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>

source

pub fn set_enabled(&mut self, enable: bool)

Enable or disable the PWM channel

source

pub fn output_to<P: AnyPin>( &mut self, pin: P ) -> Pin<P::Id, FunctionPwm, P::Pull>
where P::Id: ValidPwmOutputPin<S::Id, A>,

Capture a gpio pin and use it as pwm output for channel A

source

pub fn set_inverted(&mut self)

Invert channel output

source

pub fn clr_inverted(&mut self)

Stop inverting channel output

source§

impl<S: AnySlice> Channel<S, B>

source

pub fn set_enabled(&mut self, enable: bool)

Enable or disable the PWM channel

source

pub fn output_to<P: AnyPin>( &mut self, pin: P ) -> Pin<P::Id, FunctionPwm, P::Pull>
where P::Id: ValidPwmOutputPin<S::Id, B>,

Capture a gpio pin and use it as pwm output for channel B

source

pub fn set_inverted(&mut self)

Invert channel output

source

pub fn clr_inverted(&mut self)

Stop inverting channel output

source§

impl<S: AnySlice> Channel<S, B>
where S::Mode: ValidSliceInputMode<S::Id>,

source

pub fn input_from<P: AnyPin>( &mut self, pin: P ) -> Pin<P::Id, FunctionPwm, P::Pull>
where P::Id: ValidPwmInputPin<S::Id>,

Capture a gpio pin and use it as pwm input for channel B

Trait Implementations§

source§

impl<S: AnySlice> ErrorType for Channel<S, A>

§

type Error = Infallible

Error type
source§

impl<S: AnySlice> ErrorType for Channel<S, B>

§

type Error = Infallible

Error type
source§

impl<S: AnySlice> PwmPin for Channel<S, A>

§

type Duty = u16

Type for the duty methods Read more
source§

fn disable(&mut self)

Disables a PWM channel
source§

fn enable(&mut self)

Enables a PWM channel
source§

fn get_duty(&self) -> Self::Duty

Returns the current duty cycle
source§

fn get_max_duty(&self) -> Self::Duty

Returns the maximum duty cycle value
source§

fn set_duty(&mut self, duty: Self::Duty)

Sets a new duty cycle
source§

impl<S: AnySlice> PwmPin for Channel<S, B>

§

type Duty = u16

Type for the duty methods Read more
source§

fn disable(&mut self)

Disables a PWM channel
source§

fn enable(&mut self)

Enables a PWM channel
source§

fn get_duty(&self) -> Self::Duty

Returns the current duty cycle
source§

fn get_max_duty(&self) -> Self::Duty

Returns the maximum duty cycle value
source§

fn set_duty(&mut self, duty: Self::Duty)

Sets a new duty cycle
source§

impl<S: AnySlice> SetDutyCycle for Channel<S, A>

source§

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>

Set the duty cycle to duty / max_duty. Read more
source§

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>

Set the duty cycle to 100%, or always active.
source§

fn set_duty_cycle_fraction( &mut self, num: u16, denom: u16 ) -> Result<(), Self::Error>

Set the duty cycle to num / denom. Read more
source§

fn set_duty_cycle_percent(&mut self, percent: u8) -> Result<(), Self::Error>

Set the duty cycle to percent / 100 Read more
source§

impl<S: AnySlice> SetDutyCycle for Channel<S, B>

source§

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>

Set the duty cycle to duty / max_duty. Read more
source§

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>

Set the duty cycle to 100%, or always active.
source§

fn set_duty_cycle_fraction( &mut self, num: u16, denom: u16 ) -> Result<(), Self::Error>

Set the duty cycle to num / denom. Read more
source§

fn set_duty_cycle_percent(&mut self, percent: u8) -> Result<(), Self::Error>

Set the duty cycle to percent / 100 Read more

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>
where <S as AnySlice>::Mode: Send, C: Send, <S as AnySlice>::Id: Send,

§

impl<S, C> Sync for Channel<S, C>
where <S as AnySlice>::Mode: Sync, C: Sync, <S as AnySlice>::Id: Sync,

§

impl<S, C> Unpin for Channel<S, C>
where <S as AnySlice>::Mode: Unpin, C: Unpin, <S as AnySlice>::Id: Unpin,

§

impl<S, C> UnwindSafe for Channel<S, C>
where <S as AnySlice>::Mode: UnwindSafe, C: UnwindSafe, <S as AnySlice>::Id: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Choices> CoproductSubsetter<CNil, HNil> for Choices

§

type Remainder = Choices

source§

fn subset( self ) -> Result<CNil, <Choices as CoproductSubsetter<CNil, HNil>>::Remainder>

Extract a subset of the possible types in a coproduct (or get the remaining possibilities) Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> Is for T
where T: Sealed + Borrow<T> + BorrowMut<T>,

§

type Type = T

source§

impl<T, U, I> LiftInto<U, I> for T
where U: LiftFrom<T, I>,

source§

fn lift_into(self) -> U

Performs the indexed conversion.
source§

impl<Source> Sculptor<HNil, HNil> for Source

§

type Remainder = Source

source§

fn sculpt(self) -> (HNil, <Source as Sculptor<HNil, HNil>>::Remainder)

Consumes the current HList and returns an HList with the requested shape. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.