aboutsummaryrefslogtreecommitdiff
path: root/fsm/misc.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/misc.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/misc.c')
-rw-r--r--fsm/misc.c31
1 files changed, 6 insertions, 25 deletions
diff --git a/fsm/misc.c b/fsm/misc.c
index bc10ea1..fa8ddd7 100644
--- a/fsm/misc.c
+++ b/fsm/misc.c
@@ -118,7 +118,8 @@ uint8_t blink_num(uint8_t num) {
#ifdef USE_INDICATOR_LED
void indicator_led(uint8_t lvl) {
switch (lvl) {
- #ifdef AVRXMEGA3 // ATTINY816, 817, etc
+ // FIXME: move this logic to arch/*
+ #if (MCU==0x1616) || (MCU==0x32dd20) // ATTINY816, 817, etc
case 0: // indicator off
AUXLED_PORT.DIRSET = (1 << AUXLED_PIN); // set as output
@@ -192,7 +193,8 @@ void indicator_led_auto() {
void button_led_set(uint8_t lvl) {
switch (lvl) {
- #ifdef AVRXMEGA3 // ATTINY816, 817, etc
+ // FIXME: move this logic to arch/*
+ #if (MCU==0x1616) || (MCU==0x32dd20) // ATTINY816, 817, etc
case 0: // LED off
BUTTON_LED_PORT.DIRSET = (1 << BUTTON_LED_PIN); // set as output
@@ -240,7 +242,8 @@ void rgb_led_set(uint8_t value) {
uint8_t pin = pins[i];
switch (lvl) {
- #ifdef AVRXMEGA3 // ATTINY816, 817, etc
+ // FIXME: move this logic to arch/*
+ #if (MCU==0x1616) || (MCU==0x32dd20) // ATTINY816, 817, etc
case 0: // LED off
AUXLED_RGB_PORT.DIRSET = (1 << pin); // set as output
@@ -288,25 +291,3 @@ uint8_t triangle_wave(uint8_t phase) {
}
#endif
-#ifdef USE_REBOOT
-void reboot() {
- // put the WDT in hard reset mode, then trigger it
- cli();
- #if (ATTINY == 25) || (ATTINY == 45) || (ATTINY == 85)
- WDTCR = 0xD8 | WDTO_15MS;
- #elif (ATTINY == 1634)
- // allow protected configuration changes for next 4 clock cycles
- CCP = 0xD8; // magic number
- // reset (WDIF + WDE), no WDIE, fastest (16ms) timing (0000)
- // (DS section 8.5.2 and table 8-4)
- WDTCSR = 0b10001000;
- #elif defined(AVRXMEGA3) // ATTINY816, 817, etc
- CCP = CCP_IOREG_gc; // temporarily disable change protection
- WDT.CTRLA = WDT_PERIOD_8CLK_gc; // Enable, timeout 8ms
- #endif
- sei();
- wdt_reset();
- while (1) {}
-}
-#endif
-