Well-versed in C/C++, but new to Python.
I have done a lot of research here and maybe I am missing something, but it seems that Pi/Python does not have primitive functions for I2C, which is sad to be honest. If this is the case, then I don't understand why the foundation would not support bare-bone I2C. There are some work around's for different cases, but they do not solve all, and with some primitive functions, it could.
Here is one case: 16-bit REG_ADDR WRITE, but doesnt solve 16-bit REG_ADDR READ: https://www.raspberrypi.org/forums/viewtopic.php?t=170062
Here is what is not possible:
A sensor with 16-bit registers, and 16-bit data. I am not talking about the slaver address. I see a ton of threads where people go back and forth on this subject and mix the 2.
7-bit/8-bit slave address
- 16-bit register offsets
- 16-bit data in each offset
How can I communicate with such a device? IS it possible?
- As soon as you want to read, all of the read functions, take an 8-bit read address, thus even if you could write the offset address before a read, the read will fail.
read_block_data(SLAVE_ADDR, REG_ADDR, DATA_ARRAY[])
the REG_ADDR is always 8-bits, hence you cannot talk to a 16-bit address part.
Is there a module someone has to just have primitive write and read functions?
- write a byte array:
write(SLAVE_ADDR, BYTEARRAY[])
- read a byte array:
Array = read(SLAVE_ADDR)
Why is this not available?