In practice, it's very easy to turn the encoder just fast enough to interfere with the writes to the EEPROM and 7-segment display. I believe that this is because the seesaw library sets up an interrupt (via the enableEncoderInterrupt() method) which means the I2C channel is susceptible to simultaineous write instructions from the interrupt and statements in my loop() function.
I have not been able to figure out where/how the interrupt seesaw enables is defined.
Bigger picture, I figure that updating a display when an encoder is turned is such a common use case that there must be a way people do this which doesn't result in I2C conflicts:
- there could be a way to define my own encoder interrupt, which would allow me to update the other I2C devices in the same function
- there could be a method exposed on the Wire object which would allow me to wait until the interface is free before attempting to update the other devices
- there could be a way in which I could create a callback or "interrupt on the interrupt" so that my interrupt could run after the seesaw interrupt
- I might just have to run the encoder on a seperate I2C interface, but this feels like the coward's approach (and it seems like you'd run into the same BS if you have more than one rotary encoder, anyhow)
Any war stories are appreciated. Working on a QT Py 2040 with the Arduino 2 IDE.