diff options
| author | Sadeep Madurange <sadeep@asciimx.com> | 2024-11-30 21:20:30 +0800 |
|---|---|---|
| committer | Sadeep Madurange <sadeep@asciimx.com> | 2024-11-30 21:20:30 +0800 |
| commit | 9957c93c2c4ac19eaaa539fc0855d3f21769d1f7 (patch) | |
| tree | 3f9ea62b4cb90043dc9c1a30e224244585368b8f /rf_test | |
| parent | 8f2c8f85dac54c1c84724d83f514bf1acdd391ce (diff) | |
| download | smart-home-9957c93c2c4ac19eaaa539fc0855d3f21769d1f7.tar.gz | |
Remove read_reg() from write_reg().
Diffstat (limited to 'rf_test')
| -rw-r--r-- | rf_test/send.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/rf_test/send.c b/rf_test/send.c index 462f6e8..e8535e3 100644 --- a/rf_test/send.c +++ b/rf_test/send.c @@ -37,23 +37,17 @@ static inline uint8_t read_reg(uint8_t reg) static inline void write_reg(uint8_t reg, uint8_t val) { - serial_write_line("writing register"); - - while (read_reg(reg) != val) { - SPI_PORT &= ~(1 << SPI_SS); - - SPDR = reg | 0x80; - while (!(SPSR & (1 << SPIF))) - ; + SPI_PORT &= ~(1 << SPI_SS); - SPDR = val; - while (!(SPSR & (1 << SPIF))) - ; + SPDR = reg | 0x80; + while (!(SPSR & (1 << SPIF))) + ; - SPI_PORT |= (1 << SPI_SS); - } + SPDR = val; + while (!(SPSR & (1 << SPIF))) + ; - serial_write_line("writing register done"); + SPI_PORT |= (1 << SPI_SS); } static inline void set_mode(uint8_t mode) |
