Struct lora_phy::LoRa

source ·
pub struct LoRa<RK, DLY>where
    RK: RadioKind,
    DLY: DelayUs,{ /* private fields */ }
Expand description

Provides the physical layer API to support LoRa chips

Implementations§

source§

impl<RK, DLY> LoRa<RK, DLY>where RK: RadioKind, DLY: DelayUs,

source

pub async fn new( radio_kind: RK, enable_public_network: bool, delay: DLY ) -> Result<Self, RadioError>

Build and return a new instance of the LoRa physical layer API to control an initialized LoRa radio

source

pub fn get_board_type(&self) -> BoardType

Get the board type of the LoRa board

source

pub fn create_modulation_params( &mut self, spreading_factor: SpreadingFactor, bandwidth: Bandwidth, coding_rate: CodingRate, frequency_in_hz: u32 ) -> Result<ModulationParams, RadioError>

Create modulation parameters for a communication channel

source

pub fn create_tx_packet_params( &mut self, preamble_length: u16, implicit_header: bool, crc_on: bool, iq_inverted: bool, modulation_params: &ModulationParams ) -> Result<PacketParams, RadioError>

Create packet parameters for a send operation on a communication channel

source

pub fn create_rx_packet_params( &mut self, preamble_length: u16, implicit_header: bool, max_payload_length: u8, crc_on: bool, iq_inverted: bool, modulation_params: &ModulationParams ) -> Result<PacketParams, RadioError>

Create packet parameters for a receive operation on a communication channel

source

pub async fn init(&mut self) -> Result<(), RadioError>

Initialize a Semtech chip as the radio for LoRa physical layer communications

source

pub async fn sleep( &mut self, warm_start_if_possible: bool ) -> Result<(), RadioError>

Place the LoRa physical layer in low power mode, specifying cold or warm start (if the Semtech chip supports it)

source

pub async fn prepare_for_tx( &mut self, mdltn_params: &ModulationParams, output_power: i32, tx_boosted_if_possible: bool ) -> Result<(), RadioError>

Prepare the Semtech chip for a send operation

source

pub async fn tx( &mut self, mdltn_params: &ModulationParams, tx_pkt_params: &mut PacketParams, buffer: &[u8], timeout_in_ms: u32 ) -> Result<(), RadioError>

Execute a send operation

source

pub async fn prepare_for_rx( &mut self, mdltn_params: &ModulationParams, rx_pkt_params: &PacketParams, window_in_secs: Option<u8>, duty_cycle_params: Option<&DutyCycleParams>, rx_boosted_if_supported: bool ) -> Result<(), RadioError>

Prepare the Semtech chip for a receive operation (single shot, continuous, or duty cycled) and initiate the operation

source

pub async fn rx( &mut self, rx_pkt_params: &PacketParams, receiving_buffer: &mut [u8] ) -> Result<(u8, PacketStatus), RadioError>

Obtain the results of a read operation

source

pub async fn prepare_for_cad( &mut self, mdltn_params: &ModulationParams, rx_boosted_if_supported: bool ) -> Result<(), RadioError>

Prepare the Semtech chip for a channel activity detection operation and initiate the operation

source

pub async fn cad(&mut self) -> Result<bool, RadioError>

Obtain the results of a channel activity detection operation

Trait Implementations§

source§

impl<RK, DLY> AsyncRng for LoRa<RK, DLY>where RK: RngRadio, DLY: DelayUs,

source§

async fn get_random_number(&mut self) -> Result<u32, RadioError>

Generate a 32 bit random value. Read more

Auto Trait Implementations§

§

impl<RK, DLY> RefUnwindSafe for LoRa<RK, DLY>where DLY: RefUnwindSafe, RK: RefUnwindSafe,

§

impl<RK, DLY> Send for LoRa<RK, DLY>where DLY: Send, RK: Send,

§

impl<RK, DLY> Sync for LoRa<RK, DLY>where DLY: Sync, RK: Sync,

§

impl<RK, DLY> Unpin for LoRa<RK, DLY>where DLY: Unpin, RK: Unpin,

§

impl<RK, DLY> UnwindSafe for LoRa<RK, DLY>where DLY: UnwindSafe, RK: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.