From: Jan "Yenya" Kasprzak Date: Mon, 29 Apr 2013 16:20:19 +0000 (+0200) Subject: pwmled.c: separate target setting and on/off switching X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=15e2b46e5d25e1a9207b8b5d1bf104682167c225;p=tinyboard.git pwmled.c: separate target setting and on/off switching --- diff --git a/projects/step-up/lights.h b/projects/step-up/lights.h index f63b6f9..d409d9d 100644 --- a/projects/step-up/lights.h +++ b/projects/step-up/lights.h @@ -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(); diff --git a/projects/step-up/pwmled.c b/projects/step-up/pwmled.c index b066c59..24fbe87 100644 --- a/projects/step-up/pwmled.c +++ b/projects/step-up/pwmled.c @@ -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);