From a9543a6f7e765f36a804ec246482f68deb9ede17 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 13 Oct 2020 12:32:15 +0200 Subject: [PATCH] fixed timer --- main.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index 63ad9a1..f3d22bb 100644 --- a/main.cpp +++ b/main.cpp @@ -12,7 +12,10 @@ //from the core and we need to include it explicitly #include +// Crete default timer which is able to manage 10 concurrent tasks +// and uses milliseconds as a timebase. auto timer = timer_create_default(); +bool periodicHandler1(void* args); void setup() { // Set data direction of selected port to output. @@ -30,18 +33,20 @@ void setup() { Serial.println(" bytes"); #endif SPI.begin(); + // Call periodic handler with certain interval + timer.every(RING_BUFFER_CHECK_INTVL, periodicHandler1); } bool periodicHandler1(void* args) { if(args) {}; + Serial.println("Handling new data!"); IOBoard::handleNewData(); - return false; + // repeat action + return true; } void loop() { timer.tick(); - timer.every(RING_BUFFER_CHECK_INTVL, periodicHandler1); - //delay(1000); }