Instead using SRAM Setting 0x60 Set SRAM settings and 0x61 to set the GPIO direction and state, use the 0x50 Set GPIO Output Values command. (like the Linux kernel driver). Using the SRAM commands is harder to debug. Also make available a function that returns the GPIO state by an integer rather than tuple.
I was having trouble with I2C not working because for my application I need the time.sleep() in _i2c_read(). I made this an environment variable so people can use it as they please
The exit() in I2C_Init() has been removed and changed with exception, so the program no longer exits on error
_i2c_read() now raises error if the return code from MCP2221 is not 0x00, instead of returning -1. An alternative is to have _i2c_read() return None. I think smbus returns None ? Not too sure.
0x60 Set SRAM settings
and0x61
to set the GPIO direction and state, use the0x50 Set GPIO Output Values
command. (like the Linux kernel driver). Using the SRAM commands is harder to debug. Also make available a function that returns the GPIO state by an integer rather than tuple.time.sleep()
in_i2c_read()
. I made this an environment variable so people can use it as they pleaseexit()
inI2C_Init()
has been removed and changed with exception, so the program no longer exits on error_i2c_read()
now raises error if the return code from MCP2221 is not0x00
, instead of returning-1
. An alternative is to have_i2c_read()
returnNone
. I think smbus returnsNone
? Not too sure.Updated example and readme as appropriate