Struct TXConfig

Source
#[repr(C)]
pub struct TXConfig { /* private fields */ }
Expand description

Configuration values specific to transmit

Implementations§

Source§

impl TXConfig

Source

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)?;
Source

pub fn get_common_config(&self) -> &CommonConfig

Get the common configuration elements

Source

pub fn get_common_config_mut(&mut self) -> &mut CommonConfig

Get a mutable reference to the common configuration elements

Source

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)?;
Source

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

Source

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

Source

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

Source

pub fn get_tx_power_raw(&self) -> u8

Get the TX power as raw value from the devices PATABLE

Trait Implementations§

Source§

impl Debug for TXConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TXConfig

Source§

fn default() -> TXConfig

Returns the “default value” for a type. Read more
Source§

impl Display for TXConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.