I'm reading a 16-bit value from two consecutive registers on a sensor and I've put them into one variable by typing
Code: Select all
data = bytearray(i2c.mem_read(2, addr, mem_addr))
The order in which I'm reading the values defines data's endianness as little. So far in my previous code I've been using
Code: Select all
int.from_bytes(bytearray, 'little')
The Python documentation for int.from_bytes (available here https://docs.python.org/3/library/stdty ... from_bytes) says that you can specify the signed or unsigned nature of the bytearray (or byte(s)) to be converted. So I typed
Code: Select all
int.from_bytes(data, 'little', True)
Code: Select all
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: function expected at most 3 arguments, got 4