Skip to main content

steps

Function steps 

Source
pub fn steps(plan: &Plan) -> impl Iterator<Item = Step> + '_
Expand description

The order a concentrator is pointed at its channels in.

The receivers are given their frequencies and radios, then the correlators are tuned and told which spreading factors to look for, then the demodulators are set up, and only at the end is anything switched on. Enabling earlier would start receivers that have not been told where to listen.

§Arguments

  • plan - what to listen for.

§Returns

The steps, in the order the chip takes them.

§Examples

use pamoja_radios::sx1302::channel::{steps, Plan, Step};
use pamoja_radios::sx1302::register;

let plan = Plan::new(867_500_000, &[-400_000, -200_000, 0]);
let order: Vec<Step> = steps(&plan).collect();

// Nothing is switched on until the end.
let enable = order
    .iter()
    .position(|step| matches!(step, Step::Write(register, _) if *register == register::COMMON_GLOBAL_ENABLE))
    .expect("the receivers are switched on");
assert_eq!(enable, order.len() - 1);