|
Internal Interface Wrap
API reference
|
STM32 Periodic Timer implementation. More...
#include <StmPeriodicTimer.h>
Classes | |
| struct | DispatchEntry |
Static Public Member Functions | |
| static void | IsrDispatch (TIM_HandleTypeDef *htim) noexcept |
| Call from HAL_TIM_PeriodElapsedCallback to dispatch to instances. | |
Private Member Functions | |
| bool | ApplyPeriod (hf_u64_t period_us) noexcept |
| Recalculate and apply PSC+ARR for the requested period. | |
| void | RegisterDispatch () noexcept |
| void | UnregisterDispatch () noexcept |
Private Attributes | |
| TIM_HandleTypeDef * | htim_ |
| HAL timer handle. | |
| hf_u32_t | timer_clock_hz_ |
| Input clock to the timer. | |
| hf_u64_t | period_us_ |
| Current period in µs. | |
| hf_timer_stats_t | stats_ |
| Internal stats. | |
Static Private Attributes | |
| static constexpr int | kMaxTimerInstances = 8 |
| static DispatchEntry | s_dispatch_ [kMaxTimerInstances] {} |
| static int | s_dispatch_count_ = 0 |
Additional Inherited Members | |
Protected Member Functions inherited from BasePeriodicTimer | |
| BasePeriodicTimer (hf_timer_callback_t callback, void *user_data=nullptr) noexcept | |
| Protected constructor with callback specification. | |
| void | SetInitialized (bool initialized) noexcept |
| Set the initialized state. | |
| void | SetRunning (bool running) noexcept |
| Set the running state. | |
| void | ExecuteCallback () noexcept |
| Execute the timer callback (called by implementations). | |
| bool | HasValidCallback () const noexcept |
| Check if callback is valid. | |
Protected Attributes inherited from BasePeriodicTimer | |
| hf_timer_callback_t | callback_ |
| Timer callback function. | |
| void * | user_data_ |
| User data passed to callback. | |
| bool | initialized_ |
| Initialization state flag. | |
| bool | running_ |
| Running state flag. | |
| hf_timer_statistics_t | statistics_ |
| Timer operation statistics. | |
| hf_timer_diagnostics_t | diagnostics_ |
| Timer diagnostic information. | |
STM32 Periodic Timer implementation.
Design:
|
explicitnoexcept |
Construct from CubeMX timer handle.
| htim | Pointer to HAL timer handle (CubeMX‑initialised). |
| timer_clock_hz | APB timer clock feeding this TIM (e.g. 84 MHz). |
| callback | User callback (may also be set later via SetCallback). |
| user_data | Opaque pointer forwarded to callback. |
|
explicitnoexcept |
Construct from config struct.
|
overridenoexcept |
|
delete |
Recalculate and apply PSC+ARR for the requested period.
|
overridevirtualnoexcept |
Deinitialize the timer and free resources.
Implements BasePeriodicTimer.
Get description of this timer implementation.
Implements BasePeriodicTimer.
|
overridevirtualnoexcept |
Get timer diagnostic information.
| diagnostics | Reference to store diagnostics data |
Reimplemented from BasePeriodicTimer.
|
overridevirtualnoexcept |
Get minimum supported timer period.
Implements BasePeriodicTimer.
|
overridevirtualnoexcept |
Get maximum supported timer period.
Implements BasePeriodicTimer.
|
overridevirtualnoexcept |
Get the current timer period.
| period_us | Reference to store the current period |
Implements BasePeriodicTimer.
|
overridevirtualnoexcept |
|
overridevirtualnoexcept |
Get timer operation statistics.
| statistics | Reference to store statistics data |
Reimplemented from BasePeriodicTimer.
|
overridevirtualnoexcept |
Get timer statistics and status information.
| callback_count | Number of callbacks executed |
| missed_callbacks | Number of missed callbacks (if supported) |
| last_error | Last error that occurred |
Implements BasePeriodicTimer.
|
overridevirtualnoexcept |
Initialize the timer hardware/resources.
Implements BasePeriodicTimer.
|
staticnoexcept |
Call from HAL_TIM_PeriodElapsedCallback to dispatch to instances.
Usage in user code:
|
delete |
|
privatenoexcept |
|
overridevirtualnoexcept |
Reset timer statistics.
Implements BasePeriodicTimer.
|
overridevirtualnoexcept |
Change the timer period while running.
| period_us | New timer period in microseconds |
Implements BasePeriodicTimer.
|
overridevirtualnoexcept |
Start the periodic timer with specified period.
| period_us | Timer period in microseconds |
Implements BasePeriodicTimer.
|
overridevirtualnoexcept |
Stop the periodic timer.
Implements BasePeriodicTimer.
|
privatenoexcept |
|
private |
HAL timer handle.
|
private |
Current period in µs.
|
staticprivate |
|
staticprivate |
|
private |
Internal stats.
|
private |
Input clock to the timer.