Advanced Distributed Systems module at HSLU
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

31 lines
721 B

/*
* Copyright (c) 2021, Erich Styger
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "platform.h"
#if PL_CONFIG_USE_TIME_DATE
#include "timer.h"
#include "McuRTOS.h"
#include "esp_log.h"
#include "McuTimeDate.h"
#define TAG "Timer" /* tag for logging with ESP_LOG */
static TimerHandle_t timer;
static void timerCallback(TimerHandle_t xTimer) {
McuTimeDate_AddTick();
}
void TMR_Init(void) {
/* create auto-reload timer to update software RTC */
timer = xTimerCreate("timer", pdMS_TO_TICKS(McuTimeDate_CONFIG_TICK_TIME_MS), pdTRUE, NULL, timerCallback);
if (timer==NULL) {
ESP_LOGE(TAG, "Failed creating timer");
return;
}
xTimerStart(timer, 0);
}
#endif /* PL_CONFIG_USE_TIME_DATE */