视频
整屏幕更新颜色是,看到屏幕的颜色闪动,如上图的变化。是st7789配置问题,还是驱动的问题?
离线
static void lcd_panel_st7789s_init(void)
{
u32 x = 240, y = 320, sel = 0;
sunxi_lcd_cpu_write_index(0x11);
//sunxi_lcd_delay_ms(120); //Delay 120ms
rt_thread_delay(120);
//-------------Display and color format setting---------------
sunxi_lcd_cpu_write_index(0x36);
sunxi_lcd_cpu_write_data(0x00); // 0x60 320*240 0x80 240*320 // 0x08 rgb
/*
sunxi_lcd_cpu_write_index(0x2A);
sunxi_lcd_cpu_write_data(0x00);
sunxi_lcd_cpu_write_data(0x00);
sunxi_lcd_cpu_write_data(0x01);
sunxi_lcd_cpu_write_data(0x3f);
sunxi_lcd_cpu_write_index(0x2B);
sunxi_lcd_cpu_write_data(0x00);
sunxi_lcd_cpu_write_data(0x00);
sunxi_lcd_cpu_write_data(0x00);
sunxi_lcd_cpu_write_data(0xef);
*/
sunxi_lcd_cpu_write_index(0x3a); //262k,?????0X66, 65K,?????0X55
sunxi_lcd_cpu_write_data(0x55);
//----------ST7789S Frame rate setting----------
sunxi_lcd_cpu_write_index(0xb2);
sunxi_lcd_cpu_write_data(0x0c); // 8
sunxi_lcd_cpu_write_data(0x0c); // 8
sunxi_lcd_cpu_write_data(0x00);
sunxi_lcd_cpu_write_data(0x33); // 22
sunxi_lcd_cpu_write_data(0x33); // 22
sunxi_lcd_cpu_write_index(0xb3);
sunxi_lcd_cpu_write_data(0x00);
sunxi_lcd_cpu_write_data(0x0f);
sunxi_lcd_cpu_write_data(0x0f);
sunxi_lcd_cpu_write_index(0xb7);
sunxi_lcd_cpu_write_data(0x35 );
//----------ST7789S Power setting-----------------
sunxi_lcd_cpu_write_index(0xbb);
sunxi_lcd_cpu_write_data(0x28 ); // 27
//sunxi_lcd_cpu_write_index(0,0xc0);
//sunxi_lcd_cpu_write_data(0,0x6e ); //0x2c
sunxi_lcd_cpu_write_index(0xc2);
sunxi_lcd_cpu_write_data(0x01 );
sunxi_lcd_cpu_write_index(0xc3);
sunxi_lcd_cpu_write_data(0x10 ); //0b
sunxi_lcd_cpu_write_index(0xc4);
sunxi_lcd_cpu_write_data(0x20 );
sunxi_lcd_cpu_write_index(0xc6);
sunxi_lcd_cpu_write_data(0x0f ); //0xf
sunxi_lcd_cpu_write_index(0xd0);
sunxi_lcd_cpu_write_data(0xa4 );
sunxi_lcd_cpu_write_data(0xa1 );
//-----------ST7789S gamma setting----------------
sunxi_lcd_cpu_write_index(0xe0);
sunxi_lcd_cpu_write_data(0xd0);
sunxi_lcd_cpu_write_data(0x00);
sunxi_lcd_cpu_write_data(0x02);
sunxi_lcd_cpu_write_data(0x07);
sunxi_lcd_cpu_write_data(0x0b); //
sunxi_lcd_cpu_write_data(0x1a); // 19
sunxi_lcd_cpu_write_data(0x31); //2e
sunxi_lcd_cpu_write_data(0x54); //54
sunxi_lcd_cpu_write_data(0x40); //41
sunxi_lcd_cpu_write_data(0x29); //2d
sunxi_lcd_cpu_write_data(0x12); //17
sunxi_lcd_cpu_write_data(0x12); //18
sunxi_lcd_cpu_write_data(0x12); //12
sunxi_lcd_cpu_write_data(0x17); //17
sunxi_lcd_cpu_write_index(0xe1);
sunxi_lcd_cpu_write_data(0xd0);
sunxi_lcd_cpu_write_data(0x00);
sunxi_lcd_cpu_write_data(0x02);
sunxi_lcd_cpu_write_data(0x07);
sunxi_lcd_cpu_write_data(0x05); // 04
sunxi_lcd_cpu_write_data(0x25); //24
sunxi_lcd_cpu_write_data(0x2d); //2c
sunxi_lcd_cpu_write_data(0x44);
sunxi_lcd_cpu_write_data(0x45); //42
sunxi_lcd_cpu_write_data(0x1c); //
sunxi_lcd_cpu_write_data(0x18); // 1a
sunxi_lcd_cpu_write_data(0x16); //17
sunxi_lcd_cpu_write_data(0x1c); //15
sunxi_lcd_cpu_write_data(0x1d); //18
sunxi_lcd_cpu_write_index(0x29);
//sunxi_lcd_delay_ms(20);
rt_thread_delay(20);
// addr x
sunxi_lcd_cpu_write_index(0x2a);
sunxi_lcd_cpu_write_data(0x00);
sunxi_lcd_cpu_write_data(0x00);
sunxi_lcd_cpu_write_data((x-1)>>8);
sunxi_lcd_cpu_write_data((x-1)&0xff);
//addr y
sunxi_lcd_cpu_write_index(0x2b);
sunxi_lcd_cpu_write_data(0x00);
sunxi_lcd_cpu_write_data(0x00);
sunxi_lcd_cpu_write_data((y-1)>>8);
sunxi_lcd_cpu_write_data((y-1)&0xff);
sunxi_lcd_cpu_write_index(0x2C);
//lcd_cpu_panel_fr(sel, x, y, 0, 0);
}
配置代码在bsp内复制出来的。
在rethread下运行显示。
离线
I8080 接口的
离线