]> www.fi.muni.cz Git - tinyboard.git/commitdiff
pwmled.c: separate target setting and on/off switching
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Mon, 29 Apr 2013 16:20:19 +0000 (18:20 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Mon, 29 Apr 2013 16:20:19 +0000 (18:20 +0200)
projects/step-up/lights.h
projects/step-up/pwmled.c

index f63b6f9094326b7c785cbb6d27800a4b436adac7..d409d9d3f98b8f9b557b140c93ef4fa6af0ba347 100644 (file)
@@ -3,8 +3,6 @@
 
 #define TESTING_FW 1
 
-#define N_LEDS 7
-#define N_PWMLEDS 2
 #define N_PWMLED_MODES 4
 
 #define N_BUTTONS 2
@@ -45,7 +43,8 @@ void susp_tmr();
 /* pwmled.c */
 void init_pwmled();
 void pwmled_adc(uint16_t adcval);
-void pwmled_set_mode(unsigned char mode);
+void pwmled_set_target(unsigned char mode);
+void pwmled_on_off(unsigned char on);
 
 /* gpio.c */
 void init_gpio();
index b066c59e8824bd67e1f84e645ac95f9bda66dceb..24fbe87cc8b6d93f2e6604af7744aeb22befd483 100644 (file)
@@ -46,13 +46,18 @@ void init_pwmled()
        state = ST_OFF;
 }
 
-void pwmled_set_mode(unsigned char mode)
+void pwmled_set_target(unsigned char mode)
+{
+       target = targets[mode];
+       mode_changed = 1;
+}
+
+void pwmled_on_off(unsigned char mode)
 {
        if (!ST_CAN_SET_MODE(state))
                return;
 
        if (mode) {
-               target = targets[mode - 1];
                state = ST_ON;
                mode_changed = 1;
                pwm_set(pwm_val);