aboutsummaryrefslogtreecommitdiff
path: root/hwdef-noctigon-dm11-boost.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--hwdef-noctigon-dm11-boost.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/hwdef-noctigon-dm11-boost.c b/hwdef-noctigon-dm11-boost.c
index 006cbf8..08e2798 100644
--- a/hwdef-noctigon-dm11-boost.c
+++ b/hwdef-noctigon-dm11-boost.c
@@ -6,6 +6,8 @@
#include "chan-rgbaux.c"
+void set_level_zero();
+
void set_level_main(uint8_t level);
bool gradual_tick_main(uint8_t gt);
@@ -19,20 +21,18 @@ Channel channels[] = {
};
+void set_level_zero() {
+ CH1_PWM = 0;
+ PWM_CNT = 0; // reset phase
+ CH1_ENABLE_PORT &= ~(1 << CH1_ENABLE_PIN ); // disable opamp
+ CH1_ENABLE_PORT2 &= ~(1 << CH1_ENABLE_PIN2); // disable PMIC
+}
+
// single set of LEDs with single power channel, boost
void set_level_main(uint8_t level) {
- if (level == 0) {
- CH1_PWM = 0;
- PWM_CNT = 0; // reset phase
- CH1_ENABLE_PORT &= ~(1 << CH1_ENABLE_PIN ); // disable opamp
- CH1_ENABLE_PORT2 &= ~(1 << CH1_ENABLE_PIN2); // disable PMIC
- return;
- }
-
CH1_ENABLE_PORT |= (1 << CH1_ENABLE_PIN ); // enable opamp
CH1_ENABLE_PORT2 |= (1 << CH1_ENABLE_PIN2); // enable PMIC
- level --; // PWM array index = level - 1
PWM_DATATYPE ch1_pwm = PWM_GET(pwm1_levels, level);
// pulse frequency modulation, a.k.a. dynamic PWM
uint16_t top = PWM_GET16(pwm_tops, level);