diff options
| author | Sadeep Madurange <sadeep@asciimx.com> | 2025-06-14 14:18:39 +0800 |
|---|---|---|
| committer | Sadeep Madurange <sadeep@asciimx.com> | 2025-06-14 14:18:39 +0800 |
| commit | d03bca4d47f16efd5cd081864b45f7dc2afd0dee (patch) | |
| tree | e7c8843583f76c11f8f7670a1bbef8a3ec7138bd | |
| parent | 2de7224cc9228dd680e094a6439db3fc294554f2 (diff) | |
| download | fpm-door-lock-d03bca4d47f16efd5cd081864b45f7dc2afd0dee.tar.gz | |
Clear and enable interrupts in IRQ handlers.
| -rw-r--r-- | main.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -138,25 +138,33 @@ static inline int is_pressed(uint8_t btn) ISR(FPM_INT_VEC) { + cli(); + if (fpm_match()) { unlock(); fpm_led(BREATHE, BLUE, 1); } else { fpm_led(BREATHE, RED, 1); } + + sei(); } ISR(BTN_INT_VEC) { uint16_t id; + cli(); + if (is_pressed(FRONT_LOCK_PIN)) { lock(); fpm_led(FLASH, RED, 1); } else if (is_pressed(BACK_LOCK_PIN)) { lock(); + fpm_led(FLASH, RED, 1); } else if (is_pressed(BACK_UNLOCK_PIN)) { unlock(); + fpm_led(FLASH, BLUE, 1); } else if (is_pressed(ENROLL_PIN)) { id = fpm_match(); if (id == 1 || id == 2) { @@ -169,4 +177,6 @@ ISR(BTN_INT_VEC) } else fpm_led(BREATHE, RED, 1); } + + sei(); } |
