BeRTOS
lcd_text.h
Go to the documentation of this file.
00001 
00042 #ifndef DRV_LCD_H
00043 #define DRV_LCD_H
00044 
00045 #include "lcd_hd44.h"
00046 
00047 #include <cfg/macros.h>
00048 #include <cfg/compiler.h>
00049 #include <struct/list.h>
00050 
00051 #include <stdarg.h> // vprintf()
00052 
00053 
00054 /* flags for lcd_printf() */
00055 #define LCD_NORMAL     0       /* Scrittura normale */
00056 #define LCD_FILL       BV(0)   /* Fill rest of line with spaces */
00057 #define LCD_CENTER     BV(1)   /* Center string in line */
00058 #define LCD_NOCURSOR   BV(2)   /* Scrittura senza spostamento cursore */
00059 
00061 #define LAYER_HIDDEN   -127
00062 
00063 /* Compute LCD address from x/y coordinates */
00064 #define LCD_POS(x,y)  ((lcdpos_t)((uint8_t)(x) + (uint8_t)(y) * (uint8_t)CONFIG_LCD_COLS))
00065 #define LCD_ROW0  (CONFIG_LCD_COLS * 0)
00066 #define LCD_ROW1  (CONFIG_LCD_COLS * 1)
00067 #define LCD_ROW2  (CONFIG_LCD_COLS * 2)
00068 #define LCD_ROW3  (CONFIG_LCD_COLS * 3)
00069 
00073 typedef struct _Layer
00074 {
00079     DECLARE_NODE_ANON(struct _Layer)
00080 
00081     
00082     lcdpos_t addr;
00083 
00085     signed char pri;
00086 
00094     char buf[CONFIG_LCD_COLS * CONFIG_LCD_ROWS];
00095 } Layer;
00096 
00097 
00098 /* Global variables */
00099 extern Layer *lcd_DefLayer;
00100 
00101 /* Function prototypes */
00102 extern void lcd_init(void);
00103 extern void lcd_test(void);
00104 
00105 extern void lcd_moveCursor(lcdpos_t addr);
00106 extern char lcd_setCursor(char state);
00107 
00108 extern void lcd_setAddr(Layer *layer, lcdpos_t addr);
00109 extern void lcd_putChar(char c, Layer *layer);
00110 extern int  lcd_vprintf(Layer *layer, lcdpos_t addr, uint8_t mode, const char *format, va_list ap) FORMAT(printf, 4, 0);
00111 extern int  lcd_printf(Layer *layer, lcdpos_t addr, uint8_t mode, const char *format, ...) FORMAT(printf, 4, 5);
00112 extern void lcd_clear(Layer *layer);
00113 extern void lcd_layerSet(Layer *layer, char c);
00114 extern void lcd_clearLine(Layer *layer, int y);
00115 
00116 extern void lcd_setLayerDepth(Layer *layer, char pri);
00117 extern Layer *lcd_newLayer(char pri);
00118 extern void lcd_deleteLayer(Layer *layer);
00119 extern void lcd_lock(void);
00120 extern void lcd_unlock(void);
00121 
00122 #endif /* DRV_LCD_H */