fixed timer

This commit is contained in:
Robin Müller 2020-10-13 12:32:15 +02:00
parent 5f32dbb595
commit a9543a6f7e

View File

@ -12,7 +12,10 @@
//from the core and we need to include it explicitly //from the core and we need to include it explicitly
#include <SPI.h> #include <SPI.h>
// Crete default timer which is able to manage 10 concurrent tasks
// and uses milliseconds as a timebase.
auto timer = timer_create_default(); auto timer = timer_create_default();
bool periodicHandler1(void* args);
void setup() { void setup() {
// Set data direction of selected port to output. // Set data direction of selected port to output.
@ -30,18 +33,20 @@ void setup() {
Serial.println(" bytes"); Serial.println(" bytes");
#endif #endif
SPI.begin(); SPI.begin();
// Call periodic handler with certain interval
timer.every(RING_BUFFER_CHECK_INTVL, periodicHandler1);
} }
bool periodicHandler1(void* args) { bool periodicHandler1(void* args) {
if(args) {}; if(args) {};
Serial.println("Handling new data!");
IOBoard::handleNewData(); IOBoard::handleNewData();
return false; // repeat action
return true;
} }
void loop() { void loop() {
timer.tick(); timer.tick();
timer.every(RING_BUFFER_CHECK_INTVL, periodicHandler1);
//delay(1000);
} }