diff options
Diffstat (limited to 'project/Core/Src/Devices')
| -rw-r--r-- | project/Core/Src/Devices/UART.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/project/Core/Src/Devices/UART.c b/project/Core/Src/Devices/UART.c index b1eb30c..7c11e30 100644 --- a/project/Core/Src/Devices/UART.c +++ b/project/Core/Src/Devices/UART.c @@ -108,6 +108,13 @@ uint8_t USART_Read (USART_TypeDef * USARTx) { // Reading USART_DR automatically clears the RXNE flag } +uint8_t USART_Read_Nonblocking (USART_TypeDef * USARTx) { + if (!(USARTx->ISR & USART_ISR_RXNE)) + return 0; + + return ((uint8_t)(USARTx->RDR & 0xFF)); +} + void USART_Write(USART_TypeDef * USARTx, uint8_t *buffer, uint32_t nBytes) { int i; // TXE is cleared by a write to the USART_DR register. |
