generic USART access implementation - receive More...
#include "config.h"#include "usarts.h"#include "rtc.h"#include "usarts_int.h"#include "usarts_all.h"Defines | |
| #define | USART_DEF USART_DEF_RXINT |
Functions | |
| usart_rxdata_t | usart_recv (usart_control_t *uc) |
| get one byte from USART (blocking) | |
generic USART access implementation - receive
| usart_rxdata_t usart_recv | ( | usart_control_t * | uc | ) |
get one byte from USART (blocking)
This function reads one byte from the USART RX FIFO. When the FIFO is empty, it blocks until data has been received.
| uc | pointer to USART control structure |
{
fifo_item_t it;
#if 0 /* duplicated in fifo_get_uint8_t() */
while (!usart_can_recv (uc))
hl_sleep_for_tick (0);
#endif
if (fifo_get_buffer (&uc->rxbuf)) {
it = fifo_get_item (&uc->rxbuf);
return (usart_rxdata_t) {.data = it.data, .flags = it.flags };
}
else
return (usart_rxdata_t) {.data = 0, .flags = USART_NO_RX};
}
1.7.1