FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
|
Real-time Timer API. More...
#include "boards/io.h"
#include <avr/interrupt.h>
#include "interrupts.h"
#include "timer.h"
#include "time.h"
#include "events.h"
Go to the source code of this file.
Classes | |
class | timer::RTTRawTime< T > |
Utility class to avoid costly instantiation of time::RTTTime from an interrupt routine. More... | |
class | timer::RTT< NTIMER_ > |
API to handle a real-time timer. More... | |
class | timer::RTTEventCallback< EVENT, PERIOD_MS > |
Utility to generate events from an RTT instance at a given period. More... | |
Namespaces | |
namespace | timer |
Defines all API to manipulate AVR Timers. | |
Macros | |
#define | REGISTER_RTT_ISR(TIMER_NUM) |
Register the necessary ISR (Interrupt Service Routine) for a timer::RTT to work properly. More... | |
#define | REGISTER_RTT_ISR_METHOD(TIMER_NUM, HANDLER, CALLBACK) |
Register the necessary ISR (Interrupt Service Routine) for a timer::RTT to work properly, along with a callback method that will be notified every millisecond. More... | |
#define | REGISTER_RTT_ISR_FUNCTION(TIMER_NUM, CALLBACK) |
Register the necessary ISR (Interrupt Service Routine) for a timer::RTT to work properly, along with a callback function that will be notified every millisecond. More... | |
#define | REGISTER_RTT_EVENT_ISR(TIMER_NUM, EVENT, PERIOD) |
Register the necessary ISR (Interrupt Service Routine) for a timer::RTT to work properly, along with a callback to timer::RTTEventCallback. More... | |
#define | DECL_RTT_ISR_HANDLERS_FRIEND |
This macro shall be used in a class containing a private callback method, registered by REGISTER_RTT_ISR_METHOD . More... | |
Real-time Timer API.
Definition in file realtime_timer.h.
#define REGISTER_RTT_ISR | ( | TIMER_NUM | ) |
Register the necessary ISR (Interrupt Service Routine) for a timer::RTT to work properly.
This will not register any user callback though; if you need to register a method or function to be called back every time one millsiecond has elapsed, you need to use REGISTER_RTT_ISR_METHOD
or REGISTER_RTT_ISR_FUNCTION
instead.
TIMER_NUM | the number of the TIMER feature for the target MCU |
Definition at line 44 of file realtime_timer.h.
#define REGISTER_RTT_ISR_METHOD | ( | TIMER_NUM, | |
HANDLER, | |||
CALLBACK | |||
) |
Register the necessary ISR (Interrupt Service Routine) for a timer::RTT to work properly, along with a callback method that will be notified every millisecond.
TIMER_NUM | the number of the TIMER feature for the target MCU |
HANDLER | the class holding the callback method |
CALLBACK | the method of HANDLER that will be called when the interrupt is triggered; this must be a proper PTMF (pointer to member function) that takes an uint32_t argument that will receive the total number of milliseconds elapsed since the RTT has started. |
Definition at line 64 of file realtime_timer.h.
#define REGISTER_RTT_ISR_FUNCTION | ( | TIMER_NUM, | |
CALLBACK | |||
) |
Register the necessary ISR (Interrupt Service Routine) for a timer::RTT to work properly, along with a callback function that will be notified every millisecond.
TIMER_NUM | the number of the TIMER feature for the target MCU |
CALLBACK | the function that will be called when the interrupt is triggered; this function must accept an uint32_t argument that will receive the total number of milliseconds elapsed since the RTT has started. |
Definition at line 82 of file realtime_timer.h.
#define REGISTER_RTT_EVENT_ISR | ( | TIMER_NUM, | |
EVENT, | |||
PERIOD | |||
) |
Register the necessary ISR (Interrupt Service Routine) for a timer::RTT to work properly, along with a callback to timer::RTTEventCallback.
TIMER_NUM | the number of the TIMER feature for the target MCU |
EVENT | the events::Event<T> type to be generated by RTTEventCallback |
PERIOD | the period, in ms, at which RTTEventCallback will generate events; this must be a power of 2. |
NOTE: it is important that EVENT
and PERIOD
match an RTTEventCallback<EVENT, PERIOD>
instance in your code.
Definition at line 102 of file realtime_timer.h.
#define DECL_RTT_ISR_HANDLERS_FRIEND |
This macro shall be used in a class containing a private callback method, registered by REGISTER_RTT_ISR_METHOD
.
It declares the class where it is used as a friend of all necessary functions so that the private callback method can be called properly.
Definition at line 114 of file realtime_timer.h.