pub trait Receive {
type Error: Debug;
type Info: ReceiveInfo;
// Required methods
fn start_receive(&mut self) -> Result<(), Self::Error>;
fn check_receive(&mut self, restart: bool) -> Result<bool, Self::Error>;
fn get_received(
&mut self,
buff: &mut [u8]
) -> Result<(usize, Self::Info), Self::Error>;
}
Expand description
Receive trait for radios that can receive packets
start_receive
should be used to setup the radio in receive mode, with check_receive
called
periodically (or using interrupts) to poll for packet reception. Once a packet has been received,
get_received
fetches the received packet (and associated info) from the radio.
Required Associated Types§
Required Methods§
sourcefn start_receive(&mut self) -> Result<(), Self::Error>
fn start_receive(&mut self) -> Result<(), Self::Error>
Set receiving on the specified channel
Returns an error if receive mode was not entered
sourcefn check_receive(&mut self, restart: bool) -> Result<bool, Self::Error>
fn check_receive(&mut self, restart: bool) -> Result<bool, Self::Error>
Check for reception
The restart flag indicates on (recoverable) error conditions (such as invalid CRC) the radio should re-enter receive mode if required and continue reception.
This returns true for received, false for not received, or the provided error