summaryrefslogtreecommitdiffstats
path: root/lock
diff options
context:
space:
mode:
authorSadeep Madurange <sadeep@asciimx.com>2025-04-16 14:21:23 +0800
committerSadeep Madurange <sadeep@asciimx.com>2025-04-16 14:21:23 +0800
commit28e90cb35d5b6ee3fbe26e45ef8001bda4b8d859 (patch)
tree08e01055cb52fcbb2f232d86595199eb8df3fa88 /lock
parent265a511910db2ab027e7948fdd624801b34821fc (diff)
downloadsmart-home-28e90cb35d5b6ee3fbe26e45ef8001bda4b8d859.tar.gz
Move reset_irqs() into flush functions.
Diffstat (limited to 'lock')
-rw-r--r--lock/nrfm.c9
1 files changed, 4 insertions, 5 deletions
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;
}