Commit f77585c8 authored by zenox's avatar zenox

blink_rocket: working with just one rocket

parent 7c16c31f
......@@ -146,29 +146,29 @@ int epic_leds_get_rocket(int led)
return ret;
}
static TimerHandle_t blink_timer[NUM_ROCKETS];
static TimerHandle_t blink_timer = NULL;
void bTimerCallback(TimerHandle_t blink_timer)
{
uint32_t id = (uint32_t) pvTimerGetTimerID(blink_timer);
epic_leds_set_rocket(id, 0);
epic_leds_set_rocket(0, 0);
}
void epic_leds_blink_rocket(int led, uint8_t value, int millis)
{
int ticks = millis * (configTICK_RATE_HZ / 1000);
int32_t id = led;
if (blink_timer[id] == NULL) {
blink_timer[id] = xTimerCreate(
if (blink_timer == NULL) {
blink_timer = xTimerCreate(
"blinktimer",
ticks,
pdFALSE,
(void*) id,
0,
bTimerCallback
);
} else {
epic_leds_set_rocket(led, value);
xTimerChangePeriod(blink_timer[id], ticks, 0);
epic_leds_set_rocket(0, value);
xTimerChangePeriod(blink_timer, ticks, 0);
}
}
void epic_set_flashlight(bool power)
......
Markdown is supported
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