From dbe0aaf636ccb78a3cc1281b6a1ea6c662af6756 Mon Sep 17 00:00:00 2001 From: Gabriel Hart Date: Fri, 18 Dec 2020 15:23:31 -0600 Subject: Add AVR 1-Series and t1616 board and scripts --- spaghetti-monster/fsm-main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'spaghetti-monster/fsm-main.c') 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<