Skip to main content

RxChannel

Struct RxChannel 

Source
pub struct RxChannel<'a, Dm: DriverMode> { /* private fields */ }
Expand description

A receive channel.

Created by Rmt::rx_channel or Rmt::async_rx_channel.

Implementations§

Source§

impl<'a, Dm: DriverMode> RxChannel<'a, Dm>

Source

pub fn with_pin(self, pin: impl PeripheralInput<'a>) -> Self

Connects a pin to the channel’s input signal.

This will replace previous pin assignments for this signal.

Source

pub fn apply_config(&mut self, config: &RxConfig) -> Result<(), ConfigError>

Source

pub fn tick_rate(&self) -> Rate

Returns the actual tick rate.

Source

pub fn receive(&mut self, buf: &mut [PulseCode]) -> Result<usize, RxError>

Receives one frame into buf and returns the number of codes.

Blocks until the input stays at one level for longer than the idle threshold.

A frame cannot be longer than the channel RAM on this chip.

§Errors

RxError::BufferTooSmall or RxError::Overrun.

Source

pub fn start_receive(&mut self) -> RxReception<'_>

Available on crate feature unstable only.

Starts receiving one frame.

Returns an RxReception that copies the codes out while the frame arrives, see RxReception::poll.

A frame cannot be longer than the channel RAM on this chip.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source§

impl<'a> RxChannel<'a, Async>

Source

pub async fn receive_async( &mut self, buf: &mut [PulseCode], ) -> Result<usize, RxError>

Receives one frame into buf and returns the number of codes.

Dropping the future stops the reception. See RxChannel::receive.

§Errors

RxError::BufferTooSmall or RxError::Overrun.

Trait Implementations§

Source§

impl<'a, Dm: Debug + DriverMode> Debug for RxChannel<'a, Dm>

Available on crate feature unstable only.
Source§

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

Formats the value using the given formatter. Read more
Source§

impl<Dm: DriverMode> Drop for RxChannel<'_, Dm>

Available on crate feature unstable only.
Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'a, Dm> Freeze for RxChannel<'a, Dm>
where PhantomData<(&'a (), Dm)>: Freeze,

§

impl<'a, Dm> RefUnwindSafe for RxChannel<'a, Dm>
where PhantomData<(&'a (), Dm)>: RefUnwindSafe,

§

impl<'a, Dm> Send for RxChannel<'a, Dm>
where PhantomData<(&'a (), Dm)>: Send,

§

impl<'a, Dm> Sync for RxChannel<'a, Dm>
where PhantomData<(&'a (), Dm)>: Sync,

§

impl<'a, Dm> Unpin for RxChannel<'a, Dm>
where PhantomData<(&'a (), Dm)>: Unpin,

§

impl<'a, Dm> UnsafeUnpin for RxChannel<'a, Dm>
where PhantomData<(&'a (), Dm)>: UnsafeUnpin,

§

impl<'a, Dm> UnwindSafe for RxChannel<'a, Dm>
where PhantomData<(&'a (), Dm)>: UnwindSafe,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.