Joscha Ihl / lcd_log

Dependents:   Datarecorder2

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers lcd_log.h Source File

lcd_log.h

00001 #ifndef  __LCD_LOG_H__
00002 #define  __LCD_LOG_H__
00003 
00004 #include "stm32f769i_discovery_lcd.h" /* replace 'stm32xxx' with your EVAL board name, ex: stm324x9i_eval_lcd.h */
00005 #include <stdio.h>
00006 
00007 #define PEACH ((uint32_t) 0xFFf2c6a4)
00008 #define ZINNWALDITE_BROWN ((uint32_t) 0xff270104)
00009 
00010 /* Comment the line below to disable the scroll back and forward features */
00011 #define     LCD_SCROLL_ENABLED      1 
00012 
00013 /* Define the Fonts  */
00014 #define     LCD_LOG_HEADER_FONT                   Font20
00015 #define     LCD_LOG_FOOTER_FONT                   Font20
00016 #define     LCD_LOG_TEXT_FONT                     Font20
00017             
00018 /* Define the LCD LOG Color  */
00019 #define     LCD_LOG_BACKGROUND_COLOR              PEACH
00020 #define     LCD_LOG_TEXT_COLOR                    ZINNWALDITE_BROWN
00021 
00022 #define     LCD_LOG_SOLID_BACKGROUND_COLOR        LCD_COLOR_BLUE
00023 #define     LCD_LOG_SOLID_TEXT_COLOR              LCD_COLOR_WHITE
00024 
00025 /* Define the cache depth */
00026 #define     CACHE_SIZE              200
00027 #define     YWINDOW_SIZE            22
00028 
00029 
00030 #define LCD_LOG_PUTCHAR int std::fputc(int ch, FILE *f)
00031 
00032 #define     LCD_CACHE_DEPTH     (YWINDOW_SIZE + CACHE_SIZE)
00033 
00034 /* Define the display window settings */
00035 #define     YWINDOW_MIN         1
00036  
00037 typedef struct _LCD_LOG_line
00038 {
00039   uint8_t  line[128];
00040   uint32_t color;
00041 
00042 }LCD_LOG_line;
00043 
00044 /**
00045   * @}
00046   */ 
00047 
00048 /** @defgroup LCD_LOG_Exported_Macros
00049   * @{
00050   */ 
00051 #define  LCD_ErrLog(...)    do { \
00052                                  LCD_LineColor = LCD_COLOR_RED;\
00053                                  printf("ERROR: ") ;\
00054                                  printf(__VA_ARGS__);\
00055                                  LCD_LineColor = LCD_LOG_DEFAULT_COLOR;\
00056                                }while (0)
00057 
00058 #define  LCD_UsrLog(...)    do { \
00059                                  LCD_LineColor = LCD_LOG_TEXT_COLOR;\
00060                                  printf(__VA_ARGS__);\
00061                                } while (0)
00062 
00063 
00064 #define  LCD_DbgLog(...)    do { \
00065                                  LCD_LineColor = LCD_COLOR_CYAN;\
00066                                  printf(__VA_ARGS__);\
00067                                  LCD_LineColor = LCD_LOG_DEFAULT_COLOR;\
00068                                }while (0)
00069 
00070 extern uint32_t LCD_LineColor;
00071 
00072 void LCD_LOG_Init(void);
00073 void LCD_LOG_DeInit(void);
00074 void LCD_LOG_SetHeader(uint8_t *Title);
00075 void LCD_LOG_SetFooter(uint8_t *Status);
00076 void LCD_LOG_ClearTextZone(void);
00077 void LCD_LOG_UpdateDisplay (void);
00078 
00079 #if (LCD_SCROLL_ENABLED == 1)
00080  ErrorStatus LCD_LOG_ScrollBack(void);
00081  ErrorStatus LCD_LOG_ScrollForward(void);
00082 #endif
00083 
00084 //#define LCD_LOG_PUTCHAR int __io_putchar(int ch)
00085 //#define LCD_LOG_PUTCHAR int fputc(int ch, FILE *f)
00086 
00087 
00088 #endif /* __LCD_LOG_H__ */