pub const fn drift(bandwidth_hz: u32, carrier_hz: u32) -> Option<(u16, u8)>Expand description
How fast a frequency error turns into a timing one, as a mantissa and a shift.
The receiver corrects timing from the frequency error it measures, and how much it should correct depends on where the carrier sits: the same error is a larger fraction of a lower carrier. The chip takes that as a mantissa of at least 2048 and the shift that got it there.
§Arguments
bandwidth_hz- the bandwidth the receiver runs at.carrier_hz- what the radio is tuned to.
§Returns
The mantissa and the shift, or None for a carrier of zero.
§Examples
use pamoja_radios::sx1302::channel::drift;
// At 125 kHz on 868.1 MHz the ratio starts at 150 and doubles four times to reach 2400.
assert_eq!(drift(125_000, 868_100_000), Some((2400, 4)));