aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-main.c
diff options
context:
space:
mode:
authorGabriel Hart2020-12-18 15:23:31 -0600
committerGabriel Hart2020-12-18 15:23:31 -0600
commitdbe0aaf636ccb78a3cc1281b6a1ea6c662af6756 (patch)
tree59a05a2ba48af2a8c659946b74be50a5570e9ea3 /spaghetti-monster/fsm-main.c
parentadded model number to Lume1 FW3X build target (diff)
downloadanduril-dbe0aaf636ccb78a3cc1281b6a1ea6c662af6756.tar.gz
anduril-dbe0aaf636ccb78a3cc1281b6a1ea6c662af6756.tar.bz2
anduril-dbe0aaf636ccb78a3cc1281b6a1ea6c662af6756.zip
Add AVR 1-Series and t1616 board and scripts
Diffstat (limited to '')
-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