Replies: 1 comment 1 reply
-
Clock stretching could be used by an I2C client, but I do not know any display which uses clock stretching, so it is silently ignored in U8g2. If your SCD30 lib is based on Wire lib and the display is at the same bus, then you must use HW_I2C for U8g2. In this case both libs will use the same Wire interface (see also the FAQ). Using u8x8.setBusClock(120000); is probably required (not for U8g2, but for your sensor).
No SW_I2C will not work if both devices (display and sensor) share the same bus. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I have a design with the following key parameters:
For the moment I use the following code (code fragment):
`#include <Wire.h>
#include <SparkFun_SCD30_Arduino_Library.h>
#include <U8x8lib.h>
// OLED object
// define OLED i/f
U8X8_SH1106_128X64_NONAME_HW_I2C u8x8(/* reset=*/ U8X8_PIN_NONE); // SSD1306 AZ 1,3" OLED 128x64
` void setup() {
} `
Note: the clock value of 120000 gives in reality about 95kHz, which is ok for SCD30.
My question now is: what is the best practice to initialize the I2C bus in this case? Should I use SW_I2C for the OLED?
The u8x8.setBusClock() does influence the Wire.setClock(), also the order of initialization makes a difference.
What about clock stretching for u8x8 lib?
Thank you for some recommendations for the above setup.
Beta Was this translation helpful? Give feedback.
All reactions