Undocumented Register D2, and the Charge Pump

Hi Everyone :slight_smile:

there is a undocumented register, D2, it seems to be related to charge/discharge/the charge pump. here i cycle though several values and all documented 4 charge pump levels

134,132,128,6,4,0 -> into this function in the inner loop


void GfxApiSetDisplayUndocumentedD2 (u8 brightness)
{
  const u8 init1306[] = {
    0,
    0xd2, ((brightness | 1 ) )&~16
  };
  os_i2c_write(init1306, sizeof(init1306));
}

and this one with 1 to 4 in the outer loop.

void GfxApiSetCharge(u8 a)
{
  // freq=0;
  const u8 init1306[] = {
    0, 0x8d, "\x10\x15\x14\x94\x95"[a]
    //    0xa2,freq,   //scrolly
  };
  os_i2c_write(init1306, sizeof(init1306));
}

the image stays the same, so it seems it does not manage to “accumlate” enough power to light the text in some settings, in other settings i guess the stripes are bleeding(???) because of too much power???

in case anyone has a idea/speculation what this really does… i would be very intrested to know!

1 Like

0xd2, 0xc does something intresting when scrolling:


without scrolling the image only gets a bit darker

this somehow look “motion blur like”

i found out what 0xd2,4 does, it permanently activates the accelerator, so scrolling commands happen at once, or the screen is put in “retrace mode” or something, at least sending this commands makes the scroll and probably the draw rect happen at once.

here i draw the image, then send 128 content scroll commands, without any delay or nop !

the image scrolls arround at light speed

1 Like

update: very seldomly the display ignores a single command, so i guess a nop or 2 are needed.

every command seems to be executed at once, not at the retrace, set startline also works:
image

this is cool, i hope this is supported everywhere, it works on my display of which i think it is standard!

this gives a major performance improvement because the screen is reacting at once not at the retrace:

i2c bresenham :smiley:

void GfxApiVectorScopeLine2(int x1, int y1, int x2, int y2) {
    int dx = abs(x2 - x1);
    int dy = abs(y2 - y1);
    int sx = (x1 < x2) ? 1 : -1;
    int sy = (y1 < y2) ? 1 : -1;
    int err = dx - dy;
      
    os_i2c_start();
    os_i2c_write_byte(SSD1306_ADDRESS);
    os_i2c_write_byte(0x0);  // command mode
    while (1) {
      if((x1>=0)&&(x1<64)&&(y1>=0)&&(y1<64))
      {  os_i2c_write_byte(0xd3);
        os_i2c_write_byte(x1&63);
        os_i2c_write_byte(0x40+(y1&63));
      }   
        if (x1 == x2 && y1 == y2) {
            break;
        }

        int e2 = 2 * err;
        if (e2 > -dy) {
            err -= dy;
            x1 += sx;
        }
        if (e2 < dx) {
            err += dx;
            y1 += sy;
        }
    }
    os_i2c_stop();
}
1 Like