Add lora-phy examples.

This commit is contained in:
ceekdee
2023-04-23 18:32:34 -05:00
parent a3f727e2e1
commit 73f25093c7
20 changed files with 1218 additions and 316 deletions

View File

@ -1,5 +1,5 @@
//! This example runs on the STM32 LoRa Discovery board, which has a builtin Semtech Sx1276 radio.
//! It demonstrates LORA P2P receive functionality.
//! It demonstrates LORA P2P receive functionality in conjunction with the lora_p2p_send example.
#![no_std]
#![no_main]
#![macro_use]
@ -18,6 +18,8 @@ use lora_phy::sx1276_7_8_9::SX1276_7_8_9;
use lora_phy::LoRa;
use {defmt_rtt as _, panic_probe as _};
const LORA_FREQUENCY_IN_HZ: u32 = 903_900_000; // warning: set this appropriately for the region
#[embassy_executor::main]
async fn main(_spawner: Spawner) {
let mut config = embassy_stm32::Config::default();
@ -67,7 +69,12 @@ async fn main(_spawner: Spawner) {
let mut receiving_buffer = [00u8; 100];
let mdltn_params = {
match lora.create_modulation_params(SpreadingFactor::_10, Bandwidth::_250KHz, CodingRate::_4_8, 903900000) {
match lora.create_modulation_params(
SpreadingFactor::_10,
Bandwidth::_250KHz,
CodingRate::_4_8,
LORA_FREQUENCY_IN_HZ,
) {
Ok(mp) => mp,
Err(err) => {
info!("Radio error = {}", err);