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); }