diff options
| author | Sadeep Madurange <sadeep@asciimx.com> | 2024-12-14 12:40:38 +0800 |
|---|---|---|
| committer | Sadeep Madurange <sadeep@asciimx.com> | 2024-12-14 12:40:38 +0800 |
| commit | c69d3b4fffc543fe04e114222a8e225f476559aa (patch) | |
| tree | e3e263056d45031995984a39344053d976084f57 | |
| parent | 7ae63d313dd5bb23c92bd45cc923afaae329d132 (diff) | |
| download | smart-home-c69d3b4fffc543fe04e114222a8e225f476559aa.tar.gz | |
wip: inline standby()
| -rw-r--r-- | rf_test/radio.c | 19 | ||||
| -rw-r--r-- | rf_test/recv.c | 3 |
2 files changed, 10 insertions, 12 deletions
diff --git a/rf_test/radio.c b/rf_test/radio.c index bf94147..c7a0523 100644 --- a/rf_test/radio.c +++ b/rf_test/radio.c @@ -38,18 +38,13 @@ static inline void write_reg(uint8_t reg, uint8_t val) SPI_PORT |= (1 << SPI_SS); } -static inline void standby(void) -{ - write_reg(0x01, 0x04); - while (!(read_reg(0x27) & 0x80)) - ; -} - void radio_send(const char *data, uint8_t n) { uint8_t i; - standby(); + write_reg(0x01, 0x04); + while (!(read_reg(0x27) & 0x80)) + ; SPI_PORT &= ~(1 << SPI_SS); SPDR = 0x00 | 0x80; @@ -69,7 +64,9 @@ void radio_send(const char *data, uint8_t n) while (!(read_reg(0x28) & 0x08)) ; - standby(); + write_reg(0x01, 0x04); + while (!(read_reg(0x27) & 0x80)) + ; } uint8_t radio_recv(char *buf, uint8_t n) @@ -78,7 +75,9 @@ uint8_t radio_recv(char *buf, uint8_t n) read_len = 0; - standby(); + write_reg(0x01, 0x04); + while (!(read_reg(0x27) & 0x80)) + ; SPI_PORT &= ~(1 << SPI_SS); SPDR = 0x00 | 0x7F; diff --git a/rf_test/recv.c b/rf_test/recv.c index 47b8b7e..0b07144 100644 --- a/rf_test/recv.c +++ b/rf_test/recv.c @@ -1,4 +1,3 @@ -#include <string.h> #include <avr/io.h> #include <avr/interrupt.h> @@ -16,7 +15,7 @@ #define MAX_PAYLOAD_LEN 60 static char *s = "hello, world!"; -static uint8_t slen = strlen(s); +static uint8_t slen = 13; int main(void) { |
