I think the GPIO_Init function is using the wrong offsets to read the initial BIT, DIR, and MODE values.
This can cause garbage GPIO info to be read, which is then set back to the MCP chip in subsequent calls to GPIO_Write, which can then cause exceptions in the HID library.
You can duplicate the issue by opening the device without a Reset, setup and toggle GPIO pins, then open a new instance and try to setup and toggle GPIO.
Maybe there are additional reasons for calling Reset(), but in my case I can now remove the Reset() and GPIO and I2C seem to be working just fine.
I think the GPIO_Init function is using the wrong offsets to read the initial BIT, DIR, and MODE values. This can cause garbage GPIO info to be read, which is then set back to the MCP chip in subsequent calls to GPIO_Write, which can then cause exceptions in the HID library.
Should be:
This issue is masked by always calling the Reset() command and re-creating a new HID device which is in all of the example code:
You can duplicate the issue by opening the device without a Reset, setup and toggle GPIO pins, then open a new instance and try to setup and toggle GPIO. Maybe there are additional reasons for calling Reset(), but in my case I can now remove the Reset() and GPIO and I2C seem to be working just fine.