Closed niziak closed 7 years ago
Following error during execution of i2c:transfer()
lua: attempt to index a nil value
occurs when try to transfer more messages at once.
My code to reproduce error:
local msgs = { { 0x00 }, {0x00, 0x00, flags = I2C.I2C_M_RD}, { 0x01 }, {0x00, flags = I2C.I2C_M_RD}, { 0x02 }, {0x00, 0x00, flags = I2C.I2C_M_RD}, { 0x03 }, {0x00, 0x00, flags = I2C.I2C_M_RD}, } i2c:transfer(i2c_addr, msgs) print(string.format("[0x00] Temperature...: 0x%02x%02x", msgs[2][1], msgs[2][2])) print(string.format("[0x01] Configuration.: 0x%02x" , msgs[4][1])) print(string.format("[0x03] Thys..........: 0x%02x%02x", msgs[6][1], msgs[6][2])) print(string.format("[0x04] Tos...........: 0x%02x%02x", msgs[8][1], msgs[8][2]))
Thanks, cherry-picked in 2d39685. This will go into the next release soon with some c-periphery fixes.
Following error during execution of i2c:transfer()
occurs when try to transfer more messages at once.
My code to reproduce error: