A Rusty interface for the RN2903 LoRa module's serial protocol
Go to file
Leonora Tindall d42b0ec6b3
Add MAC pause/unpause
Also adds associated error variants `CannotPause` and `BadResponse`, an
associated helper function `Error::bad_response`, and the internal
helper function `transact_expecting` which shortens function bodies for
functions implementing simple handshake-like commands, like `mac
resume`.
2019-12-31 14:48:51 -08:00
docu Add documentation PDFs 2019-12-29 12:12:03 -08:00
src Add MAC pause/unpause 2019-12-31 14:48:51 -08:00
.gitignore Basic SerialPort wrapper 2019-12-28 08:29:09 -08:00
CHANGELOG.md Add MAC pause/unpause 2019-12-31 14:48:51 -08:00
CONTRIBUTING.md Formalize release process 2019-12-29 12:47:18 -08:00
Cargo.lock Basic SerialPort wrapper 2019-12-28 08:29:09 -08:00
Cargo.toml Add repository info. 2019-12-29 12:13:59 -08:00
LICENSE.html Add GNU GPL v3 license, and package metadata 2019-12-29 11:56:33 -08:00
README.md Add documentation PDFs 2019-12-29 12:12:03 -08:00

README.md

RN2903

A Rusty interface for the RN2903 LoRa module's 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.

This crate is available under the GNU General Public License, version 3.0 only, and does not directly depend on unstable crates.

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"sys set pindig GPIO10 0").unwrap();
        thread::sleep(Duration::from_millis(1000));
        txvr.transact(b"sys set pindig GPIO10 1").unwrap();
        thread::sleep(Duration::from_millis(1000));
    }
}

Module Documentation

This repository reproduces the relevant documents for the RN2903 module at command_reference-40001811B.pdf and datasheet-DS5000239H.pdf.