diff --git a/src/main.cc b/src/main.cc index 4c31332..d3cb907 100644 --- a/src/main.cc +++ b/src/main.cc @@ -74,12 +74,12 @@ ssd1306::ssd1306() { write_cmd(SET_DISP_OFFSET); // No offset write_cmd(0x00); // No offset - write_cmd(SET_DISP_START_LINE | 0x00); // Resolution and layout + write_cmd(SET_DISP_START_LINE); // Resolution and layout write_cmd(SET_SEG_REMAP | 0x01); write_cmd(SET_COM_OUT_DIR | 0x08); // Scan from COM[N] to COM0 write_cmd(SET_COM_PIN_CFG); - write_cmd(0x02); + write_cmd(0x12); write_cmd(SET_CONTRAST); write_cmd(0xFF); @@ -90,30 +90,28 @@ ssd1306::ssd1306() { write_cmd(0x80); write_cmd(SET_PRECHARGE); - write_cmd(0x22); + write_cmd(0xF1); write_cmd(SET_CHARGE_PUMP); write_cmd(0x14); - write_cmd(SET_DISP | 0x01); + write_cmd(SET_VCOM_DESEL); + write_cmd(0x30); + write_cmd(SET_DISP | 0x01); write_cmd(SET_MEM_ADDR); write_cmd(0x00); // Horizontal - /* - write_cmd(SET_VCOM_DESEL); - write_cmd(0x30); - */ write_cmd(SET_COL_ADDR); write_cmd(0); write_cmd(127); write_cmd(SET_PAGE_ADDR); write_cmd(0); - write_cmd(63); + write_cmd(0x63); } void ssd1306::test() { static bool flip = true; - uint8_t buf[2] = {0x40, 0x00}; + uint8_t buf[2] = {0x40, 0xFF}; write_data(buf, 2); }