diff options
| author | Selene ToyKeeper | 2024-09-22 16:46:40 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2024-09-22 16:46:40 -0600 |
| commit | 89ea4e6f8ac15d3cb12d5562df9681c9d650b5f8 (patch) | |
| tree | 502399ddb1b11bdcdc33388958dba6b200bef379 /fsm | |
| parent | Merge branch 'pr90-SammysHP-wurkkos-ts10-lowfet' into trunk (diff) | |
| download | anduril-89ea4e6f8ac15d3cb12d5562df9681c9d650b5f8.tar.gz anduril-89ea4e6f8ac15d3cb12d5562df9681c9d650b5f8.tar.bz2 anduril-89ea4e6f8ac15d3cb12d5562df9681c9d650b5f8.zip | |
cherry-picked hank-lume-x1 code from https://github.com/loneoceans/anduril/commit/d83ebb75dab8c462b7efa841bccc00a136ff15a2
The [PR](https://github.com/ToyKeeper/anduril/pull/37) has a lot of other
stuff in it, so I'm just picking out the parts needed for this particular
light, and leaving the rest for later.
Will need further edits before merging into trunk.
Diffstat (limited to '')
| -rw-r--r-- | fsm/misc.c | 34 | ||||
| -rw-r--r-- | fsm/misc.h | 3 |
2 files changed, 37 insertions, 0 deletions
@@ -65,6 +65,16 @@ 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(){ + // "negative" symbol gets a single long blink + uint8_t ontime = BLINK_SPEED * 2 / 12; + set_level(BLINK_BRIGHTNESS); + nice_delay_ms(ontime*3); + set_level(0); + nice_delay_ms(ontime*5); +} +#endif #endif #ifdef USE_BLINK_BIG_NUM @@ -245,6 +255,28 @@ void rgb_led_set(uint8_t value) { // FIXME: move this logic to arch/* #if (MCU==0x1616) || (MCU==0x32dd20) // ATTINY816, 817, etc + #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);} + 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;} + 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);} + break; + + #else + case 0: // LED off AUXLED_RGB_PORT.DIRSET = (1 << pin); // set as output AUXLED_RGB_PORT.OUTCLR = (1 << pin); // set output low @@ -258,6 +290,8 @@ void rgb_led_set(uint8_t value) { AUXLED_RGB_PORT.DIRSET = (1 << pin); // set as output AUXLED_RGB_PORT.OUTSET = (1 << pin); // set as high break; + + #endif #else @@ -28,6 +28,9 @@ void auto_clock_speed(); #ifdef USE_BLINK_NUM //#define USE_BLINK uint8_t blink_num(uint8_t num); +#ifdef USE_LONG_BLINK_FOR_NEGATIVE_SIGN +void blink_negative(); +#endif #endif /* |
