The project can be seen at https://github.com/jskubick/u8g2-exampl ... -sda5-scl4
Now, I want to add code to use additional devices sharing the same i2c bus as the display, and I'm not really sure how to proceed...
- rewrite u8g2_esp32_hal.c to turn it into a more general-purpose class for encapsulating an i2c_cmd_handle_t object, treat it like a Singleton, and use it to communicate with EVERYTHING that's on the pin 4/5 i2c bus?
- slightly refactor u8g2_esp32_hal.c to turn it into a more general-purpose class for encapsulating an i2c_cmd_handle_t object, but instantiate a separate object for every device on the bus. And maybe come up with some locking mechanism to ensure that only a single thread at a time can touch the i2c bus, and ensure that communication sequences don't get interrupted (say, if a thread that reads a SHT21 temperature/humidity sensor decides to run at the exact same instant another thread is updating the SSD1306 display).
- Some other strategy?