diff options
| author | Selene ToyKeeper | 2024-09-22 17:15:47 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2024-09-22 17:15:47 -0600 |
| commit | 6be8fff532c4be83126517a6e3b7b725548761c2 (patch) | |
| tree | 10865593112cc903c5558bdf0dc6b892367f3883 /fsm | |
| parent | cherry-picked hank-lume-x1 code from https://github.com/loneoceans/anduril/co... (diff) | |
| download | anduril-6be8fff532c4be83126517a6e3b7b725548761c2.tar.gz anduril-6be8fff532c4be83126517a6e3b7b725548761c2.tar.bz2 anduril-6be8fff532c4be83126517a6e3b7b725548761c2.zip | |
hank-lume-x1 cleanup and calibration, part 1:
- changed model number from 0281 to 0171
- cleaned up blink_negative and AUXLED_RGB_DIFFERENT_PORTS a little
(but the latter needs a complete refactor, as soon as the
hardware abstraction code can handle aux LEDs better)
- cleaned up USE_LONG_BLINK_FOR_NEGATIVE_SIGN a little
- removed USE_OTG_IN_MOMENTARY since it's not actually used
- moved hw/loneoceans/lume-x1-avr32dd20/* files into hw/hank/lume-x1/
- superficial cleanup on hank/lume-x1/hwdef.*
- removed some of the extra stuff from hank/lume-x1/anduril.h
- adjusted calibration (especially ramp table) on hank-lume-x1
(ramp shape is pretty close to a D4K-boost now, but with more firefly modes)
(calibration is based on a sample size of 1, further testing needed)
Diffstat (limited to '')
| -rw-r--r-- | fsm/misc.c | 52 |
1 files changed, 37 insertions, 15 deletions
@@ -66,13 +66,13 @@ uint8_t blink_digit(uint8_t num) { return nice_delay_ms(BLINK_SPEED * 8 / 12); } #ifdef USE_LONG_BLINK_FOR_NEGATIVE_SIGN -void blink_negative(){ +void blink_negative() { // "negative" symbol gets a single long blink uint8_t ontime = BLINK_SPEED * 2 / 12; set_level(BLINK_BRIGHTNESS); - nice_delay_ms(ontime*3); + nice_delay_ms(ontime * 3); set_level(0); - nice_delay_ms(ontime*5); + nice_delay_ms(ontime * 5); } #endif #endif @@ -255,28 +255,50 @@ void rgb_led_set(uint8_t value) { // FIXME: move this logic to arch/* #if (MCU==0x1616) || (MCU==0x32dd20) // ATTINY816, 817, etc + // FIXME: this *really* needs to be moved to somewhere hardware-specific #ifdef AUXLED_RGB_DIFFERENT_PORTS case 0: // LED off - if (i==0){AUXLED_R_PORT.DIRSET = (1 << pin); AUXLED_R_PORT.OUTCLR = (1 << pin);} - if (i==1){AUXLED_G_PORT.DIRSET = (1 << pin); AUXLED_G_PORT.OUTCLR = (1 << pin);} - if (i==2){AUXLED_B_PORT.DIRSET = (1 << pin); AUXLED_B_PORT.OUTCLR = (1 << pin);} + if (i == 0) { + AUXLED_R_PORT.DIRSET = (1 << pin); + AUXLED_R_PORT.OUTCLR = (1 << pin); + } else if (i == 1) { + AUXLED_G_PORT.DIRSET = (1 << pin); + AUXLED_G_PORT.OUTCLR = (1 << pin); + } else if (i == 2) { + AUXLED_B_PORT.DIRSET = (1 << pin); + AUXLED_B_PORT.OUTCLR = (1 << pin); + } break; case 1: // LED low - if (i==0){AUXLED_R_PORT.DIRCLR = (1 << pin); *((uint8_t *)&AUXLED_R_PORT + 0x10 + pin) = PORT_PULLUPEN_bm;} - if (i==1){AUXLED_G_PORT.DIRCLR = (1 << pin); *((uint8_t *)&AUXLED_G_PORT + 0x10 + pin) = PORT_PULLUPEN_bm;} - if (i==2){AUXLED_B_PORT.DIRCLR = (1 << pin); *((uint8_t *)&AUXLED_B_PORT + 0x10 + pin) = PORT_PULLUPEN_bm;} + if (i == 0) { + AUXLED_R_PORT.DIRCLR = (1 << pin); + *((uint8_t *)&AUXLED_R_PORT + 0x10 + pin) = PORT_PULLUPEN_bm; + } else if (i == 1) { + AUXLED_G_PORT.DIRCLR = (1 << pin); + *((uint8_t *)&AUXLED_G_PORT + 0x10 + pin) = PORT_PULLUPEN_bm; + } else if (i == 2) { + AUXLED_B_PORT.DIRCLR = (1 << pin); + *((uint8_t *)&AUXLED_B_PORT + 0x10 + pin) = PORT_PULLUPEN_bm; + } break; default: // LED high - if (i==0){AUXLED_R_PORT.DIRSET = (1 << pin); AUXLED_R_PORT.OUTSET = (1 << pin);} - if (i==1){AUXLED_G_PORT.DIRSET = (1 << pin); AUXLED_G_PORT.OUTSET = (1 << pin);} - if (i==2){AUXLED_B_PORT.DIRSET = (1 << pin); AUXLED_B_PORT.OUTSET = (1 << pin);} + if (i==0) { + AUXLED_R_PORT.DIRSET = (1 << pin); + AUXLED_R_PORT.OUTSET = (1 << pin); + } else if (i==1) { + AUXLED_G_PORT.DIRSET = (1 << pin); + AUXLED_G_PORT.OUTSET = (1 << pin); + } else if (i==2) { + AUXLED_B_PORT.DIRSET = (1 << pin); + AUXLED_B_PORT.OUTSET = (1 << pin); + } break; - #else - + #else // not ifdef AUXLED_RGB_DIFFERENT_PORTS + case 0: // LED off AUXLED_RGB_PORT.DIRSET = (1 << pin); // set as output AUXLED_RGB_PORT.OUTCLR = (1 << pin); // set output low @@ -293,7 +315,7 @@ void rgb_led_set(uint8_t value) { #endif - #else + #else // not #if (MCU==0x1616) || (MCU==0x32dd20) case 0: // LED off AUXLED_RGB_DDR &= 0xff ^ (1 << pin); |
