Skip to main content

receive

Function receive 

Source
pub const fn receive(hertz: u32, bandwidth: Bandwidth) -> [Frame; 8]
Expand description

The commands that point the receiver at a channel and start it listening.

§Arguments

  • hertz - the carrier to listen on.
  • bandwidth - how wide to listen.

§Returns

Releasing whatever the radio was doing, putting it on frequency, tuning it, setting the averaging window, and then the modulation, the packet shape, and continuous receive. The radio is left listening, which is what a carrier check then reads a level from.

§Examples

use pamoja_radios::sx1302::sx1261::{receive, Bandwidth, OP_SET_RX};

let frames = receive(868_100_000, Bandwidth::Khz125);
assert_eq!(frames[0].payload(), &[0x08, 0x9b, 0x00], "release it first");
assert_eq!(frames[2].payload(), &[0x36, 0x41, 0x99, 0x99], "tuned to 868.1 MHz");
assert_eq!(frames[7].opcode(), OP_SET_RX);
assert_eq!(frames[7].payload(), &[0xff, 0xff, 0xff], "and it listens until told not to");