honestly this is an issue with the u8g2 page.
There are two sections SH1106 128X64_NONAME
with no obvious difference based in their name or description, but one has the i2c
versions, while the other doesn't.
I don't know how to make it clearer in our page: I put i2c
in
By clicking on the name of your screen you should find a setup function with a format similar to this:
u8g2_Setup_<CONTROLLER>_i2c_<WIDTH>x<HEIGHT>_<NAME>_f
and I even give as an example the very function you needed:
Here is an example of a complete setup function: u8g2_Setup_sh1106_i2c_128x64_noname_f
and it's in the code example:
std::vector<Display> gDisplays = {
// use `-1` as the last value to indicate that the display is not behind a mux, or a number between 0 and 7 for its muxed channel number
{U8G2LinuxI2C(U8G2_R0, gI2cBus, 0x3c, u8g2_Setup_sh1106_i2c_128x64_noname_f), -1},
// add more displays / addresses here
};
Do you have any practical suggestion on how it could be made clearer? Maybe just adding a warning that there may be similarly-named functions and that it's easy to get confused?
even funnier: the O2O code would have worked out of the box for you because the line you see there in the stock main.cpp
:
{ U8G2_SH1106_128X64_NONAME_F_HW_I2C_LINUX(U8G2_R0, gI2cBus, 0x3c), -1},
actually calls under the hood:
U8G2LinuxI2C(rotation, bus, address, u8g2_Setup_sh1106_i2c_128x64_noname_f)
:-)
Btw, only I2C is supported at the moment on O2O, but it shouldn't be extremely hard to support SPI if it comes to it.