aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-main.c
diff options
context:
space:
mode:
authorSelene ToyKeeper2021-04-01 16:30:16 -0600
committerSelene ToyKeeper2021-04-01 16:30:16 -0600
commitbc281fdece8f3913c9ae13503f6d049e8879e0ce (patch)
treed96db6041a308caed35ee693389434263c901dd7 /spaghetti-monster/fsm-main.c
parentupdated MODELS file with missing K9.3-nofet build target (diff)
parentMerge TKs changes from 2021-01-25 (diff)
downloadanduril-bc281fdece8f3913c9ae13503f6d049e8879e0ce.tar.gz
anduril-bc281fdece8f3913c9ae13503f6d049e8879e0ce.tar.bz2
anduril-bc281fdece8f3913c9ae13503f6d049e8879e0ce.zip
merged gchart's Tiny1 series branch for tiny1616 support
Diffstat (limited to 'spaghetti-monster/fsm-main.c')
-rw-r--r--spaghetti-monster/fsm-main.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/spaghetti-monster/fsm-main.c b/spaghetti-monster/fsm-main.c
index b96bce8..f3c319c 100644
--- a/spaghetti-monster/fsm-main.c
+++ b/spaghetti-monster/fsm-main.c
@@ -23,6 +23,9 @@
#include "fsm-main.h"
#if PWM_CHANNELS == 4
+#ifdef AVRXMEGA3 // ATTINY816, 817, etc
+#error 4-channel PWM not currently set up for the AVR 1-Series
+#endif
// 4th PWM channel requires manually turning the pin on/off via interrupt :(
ISR(TIMER1_OVF_vect) {
//bitClear(PORTB, 3);
@@ -68,7 +71,7 @@ static inline void hw_setup() {
PORTB = (1 << SWITCH_PIN); // e-switch is the only input
PCMSK = (1 << SWITCH_PIN); // pin change interrupt uses this pin
}
-#elif (ATTINY == 1634)
+#elif (ATTINY == 1634) || defined(AVRXMEGA3) // ATTINY816, 817, etc
static inline void hw_setup() {
// this gets tricky with so many pins...
// ... so punt it to the hwdef file
@@ -82,7 +85,11 @@ static inline void hw_setup() {
//#ifdef USE_REBOOT
static inline void prevent_reboot_loop() {
// prevent WDT from rebooting MCU again
+ #ifdef AVRXMEGA3 // ATTINY816, 817, etc
+ RSTCTRL.RSTFR &= ~(RSTCTRL_WDRF_bm); // reset status flag
+ #else
MCUSR &= ~(1<<WDRF); // reset status flag
+ #endif
wdt_disable();
}
//#endif