Channel

Struct Channel 

Source
pub struct Channel<S, C>
where 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> Channel<S, A>
where S: AnySlice,

Source

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

Enable or disable the PWM channel

Source

pub fn output_to<P>( &mut self, pin: P, ) -> Pin<<P as AnyPin>::Id, FunctionPwm, <P as AnyPin>::Pull>
where P: AnyPin, <P as AnyPin>::Id: ValidPwmOutputPin<<S as AnySlice>::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> Channel<S, B>
where S: AnySlice,

Source

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

Enable or disable the PWM channel

Source

pub fn output_to<P>( &mut self, pin: P, ) -> Pin<<P as AnyPin>::Id, FunctionPwm, <P as AnyPin>::Pull>
where P: AnyPin, <P as AnyPin>::Id: ValidPwmOutputPin<<S as AnySlice>::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> Channel<S, B>
where S: AnySlice, <S as AnySlice>::Mode: ValidSliceInputMode<<S as AnySlice>::Id>,

Source

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

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

Trait Implementations§

Source§

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

Source§

type Error = Infallible

Error type
Source§

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

Source§

type Error = Infallible

Error type
Source§

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

Source§

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) -> <Channel<S, A> as PwmPin>::Duty

Returns the current duty cycle
Source§

fn get_max_duty(&self) -> <Channel<S, A> as PwmPin>::Duty

Returns the maximum duty cycle value
Source§

fn set_duty(&mut self, duty: <Channel<S, A> as PwmPin>::Duty)

Sets a new duty cycle
Source§

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

Source§

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) -> <Channel<S, B> as PwmPin>::Duty

Returns the current duty cycle
Source§

fn get_max_duty(&self) -> <Channel<S, B> as PwmPin>::Duty

Returns the maximum duty cycle value
Source§

fn set_duty(&mut self, duty: <Channel<S, B> as PwmPin>::Duty)

Sets a new duty cycle
Source§

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

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<(), <Channel<S, A> as ErrorType>::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> SetDutyCycle for Channel<S, B>
where S: AnySlice,

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<(), <Channel<S, B> as ErrorType>::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

Source§

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>,

Source§

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

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>,

Source§

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>,

Source§

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.