diff options
| -rw-r--r-- | main.c | 41 |
1 files changed, 21 insertions, 20 deletions
@@ -62,6 +62,20 @@ uint16_t getvcc(void) return vcc; } +static inline void lock(void) +{ + OCR1A = PWM_MID; + _delay_ms(100); + OCR1A = PWM_TOP; +} + +static inline void unlock(void) +{ + OCR1A = PWM_MAX; + _delay_ms(100); + OCR1A = PWM_TOP; +} + int main(void) { /* disable watchdog timer */ @@ -75,6 +89,13 @@ int main(void) LED_DDR |= (1 << LED_PIN); LED_PORT &= ~(1 << LED_PIN); + for (int i = 0; i < 4; i++) { + LED_PORT |= (1 << LED_PIN); + _delay_ms(70); + LED_PORT &= ~(1 << LED_PIN); + _delay_ms(70); + } + /* init input ports */ INPUT_DDR &= ~((1 << BACK_LOCK_PIN) | (1 << BACK_UNLOCK_PIN) | (1 << FRONT_LOCK_PIN) | (1 << FRONT_UNLOCK_PIN) | @@ -102,31 +123,11 @@ int main(void) sei(); for (;;) { - if (getvcc() < VCC_MIN) - LED_PORT |= (1 << LED_PIN); - - sleep_bod_disable(); - set_sleep_mode(SLEEP_MODE_PWR_DOWN); - sleep_mode(); } return 0; } -static inline void lock(void) -{ - OCR1A = PWM_MID; - _delay_ms(100); - OCR1A = PWM_TOP; -} - -static inline void unlock(void) -{ - OCR1A = PWM_MAX; - _delay_ms(100); - OCR1A = PWM_TOP; -} - static inline int is_pressed(uint8_t btn) { if (!((PIND >> btn) & 0x01)) { |
