[temporary commit]

This commit is contained in:
Phat Nguyen
2024-04-03 07:04:55 +07:00
parent f52eab87d2
commit 8e032927c6
11 changed files with 1029 additions and 8 deletions

21
src/AgSchedule.cpp Normal file
View File

@ -0,0 +1,21 @@
#include "AgSchedule.h"
AgSchedule::AgSchedule(int period, void (*handler)(void))
: period(period), handler(handler) {}
AgSchedule::~AgSchedule() {}
void AgSchedule::run(void) {
uint32_t ms = (uint32_t)(millis() - count);
if (ms >= period) {
handler();
count = millis();
}
}
/**
* @brief Set schedule period
*
* @param period Period in ms
*/
void AgSchedule::setPeriod(int period) { this->period = period; }