Merge pull request #870 from TomWS1/ssd1607_PartialUpdateFix

after > 10 weeks... Updated to fix partial update, add refreshDisplay, for SSD1607_WS_200…
This commit is contained in:
olikraus 2019-06-30 16:12:33 +02:00 committed by GitHub
commit 26de47cb1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 67 additions and 36 deletions

View File

@ -186,6 +186,9 @@ class U8G2 : public Print
{ u8g2_UpdateDisplayArea(&u8g2, tx, ty, tw, th); }
void updateDisplay(void)
{ u8g2_UpdateDisplay(&u8g2); }
void refreshDisplay(void)
{ u8x8_RefreshDisplay(u8g2_GetU8x8(&u8g2)); }
/* u8g2_hvline.c */

View File

@ -163,10 +163,12 @@ static void u8x8_d_ssd1607_draw_tile(u8x8_t *u8x8, uint8_t arg_int, void *arg_pt
x = ((u8x8_tile_t *)arg_ptr)->x_pos;
x *= 8;
x += u8x8->x_offset;
u8x8_cad_SendCmd(u8x8, 0x045 ); /* window start column */
u8x8_cad_SendArg(u8x8, 0);
u8x8_cad_SendArg(u8x8, 0);
u8x8_cad_SendArg(u8x8, x&255);
u8x8_cad_SendArg(u8x8, x>>8);
u8x8_cad_SendArg(u8x8, 199); /* end of display */
u8x8_cad_SendArg(u8x8, 0);
@ -538,31 +540,39 @@ measured 1240 ms with IL3830 196x128
U8X8_C(0x32), /* write LUT register*/
/*
U8X8_A(0x50), U8X8_A(0xAA), U8X8_A(0x55), U8X8_A(0xAA), U8X8_A(0x11),
U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00),
U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00),
U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00),
U8X8_A(0xFF), U8X8_A(0xFF), U8X8_A(0x1F), U8X8_A(0x00), U8X8_A(0x00),
U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00),
*/
U8X8_A(0x10), U8X8_A(0x18), U8X8_A(0x18), U8X8_A(0x08), U8X8_A(0x18), // numbers based on Waveshare demo code
U8X8_A(0x18), U8X8_A(0x08), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00),
U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00),
U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00),
U8X8_A(0x13), U8X8_A(0x14), U8X8_A(0x44), U8X8_A(0x12), U8X8_A(0x00),
U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00),
U8X8_CA(0x22, 0x04), /* display update seq. option: clk -> CP -> LUT -> initial display -> pattern display */
U8X8_CA(0x22, 0xc4), /* display update seq. option: clk -> CP -> LUT -> initial display -> pattern display */
U8X8_C(0x20), /* execute sequence */
U8X8_DLY(250), /* delay for 1500ms. The current sequence takes 1300ms */
U8X8_DLY(250),
U8X8_DLY(250),
U8X8_DLY(250),
// U8X8_DLY(250),
U8X8_DLY(250),
U8X8_DLY(250),
// U8X8_DLY(250),
// U8X8_DLY(250),
U8X8_END_TRANSFER(), /* disable chip */
U8X8_END() /* end of sequence */
};
uint8_t u8x8_d_ssd1607_gd_200x200(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
switch(msg)
@ -600,36 +610,53 @@ uint8_t u8x8_d_ssd1607_gd_200x200(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, vo
/*=================================================*/
static const uint8_t u8x8_d_ssd1607_ws_to_display_seq[] = {
U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
U8X8_C(0x32), /* write LUT register*/
U8X8_A(0x10), U8X8_A(0x18), U8X8_A(0x18), U8X8_A(0x08), U8X8_A(0x18), // numbers based on Waveshare demo code
U8X8_A(0x18), U8X8_A(0x08), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00),
U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00),
U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00),
U8X8_A(0x13), U8X8_A(0x14), U8X8_A(0x44), U8X8_A(0x12), U8X8_A(0x00),
U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00), U8X8_A(0x00),
U8X8_CA(0x22, 0xc4), /* display update seq. option: clk -> CP -> LUT -> initial display -> pattern display */
U8X8_C(0x20), /* execute sequence */
U8X8_DLY(250), /* delay for 1250ms. */
U8X8_DLY(250),
U8X8_DLY(250),
U8X8_DLY(250),
U8X8_DLY(250),
U8X8_END_TRANSFER(), /* disable chip */
U8X8_END() /* end of sequence */
};
static const uint8_t u8x8_d_ssd1607_ws_to_refresh_seq[] = {
U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
U8X8_CA(0x22, 0x04), /* display update seq. option: clk -> CP -> LUT -> initial display -> pattern display */
U8X8_C(0x20), /* execute sequence */
// U8X8_DLY(250),
// U8X8_DLY(250),
U8X8_END_TRANSFER(), /* disable chip */
U8X8_END() /* end of sequence */
};
/* waveshare 200x200 */
static const uint8_t u8x8_d_ssd1607_ws_200x200_init_seq[] = {
// original code
// U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
// U8X8_C(0x01),
// U8X8_A(199),U8X8_A(0),U8X8_A(0),
// U8X8_CA(0x03, 0x00), /* Gate Driving voltage: 15V (lowest value)*/
// U8X8_CA(0x04, 0x0a), /* Source Driving voltage: 15V (mid value and POR)*/
// U8X8_CA(0x0f, 0x00), /* scan start ? */
// U8X8_CA(0xf0, 0x1f), /* set booster feedback to internal */
// U8X8_CA(0x2c, 0xa8), /* write vcom value*/
// U8X8_CA(0x3a, 0x1a), /* dummy lines */
// U8X8_CA(0x3b, 0x08), /* gate time */
// U8X8_CA(0x3c, 0x33), /* select boarder waveform */
// U8X8_CA(0x11, 0x03), /* cursor increment mode */
// U8X8_CAA(0x44, 0, 24), /* RAM x start & end, each byte has 8 pixel, 25*4=200 */
// U8X8_CAAAA(0x45, 0, 0, 299&255, 299>>8), /* RAM y start & end, 0..299 */
// U8X8_END_TRANSFER(), /* disable chip */
// U8X8_END() /* end of sequence */
// suggested code from https://github.com/olikraus/u8g2/issues/637
U8X8_START_TRANSFER(), /* enable chip, delay is part of the transfer start */
@ -667,6 +694,7 @@ uint8_t u8x8_d_ssd1607_ws_200x200(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, vo
u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_ws_200x200_init_seq);
u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_200x200_powersave0_seq);
u8x8_d_ssd1607_200x200_first_init(u8x8);
u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_ws_to_display_seq);; // to setup LUT
break;
case U8X8_MSG_DISPLAY_SET_POWER_SAVE:
if ( arg_int == 0 )
@ -680,7 +708,7 @@ uint8_t u8x8_d_ssd1607_ws_200x200(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, vo
u8x8_d_ssd1607_draw_tile(u8x8, arg_int, arg_ptr);
break;
case U8X8_MSG_DISPLAY_REFRESH:
u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_to_display_seq);
u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1607_ws_to_refresh_seq);
break;
default:
return 0;