msvklr
Newbie level 3
Hi
Could anyone describe the Uart0GetChar function, line by line? I really don't get it.. What are tU8 and tU32 types?
Could anyone describe the Uart0GetChar function, line by line? I really don't get it.. What are tU8 and tU32 types?
Code:
while(1)
{
static tU32 rxCharCnt = 0;
tU8 rxChar;
//check if any character has been received
if (uart0GetChar(&rxChar) == TRUE)
{
uart0SendString("Jest ok");
}
}
return 0;
}
tU8
uart0GetChar(tU8 *pRxChar)
{
tU32 tmpTail;
/* buffer is empty */
if(uart0RxHead == uart0RxTail)
return FALSE;
tmpTail = (uart0RxTail + 1) & RX_BUFFER_MASK;
uart0RxTail = tmpTail;
*pRxChar = uart0RxBuf[tmpTail];
return TRUE;
}
tU8
uart0GetCh(void)
{
tU8 rxChar;
//wait for a character to be available
while(uart0GetChar(&rxChar) == FALSE)
;
return rxChar;
}