Enum attiny_hal::simple_pwm::Prescaler
source · pub enum Prescaler {
Direct,
Prescale8,
Prescale64,
Prescale256,
Prescale1024,
}
Expand description
Clock prescaler for PWM
The prescaler dictates the PWM frequency, together with the IO clock. The formula is as follows:
F_pwm = CLK_io / (Prescaler * 256);
Prescaler | 16 MHz Clock | 8 MHz Clock |
---|---|---|
Direct | 62.5 kHz | 31.3 kHz |
Prescale8 | 7.81 kHz | 3.91 kHz |
Prescale64 | 977 Hz | 488 Hz |
Prescale256 | 244 Hz | 122 Hz |
Prescale1024 | 61.0 Hz | 30.5 Hz |
Variants§
Direct
No prescaling, the IO clock drives the timer directly.
Prescale8
Divide the IO clock by 8.
Prescale64
Divide the IO clock by 64.
Prescale256
Divide the IO clock by 256.
Prescale1024
Divide the IO clock by 1024.
Trait Implementations§
source§impl Ord for Prescaler
impl Ord for Prescaler
source§impl PartialEq for Prescaler
impl PartialEq for Prescaler
source§impl PartialOrd for Prescaler
impl PartialOrd for Prescaler
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Prescaler
impl Eq for Prescaler
impl StructuralPartialEq for Prescaler
Auto Trait Implementations§
impl Freeze for Prescaler
impl RefUnwindSafe for Prescaler
impl Send for Prescaler
impl Sync for Prescaler
impl Unpin for Prescaler
impl UnwindSafe for Prescaler
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more