Crate rn2903

Source
Expand description

§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.

See the Rn2903 struct for the bulk of the crate’s functionality.

§Examples

Receiving and printing valid LoRa payloads.

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);
    }
}

Structs§

NvmAddress
An address in user-accessible nonvolatile memory. Guaranteed to be between 0x300 and 0x3FF.
Rn2903
A handle to a serial link connected to a RN2903 module.

Enums§

Error
The primary error type used for fallible operations on the RN2903.
ModulationMode
Types of modulation available for transmitting and receiving packets.

Functions§

bytes_to_string
Turn the raw bytes into a String for display.
serial_config
Returns the SerialPortSettings corresponding to the default settings of an RNB2903.

Type Aliases§

Result
Universal Result wrapper for the RN2903 interface.