Struct cc1101_rust::config::TXConfig
source · [−]#[repr(C)]pub struct TXConfig { /* private fields */ }
Expand description
Configuration values specific to transmit
Implementations
sourceimpl TXConfig
impl TXConfig
sourcepub fn new(
frequency: f32,
modulation: Modulation,
baud_rate: f32,
tx_power: f32,
deviation: Option<f32>,
sync_word: Option<u32>
) -> Result<TXConfig, CC1101Error>
pub fn new(
frequency: f32,
modulation: Modulation,
baud_rate: f32,
tx_power: f32,
deviation: Option<f32>,
sync_word: Option<u32>
) -> Result<TXConfig, CC1101Error>
Create a new transmit configuration
See CommonConfig
for valid argument values.
TX power is specified in dBm. Valid values can be found in TI DN013
Frequency must be close to 315/433/868/915Mhz
Example
let config = TXConfig::new(433.92, Modulation::OOK, 1.0, 0.1, None, None)?;
sourcepub fn get_common_config(&self) -> &CommonConfig
pub fn get_common_config(&self) -> &CommonConfig
Get the common configuration elements
sourcepub fn get_common_config_mut(&mut self) -> &mut CommonConfig
pub fn get_common_config_mut(&mut self) -> &mut CommonConfig
Get a mutable reference to the common configuration elements
sourcepub fn new_raw(
frequency: f32,
modulation: Modulation,
baud_rate: f32,
tx_power: u8,
deviation: Option<f32>,
sync_word: Option<u32>
) -> Result<TXConfig, CC1101Error>
pub fn new_raw(
frequency: f32,
modulation: Modulation,
baud_rate: f32,
tx_power: u8,
deviation: Option<f32>,
sync_word: Option<u32>
) -> Result<TXConfig, CC1101Error>
Create a new transmit configuration using a TX power specified as a raw CC1101 PATABLE byte.
Frequency can be any valid value.
See CommonConfig
for valid argument values.
Example
let mut config = TXConfig::new_raw(433.92, Modulation::OOK, 1.0, 0x60, None, None)?;
sourcepub fn set_tx_power(&mut self, tx_power: f32) -> Result<(), CC1101Error>
pub fn set_tx_power(&mut self, tx_power: f32) -> Result<(), CC1101Error>
Set the TX power to a value in dBm.
Configured frequency must be within 1Mhz of 315/433/868/915Mhz
sourcepub fn get_tx_power(&self) -> Result<f32, CC1101Error>
pub fn get_tx_power(&self) -> Result<f32, CC1101Error>
Get the TX power in dBm.
Configured frequency must be within 1MHz of 315/433/868/915Mhz
sourcepub fn set_tx_power_raw(&mut self, tx_power: u8)
pub fn set_tx_power_raw(&mut self, tx_power: u8)
Set the TX power to a raw value which will be set in the devices PATABLE
sourcepub fn get_tx_power_raw(&self) -> u8
pub fn get_tx_power_raw(&self) -> u8
Get the TX power as raw value from the devices PATABLE