From 343a139e10436d074a8d94a63b26ee0fe74280be Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Sun, 24 Nov 2024 15:16:10 +0800 Subject: Updated send and recv files to use rfm. --- rf_test/send.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'rf_test/send.c') diff --git a/rf_test/send.c b/rf_test/send.c index 97ebbcf..539cf79 100644 --- a/rf_test/send.c +++ b/rf_test/send.c @@ -2,23 +2,29 @@ #include #include +#include "rfm.h" + #define LOCK_BTN PD6 #define UNLOCK_BTN PD7 -#define SYN 0xAA +#define ADDR 0xAA #define LOCK 0xB5 #define UNLOCK 0xAE static inline void lock(void) { - spi_send(SYN); - spi_send(LOCK); + uint8_t data[1]; + + data[0] = LOCK; + rfm_sendto(ADDR, data, 1); } static inline void unlock(void) { - spi_send(SYN); - spi_send(UNLOCK); + uint8_t data[1]; + + data[0] = UNLOCK; + rfm_sendto(ADDR, data, 1); } static inline int is_btn_pressed(unsigned char btn) @@ -42,7 +48,7 @@ int main(void) DDRD &= ~((1 << LOCK_BTN) | (1 << UNLOCK_BTN)); PORTD |= (1 << LOCK_BTN) | (1 << UNLOCK_BTN); - spi_init(); + rfm_init(); pcint2_init(); sei(); -- cgit v1.2.3