summaryrefslogtreecommitdiffstats
path: root/door_lock/servo.c
diff options
context:
space:
mode:
authorSadeep Madurange <sadeep@asciimx.com>2024-11-06 13:02:18 +0800
committerSadeep Madurange <sadeep@asciimx.com>2024-11-06 13:02:18 +0800
commit7327d5e93e0386914dbe712f8f82e2d015ad7029 (patch)
tree72b9cb669a43ed4ee8ff3b8924c7c3f32b65ccd5 /door_lock/servo.c
parentbe35226d9ebbe3679c38c118a3c7bff34e04c10b (diff)
downloadsmart-home-7327d5e93e0386914dbe712f8f82e2d015ad7029.tar.gz
USe enum for commands.
Diffstat (limited to 'door_lock/servo.c')
-rw-r--r--door_lock/servo.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/door_lock/servo.c b/door_lock/servo.c
index 5ba867f..3e78353 100644
--- a/door_lock/servo.c
+++ b/door_lock/servo.c
@@ -40,19 +40,18 @@ static inline uint8_t is_btn_pressed(uint8_t btn)
int main(void)
{
- char *ulock_cmd;
+ char *cmd;
servo_init();
pcint2_init();
-
serial_init();
sei();
for(;;) {
- ulock_cmd = get_encrypted_ulock_cmd();
-
- if (is_ulock_cmd(ulock_cmd))
+ cmd = get_cmd_hash(DOOR_UNLOCK);
+
+ if (is_valid_cmd(cmd, DOOR_UNLOCK))
serial_write_line("unlock door");
else
serial_write_line("do not unlock door");