Merge branch 'main' into UDP-broadcast

This commit is contained in:
joran2738
2023-11-13 18:17:24 +01:00
27 changed files with 7082 additions and 3347 deletions

File diff suppressed because it is too large Load Diff

107
project/Core/Inc/lcd_api.h Normal file
View File

@@ -0,0 +1,107 @@
/**
* @file lcd_api.h
* @brief API for LCD functionality
* @author Tim S.
*/
#ifndef INC_LCD_API_H_
#define INC_LCD_API_H_
#include <stdbool.h>
#include <string.h>
#include <ctype.h>
#define LOGGER_LEVEL_ALL
#include "log.h"
#include "../../Drivers/BSP/STM32746G-Discovery/stm32746g_discovery_lcd.h"
#define LCD_BLUE LCD_COLOR_BLUE
#define LCD_GREEN LCD_COLOR_GREEN
#define LCD_RED LCD_COLOR_RED
#define LCD_CYAN LCD_COLOR_CYAN
#define LCD_MAGENTA LCD_COLOR_MAGENTA
#define LCD_YELLOW LCD_COLOR_YELLOW
#define LCD_LIGHTBLUE LCD_COLOR_LIGHTBLUE
#define LCD_LIGHTGREEN LCD_COLOR_LIGHTGREEN
#define LCD_LIGHTRED LCD_COLOR_LIGHTRED
#define LCD_LIGHTCYAN LCD_COLOR_LIGHTCYAN
#define LCD_LIGHTMAGENTA LCD_COLOR_LIGHTMAGENTA
#define LCD_LIGHTYELLOW LCD_COLOR_LIGHTYELLOW
#define LCD_DARKBLUE LCD_COLOR_DARKBLUE
#define LCD_DARKGREEN LCD_COLOR_DARKGREEN
#define LCD_DARKRED LCD_COLOR_DARKRED
#define LCD_DARKCYAN LCD_COLOR_DARKCYAN
#define LCD_DARKMAGENTA LCD_COLOR_DARKMAGENTA
#define LCD_DARKYELLOW LCD_COLOR_DARKYELLOW
#define LCD_WHITE LCD_COLOR_WHITE
#define LCD_LIGHTGRAY LCD_COLOR_LIGHTGRAY
#define LCD_GRAY LCD_COLOR_GRAY
#define LCD_DARKGRAY LCD_COLOR_DARKGRAY
#define LCD_BLACK LCD_COLOR_BLACK
#define LCD_BROWN LCD_COLOR_BROWN
#define LCD_ORANGE LCD_COLOR_ORANGE
#define LCD_TRANSPARENT LCD_COLOR_TRANSPARENT
#define LCD_ARGB8888 0x00000000U
#define LCD_RGB888 0x00000001U
#define LCD_RGB565 0x00000002U
#define LCD_ARGB1555 0x00000003U
#define LCD_FONT8 &Font8
#define LCD_FONT12 &Font12
#define LCD_FONT16 &Font16
#define LCD_FONT20 &Font20
#define LCD_FONT24 &Font24
extern LTDC_HandleTypeDef hLtdcHandler;
/**
* @brief Initialise LCD
* Initialise the LCD screen with BackLight on or not
*
* @param[in] bl_on Bool to enable or disable the LCD backlight
*
*/
void lcd_init(bool bl_on);
/**
* @brief Display text
* 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 letters in a word, the '-' character
* will be injected.
*
* @param[in] text C-style text string to display on the LCD screen
* @param[in] x_pos X-position
* @param[in] y_pos Y-position
* @param[in] color Color in which the text will be displayed, see preset colors in defines above
* @param[in] bg_color Background color for the text
* @param[in] font Font size, see defines above in file
*/
void lcd_display_text(uint8_t* text, uint16_t x_pos, uint16_t y_pos, uint32_t color, uint32_t bg_color, sFONT *font);
/**
* @brief Draw BMP image on screen
* Draw BMP image from C array to the LCD screen at position X, Y. In color mode ARGB8888, RGB888, RGB565 or ARGB1555
* Supports ARGB8888, RGB565, RGB888
*
* @author Wim Dams
*
* @param[in] p_src C array containing the image data
* @param[in] x_pos X-position
* @param[in] y_pos Y-position
* @param[in] x_size Width of image
* @param[in] y_size Height of image
* @param[in] color_mode Color mode (see defined color modes above in file)
*/
void lcd_draw_bmp(const void* p_src, uint32_t x_pos, uint32_t y_pos, uint32_t x_size, uint32_t y_size, uint32_t color_mode);
/**
* @brief Clear LCD screen
* Clears the whole LCD screen to the desired color
*
*@param[in] color Color to which the LCD should be cleared
*/
void lcd_clear(uint32_t color);
#endif /* INC_LCD_API_H_ */

View File

@@ -2,6 +2,7 @@
* @file llfs.h
* @brief Linked List Filesystem header (llfs)
* @author Lorenz C.
* @version 0.1.1
*/
#ifndef LLFS_H
@@ -30,20 +31,25 @@ struct llfs_data_file {
const struct llfs_data_file* next;
};
/**
* @brief Initialize the llfs filesystem
* @note This function should be called before any other llfs function or POSIX file operation (e.g. fopen, fread, ...)
* @return 0 on success
*/
int8_t llfs_init(void);
/**
* @brief Get a list of files in the filesystem
* Get a list of all the files in the filesystem.
*
* Use the filter to filter out files with a filename that do not match the filter. (e.g. "*.txt" or "*.png|*.jpg") (not
* implemented yet) Multiple filters can be used by separating them with a pipe (|).
* Use the filter to filter out files with a filename that do not match the file extension filter.
*
* The following members of the llfs_file_t struct are set: name, len and data. @ref llfs_file_t
*
* @todo Implement file filter
*
* @param[out] file_list A pointer to an array of llfs_file_t to store the files in @ref llfs_file_t
* @param[in] max_files The maximum number of files to return (size of file_list)
* @param[in] filter A string with file extensions to filter out. (e.g. "*.txt" or "*.png|*.jpg")
* @param[in] filter A string with the file extensions to filter out. (e.g. "*.txt" or "*.png")
* @return The number of files returned
*/
size_t llfs_file_list(llfs_file_t* file_list, size_t max_files, char* filter);
@@ -58,4 +64,23 @@ size_t llfs_file_list(llfs_file_t* file_list, size_t max_files, char* filter);
*/
llfs_file_t* llfs_file_open(const char* name);
/**
* @brief Iterate over all files in the filesystem
* For each call (with the same mem pointer) the next file in the filesystem is returned.
* The first call should be with mem = NULL.
* If a filter is specified, only files with a filename that matches the filter are returned.
*
* @param[in, out] mem A pointer to a void* that is used internally to keep track of the current file
* @param[in] filter A string with file extension to filter out. (e.g. "*.txt" or "*.png")
* @return The next file in the filesystem or NULL if there are no more files @ref llfs_file_t
*/
llfs_file_t* llfs_next_file(void** mem, char* filter);
/**
* @brief Get the number of files in the filesystem
*
* @return The number of files in the filesystem
*/
size_t llfs_file_count(void);
#endif // LLFS_H

View File

@@ -31,6 +31,7 @@ extern "C" {
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "../../Drivers/BSP/STM32746G-Discovery/stm32746g_discovery_lcd.h"
/* USER CODE END Includes */