From 101b21a45bf863b226ca5298226732f31d7e5dbc Mon Sep 17 00:00:00 2001 From: "Jan \"Yenya\" Kasprzak" Date: Wed, 10 Apr 2013 23:16:45 +0200 Subject: [PATCH] control.c: braking pattern for pwmled0 --- firmware/control.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/firmware/control.c b/firmware/control.c index 0f19390..4de03ab 100644 --- a/firmware/control.c +++ b/firmware/control.c @@ -44,6 +44,12 @@ static pattern_t on3_pattern [] = { PATTERN_END }; +static pattern_t brake_pattern [] = { + { 4, 0x2 }, + { 3, 0x8 }, + PATTERN_END +}; + static pattern_t normal2_pattern[] = { { 2, 0x1 }, { 0, 0x1 }, @@ -112,7 +118,7 @@ void brake_on() braking = 1; gpio_set(0, 1); led_set_pattern(N_PWMLEDS, status_led_pattern_select()); - // TODO brighten rear light + led_set_pattern(0, pwmled0_pattern_select()); } void brake_off() @@ -120,7 +126,7 @@ void brake_off() braking = 0; gpio_set(0, 0); led_set_pattern(N_PWMLEDS, status_led_pattern_select()); - // TODO dim rear light + led_set_pattern(0, pwmled0_pattern_select()); } void toggle_dim_mode() @@ -147,8 +153,11 @@ pattern_t *pwmled0_pattern_select() if (towbar_mode) return NULL; + if (braking) + return brake_pattern; + switch (ambient_zone) { - case 0: return dim_mode ? NULL : on3_pattern; + case 0: return dim_mode ? NULL : number_pattern(2, 1); case 1: return dim_mode ? NULL : normal3_pattern; case 2: return dim_mode ? slow3_pattern : normal3_pattern; case 3: -- 2.43.5