From 9957c93c2c4ac19eaaa539fc0855d3f21769d1f7 Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Sat, 30 Nov 2024 21:20:30 +0800 Subject: Remove read_reg() from write_reg(). --- rf_test/send.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'rf_test') 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) -- cgit v1.2.3