From 90a66c34ccb50073c525e7b0ba0d24c5389ef254 Mon Sep 17 00:00:00 2001 From: Ron de Ridder Date: Sat, 12 Oct 2024 17:18:09 +0200 Subject: [PATCH] The timer handling changed in the ESP32 Arduino libraries, see documentation: https://docs.espressif.com/projects/arduino-esp32/en/latest/api/timer.html --- src/platforms/esp32.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/platforms/esp32.h b/src/platforms/esp32.h index 22e80b0..372ca93 100644 --- a/src/platforms/esp32.h +++ b/src/platforms/esp32.h @@ -47,19 +47,16 @@ void initTimer(uint32_t init_clock) // create the clockTask xTaskCreate(clockTask, "clockTask", CLOCK_STACK_SIZE, NULL, 1, &taskHandle); - _uclockTimer = timerBegin(TIMER_ID, 80, true); + _uclockTimer = timerBegin(1000000); // attach to generic uclock ISR - timerAttachInterrupt(_uclockTimer, &handlerISR, false); + timerAttachInterrupt(_uclockTimer, &handlerISR); // init clock tick time - timerAlarmWrite(_uclockTimer, init_clock, true); - - // activate it! - timerAlarmEnable(_uclockTimer); + timerAlarm(_uclockTimer, init_clock, true, 0); } void setTimer(uint32_t us_interval) { - timerAlarmWrite(_uclockTimer, us_interval, true); + timerAlarm(_uclockTimer, us_interval, true, 0); } \ No newline at end of file