2 #include <stdlib.h> // for NULL
6 static pattern_t on_pattern [] = {
11 static pattern_t blink_pattern[] = {
21 static pattern_t slow_pattern[] = {
27 static unsigned char light_mode;
31 unsigned char shutdown_in_progress : 1;
32 unsigned char pwmled_error : 1;
33 unsigned char battery_low : 1;
37 void set_error(unsigned char err)
58 void long_press_start()
60 e.shutdown_in_progress = 1;
69 if (++light_mode >= 2*N_PWMLED_MODES)
72 pwmled_set_target(light_mode < N_PWMLED_MODES
74 : light_mode - N_PWMLED_MODES);
83 pattern_t *pwmled_pattern_select()
85 if (e.shutdown_in_progress)
91 if (light_mode == 0) {
93 } else if (light_mode < N_PWMLED_MODES) {
100 pattern_t *status_led_pattern_select()
102 if (e.shutdown_in_progress)
106 return number_pattern(3, 1);
109 return number_pattern(1, 1);
111 return number_pattern(battery_gauge(), 0);
119 led_set_pattern(N_PWMLEDS, status_led_pattern_select());
120 led_set_pattern(0, pwmled0_pattern_select());
127 led_set_pattern(N_PWMLEDS, status_led_pattern_select());
128 led_set_pattern(0, pwmled0_pattern_select());