lcd_api
Add lcd_draw_img_from_llfs_file and lcd_draw_gif_from_llfs_file
This commit is contained in:
@@ -145,6 +145,16 @@ void lcd_draw_bmp_img(uint8_t* bmp_buff, uint32_t x_pos, uint32_t y_pos);
|
||||
*/
|
||||
void lcd_draw_img_from_fs(const char* name, uint32_t x_pos, uint32_t y_pos);
|
||||
|
||||
/**
|
||||
* @brief Draw BMP image on screen by specifying the llfs_file_t, the BMP image has in the file system
|
||||
* Draw BMP image from C array to the LCD screen at position X, Y by specifying the BMP image name on the filesystem
|
||||
* Supports ARGB8888, RGB565, RGB888
|
||||
*
|
||||
* @param file pointer to the llfs_file_t
|
||||
* @param x_pos X-position
|
||||
* @param y_pos Y-position
|
||||
*/
|
||||
void lcd_draw_img_from_llfs_file(llfs_file_t* file, uint32_t x_pos, uint32_t y_pos);
|
||||
/**
|
||||
* @brief Clear LCD text
|
||||
* Clears the text drawn on the LCD screen
|
||||
@@ -201,6 +211,19 @@ lcd_gif_t* lcd_draw_gif(uint8_t* src, size_t size, uint32_t x_pos, uint32_t y_po
|
||||
*/
|
||||
lcd_gif_t* lcd_draw_gif_from_fs(const char* name, uint32_t x_pos, uint32_t y_pos);
|
||||
|
||||
/**
|
||||
* @brief Draw GIF image on screen from filesystem
|
||||
* Draw GIF image from filesystem to the LCD screen at position X, Y
|
||||
* @warning If the GIF has a loop count specified, it will stop after the specified amount of loops and the lcd_git_t handle will be invalidated
|
||||
* @note Before drawing over a GIF, make sure to call lcd_stop_gif(), otherwise the GIF will keep overwriting the screen
|
||||
*
|
||||
* @param file The pointer to the llfs_file_t
|
||||
* @param x_pos The X position on the screen
|
||||
* @param y_pos The Y position on the screen
|
||||
* @return lcd_gif_t* A handle to the GIF image, NULL if the GIF could not be opened
|
||||
*/
|
||||
lcd_gif_t* lcd_draw_gif_from_llfs_file(llfs_file_t* file, uint32_t x_pos, uint32_t y_pos);
|
||||
|
||||
/**
|
||||
* @brief Stop a GIF from playing
|
||||
* Frees the GIF slot and stops the GIF from playing
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user