Skip to main content

TrxError

Enum TrxError 

Source
pub enum TrxError {
    TrxNotFound,
    Reset,
    Spi,
    Gpio,
    Config,
    WrongPacketFormat,
    RecoverUnsupported,
}
Expand description

Stable, lossy error enum for the transport-agnostic Transceiver trait.

The driver’s parametric crate::Error preserves the underlying SPI / GPIO error types, which is useful for users that hold a concrete Rfm69<...> but does not survive a dyn boundary or a generic that abstracts over the backing radio. TrxError collapses those variants into a fixed vocabulary for use across the Transceiver boundary.

The lossy shape is deliberate (the alternative was to make TrxError parametric over the SPI / RESET / DIO0 error types). Reasons:

  • Mirrors the embassy-net::Stack pattern — high-level Stack APIs should not leak the underlying driver’s error types across the abstraction they were created to draw.
  • Keeps Stack<'a>, Runner<'a, TRX>, and the channel slot type free of an extra error-type generic, so user code threading Stack around stays terse.
  • Future multi-radio backends get to share one stable error vocabulary; user code keeps working when swapping backings.
  • Debuggability is preserved by the Runner logging the underlying error chain via the internal error! macro before handing the collapsed TrxError to the user.

Power users who want the full parametric error chain can call the inherent Rfm69::send / Rfm69::recv directly, which still return Error<SPI, RESET, DIO0> — the lossy collapse only happens at the Transceiver boundary.

Variants§

§

TrxNotFound

Reading the version register failed or returned an unexpected value during configuration / reset.

§

Reset

The reset GPIO write failed.

§

Spi

An SPI bus transaction failed.

§

Gpio

A DIO0 GPIO read or interrupt-wait failed.

§

Config

A configuration step (e.g. sync-word size) was rejected.

§

WrongPacketFormat

A packet’s framing was invalid (length out of range, etc.).

§

RecoverUnsupported

The Transceiver has no active-recovery implementation. Returned by the default Transceiver::recover so the Runner keeps the link Down rather than treating an unimplemented recovery as success.

Trait Implementations§

Source§

impl Debug for TrxError

Source§

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

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

impl Format for TrxError

Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl<SPI, RESET, DIO0> From<Error<SPI, RESET, DIO0>> for TrxError

Source§

fn from(error: Error<SPI, RESET, DIO0>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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