Skyward boardcore
|
Timer utilities. More...
Enumerations | |
enum class | TriggerSource : uint16_t { ITR0 = 0 , ITR1 = TIM_SMCR_TS_0 , ITR2 = TIM_SMCR_TS_1 , ITR3 = TIM_SMCR_TS_1 | TIM_SMCR_TS_0 , TI1F_ED = TIM_SMCR_TS_2 , TI1FP1 = TIM_SMCR_TS_2 | TIM_SMCR_TS_0 , TI2FP2 = TIM_SMCR_TS_2 | TIM_SMCR_TS_1 } |
Trigger sources. More... | |
enum class | MasterMode : uint32_t { RESET = 0 , ENABLE = TIM_CR2_MMS_0 , UPDATE = TIM_CR2_MMS_1 , COMPARE_PULSE = TIM_CR2_MMS_1 | TIM_CR2_MMS_0 , OC1REF_OUTPUT = TIM_CR2_MMS_2 , OC2REF_OUTPUT = TIM_CR2_MMS_2 | TIM_CR2_MMS_0 , OC3REF_OUTPUT = TIM_CR2_MMS_2 | TIM_CR2_MMS_1 , OC4REF_OUTPUT = TIM_CR2_MMS } |
enum class | SlaveMode : uint16_t { DISABLED = 0 , RESET_MODE = TIM_SMCR_SMS_2 , GATED_MODE = TIM_SMCR_SMS_2 | TIM_SMCR_SMS_0 , TRIGGER_MODE = TIM_SMCR_SMS_2 | TIM_SMCR_SMS_1 , EXTERNAL_CLOCK_MODE_1 = TIM_SMCR_SMS_0 | TIM_SMCR_SMS_1 | TIM_SMCR_SMS_2 } |
enum class | OutputCompareMode : uint16_t { FROZEN = 0 , ACTIVE_ON_MATCH = 0x1 , INACTIVE_ON_MATCH = 0x2 , TOGGLE = 0x3 , FORCE_INACTIVE = 0x4 , FORCE_ACTIVE = 0x5 , PWM_MODE_1 = 0x6 , PWM_MODE_2 = 0x7 } |
enum class | OutputComparePolarity : uint16_t { ACTIVE_HIGH = 0 , ACTIVE_LOW = 0x1 } |
enum class | Channel : uint8_t { CHANNEL_1 = 0 , CHANNEL_2 = 1 , CHANNEL_3 = 2 , CHANNEL_4 = 3 } |
Functions | |
ClockUtils::APB | getTimerInputClock (const TIM_TypeDef *timer) |
Returns the timer input clock. | |
uint32_t | getPrescalerInputFrequency (const TIM_TypeDef *timer) |
Returns the timer clock frequency before the prescaler. | |
uint32_t | getFrequency (TIM_TypeDef *timer) |
Return the timer clock frequency. | |
float | toMicroSeconds (TIM_TypeDef *timer, uint32_t value) |
Returns the specified value converted in microseconds based on the timer clock frequency and prescaler. | |
float | toMicroSeconds (TIM_TypeDef *timer) |
Returns the timer counter converted in microseconds based on the timer clock frequency and prescaler. | |
uint64_t | toIntMicroSeconds (TIM_TypeDef *timer, uint32_t value) |
Returns the specified value converted in microseconds based on the timer clock frequency and prescaler. | |
uint64_t | toIntMicroSeconds (TIM_TypeDef *timer) |
Returns the timer counter converted in microseconds based on the timer clock frequency and prescaler. | |
float | toMilliSeconds (TIM_TypeDef *timer, uint32_t value) |
Returns the specified value converted in milliseconds based on the timer clock frequency and prescaler. | |
float | toMilliSeconds (TIM_TypeDef *timer) |
Returns the timer counter converted in milliseconds based on the timer clock frequency and prescaler. | |
float | toSeconds (TIM_TypeDef *timer) |
Returns the timer counter converted in seconds based on the timer clock frequency and prescaler. | |
float | getResolution (TIM_TypeDef *timer) |
Computes the timer resolution in microseconds. | |
float | getMaxDuration (TIM_TypeDef *timer) |
Computes the number of seconds for timer reset. | |
uint16_t | computePrescalerValue (TIM_TypeDef *timer, int targetFrequency) |
Compute the prescaler value for the specified target frequency. | |
MasterMode | masterModeFromChannel (const Channel channel) |
Returns the corresponding master for for the given channel. | |
Timer utilities.
|
strong |
Enumerator | |
---|---|
CHANNEL_1 | |
CHANNEL_2 | |
CHANNEL_3 | |
CHANNEL_4 |
Definition at line 246 of file TimerUtils.h.
|
strong |
Definition at line 97 of file TimerUtils.h.
|
strong |
Definition at line 193 of file TimerUtils.h.
|
strong |
Enumerator | |
---|---|
ACTIVE_HIGH | |
ACTIVE_LOW |
Definition at line 240 of file TimerUtils.h.
|
strong |
Definition at line 148 of file TimerUtils.h.
|
strong |
Trigger sources.
Here a quick recap of the internal trigger sources:
ITR0 ITR1 ITR2 ITR3
TIM1 TIM5 TIM2 TIM3 TIM4 TIM2 TIM1 TIM8 TIM3 TIM4 TIM3 TIM1 TIM2 TIM5 TIM4 TIM4 TIM1 TIM2 TIM3 TIM8 TIM5 TIM2 TIM3 TIM4 TIM8 TIM6 -— -— -— -— TIM7 -— -— -— -— TIM8 TIM1 TIM2 TIM4 TIM5 TIM9 TIM2 TIM3 TIM10 TIM11 TIM10 -— -— -— -— TIM11 -— -— -— -— TIM12 TIM4 TIM5 TIM13 TIM14 TIM13 -— -— -— -— TIM14 -— -— -— -—
Enumerator | |
---|---|
ITR0 | Internal trigger 0. |
ITR1 | Internal trigger 1. |
ITR2 | Internal trigger 2. |
ITR3 | Internal trigger 3. |
TI1F_ED | TI1 edge detector. |
TI1FP1 | Filtered timer input 1. |
TI2FP2 | Filtered timer input 2. |
Definition at line 59 of file TimerUtils.h.
|
inline |
Compute the prescaler value for the specified target frequency.
If the target frequency is above the prescaler input frequency, the returned value will be 0 which is the maximum.
Definition at line 448 of file TimerUtils.h.
|
inline |
Return the timer clock frequency.
timer | Timer to use. |
Definition at line 392 of file TimerUtils.h.
|
inline |
Computes the number of seconds for timer reset.
Definition at line 442 of file TimerUtils.h.
|
inline |
Returns the timer clock frequency before the prescaler.
Class borrowed from the SynchronizedServo class in Miosix.
timer | Timer to use. |
Definition at line 387 of file TimerUtils.h.
|
inline |
Computes the timer resolution in microseconds.
Definition at line 437 of file TimerUtils.h.
|
inline |
Returns the timer input clock.
Definition at line 370 of file TimerUtils.h.
|
inline |
Returns the corresponding master for for the given channel.
Definition at line 456 of file TimerUtils.h.
|
inline |
Returns the timer counter converted in microseconds based on the timer clock frequency and prescaler.
Calculation using integer values.
Definition at line 415 of file TimerUtils.h.
|
inline |
Returns the specified value converted in microseconds based on the timer clock frequency and prescaler.
Calculation using integer values.
Definition at line 408 of file TimerUtils.h.
|
inline |
Returns the timer counter converted in microseconds based on the timer clock frequency and prescaler.
Definition at line 403 of file TimerUtils.h.
|
inline |
Returns the specified value converted in microseconds based on the timer clock frequency and prescaler.
Definition at line 397 of file TimerUtils.h.
|
inline |
Returns the timer counter converted in milliseconds based on the timer clock frequency and prescaler.
Definition at line 426 of file TimerUtils.h.
|
inline |
Returns the specified value converted in milliseconds based on the timer clock frequency and prescaler.
Definition at line 420 of file TimerUtils.h.
|
inline |
Returns the timer counter converted in seconds based on the timer clock frequency and prescaler.
Definition at line 431 of file TimerUtils.h.