6#include "stm32h7xx_hal.h"
Definition leddriver.h:33
Hardare timer peripheral support.
Definition tim.h:39
uint32_t GetTick()
Returns the number of counter position.
Result SetPeriod(uint32_t ticks)
Sets the period of the Timer.
Result Start()
Starts the TIM peripheral specified by Config.
void DelayUs(uint32_t del)
Stay within this function for del microseconds.
uint32_t GetFreq()
Returns the frequency of each tick of the timer in Hz.
uint32_t GetMs()
Returns the ticks scaled as milliseconds.
void(* PeriodElapsedCallback)(void *data)
User Callback type that will fire at the end of each timer period. This requires that Config::enable_...
Definition tim.h:96
Result Stop()
Stops the TIM peripheral specified by Config.
void DelayMs(uint32_t del)
Stay within this function for del milliseconds.
TimerHandle & operator=(const TimerHandle &other)=default
void SetCallback(PeriodElapsedCallback cb, void *data=nullptr)
Sets the PeriodElapsedCallback that will fire whenever the timer reaches the end of it's period.
~TimerHandle()
Definition tim.h:101
Result DeInit()
Deinitializes the timer.
Result
Return values for TIM funcitons.
Definition tim.h:87
TimerHandle()
Definition tim.h:98
uint32_t GetUs()
Returns the ticks scaled as microseconds.
void DelayTick(uint32_t del)
Stay within this function for del ticks.
Result Init(const Config &config)
Initializes the timer according to the configuration.
TimerHandle(const TimerHandle &other)=default
Result SetPrescaler(uint32_t val)
Sets the Prescalar applied to the TIM peripheral.
const Config & GetConfig() const
Returns a const reference to the Config struct.
Hardware defines and helpers for daisy field platform.
Definition index.h:2
Configuration struct for the Peripheral.
Definition tim.h:46
CounterDir
Direction of the auto-reload counter.
Definition tim.h:61
CounterDir dir
Definition tim.h:67
uint32_t period
period in ticks at TIM frequency that counter will reset based on dir
Definition tim.h:72
Peripheral periph
Definition tim.h:66
Peripheral
Hardware Timer to configure, and use.
Definition tim.h:49
Config()
Definition tim.h:76
bool enable_irq
Definition tim.h:73