Trait kernel::hil::radio::RadioConfig

source ·
pub trait RadioConfig<'a> {
Show 19 methods // Required methods fn initialize(&self) -> Result<(), ErrorCode>; fn reset(&self) -> Result<(), ErrorCode>; fn start(&self) -> Result<(), ErrorCode>; fn stop(&self) -> Result<(), ErrorCode>; fn is_on(&self) -> bool; fn busy(&self) -> bool; fn set_power_client(&self, client: &'a dyn PowerClient); fn config_commit(&self); fn set_config_client(&self, client: &'a dyn ConfigClient); fn get_address(&self) -> u16; fn get_address_long(&self) -> [u8; 8]; fn get_pan(&self) -> u16; fn get_tx_power(&self) -> i8; fn get_channel(&self) -> u8; fn set_address(&self, addr: u16); fn set_address_long(&self, addr: [u8; 8]); fn set_pan(&self, id: u16); fn set_tx_power(&self, power: i8) -> Result<(), ErrorCode>; fn set_channel(&self, chan: RadioChannel);
}
Expand description

Configure the 802.15.4 radio.

Required Methods§

source

fn initialize(&self) -> Result<(), ErrorCode>

Initialize the radio.

This should perform any needed initialization, but should not turn the radio on.

§Return

Ok(()) on success. On Err(), valid errors are:

  • ErrorCode::FAIL: Internal error occurred.
source

fn reset(&self) -> Result<(), ErrorCode>

Reset the radio.

Perform a radio reset which may reset the internal state of the radio.

§Return

Ok(()) on success. On Err(), valid errors are:

  • ErrorCode::FAIL: Internal error occurred.
source

fn start(&self) -> Result<(), ErrorCode>

Start the radio.

This should put the radio into receive mode.

§Return

Ok(()) on success. On Err(), valid errors are:

  • ErrorCode::FAIL: Internal error occurred.
source

fn stop(&self) -> Result<(), ErrorCode>

Stop the radio.

This should turn the radio off, disabling receive mode, and put the radio into a low power state.

§Return

Ok(()) on success. On Err(), valid errors are:

  • ErrorCode::FAIL: Internal error occurred.
source

fn is_on(&self) -> bool

Check if the radio is currently on.

§Return

True if the radio is on, false otherwise.

source

fn busy(&self) -> bool

Check if the radio is currently busy transmitting or receiving a packet.

If this returns true, the radio is unable to start another operation.

§Return

True if the radio is busy, false otherwise.

source

fn set_power_client(&self, client: &'a dyn PowerClient)

Set the client that is called when the radio changes power states.

source

fn config_commit(&self)

Commit the configuration calls to the radio.

This will set the address, PAN ID, TX power, and channel to the specified values within the radio hardware. When this finishes, this will issue a callback to the config client when done.

source

fn set_config_client(&self, client: &'a dyn ConfigClient)

Set the client that is called when configuration finishes.

source

fn get_address(&self) -> u16

Get the 802.15.4 short (16-bit) address for the radio.

§Return

The radio’s short address.

source

fn get_address_long(&self) -> [u8; 8]

Get the 802.15.4 extended (64-bit) address for the radio.

§Return

The radio’s extended address.

source

fn get_pan(&self) -> u16

Get the 802.15.4 16-bit PAN ID for the radio.

§Return

The radio’s PAN ID.

source

fn get_tx_power(&self) -> i8

Get the radio’s transmit power.

§Return

The transmit power setting used by the radio, in dBm.

source

fn get_channel(&self) -> u8

Get the 802.15.4 channel the radio is currently using.

§Return

The channel number.

source

fn set_address(&self, addr: u16)

Set the 802.15.4 short (16-bit) address for the radio.

Note, calling this function configures the software driver, but does not take effect in the radio hardware. Call RadioConfig::config_commit() to set the configuration settings in the radio hardware.

§Argument
  • addr: The short address.
source

fn set_address_long(&self, addr: [u8; 8])

Set the 802.15.4 extended (64-bit) address for the radio.

Note, calling this function configures the software driver, but does not take effect in the radio hardware. Call RadioConfig::config_commit() to set the configuration settings in the radio hardware.

§Argument
  • addr: The extended address.
source

fn set_pan(&self, id: u16)

Set the 802.15.4 PAN ID (16-bit) for the radio.

Note, calling this function configures the software driver, but does not take effect in the radio hardware. Call RadioConfig::config_commit() to set the configuration settings in the radio hardware.

§Argument
  • id: The PAN ID.
source

fn set_tx_power(&self, power: i8) -> Result<(), ErrorCode>

Set the radio’s transmit power.

Note, calling this function configures the software driver, but does not take effect in the radio hardware. Call RadioConfig::config_commit() to set the configuration settings in the radio hardware.

§Argument
  • power: The transmit power in dBm.
§Return

Ok(()) on success. On Err(), valid errors are:

  • ErrorCode::INVAL: The transmit power is above acceptable limits.
  • ErrorCode::NOSUPPORT: The transmit power is not supported by the radio.
  • ErrorCode::FAIL: Internal error occurred.
source

fn set_channel(&self, chan: RadioChannel)

Set the 802.15.4 channel for the radio.

Note, calling this function configures the software driver, but does not take effect in the radio hardware. Call RadioConfig::config_commit() to set the configuration settings in the radio hardware.

§Argument
  • chan: The 802.15.4 channel.

Implementors§