Hello,
I have a question regarding regarding the below embedded function of the SCI driver library:
static inline uint16_t SCI_readCharBlockingFIFO(uint32_t base) { // // Check the arguments. // ASSERT(SCI_isBaseValid(base)); // // Wait until a character is available in the receive FIFO. // while(SCI_getRxFIFOStatus(base) == SCI_FIFO_RX0) { // //If there is any error return // if((SCI_getRxStatus(base) & SCI_RXSTATUS_ERROR) != 0U) { return(0U); } } // // Return the character from the receive buffer. // return((uint16_t)(HWREGH(base + SCI_O_RXBUF) & SCI_RXBUF_SAR_M)); }
As you can see, that function returns the value 0 in case of an error. The problem is, that the value 0 is a valid character in case that binary data are being received over UART(no ASCII communication). Wouldn't it be more meaningful if that function returns valid characters between 0x0...0xFF and in case of an error it returns -1 (since the return values is of type 16-bit and -1 would be 0xFFFF)?
Thanks,
Inno