【GD32E503评测】mig29_Step3 初探 LCD 显示的疑问
[复制链接]
一直没有用过带 LCD 的开发板,本次申请除了要实测ADC、DAC的物理特性外,就是特地要实践玩一下LCD 显示。
等到看了例程(见下方代码),心里有个疑问:显示的内容都是一个点一个点 “填充”出来的?! (比如清屏),而且每个点起码涉及三次写操作,速度怎么能快得起来?
(之前的设想:应该是在 MCU 的 RAM 里面开 Buff,然后用 DMA 搬运到 LCD 驱动的RAM 里)
幸运的是,本次参与测评的其他同好贡献了许多跟显示相关的 Demo,接下来可以认真学习一番。
#define BANK0_LCD_D ((uint32_t)0x61000000) /*!< LCD data address */
#define BANK0_LCD_C ((uint32_t)0x60000000) /*!< LCD register address */
void lcd_register_write(uint16_t register_id,uint16_t value)
{
*(__IO uint16_t *) (BANK0_LCD_C)= register_id;
*(__IO uint16_t *) (BANK0_LCD_D)= value;
}
/*!
\brief set the point according to the specified position and color
\param[in] x: the row-coordinate
\param[in] y: the column-coordinate
\param[in] point: specified color of the point
*/
void lcd_point_set(uint16_t x,uint16_t y,uint16_t point)
{
if ((x > LCD_PIXEL_HEIGHT)||(y > LCD_PIXEL_WIDTH)){
return;
}
if(0x8989 == device_code){ // SSD1289
lcd_cursor_set(x,y);
lcd_gram_write_prepare();
lcd_gram_write(point);
}else if((0x9320 == device_code) || (0x9300 == device_code)){ //ILI9320
lcd_register_write(0x20, x);
lcd_register_write(0x21, y);
lcd_register_write(0x22, point);
}
}
void lcd_hline_draw(uint16_t x,uint16_t start_y,uint16_t end_y,uint16_t color,uint16_t width)
{
uint16_t i, y;
for (i = 0; i < width; i++) {
uint16_t sx = x + i;
for (y = start_y; y < end_y; y++) {
lcd_point_set(sx, y, color);
}
}
}
|