pub fn start_gain_control(
front_end: FrontEnd,
listen_before_talk: bool,
) -> impl Iterator<Item = Step>Expand description
What a gain control is configured with and how it is told.
The exchange is strictly ordered: every group is written, announced, acknowledged and read back before the next begins, and the status the microcontroller reports rises by one at each acknowledgment. Skipping a read-back would let a setting that never took pass for one that did.
§Arguments
front_end- which front end the board carries, which decides both the gain table and the firmware version expected.listen_before_talk- whether the SX1261 beside the concentrator is checking channels before the gateway talks on them.
§Returns
The steps, in the order the microcontroller takes them.
§Examples
use pamoja_radios::sx1302::mcu::{start_gain_control, Step};
use pamoja_radios::sx1302::tx::FrontEnd;
let mut order = start_gain_control(FrontEnd::Sx1250, false);
// Nothing is written until the firmware says it is running and names its version.
assert_eq!(order.next(), Some(Step::Await(0x01)));
assert_eq!(order.next(), Some(Step::Version(10)));
// The exchange ends by telling the microcontroller there is nothing more to come.
assert_eq!(
start_gain_control(FrontEnd::Sx1250, false).last(),
Some(Step::Notify(0x0f))
);