/* Retargets the C library printf function to the USART.  */
int fputc(int ch, FILE *f)
/* Retargets the C library printf function to the USART.  */
int fputc(int ch, FILE *f)
{
static unsigned portSHORT usColumn = 0, usRefColumn = mainCOLUMN_START;
static unsigned portCHAR ucLine = 0;
	if( ( usColumn == 0 ) && ( ucLine == 0 ) )
	{
		LCD_Clear();
	}
	if( ch != '\n' )
	{
		LCD_DisplayChar( ucLine, usRefColumn, (u8) ch );
		usRefColumn -= mainCOLUMN_INCREMENT;
		usColumn++;
		if( usColumn == mainMAX_COLUMN )
		{
			ucLine += mainROW_INCREMENT;
			usRefColumn = mainCOLUMN_START;
			usColumn = 0;
		}
	}
	else
	{
		ucLine += mainROW_INCREMENT;
		usRefColumn = mainCOLUMN_START;
		usColumn = 0;	}
	if( ucLine >= mainMAX_LINE )
	{
		ucLine = 0;
	}
	return ch;
}