pub enum FrameRate {
Half,
One,
Two,
Four,
Eight,
Sixteen,
ThirtyTwo,
SixtyFour,
}Expand description
The frame rates the cameras are able to run at.
Before using the higher refresh rates, ensure your I²C bus is fast enough. Because the image is
smaller (and it has a more efficient access pattern) the MLX90641 can use the faster frame
rates with slower I²C bus speeds. With the read patterns used by the included MelexisCamera
implementations, here are the maximum frame rates for common different bus speeds.
| Bus Speed | MLX90640 (Chess) | MLX 90640 (Interleaved) | MLX90641 |
|---|---|---|---|
| 100kHz | 4Hz | 8Hz | 16Hz |
| 400kHz | 16Hz | 32Hz | 64Hz |
| 1MHz | 64Hz (barely, 32Hz is more realistic) | 32Hz | 64Hz |
On top of the bus speed, your hardware also has to be able to process each frame before the next frame is ready. As a final warning, the EEPROM cannot be accessed above 400kHz so if you’re using a 1MHz bus speed you will need to read the calibration data at 400kHz then increase the bus speed afterwards.
§Usage
Besides accessing the enum variants directly, standard conversion traits are provided for both
f32, u8, and core::time::Duration.
use core::convert::TryInto;
use core::time::Duration;
assert_eq!(Duration::from_secs(2), FrameRate::Half.into());
assert_eq!(8.try_into(), Ok(FrameRate::Eight));
assert_eq!(0.5f32.try_into(), Ok(FrameRate::Half));
assert_eq!(0.5f32, FrameRate::Half.into());Variants§
Half
0.5 Hz, one frame every two seconds.
One
1Hz.
Two
2Hz, which is also the default for the MLX90640 and MLX90641.
Four
4Hz.
Eight
8Hz.
Sixteen
16 Hz.
ThirtyTwo
32Hz.
SixtyFour
64Hz.
Trait Implementations§
Source§impl Ord for FrameRate
impl Ord for FrameRate
Source§impl PartialOrd for FrameRate
impl PartialOrd for FrameRate
Source§impl TryFrom<f32> for FrameRate
impl TryFrom<f32> for FrameRate
Source§fn try_from(value: f32) -> Result<Self, Self::Error>
fn try_from(value: f32) -> Result<Self, Self::Error>
Attempt to create a FrameRate from a number.
This will only work if the source number exactly matches one of the values named as a variant.
assert_eq!(FrameRate::try_from(0.5), Ok(FrameRate::Half));
let almost_half = 0.50001;
assert!(FrameRate::try_from(almost_half).is_err());