-
Notifications
You must be signed in to change notification settings - Fork 248
Open
Description
Hello there!
I've been using this library a lot for a project of mine. I just wanted to share two additional functions that I've been using a lot and might be worth integrating into the main program. They are very lightweight and don't require modifications.
void ssd1306_SetCursor_WriteString(const char* str, ssd1306_Font_t font,
ssd1306_COLOR color,
uint8_t x_align,
uint8_t y_align){
ssd1306_SetCursor(x_align, y_align);
ssd1306_WriteString(str, font , color);
}
Very simple but very effective when writing text to avoid making pairings SetCursor WriteString all the time.
void ssd1306_underline_WriteString(const char* str, ssd1306_Font_t font,
ssd1306_COLOR color,
uint8_t x_align,
uint8_t y_align,
uint8_t underlined){
uint8_t line_height = font.height +1;
ssd1306_SetCursor(x_align, y_align);
ssd1306_WriteString(str, font , color);
if(underlined == 1){
ssd1306_SetCursor(x_align, y_align +1);
uint8_t line_length = font.width * strlen(str);
screen_driver_Line(x_align, y_align + line_height,
x_align+ line_length, y_align + line_height, White);
}
}
This one draws an underline based on the value of an int. Very useful to make menuing for selecting different items.
Hope this helps!
Ilyhadev and wu144053
Metadata
Metadata
Assignees
Labels
No labels