Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Display Oled with Multiplexer #14

Open
allacmc opened this issue Apr 7, 2024 · 0 comments
Open

Multiple Display Oled with Multiplexer #14

allacmc opened this issue Apr 7, 2024 · 0 comments

Comments

@allacmc
Copy link

allacmc commented Apr 7, 2024

Firstly I would like to thank you. This library works perfectly.

Although I had a little difficulty configuring the CMAKE file, I managed to make it work perfectly.

My project involves the use of multiple displays.

I need to initialize the i2c bus and then initialize each display.

However, ESP32, after being compiled, gives an error.

Does anyone have any idea which way to go?

I've tried several approaches and I'm lost as to which correct path I should follow.

See my code and project below.

image

My code approach would be this:

`
#include <u8g2.h>
#include "sdkconfig.h"
#include "u8g2_esp32_hal.h"

#define PIN_SDA 21
#define PIN_SCL 22

u8g2_t u8g2;
u8g2_t u8g2_1;

void f_setupI2c(){

selectChannel(2);//Select Display 2
    u8g2_esp32_hal_t u8g2_esp32_hal = U8G2_ESP32_HAL_DEFAULT;
    u8g2_esp32_hal.bus.i2c.sda = PIN_SDA;
    u8g2_esp32_hal.bus.i2c.scl = PIN_SCL;
    u8g2_esp32_hal_init(u8g2_esp32_hal);

    u8g2_Setup_sh1106_i2c_128x64_noname_f(&u8g2, U8G2_R0,u8g2_esp32_i2c_byte_cb,u8g2_esp32_gpio_and_delay_cb);
    u8x8_SetI2CAddress(&u8g2.u8x8, 0x78);
    u8g2_InitDisplay(&u8g2);
    u8g2_SetPowerSave(&u8g2, 0);
    u8g2_ClearBuffer(&u8g2);
    u8g2_SetFont(&u8g2, u8g2_font_ncenB10_tr);
    u8g2_DrawStr(&u8g2, 0, 17, "ENERVISION");
    u8g2_SendBuffer(&u8g2);

selectChannel(3); //Select Display 3
    u8g2_Setup_sh1106_i2c_128x64_noname_f(&u8g2_1, U8G2_R0,u8g2_esp32_i2c_byte_cb,u8g2_esp32_gpio_and_delay_cb);
    u8x8_SetI2CAddress(&u8g2_1.u8x8, 0x78);
    u8g2_InitDisplay(&u8g2_1);
    u8g2_SetPowerSave(&u8g2_1, 0);
    u8g2_ClearBuffer(&u8g2_1);
    u8g2_SetFont(&u8g2_1, u8g2_font_ncenB10_tr);
    u8g2_DrawStr(&u8g2_1, 0, 17, "ENERVISION");
    u8g2_SendBuffer(&u8g2_1);

}`

However, when you run the 3 display, I have an error during execution.

image

Does anyone have an idea where I'm going wrong?

How to separate i2c initialization and Display initialization?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant