Move components to lib folder

This commit is contained in:
Robert Marshall 2022-09-08 13:20:51 +01:00
parent ae3c20b59d
commit b9b68f08cb
8 changed files with 1 additions and 0 deletions

View file

@ -1,32 +0,0 @@
#ifndef TimerManager_cpp
#define TimerManager_cpp
#include <map>
#include <functional>
#include "Timer.cpp"
class TimerManager{
std::map<int, Timer*> _timers;
public:
void add(int id, std::function<void()> callback){
_timers[id] = new Timer(callback);
}
void reset(int id, unsigned long interval){
if (!_timers.count(id))
return;
_timers.find(id)->second->reset(interval);
}
void loop(){
for(auto iterator = _timers.begin(); iterator != _timers.end(); ++iterator)
{
auto timer = iterator->second;
timer->loop();
}
}
};
#endif