summaryrefslogtreecommitdiffstats
path: root/rf_test/radio.c
diff options
context:
space:
mode:
Diffstat (limited to 'rf_test/radio.c')
-rw-r--r--rf_test/radio.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/rf_test/radio.c b/rf_test/radio.c
index 9db0f05..143a67c 100644
--- a/rf_test/radio.c
+++ b/rf_test/radio.c
@@ -22,6 +22,7 @@
#define RF69_REG_TESTPA1 0x5A
#define RF69_REG_TESTPA2 0x5C
#define RF69_REG_IRQFLAGS1 0x27
+#define RF69_REG_IRQFLAGS2 0x28
#define RF69_PALEVEL_PA1 0x40
#define RF69_PALEVEL_PA2 0x20
@@ -112,6 +113,7 @@ void radio_send(const char *data, uint8_t n)
set_mode(RF69_OPMODE_STDBY);
cli();
+
SPI_PORT &= ~(1 << SPI_SS);
SPDR = 0x00 | 0x80;
@@ -125,8 +127,13 @@ void radio_send(const char *data, uint8_t n)
}
SPI_PORT |= (1 << SPI_SS);
+
sei();
set_mode(RF69_OPMODE_TX);
+
+ while (!(read_reg(RF69_REG_IRQFLAGS2) & 0x08))
+ ;
+ set_mode(RF69_OPMODE_STDBY);
}
uint8_t radio_recv(char *buf, uint8_t n)