From 28e90cb35d5b6ee3fbe26e45ef8001bda4b8d859 Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Wed, 16 Apr 2025 14:21:23 +0800 Subject: Move reset_irqs() into flush functions. --- lock/nrfm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lock') diff --git a/lock/nrfm.c b/lock/nrfm.c index dd83f47..560609c 100644 --- a/lock/nrfm.c +++ b/lock/nrfm.c @@ -148,6 +148,8 @@ static inline void flush_tx(void) while (!(SPSR & (1 << SPIF))) ; SPI_PORT |= (1 << SPI_SS); + + reset_irqs(); } static inline void flush_rx(void) @@ -157,6 +159,8 @@ static inline void flush_rx(void) while (!(SPSR & (1 << SPIF))) ; SPI_PORT |= (1 << SPI_SS); + + reset_irqs(); } static inline uint8_t rx_pdlen(void) @@ -243,7 +247,6 @@ uint8_t radio_sendto( tx_mode(); flush_tx(); - reset_irqs(); setaddr(0x10, addr); setaddr(0x0A, addr); @@ -302,7 +305,6 @@ uint8_t radio_recv(char *buf, uint8_t n) pdlen = rx_pdlen(); if (pdlen == 0) { flush_rx(); - reset_irqs(); uart_write_line("ERROR: PDLEN = 0, abort read"); return 0; } @@ -313,7 +315,6 @@ uint8_t radio_recv(char *buf, uint8_t n) if (pdlen > MAXPDLEN) { flush_rx(); - reset_irqs(); uart_write_line("ERROR: PDLEN > MAXPDLEN, abort read"); return 0; } @@ -333,9 +334,7 @@ uint8_t radio_recv(char *buf, uint8_t n) SPI_PORT |= (1 << SPI_SS); flush_rx(); - reset_irqs(); enable_chip(); - return readlen - 1; } -- cgit v1.2.3