Struct stm32_hal2::timer::BasicTimer
source · [−]pub struct BasicTimer<R> {
pub regs: R,
/* private fields */
}
Expand description
Represents a Basic timer, used primarily to trigger the onboard DAC. Eg Tim6 or Tim7.
Fields
regs: R
Implementations
sourceimpl<R> BasicTimer<R> where
R: Deref<Target = RegisterBlock> + RccPeriph,
impl<R> BasicTimer<R> where
R: Deref<Target = RegisterBlock> + RccPeriph,
sourcepub fn new(regs: R, freq: f32, clock_cfg: &Clocks) -> Self
pub fn new(regs: R, freq: f32, clock_cfg: &Clocks) -> Self
Initialize a Basic timer, including enabling and resetting its RCC peripheral clock.
sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if the timer is enabled.
sourcepub fn set_period(&mut self, time: f32) -> Result<(), ValueError>
pub fn set_period(&mut self, time: f32) -> Result<(), ValueError>
Set the timer period, in seconds. Overrides the period or frequency set in the constructor.
sourcepub fn set_freq(&mut self, freq: f32) -> Result<(), ValueError>
pub fn set_freq(&mut self, freq: f32) -> Result<(), ValueError>
Set the timer frequency, in Hz. Overrides the period or frequency set in the constructor.
sourcepub fn get_max_duty(&self) -> u16
pub fn get_max_duty(&self) -> u16
Return the integer associated with the maximum duty period.
sourcepub fn set_auto_reload(&mut self, arr: u16)
pub fn set_auto_reload(&mut self, arr: u16)
Set the auto-reload register value. Used for adjusting frequency.
sourcepub fn set_prescaler(&mut self, psc: u16)
pub fn set_prescaler(&mut self, psc: u16)
Set the prescaler value. Used for adjusting frequency.
sourcepub fn reset_countdown(&mut self)
pub fn reset_countdown(&mut self)
Reset the countdown; set the counter to 0.
sourcepub fn read_count(&self) -> u16
pub fn read_count(&self) -> u16
Read the current counter value.
sourcepub fn set_mastermode(&self, mode: MasterModeSelection)
pub fn set_mastermode(&self, mode: MasterModeSelection)
Allow selected information to be sent in master mode to slave timers for synchronization (TRGO).
Auto Trait Implementations
impl<R> RefUnwindSafe for BasicTimer<R> where
R: RefUnwindSafe,
impl<R> Send for BasicTimer<R> where
R: Send,
impl<R> Sync for BasicTimer<R> where
R: Sync,
impl<R> Unpin for BasicTimer<R> where
R: Unpin,
impl<R> UnwindSafe for BasicTimer<R> where
R: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more