clangformat everything

This commit is contained in:
2023-12-23 20:37:34 +01:00
parent e19e7c9253
commit e5273c7012
29 changed files with 251186 additions and 298341 deletions

View File

@@ -20,22 +20,24 @@
#include "lcd_api.h"
// Defines used by UDP callback
#define UDP_BROADCAST_MAX_DATA_SIZE ((UDP_BROADCAST_MAX_NAME_SIZE * 2) - 2 + 25) // Define the maximum expected data size
#define UDP_BROADCAST_UDP_QUESTION1 "Where are you?v1.0" // Expected question from UDP client
#define UDP_BROADCAST_MAX_FUNC_LEN 7
#define UDP_BROADCAST_MAX_DATA_SIZE \
((UDP_BROADCAST_MAX_NAME_SIZE * 2) - 2 + 25) // Define the maximum expected data size
#define UDP_BROADCAST_UDP_QUESTION1 "Where are you?v1.0" // Expected question from UDP client
#define UDP_BROADCAST_MAX_FUNC_LEN 7
#define UDP_BROADCAST_MAX_COLON_COMMA_COUNT 4
// Defines used by owner details
#define UDP_BROADCAST_MAX_REPLY_SIZE (UDP_BROADCAST_MAX_MAC_ADDR_LEN + sizeof(UDP_BROADCAST_REPLY_MIDDLE_TEXT) + (UDP_BROADCAST_MAX_NAME_SIZE * 2) + UDP_BROADCAST_MAX_REPLY_SIZE_EXTRA)
#define UDP_BROADCAST_MAX_REPLY_SIZE \
(UDP_BROADCAST_MAX_MAC_ADDR_LEN + sizeof(UDP_BROADCAST_REPLY_MIDDLE_TEXT) + (UDP_BROADCAST_MAX_NAME_SIZE * 2) \
+ UDP_BROADCAST_MAX_REPLY_SIZE_EXTRA)
#define UDP_BROADCAST_REPLY_MIDDLE_TEXT "is present and my owner is"
#define UDP_BROADCAST_MAX_MAC_ADDR_LEN 19 // Format is: "xx:xx:xx:xx:xx:xx"
#define UDP_BROADCAST_MAX_NAME_SIZE 21 // Code automatically leaves 1 char for '\0' (actual length = length - 1)
#define UDP_BROADCAST_MAX_REPLY_SIZE_EXTRA 20 // Just a bit extra
#define UDP_BROADCAST_MAX_MAC_ADDR_LEN 19 // Format is: "xx:xx:xx:xx:xx:xx"
#define UDP_BROADCAST_MAX_NAME_SIZE 21 // Code automatically leaves 1 char for '\0' (actual length = length - 1)
#define UDP_BROADCAST_MAX_REPLY_SIZE_EXTRA 20 // Just a bit extra
#define UDP_BROADCAST_LCD_NAME_PRE_TEXT "New owner: "
#define UDP_BROADCAST_LCD_TEXT_SIZE (strlen(UDP_BROADCAST_LCD_NAME_PRE_TEXT) + UDP_BROADCAST_MAX_NAME_SIZE)
#define UDP_BROADCAST_LCD_TEXT_SIZE (strlen(UDP_BROADCAST_LCD_NAME_PRE_TEXT) + UDP_BROADCAST_MAX_NAME_SIZE)
/**
* @struct owner_details_t

View File

@@ -13,10 +13,10 @@
#ifndef __ANIMATEDGIF__
#define __ANIMATEDGIF__
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define memcpy_P memcpy
#define PROGMEM
@@ -39,9 +39,9 @@
// with 256 entries
//
#define MAX_CODE_SIZE 12
#define MAX_COLORS 256
#define LZW_BUF_SIZE (6*MAX_CHUNK_SIZE)
#define LZW_HIGHWATER (4*MAX_CHUNK_SIZE)
#define MAX_COLORS 256
#define LZW_BUF_SIZE (6 * MAX_CHUNK_SIZE)
#define LZW_HIGHWATER (4 * MAX_CHUNK_SIZE)
#ifdef __LINUX__
#define MAX_WIDTH 2048
#else
@@ -50,13 +50,13 @@
// This buffer is used to store the pixel sequence in reverse order
// it needs to be large enough to hold the longest possible
// sequence (1<<MAX_CODE_SIZE)
#define FILE_BUF_SIZE (1<<MAX_CODE_SIZE)
#define FILE_BUF_SIZE (1 << MAX_CODE_SIZE)
#define PIXEL_FIRST 0
#define PIXEL_LAST (1<<MAX_CODE_SIZE)
#define PIXEL_LAST (1 << MAX_CODE_SIZE)
#define LINK_UNUSED 5911 // 0x1717 to use memset
#define LINK_END 5912
#define MAX_HASH 5003
#define LINK_END 5912
#define MAX_HASH 5003
enum {
GIF_PALETTE_RGB565_LE = 0, // little endian (default)
@@ -65,16 +65,13 @@ enum {
};
// for compatibility with older code
#define LITTLE_ENDIAN_PIXELS GIF_PALETTE_RGB565_LE
#define BIG_ENDIAN_PIXELS GIF_PALETTE_RGB565_BE
#define BIG_ENDIAN_PIXELS GIF_PALETTE_RGB565_BE
//
// Draw callback pixel type
// RAW = 8-bit palettized pixels requiring transparent pixel handling
// COOKED = 16 or 24-bpp fully rendered pixels ready for display
//
enum {
GIF_DRAW_RAW = 0,
GIF_DRAW_COOKED
};
enum { GIF_DRAW_RAW = 0, GIF_DRAW_COOKED };
enum {
GIF_SUCCESS = 0,
@@ -89,134 +86,136 @@ enum {
GIF_ERROR_MEMORY
};
typedef struct gif_file_tag
{
int32_t iPos; // current file position
int32_t iSize; // file size
uint8_t *pData; // memory file pointer
void * fHandle; // class pointer to File/SdFat or whatever you want
typedef struct gif_file_tag {
int32_t iPos; // current file position
int32_t iSize; // file size
uint8_t* pData; // memory file pointer
void* fHandle; // class pointer to File/SdFat or whatever you want
} GIFFILE;
typedef struct gif_info_tag
{
typedef struct gif_info_tag {
int32_t iFrameCount; // total frames in file
int32_t iDuration; // duration of animation in milliseconds
int32_t iMaxDelay; // maximum frame delay
int32_t iMinDelay; // minimum frame delay
int32_t iDuration; // duration of animation in milliseconds
int32_t iMaxDelay; // maximum frame delay
int32_t iMinDelay; // minimum frame delay
} GIFINFO;
typedef struct gif_draw_tag
{
int iX, iY; // Corner offset of this frame on the canvas
int y; // current line being drawn (0 = top line of image)
int iWidth, iHeight; // size of this frame
void *pUser; // user supplied pointer
uint8_t *pPixels; // 8-bit source pixels for this line
uint16_t *pPalette; // little or big-endian RGB565 palette entries (default)
uint8_t *pPalette24; // RGB888 palette (optional)
uint8_t ucTransparent; // transparent color
typedef struct gif_draw_tag {
int iX, iY; // Corner offset of this frame on the canvas
int y; // current line being drawn (0 = top line of image)
int iWidth, iHeight; // size of this frame
void* pUser; // user supplied pointer
uint8_t* pPixels; // 8-bit source pixels for this line
uint16_t* pPalette; // little or big-endian RGB565 palette entries (default)
uint8_t* pPalette24; // RGB888 palette (optional)
uint8_t ucTransparent; // transparent color
uint8_t ucHasTransparency; // flag indicating the transparent color is in use
uint8_t ucDisposalMethod; // frame disposal method
uint8_t ucBackground; // background color
uint8_t ucDisposalMethod; // frame disposal method
uint8_t ucBackground; // background color
uint8_t ucIsGlobalPalette; // Flag to indicate that a global palette, rather than a local palette is being used
} GIFDRAW;
// Callback function prototypes
typedef int32_t (GIF_READ_CALLBACK)(GIFFILE *pFile, uint8_t *pBuf, int32_t iLen);
typedef int32_t (GIF_SEEK_CALLBACK)(GIFFILE *pFile, int32_t iPosition);
typedef void (GIF_DRAW_CALLBACK)(GIFDRAW *pDraw);
typedef void * (GIF_OPEN_CALLBACK)(const char *szFilename, int32_t *pFileSize);
typedef void (GIF_CLOSE_CALLBACK)(void *pHandle);
typedef void * (GIF_ALLOC_CALLBACK)(uint32_t iSize);
typedef void (GIF_FREE_CALLBACK)(void *buffer);
typedef int32_t(GIF_READ_CALLBACK)(GIFFILE* pFile, uint8_t* pBuf, int32_t iLen);
typedef int32_t(GIF_SEEK_CALLBACK)(GIFFILE* pFile, int32_t iPosition);
typedef void(GIF_DRAW_CALLBACK)(GIFDRAW* pDraw);
typedef void*(GIF_OPEN_CALLBACK)(const char* szFilename, int32_t* pFileSize);
typedef void(GIF_CLOSE_CALLBACK)(void* pHandle);
typedef void*(GIF_ALLOC_CALLBACK)(uint32_t iSize);
typedef void(GIF_FREE_CALLBACK)(void* buffer);
//
// our private structure to hold a GIF image decode state
//
typedef struct gif_image_tag
{
typedef struct gif_image_tag {
int iWidth, iHeight, iCanvasWidth, iCanvasHeight;
int iX, iY; // GIF corner offset
int iBpp;
int iError; // last error
int iFrameDelay; // delay in milliseconds for this frame
int iRepeatCount; // NETSCAPE animation repeat count. 0=forever
int iError; // last error
int iFrameDelay; // delay in milliseconds for this frame
int iRepeatCount; // NETSCAPE animation repeat count. 0=forever
int iXCount, iYCount; // decoding position in image (countdown values)
int iLZWOff; // current LZW data offset
int iLZWSize; // current quantity of data in the LZW buffer
int iCommentPos; // file offset of start of comment data
short sCommentLen; // length of comment
GIF_READ_CALLBACK *pfnRead;
GIF_SEEK_CALLBACK *pfnSeek;
GIF_DRAW_CALLBACK *pfnDraw;
GIF_OPEN_CALLBACK *pfnOpen;
GIF_CLOSE_CALLBACK *pfnClose;
int iLZWOff; // current LZW data offset
int iLZWSize; // current quantity of data in the LZW buffer
int iCommentPos; // file offset of start of comment data
short sCommentLen; // length of comment
GIF_READ_CALLBACK* pfnRead;
GIF_SEEK_CALLBACK* pfnSeek;
GIF_DRAW_CALLBACK* pfnDraw;
GIF_OPEN_CALLBACK* pfnOpen;
GIF_CLOSE_CALLBACK* pfnClose;
GIFFILE GIFFile;
void *pUser;
unsigned char *pFrameBuffer;
void* pUser;
unsigned char* pFrameBuffer;
unsigned char *pPixels, *pOldPixels;
unsigned char ucLineBuf[MAX_WIDTH]; // current line
unsigned char ucFileBuf[FILE_BUF_SIZE]; // holds temp data and pixel stack
unsigned short pPalette[(MAX_COLORS * 3)/2]; // can hold RGB565 or RGB888 - set in begin()
unsigned short pLocalPalette[(MAX_COLORS * 3)/2]; // color palettes for GIF images
unsigned char ucLZW[LZW_BUF_SIZE]; // holds 6 chunks (6x255) of GIF LZW data packed together
unsigned short usGIFTable[1<<MAX_CODE_SIZE];
unsigned char ucGIFPixels[(PIXEL_LAST*2)];
unsigned char ucLineBuf[MAX_WIDTH]; // current line
unsigned char ucFileBuf[FILE_BUF_SIZE]; // holds temp data and pixel stack
unsigned short pPalette[(MAX_COLORS * 3) / 2]; // can hold RGB565 or RGB888 - set in begin()
unsigned short pLocalPalette[(MAX_COLORS * 3) / 2]; // color palettes for GIF images
unsigned char ucLZW[LZW_BUF_SIZE]; // holds 6 chunks (6x255) of GIF LZW data packed together
unsigned short usGIFTable[1 << MAX_CODE_SIZE];
unsigned char ucGIFPixels[(PIXEL_LAST * 2)];
unsigned char bEndOfFrame;
unsigned char ucGIFBits, ucBackground, ucTransparent, ucCodeStart, ucMap, bUseLocalPalette;
unsigned char ucPaletteType; // RGB565 or RGB888
unsigned char ucDrawType; // RAW or COOKED
unsigned char ucDrawType; // RAW or COOKED
} GIFIMAGE;
#ifdef __cplusplus
//
// The GIF class wraps portable C code which does the actual work
//
class AnimatedGIF
{
class AnimatedGIF {
public:
int open(uint8_t *pData, int iDataSize, GIF_DRAW_CALLBACK *pfnDraw);
int openFLASH(uint8_t *pData, int iDataSize, GIF_DRAW_CALLBACK *pfnDraw);
int open(const char *szFilename, GIF_OPEN_CALLBACK *pfnOpen, GIF_CLOSE_CALLBACK *pfnClose, GIF_READ_CALLBACK *pfnRead, GIF_SEEK_CALLBACK *pfnSeek, GIF_DRAW_CALLBACK *pfnDraw);
int open(uint8_t* pData, int iDataSize, GIF_DRAW_CALLBACK* pfnDraw);
int openFLASH(uint8_t* pData, int iDataSize, GIF_DRAW_CALLBACK* pfnDraw);
int open(const char* szFilename,
GIF_OPEN_CALLBACK* pfnOpen,
GIF_CLOSE_CALLBACK* pfnClose,
GIF_READ_CALLBACK* pfnRead,
GIF_SEEK_CALLBACK* pfnSeek,
GIF_DRAW_CALLBACK* pfnDraw);
void close();
void reset();
void begin(unsigned char ucPaletteType = GIF_PALETTE_RGB565_LE);
void begin(int iEndian, unsigned char ucPaletteType) { begin(ucPaletteType); };
int playFrame(bool bSync, int *delayMilliseconds, void *pUser = NULL);
void begin(int iEndian, unsigned char ucPaletteType) {
begin(ucPaletteType);
};
int playFrame(bool bSync, int* delayMilliseconds, void* pUser = NULL);
int getCanvasWidth();
int allocFrameBuf(GIF_ALLOC_CALLBACK *pfnAlloc);
int allocFrameBuf(GIF_ALLOC_CALLBACK* pfnAlloc);
int setDrawType(int iType);
int freeFrameBuf(GIF_FREE_CALLBACK *pfnFree);
uint8_t *getFrameBuf();
int freeFrameBuf(GIF_FREE_CALLBACK* pfnFree);
uint8_t* getFrameBuf();
int getCanvasHeight();
int getLoopCount();
int getInfo(GIFINFO *pInfo);
int getInfo(GIFINFO* pInfo);
int getLastError();
int getComment(char *destBuffer);
int getComment(char* destBuffer);
private:
GIFIMAGE _gif;
};
#else
// C interface
int GIF_openRAM(GIFIMAGE *pGIF, uint8_t *pData, int iDataSize, GIF_DRAW_CALLBACK *pfnDraw);
int GIF_openFile(GIFIMAGE *pGIF, const char *szFilename, GIF_DRAW_CALLBACK *pfnDraw);
void GIF_close(GIFIMAGE *pGIF);
void GIF_begin(GIFIMAGE *pGIF, unsigned char ucPaletteType);
void GIF_reset(GIFIMAGE *pGIF);
int GIF_playFrame(GIFIMAGE *pGIF, int *delayMilliseconds, void *pUser);
int GIF_getCanvasWidth(GIFIMAGE *pGIF);
int GIF_getCanvasHeight(GIFIMAGE *pGIF);
int GIF_getComment(GIFIMAGE *pGIF, char *destBuffer);
int GIF_getInfo(GIFIMAGE *pGIF, GIFINFO *pInfo);
int GIF_getLastError(GIFIMAGE *pGIF);
int GIF_getLoopCount(GIFIMAGE *pGIF);
int GIF_openRAM(GIFIMAGE* pGIF, uint8_t* pData, int iDataSize, GIF_DRAW_CALLBACK* pfnDraw);
int GIF_openFile(GIFIMAGE* pGIF, const char* szFilename, GIF_DRAW_CALLBACK* pfnDraw);
void GIF_close(GIFIMAGE* pGIF);
void GIF_begin(GIFIMAGE* pGIF, unsigned char ucPaletteType);
void GIF_reset(GIFIMAGE* pGIF);
int GIF_playFrame(GIFIMAGE* pGIF, int* delayMilliseconds, void* pUser);
int GIF_getCanvasWidth(GIFIMAGE* pGIF);
int GIF_getCanvasHeight(GIFIMAGE* pGIF);
int GIF_getComment(GIFIMAGE* pGIF, char* destBuffer);
int GIF_getInfo(GIFIMAGE* pGIF, GIFINFO* pInfo);
int GIF_getLastError(GIFIMAGE* pGIF);
int GIF_getLoopCount(GIFIMAGE* pGIF);
#endif // __cplusplus
// Due to unaligned memory causing an exception, we have to do these macros the slow way
#define INTELSHORT(p) ((*p) + (*(p+1)<<8))
#define INTELLONG(p) ((*p) + (*(p+1)<<8) + (*(p+2)<<16) + (*(p+3)<<24))
#define MOTOSHORT(p) (((*(p))<<8) + (*(p+1)))
#define MOTOLONG(p) (((*p)<<24) + ((*(p+1))<<16) + ((*(p+2))<<8) + (*(p+3)))
#define INTELSHORT(p) ((*p) + (*(p + 1) << 8))
#define INTELLONG(p) ((*p) + (*(p + 1) << 8) + (*(p + 2) << 16) + (*(p + 3) << 24))
#define MOTOSHORT(p) (((*(p)) << 8) + (*(p + 1)))
#define MOTOLONG(p) (((*p) << 24) + ((*(p + 1)) << 16) + ((*(p + 2)) << 8) + (*(p + 3)))
// Must be a 32-bit target processor
#define REGISTER_WIDTH 32

View File

@@ -7,15 +7,15 @@
#ifndef INC_LCD_API_H_
#define INC_LCD_API_H_
#include <ctype.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"
#include "llfs.h"
#include "gifdec.h"
#include "llfs.h"
#include "log.h"
/**
* @brief The maximum amount of GIFs that can be displayed at the same time
@@ -23,46 +23,45 @@
*/
#define LCD_MAX_GIFS 5
#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_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_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)
#define LCD_FONT8 (&Font8)
#define LCD_FONT12 (&Font12)
#define LCD_FONT16 (&Font16)
#define LCD_FONT20 (&Font20)
#define LCD_FONT24 (&Font24)
extern LTDC_HandleTypeDef hLtdcHandler;
extern LTDC_HandleTypeDef hLtdcHandler;
typedef struct {
GIFIMAGE gif;
@@ -105,7 +104,7 @@ void lcd_task(void);
* @param[in] bg_color Text background color
* @param[in] font Font size, see defines above in file
*/
void lcd_display_text(const char* text, uint32_t x_pos, uint32_t y_pos, uint32_t color, uint32_t bg_color, sFONT *font);
void lcd_display_text(const char* text, uint32_t x_pos, uint32_t y_pos, uint32_t color, uint32_t bg_color, sFONT* font);
/**
* @brief Draw BMP image on screen
@@ -121,7 +120,12 @@ void lcd_display_text(const char* text, uint32_t x_pos, uint32_t y_pos, uint32_t
* @param[in] y_size Height of image
* @param[in] color_mode Color mode (see defined color modes above in file)
*/
void lcd_draw_raw_img(const void* p_src, uint32_t x_pos, uint32_t y_pos, uint32_t x_size, uint32_t y_size, uint32_t color_mode);
void lcd_draw_raw_img(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 Draw BMP image on screen
@@ -148,8 +152,8 @@ 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
*
* Supports ARGB8888, RGB565, RGB888
*
* @param file pointer to the llfs_file_t
* @param x_pos X-position
* @param y_pos Y-position
@@ -187,7 +191,8 @@ void lcd_stop_all_gifs(void);
/**
* @brief Draw GIF image on screen from memory
* Draw GIF image from memory 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_gif_t handle will be invalid for further use
* @warning If the GIF has a loop count specified, it will stop after the specified amount of loops and the lcd_gif_t
* handle will be invalid for further use
* @note Before drawing over a GIF, make sure to call lcd_stop_gif(), otherwise the GIF will keep overwriting the screen
*
* @param src Pointer to the GIF image data
@@ -201,7 +206,8 @@ lcd_gif_t* lcd_draw_gif(uint8_t* src, size_t size, uint32_t x_pos, uint32_t y_po
/**
* @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
* @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 name The filename of the GIF image
@@ -212,11 +218,12 @@ 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
* @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
*
* @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

View File

@@ -11,8 +11,8 @@
#ifndef LOG_H
#define LOG_H
#include <stdint.h>
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/times.h>
@@ -52,24 +52,24 @@
#define CLEAR_SCREEN "\033c"
#define CURSOR_RESET ANSI_ESC "[H"
#define CURSOR_UP(n) ANSI_ESC "[" #n "A"
#define CURSOR_DOWN(n) ANSI_ESC "[" #n "B"
#define CURSOR_RIGHT(n) ANSI_ESC "[" #n "C"
#define CURSOR_LEFT(n) ANSI_ESC "[" #n "D"
#define CURSOR_RESET ANSI_ESC "[H"
#define CURSOR_UP(n) ANSI_ESC "[" #n "A"
#define CURSOR_DOWN(n) ANSI_ESC "[" #n "B"
#define CURSOR_RIGHT(n) ANSI_ESC "[" #n "C"
#define CURSOR_LEFT(n) ANSI_ESC "[" #n "D"
#define CURSOR_NEXT_N_LINES(n) ANSI_ESC "[" #n "E"
#define CURSOR_PREV_N_LINES(n) ANSI_ESC "[" #n "F"
#define CURSOR_COL(n) ANSI_ESC "[" #n "G"
#define CURSOR_POS ANSI_ESC "[" #n ";" #n "H"
#define CURSOR_SAVE ANSI_ESC "7"
#define CURSOR_RESTORE ANSI_ESC "8"
#define CURSOR_COL(n) ANSI_ESC "[" #n "G"
#define CURSOR_POS ANSI_ESC "[" #n ";" #n "H"
#define CURSOR_SAVE ANSI_ESC "7"
#define CURSOR_RESTORE ANSI_ESC "8"
#define ERASE_FROM_CURSOR_TO_END ANSI_ESC "[0J"
#define ERASE_FROM_CURSOR_TO_BEGINNING ANSI_ESC "[1J"
#define ERASE_ENTIRE_SCREEN ANSI_ESC "[2J"
#define ERASE_FROM_CURSOR_TO_END_LINE ANSI_ESC "[0K"
#define ERASE_FROM_CURSOR_TO_END ANSI_ESC "[0J"
#define ERASE_FROM_CURSOR_TO_BEGINNING ANSI_ESC "[1J"
#define ERASE_ENTIRE_SCREEN ANSI_ESC "[2J"
#define ERASE_FROM_CURSOR_TO_END_LINE ANSI_ESC "[0K"
#define ERASE_FROM_CURSOR_TO_BEGINNING_LINE ANSI_ESC "[1K"
#define ERASE_ENTIRE_LINE ANSI_ESC "[2K"
#define ERASE_ENTIRE_LINE ANSI_ESC "[2K"
#if LOGGER_COLOR == 1
#define LOG_RESET_COLOR "\033[0m"
@@ -88,27 +88,37 @@
#endif
#if LOGGER_LEVEL <= 1
#define LOG_DEBUG(tag, fmt, ...) printf(LOG_COLOR_D"[Debug] (%8lu) [%s]: " fmt LOG_RESET_COLOR "\r\n", logger_get_timestamp(), tag, ##__VA_ARGS__)
#define LOG_DEBUG(tag, fmt, ...) \
printf(LOG_COLOR_D "[Debug] (%8lu) [%s]: " fmt LOG_RESET_COLOR "\r\n", logger_get_timestamp(), tag, \
##__VA_ARGS__)
#else
#define LOG_DEBUG(tag, fmt, ...)
#endif
#if LOGGER_LEVEL <= 2
#define LOG_INFO(tag, fmt, ...) printf(LOG_COLOR_I"[Info] (%8lu) [%s]: " fmt LOG_RESET_COLOR "\r\n", logger_get_timestamp(), tag, ##__VA_ARGS__)
#define LOG_INFO(tag, fmt, ...) \
printf(LOG_COLOR_I "[Info] (%8lu) [%s]: " fmt LOG_RESET_COLOR "\r\n", logger_get_timestamp(), tag, \
##__VA_ARGS__)
#else
#define LOG_INFO(tag, fmt, ...)
#endif
#if LOGGER_LEVEL <= 3
#define LOG_WARN(tag, fmt, ...) printf(LOG_COLOR_W"[Warning] (%8lu) [%s]: " fmt LOG_RESET_COLOR "\r\n", logger_get_timestamp(), tag, ##__VA_ARGS__)
#define LOG_WARN(tag, fmt, ...) \
printf(LOG_COLOR_W "[Warning] (%8lu) [%s]: " fmt LOG_RESET_COLOR "\r\n", logger_get_timestamp(), tag, \
##__VA_ARGS__)
#else
#define LOG_WARN(tag, fmt, ...)
#endif
#if LOGGER_LEVEL <= 4
#define LOG_CRIT(tag, fmt, ...) printf(LOG_COLOR_C"[Critical] (%8lu) [%s]: " fmt LOG_RESET_COLOR "\r\n", logger_get_timestamp(), tag, ##__VA_ARGS__)
#define LOG_CRIT(tag, fmt, ...) \
printf(LOG_COLOR_C "[Critical] (%8lu) [%s]: " fmt LOG_RESET_COLOR "\r\n", logger_get_timestamp(), tag, \
##__VA_ARGS__)
#else
#define LOG_CRIT(tag, fmt, ...)
#endif
#if LOGGER_LEVEL <= 4
#define LOG_FATAL(tag, fmt, ...) printf(LOG_COLOR_F"[Fatal] (%8lu) [%s]: " fmt LOG_RESET_COLOR "\r\n", logger_get_timestamp(), tag, ##__VA_ARGS__)
#define LOG_FATAL(tag, fmt, ...) \
printf(LOG_COLOR_F "[Fatal] (%8lu) [%s]: " fmt LOG_RESET_COLOR "\r\n", logger_get_timestamp(), tag, \
##__VA_ARGS__)
#else
#define LOG_FATAL(tag, fmt, ...)
#endif
@@ -117,6 +127,6 @@
* Use the LOG_* macros instead e.g., LOG_DEBUG(TAG, "Debug message");
*/
uint32_t logger_get_timestamp(void);
int _write(int file, char *data, int len);
int _write(int file, char* data, int len);
#endif /* LOG_H */

View File

@@ -11,15 +11,13 @@
#define MODBUSPORT 502 // 502 is the default
#include <tcp.h>
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <tcp.h>
#include "lcd_api.h"
#include "llfs.h"
/**
* @fn void modbus_init
* @brief Initializes the modbus tcp

View File

@@ -1,21 +1,19 @@
/**
* @file tcp_cmd.h
* @brief TCP CMD interface
* @author Gert R.
*/
* @file tcp_cmd.h
* @brief TCP CMD interface
* @author Gert R.
*/
#ifndef INC_TCP_CMD_H_
#define INC_TCP_CMD_H_
#include <stdio.h>
#include <string.h>
#include <tcp.h>
#include "lcd_api.h"
#include "llfs.h"
#include "log.h"
#include <tcp.h>
#include <stdio.h>
#include <string.h>
void tcp_cmd_init( void );
void tcp_cmd_init(void);
#endif /* INC_TCP_CMD_H_ */

View File

@@ -8,24 +8,24 @@
#define INC_WEBSITE_BACKEND_
/* Include headers C lib */
#include <string.h>
#include <stdint.h>
#include <string.h>
/* Defines */
#define LOGGER_LEVEL_ALL
#define STR_MAX 200
#define CLR_MAX 11
#define IMG_X 0
#define IMG_Y 0
#define SD_IMG "st.bmp"
#define IMG_X 0
#define IMG_Y 0
#define SD_IMG "st.bmp"
/* Include headers */
#include "httpd.h"
#include "lcd_api.h"
#include "llfs.h"
#include "log.h"
#include "lwip.h"
#include "httpd.h"
#include "lwip/apps/fs.h"
#include "llfs.h"
#include "lcd_api.h"
/**
* @fn void wbe_init(void)