ESOS32
ESOSOn32-bitProcessors
esos_lcd44780wo.c
Go to the documentation of this file.
1 /*
2  * "Copyright (c) 2019 J. W. Bruce ("AUTHOR(S)")"
3  * All rights reserved.
4  * (J. W. Bruce, jwbruce_AT_tntech.edu, Tennessee Tech University)
5  *
6  * Permission to use, copy, modify, and distribute this software and its
7  * documentation for any purpose, without fee, and without written agreement is
8  * hereby granted, provided that the above copyright notice, the following
9  * two paragraphs and the authors appear in all copies of this software.
10  *
11  * IN NO EVENT SHALL THE "AUTHORS" BE LIABLE TO ANY PARTY FOR
12  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
13  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE "AUTHORS"
14  * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15  *
16  * THE "AUTHORS" SPECIFICALLY DISCLAIMS ANY WARRANTIES,
17  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
18  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
19  * ON AN "AS IS" BASIS, AND THE "AUTHORS" HAS NO OBLIGATION TO
20  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
21  *
22  * Please maintain this header in its entirety when copying/modifying
23  * these files.
24  *
25  *
26  */
27 
41 #include <esos.h>
42 #include "esos_lcd44780wo.h"
43 
44 // ******** G L O B A L S ***************
45 volatile struct stTask __stLCDChildTask;
46 
47 // Main data structure for updating lcd44780
48 struct {
49  BOOL b_cursorPositionNeedsUpdate;
50  uint8_t u8_cursorRow;
51  uint8_t u8_cursorCol;
52 
53  BOOL b_cursorShownNeedsUpdate;
54  BOOL b_cursorShown;
55 
56  BOOL b_cursorBlinkNeedsUpdate;
57  BOOL b_cursorBlink;
58 
59  BOOL b_displayVisibleNeedsUpdate;
60  BOOL b_displayVisible;
61 
62  BOOL ab_lcdBufferNeedsUpdate[ESOS_LCD44780_MEM_HEIGHT][ESOS_LCD44780_MEM_WIDTH];
63  char aac_lcdBuffer[ESOS_LCD44780_MEM_HEIGHT][ESOS_LCD44780_MEM_WIDTH];
64 
65  BOOL ab_customCharNeedsUpdate[ESOS_LCD44780_NUM_CUSTOM_CHARS];
66  esos_lcd44780_char_t ast_customChar[ESOS_LCD44780_NUM_CUSTOM_CHARS];
67 } esos_lcd44780_vars;
68 
69 // Hidden LCD character moduel service/housekeeping task
70 ESOS_USER_TASK( __esos_lcd44780_service )
71 {
72  // Can first initialized the LCD module hardware and setup the LCD service software structures
73  // Also manages the LCD character module got ESOS
74  // The LCD service hidden task will need to maintain a buffer containing the LCD character display
76  ESOS_TASK_WAIT_TICKS(500); // Wait > 40 msec after power is applied
77 
78 #ifdef ESOS_USE_LCD_8BIT
79  // TODO: remove the magic numbers in this section
80  ESOS_TASK_WAIT_LCD44780_WRITE_COMMAND_NOWAIT( ESOS_LCD44780_CMD_FUNCTION_SET + \
81  ESOS_LCD44780_CMD_FUNCTION_SET_8BIT_MODE + \
82  ESOS_LCD44780_CMD_FUNCTION_SET_2LINE_MODE + \
83  ESOS_LCD44780_CMD_FUNCTION_SET_LOWFONT_MODE ); // 0x30
84  ESOS_TASK_WAIT_TICKS(10); // must wait 5ms, busy flag not available
85  ESOS_TASK_WAIT_LCD44780_WRITE_COMMAND_NOWAIT( ESOS_LCD44780_CMD_FUNCTION_SET + \
86  ESOS_LCD44780_CMD_FUNCTION_SET_8BIT_MODE + \
87  ESOS_LCD44780_CMD_FUNCTION_SET_2LINE_MODE + \
88  ESOS_LCD44780_CMD_FUNCTION_SET_LOWFONT_MODE ); // 0x30
89 
90  ESOS_TASK_WAIT_TICKS(1); // must wait 160us, busy flag not available
91  ESOS_TASK_WAIT_LCD44780_WRITE_COMMAND_NOWAIT( ESOS_LCD44780_CMD_FUNCTION_SET + \
92  ESOS_LCD44780_CMD_FUNCTION_SET_8BIT_MODE + \
93  ESOS_LCD44780_CMD_FUNCTION_SET_2LINE_MODE + \
94  ESOS_LCD44780_CMD_FUNCTION_SET_LOWFONT_MODE ); // 0x30
95 
96  ESOS_TASK_WAIT_TICKS(1); // must wait 160us, busy flag not available
97  ESOS_TASK_WAIT_LCD44780_WRITE_COMMAND(ESOS_LCD44780_CMD_FUNCTION_SET + \
98  ESOS_LCD44780_CMD_FUNCTION_SET_8BIT_MODE + \
99  ESOS_LCD44780_CMD_FUNCTION_SET_2LINE_MODE + \
100  ESOS_LCD44780_CMD_FUNCTION_SET_LOWFONT_MODE ); // 0x38
101 #endif
102 
103 #ifdef ESOS_USE_LCD_4BIT
104  // TODO: remove the magic numbers in this section
105  // see p.45 figure 23 in hitachi HD44780 datasheet
106  __esos_unsafe_lcd44780_hw_write_u4( 0x30, FALSE, FALSE) ; // write a command (RS=0) nibble 0x30 with E low
107  ESOS_TASK_WAIT_TICKS(5); // must wait 5ms, busy flag not available
108  // Now "clock" in command 0x30
109  __esos_unsafe_lcd44780_hw_write_u4( 0x30, TRUE, FALSE) ; // write a command (RS=0) nibble 0x30 with E HIGH
110  __esos_unsafe_lcd44780_hw_write_u4( 0x30, FALSE, FALSE) ; // write a command (RS=0) nibble 0x30 with E LOW
111  ESOS_TASK_WAIT_TICKS(5); // must wait 5ms, busy flag not available
112  // Now "clock" in command 0x30 a second time
113  __esos_unsafe_lcd44780_hw_write_u4( 0x30, TRUE, FALSE) ; // write a command (RS=0) nibble 0x30 with E HIGH
114  __esos_unsafe_lcd44780_hw_write_u4( 0x30, FALSE, FALSE) ; // write a command (RS=0) nibble 0x30 with E LOW
115  ESOS_TASK_WAIT_TICKS(5); // must wait 5ms, busy flag not available
116  // Now "clock" in command 0x30 a third
117  __esos_unsafe_lcd44780_hw_write_u4( 0x30, TRUE, FALSE) ; // write a command (RS=0) nibble 0x30 with E HIGH
118  __esos_unsafe_lcd44780_hw_write_u4( 0x30, FALSE, FALSE) ; // write a command (RS=0) nibble 0x30 with E LOW
119  ESOS_TASK_WAIT_TICKS(5); // must wait 5ms, busy flag not available
120  // Now "clock" in command 0x20 to command LCD into 4-bit mode
121  __esos_unsafe_lcd44780_hw_write_u4( 0x20, TRUE, FALSE) ; // write a command (RS=0) nibble 0x30 with E HIGH
122  __esos_unsafe_lcd44780_hw_write_u4( 0x20, FALSE, FALSE) ; // write a command (RS=0) nibble 0x30 with E LOW
123  ESOS_TASK_WAIT_TICKS(1); // wait a smidge
124  // send it 4-bit mode with two lines and font selection
125  ESOS_TASK_WAIT_LCD44780_WRITE_COMMAND(ESOS_LCD44780_CMD_FUNCTION_SET + \
126  ESOS_LCD44780_CMD_FUNCTION_SET_4BIT_MODE + \
127  ESOS_LCD44780_CMD_FUNCTION_SET_2LINE_MODE + \
128  ESOS_LCD44780_CMD_FUNCTION_SET_LOWFONT_MODE ); // 0x28
129 
130 #endif
131 
132 #define ESOS_LCD44780_CMD_CLEAR_DISPLAY 0b00000001
133 #define ESOS_LCD44780_CMD_RETURN_HOME 0b00000010
134 #define ESOS_LCD44780_CMD_ENTRY_MODE_SET 0b00000100
135 #define ESOS_LCD44780_CMD_ENTRY_MODE_SET_INC 0b00000010
136 #define ESOS_LCD44780_CMD_ENTRY_MODE_SET_SHIFT 0b00000001
137 #define ESOS_LCD44780_CMD_DISPLAY_ON_OFF 0b00001000
138 #define ESOS_LCD44780_CMD_DISPLAY_ON_OFF_DISPLAYON 0b00000100
139 #define ESOS_LCD44780_CMD_DISPLAY_ON_OFF_CURSORON 0b00000010
140 #define ESOS_LCD44780_CMD_DISPLAY_ON_OFF_BLINKCURSOR 0b00000001
141 #define ESOS_LCD44780_CMD_CUR_DISP_CURSOR_SHIFT_L 0b00010000
142 #define ESOS_LCD44780_CMD_CUR_DISP_CURSOR_SHIFT_R 0b00010100
143 #define ESOS_LCD44780_CMD_CUR_DISP_DISPLAY_SHIFT_L 0b00011000
144 #define ESOS_LCD44780_CMD_CUR_DISP_DISPLAY_SHIFT_R 0b00011100
145 #define ESOS_LCD44780_CMD_FUNCTION_SET 0b00100000
146 #define ESOS_LCD44780_CMD_FUNCTION_SET_8BIT_MODE 0b00010000
147 #define ESOS_LCD44780_CMD_FUNCTION_SET_4BIT_MODE 0b00000000
148 #define ESOS_LCD44780_CMD_FUNCTION_SET_1LINE_MODE 0b00000000
149 #define ESOS_LCD44780_CMD_FUNCTION_SET_2LINE_MODE 0b00001000
150 #define ESOS_LCD44780_CMD_FUNCTION_SET_LOWFONT_MODE 0b00000000
151 #define ESOS_LCD44780_CMD_FUNCTION_SET_HIFONT_MODE 0b00000100
152 #define ESOS_LCD44780_CMD_SET_CGRAM_ADDR 0b01000000
153 #define ESOS_LCD44780_CMD_SET_DDRAM_ADDR 0b10000000
154 
155 
156 
157 
158  ESOS_TASK_WAIT_LCD44780_WRITE_COMMAND(ESOS_LCD44780_CMD_CUR_DISP_CURSOR_SHIFT_R); // 0x10
159  //ESOS_TASK_WAIT_LCD44780_WRITE_COMMAND(ESOS_LCD44780_CMD_DISPLAY_ON_OFF + ESOS_LCD44780_CMD_DISPLAY_ON_OFF_DISP); // 0x0C
160  //ESOS_TASK_WAIT_LCD44780_WRITE_COMMAND(ESOS_LCD44780_CMD_ENTRY_MODE_SET+ESOS_LCD44780_CMD_ENTRY_MODE_SET_INC); // 0x06
161 
162  // Send startup sequence from datasheet
163 
164  ESOS_TASK_WAIT_LCD44780_WRITE_COMMAND( ESOS_LCD44780_CMD_DISPLAY_ON_OFF + \
165  ESOS_LCD44780_CMD_DISPLAY_ON_OFF_DISPLAYON );
166 
167  /*
168  ESOS_TASK_WAIT_LCD44780_WRITE_COMMAND( ESOS_LCD44780_CMD_DISPLAY_ON_OFF + \
169  ESOS_LCD44780_CMD_DISPLAY_ON_OFF_DISPLAYON + \
170  ESOS_LCD44780_CMD_DISPLAY_ON_OFF_CURSORON + \
171  ESOS_LCD44780_CMD_DISPLAY_ON_OFF_BLINKCURSOR);
172  */
173 
174  ESOS_TASK_WAIT_LCD44780_WRITE_COMMAND( ESOS_LCD44780_CMD_ENTRY_MODE_SET |
175  ESOS_LCD44780_CMD_ENTRY_MODE_SET_INC);
176 
177  while(TRUE) {
178  static uint8_t i, u8_col, u8_row;
179 
180  if(esos_lcd44780_vars.b_cursorPositionNeedsUpdate) {
181  esos_lcd44780_vars.b_cursorPositionNeedsUpdate = FALSE;
182  ESOS_TASK_WAIT_LCD44780_SET_DATA_ADDRESS(esos_lcd44780_vars.u8_cursorRow > 0 ? 0x40 : 0x00 |
183  esos_lcd44780_vars.u8_cursorCol);
184  }
185 
186  if(esos_lcd44780_vars.b_cursorShownNeedsUpdate ||
187  esos_lcd44780_vars.b_cursorBlinkNeedsUpdate ||
188  esos_lcd44780_vars.b_displayVisibleNeedsUpdate) {
189  esos_lcd44780_vars.b_cursorShownNeedsUpdate = FALSE;
190  esos_lcd44780_vars.b_cursorBlinkNeedsUpdate = FALSE;
191  esos_lcd44780_vars.b_displayVisibleNeedsUpdate = FALSE;
192  ESOS_TASK_WAIT_LCD44780_WRITE_COMMAND( ESOS_LCD44780_CMD_DISPLAY_ON_OFF |
193  (esos_lcd44780_vars.b_cursorShown ? ESOS_LCD44780_CMD_DISPLAY_ON_OFF_CURSORON : 0) |
194  (esos_lcd44780_vars.b_cursorBlink ? ESOS_LCD44780_CMD_DISPLAY_ON_OFF_BLINKCURSOR : 0) |
195  (esos_lcd44780_vars.b_displayVisible ? ESOS_LCD44780_CMD_DISPLAY_ON_OFF_DISPLAYON : 0));
196  }
197 
198  for(u8_row = 0; u8_row < ESOS_LCD44780_MEM_HEIGHT; ++u8_row) {
199  for(u8_col = 0; u8_col < ESOS_LCD44780_MEM_WIDTH; ++u8_col) {
200  // Update all consecutive characters that need it, but only send the address once.
201  if(esos_lcd44780_vars.ab_lcdBufferNeedsUpdate[u8_row][u8_col]) {
202  esos_lcd44780_vars.b_cursorPositionNeedsUpdate = TRUE;
203  ESOS_TASK_WAIT_LCD44780_SET_DATA_ADDRESS((u8_row > 0 ? 0x40 : 0x00) | u8_col);
204  do {
205  esos_lcd44780_vars.ab_lcdBufferNeedsUpdate[u8_row][u8_col] = FALSE;
206  ESOS_TASK_WAIT_LCD44780_WRITE_DATA(esos_lcd44780_vars.aac_lcdBuffer[u8_row][u8_col]);
207  ++u8_col;
208  ESOS_TASK_YIELD();
209  } while(esos_lcd44780_vars.ab_lcdBufferNeedsUpdate[u8_row][u8_col]
210  && u8_col < ESOS_LCD44780_MEM_WIDTH);
211  }
212  ESOS_TASK_YIELD();
213  }
214  }
215 
216  for(i = 0; i < ESOS_LCD44780_NUM_CUSTOM_CHARS; ++i) {
217  // Update all characters that need updating, but only send the CG address once.
218  if(esos_lcd44780_vars.ab_customCharNeedsUpdate[i]) {
219  // We destroy the hardware's cursor position, so fix it later.
220  esos_lcd44780_vars.b_cursorPositionNeedsUpdate = TRUE;
221  ESOS_TASK_WAIT_LCD44780_SET_CG_ADDRESS(8 * i);
222 
223  do {
224  static int n;
225 
226  esos_lcd44780_vars.ab_customCharNeedsUpdate[i] = FALSE;
227 
228  for(n = 0; n < 8; ++n) {
229  ESOS_TASK_WAIT_LCD44780_WRITE_DATA(esos_lcd44780_vars.ast_customChar[i].au8_data[n]);
230  }
231  ++i;
232  ESOS_TASK_YIELD();
233  } while(esos_lcd44780_vars.ab_customCharNeedsUpdate[i] && i < ESOS_LCD44780_NUM_CUSTOM_CHARS);
234  }
235  ESOS_TASK_YIELD();
236  }
237 
238  ESOS_TASK_YIELD();
239  }
240 
241  ESOS_TASK_END();
242 }
243 
244 void esos_lcd44780_configDisplay( void )
245 {
246  unsigned int u8_column;
247 
248  esos_lcd44780_vars.b_displayVisible = TRUE;
249  esos_lcd44780_vars.b_displayVisibleNeedsUpdate = TRUE;
250  esos_lcd44780_vars.b_cursorShown = FALSE;
251  esos_lcd44780_vars.b_cursorShownNeedsUpdate = TRUE;
252  esos_lcd44780_vars.b_cursorBlink = FALSE;
253  esos_lcd44780_vars.b_cursorBlinkNeedsUpdate = TRUE;
254 
255  esos_lcd44780_clearScreen();
256 
257  for(u8_column = 0; u8_column < ESOS_LCD44780_NUM_CUSTOM_CHARS; ++u8_column) {
258  esos_lcd44780_vars.ab_customCharNeedsUpdate[u8_column] = FALSE;
259  }
260 }
261 
262 void __esos_lcd44780_init( void )
263 {
264  // give HW specific code a chance to do anything else to init/config
265  __esos_lcd44780_hw_config();
266 
267  // install our LCD housekeeping task into the scheduler
268  esos_RegisterTask( __esos_lcd44780_service );
269 }
270 
271 void esos_lcd44780_clearScreen( void )
272 {
273  uint8_t u8_height;
274  uint8_t u8_width;
275  // Clears the buffer
276  for(u8_height = 0; u8_height < ESOS_LCD44780_MEM_HEIGHT; u8_height++){
277  for(u8_width = 0; u8_width < ESOS_LCD44780_MEM_WIDTH; u8_width++){
278  esos_lcd44780_vars.aac_lcdBuffer[u8_height][u8_width] = ' ';
279  esos_lcd44780_vars.ab_lcdBufferNeedsUpdate[u8_height][u8_width] = TRUE;
280  }
281  }
282 
283  esos_lcd44780_setCursor(0,0);
284  esos_lcd44780_vars.b_cursorPositionNeedsUpdate = TRUE;
285 }
286 
287 void esos_lcd44780_setCursorHome( void )
288 {
289  esos_lcd44780_setCursor(0,0);
290  esos_lcd44780_vars.b_cursorPositionNeedsUpdate = TRUE;
291 }
292 
293 void esos_lcd44780_setCursor( uint8_t u8_row, uint8_t u8_column )
294 {
295  // Move cursor to (u8_row,u8_column) without changing memory buffer or the display
296  // TODO: Write hardware-independent code here
297 }
298 
299 void esos_lcd44780_writeChar( uint8_t u8_row, uint8_t u8_column, uint8_t u8_data )
300 {
301  esos_lcd44780_vars.aac_lcdBuffer[u8_row][u8_column] = u8_data;
302  esos_lcd44780_vars.ab_lcdBufferNeedsUpdate[u8_row][u8_column] = TRUE;
303 }
304 
305 uint8_t esos_lcd44780_getChar( uint8_t u8_row, uint8_t u8_column )
306 {
307  return esos_lcd44780_vars.aac_lcdBuffer[u8_row][u8_column];
308 }
309 
310 void esos_lcd44780_writeBuffer( uint8_t u8_row, uint8_t u8_column, uint8_t *pu8_data, uint8_t u8_bufflen ) {
311  // Write u8_bufflen characters from pu8_data to (u8_row,u8_column)
312  //This should ensure that the buffer is written in sequentially left to right
313  // and that the buffer is never written to past its length or width.
314  uint8_t i;
315  for(i = 0; i < u8_bufflen; i++){
316  if(u8_column + i >= 8){
317  u8_row = !u8_row;
318  }
319  esos_lcd44780_vars.aac_lcdBuffer[(u8_row)][(u8_column+i)%ESOS_LCD44780_MEM_WIDTH] = pu8_data[i];
320  esos_lcd44780_vars.ab_lcdBufferNeedsUpdate[(u8_row)][(u8_column+i)%ESOS_LCD44780_MEM_WIDTH] = TRUE;
321  }
322  return;
323 }
324 
325 void esos_lcd44780_getBuffer( uint8_t u8_row, uint8_t u8_column, uint8_t *pu8_data, uint8_t u8_bufflen ) {
326  // Return pu8_data with u8_bufflen characters currently displayed beginning at (u8_row,u8_column)
327  // This should ensure that the buffer is read out sequentially left to right
328  // and that the buffer is never read past its length or width.
329  uint8_t i;
330  for(i = 0; i < u8_bufflen; i++){
331  if(u8_row + i >= ESOS_LCD44780_MEM_WIDTH){
332  u8_column = (u8_column + 1) % ESOS_LCD44780_MEM_WIDTH;
333  }
334  pu8_data[i] = esos_lcd44780_vars.aac_lcdBuffer[(u8_row+i)%ESOS_LCD44780_MEM_HEIGHT][u8_column];
335  }
336  return;
337 }
338 
339 void esos_lcd44780_writeString( uint8_t u8_row, uint8_t u8_column, char *psz_data ) {
340  // Write zero-terminated string psz_data to location starting at (u8_row,u8_column)
341  // This should ensure that the zero-terminated string is written sequentially left to right
342  // and that the buffer is never written to past its length or width.
343 
344  // Find length of zero-terminated string so that we can implement like buffer
345  uint8_t u8_pszbufflen = 0;
346  uint8_t i;
347  while(psz_data[u8_pszbufflen] != '\0'){
348  u8_pszbufflen++;
349  }
350 
351  //replica code from esos_lcd44780_writeBuffer with updated variable names
352  for(i = 0; i < u8_pszbufflen; i++){
353  if(u8_row + i >= ESOS_LCD44780_MEM_WIDTH){
354  u8_column = (u8_column + 1) % ESOS_LCD44780_MEM_WIDTH;
355  }
356  esos_lcd44780_vars.aac_lcdBuffer[(u8_row)][(u8_column+i)%ESOS_LCD44780_MEM_WIDTH] = psz_data[i];
357  esos_lcd44780_vars.ab_lcdBufferNeedsUpdate[(u8_row)][(u8_column+i)%ESOS_LCD44780_MEM_WIDTH] = TRUE;
358  }
359  return;
360 }
361 
362 void esos_lcd44780_setCursorDisplay( BOOL u8_state )
363 {
364  // Set cursor display state to u8_state
365  // TODO: Write hardware-independent code here
366 
367  esos_lcd44780_vars.b_cursorShown = u8_state;
368  esos_lcd44780_vars.b_cursorShownNeedsUpdate = TRUE;
369 }
370 
371 BOOL esos_lcd44780_getCursorDisplay( void )
372 {
373  // Return cursor display state
374  return esos_lcd44780_vars.b_cursorShown;
375 }
376 
377 void esos_lcd44780_setCursorBlink( BOOL u8_state )
378 {
379  // Set cursor blink state to u8_state
380  esos_lcd44780_vars.b_cursorBlink = u8_state;
381  esos_lcd44780_vars.b_cursorBlinkNeedsUpdate = TRUE;
382 }
383 
384 BOOL esos_lcd44780_getCursorBlink( void )
385 {
386  // Return cursor blink state
387  return esos_lcd44780_vars.b_cursorBlink;
388 }
389 
390 void esos_lcd44780_setDisplayVisible( BOOL u8_state )
391 {
392  // Set display visible state to u8_state
393  esos_lcd44780_vars.b_displayVisible = u8_state;
394  esos_lcd44780_vars.b_displayVisibleNeedsUpdate = TRUE;
395 }
396 
397 BOOL esos_lcd44780_getDisplayVisible( void )
398 {
399  // Return display visible state
400  return esos_lcd44780_vars.b_displayVisible;
401 }
402 
403 void esos_lcd44780_setCustomChar( uint8_t u8_charSlot, uint8_t *pu8_charData )
404 {
405  // Set custom character memory for u8_charSlot to data in pu8_charData
406  // TODO: this code is untested.
407  uint8_t i;
408  esos_lcd44780_vars.ab_customCharNeedsUpdate[u8_charSlot] = TRUE;
409  for(i = 0; i < ESOS_LCD44780_NUM_CUSTOM_CHARS; i++) {
410  esos_lcd44780_vars.ast_customChar[u8_charSlot].au8_data[i] = pu8_charData[i];
411  }
412 }
413 
414 void esos_lcd44780_getCustomChar( uint8_t u8_charSlot, uint8_t *pu8_charData )
415 {
416  // Return pu8_charData with custom character memory for u8_charSlot
417  // TODO: Write hardware-independent code here
418 }
419 
420 BOOL esos_lcd44780_isCurrent( void )
421 {
422  uint8_t u8_row, u8_column;
423 
424  if(esos_lcd44780_vars.b_cursorPositionNeedsUpdate ||
425  esos_lcd44780_vars.b_cursorBlinkNeedsUpdate ||
426  esos_lcd44780_vars.b_displayVisibleNeedsUpdate) {
427  return FALSE;
428  }
429 
430  for(u8_row = 0; u8_row < ESOS_LCD44780_MEM_HEIGHT; ++u8_row) {
431  for(u8_column = 0; u8_column < ESOS_LCD44780_MEM_WIDTH; ++u8_column) {
432  if(esos_lcd44780_vars.ab_lcdBufferNeedsUpdate[u8_row][u8_column]) {
433  return FALSE;
434  }
435  }
436  }
437 
438  for(u8_column = 0; u8_column < ESOS_LCD44780_NUM_CUSTOM_CHARS; ++u8_column) {
439  if(esos_lcd44780_vars.ab_customCharNeedsUpdate[u8_column]) {
440  return FALSE;
441  }
442  }
443 
444  return TRUE;
445 }
446 
ESOS_TASK_WAIT_TICKS
#define ESOS_TASK_WAIT_TICKS(u32_duration)
Definition: esos_task.h:375
esos_lcd44780_char_t
Definition: esos_lcd44780wo.h:107
ESOS_TASK_YIELD
#define ESOS_TASK_YIELD()
Definition: esos_task.h:589
esos_lcd44780wo.h
esos.h
ESOS_TASK_END
#define ESOS_TASK_END()
Definition: esos_task.h:271
BOOL
enum _BOOL BOOL
TRUE
@ TRUE
Definition: all_generic.h:410
FALSE
@ FALSE
Definition: all_generic.h:408
stTask
Definition: esos_task.h:54
ESOS_USER_TASK
#define ESOS_USER_TASK(taskname)
Definition: esos_task.h:227
ESOS_TASK_BEGIN
#define ESOS_TASK_BEGIN()
Definition: esos_task.h:259
esos_RegisterTask
ESOS_TASK_HANDLE esos_RegisterTask(uint8_t(*taskname)(ESOS_TASK_HANDLE pstTask))
Definition: esos.c:126