Skip to main content

steps

Function steps 

Source
pub fn steps(
    chain: Chain,
    trigger: Trigger,
    start_delay: u16,
) -> impl Iterator<Item = Send>
Expand description

The order a packet is loaded and sent in.

A timed send carries one step the other two do not, since only it programs the counter value to go out at.

§Arguments

  • chain - which transmit chain is sending.
  • trigger - what the send waits for.
  • start_delay - what start_delay worked out for this packet.

§Returns

The steps, in the order the chip takes them.

§Examples

use pamoja_radios::sx1302::tx::{steps, Chain, Send, Trigger};

// A send that goes out now: delay, buffer, trigger.
assert_eq!(steps(Chain::A, Trigger::Immediate, 1_000).count(), 6);

// A timed one programs the counter as well.
assert_eq!(steps(Chain::A, Trigger::At(1_000_000), 1_000).count(), 7);

let mut order = steps(Chain::A, Trigger::Immediate, 1_000);
assert!(matches!(order.next(), Some(Send::SetStartDelay(1_000))));
assert!(matches!(order.next(), Some(Send::OpenBuffer(_))));
assert!(matches!(order.next(), Some(Send::WritePayload(0x5300))));