diff options
| author | Sadeep Madurange <sadeep@asciimx.com> | 2024-12-01 09:46:30 +0800 |
|---|---|---|
| committer | Sadeep Madurange <sadeep@asciimx.com> | 2024-12-01 09:46:30 +0800 |
| commit | 203617363ac6b57a96a781280d76e1b96264f00e (patch) | |
| tree | 6731904a15d968a23b7587216b4dc0e3503a622d /rf_test/send.c | |
| parent | 9957c93c2c4ac19eaaa539fc0855d3f21769d1f7 (diff) | |
| download | smart-home-203617363ac6b57a96a781280d76e1b96264f00e.tar.gz | |
Baud rate, and other stuff.
Diffstat (limited to 'rf_test/send.c')
| -rw-r--r-- | rf_test/send.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/rf_test/send.c b/rf_test/send.c index e8535e3..8e54859 100644 --- a/rf_test/send.c +++ b/rf_test/send.c @@ -1,3 +1,5 @@ +#include <stdlib.h> + #include <avr/io.h> #include <avr/interrupt.h> #include <util/delay.h> @@ -50,33 +52,32 @@ static inline void write_reg(uint8_t reg, uint8_t val) SPI_PORT |= (1 << SPI_SS); } -static inline void set_mode(uint8_t mode) -{ - write_reg(0x01, mode); - while (!read_reg(0x27)) - ; -} - static inline void radio_init(void) { SPI_DDR |= (1 << SPI_SS) | (1 << SPI_SCK) | (1 << SPI_MOSI); SPI_PORT |= (1 << SPI_SS); SPCR |= (1 << SPE) | (1 << MSTR); - - set_mode(STDBY | LISTEN_ON); + + write_reg(0x01, STDBY); } int main(void) { + uint8_t val; + char buf[100]; + serial_init(); - _delay_ms(5000); + _delay_ms(3000); serial_write_line("Initializing radio"); radio_init(); serial_write_line("Initialized radio"); - for (;;) - ; + for (;;) { + val = read_reg(0x01); + serial_write_line(itoa(val, buf, 16)); + _delay_ms(2000); + } return 0; } |
