Struct rp2040_hal::pwm::Channel
source · pub struct Channel<S: AnySlice, C: ChannelId> { /* private fields */ }
Expand description
A Channel from the Pwm subsystem.
Its attached to one of the eight slices and can be an A or B side channel
Implementations§
source§impl<S: AnySlice> Channel<S, A>
impl<S: AnySlice> Channel<S, A>
sourcepub fn set_enabled(&mut self, enable: bool)
pub fn set_enabled(&mut self, enable: bool)
Enable or disable the PWM channel
sourcepub fn output_to<P: AnyPin>(
&mut self,
pin: P
) -> Pin<P::Id, FunctionPwm, P::Pull>
pub fn output_to<P: AnyPin>( &mut self, pin: P ) -> Pin<P::Id, FunctionPwm, P::Pull>
Capture a gpio pin and use it as pwm output for channel A
sourcepub fn set_inverted(&mut self)
pub fn set_inverted(&mut self)
Invert channel output
sourcepub fn clr_inverted(&mut self)
pub fn clr_inverted(&mut self)
Stop inverting channel output
source§impl<S: AnySlice> Channel<S, B>
impl<S: AnySlice> Channel<S, B>
sourcepub fn set_enabled(&mut self, enable: bool)
pub fn set_enabled(&mut self, enable: bool)
Enable or disable the PWM channel
sourcepub fn output_to<P: AnyPin>(
&mut self,
pin: P
) -> Pin<P::Id, FunctionPwm, P::Pull>
pub fn output_to<P: AnyPin>( &mut self, pin: P ) -> Pin<P::Id, FunctionPwm, P::Pull>
Capture a gpio pin and use it as pwm output for channel B
sourcepub fn set_inverted(&mut self)
pub fn set_inverted(&mut self)
Invert channel output
sourcepub fn clr_inverted(&mut self)
pub fn clr_inverted(&mut self)
Stop inverting channel output
Trait Implementations§
source§impl<S: AnySlice> PwmPin for Channel<S, A>
impl<S: AnySlice> PwmPin for Channel<S, A>
source§fn get_max_duty(&self) -> Self::Duty
fn get_max_duty(&self) -> Self::Duty
Returns the maximum duty cycle value
source§impl<S: AnySlice> PwmPin for Channel<S, B>
impl<S: AnySlice> PwmPin for Channel<S, B>
source§fn get_max_duty(&self) -> Self::Duty
fn get_max_duty(&self) -> Self::Duty
Returns the maximum duty cycle value
source§impl<S: AnySlice> SetDutyCycle for Channel<S, A>
impl<S: AnySlice> SetDutyCycle for Channel<S, A>
source§fn max_duty_cycle(&self) -> u16
fn max_duty_cycle(&self) -> u16
Get the maximum duty cycle value. Read more
source§fn set_duty_cycle(&mut self, duty: u16) -> Result<(), Self::Error>
fn set_duty_cycle(&mut self, duty: u16) -> Result<(), Self::Error>
Set the duty cycle to
duty / max_duty
. Read moresource§fn set_duty_cycle_fully_off(&mut self) -> Result<(), Self::Error>
fn set_duty_cycle_fully_off(&mut self) -> Result<(), Self::Error>
Set the duty cycle to 0%, or always inactive.
source§fn set_duty_cycle_fully_on(&mut self) -> Result<(), Self::Error>
fn set_duty_cycle_fully_on(&mut self) -> Result<(), Self::Error>
Set the duty cycle to 100%, or always active.
source§impl<S: AnySlice> SetDutyCycle for Channel<S, B>
impl<S: AnySlice> SetDutyCycle for Channel<S, B>
source§fn max_duty_cycle(&self) -> u16
fn max_duty_cycle(&self) -> u16
Get the maximum duty cycle value. Read more
source§fn set_duty_cycle(&mut self, duty: u16) -> Result<(), Self::Error>
fn set_duty_cycle(&mut self, duty: u16) -> Result<(), Self::Error>
Set the duty cycle to
duty / max_duty
. Read moresource§fn set_duty_cycle_fully_off(&mut self) -> Result<(), Self::Error>
fn set_duty_cycle_fully_off(&mut self) -> Result<(), Self::Error>
Set the duty cycle to 0%, or always inactive.
source§fn set_duty_cycle_fully_on(&mut self) -> Result<(), Self::Error>
fn set_duty_cycle_fully_on(&mut self) -> Result<(), Self::Error>
Set the duty cycle to 100%, or always active.
Auto Trait Implementations§
impl<S, C> Freeze for Channel<S, C>
impl<S, C> RefUnwindSafe for Channel<S, C>
impl<S, C> Send for Channel<S, C>
impl<S, C> Sync for Channel<S, C>
impl<S, C> Unpin for Channel<S, C>
impl<S, C> UnwindSafe for Channel<S, C>
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
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>
Converts
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>
Converts
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