Skyward boardcore
|
Driver for STM32 general purpose timers. More...
#include <GeneralPurposeTimer.h>
Public Member Functions | |
GeneralPurposeTimer (TIM_TypeDef *timer) | |
Create a GeneralPurposeTimer object. Note that this does not resets the timer configuration but automatically enables the timer peripheral clock. | |
~GeneralPurposeTimer () | |
Disables the peripheral clock. | |
void | reset () override |
Resets the timer configuration to the default state. | |
void | enable () override |
void | disable () override |
T | readCounter () |
void | setCounter (T counterValue) |
T | readAutoReloadRegister () |
void | setAutoReloadRegister (T autoReloadValue) |
void | setMasterMode (TimerUtils::MasterMode masterMode) override |
void | setSlaveMode (TimerUtils::SlaveMode slaveMode) |
void | setTriggerSource (TimerUtils::TriggerSource triggerSource) |
void | enableTriggerInterrupt () |
void | disableTriggerInterrupt () |
void | enableCaptureCompareInterrupt (TimerUtils::Channel channel) |
void | disableCaptureCompareInterrupt (TimerUtils::Channel channel) |
void | enableCaptureCompareDMARequest (TimerUtils::Channel channel) |
void | disableCaptureCompareDMARequest (TimerUtils::Channel channel) |
void | generateTrigger () |
void | generateCaptureCompareEvent (TimerUtils::Channel channel) |
void | enableCaptureComparePreload (TimerUtils::Channel channel) |
The capture/compare register is buffered. | |
void | disableCaptureComparePreload (TimerUtils::Channel channel) |
The capture/compare register is not buffered. | |
void | setOutputCompareMode (TimerUtils::Channel channel, TimerUtils::OutputCompareMode modeChannel) |
void | enableCaptureCompareOutput (TimerUtils::Channel channel) |
void | enableCaptureCompareComplementaryOutput (TimerUtils::Channel channel) |
void | disableCaptureCompareOutput (TimerUtils::Channel channel) |
void | disableCaptureCompareComplementaryOutput (TimerUtils::Channel channel) |
bool | isCaptureCompareOutputEnabled (TimerUtils::Channel channel) |
bool | isCaptureCompareComplementaryOutputEnabled (TimerUtils::Channel channel) |
void | setCaptureComparePolarity (TimerUtils::Channel channel, TimerUtils::OutputComparePolarity polarity) |
void | setCaptureCompareComplementaryPolarity (TimerUtils::Channel channel, TimerUtils::OutputComparePolarity polarity) |
void | setCaptureCompareRegister (TimerUtils::Channel channel, T value) |
T | readCaptureCompareRegister (TimerUtils::Channel channel) |
void | clearTriggerInterruptFlag () |
void | clearCaptureCompareInterruptFlag (TimerUtils::Channel channel) |
![]() | |
BasicTimer (TIM_TypeDef *timer) | |
Create a BasicTimer object. Note that this does not resets the timer configuration but automatically enables the timer peripheral clock. | |
~BasicTimer () | |
Disables the peripheral clock. | |
TIM_TypeDef * | getTimer () |
uint8_t | getTimerNumber () |
virtual bool | isEnabled () final |
virtual void | enableAutoReloadPreload () final |
The auto reload register is buffered. | |
virtual void | disableAutoReloadPreload () final |
Tha auto reload register is not buffered. | |
virtual void | enableUpdateEventGeneration () final |
When enabled, the UEV is generated by the counter overflow and software UEV generation. | |
virtual void | disableUpdateEventGeneration () final |
The UEV is disabled. | |
virtual void | generateUpdate () final |
Re-initializes the timer counter and generate an update of the registers (the prescaler is cleared too). | |
uint16_t | readCounter () |
void | setCounter (uint16_t counterValue) |
virtual uint16_t | readPrescaler () final |
virtual void | setPrescaler (uint16_t prescalerValue) final |
Updated the prescaler value. | |
virtual int | getFrequency () final |
virtual void | setFrequency (int frequency) final |
Allows to set directly the frequency of the timer's clock. | |
uint16_t | readAutoReloadRegister () |
void | setAutoReloadRegister (uint16_t autoReloadValue) |
virtual void | enableUpdateInterrupt () final |
virtual void | disableUpdateInterrupt () final |
virtual void | enableUpdateDMARequest () final |
virtual void | disableUpdateDMARequest () final |
virtual void | enableOnePulseMode () final |
virtual void | disableOnePulseMode () final |
virtual void | enableUGInterruptAndDMA () final |
virtual void | disableUGInterruptAndDMA () final |
Additional Inherited Members | |
![]() | |
static void | clearUpdateInterruptFlag (TIM_TypeDef *timer) |
![]() | |
TIM_TypeDef * | timer |
Driver for STM32 general purpose timers.
This driver applies to the whole STM32F4xx family.
General purpose timers main features are:
TIM2 to TIM5 and TIM9 to TIM14 are general purpose timers.
You can use 32bit general purpose timers and advance timers as general purpose timers.
Although general purpose timers are called the same, there are slight differences in features:
For a basic introduction to timers read BasicTimer description. For a more exhaustive explanation and feature list study the reference manual!
The counter clock can be provided by the following clock sources:
The internal clock source is the default clock source. For TIM9 and TIM12 the internal clock source is selected when the slave mode controller is disabled.
In External clock mode 1 the counter can count at each rising or falling edge on a selected input.
Output compare mode function is used to control an output waveform or indicating when a period of timer has elapse. When a match is found between the capture/compare register and the counter, the compare function outputs the value defined by the output compare mode.
PWM mode allows the user to generate a PWM signal with a specific frequency and duty cycle.
TODO: Gated mode
TODO: Timer synchronization
Other timer functionalities still needs to be implemented.
Definition at line 98 of file GeneralPurposeTimer.h.
|
inlineexplicit |
Create a GeneralPurposeTimer object. Note that this does not resets the timer configuration but automatically enables the timer peripheral clock.
Definition at line 224 of file GeneralPurposeTimer.h.
|
inline |
Disables the peripheral clock.
Definition at line 230 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 574 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 568 of file GeneralPurposeTimer.h.
|
inlineoverridevirtual |
Reimplemented from Boardcore::BasicTimer.
Definition at line 270 of file GeneralPurposeTimer.h.
|
inline |
Same as non complementary outputs but their idle state is high.
Definition at line 491 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 371 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 357 of file GeneralPurposeTimer.h.
|
inline |
Note that after the output is disabled, its level is then function of MOE, OSSI, OSSR, OIS1, OIS1N and CC1NE bits for timers TIM1 and TIM8.
Practically disabled, so low state.
Definition at line 484 of file GeneralPurposeTimer.h.
|
inline |
The capture/compare register is not buffered.
This means that when you change the capture/compare register, its value is taken into account immediately.
Definition at line 412 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 344 of file GeneralPurposeTimer.h.
|
inlineoverridevirtual |
Reimplemented from Boardcore::BasicTimer.
Definition at line 259 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 477 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 364 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 350 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 470 of file GeneralPurposeTimer.h.
|
inline |
The capture/compare register is buffered.
This means that the shadow register is used and the capture/compare value will became active at the next UEV.
Definition at line 391 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 338 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 384 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 378 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 505 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 498 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 293 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 549 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 281 of file GeneralPurposeTimer.h.
|
inlineoverridevirtual |
Resets the timer configuration to the default state.
This means that:
Reimplemented from Boardcore::BasicTimer.
Definition at line 236 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 299 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 520 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 512 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 528 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 287 of file GeneralPurposeTimer.h.
|
inlineoverridevirtual |
Reimplemented from Boardcore::BasicTimer.
Definition at line 305 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 433 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 316 of file GeneralPurposeTimer.h.
|
inline |
Definition at line 327 of file GeneralPurposeTimer.h.