Improve handling of arming, providing LED blink codes if the arming fails.
Also, implement a software watchdog to make sure that the main real-time modules are actually being run. Provide a panic facility, also giving blink codes to indicate the panic reason.
This commit is contained in:
14
led.c
14
led.c
@@ -11,13 +11,14 @@ unsigned int led_next_time;
|
||||
bool led_next_state;
|
||||
|
||||
led_pattern led_pattern_active[] = {250, 250, 0};
|
||||
led_pattern led_pattern_unknown[] = {100, 100, 0};
|
||||
|
||||
void led_set(bool on)
|
||||
{
|
||||
if (on)
|
||||
FP0XVAL |= 0x04000000;
|
||||
else
|
||||
FP0XVAL &= ~0x04000000;
|
||||
else
|
||||
FP0XVAL |= 0x04000000;
|
||||
}
|
||||
|
||||
void led_update(void)
|
||||
@@ -43,8 +44,15 @@ void led_update(void)
|
||||
|
||||
void led_set_pattern(led_pattern *pattern)
|
||||
{
|
||||
if (led_current_pattern == pattern)
|
||||
return;
|
||||
led_current_pattern = pattern;
|
||||
led_current_pointer = pattern;
|
||||
}
|
||||
|
||||
void led_init(void)
|
||||
{
|
||||
led_current_pattern = led_pattern_unknown;
|
||||
led_current_pointer = led_pattern_unknown;
|
||||
led_next_state = TRUE;
|
||||
led_next_time = timer_read();
|
||||
led_update();
|
||||
|
||||
Reference in New Issue
Block a user