Struct mlx9064x::CameraDriver [−][src]
pub struct CameraDriver<Cam, Clb, I2C, const HEIGHT: usize, const WIDTH: usize, const NUM_BYTES: usize> { /* fields omitted */ }
Expand description
The shared camera driver for the MLX90640 and MLX90641 thermopiles.
These cameras offer higher resolutions and faster refresh rates than other common low-cost thermal cameras, but they come with some differences in operation, as well as much more processing required to end up with a grid of temperatures.
The biggest impact to users of these modules is that one of the generate_image_*
functions
will need to be called twice (once for each subpage) before a full image is available.
Implementations
impl<'a, Cam, Clb, I2C, const HEIGHT: usize, const WIDTH: usize, const BUFFER_SIZE: usize> CameraDriver<Cam, Clb, I2C, HEIGHT, WIDTH, BUFFER_SIZE> where
Cam: MelexisCamera,
Clb: CalibrationData<'a>,
I2C: WriteRead + Write,
impl<'a, Cam, Clb, I2C, const HEIGHT: usize, const WIDTH: usize, const BUFFER_SIZE: usize> CameraDriver<Cam, Clb, I2C, HEIGHT, WIDTH, BUFFER_SIZE> where
Cam: MelexisCamera,
Clb: CalibrationData<'a>,
I2C: WriteRead + Write,
Create a new CameraDriver
, obtaining the calibration data from the camera over I²C.
pub fn new_with_calibration(
bus: I2C,
address: u8,
calibration: Clb
) -> Result<Self, Error<I2C>>
pub fn new_with_calibration(
bus: I2C,
address: u8,
calibration: Clb
) -> Result<Self, Error<I2C>>
Create a CameraDriver
for accessing the camera at the given I²C address.
MLX9064*s can be configured to use any I²C address (except 0x00), but the default address is 0x33.
Get the last measured subpage.
Check if there is new data available, and if so, which subpage.
Clear the data available flag, signaling to the camera that the controller is ready for more data.
This flag can only be reset by the controller.
Check if the overwrite enabled flag is set.
This flag is only effective when data_hold_enabled
is active.
Enabled (or disable) overwriting of data in RAM with new data.
Check if the camera is using subpages.
When disabled, only one page will be measured. The default is to use subpages.
Enabled (or disable) the use of subpages.
Check if the “Enable data hold” flag is set.
When this flag (bit 2 on 0x800D) is set, data is not copied to RAM unless the
enable_overwrite
flag is set. The default is for this mode to be disabled.
Enabled (or disable) data holding.
Check if the camera is in subpage repeat mode.
This flag only has an effect if subpages is enabled. In
subpage repeat mode, only the subpage set in selected_subpage
will be measured and
updated. When disabled, the active subpage will alternate between the two. The default is
disabled.
Enabled (or disable) subpage repeat mode.
Get the currently selected subpage when subpage repeat is enabled.
This setting only has an effect when subpage_repeat
is enabled. The default value is
Subpage::Zero
.
Set the currently selected subpage when subpage repeat is enabled.
Read the frame rate from the camera.
The default frame rate is 2 FPS.
Set camera’s frame rate.
Get the current resolution of the ADC in the camera.
The default resolution is 18 bits.
Set ADC resolution within the camera.
Get the current access pattern used by the camera when updating subpages.
The default for the MLX90640 is the chess patterm while the default for the MLX90641 is the interleaved pattern.
Set the access pattern used by the camera.
Get the emissivity value that is being used for calculations currently.
The default emissivity is 1, unless a camera has a different value stored in EEPROM, in which case that value is used. The default can also be overridden, but this change is not stored on the camera.
Override the emissivity value used in temperature calculations.
The default emissivity is 1, unless a camera has a different value stored in EEPROM, in which case that value is used. This method allows a new value to be used to compensate for emissivity.
Use the default emissivity value.
This is the opposite to override_emissivity
, as it uses the default emissivity from
either the camera (if the camera has a value set) or 1.
Retrieve the current reflected temperature value.
When the temperature of the ambient environment is not known, this function will return
None
. See set_reflected_temperature
for more
information.
Set the reflected temperature value.
This value is used to compensate for infrared radiation not being emitted by an object
itself, but being emitted by the ambient environment and reflected by an object being
measured. This value is distinct from the one from ambient_temperature
, but if not
explicitly known it can be estimated from that value.
Get the most recent ambient temperature calculation.
What the datasheets (and this crate) refer to as “ambient temperature” should be better
understood as the ambient temperature of the camera itself, not of the area being imaged.
These values will usually be different because the camera generates some heat itself, and
the sensor used for this value is within the camera module. See
MelexisCamera::SELF_HEATING
for more details.
This value is calculated as part of the overall image calculations. If that
process hasn’t been performed yet (by calling
generate_image_if_ready
or similar), this method will
return None
.
pub fn generate_raw_image_subpage_to(
&'a mut self,
subpage: Subpage,
destination: &mut [f32]
) -> Result<(), Error<I2C>>
pub fn generate_image_subpage_to(
&'a mut self,
subpage: Subpage,
destination: &mut [f32]
) -> Result<(), Error<I2C>>
Generate a thermal “image” from the camera’s current data.
This function does not check if there is new data, it just copies the
Generate a thermal “image” from the camera’s current data, if there’s new data.
This function first checks to see if there is new data available, and if there is it copies
that data into the provided buffer. It will then clear the data ready flag afterwards,
signaliing to the camera that we are ready for more data. The Ok
value is a boolean for
whether or not data was ready and copied.
Synchronize with the camera’s frame update timing
This function ignores any new data, then forces a new measurement by the camera, only returning when that measurement is complete. This can be used to synchronize frame access from the controller to the update time of the camera.
Trait Implementations
Auto Trait Implementations
impl<Cam, Clb, I2C, const HEIGHT: usize, const WIDTH: usize, const NUM_BYTES: usize> RefUnwindSafe for CameraDriver<Cam, Clb, I2C, HEIGHT, WIDTH, NUM_BYTES> where
Cam: RefUnwindSafe,
Clb: RefUnwindSafe,
I2C: RefUnwindSafe,
impl<Cam, Clb, I2C, const HEIGHT: usize, const WIDTH: usize, const NUM_BYTES: usize> Send for CameraDriver<Cam, Clb, I2C, HEIGHT, WIDTH, NUM_BYTES> where
Cam: Send,
Clb: Send,
I2C: Send,
impl<Cam, Clb, I2C, const HEIGHT: usize, const WIDTH: usize, const NUM_BYTES: usize> Sync for CameraDriver<Cam, Clb, I2C, HEIGHT, WIDTH, NUM_BYTES> where
Cam: Sync,
Clb: Sync,
I2C: Sync,
impl<Cam, Clb, I2C, const HEIGHT: usize, const WIDTH: usize, const NUM_BYTES: usize> Unpin for CameraDriver<Cam, Clb, I2C, HEIGHT, WIDTH, NUM_BYTES> where
Cam: Unpin,
Clb: Unpin,
I2C: Unpin,
impl<Cam, Clb, I2C, const HEIGHT: usize, const WIDTH: usize, const NUM_BYTES: usize> UnwindSafe for CameraDriver<Cam, Clb, I2C, HEIGHT, WIDTH, NUM_BYTES> where
Cam: UnwindSafe,
Clb: UnwindSafe,
I2C: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more