mirror of
https://github.com/ferrous-systems/embedded-trainings-2020.git
synced 2025-01-26 07:48:06 +00:00
add set_channel and reminder to radio-recv.rs
This commit is contained in:
parent
c6aba97a3a
commit
c88ede8e48
2 changed files with 4 additions and 2 deletions
|
@ -5,7 +5,7 @@
|
||||||
use core::str;
|
use core::str;
|
||||||
|
|
||||||
use cortex_m_rt::entry;
|
use cortex_m_rt::entry;
|
||||||
use dk::ieee802154::{Error, Packet};
|
use dk::ieee802154::{Channel, Error, Packet};
|
||||||
use panic_log as _; // the panicking behavior
|
use panic_log as _; // the panicking behavior
|
||||||
|
|
||||||
const TEN_MS: u32 = 10_000;
|
const TEN_MS: u32 = 10_000;
|
||||||
|
@ -17,6 +17,8 @@ fn main() -> ! {
|
||||||
let mut radio = board.radio;
|
let mut radio = board.radio;
|
||||||
let mut timer = board.timer;
|
let mut timer = board.timer;
|
||||||
|
|
||||||
|
radio.set_channel(Channel::_20);
|
||||||
|
|
||||||
let mut packet = Packet::new();
|
let mut packet = Packet::new();
|
||||||
let msg = b"olleh";
|
let msg = b"olleh";
|
||||||
packet.copy_from_slice(msg);
|
packet.copy_from_slice(msg);
|
||||||
|
|
|
@ -4,7 +4,7 @@ In this section we'll explore the `recv_timeout` method of the Radio API. As the
|
||||||
|
|
||||||
The `loopback` application running on the Dongle will broadcast a radio packet after receiving one over channel 20. The contents of this outgoing packet will be the contents of the received one but reversed.
|
The `loopback` application running on the Dongle will broadcast a radio packet after receiving one over channel 20. The contents of this outgoing packet will be the contents of the received one but reversed.
|
||||||
|
|
||||||
✅ Open the `src/bin/radio-recv.rs` file and click the "Run" button.
|
✅ Open the `src/bin/radio-recv.rs` file. Make sure that the Dongle and the Radio are set to the same channel. Click the "Run" button.
|
||||||
|
|
||||||
The Dongle expects the packet to contain only ASCII characters and will not respond to packets that contain non-ASCII data. If you only send packets that contain byte string literals *with no escaped characters* (e.g. `b"hello"`) then this requirement will be satisfied. At the same time the Dongle will always respond with ASCII data so calling `str::from_utf8` on the response should never fail, unless the packet contents got corrupted in the transmission but the CRC should detect this scenario.
|
The Dongle expects the packet to contain only ASCII characters and will not respond to packets that contain non-ASCII data. If you only send packets that contain byte string literals *with no escaped characters* (e.g. `b"hello"`) then this requirement will be satisfied. At the same time the Dongle will always respond with ASCII data so calling `str::from_utf8` on the response should never fail, unless the packet contents got corrupted in the transmission but the CRC should detect this scenario.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue