[RPI 4B 8GB] How can the I2C call readfrom_mem_into be replicated with SMBus methods in micropython?
Posted: Wed May 12, 2021 2:01 pm
For a micropython application on a Raspberry Pi I want to read a sensor, but in the linux port of micropython the I2C library is not available. The SMBus library is available as a port on Github (https://github.com/dlech/micropython-ev ... dev/i2c.py), so I'm trying to rebuild the I2C method I2C.readfrom_mem_into (https://docs.micropython.org/en/latest/ ... m_mem_into) to read data from memory using SMBus methods.
SMBus provides a method to read I2C data: read_i2c_block_data(addr,cmd) where this has only two instead of the three parameters from the I2C.readfrom_mem_into method. There are other read methods like read_block_data, read_byte, read_byte_data which also do not offer three parameters.
The question now is, how can I reconstruct the I2C.readfrom_mem_into call by one or more SMBus methods?
SMBus provides a method to read I2C data: read_i2c_block_data(addr,cmd) where this has only two instead of the three parameters from the I2C.readfrom_mem_into method. There are other read methods like read_block_data, read_byte, read_byte_data which also do not offer three parameters.
The question now is, how can I reconstruct the I2C.readfrom_mem_into call by one or more SMBus methods?