test
lcd_log.h@0:a9366f354506, 2017-05-28 (annotated)
- Committer:
- joschaihl
- Date:
- Sun May 28 11:16:02 2017 +0000
- Revision:
- 0:a9366f354506
Library for logging on STM32F7 DISCO
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joschaihl | 0:a9366f354506 | 1 | #ifndef __LCD_LOG_H__ |
joschaihl | 0:a9366f354506 | 2 | #define __LCD_LOG_H__ |
joschaihl | 0:a9366f354506 | 3 | |
joschaihl | 0:a9366f354506 | 4 | #include "stm32f769i_discovery_lcd.h" /* replace 'stm32xxx' with your EVAL board name, ex: stm324x9i_eval_lcd.h */ |
joschaihl | 0:a9366f354506 | 5 | #include <stdio.h> |
joschaihl | 0:a9366f354506 | 6 | |
joschaihl | 0:a9366f354506 | 7 | #define PEACH ((uint32_t) 0xFFf2c6a4) |
joschaihl | 0:a9366f354506 | 8 | #define ZINNWALDITE_BROWN ((uint32_t) 0xff270104) |
joschaihl | 0:a9366f354506 | 9 | |
joschaihl | 0:a9366f354506 | 10 | /* Comment the line below to disable the scroll back and forward features */ |
joschaihl | 0:a9366f354506 | 11 | #define LCD_SCROLL_ENABLED 1 |
joschaihl | 0:a9366f354506 | 12 | |
joschaihl | 0:a9366f354506 | 13 | /* Define the Fonts */ |
joschaihl | 0:a9366f354506 | 14 | #define LCD_LOG_HEADER_FONT Font20 |
joschaihl | 0:a9366f354506 | 15 | #define LCD_LOG_FOOTER_FONT Font20 |
joschaihl | 0:a9366f354506 | 16 | #define LCD_LOG_TEXT_FONT Font20 |
joschaihl | 0:a9366f354506 | 17 | |
joschaihl | 0:a9366f354506 | 18 | /* Define the LCD LOG Color */ |
joschaihl | 0:a9366f354506 | 19 | #define LCD_LOG_BACKGROUND_COLOR PEACH |
joschaihl | 0:a9366f354506 | 20 | #define LCD_LOG_TEXT_COLOR ZINNWALDITE_BROWN |
joschaihl | 0:a9366f354506 | 21 | |
joschaihl | 0:a9366f354506 | 22 | #define LCD_LOG_SOLID_BACKGROUND_COLOR LCD_COLOR_BLUE |
joschaihl | 0:a9366f354506 | 23 | #define LCD_LOG_SOLID_TEXT_COLOR LCD_COLOR_WHITE |
joschaihl | 0:a9366f354506 | 24 | |
joschaihl | 0:a9366f354506 | 25 | /* Define the cache depth */ |
joschaihl | 0:a9366f354506 | 26 | #define CACHE_SIZE 200 |
joschaihl | 0:a9366f354506 | 27 | #define YWINDOW_SIZE 22 |
joschaihl | 0:a9366f354506 | 28 | |
joschaihl | 0:a9366f354506 | 29 | |
joschaihl | 0:a9366f354506 | 30 | #define LCD_LOG_PUTCHAR int std::fputc(int ch, FILE *f) |
joschaihl | 0:a9366f354506 | 31 | |
joschaihl | 0:a9366f354506 | 32 | #define LCD_CACHE_DEPTH (YWINDOW_SIZE + CACHE_SIZE) |
joschaihl | 0:a9366f354506 | 33 | |
joschaihl | 0:a9366f354506 | 34 | /* Define the display window settings */ |
joschaihl | 0:a9366f354506 | 35 | #define YWINDOW_MIN 1 |
joschaihl | 0:a9366f354506 | 36 | |
joschaihl | 0:a9366f354506 | 37 | typedef struct _LCD_LOG_line |
joschaihl | 0:a9366f354506 | 38 | { |
joschaihl | 0:a9366f354506 | 39 | uint8_t line[128]; |
joschaihl | 0:a9366f354506 | 40 | uint32_t color; |
joschaihl | 0:a9366f354506 | 41 | |
joschaihl | 0:a9366f354506 | 42 | }LCD_LOG_line; |
joschaihl | 0:a9366f354506 | 43 | |
joschaihl | 0:a9366f354506 | 44 | /** |
joschaihl | 0:a9366f354506 | 45 | * @} |
joschaihl | 0:a9366f354506 | 46 | */ |
joschaihl | 0:a9366f354506 | 47 | |
joschaihl | 0:a9366f354506 | 48 | /** @defgroup LCD_LOG_Exported_Macros |
joschaihl | 0:a9366f354506 | 49 | * @{ |
joschaihl | 0:a9366f354506 | 50 | */ |
joschaihl | 0:a9366f354506 | 51 | #define LCD_ErrLog(...) do { \ |
joschaihl | 0:a9366f354506 | 52 | LCD_LineColor = LCD_COLOR_RED;\ |
joschaihl | 0:a9366f354506 | 53 | printf("ERROR: ") ;\ |
joschaihl | 0:a9366f354506 | 54 | printf(__VA_ARGS__);\ |
joschaihl | 0:a9366f354506 | 55 | LCD_LineColor = LCD_LOG_DEFAULT_COLOR;\ |
joschaihl | 0:a9366f354506 | 56 | }while (0) |
joschaihl | 0:a9366f354506 | 57 | |
joschaihl | 0:a9366f354506 | 58 | #define LCD_UsrLog(...) do { \ |
joschaihl | 0:a9366f354506 | 59 | LCD_LineColor = LCD_LOG_TEXT_COLOR;\ |
joschaihl | 0:a9366f354506 | 60 | printf(__VA_ARGS__);\ |
joschaihl | 0:a9366f354506 | 61 | } while (0) |
joschaihl | 0:a9366f354506 | 62 | |
joschaihl | 0:a9366f354506 | 63 | |
joschaihl | 0:a9366f354506 | 64 | #define LCD_DbgLog(...) do { \ |
joschaihl | 0:a9366f354506 | 65 | LCD_LineColor = LCD_COLOR_CYAN;\ |
joschaihl | 0:a9366f354506 | 66 | printf(__VA_ARGS__);\ |
joschaihl | 0:a9366f354506 | 67 | LCD_LineColor = LCD_LOG_DEFAULT_COLOR;\ |
joschaihl | 0:a9366f354506 | 68 | }while (0) |
joschaihl | 0:a9366f354506 | 69 | |
joschaihl | 0:a9366f354506 | 70 | extern uint32_t LCD_LineColor; |
joschaihl | 0:a9366f354506 | 71 | |
joschaihl | 0:a9366f354506 | 72 | void LCD_LOG_Init(void); |
joschaihl | 0:a9366f354506 | 73 | void LCD_LOG_DeInit(void); |
joschaihl | 0:a9366f354506 | 74 | void LCD_LOG_SetHeader(uint8_t *Title); |
joschaihl | 0:a9366f354506 | 75 | void LCD_LOG_SetFooter(uint8_t *Status); |
joschaihl | 0:a9366f354506 | 76 | void LCD_LOG_ClearTextZone(void); |
joschaihl | 0:a9366f354506 | 77 | void LCD_LOG_UpdateDisplay (void); |
joschaihl | 0:a9366f354506 | 78 | |
joschaihl | 0:a9366f354506 | 79 | #if (LCD_SCROLL_ENABLED == 1) |
joschaihl | 0:a9366f354506 | 80 | ErrorStatus LCD_LOG_ScrollBack(void); |
joschaihl | 0:a9366f354506 | 81 | ErrorStatus LCD_LOG_ScrollForward(void); |
joschaihl | 0:a9366f354506 | 82 | #endif |
joschaihl | 0:a9366f354506 | 83 | |
joschaihl | 0:a9366f354506 | 84 | //#define LCD_LOG_PUTCHAR int __io_putchar(int ch) |
joschaihl | 0:a9366f354506 | 85 | //#define LCD_LOG_PUTCHAR int fputc(int ch, FILE *f) |
joschaihl | 0:a9366f354506 | 86 | |
joschaihl | 0:a9366f354506 | 87 | |
joschaihl | 0:a9366f354506 | 88 | #endif /* __LCD_LOG_H__ */ |