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§
sourcefn initialize(&self) -> Result<(), ErrorCode>
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.
sourcefn reset(&self) -> Result<(), ErrorCode>
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.
sourcefn start(&self) -> Result<(), ErrorCode>
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.
sourcefn stop(&self) -> Result<(), ErrorCode>
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.
sourcefn busy(&self) -> bool
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.
sourcefn set_power_client(&self, client: &'a dyn PowerClient)
fn set_power_client(&self, client: &'a dyn PowerClient)
Set the client that is called when the radio changes power states.
sourcefn config_commit(&self)
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.
sourcefn set_config_client(&self, client: &'a dyn ConfigClient)
fn set_config_client(&self, client: &'a dyn ConfigClient)
Set the client that is called when configuration finishes.
sourcefn get_address(&self) -> u16
fn get_address(&self) -> u16
sourcefn get_address_long(&self) -> [u8; 8]
fn get_address_long(&self) -> [u8; 8]
sourcefn get_tx_power(&self) -> i8
fn get_tx_power(&self) -> i8
sourcefn get_channel(&self) -> u8
fn get_channel(&self) -> u8
sourcefn set_address(&self, addr: u16)
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.
sourcefn set_address_long(&self, addr: [u8; 8])
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.
sourcefn set_pan(&self, id: u16)
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.
sourcefn set_tx_power(&self, power: i8) -> Result<(), ErrorCode>
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.
sourcefn set_channel(&self, chan: RadioChannel)
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.