From d0f895105f41c40f9a6a000b3437ad55b1ef9bc6 Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Wed, 16 Apr 2025 17:21:15 +0800 Subject: Function to flush RX buffers. --- lock/nrfm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lock/nrfm.c') diff --git a/lock/nrfm.c b/lock/nrfm.c index 560609c..7630453 100644 --- a/lock/nrfm.c +++ b/lock/nrfm.c @@ -152,7 +152,7 @@ static inline void flush_tx(void) reset_irqs(); } -static inline void flush_rx(void) +void radio_flush_rx(void) { SPI_PORT &= ~(1 << SPI_SS); SPDR = 0b11100010; @@ -304,7 +304,7 @@ uint8_t radio_recv(char *buf, uint8_t n) pdlen = rx_pdlen(); if (pdlen == 0) { - flush_rx(); + radio_flush_rx(); uart_write_line("ERROR: PDLEN = 0, abort read"); return 0; } @@ -314,7 +314,7 @@ uint8_t radio_recv(char *buf, uint8_t n) uart_write_line(s); if (pdlen > MAXPDLEN) { - flush_rx(); + radio_flush_rx(); uart_write_line("ERROR: PDLEN > MAXPDLEN, abort read"); return 0; } @@ -333,7 +333,7 @@ uint8_t radio_recv(char *buf, uint8_t n) } SPI_PORT |= (1 << SPI_SS); - flush_rx(); + radio_flush_rx(); enable_chip(); return readlen - 1; } -- cgit v1.2.3