]> www.fi.muni.cz Git - tinyboard.git/blobdiff - projects/step-up/pwmled.c
pwm.c: single PWM channel only
[tinyboard.git] / projects / step-up / pwmled.c
index eb6a689624a4d5c5946afb49f02590f320f793b1..52993308edf3fa31daeaee91c11a61ab4676e7e9 100644 (file)
@@ -72,6 +72,7 @@ void init_pwmled()
                        led->err_sums[j] = 0;
                }
        }
+       pwmleds[0].state = ST_DISABLED;
 }
 
 void pwmled_set_mode(unsigned char n, unsigned char mode)
@@ -94,10 +95,10 @@ void pwmled_set_mode(unsigned char n, unsigned char mode)
                led->pwm = led->mode_pwm[mode - 1];
                led->err_sum = led->err_sums[mode - 1];
                led->mode_changed = 1;
-               pwm_set(n, led->pwm);
+               pwm_set(led->pwm);
        } else {
                led->state = ST_OFF;
-               pwm_off(n);
+               pwm_off();
        }
 }
 
@@ -135,7 +136,7 @@ static inline unsigned char pwmled_probed_ok(unsigned char n, uint16_t old_pwm)
                unsigned char i;
 
                led->state = ST_OFF;
-               pwm_off(n);
+               pwm_off();
 
                log_byte(0xF0);
                log_byte(n);
@@ -156,7 +157,7 @@ static inline unsigned char pwmled_probed_ok(unsigned char n, uint16_t old_pwm)
 static inline void pwmled_err(unsigned char n)
 {
        pwmleds[n].state = ST_DISABLED;
-       pwm_off(n);
+       pwm_off();
 
        log_byte(0xF1);
        log_byte(n);
@@ -208,6 +209,6 @@ void pwmled_adc(unsigned char n, uint16_t adcval)
        if (led->pwm == old_pwm)
                return;
 
-       pwm_set(n, led->pwm);
+       pwm_set(led->pwm);
 }