diff options
Diffstat (limited to 'software/main.c')
-rw-r--r-- | software/main.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/software/main.c b/software/main.c index 5261d34..14dedc6 100644 --- a/software/main.c +++ b/software/main.c @@ -1,7 +1,7 @@ /* * Traffic light * - * Copyright (C) 2019-2022 Aurelien Jarno + * Copyright (C) 2019-2024 Aurelien Jarno * * Authors: * Aurelien Jarno <aurelien@aurel32.net> @@ -42,6 +42,7 @@ enum state { state_off, state_red, state_orange, + state_orange_red, state_green, state_blinking_on, state_blinking_off, @@ -98,6 +99,34 @@ const struct state_desc states_desc[] = { .next_button_medium = state_blinking_on, .next_button_long = state_off, }, +/* Define to 1 for a four main states traffic light, as used in some countries, + * i.e. going to orange + red in between red and green. */ +#if 0 + [state_red] = { + .leds = { + { .r = 0x7f, .g = 0x00, .b = 0x00, }, + { .r = 0x00, .g = 0x00, .b = 0x00, }, + { .r = 0x00, .g = 0x00, .b = 0x00, }, + }, + .duration = 13500, + .next = state_orange_red, + .next_button_short = state_orange_red, + .next_button_medium = state_blinking_on, + .next_button_long = state_off, + }, + [state_orange_red] = { + .leds = { + { .r = 0x7f, .g = 0x00, .b = 0x00, }, + { .r = 0x7f, .g = 0x2f, .b = 0x00, }, + { .r = 0x00, .g = 0x00, .b = 0x00, }, + }, + .duration = 1500, + .next = state_green, + .next_button_short = state_green, + .next_button_medium = state_blinking_on, + .next_button_long = state_off, + }, +#else [state_red] = { .leds = { { .r = 0x7f, .g = 0x00, .b = 0x00, }, @@ -110,6 +139,7 @@ const struct state_desc states_desc[] = { .next_button_medium = state_blinking_on, .next_button_long = state_off, }, +#endif [state_blinking_on] = { .leds = { |