61 lines
1.2 KiB
C
61 lines
1.2 KiB
C
/**
|
|
* @brief Led Controller module
|
|
* @details This file outputs a byte of data to the pins for led indication.
|
|
* @author Jake G
|
|
* @date 2024-08-21
|
|
* @copyright None
|
|
* @file LEDCONTROLLER.h
|
|
*/
|
|
|
|
#ifndef LEDCONTROLLER
|
|
#define LEDCONTROLLER
|
|
|
|
#include <stdint.h>
|
|
#include "stdbool.h"
|
|
|
|
|
|
/**
|
|
* A structure representing an LED
|
|
*/
|
|
typedef struct Led
|
|
{
|
|
uint8_t *port;
|
|
uint8_t pin_num;
|
|
bool state;
|
|
}Led;
|
|
|
|
|
|
/**
|
|
* Sets the default PORTB pins for output.
|
|
*/
|
|
void LedControler_SetPortADefault(void);
|
|
|
|
/**
|
|
* Sets the default PORTA pins for output.
|
|
*/
|
|
void LedControler_SetPortBDefault(void);
|
|
|
|
/**
|
|
* Allows the setting or changing of which pins represent which bits.
|
|
* @param port The address of the port.
|
|
* @param pin The pin number for the port.
|
|
* @param bit The bit that the pin should represent.
|
|
*/
|
|
void LedController_SetLedBitNum(void *port, uint8_t pin, uint8_t bit);
|
|
|
|
/**
|
|
* Displays the byte of data via led pins.
|
|
*/
|
|
void LedController_ShowByte(uint8_t byte);
|
|
|
|
/**
|
|
* Displays the the first 4 bits of a byte.
|
|
*/
|
|
void LedControler_ShowHalfByte(uint8_t byte);
|
|
|
|
/**
|
|
* Clears out the halfbyte led representation
|
|
*/
|
|
void LedControler_ClearHalfByte(void);
|
|
|
|
#endif // LEDCONTROLLER
|