summaryrefslogtreecommitdiffstats
path: root/rf_test/send.c
diff options
context:
space:
mode:
authorSadeep Madurange <sadeep@asciimx.com>2024-11-24 15:16:10 +0800
committerSadeep Madurange <sadeep@asciimx.com>2024-11-24 15:16:10 +0800
commit343a139e10436d074a8d94a63b26ee0fe74280be (patch)
tree2e5e6bd7a0b560e163419a7b1d06b0a69ecc16c7 /rf_test/send.c
parent965ba924daf988946a39a49926d0e8d61c2ae805 (diff)
downloadsmart-home-343a139e10436d074a8d94a63b26ee0fe74280be.tar.gz
Updated send and recv files to use rfm.
Diffstat (limited to 'rf_test/send.c')
-rw-r--r--rf_test/send.c18
1 files changed, 12 insertions, 6 deletions
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 <avr/interrupt.h>
#include <util/delay.h>
+#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();