pub struct PwmCluster<const NUM_PINS: usize, P, SM>where
P: PIOExt,
SM: StateMachineIndex,{ /* private fields */ }
Expand description
A type to manage a cluster of PWM signals.
Implementations§
Source§impl<const NUM_PINS: usize, P, SM> PwmCluster<NUM_PINS, P, SM>where
P: PIOExt,
SM: StateMachineIndex,
impl<const NUM_PINS: usize, P, SM> PwmCluster<NUM_PINS, P, SM>where
P: PIOExt,
SM: StateMachineIndex,
Sourcepub const CHANNEL_COUNT: usize = NUM_PINS
pub const CHANNEL_COUNT: usize = NUM_PINS
The number of channels used by this cluster.
Sourcepub const CHANNEL_PAIR_COUNT: usize
pub const CHANNEL_PAIR_COUNT: usize
The number of channel pairs used by this cluster.
Sourcepub fn builder() -> PwmClusterBuilder<NUM_PINS, P>
pub fn builder() -> PwmClusterBuilder<NUM_PINS, P>
Get a PwmClusterBuilder.
Sourcepub fn calculate_pwm_factors(
system_clock_hz: HertzU32,
freq: f32,
) -> Option<(u32, u32)>
pub fn calculate_pwm_factors( system_clock_hz: HertzU32, freq: f32, ) -> Option<(u32, u32)>
Calculate the pwm factors (div and frac) from the system clock and desired frequency.
Sourcepub fn clock_divisor_fixed_point(&mut self, div: u16, frac: u8)
pub fn clock_divisor_fixed_point(&mut self, div: u16, frac: u8)
Set the clock divisor for this cluster.
Sourcepub fn channel_level(&self, channel: u8) -> Result<u32, PwmError>
pub fn channel_level(&self, channel: u8) -> Result<u32, PwmError>
The configured pwm level for the supplied channel
.
Sourcepub fn set_channel_level(
&mut self,
channel: u8,
level: u32,
load: bool,
) -> Result<(), PwmError>
pub fn set_channel_level( &mut self, channel: u8, level: u32, load: bool, ) -> Result<(), PwmError>
Set the pwm level for the supplied channel
. If load
is true, update
the cluster’s data in the PIO state machine.
pub fn channel_offset(&self, channel: u8) -> Result<u32, PwmError>
Sourcepub fn set_channel_offset(
&mut self,
channel: u8,
offset: u32,
load: bool,
) -> Result<(), PwmError>
pub fn set_channel_offset( &mut self, channel: u8, offset: u32, load: bool, ) -> Result<(), PwmError>
Set the start offset for the supplied channel
. If load
is true,
update the cluster’s data in the PIO state machine.
pub fn channel_polarity(&self, channel: u8) -> Result<bool, PwmError>
Sourcepub fn set_channel_polarity(
&mut self,
channel: u8,
polarity: bool,
load: bool,
) -> Result<(), PwmError>
pub fn set_channel_polarity( &mut self, channel: u8, polarity: bool, load: bool, ) -> Result<(), PwmError>
Set the polarity for the supplied channel
. If load
is true, update
the cluster’s data in the PIO state machine.
Sourcepub fn top(&self) -> u32
pub fn top(&self) -> u32
Gets the top value for the pwm counter. This is equivalent to Slice::get_top
when using
[pac::PWM].
Auto Trait Implementations§
impl<const NUM_PINS: usize, P, SM> Freeze for PwmCluster<NUM_PINS, P, SM>
impl<const NUM_PINS: usize, P, SM> !RefUnwindSafe for PwmCluster<NUM_PINS, P, SM>
impl<const NUM_PINS: usize, P, SM> !Send for PwmCluster<NUM_PINS, P, SM>
impl<const NUM_PINS: usize, P, SM> !Sync for PwmCluster<NUM_PINS, P, SM>
impl<const NUM_PINS: usize, P, SM> Unpin for PwmCluster<NUM_PINS, P, SM>
impl<const NUM_PINS: usize, P, SM> !UnwindSafe for PwmCluster<NUM_PINS, P, SM>
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
Source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more