This file contains HardwareTimer class, that you can use to easy timer handling.
More...
Go to the source code of this file.
|
struct | TimerSettings |
| Structure, those data was calculated in setInterval method. More...
|
|
class | HardwareTimer |
| Handle timers in interrupt mode really easy using this class.
In table below, you can see methods sections. More...
|
|
|
enum | CalculateTimerState {
CTS_BAD_ARGUMENT = -3,
CTS_TOO_HIGH_RESULT = -2,
CTS_TOO_LOW_RES = -1,
CTS_NONE = 0,
CTS_OK_JUST_PERIOD = 1,
CTS_OK_JUST_PRESCALER = 2,
CTS_OK_BEST_ACCURACY = 3,
CTS_OK_ROUNDED_UP = 4,
CTS_OK_ROUNDED_DOWN = 5
} |
| Enums of all possible calculation states of setTimer method. More...
|
|
enum | TimerState { TS_RUNNING,
TS_PAUSED,
TS_STOPPED,
TS_ERROR
} |
| This is enum of all possible timer states. More...
|
|
This file contains HardwareTimer class, that you can use to easy timer handling.
Credits
- Author
- Matej Fitoš
- Date
- Dec 12, 2020
- See also
- HardwareTimer
◆ min
#define min |
( |
|
a, |
|
|
|
b |
|
) |
| (((a)<b)?(a):(b)) |
◆ max
#define max |
( |
|
a, |
|
|
|
b |
|
) |
| (((a)>b)?(a):(b)) |
◆ abs
#define abs |
( |
|
a | ) |
(((a)>=0)?(a):-(a)) |
◆ TIMER_16BIT_MAX_PRESCALER
#define TIMER_16BIT_MAX_PRESCALER (0xFFFFUL) |
◆ TIMER_32BIT_MAX_PERIOD
#define TIMER_32BIT_MAX_PERIOD (0xFFFFFFFFUL) |
◆ TIMER_16BIT_MAX_PERIOD
#define TIMER_16BIT_MAX_PERIOD (0xFFFFUL) |
◆ CTS_IS_OK
#define CTS_IS_OK |
( |
|
state | ) |
((state)>CTS_NONE) |
Checks if setInterval calculation was OK.
- Parameters
-
state | Use only CalculateTimerState state from timer TimerSettings structure. |
- Returns
- Returns true when calculation was successful.
◆ CalculateTimerState
Enums of all possible calculation states of setTimer method.
- See also
- TimerSettings
Enumerator |
---|
CTS_BAD_ARGUMENT | Check if values maxPrescaler, maxCounter, minPeriod are correct.
|
CTS_TOO_HIGH_RESULT | Value (duration_100ns) is higher than maximum available time that can be set using this timer with current frequency.
(Function returns the highest possible setting)
|
CTS_TOO_LOW_RES | Value (duration_100ns) is lower than minumum available time that can be set using this timer with current frequency.
(Function returns the smallest possible setting)
|
CTS_NONE | Function was not called yet.
|
CTS_OK_JUST_PERIOD | Value was established just with period (prescaler value is 0)
|
CTS_OK_JUST_PRESCALER | Value was established just with prescaler (period value is 0) - This should never happens when you have correct settings.
|
CTS_OK_BEST_ACCURACY | Value was established with the best possible accuracy.
|
CTS_OK_ROUNDED_UP | Value was established with the best possible accuracy, but is slightly higher than expected value.
|
CTS_OK_ROUNDED_DOWN | Value was established with the best possible accuracy, but is slightly lower than expected value.
|
◆ TimerState
This is enum of all possible timer states.
- See also
- state(void)
Enumerator |
---|
TS_RUNNING | Timer is running.
|
TS_PAUSED | Timer is paused, counter register is unchanged.
|
TS_STOPPED | Timer is stopped, counter register was restarted.
|
TS_ERROR | There is some error with timer.
Timer instance probably does not exists.
|