Crates.io | rn2903 |
lib.rs | rn2903 |
version | 0.2.0 |
source | src |
created_at | 2019-12-29 20:14:52.589597 |
updated_at | 2020-01-01 19:35:30.700577 |
description | A Rusty interface for the RN2903 LoRa module's serial protocol |
homepage | https://nora.codes/projects/rn2903 |
repository | https://git.nora.codes/nora/rn2903 |
max_upload_size | |
id | 193307 |
size | 1,908,607 |
The RN2903 is a LoRa and FSK transciever for the 915MHz ISM band, commonly used in USB devices like the LoStik.
This crate provides a safe, idiomatic interface using cross-platform native serial
functionality via serialport
. This supports, for instance, a LoStik connected to a USB
TTY or virtual COM port, or a RN2903 connected via a TTL serial interface.
This crate is available under the GNU General Public License, version 3.0 only, and does not directly depend on unstable crates.
For instance, here is a simple program which dumps all LoRa packets received.
use rn2903::{Rn2903, ModulationMode};
fn main() {
let mut txvr = Rn2903::new_at("/dev/ttyUSB0")
.expect("Could not open device. Error");
txvr.mac_pause().unwrap();
txvr.radio_set_modulation_mode(ModulationMode::LoRa).unwrap();
loop {
if let Some(packet) = txvr.radio_rx(65535).unwrap() {
println!("{:?}", packet);
}
}
}
This repository reproduces the relevant documents for the RN2903 module at command_reference-40001811B.pdf and datasheet-DS5000239H.pdf.