From e6909adcb1d44797e097dcf93ee7459276a4516a Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 19 Nov 2023 01:47:40 -0700 Subject: moved prevent_reboot_loop() and some other junk out of fsm/main.c --- arch/attiny1616.c | 6 ++++++ arch/attiny1616.h | 2 ++ arch/attiny1634.c | 6 ++++++ arch/attiny1634.h | 2 ++ arch/attiny85.c | 21 +++++++++++++++++++++ arch/attiny85.h | 2 ++ fsm/main.c | 50 +++----------------------------------------------- 7 files changed, 42 insertions(+), 47 deletions(-) diff --git a/arch/attiny1616.c b/arch/attiny1616.c index 3b170bb..a3ead7e 100644 --- a/arch/attiny1616.c +++ b/arch/attiny1616.c @@ -145,3 +145,9 @@ void reboot() { while (1) {} } +inline void prevent_reboot_loop() { + // prevent WDT from rebooting MCU again + RSTCTRL.RSTFR &= ~(RSTCTRL_WDRF_bm); // reset status flag + wdt_disable(); +} + diff --git a/arch/attiny1616.h b/arch/attiny1616.h index 5989785..b4e17fc 100644 --- a/arch/attiny1616.h +++ b/arch/attiny1616.h @@ -94,3 +94,5 @@ inline void mcu_pcint_off(); void reboot(); +inline void prevent_reboot_loop(); + diff --git a/arch/attiny1634.c b/arch/attiny1634.c index d4b3767..0737a81 100644 --- a/arch/attiny1634.c +++ b/arch/attiny1634.c @@ -123,3 +123,9 @@ void reboot() { while (1) {} } +inline void prevent_reboot_loop() { + // prevent WDT from rebooting MCU again + MCUSR &= ~(1<= 1 - PWM1_LVL = 0; - #endif - #if PWM_CHANNELS >= 2 - PWM2_LVL = 0; - #endif - #if PWM_CHANNELS >= 3 - PWM3_LVL = 0; - #endif - #if PWM_CHANNELS >= 4 - PWM4_LVL = 255; // inverted :( - #endif - #endif standby_mode(); } -- cgit v1.2.3