freertos_timer.hpp
Go to the documentation of this file.
1 /*
2  * SocialLedge.com - Copyright (C) 2013
3  *
4  * This file is part of free software framework for embedded processors.
5  * You can use it and/or distribute it as long as this copyright header
6  * remains unmodified. The code is free for personal use and requires
7  * permission to use in a commercial product.
8  *
9  * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
10  * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
12  * I SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
13  * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
14  *
15  * You can reach the author of this software at :
16  * p r e e t . w i k i @ g m a i l . c o m
17  */
18 
26 #ifndef TIMER_HPP_
27 #define TIMER_HPP_
28 
29 #include "FreeRTOS.h"
30 #include "timers.h"
31 #include "task.h"
32 
33 
34 
37 
40 
51 {
52  public:
60  ~FreeRTOSTimer();
61 
62  void start();
63  void stop();
64  void reset();
65  void changePeriod(timeMs_t t);
66  bool isRunning();
67 
72  void startFromISR();
73  void stopFromISR();
74  void resetFromISR();
76 
78  inline TimerHandle_t getTimerHandle() { return mTimerHandle; }
80 
81  private:
82  TimerHandle_t mTimerHandle;
83 };
84 
85 #endif /* TIMER_HPP_ */
void reset()
Resets(restarts) the timer.
void startFromISR()
Restarts the timer from an ISR.
void stop()
Stops the timer.
void resetFromISR()
Resets the timer from an ISR.
void changePeriodFromISR(timeMs_t t)
Changes the timer's time from an ISR.
FreeRTOSTimer(TimerCallbackFunction_t pFunction, timeMs_t t, TimerType type=TimerPeriodic)
TimerType
Enumeration to indicate timer type.
Definition: freertos_timer.hpp:39
uint32_t TickType_t
Definition: portmacro.h:105
TimerHandle_t getTimerHandle()
Definition: freertos_timer.hpp:79
void stopFromISR()
Stops the timer from an ISR.
~FreeRTOSTimer()
Destructor to delete the timer.
void changePeriod(timeMs_t t)
Changes the timer's time.
Definition: freertos_timer.hpp:39
void(* TimerCallbackFunction_t)(TimerHandle_t xTimer)
Definition: timers.h:123
void start()
Starts the timer, and calls reset() if timer is already started.
Definition: freertos_timer.hpp:39
TickType_t timeMs_t
Typedef to clarify the time in milliseconds.
Definition: freertos_timer.hpp:36
bool isRunning()
void * TimerHandle_t
Definition: timers.h:118
Definition: freertos_timer.hpp:50