pub struct PeripheralClockConfig<'a> { /* private fields */ }
Expand description

Clock configuration of the MCPWM peripheral

Implementations§

Get a clock configuration with the given prescaler.

With standard system clock configurations the input clock to the MCPWM peripheral is 160 MHz.

The peripheral clock frequency is calculated as: peripheral_clock = input_clock / (prescaler + 1)

Get a clock configuration with the given frequency.

Note:

This will try to select an appropriate prescaler for the PeripheralClockConfig::with_prescaler method. If the calculated prescaler is not in the range 0..u8::MAX FrequencyError will be returned.

With standard system clock configurations the input clock to the MCPWM peripheral is 160 MHz.

Only divisors of the input clock (160 Mhz / 1, 160 Mhz / 2, …, 160 Mhz / 256) are representable exactly. Other target frequencies will be rounded up to the next divisor.

Get the peripheral clock frequency.

Note:

The actual value is rounded down to the nearest u32 value

Get a timer clock configuration with the given prescaler.

The resulting timer frequency depends of the chosen timer::PwmWorkingMode.

PwmWorkingMode::Increase or PwmWorkingMode::Decrease

timer_frequency = peripheral_clock / (prescaler + 1) / (period + 1)

PwmWorkingMode::UpDown

timer_frequency = peripheral_clock / (prescaler + 1) / (2 * period)

Get a timer clock configuration with the given frequency.

Note:

This will try to select an appropriate prescaler for the timer. If the calculated prescaler is not in the range 0..u8::MAX FrequencyError will be returned.

See PeripheralClockConfig::timer_clock_with_prescaler for how the frequency is calculated.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.