Is the I2C for MLX90640 thermal sensor software/bit-bashed?

If so why?
Just want to understand before I spend time trying to change it to hardware.

It’s bit banged. Ibrahim wrote it like that a long time ago and it worked and we just didn’t change it. If you look at the commits the code is from like 2015. The sensor is on a valid I2C bus however so you can use an I2C bus easily.

I think the old 16x4 MLX sensor needed the software I2C because you need to do repeated starts on it which the ST HAL might not be able to do easily. But, the MLX90640 can probably be done in hardware.

Just switch out the software i2c to hardware i2c: https://github.com/openmv/openmv/tree/master/src/mlx/src

You can literally see the hardware i2c code is commented out and the software code is not commented. You just need to comment the software code and then implement the interface for the hardware code.

Hi, I’ve updated all the FIR I2C code, the older MLX sensor still uses soft-i2c but the other two sensors (AMG and MLX90640) are now using HW I2C. And I’ve also enabled FM+ for the MLX90640 to allow the fastest I2C freq possible. Note the MLX90640 driver got an update from MLX upstream, the update is an improvement and fixes some issues, but there’s a side effect the read_ir and snapshot can timeout/fail now. You need to wrap these functions with try…exception OSError block and retry if it fails.