My Project
 All Classes Functions Variables Pages
FreeRTOSTimer.h
1 /*
2  * FreeRTOSTimer.h
3  *
4  * Created on: Mar 8, 2017
5  * Author: kolban
6  */
7 
8 #ifndef COMPONENTS_CPP_UTILS_FREERTOSTIMER_H_
9 #define COMPONENTS_CPP_UTILS_FREERTOSTIMER_H_
10 #include <freertos/FreeRTOS.h>
11 #include <freertos/task.h>
12 #include <freertos/timers.h>
17 public:
18  FreeRTOSTimer(char* name, TickType_t period, UBaseType_t reload, void* data, void (*callback)(FreeRTOSTimer* pTimer));
19  virtual ~FreeRTOSTimer();
20  void changePeriod(TickType_t newPeriod, TickType_t blockTime = portMAX_DELAY);
21  void* getData();
22  const char* getName();
23  TickType_t getPeriod();
24  void reset(TickType_t blockTime = portMAX_DELAY);
25  void start(TickType_t blockTime = portMAX_DELAY);
26  void stop(TickType_t blockTime = portMAX_DELAY);
27 
28 private:
29  TimerHandle_t timerHandle;
30  TickType_t period;
31  void (*callback)(FreeRTOSTimer* pTimer);
32  static void internalCallback(TimerHandle_t xTimer);
33 
34 };
35 
36 #endif /* COMPONENTS_CPP_UTILS_FREERTOSTIMER_H_ */
FreeRTOSTimer(char *name, TickType_t period, UBaseType_t reload, void *data, void(*callback)(FreeRTOSTimer *pTimer))
Construct a timer.
Definition: FreeRTOSTimer.cpp:46
void reset(TickType_t blockTime=portMAX_DELAY)
Reset the timer to the period and start it ticking.
Definition: FreeRTOSTimer.cpp:90
TickType_t getPeriod()
Return the period of the timer.
Definition: FreeRTOSTimer.cpp:100
virtual ~FreeRTOSTimer()
Destroy a class instance.
Definition: FreeRTOSTimer.cpp:68
void stop(TickType_t blockTime=portMAX_DELAY)
Stop the timer from ticking.
Definition: FreeRTOSTimer.cpp:83
void changePeriod(TickType_t newPeriod, TickType_t blockTime=portMAX_DELAY)
Change the period of the timer.
Definition: FreeRTOSTimer.cpp:110
const char * getName()
Get the name of the timer.
Definition: FreeRTOSTimer.cpp:122
void start(TickType_t blockTime=portMAX_DELAY)
Start the timer ticking.
Definition: FreeRTOSTimer.cpp:76
void * getData()
Get the user supplied data associated with the timer.
Definition: FreeRTOSTimer.cpp:132
Wrapper around the FreeRTOS timer functions.
Definition: FreeRTOSTimer.h:16