summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSadeep Madurange <sadeep@asciimx.com>2025-04-07 14:35:35 +0800
committerSadeep Madurange <sadeep@asciimx.com>2025-04-07 14:35:35 +0800
commit9ec776c0cf221800d66a0e0859da73c60e5e9925 (patch)
tree6b4de5cd93bc787316b4062f92931d612e99a301
parentc0766d32115ef8b5e92608555fad55a3618b69da (diff)
downloadsmart-home-9ec776c0cf221800d66a0e0859da73c60e5e9925.tar.gz
frnt rx init.
-rw-r--r--lock/frnt.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lock/frnt.c b/lock/frnt.c
index 18eac98..8a738d5 100644
--- a/lock/frnt.c
+++ b/lock/frnt.c
@@ -34,13 +34,17 @@ int main(void)
char key[WDLEN + 1], msg[WDLEN + 1];
+ RX_DDR &= ~(1 << RX_PIN);
+ RX_PORT |= (1 << RX_PIN);
+ PCICR |= (1 << RX_PCIE);
+ RX_PCMSK |= (1 << RX_PCINT);
+
uart_init();
radio_init(rxaddr);
radio_print_config();
for (;;) {
_delay_ms(2000); /* todo: fingerprint check */
-
xor(KEY, SYN, msg, WDLEN);
radio_sendto(txaddr, msg, WDLEN);
await_reply();
@@ -48,7 +52,6 @@ int main(void)
n = radio_recv(msg, WDLEN);
msg[n] = '\0';
rxdr = 0;
-
xor(KEY, msg, key, WDLEN);
xor(key, LOCK, msg, WDLEN);
radio_sendto(txaddr, msg, WDLEN);
@@ -63,7 +66,6 @@ int main(void)
// power down
}
}
-
return 0;
}