Commit 15e2b46e authored by Jan Kasprzak's avatar Jan Kasprzak
Browse files

pwmled.c: separate target setting and on/off switching

parent d024b5fc
......@@ -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();
......
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment