Skip to content

Commit

Permalink
[TASKS] Create stateless TaskWithTimer
Browse files Browse the repository at this point in the history
  • Loading branch information
aleemont1 committed Nov 25, 2023
1 parent 18d46ae commit 5b05020
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions smart_bridge/src/kernel/TaskWithTimer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef __TASK_WITH_TIMER__
#define __TASK_WITH_TIMER__

#include "Task.h"
#include <Arduino.h>

class TaskWithTimer : public Task
{
public:
TaskWithTimer() : Task(){
this->timerTimestamp = millis();
}; // Default constructor

long elapsedTime()
{
return millis() - timerTimestamp;
}
private:
long timerTimestamp;
};
#endif

0 comments on commit 5b05020

Please sign in to comment.