diff options
| author | Selene ToyKeeper | 2017-10-21 06:51:27 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2017-10-21 06:51:27 -0600 |
| commit | a154ddbda5477a9b5a66333b8777fd6d1ee99d39 (patch) | |
| tree | 30f1b2f8869ef78a5dbf3d84fa3ec2e74325a741 /spaghetti-monster/fsm-misc.c | |
| parent | Delay un-setting go_to_standby until the last moment, in case set_level() wan... (diff) | |
| download | anduril-a154ddbda5477a9b5a66333b8777fd6d1ee99d39.tar.gz anduril-a154ddbda5477a9b5a66333b8777fd6d1ee99d39.tar.bz2 anduril-a154ddbda5477a9b5a66333b8777fd6d1ee99d39.zip | |
Moved indicator_led() from Anduril into FSM. Made it auto-set indicator level based on ramp level.
Made Anduril configure voltage fudge and indicator LED functions based on driver type.
Removed "ticks_spent_awake" thing since it's redundant. EV_tick arg does the same thing in fewer bytes.
Rearranged some clauses in off_state to put events in a more coherent order.
Diffstat (limited to 'spaghetti-monster/fsm-misc.c')
| -rw-r--r-- | spaghetti-monster/fsm-misc.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spaghetti-monster/fsm-misc.c b/spaghetti-monster/fsm-misc.c index 1b8f864..acef28c 100644 --- a/spaghetti-monster/fsm-misc.c +++ b/spaghetti-monster/fsm-misc.c @@ -109,4 +109,32 @@ uint8_t blink_num(uint8_t num) { } #endif +#ifdef USE_INDICATOR_LED +void indicator_led(uint8_t lvl) { + switch (lvl) { + case 0: // indicator off + DDRB &= 0xff ^ (1 << AUXLED_PIN); + PORTB &= 0xff ^ (1 << AUXLED_PIN); + break; + case 1: // indicator low + DDRB &= 0xff ^ (1 << AUXLED_PIN); + PORTB |= (1 << AUXLED_PIN); + break; + default: // indicator high + DDRB |= (1 << AUXLED_PIN); + PORTB |= (1 << AUXLED_PIN); + break; + } +} + +/* +void indicator_led_auto() { + if (actual_level > MAX_1x7135) indicator_led(2); + else if (actual_level > 0) indicator_led(1); + else indicator_led(0); +} +*/ +#endif // USE_INDICATOR_LED + + #endif |
