pub struct LoRa<RK> { /* private fields */ }Expand description
Provides the physical layer API to support LoRa chips
Implementations§
source§impl<RK> LoRa<RK>where
RK: RadioKind + 'static,
impl<RK> LoRa<RK>where RK: RadioKind + 'static,
sourcepub async fn new(
radio_kind: RK,
enable_public_network: bool,
delay: &mut impl DelayUs
) -> Result<Self, RadioError>
pub async fn new( radio_kind: RK, enable_public_network: bool, delay: &mut impl DelayUs ) -> Result<Self, RadioError>
Build and return a new instance of the LoRa physical layer API to control an initialized LoRa radio
sourcepub fn get_board_type(&self) -> BoardType
pub fn get_board_type(&self) -> BoardType
Get the board type of the LoRa board
sourcepub fn create_modulation_params(
&mut self,
spreading_factor: SpreadingFactor,
bandwidth: Bandwidth,
coding_rate: CodingRate,
frequency_in_hz: u32
) -> Result<ModulationParams, RadioError>
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
sourcepub 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>
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
sourcepub 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>
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
sourcepub async fn init(
&mut self,
enable_public_network: bool,
delay: &mut impl DelayUs
) -> Result<(), RadioError>
pub async fn init( &mut self, enable_public_network: bool, delay: &mut impl DelayUs ) -> Result<(), RadioError>
Initialize a Semtech chip as the radio for LoRa physical layer communications
sourcepub async fn sleep(
&mut self,
delay: &mut impl DelayUs
) -> Result<(), RadioError>
pub async fn sleep( &mut self, delay: &mut impl DelayUs ) -> Result<(), RadioError>
Place the LoRa physical layer in low power mode, using warm start if the Semtech chip supports it
sourcepub async fn prepare_for_tx(
&mut self,
mdltn_params: &ModulationParams,
output_power: i32,
tx_boosted_if_possible: bool
) -> Result<(), RadioError>
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
sourcepub async fn tx(
&mut self,
mdltn_params: &ModulationParams,
tx_pkt_params: &mut PacketParams,
buffer: &[u8],
timeout_in_ms: u32
) -> Result<(), RadioError>
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
sourcepub async fn prepare_for_rx(
&mut self,
mdltn_params: &ModulationParams,
rx_pkt_params: &PacketParams,
duty_cycle_params: Option<&DutyCycleParams>,
rx_continuous: bool,
rx_boosted_if_supported: bool,
symbol_timeout: u16,
rx_timeout_in_ms: u32
) -> Result<(), RadioError>
pub async fn prepare_for_rx( &mut self, mdltn_params: &ModulationParams, rx_pkt_params: &PacketParams, duty_cycle_params: Option<&DutyCycleParams>, rx_continuous: bool, rx_boosted_if_supported: bool, symbol_timeout: u16, rx_timeout_in_ms: u32 ) -> Result<(), RadioError>
Prepare the Semtech chip for a receive operation (single shot, continuous, or duty cycled) and initiate the operation
sourcepub async fn rx(
&mut self,
rx_pkt_params: &PacketParams,
receiving_buffer: &mut [u8]
) -> Result<(u8, PacketStatus), RadioError>
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
sourcepub async fn prepare_for_cad(
&mut self,
mdltn_params: &ModulationParams,
rx_boosted_if_supported: bool
) -> Result<(), RadioError>
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
sourcepub async fn cad(&mut self) -> Result<bool, RadioError>
pub async fn cad(&mut self) -> Result<bool, RadioError>
Obtain the results of a channel activity detection operation