Skip to main content

Channel

Struct Channel 

Source
pub struct Channel<'d> { /* private fields */ }
Expand description

A connected sigma-delta channel.

Dropping a channel disconnects its output pin and releases the SDM clock guard.

Implementations§

Source§

impl<'d> Channel<'d>

Source

pub fn new( channel: impl Instance + 'd, pin: impl PeripheralOutput<'d>, config: ChannelConfig, ) -> Self

Creates a connected sigma-delta channel.

Source

pub fn apply_config(&mut self, config: &ChannelConfig)

Applies a new channel configuration.

Source

pub fn set_pulse_density(&mut self, density: i8)

Sets raw pulse density.

The value ranges from -128 to 127.

Source

pub fn set_duty(&mut self, duty: u8)

Sets duty cycle. 0 maps to the minimum density and 255 maps to the maximum density.

Source

pub fn prescaler(&self) -> u16

Reads the hardware prescaler.

The returned value is in the hardware divider range 1..=256.

Source

pub fn pulse_density(&self) -> i8

Reads the raw pulse density.

The returned value is in the hardware range -128..=127.

Trait Implementations§

Source§

impl<'d> Debug for Channel<'d>

Available on crate feature unstable only.
Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'d> !UnwindSafe for Channel<'d>

§

impl<'d> Freeze for Channel<'d>

§

impl<'d> RefUnwindSafe for Channel<'d>

§

impl<'d> Send for Channel<'d>

§

impl<'d> Sync for Channel<'d>

§

impl<'d> Unpin for Channel<'d>

§

impl<'d> UnsafeUnpin for Channel<'d>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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> Same for T

Source§

type Output = T

Should always be Self
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

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

Performs the conversion.