embedded-software
reusable software modules for embedded systems
|
The Seven Seg Module allows for values to be displayed on a seven segment display. More...
Functions | |
void | SevenSeg_Init (void) |
Initialize the Seven Seg Module. More... | |
void | SevenSeg_DisplayHex (uint16_t value) |
Displays value on seven seg in Hex. More... | |
void | SevenSeg_DisplayRaw (uint8_t seg0, uint8_t seg1, uint8_t seg2, uint8_t seg3) |
Displays individual parameters on up to four seven segment displays. More... | |
void | SevenSeg_DisplayFloat (float value) |
Displays float value on seven seg in decimal. More... | |
uint16_t | SevenSeg_BCD (uint16_t value) |
Converts binary number (uint16_t) to BCD format. More... | |
void | UpdateDisplay (void) |
updates static variables and displays on hex task-compatible function void function to easily display values on display using scheduled tasks Calls hal_Display to display current value of static variables More... | |
The Seven Seg Module allows for values to be displayed on a seven segment display.
What Module Does: This module provides functions to populate up to four seven segment displays. Available functions allow for four displays to be populated based on a singular 16-bit uint16_t input as well as 4 individual 8-bit uint8_t inputs.
How To Use Module: Call SevenSeg_Init() to initialize the module. Once initialized, calling SevenSeg_DisplayHex(), SevenSeg_DisplayRaw() or SevenSeg_DisplayFloat() will populate four seven segment displays based on the function inputs. These functions will only be run once, flashing the input on the display. To make a persistently readable number, run function in a while loop. Alternatively, if you run UpdateDisplay as a scheduled task, the displays will be constantly populated, and the inputs can be changed using any of the other functions.
uint16_t SevenSeg_BCD | ( | uint16_t | value | ) |
Converts binary number (uint16_t) to BCD format.
Converts unint16_t input from its binary encoding to BCD format
value | binary input that will be converted to BCD format (BCD - Binary Coded Decimal) |
void SevenSeg_DisplayFloat | ( | float | value | ) |
Displays float value on seven seg in decimal.
This function will convert a 32-bit float input into a 4 digit decimal number from 0000 to 9999. This number will then be displayed on up to four seven segment displays. Max decimal input: 9999 Will take the most significant 4 digits i.e. 9998.5 will display 9998, 85.123 will display 85.12
value | float that will be displayed in up to 4 seven segment display in decimal |
void SevenSeg_DisplayHex | ( | uint16_t | value | ) |
Displays value on seven seg in Hex.
This function will convert a 16-bit input into a 4 digit HEX number from 0000 to FFFF. This number will then be displayed on up to four seven segment displays. Max decimal input: 65535
value | number that will be displayed in up to 4 seven segment display in HEX |
void SevenSeg_DisplayRaw | ( | uint8_t | seg0, |
uint8_t | seg1, | ||
uint8_t | seg2, | ||
uint8_t | seg3 | ||
) |
Displays individual parameters on up to four seven segment displays.
This function will take four uint8_t values and display them across four respective seven segment displays. Currently only supports whole numbers 0 to F as parameters.
seg0 | number to be displayed in the left most display |
seg1 | number to be displayed in the second display from the left |
seg2 | number to be displayed in the third display from the left |
seg3 | number to be displayed in the right most display |
void SevenSeg_Init | ( | void | ) |
Initialize the Seven Seg Module.
Initializes the seven segment module for operation. Calls hal_seven_seg_Init() which can be found in the hal_seven_seg.c file for the respective MCU being used. Initializes all display values to 0s.
void UpdateDisplay | ( | void | ) |
updates static variables and displays on hex task-compatible function void function to easily display values on display using scheduled tasks Calls hal_Display to display current value of static variables