BeRTOS
|
7 segments LED displays (headers) More...
Data Structures | |
struct | SevenSeg |
Context data for Display functions. More... | |
Defines | |
#define | CONFIG_LED_7SEG_CCAT 0 |
Use a Common Cathode display. | |
#define | CONFIG_LED_7SEG_DIGIT 4 |
Number of digit present in the LED display. | |
#define | CONFIG_LED_7SEG_STRLEN 255 |
Max lenght of the string to be displayed. | |
#define | CONFIG_LED_7SEG_SSPEED 10 |
Default scrolling speed (ms * CONFIG_LED_7SEG_RTIME). | |
#define | CONFIG_LED_7SEG_RTIME 5 |
Default refresh time (ms). | |
Functions | |
int | sevenseg_print (SevenSeg *SS, const char *sstring) |
Print a string on the display. | |
void | sevenseg_init (SevenSeg *SS) |
initialize the structure and the timer for the display | |
bool | sevenseg_isReady (SevenSeg *SS) |
check if is possible to do a new print | |
bool | sevenseg_unlock (SevenSeg *SS) |
unlock the SevenSeg structure and stops the print | |
bool | sevenseg_lock (SevenSeg *SS) |
lock the SeveSeg structure and starts a new print | |
bool | sevenseg_setBlink (SevenSeg *SS, bool blink, uint8_t digit) |
set the blinking of the digits of the display | |
bool | sevenseg_setRunonce (SevenSeg *SS, bool runonce) |
set if the text has to be displayed just one time | |
bool | sevenseg_setRunspeed (SevenSeg *SS, unsigned int r_speed) |
set the scrolling speed of the text | |
bool | sevenseg_clear (SevenSeg *SS) |
clear the display | |
Numbers and Letters Table. | |
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ., -, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, SPACE | |
static const uint8_t | segstable [] |
7 segments LED displays (headers)
Here you find the prototypes and the data structures that format and holds the text that has to be displayed by the 7 segments display.
The main function is the sevenseg_print() that is called by your software to display the text, also important is the sevenseg_init() that initialize the data structures and set the refresh timer, you need to call this procedure just one time in the init procedure of your software before any use of the sevenseg_print().
Usage:
To use succesfully the display you have to follow these steps:
When the display is locked the displaying of the text starts.
static Seven_Seg display; // ... sevenseg_init(&display); while (!sevenseg_isReady(&display)) ; sevenseg_unlock(&display); sevenseg_setBlink(&display,false,0); sevenseg_setRunonce(&display,false); sevenseg_setRunspeed(&display,10); if ((sevenseg_print(&display, "made with bertos.")) != 0) return -1; sevenseg_lock(&display);
bool sevenseg_clear | ( | SevenSeg * | SS | ) |
clear the display
This is the procedure that blanks the text to be displayed and so on clear the display.
SS | Pointer to the SevenSeg structure |
Definition at line 508 of file led_7seg.c.
void sevenseg_init | ( | SevenSeg * | SS | ) |
initialize the structure and the timer for the display
This is the procedure that inits all the structures that rules the 7 segments display and set the timer for the proper print/refresh of the text.
SS | Pointer to the SevenSeg structure |
Definition at line 325 of file led_7seg.c.
bool sevenseg_isReady | ( | SevenSeg * | SS | ) |
check if is possible to do a new print
This is the procedure that check if the print of the current text is run almost one time and we're ready to print a new text.
SS | Pointer to the SevenSeg structure |
Definition at line 364 of file led_7seg.c.
bool sevenseg_lock | ( | SevenSeg * | SS | ) |
lock the SeveSeg structure and starts a new print
This is the procedure that lock the display and permit the print of the text.
SS | Pointer to the SevenSeg structure |
Definition at line 403 of file led_7seg.c.
int sevenseg_print | ( | SevenSeg * | SS, |
const char * | sstring | ||
) |
Print a string on the display.
This is the procedure that fills the seven_seg structure with the translated string to display. It swaps also the structures to display the new text when all the data is ready to display.
SS | Pointer to the SevenSeg structure |
sstring | String to be displayed |
Definition at line 217 of file led_7seg.c.
bool sevenseg_setBlink | ( | SevenSeg * | SS, |
bool | blink, | ||
uint8_t | digit | ||
) |
set the blinking of the digits of the display
This is the procedure that set the blinking of the display. You can choose to blink all the display or only a single digit.
SS | Pointer to the SevenSeg structure |
blink | if true the display will blink |
digit | if 0 all the digits have to blink, else the digit that has to blink |
Definition at line 432 of file led_7seg.c.
bool sevenseg_setRunonce | ( | SevenSeg * | SS, |
bool | runonce | ||
) |
set if the text has to be displayed just one time
This is the procedure that set if the text has to be displayed just one time
SS | Pointer to the SevenSeg structure |
runonce | true if the text has to be displayed only one time, false if the text has to be displayed till next print |
Definition at line 464 of file led_7seg.c.
bool sevenseg_setRunspeed | ( | SevenSeg * | SS, |
unsigned int | r_speed | ||
) |
set the scrolling speed of the text
This is the procedure that set the scrolling speed of the text if the text is longer than the display digits or the duration of the display if the text is smaller or equal the length of display digits.
SS | Pointer to the SevenSeg structure |
r_speed | the Scrolling speed or display time |
Definition at line 486 of file led_7seg.c.
bool sevenseg_unlock | ( | SevenSeg * | SS | ) |
unlock the SevenSeg structure and stops the print
This is the procedure that check if the print of the current text is run almost one time and then set the status of the display to "unlocked".
SS | Pointer to the SevenSeg structure |
Definition at line 379 of file led_7seg.c.