Add lcd_clear_text() and lcd_clear_images

This commit is contained in:
xoreo
2023-11-20 14:10:26 +01:00
parent 7f36e365ee
commit 758f1f47ca
3 changed files with 71 additions and 25 deletions

View File

@@ -104,7 +104,7 @@ void main(void) {
#### Drawing text on the screen
```c
void lcd_display_text(const char* text, uint16_t x_pos, uint16_t y_pos, uint32_t color, uint32_t bg_color, sFONT *font);
void lcd_display_text(const char* text, uint16_t x_pos, uint16_t y_pos, uint32_t color, sFONT *font);
```
```c
@@ -116,7 +116,7 @@ void main(void) {
...
lcd_init(true);
...
lcd_display_text("This is a text string.", 10, 10, LCD_GREEN, LCD_BLACK, LCD_FONT16);
lcd_display_text("This is a text string.", 10, 10, LCD_GREEN, LCD_FONT16);
}
```
Display text on the LCD screen in a certain color. When text width exceeds BSP_LCD_GetXSize(), a text wrap will be performed. If the text wrap is between two will be injected.
@@ -194,13 +194,13 @@ void main(void) {
...
lcd_init(true);
...
// From a C-array
lcd_gif_t* gif = lcd_draw_gif(gif_array, gif_size, 0, 0);
// From the filesystem
lcd_gif_t* gif = lcd_draw_gif_from_fs("st.gif", 0, 0);
if (gif == NULL) {
LOG_WARNING("GIF could not be drawn");
}
@@ -235,9 +235,9 @@ bool lcd_gif_is_playing(lcd_gif_t* gif);
```
NOTE: It is possible that the GIF has stopped playing, but another GIF has taken its slot and is still playing.
#### Clearing the LCD screen
#### Clearing the text on the LCD screen
```c
void lcd_clear(uint32_t color);
void lcd_clear_text(void);
```
```c
@@ -246,9 +246,29 @@ void lcd_clear(uint32_t color);
void main(void) {
...
lcd_init(true);
lcd_display_text("Hello world!", 0, 0, LCD_GREEN, LCD_FONT20);
...
lcd_clear(LCD_BLACK);
lcd_clear_text();
}
```
Clears the LCD screen to the specified color.
Clears all text strings on the LCD screen.
#### Clearing the images on the LCD screen
```c
void lcd_clear_images(void);
```
```c
#include "lcd_api.h"
void main(void) {
...
lcd_init(true);
lcd_draw_img_from_fs("st.bmp", 300, 100);
...
lcd_clear_images();
}
```
Clears all text strings on the LCD screen.