pub struct Radio<'d, T: Instance> { /* private fields */ }Expand description
IEEE 802.15.4 radio driver.
Implementations§
Source§impl<'d, T: Instance> Radio<'d, T>
impl<'d, T: Instance> Radio<'d, T>
Sourcepub fn new(
radio: Peri<'d, T>,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
) -> Self
pub fn new( radio: Peri<'d, T>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, ) -> Self
Create a new IEEE 802.15.4 radio driver.
Sourcepub fn set_channel(&mut self, channel: u8)
pub fn set_channel(&mut self, channel: u8)
Changes the radio channel
Sourcepub fn clear_all_interrupts(&mut self)
pub fn clear_all_interrupts(&mut self)
Clear interrupts
Sourcepub fn set_transmission_power(&mut self, power: i8)
pub fn set_transmission_power(&mut self, power: i8)
Changes the radio transmission power
Sourcepub async fn receive(&mut self, packet: &mut Packet) -> Result<(), Error>
pub async fn receive(&mut self, packet: &mut Packet) -> Result<(), Error>
Receives one radio packet and copies its contents into the given packet buffer
This methods returns the Ok variant if the CRC included the packet was successfully
validated by the hardware; otherwise it returns the Err variant. In either case, packet
will be updated with the received packet’s data
Sourcepub async fn try_send(&mut self, packet: &mut Packet) -> Result<(), Error>
pub async fn try_send(&mut self, packet: &mut Packet) -> Result<(), Error>
Tries to send the given packet
This method performs Clear Channel Assessment (CCA) first and sends the packet only if the
channel is observed to be clear (no transmission is currently ongoing), otherwise no
packet is transmitted and the Err variant is returned
NOTE this method will not modify the packet argument. The mutable reference is used to
ensure the packet buffer is allocated in RAM, which is required by the RADIO peripheral