|
enum | Mode : uint32_t { UpCounter = 0,
OneShotUpCounter = TIM_CR1_OPM
} |
|
enum | Interrupt : uint32_t { Update = TIM_DIER_UIE
} |
|
enum | InterruptFlag : uint32_t { Update = TIM_SR_UIF
} |
|
enum | Event : uint32_t {
Break2 = TIM_EGR_B2G,
Break = TIM_EGR_BG,
CaptureCompareControlUpdate = TIM_EGR_COMG,
Trigger = TIM_EGR_TG,
CaptureCompare4 = TIM_EGR_CC4G,
CaptureCompare3 = TIM_EGR_CC3G,
CaptureCompare2 = TIM_EGR_CC2G,
CaptureCompare1 = TIM_EGR_CC1G,
Update = TIM_EGR_UG
} |
|
|
| MODM_FLAGS32 (Interrupt) |
|
| MODM_FLAGS32 (InterruptFlag) |
|
static void modm::platform::BasicTimer::acknowledgeInterruptFlags |
( |
InterruptFlag_t |
flags | ) |
|
|
static |
Clears one or multiple flags.
- Parameters
-
static void modm::platform::BasicTimer::applyAndReset |
( |
| ) |
|
|
inlinestatic |
Reset the counter, and update the prescaler and overflow values.
Generates an Update-Event without generating an Update-Interrupt.
This will reset the counter to 0 in up-counting mode (the default) or to the maximal value in down-counting mode. It will also update the timer's prescaler and overflow values if you have set them up to be changed using setPrescaler() or setOverflow() (or setPeriod()).
An Update-Event is also generated when the timer reaches its maximal (up-counting) or minimal (down-counting) value. The settings for Prescaler, Overflow and Compare values are applied then without calling this function.
static void modm::platform::BasicTimer::disable |
( |
| ) |
|
|
static |
Disable clock.
All settings are ignored in this mode and the timer is shut down. Calling any function other than enable() won't have any effect.
static void modm::platform::BasicTimer::disableInterrupt |
( |
Interrupt_t |
interrupt | ) |
|
|
static |
Disables interrupts.
- Parameters
-
interrupt | Interrupts to disable |
static void modm::platform::BasicTimer::enable |
( |
| ) |
|
|
static |
Enables the clock for the timer and resets all settings
Has to be called before calling any other function from this class! Otherwise the settings won't have any effect.
static void modm::platform::BasicTimer::enableInterrupt |
( |
Interrupt_t |
interrupt | ) |
|
|
static |
static void modm::platform::BasicTimer::enableInterruptVector |
( |
bool |
enable, |
|
|
uint8_t |
priority |
|
) |
| |
|
static |
Enables or disables the Interrupt Vector.
- Parameters
-
enable | Enable/disable the interrupt vector |
priority | Priority of the interrupt vector (0=highest to 15=lowest). |
static InterruptFlag_t modm::platform::BasicTimer::getInterruptFlags |
( |
| ) |
|
|
static |
Returns a bitmap of the enum StateFlag. Use this method while executing an interrupt or in other situations where you want to know which of the flags are set.
If a flag is a cause of an enabled interrupt (and the Interrupt Vector is enabled) then interrupt will be triggered as long the flag is set.
- Warning
- You cannot use a switch statement for the returned value, since multiple flags may be set!
InterruptFlag flags = TimerX::getInterruptFlags()
if (flags & TimerX::FLAG_XX){
TimerX::resetInterruptFlags(TIMx::FLAG_XX)
}
static Value modm::platform::BasicTimer::getOverflow |
( |
| ) |
|
|
inlinestatic |
static uint16_t modm::platform::BasicTimer::getPrescaler |
( |
| ) |
|
|
inlinestatic |
static Value modm::platform::BasicTimer::getValue |
( |
| ) |
|
|
inlinestatic |
static constexpr bool modm::platform::BasicTimer::hasAdvancedPwmControl |
( |
| ) |
|
|
staticconstexpr |
Allows to check, whether the timer has BDTR and DTR2 registers for PWM deadtime, break and output enable control.
static bool modm::platform::BasicTimer::isCountingUp |
( |
| ) |
|
|
inlinestatic |
Check current count direction
static bool modm::platform::BasicTimer::isEnabled |
( |
| ) |
|
|
static |
Check, whether clock has been enabled.
static void modm::platform::BasicTimer::pause |
( |
| ) |
|
|
static |
Pause timer operation
All settings are stored but the timer operation is suspend until start() is called.
static void modm::platform::BasicTimer::setMode |
( |
Mode |
mode | ) |
|
|
static |
Set operation mode of the timer
static void modm::platform::BasicTimer::setOverflow |
( |
Value |
overflow | ) |
|
|
inlinestatic |
Set overflow.
This sets the maximum counter value of the timer. The timer is blocked if overflow
is set to zero.
Takes effect at next update event.
- See also
- applyAndReset()
template<class Rep , class Period >
static Value modm::platform::BasicTimer::setPeriod |
( |
std::chrono::duration< Rep, Period > |
duration, |
|
|
bool |
autoApply = true |
|
) |
| |
|
static |
Set Timer period
Changes prescaler and overflow values. Takes effect at next update event.
- Parameters
-
duration | Requested duration of period |
autoApply | Update the new value immediately and reset the counter value. |
- Returns
- New overflow value.
- See also
- applyAndReset()
static void modm::platform::BasicTimer::setPrescaler |
( |
uint16_t |
prescaler | ) |
|
|
inlinestatic |
Set new prescaler
The prescaler can divide the counter clock frequency by any factor between 1 and 65'536. The new prescaler ratio is taken into account at the next update event.
- See also
- applyAndReset()
static void modm::platform::BasicTimer::setValue |
( |
Value |
value | ) |
|
|
inlinestatic |
static void modm::platform::BasicTimer::start |
( |
| ) |
|
|
static |
Re-enable timer operations
Has to called after the initial configuration to start timer or after pause() to restart the timer.
The documentation for this class was generated from the following file: