And this is the routine that calls the above routine
//************************************************************************
static boolean LCD_ProcessChar(char theChar)
{
boolean echoTheChar;
//* this is so all 4 lines get used, when a CR comes in, we will wait
//* until the next char to actually do the scrolling
if (gNeedToScroll && (theChar != 0x0A))
{
LCD_BumpToNextLine(true);
gNeedToScroll = false;
}
echoTheChar = false;
switch(theChar)
{
case 0x07: //* Bell
TurnBellOn_Off(true);
break;
case 0x08: //* back space
gLCD_currentColumn--;
if (gLCD_currentColumn < 0)
{
gLCD_currentColumn = 0;
}
gLCD.setCursor(gLCD_currentColumn, gLCD_currentRow);
echoTheChar = true;
break;
case 0x09: //* tab
LCD_DisplayPrintableChar(0x20);
while (gLCD_currentColumn % 4)
{
LCD_DisplayPrintableChar(0x20);
}
break;
case 0x0A: //* Line feed
echoTheChar = true;
break;
case 0x0B: //* Vertical tab (the opposite of line feed)
gLCD_currentRow--;
if (gLCD_currentRow < 0)
{
gLCD_currentRow = 0;
}
gLCD.setCursor(gLCD_currentColumn, gLCD_currentRow);
break;
case 0x0C: //* form feed
LCD_ClearScreen();
echoTheChar = true;
break;
case 0x0D: //* Carriage return
#ifdef _ENABLE_BIG_FONTS_
if (gCurrentFont == kFont_Large)
{
gLCD_currentColumn = 0;
gLCD_currentRow += 2;
if (gLCD_currentRow >= gLCD_MaxLines)
{
LCD_ClearScreen();
}
else
{
gLCD.clearLine(2);
gLCD.clearLine(3);
}
}
else
#endif
{
if (gLCD_ScrollEnabled && (gLCD_currentRow == (gLCD_MaxLines - 1)))
{
//* we dont want to do the CR if we just forced a bump because of line overflow
if (gWrapHasOccured == false)
{
gNeedToScroll = true;
}
}
else
{
LCD_BumpToNextLine(true);
}
}
gWrapHasOccured = false;
echoTheChar = true;
break;
case 0x0e: //* ^N SHIFT OUT - use alternate character set
SetFont(kFont_Alternate);
break;
case 0x0f: //* ^O SHIFT IN, resume default character set
SetFont(kFont_Normal);
break;
case 0x1B: //* ESCAPE
gEscapeSequenceActive = true;
break;
default: // display each character to the LCD
if (theChar >= 0x20)
{
echoTheChar = true;
switch(gCurrentFont)
{
case kFont_Alternate:
LCD_DisplayPrintableChar(theChar + 0x80);
break;
#ifdef _ENABLE_BIG_FONTS_
case kFont_Large:
if (gLCD_currentColumn >= (gLCD_MaxColumns - 2))
{
gLCD_currentColumn = 0;
gLCD_currentRow += 2;
if (gLCD_currentRow >= gLCD_MaxLines)
{
gLCD_currentRow = 0;
gLCD.clearLine(0);
gLCD.clearLine(1);
}
else
{
gLCD.clearLine(2);
gLCD.clearLine(3);
}
}
gLCD_currentColumn += DrawBigChar(gLCD_currentColumn, gLCD_currentRow, theChar);
break;
#endif
case kFont_Normal:
default:
LCD_DisplayPrintableChar(theChar);
break;
}
}
break;
}
#ifdef _ENABLE_MORSE_CODE_
if (gEnableMorseCode)
{
SendMorseCode(theChar, gMorseCodeWPM);
}
#endif
return(echoTheChar);
}