A Rusty interface for the RN2903 LoRa module's serial protocol
Go to file
Leonora Tindall 41c5a352b8
Add meta files
README, CHANGELOG, and CONTRIBUTING
2019-12-29 11:47:36 -08:00
src Abstract reading/writing into ::transact_command() 2019-12-28 10:48:12 -08:00
.gitignore Basic SerialPort wrapper 2019-12-28 08:29:09 -08:00
CHANGELOG.md Add meta files 2019-12-29 11:47:36 -08:00
CONTRIBUTING.md Add meta files 2019-12-29 11:47:36 -08:00
Cargo.lock Basic SerialPort wrapper 2019-12-28 08:29:09 -08:00
Cargo.toml Basic SerialPort wrapper 2019-12-28 08:29:09 -08:00
README.md Add meta files 2019-12-29 11:47:36 -08:00

README.md

RN2903

A Rusty interface for the RN2903 serial protocol

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.

Example

For instance, here is a simple program which blinks the LoStik's LED using the RN2903's GPIO functionality.

use rn2903::Rn2903;
use std::time::Duration;
use std::thread;

fn main() {
    let mut txvr = Rn2903::new_at("/dev/ttyUSB0")
        .expect("Could not open device. Error");
    loop {
        txvr.transact(b"radio set pindig GPIO10 0").unwrap();
        thread::sleep(Duration::from_millis(1000));
        txvr.transact(b"radio set pindig GPIO10 1").unwrap();
        thread::sleep(Duration::from_millis(1000));
    }
}