Add lcd_draw_img_from_llfs_file and lcd_draw_gif_from_llfs_file
This commit is contained in:
2023-12-03 22:01:14 +01:00
parent 0704473bc5
commit d77fca56b7
3 changed files with 57 additions and 1 deletions

View File

@@ -3,6 +3,7 @@
* @brief LCD API implementation
* @author Tim S.
* @author Lorenz C.
* @author Sander S.
*/
#include "lcd_api.h"
@@ -169,6 +170,16 @@ void lcd_draw_img_from_fs(const char* name, uint32_t x_pos, uint32_t y_pos) {
LOG_WARN(TAG, "File \"%s\" not found", name);
}
void lcd_draw_img_from_llfs_file(llfs_file_t* file, uint32_t x_pos, uint32_t y_pos) {
LOG_INFO(TAG, "Displaying BMP image from llfs file: @x=%lu, @y=%lu", x_pos, y_pos);
BSP_LCD_SelectLayer(0);
if (file == NULL) {
LOG_WARN(TAG, "File not found");
return;
}
BSP_LCD_DrawBitmap(x_pos, y_pos, (uint8_t*)file->data);
}
void lcd_clear_text(void) {
LOG_INFO(TAG, "Clear text");
BSP_LCD_SelectLayer(1);
@@ -248,6 +259,19 @@ lcd_gif_t* lcd_draw_gif_from_fs(const char* name, uint32_t x_pos, uint32_t y_pos
return gif;
}
lcd_gif_t* lcd_draw_gif_from_llfs_file(llfs_file_t* file, uint32_t x_pos, uint32_t y_pos) {
BSP_LCD_SelectLayer(0);
lcd_gif_t* gif;
if (file == NULL) {
LOG_WARN(TAG, "File not found");
return NULL;
}
// Draw the GIF using the file data
gif = lcd_draw_gif((uint8_t*)file->data, file->len, x_pos, y_pos);
return gif;
}
void lcd_stop_gif(lcd_gif_t* gif) {
free_gif_slot(gif);
}