Hello I have a question about your code :
static int fnInitDisplay(int iState)
{
// After power up the display needs to be idle for >= 30ms. This is ensured by a start up delay of the task
if ((ucDispCount != 0) && (!fnSendDisplay())) return iState; // return when display transmitter busy, sending next byte on the way
if (iState > WRITE_FUNCTION_SET) {
return iState; // LCD is busy
}
switch (iState) {
case STATE_INIT: // initialise the LCD hardware once on startup
INITIALISE_LCD_CONTROL_LINES(); // initialise the LCD hardware once on startup
case STATE_INITIALISING:
_fnWriteDisplay(0, INIT_FUNCTION_SET); // write function set
uTaskerMonoTimer( OWN_TASK, T_INIT_WAIT, E_INIT_CONTINUE ); // wait at least 4,1ms the first time and 100us the second time - we do longer waits than necessayr
break;
case WRITE_FUNCTION_SET:
_fnWriteDisplay(0, INIT_FUNCTION_SET); // repeat after at least 4,1ms
_fnWriteDisplay(0, INIT_FUNCTION_SET_MODE); // set final value after another 100us (after this the LCD is in the required 4 or 8 bit mode)
uTaskerStateChange(OWN_TASK, UTASKER_GO); // switch to polling mode of operation since BF (Busy Flag) is not valid
break;
case STATE_INIT_2:
fnWriteDisplay(0, (INIT_FUNCTION_SET_MODE | N_BIT | F_BIT)); // 2 line mode, display on
break;
case STATE_INIT_3:
fnWriteDisplay(0, DISPLAY_OFF_NO_CURSOR);
break;
case STATE_INIT_4:
fnWriteDisplay(0, CLEAR_DISPLAY);
break;
case STATE_DISPLAY_INITIALISED:
fnWriteDisplay(0, DISPLAY_ON_NO_CURSOR);
// At this point the display is clear and the cursor is at the home position.
// we inform the application that the initialisation has terminated, so that it can start using it
fnEventMessage(LCD_PARTNER_TASK, TASK_LCD, E_LCD_INITIALISED);
return STATE_LCD_READY; // we are ready to work....
case STATE_LCD_SENDING:
uTaskerStateChange(OWN_TASK, UTASKER_STOP); // switch to event mode of operation
fnEventMessage(LCD_PARTNER_TASK, TASK_LCD, E_LCD_READY); // we have completed an operation for the application
break;
default:
if (iState > STATE_LCD_READY) { // writing a pattern
if (--iState <= STATE_LCD_READY) { // last character to be written
iState = STATE_LCD_SENDING;
}
fnWriteLine(ucTXDisp, 1, O_CONTROL_RS); // repeat the test pattern
}
return iState;
}
return (++iState);
}
How it's possible to reach the case : STATE_INIT_2
The code :
if (iState > WRITE_FUNCTION_SET) {
return iState; // LCD is busy
}
Short circuit the next line.
Could you explain to me how does it work because i don't understand yet .
Thank's