Struct stm32f4xx_hal::timer::Timer
source · pub struct Timer<TIM> { /* private fields */ }
Expand description
Timer wrapper.
This wrapper can be used both for the system timer (SYST) or the general-purpose timers (TIMx).
Note: If you want to use the timer to sleep a certain amount of time, use
Delay
.
Implementations§
source§impl Timer<SYST>
impl Timer<SYST>
sourcepub fn counter_hz(self) -> SysCounterHz
pub fn counter_hz(self) -> SysCounterHz
Creates SysCounterHz which takes Hertz as Duration
sourcepub fn counter<const FREQ: u32>(self) -> SysCounter<FREQ>
pub fn counter<const FREQ: u32>(self) -> SysCounter<FREQ>
Creates SysCounter with custom precision (core frequency recommended is known)
sourcepub fn counter_us(self) -> SysCounterUs
pub fn counter_us(self) -> SysCounterUs
Creates SysCounter 1 microsecond precision
source§impl Timer<TIM1>
impl Timer<TIM1>
sourcepub fn pwm_input(
self,
best_guess: Hertz,
pins: impl Into<<TIM1 as CPin<0>>::Ch<PushPull>>
) -> PwmInput<TIM1>
pub fn pwm_input( self, best_guess: Hertz, pins: impl Into<<TIM1 as CPin<0>>::Ch<PushPull>> ) -> PwmInput<TIM1>
Configures this timer for PWM input. Accepts the best_guess
frequency of the signal
Note: this should be as close as possible to the frequency of the PWM waveform for best
accuracy.
This device will emit an interrupt on CC1, which occurs at two times in this mode:
- When a new cycle is started: the duty cycle will be
1.00
- When the period is captured. the duty cycle will be an observable value. See the pwm input example for an suitable interrupt handler.
source§impl Timer<TIM2>
impl Timer<TIM2>
sourcepub fn pwm_input(
self,
best_guess: Hertz,
pins: impl Into<<TIM2 as CPin<0>>::Ch<PushPull>>
) -> PwmInput<TIM2>
pub fn pwm_input( self, best_guess: Hertz, pins: impl Into<<TIM2 as CPin<0>>::Ch<PushPull>> ) -> PwmInput<TIM2>
Configures this timer for PWM input. Accepts the best_guess
frequency of the signal
Note: this should be as close as possible to the frequency of the PWM waveform for best
accuracy.
This device will emit an interrupt on CC1, which occurs at two times in this mode:
- When a new cycle is started: the duty cycle will be
1.00
- When the period is captured. the duty cycle will be an observable value. See the pwm input example for an suitable interrupt handler.
source§impl Timer<TIM3>
impl Timer<TIM3>
sourcepub fn pwm_input(
self,
best_guess: Hertz,
pins: impl Into<<TIM3 as CPin<0>>::Ch<PushPull>>
) -> PwmInput<TIM3>
pub fn pwm_input( self, best_guess: Hertz, pins: impl Into<<TIM3 as CPin<0>>::Ch<PushPull>> ) -> PwmInput<TIM3>
Configures this timer for PWM input. Accepts the best_guess
frequency of the signal
Note: this should be as close as possible to the frequency of the PWM waveform for best
accuracy.
This device will emit an interrupt on CC1, which occurs at two times in this mode:
- When a new cycle is started: the duty cycle will be
1.00
- When the period is captured. the duty cycle will be an observable value. See the pwm input example for an suitable interrupt handler.
source§impl Timer<TIM4>
impl Timer<TIM4>
sourcepub fn pwm_input(
self,
best_guess: Hertz,
pins: impl Into<<TIM4 as CPin<0>>::Ch<PushPull>>
) -> PwmInput<TIM4>
pub fn pwm_input( self, best_guess: Hertz, pins: impl Into<<TIM4 as CPin<0>>::Ch<PushPull>> ) -> PwmInput<TIM4>
Configures this timer for PWM input. Accepts the best_guess
frequency of the signal
Note: this should be as close as possible to the frequency of the PWM waveform for best
accuracy.
This device will emit an interrupt on CC1, which occurs at two times in this mode:
- When a new cycle is started: the duty cycle will be
1.00
- When the period is captured. the duty cycle will be an observable value. See the pwm input example for an suitable interrupt handler.
source§impl Timer<TIM5>
impl Timer<TIM5>
sourcepub fn pwm_input(
self,
best_guess: Hertz,
pins: impl Into<<TIM5 as CPin<0>>::Ch<PushPull>>
) -> PwmInput<TIM5>
pub fn pwm_input( self, best_guess: Hertz, pins: impl Into<<TIM5 as CPin<0>>::Ch<PushPull>> ) -> PwmInput<TIM5>
Configures this timer for PWM input. Accepts the best_guess
frequency of the signal
Note: this should be as close as possible to the frequency of the PWM waveform for best
accuracy.
This device will emit an interrupt on CC1, which occurs at two times in this mode:
- When a new cycle is started: the duty cycle will be
1.00
- When the period is captured. the duty cycle will be an observable value. See the pwm input example for an suitable interrupt handler.
source§impl Timer<TIM8>
impl Timer<TIM8>
sourcepub fn pwm_input(
self,
best_guess: Hertz,
pins: impl Into<<TIM8 as CPin<0>>::Ch<PushPull>>
) -> PwmInput<TIM8>
pub fn pwm_input( self, best_guess: Hertz, pins: impl Into<<TIM8 as CPin<0>>::Ch<PushPull>> ) -> PwmInput<TIM8>
Configures this timer for PWM input. Accepts the best_guess
frequency of the signal
Note: this should be as close as possible to the frequency of the PWM waveform for best
accuracy.
This device will emit an interrupt on CC1, which occurs at two times in this mode:
- When a new cycle is started: the duty cycle will be
1.00
- When the period is captured. the duty cycle will be an observable value. See the pwm input example for an suitable interrupt handler.
source§impl Timer<TIM9>
impl Timer<TIM9>
sourcepub fn pwm_input(
self,
best_guess: Hertz,
pins: impl Into<<TIM9 as CPin<0>>::Ch<PushPull>>
) -> PwmInput<TIM9>
pub fn pwm_input( self, best_guess: Hertz, pins: impl Into<<TIM9 as CPin<0>>::Ch<PushPull>> ) -> PwmInput<TIM9>
Configures this timer for PWM input. Accepts the best_guess
frequency of the signal
Note: this should be as close as possible to the frequency of the PWM waveform for best
accuracy.
This device will emit an interrupt on CC1, which occurs at two times in this mode:
- When a new cycle is started: the duty cycle will be
1.00
- When the period is captured. the duty cycle will be an observable value. See the pwm input example for an suitable interrupt handler.
source§impl Timer<TIM12>
impl Timer<TIM12>
sourcepub fn pwm_input(
self,
best_guess: Hertz,
pins: impl Into<<TIM12 as CPin<0>>::Ch<PushPull>>
) -> PwmInput<TIM12>
pub fn pwm_input( self, best_guess: Hertz, pins: impl Into<<TIM12 as CPin<0>>::Ch<PushPull>> ) -> PwmInput<TIM12>
Configures this timer for PWM input. Accepts the best_guess
frequency of the signal
Note: this should be as close as possible to the frequency of the PWM waveform for best
accuracy.
This device will emit an interrupt on CC1, which occurs at two times in this mode:
- When a new cycle is started: the duty cycle will be
1.00
- When the period is captured. the duty cycle will be an observable value. See the pwm input example for an suitable interrupt handler.