aboutsummaryrefslogtreecommitdiff
path: root/fsm/pcint.c
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-11-30 09:19:45 -0700
committerSelene ToyKeeper2023-11-30 09:19:45 -0700
commitf745e12c3bc48d8fe544893871191086cf3cccc9 (patch)
tree0e7f6c2c5f362719ac4efad9d5c2365f3ed3c159 /fsm/pcint.c
parentadded md5sum to build-all.sh output per target (diff)
parenteliminated direct CCP register access from arch/attiny1616 (diff)
downloadanduril-f745e12c3bc48d8fe544893871191086cf3cccc9.tar.gz
anduril-f745e12c3bc48d8fe544893871191086cf3cccc9.tar.bz2
anduril-f745e12c3bc48d8fe544893871191086cf3cccc9.zip
Merge branch 'avr32dd20-devkit' into trunk
Added support for AVR DD MCUs, particularly avr32dd20. Also did a bunch of refactoring for how MCU support works, cleaned up the ADC code, switched to consistent internal formats for voltage and temperature, fixed the FW3X, and some other little things. * avr32dd20-devkit: (28 commits) eliminated direct CCP register access from arch/attiny1616 made the avr32dd20 flashing script more universal added a build target for FW3X with manually-fixed RGB aux wiring prevent future issues like the FW3X had fixed FW3X thermal regulation fixed incorrect temperature history for a few seconds after waking fsm/adc: removed dead code FW3X: fixed external temperature sensor FW3X: multiple upgrades... fw3x: fixed swapped red+blue, fixed battery measurements, added police color strobe fixed ADC on sp10-pro fixed ADC on attiny85 and related builds fixed ADC on attiny1634 and related builds more ADC / DAC / MCU progress... avr32dd20-devkit: make the defaults a bit more dev friendly (realtime voltage colors, and no simple UI by default) ADC voltage: battcheck 3 digits, fixed t1616, switched back to 8-bit internal volt unit got ADC voltage+temp working on avrdd... but broke all other builds/MCUs 1.55V AA battery should not show as "white" voltage color, only purple started refactoring fsm/adc.*, but need a checkpoint before continuing added dac-scale.py: short script to calculate avrdd DAC+Vref values from level_calc.py ramp data ...
Diffstat (limited to 'fsm/pcint.c')
-rw-r--r--fsm/pcint.c54
1 files changed, 2 insertions, 52 deletions
diff --git a/fsm/pcint.c b/fsm/pcint.c
index 131d0c3..d00b51d 100644
--- a/fsm/pcint.c
+++ b/fsm/pcint.c
@@ -13,58 +13,8 @@ uint8_t button_is_pressed() {
return value;
}
-inline void PCINT_on() {
- #if (ATTINY == 25) || (ATTINY == 45) || (ATTINY == 85)
- // enable pin change interrupt
- GIMSK |= (1 << PCIE);
- // only pay attention to the e-switch pin
- #if 0 // this is redundant; was already done in main()
- PCMSK = (1 << SWITCH_PCINT);
- #endif
- // set bits 1:0 to 0b01 (interrupt on rising *and* falling edge) (default)
- // MCUCR &= 0b11111101; MCUCR |= 0b00000001;
- #elif (ATTINY == 1634)
- // enable pin change interrupt
- #ifdef SWITCH2_PCIE
- GIMSK |= ((1 << SWITCH_PCIE) | (1 << SWITCH2_PCIE));
- #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
-}
-
-inline void PCINT_off() {
- #if (ATTINY == 25) || (ATTINY == 45) || (ATTINY == 85)
- // disable all pin-change interrupts
- GIMSK &= ~(1 << PCIE);
- #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
-}
-
-//void button_change_interrupt() {
-#if (ATTINY == 25) || (ATTINY == 45) || (ATTINY == 85) || (ATTINY == 1634)
- #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(SWITCH_VECT) {
+ mcu_switch_vect_clear();
irq_pcint = 1; // let deferred code know an interrupt happened