diff options
Diffstat (limited to '')
| -rw-r--r-- | hwdef-Emisar_D1Sv2.h | 3 | ||||
| -rw-r--r-- | spaghetti-monster/fsm-ramping.c | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/hwdef-Emisar_D1Sv2.h b/hwdef-Emisar_D1Sv2.h index c51e827..6895e73 100644 --- a/hwdef-Emisar_D1Sv2.h +++ b/hwdef-Emisar_D1Sv2.h @@ -51,7 +51,8 @@ #define PWM1_PIN PB3 // pin 16, Opamp reference #define PWM1_LVL OCR1A // OCR1A is the output compare register for PB3 -#define LED_ENABLE_PIN PB0 // pin 19, Opamp power +#define LED_ENABLE_PIN PB0 // pin 19, Opamp power +#define LED_ENABLE_PORT PORTB // control port for PB0 //#define PWM2_PIN PB0 // pin 19, Opamp power // FIXME: //#define PWM2_LVL OCR1B // OCR1B is the output compare register for PB1 diff --git a/spaghetti-monster/fsm-ramping.c b/spaghetti-monster/fsm-ramping.c index 69e20bc..52a7246 100644 --- a/spaghetti-monster/fsm-ramping.c +++ b/spaghetti-monster/fsm-ramping.c @@ -65,9 +65,18 @@ void set_level(uint8_t level) { #if PWM_CHANNELS >= 4 PWM4_LVL = 0; #endif + // disable the power channel, if relevant + #ifdef LED_ENABLE_PIN + LED_ENABLE_PORT &= ~(1 << LED_ENABLE_PIN); + #endif } else { level --; + // enable the power channel, if relevant + #ifdef LED_ENABLE_PIN + LED_ENABLE_PORT |= (1 << LED_ENABLE_PIN); + #endif + #ifdef USE_TINT_RAMPING // calculate actual PWM levels based on a single-channel ramp // and a global tint value |
