How do you determine ID of an I2C peripheral when using machine library

I am using OpenMV on an Arduino Nicla Vision and am trying to use the machine.I2C class.

From the TOF sensor example I can see that the I2C ID is 2

from machine import I2C
tof = VL53L1X(I2C(2))

Where can I find that ID in the documentation?

I was trying to use the external I2C port (the one on the header) and I determined by trial and error that it’s ID was 1.

I assume that is in a config file somewhere ,but don’t know where to look.

I can see some reference to I2C_ID in the file openmv/omv_boardconfig.h at master · openmv/openmv · GitHub, but I don’t see a value for the TOF sensor and ID =1 is the FIR (not sure what this is on the Nicla Vision)
#define FIR_I2C_ID (1)

It’s not documented anywhere as far as I know, you can find which bus connects to what from the schematics.

Ok, thx. I can see the I2C connections on the schematic.

I was just thinking that since the OpenMV IDE handles multiple boards that there must be a file that indicates what the IDs are for the different boards. Like the variant pin files on the Arduino IDE.

I thought the file that I referenced “openmv/src/omv/boards/NICLAV/omv_boardconfig.h” was the correct place to look, but it doesn’t correlate exactly to the schematic. I’ll just accept that there is some sort of magic that gets that done.

If you just want to know what I2C are available/enabled for MicroPython, see:

However, this doesn’t tell you which devices are on which bus, it’s just the list of enabled buses.

Thanks, that’s helpful.