A network driver for a RAK811 attached via a UART.
Currently requires the RAK811 to be flashed with a 2.x version of the AT firmware.
At first, the UART must be configured and handed to the driver. The uart must implement the embedded_hal::serial
traits.
```rust let (uartetx, uarterx) = uarte .split(ctx.resources.txbuf, ctx.resources.rxbuf) .unwrap();
let driver = rak811::Rak811Driver::new( uartetx, uarterx, port1.p102.intopushpulloutput(Level::High).degrade(), ) .unwrap(); ```
In order to connect to the gateway, the LoRa node needs to be configured with the following:
The driver can be used to configure the properties in this way:
rust
driver.set_band(rak811::LoraRegion::EU868).unwrap();
driver.set_mode(rak811::LoraMode::WAN).unwrap();
In addition, the following settings from the TTN console must be set:
```rust driver.setdeviceeui(&[0x00, 0xBB, 0x7C, 0x95, 0xAD, 0xB5, 0x30, 0xB9]).unwrap(); driver.setappeui(&[0x70, 0xB3, 0xD5, 0x7E, 0xD0, 0x03, 0xB1, 0x84])
// Secret generated by network provider driver .setappkey(&[0x00]).unwrap(); ```
To join the network and send packets:
```rust driver.join(rak811::ConnectMode::OTAA).unwrap();
// Port number can be between 1 and 255 driver.send(rak811::QoS::Confirmed, 1, b"hello!").unwrap(); ```