Function highest_freq_in
pub const fn highest_freq_in(
range: RangeInclusive<Rate<u32, 1000, 1>>,
) -> Frequency
Available on crate feature
i2c
only.Expand description
Returns the highest I2C frequency available on the MCU that fits into the requested range.
§Examples
Assuming the MCU is only able to do 100 kHz and 400 kHz (not 250 kHz):
let freq = const { highest_freq_in(Kilohertz::kHz(100)..=Kilohertz::kHz(250)) };
assert_eq!(freq, hal::i2c::controller::Frequency::_100k);
§Panics
This function is only intended to be used in a const
context.
It panics if no suitable frequency can be found.