Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of HardwareTimersLib by
Timer_PIT Class Reference
Base class for PIT timing on the FRDM-KL46Z. More...
#include <Timer_PIT.h>
Inherits HardwareTimer.
Public Member Functions | |
| Timer_PIT () | |
| Construct a new PIT timer. | |
| virtual | ~Timer_PIT () |
| Destroy the PIT object. | |
| virtual uint32_t | getTick () |
| bool | valid () |
| bool | enabled () |
| bool | running () |
| float | tickValue () |
| float | tickUnits () |
| void | enable (void(*fptr)(void)) |
| Enables the timer with a user-specified callback function that is called each time the timer expires. | |
| template<typename T > | |
| void | enable (T *tptr, void(T::*mptr)(void)) |
| Enables the timer with a user-specified callback function that is called each time the timer expires. | |
| void | disable () |
| Stops and disables the timer. | |
| void | start (uint32_t callback_tick_count, bool periodic, uint32_t num_callbacks) |
| Starts the timer. | |
| uint32_t | getMaxCallbackTickCount () |
| PreciseTime | getTime () |
| Gets the timer value in a nice form. | |
Detailed Description
Base class for PIT timing on the FRDM-KL46Z.
Definition at line 17 of file Timer_PIT.h.
Constructor & Destructor Documentation
| Timer_PIT | ( | ) |
Construct a new PIT timer.
The timer operates at 1 KHz. Only one Timer_PIT object may be valid at a time (can control hardware).
Definition at line 16 of file Timer_PIT.cpp.
| ~Timer_PIT | ( | ) | [virtual] |
Destroy the PIT object.
If the object was valid (was allowed to access the timer hardware), it will free the resource so that another Timer_PIT object can access hardware.
Definition at line 28 of file Timer_PIT.cpp.
Member Function Documentation
| void disable | ( | ) | [inherited] |
Stops and disables the timer.
No user function callbacks will be made, and the tick value stops increasing.
Definition at line 99 of file HardwareTimer.cpp.
| void enable | ( | void(*)(void) | fptr ) | [inherited] |
Enables the timer with a user-specified callback function that is called each time the timer expires.
- Parameters:
-
fptr the user callback function
Definition at line 65 of file HardwareTimer.cpp.
| void enable | ( | T * | tptr, |
| void(T::*)(void) | mptr | ||
| ) | [inherited] |
Enables the timer with a user-specified callback function that is called each time the timer expires.
- Parameters:
-
tptr the object mptr method to call on the object
Definition at line 81 of file HardwareTimer.cpp.
| bool enabled | ( | ) | [inherited] |
- Returns:
- true if the timer is ready to start.
Definition at line 35 of file HardwareTimer.cpp.
| uint32_t getMaxCallbackTickCount | ( | ) | [inherited] |
- Returns:
- the maximum value of the user-settable callback tick count (via startTimer()). Some timers may support full 32-bit tick counts, while others may be less.
Definition at line 128 of file HardwareTimer.cpp.
| uint32_t getTick | ( | ) | [virtual] |
- Returns:
- the current tick number. Convert to seconds by multiplying the return value with tickValue(). Note that getTick() * tickValue() can easily overflow on faster timers due to the 32-bit upper bound on arithmetic.
Implements HardwareTimer.
Definition at line 35 of file Timer_PIT.cpp.
| PreciseTime getTime | ( | ) | [inherited] |
Gets the timer value in a nice form.
Note that in general, the timer may overflow, leading to saturated values obtained from getTime(). To maximize resolution, accuracy, performance, and range, it is recommended to use getTick() for most purposes. getTime() is mostly for convenience.
- Returns:
- the current tick converted into a PreciseTime representation.
Definition at line 132 of file HardwareTimer.cpp.
| bool running | ( | ) | [inherited] |
- Returns:
- true if the timer is running.
Definition at line 39 of file HardwareTimer.cpp.
| void start | ( | uint32_t | callback_tick_count, |
| bool | periodic, | ||
| uint32_t | num_callbacks | ||
| ) | [inherited] |
Starts the timer.
If valid() or enabled() are false, then this method does nothing. Otherwise, the timer begins ticking. The user callback function specified in enableTimer() is called each time the timer rolls over.
- Parameters:
-
callback_tick_count the modulo tick value for when the timer calls the user callback function. Note that the timer counts up. Note that some timers may not support the full 32-bit range. Use getMaxCallbackTickCount() To check the maximum allowed value. If callback_tick_count is greater than that value, this method will have no effect. periodic if true, the timer will call the user function every time the internal tick modulo callback_tick_count is reached. If false, the user callback function is only called the first num_callbacks times. num_callbacks if periodic is set to false, this many callbacks will be made. Before the timer stops.
Definition at line 113 of file HardwareTimer.cpp.
| float tickUnits | ( | ) | [inherited] |
- Returns:
- time in seconds corresponding to each tick
Definition at line 47 of file HardwareTimer.cpp.
| float tickValue | ( | ) | [inherited] |
- Returns:
- the amount of time corresponding to each timer tick in units given by tickUnits().
Definition at line 43 of file HardwareTimer.cpp.
| bool valid | ( | ) | [inherited] |
- Returns:
- true if this timer is valid. If false, the timer cannot be used.
Definition at line 31 of file HardwareTimer.cpp.
Generated on Tue Jul 12 2022 20:37:48 by
1.7.2
