Skip to content
Snippets Groups Projects
Commit f77585c8 authored by zenox's avatar zenox
Browse files

blink_rocket: working with just one rocket

parent 7c16c31f
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment