4 * Copyright 2005 Develer S.r.l. (http://www.develer.com/)
5 * This file is part of DevLib - See README.devlib for information.
8 * \brief Generic text LCD driver (interface).
11 * \author Bernardo Innocenti <bernie@develer.com>
12 * \author Stefano Fedrigo <aleph@develer.com>
17 *#* Revision 1.1 2005/11/04 18:00:42 bernie
18 *#* Import into DevLib.
20 *#* Revision 1.5 2005/06/14 14:43:43 bernie
21 *#* Add DevLib headers.
23 *#* Revision 1.4 2005/06/06 17:41:57 batt
24 *#* Add lcd_layerSet function.
26 *#* Revision 1.3 2005/06/01 10:36:23 batt
27 *#* Layer: Rename member variables and Doxygenize.
29 *#* Revision 1.2 2005/05/26 08:31:23 batt
30 *#* Add layer hiding/showing.
32 *#* Revision 1.1 2005/05/24 09:17:58 batt
33 *#* Move drivers to top-level.
41 #include <cfg/macros.h>
42 #include <cfg/compiler.h>
43 #include <mware/list.h>
45 #include <stdarg.h> // vprintf()
48 /* flags for lcd_printf() */
49 #define LCD_NORMAL 0 /* Scrittura normale */
50 #define LCD_FILL BV(0) /* Fill rest of line with spaces */
51 #define LCD_CENTER BV(1) /* Center string in line */
52 #define LCD_NOCURSOR BV(2) /* Scrittura senza spostamento cursore */
54 /*! Special priority value for lcd_setLayerDepth(). */
55 #define LAYER_HIDDEN -128
57 /* Compute LCD address from x/y coordinates */
58 #define LCD_POS(x,y) ((lcdpos_t)((uint8_t)(x) + (uint8_t)(y) * (uint8_t)LCD_COLS))
59 #define LCD_ROW0 (LCD_COLS * 0)
60 #define LCD_ROW1 (LCD_COLS * 1)
61 #define LCD_ROW2 (LCD_COLS * 2)
62 #define LCD_ROW3 (LCD_COLS * 3)
65 * Overwrapping layer context.
70 * Active layers are linked together in a list
71 * sorted in top to bottom order.
73 DECLARE_NODE_ANON(struct _Layer)
75 /*! Current XY address into this layer, for write operations. */
78 /*! Priority of this layer (greater in front of lesser). */
82 * Buffer per il salvataggio ed il ripristino del
83 * contenuto del display. Le posizioni che contengono
84 * il carattere '\0' sono trasparenti.
86 char buf[LCD_COLS * LCD_ROWS];
90 /* Global variables */
91 extern Layer *lcd_DefLayer;
93 /* Function prototypes */
94 extern void lcd_init(void);
95 extern void lcd_test(void);
97 extern void lcd_moveCursor(lcdpos_t addr);
98 extern char lcd_setCursor(char state);
100 extern void lcd_setAddr(Layer *layer, lcdpos_t addr);
101 extern void lcd_putChar(char c, Layer *layer);
102 extern int lcd_vprintf(Layer *layer, lcdpos_t addr, uint8_t mode, const char *format, va_list ap) FORMAT(printf, 4, 0);
103 extern int lcd_printf(Layer *layer, lcdpos_t addr, uint8_t mode, const char *format, ...) FORMAT(printf, 4, 5);
104 extern void lcd_clear(Layer *layer);
105 extern void lcd_layerSet(Layer *layer, char c);
106 extern void lcd_clearLine(Layer *layer, int y);
108 extern void lcd_setLayerDepth(Layer *layer, char pri);
109 extern Layer *lcd_newLayer(char pri);
110 extern void lcd_deleteLayer(Layer *layer);
111 extern void lcd_lock(void);
112 extern void lcd_unlock(void);
114 #endif /* DRV_LCD_H */