aboutsummaryrefslogtreecommitdiff
path: root/hwdef-emisar-2ch.c
diff options
context:
space:
mode:
Diffstat (limited to 'hwdef-emisar-2ch.c')
-rw-r--r--hwdef-emisar-2ch.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/hwdef-emisar-2ch.c b/hwdef-emisar-2ch.c
index 7955cf6..31d27af 100644
--- a/hwdef-emisar-2ch.c
+++ b/hwdef-emisar-2ch.c
@@ -7,6 +7,8 @@
#include "chan-rgbaux.c"
+void set_level_zero();
+
void set_level_ch1(uint8_t level);
void set_level_ch2(uint8_t level);
void set_level_both(uint8_t level);
@@ -90,41 +92,29 @@ void set_pwms(uint16_t ch1_pwm, uint16_t ch2_pwm, uint16_t top) {
if (! was_on) PWM_CNT = 0;
}
-void set_level_ch1(uint8_t level) {
- if (0 == level)
- return set_pwms(0, 0, PWM_TOP_INIT);
+void set_level_zero() {
+ return set_pwms(0, 0, PWM_TOP_INIT);
+}
- level --;
+void set_level_ch1(uint8_t level) {
uint16_t pwm = PWM_GET(pwm1_levels, level);
uint16_t top = PWM_GET(pwm_tops, level);
set_pwms(pwm, 0, top);
}
void set_level_ch2(uint8_t level) {
- if (0 == level)
- return set_pwms(0, 0, PWM_TOP_INIT);
-
- level --;
uint16_t pwm = PWM_GET(pwm1_levels, level);
uint16_t top = PWM_GET(pwm_tops, level);
set_pwms(0, pwm, top);
}
void set_level_both(uint8_t level) {
- if (0 == level)
- return set_pwms(0, 0, PWM_TOP_INIT);
-
- level --;
uint16_t pwm = PWM_GET(pwm1_levels, level);
uint16_t top = PWM_GET(pwm_tops, level);
set_pwms(pwm, pwm, top);
}
void set_level_blend(uint8_t level) {
- if (0 == level)
- return set_pwms(0, 0, PWM_TOP_INIT);
-
- level --;
PWM_DATATYPE ch1_pwm, ch2_pwm;
PWM_DATATYPE brightness = PWM_GET(pwm1_levels, level);
PWM_DATATYPE top = PWM_GET(pwm_tops, level);
@@ -136,10 +126,6 @@ void set_level_blend(uint8_t level) {
}
void set_level_auto(uint8_t level) {
- if (0 == level)
- return set_pwms(0, 0, PWM_TOP_INIT);
-
- level --;
PWM_DATATYPE ch1_pwm, ch2_pwm;
PWM_DATATYPE brightness = PWM_GET(pwm1_levels, level);
PWM_DATATYPE top = PWM_GET(pwm_tops, level);