Struct CommonConfig

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

Configuration values shared between transmit and receive

Implementations§

Source§

impl CommonConfig

Source

pub fn new( frequency: f32, modulation: Modulation, baud_rate: f32, deviation: Option<f32>, sync_word: Option<u32>, ) -> Result<CommonConfig, CC1101Error>

Create a new CommonConfig

§Example
let config = CommonConfig::new(433.92, Modulation::OOK, 1.0, None, None)?;
Source

pub fn set_frequency(&mut self, frequency: f32) -> Result<(), CC1101Error>

The frequency to receive/transmit on.

Valid values are 300-348, 387-464 and 779-928 MHz.

Source

pub fn get_frequency(&self) -> f32

Get the current receive/transmit frequency

Source

pub fn set_modulation_and_baud_rate( &mut self, modulation: Modulation, baud_rate: f32, ) -> Result<(), CC1101Error>

Set the modulation scheme and the baud rate in kBaud

§Valid Modulation / Baud Rate Values
ModulationBaud Rate
Modulation::OOK0.6 - 250
Modulation::GFSK0.6 - 250
Modulation::FSK20.6 - 500
Modulation::FSK40.6 - 300
Modulation::MSK26 - 500
Source

pub fn get_modulation(&self) -> Modulation

Get the current modulation

Source

pub fn get_baud_rate(&self) -> f32

Get the current baud rate in kBaud

Source

pub fn set_deviation(&mut self, deviation: f32) -> Result<(), CC1101Error>

Set the frequency deviation in kHz

Source

pub fn get_deviation(&self) -> f32

Get the frequency deviation in kHz

Source

pub fn set_sync_word(&mut self, sync_word: u32) -> Result<(), CC1101Error>

Set the sync word

Any sync word between 0x0000 and 0xFFFF is allowed. Above 0xFFFF, the high and low 16-bits must be the same (e.g 0x0f0f0f0f).

In RX, the device searches for the specified sync word to begin reception.

In TX, the sync word is prepended to each packet.

Source

pub fn get_sync_word(&self) -> u32

Get the configured sync word

Trait Implementations§

Source§

impl Clone for CommonConfig

Source§

fn clone(&self) -> CommonConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CommonConfig

Source§

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

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

impl Default for CommonConfig

Source§

fn default() -> CommonConfig

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

impl Display for CommonConfig

Source§

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

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

impl PartialEq for CommonConfig

Source§

fn eq(&self, other: &CommonConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for CommonConfig

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.