Skip to content
Snippets Groups Projects
Commit 58acc803 authored by schneider's avatar schneider
Browse files

change(vibra): Use a static timer

Closes #50
parent 1b0df22d
Branches
No related tags found
No related merge requests found
...@@ -6,6 +6,7 @@ static const gpio_cfg_t motor_pin = { ...@@ -6,6 +6,7 @@ static const gpio_cfg_t motor_pin = {
PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE
}; };
static StaticTimer_t vibra_timer_data;
static TimerHandle_t vibra_timer = NULL; static TimerHandle_t vibra_timer = NULL;
void epic_vibra_set(int status) void epic_vibra_set(int status)
...@@ -27,8 +28,13 @@ void epic_vibra_vibrate(int millis) ...@@ -27,8 +28,13 @@ void epic_vibra_vibrate(int millis)
int ticks = millis * (configTICK_RATE_HZ / 1000); int ticks = millis * (configTICK_RATE_HZ / 1000);
if (vibra_timer == NULL) { if (vibra_timer == NULL) {
vibra_timer = xTimerCreate( vibra_timer = xTimerCreateStatic(
"vibratimer", ticks, pdFALSE, 0, vTimerCallback "vibratimer",
ticks,
pdFALSE,
0,
vTimerCallback,
&vibra_timer_data
); );
} }
if (vibra_timer != NULL) { if (vibra_timer != NULL) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment