pub const fn frequency_word(frequency_hz: u32) -> u32Expand description
Returns the 24-bit RegFrf word for a frequency.
The datasheet defines the carrier as the word times the crystal frequency over 2^19, a step of 61.035 Hz. The word is rounded to the nearest step.
§Arguments
frequency_hz- the carrier frequency in hertz.
§Returns
The frequency word.
§Examples
use pamoja_radios::sx127x::config::frequency_word;
// 434 MHz is the RegFrf reset value the datasheet gives.
assert_eq!(frequency_word(434_000_000), 0x6C_8000);
assert_eq!(frequency_word(868_100_000), 0xD9_0666);
assert_eq!(frequency_word(915_000_000), 0xE4_C000);