u8g2
u8g2 copied to clipboard
Request for ST7567S I2c 128/64 LCD support
Request for ST7567S I2c 128/64 LCD support
https://www.buydisplay.com/download/ic/ST7567S.pdf
I have added I2C versions to the code: for example: U8G2_ST7567_JLX12864_1_SW_I2C U8G2_ST7567_ENH_DG128064_1_SW_I2C U8G2_ST7567_ENH_DG128064I_1_SW_I2C U8G2_ST7567_OS12864_1_SW_I2C
I have created beta v2.33.1. Can you test the above constructors? You can download the latest U8g2 beta release from here: https://github.com/olikraus/U8g2_Arduino/archive/master.zip Arduino IDE:
- Remove the existing U8g2_Arduino library (https://stackoverflow.com/questions/16752806/how-do-i-remove-a-library-from-the-arduino-environment)
- Install the U8g2_Arduino Zip file via Arduino IDE, add zip library menu (https://www.arduino.cc/en/Guide/Libraries).
PlatformIO:
platformio.ini
(https://docs.platformio.org/en/latest/projectconf/section_env_library.html#lib-deps) should include
lib_deps =
u8g2=https://github.com/olikraus/U8g2_Arduino/archive/master.zip
failed the test Using https://github.com/mworkfun/ST7567A_128X32DOT_LCD Only 128*32 pixels LCD. After checking, it seems that there is no addr = 0x3f; //Address of LCD device.
I am confused. What has the referenced lib Todo with u8g2
`#include <U8g2lib.h>
#ifdef U8X8_HAVE_HW_SPI #include <SPI.h> #endif #ifdef U8X8_HAVE_HW_I2C #include <Wire.h> #endif
U8G2_ST7567_ENH_DG128064_1_SW_I2C u8g2(U8G2_R0, SCL, SDA, U8X8_PIN_NONE);
void setup(void) { u8g2.setI2CAddress(0x3F * 2); u8g2.begin(); u8g2.clearBuffer(); // clear the internal memory } void loop(void) { u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font u8g2.drawStr(0, 10, "Hello World!"); // write something to the internal memory u8g2.sendBuffer(); // transfer internal memory to the display delay(1000); } ` Hello. How to fix?
Use U8G2_ST7567_ENH_DG128064_F_SW_I2C
THX for help thx for lib, works! But better use U8G2_ST7567_ENH_DG128064I_F_SW_I2C
HI to use less memory , How i can configure ST7567_ENH_DG128064I_F_SW_I2C to use at the same time "u8g2.drawStr" and "u8x8.print"? thanks
You can not use u8x8.print() because the C++ member is notavailable in your case. However you could use the plain C u8x8 functions instead of u8x8.print() (see https://github.com/olikraus/u8g2/wiki/u8x8reference#drawstring):
void u8x8_DrawString(u8x8_t *u8x8, uint8_t x, uint8_t y, const char *s);
void u8x8_Draw1x2String(u8x8_t *u8x8, uint8_t x, uint8_t y, const char *s);
void u8x8_Draw2x2String(u8x8_t *u8x8, uint8_t x, uint8_t y, const char *s);
In order to do this, you need the u8x8_t pointer as first argument, which is returned by the following (undocumented) U8g2 function:
u8x8_t *U8g2:getU8x8(void)
So a u8x8 call with a given u8g2 object will look like this:
u8x8_DrawString(u8g2.getU8x8(), 0, 0, "Upper Left");
I've been trying this (via https://github.com/mkfrey/u8g2-hal-esp-idf):
void task_test_screen()
{
u8g2_t u8g2;
u8g2_esp32_hal_t u8g2_esp32_hal = U8G2_ESP32_HAL_DEFAULT;
u8g2_esp32_hal.bus.i2c.sda = CONFIG_I2C_MASTER_SDA_PIN;
u8g2_esp32_hal.bus.i2c.scl = CONFIG_I2C_MASTER_SCL_PIN;
u8g2_esp32_hal_init(u8g2_esp32_hal);
u8g2_Setup_st7567_enh_dg128064i_f(
&u8g2, U8G2_R0,
// u8x8_byte_sw_i2c,
u8g2_esp32_i2c_byte_cb,
u8g2_esp32_gpio_and_delay_cb); // init u8g2 structure
u8x8_SetI2CAddress(&u8g2.u8x8, 0x3F * 2);
u8g2_InitDisplay(&u8g2);
//ESP_LOGI(TAG, "u8g2_SetPowerSave");
u8g2_SetPowerSave(&u8g2, 0);
ESP_LOGI(TAG, "u8g2_ClearBuffer");
u8g2_ClearBuffer(&u8g2);
//u8g2_DrawBox(&u8g2, 0, 26, 80, 6);
//u8g2_DrawFrame(&u8g2, 0, 26, 100, 6);
ESP_LOGI(TAG, "u8g2_SetFont");
u8g2_SetFont(&u8g2, u8g2_font_ncenB08_tr);
ESP_LOGI(TAG, "u8g2_DrawStr");
u8g2_DrawStrX2(&u8g2, 0, 10, "HELLO HELLO");
ESP_LOGI(TAG, "u8g2_SendBuffer");
u8g2_SendBuffer(&u8g2);
}
The screen is basically garbled and no text is written.
Other people report issues due to the zener diodes: https://forum.arduino.cc/t/how-can-i-controll-my-st7567s-lcd-display-128x64-i2c/1146185/6
I can confirm that removal of the zener diodes returns I2C communications. Both 3.3V and 5V are impacted.