Netcruzer Library API  V2.03
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Groups Pages
nz_lcd2s.h
Go to the documentation of this file.
1 
110 #ifndef _LCD2S_H_
111 #define _LCD2S_H_
112 
113 #if defined(NZ_LCD2S_ENABLED)
114 
116 //Global defines
117 #ifndef LCD2S_I2C_ADR
118 #define LCD2S_I2C_ADR 80ul //LCD2S I2C Address
119 #endif
120 
121 //Default is a single LCD2S display on I2C bus
122 #ifndef LCD2S_MAX_NUMBER
123 #define LCD2S_MAX_NUMBER 1
124 #endif
125 
126 //Default buffer of 8 for each LCD2S keypad buffer
127 #ifndef KPAD_BUF_SIZE
128 #define KPAD_BUF_SIZE 8ul
129 #endif
130 
131 //Use I2C bus 1 by default
132 #ifndef LCD2S_USE_I2C_BUS
133 #define LCD2S_USE_I2C_BUS 1
134 #endif
135 
136 
137 //LCD2S Commands
139 #define LCD2S_CMD_CURSOR_MOVES_BACKWARDS 0x01
140 
142 #define LCD2S_CMD_CURSOR_MOVES_FORWARD 0x09
143 
145 #define LCD2S_CMD_BLINK_BLOCK_CURSOR_OFF 0x10
146 
148 #define LCD2S_CMD_UNDERLINE_CURSOR_ON 0x19
149 
151 #define LCD2S_CMD_DISPLAY_ON 0x1A
152 
154 #define LCD2S_CMD_DISPLAY_OFF 0x12
155 
157 #define LCD2S_CMD_INTERRUPT_PIN_PUSH_PULL 0x22
158 
160 #define LCD2S_CMD_BACKLIGHT_ON 0x28
161 
163 #define LCD2S_CMD_BACKLIGHT_OFF 0x20
164 
166 #define LCD2S_CMD_OUT1_OFF 0x30
167 
169 #define LCD2S_CMD_OUT2_OFF 0x31
170 
172 #define LCD2S_CMD_OUT1_ON 0x38
173 
175 #define LCD2S_CMD_OUT2_ON 0x39
176 
178 #define LCD2S_CMD_GPIO1_OFF 0x40
179 
181 #define LCD2S_CMD_GPIO2_OFF 0x41
182 
184 #define LCD2S_CMD_GPIO1_ON 0x48
185 
187 #define LCD2S_CMD_GPIO2_ON 0x49
188 
190 #define LCD2S_CMD_WRITE_STRING 0x80
191 
193 #define LCD2S_CMD_SET_BACKLIGHT 0x81
194 
196 #define LCD2S_CMD_SET_CONTRAST 0x82
197 
199 #define LCD2S_CMD_MOVE_CURSOR_RIGHT 0x83
200 
202 #define LCD2S_CMD_MOVE_CURSOR_LEFT 0x84
203 
205 #define LCD2S_CMD_SHIFT_DISPLAY_RIGHT 0x85
206 
208 #define LCD2S_CMD_SHIFT_DISPLAY_LEFT 0x86
209 
211 #define LCD2S_CMD_SHIFT_DISPLAY_UP 0x85
212 
214 #define LCD2S_CMD_SHIFT_DISPLAY_DOWN 0x86
215 
217 #define LCD2S_CMD_SET_CURSOR_ADDRESS 0x89
218 
220 #define LCD2S_CMD_SET_CURSOR_POSITION 0x8A
221 
223 #define LCD2S_CMD_CLEAR_DISPLAY 0x8C
224 
226 #define LCD2S_CMD_REMEMBER 0x8D
227 
229 #define LCD2S_CMD_LOAD_CUSTOM_CHAR_SET 0x8E
230 
232 #define LCD2S_CMD_WRITE_LARGE_NUM_STING 0x8F
233 
235 #define LCD2S_CMD_SET_STARTUP_SCREEN 0x90
236 
238 #define LCD2S_CMD_SET_I2C_BASE_ADR 0x91
239 
241 #define LCD2S_CMD_DEFINE_CUSTOM_CHAR 0x92
242 
244 #define LCD2S_CMD_DRAW_VERT_BAR_GRAPH 0x93
245 
247 #define LCD2S_CMD_DRAW_TALL_VERT_BAR_GRAPH 0x94
248 
250 #define LCD2S_CMD_CONFIG_DEVICE 0x95
251 
253 #define LCD2S_CMD_SET_KEYPAD_REPEAT_DELAY 0xA0
254 
256 #define LCD2S_CMD_SET_KEYPAD_REPEAT_RATE 0xA1
257 
259 #define LCD2S_CMD_SET_KEYPAD_BUZZER_PERIOD 0xA2
260 
262 #define LCD2S_CMD_MAX_BACKLIGHT 0xA3
263 
265 #define LCD2S_CMD_GET_STATUS 0xD0
266 
268 #define LCD2S_CMD_GET_KEY 0xD1
269 
271 #define LCD2S_CMD_GET_GPIO1_TO_GPIO3 0xD3
272 
274 #define LCD2S_CMD_CONFIG_KEYPAD_AND_IO 0xE0
275 
277 #define LCD2S_CMD_SET_KEYPAD_DEBOUNCE_TIME 0xE1
278 
280 #define LCD2S_CMD_SET_OUT1_AND_OUT2 0xE2
281 
283 #define LCD2S_CMD_CONFIG_GPIO1 0xE3
284 
286 #define LCD2S_CMD_CONFIG_GPIO2 0xE4
287 
288 
289 
291 //Global data
292 extern BYTE kpadBufGet[LCD2S_MAX_NUMBER]; //get index
293 extern BYTE kpadBufPut[LCD2S_MAX_NUMBER]; //put index
294 
295 
297 //Function prototypes
298 
299 
303 void lcdInit(void);
304 
305 
309 void lcd2sTask(void);
310 
311 
316 #define kpadHasKeys(kpadNum) (kpadBufPut[kpadNum] != kpadBufGet[kpadNum])
317 
318 
329 BYTE kpadGetKey(BYTE kpadNum);
330 
331 
343 INT8 lcdPutCmd(BYTE lcdNum, BYTE cmd);
344 
345 
359 INT8 lcdPutCmd1Param(BYTE lcdNum, BYTE cmd, BYTE param1);
360 
361 
377 INT8 lcdPutCmd2Param(BYTE lcdNum, BYTE cmd, BYTE param1, BYTE param2);
378 
379 
390 INT8 lcdPutArray(BYTE lcdNum, BYTE* buf, BYTE len);
391 
392 
403 INT8 lcdDisplayChar(BYTE lcdNum, char c);
404 
405 
417 INT8 lcdDisplayCharHex(BYTE lcdNum, BYTE c);
418 
419 
442 INT8 lcdDisplayString(BYTE lcdNum, char* s);
443 
444 
471 INT8 lcdSetStartupScreen(BYTE lcdNum, BYTE row, char* string);
472 
473 
497 INT8 lcdDrawVertBargraph(BYTE lcdNum, BYTE row, BYTE col, BYTE height);
498 
499 
512 #define lcdSetCursorPosition(lcdNum, row, col) lcdPutCmd2Param(lcdNum, LCD2S_CMD_SET_CURSOR_POSITION, row, col)
513 
524 #define lcdSetBacklight(lcdNum, value) lcdPutCmd1Param(lcdNum, LCD2S_CMD_SET_BACKLIGHT, value)
525 
536 #define lcdSetContrast(lcdNum, value) lcdPutCmd1Param(lcdNum, LCD2S_CMD_SET_CONTRAST, value)
537 
562 #define lcdLoadCustomCharSet(lcdNum, value) lcdPutCmd1Param(lcdNum, LCD2S_CMD_LOAD_CUSTOM_CHAR_SET, value)
563 
602 #define lcdDefineCustomChar(lcdNum, buf) lcdPutArray(lcdNum, buf, 10)
603 
604 #endif //#if defined(NZ_LCD2S_ENABLED)
605 #endif //_LCD2S_H_
606 
607 
608 
609