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::Stackpattern — 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 threadingStackaround 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
Runnerlogging the underlying error chain via the internalerror!macro before handing the collapsedTrxErrorto 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.