olikraus / u8g2

U8glib library for monochrome displays, version 2
Other
4.91k stars 1.02k forks source link

Just wanted to add this improvement to help someone in the future. :) #2451

Open haseebzaib opened 1 month ago

haseebzaib commented 1 month ago

I recently, started using u8g2 and this is definitely amazing library for working with monochrome LCDs.

I recently got LCD based on UC1608 chip set and I saw u8g2 had support for it. But my lcd was not working when I ran U8g2. And then I saw that the initailization routine for u8g2 is wrong for this LCD so here is the correction for it.

My setup is with stm32l4 and SPI with UC1608

static const uint8_t u8x8_d_uc1608_erc240120_init_seq[] = {

  U8X8_START_TRANSFER(),                /* enable chip, delay is part of the transfer start */

//  U8X8_C(0x0e2),                      /* soft reset */
//  U8X8_DLY(200),
//
//  //U8X8_C(0x023),                        /* Bit 0/1: Temp compenstation, Bit 2: Multiplex Rate 0=96, 1=128 */
//  U8X8_C(0x026),                      /* Bit 0/1: Temp compenstation, Bit 2: Multiplex Rate 0=96, 1=128 */
//
//  U8X8_C(0x0c8),                      /* Map control, Bit 3: MY=1, Bit 2: MX=0, Bit 0: MSF =0 */
//  U8X8_C(0x0ea),                      /* LCD bias Bits 0/1: 00=10.7 01=10.3, 10=12.0, 11=12.7 */
//                          /* accorsing to DemoCode.txt */
//
//  U8X8_C(0x02f),                      /* power on, Bit 2 PC2=1 (internal charge pump), Bits 0/1: cap of panel */
//  U8X8_DLY(50),
//
//  U8X8_C(0x040),                      /* set display start line to 0 */
//  U8X8_C(0x090),                      /* no fixed lines */
//  U8X8_C(0x089),                      /* RAM access control */
//
//  //U8X8_CA(0x081, 46),           /* set contrast, 46 according to  DemoCode.txt */
//  U8X8_CA(0x081, 80),         /* */
//
//  U8X8_C(0x000),                      /* column low nibble */
//  U8X8_C(0x010),                      /* column high nibble */
//  U8X8_C(0x0b0),                      /* page adr  */

  U8X8_DLY(200),
  U8X8_C(0xE2),
  U8X8_DLY(200),
  U8X8_C(0x27),
  U8X8_C(0xC4),
  U8X8_C(0xEA),
  U8X8_C(0x81),
  U8X8_C(0x40|80),
  U8X8_C(0x2f),
  U8X8_C(0x40),
  U8X8_C(0xA4),
  U8X8_C(0xA6),
  U8X8_C(0x89),
  U8X8_C(0xB0),
  U8X8_C(0xAf),

  U8X8_END_TRANSFER(),              /* disable chip */
  U8X8_END()                        /* end of sequence */
};
olikraus commented 2 weeks ago

Thanks for the update. Although the display controller is the same, different display may require different init sequences. Maybe you can post a link to your display, so that visitors can relate for which exact display the above sequence is intended.