Skip to content
Snippets Groups Projects

Show COVID-19 exposure notification statistics

Merged schneider requested to merge schneider/covid-tracing into master
Files
6
+ 28
0
#include "leds.h"
#include "pmic.h"
#include "FreeRTOS.h"
#include "timers.h"
#include "task.h"
#include "epicardium.h"
#include "modules.h"
@@ -128,6 +129,33 @@ int epic_leds_get_rocket(int led)
return ret;
}
static StaticTimer_t flash_timer_data[3];
static TimerHandle_t flash_timer[] = { NULL, NULL, NULL };
static void rocket_timer_callback(TimerHandle_t flash_timer)
{
uint32_t id = (uint32_t)pvTimerGetTimerID(flash_timer);
epic_leds_set_rocket(id, 0);
}
void epic_leds_flash_rocket(int led, uint8_t value, int millis)
{
int ticks = millis * (configTICK_RATE_HZ / 1000);
int32_t id = led;
if (flash_timer[id] == NULL) {
flash_timer[id] = xTimerCreateStatic(
"flashtimer",
ticks,
pdFALSE,
(void *)id,
rocket_timer_callback,
&flash_timer_data[id]
);
epic_leds_set_rocket(led, value);
}
epic_leds_set_rocket(led, value);
xTimerChangePeriod(flash_timer[id], ticks, 0);
}
void epic_set_flashlight(bool power)
{
hwlock_acquire(HWLOCK_I2C);
Loading