Struct cc1101_rust::config::RXConfig
source · [−]#[repr(C)]pub struct RXConfig { /* private fields */ }
Expand description
Configuration values specific to receive
Implementations
sourceimpl RXConfig
impl RXConfig
sourcepub fn new(
frequency: f32,
modulation: Modulation,
baud_rate: f32,
packet_length: u32,
deviation: Option<f32>,
sync_word: Option<u32>,
bandwidth: Option<u32>,
carrier_sense: Option<CarrierSense>,
max_lna_gain: Option<u8>,
max_dvga_gain: Option<u8>,
magn_target: Option<u8>
) -> Result<RXConfig, CC1101Error>
pub fn new(
frequency: f32,
modulation: Modulation,
baud_rate: f32,
packet_length: u32,
deviation: Option<f32>,
sync_word: Option<u32>,
bandwidth: Option<u32>,
carrier_sense: Option<CarrierSense>,
max_lna_gain: Option<u8>,
max_dvga_gain: Option<u8>,
magn_target: Option<u8>
) -> Result<RXConfig, CC1101Error>
Create a new receive configuration
See CommonConfig
for valid argument values.
Example
let config = RXConfig::new(433.92, Modulation::OOK, 1.0, 1024, None, None, None, None, None, 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 set_bandwidth(&mut self, bandwidth: u32) -> Result<(), CC1101Error>
pub fn set_bandwidth(&mut self, bandwidth: u32) -> Result<(), CC1101Error>
Set the configured bandwith in KHz
Valid values are 58,67,81,101,116,135,162,203,232,270,325,406,464,541,650,812
sourcepub fn get_bandwith(&self) -> u32
pub fn get_bandwith(&self) -> u32
Get the configured bandwidth
sourcepub fn set_carrier_sense(
&mut self,
carrier_sense: Option<CarrierSense>
) -> Result<(), CC1101Error>
pub fn set_carrier_sense(
&mut self,
carrier_sense: Option<CarrierSense>
) -> Result<(), CC1101Error>
Sets the carrier sense threshold in dB.
For CarrierSense::Relative
an increase of 6, 10 or 14 dB can be specified. This will begin RX on a sudden increase in RSSI greather than or equal to this value.
For CarrierSense::Absolute
a value between -7 dB and 7 dB can be set. When RSSI exceeds magn_target
+/- this value, packet RX will begin.
max_lna_gain
and max_dvga_gain
will also require configuring to set the correct absolute RSSI value.
None
disables carrier sense.
sourcepub fn get_carrier_sense(&self) -> Option<CarrierSense>
pub fn get_carrier_sense(&self) -> Option<CarrierSense>
Get the configured carrier sense
sourcepub fn set_max_lna_gain(&mut self, max_lna_gain: u8) -> Result<(), CC1101Error>
pub fn set_max_lna_gain(&mut self, max_lna_gain: u8) -> Result<(), CC1101Error>
Sets the amount to decrease the maximum LNA gain by approximately the specified amount in dB.
Valid values are 0, 3, 6, 7, 9, 12, 15, 17
sourcepub fn get_max_lna_gain(&self) -> u8
pub fn get_max_lna_gain(&self) -> u8
Get the configured maximum LNA gain
sourcepub fn set_max_dvga_gain(&mut self, max_dvga_gain: u8) -> Result<(), CC1101Error>
pub fn set_max_dvga_gain(&mut self, max_dvga_gain: u8) -> Result<(), CC1101Error>
Sets the amount to decrease the maximum DVGA gain by approximately the specified amount in dB.
Valid values are 0, 6, 12, 18
sourcepub fn get_max_dvga_gain(&self) -> u8
pub fn get_max_dvga_gain(&self) -> u8
Get the configured maximum DVGA gain
sourcepub fn set_magn_target(&mut self, magn_target: u8) -> Result<(), CC1101Error>
pub fn set_magn_target(&mut self, magn_target: u8) -> Result<(), CC1101Error>
Sets the target channel filter amplitude in dB
Valid values are 24, 27, 30, 33, 36, 38, 40, 42
sourcepub fn get_magn_target(&self) -> u8
pub fn get_magn_target(&self) -> u8
Get the configured maximum DVGA gain
sourcepub fn set_packet_length(&mut self, packet_length: u32)
pub fn set_packet_length(&mut self, packet_length: u32)
Set the length of packets to receive in bytes
sourcepub fn get_packet_length(&self) -> u32
pub fn get_packet_length(&self) -> u32
Get the configured packet length