lcd_text.h

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