diff options
| author | Selene ToyKeeper | 2021-04-02 14:34:10 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2021-04-02 14:34:10 -0600 |
| commit | 7713133fedd51212eee10c8ed855e512820ff5fb (patch) | |
| tree | aca9e6bf2fb078aa50ad71800afeace32be61daa /spaghetti-monster/fsm-pcint.c | |
| parent | updated MODELS file with missing K9.3-nofet build target (diff) | |
| parent | re-numbered t1616 builds to reflect manufacturer better (diff) | |
| download | anduril-7713133fedd51212eee10c8ed855e512820ff5fb.tar.gz anduril-7713133fedd51212eee10c8ed855e512820ff5fb.tar.bz2 anduril-7713133fedd51212eee10c8ed855e512820ff5fb.zip | |
merged gchart's Tiny1 series branch for t1616 support
Diffstat (limited to 'spaghetti-monster/fsm-pcint.c')
| -rw-r--r-- | spaghetti-monster/fsm-pcint.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/spaghetti-monster/fsm-pcint.c b/spaghetti-monster/fsm-pcint.c index 24cc82c..4ada5b8 100644 --- a/spaghetti-monster/fsm-pcint.c +++ b/spaghetti-monster/fsm-pcint.c @@ -46,6 +46,8 @@ inline void PCINT_on() { #else GIMSK |= (1 << SWITCH_PCIE); #endif + #elif defined(AVRXMEGA3) // ATTINY816, 817, etc) + SWITCH_ISC_REG |= PORT_ISC_BOTHEDGES_gc; #else #error Unrecognized MCU type #endif @@ -58,6 +60,8 @@ inline void PCINT_off() { #elif (ATTINY == 1634) // disable all pin-change interrupts GIMSK &= ~(1 << SWITCH_PCIE); + #elif defined(AVRXMEGA3) // ATTINY816, 817, etc) + SWITCH_ISC_REG &= ~(PORT_ISC_gm); #else #error Unrecognized MCU type #endif @@ -65,19 +69,20 @@ inline void PCINT_off() { //void button_change_interrupt() { #if (ATTINY == 25) || (ATTINY == 45) || (ATTINY == 85) || (ATTINY == 1634) -//EMPTY_INTERRUPT(PCINT0_vect); -#ifdef PCINT_vect -ISR(PCINT_vect) { -#else -ISR(PCINT0_vect) { -#endif - irq_pcint = 1; -} + #ifdef PCINT_vect + ISR(PCINT_vect) { + #else + ISR(PCINT0_vect) { + #endif +#elif defined(AVRXMEGA3) // ATTINY816, 817, etc) + ISR(SWITCH_VECT) { + // Write a '1' to clear the interrupt flag + SWITCH_INTFLG |= (1 << SWITCH_PIN); #else #error Unrecognized MCU type #endif -/* -ISR(PCINT0_vect) { + + irq_pcint = 1; // let deferred code know an interrupt happened //DEBUG_FLASH; @@ -86,9 +91,7 @@ ISR(PCINT0_vect) { // noisy / bouncy switch (so the content of this function has been // moved to a separate function, called from WDT only) // PCINT_inner(button_is_pressed()); - } -*/ // should only be called from PCINT and/or WDT // (is a separate function to reduce code duplication) |
