lora-modulation

Crates.iolora-modulation
lib.rslora-modulation
version0.1.4
sourcesrc
created_at2023-09-08 15:14:19.827044
updated_at2024-01-20 16:07:14.047802
descriptionA definition of LoRa modulation characteristics with minimal external dependencies.
homepage
repositoryhttps://github.com/lora-rs/lora-rs
max_upload_size
id967227
size12,008
Ulf Lilleengen (lulf)

documentation

README

lora-modulation

Latest Version Docs

A minimal crate for providing LoRa modulation characteristics of:

  • Bandwidth
  • Spreading factor
  • Coding rate

Provides utility for calculating time on air.

Usage

use lora_modulation::{BaseBandModulationParams, SpreadingFactor, Bandwidth, CodingRate};

let length = 12;
let params = BaseBandModulationParams::new(SpreadingFactor::_9, Bandwidth::_125KHz, CodingRate::_4_5);
let time_on_air = params.time_on_air_us(
    Some(8), // preamble
    true,    // explicit header
    length); // length of payload

// Time on air is 144.384 ms
assert_eq!(time_on_air, 144384);
use lora_modulation::{BaseBandModulationParams, SpreadingFactor, Bandwidth, CodingRate};

let symbols = 14;
let params = BaseBandModulationParams::new(SpreadingFactor::_12, Bandwidth::_125KHz, CodingRate::_4_5);
let timeout = params.symbols_to_ms(symbols);

// Timeout is 458 ms
assert_eq!(timeout, 458);
Commit count: 575

cargo fmt