LCDC(LCD Controller) 是为屏提供一个统一的接口,而不需关心具体物理连接是SPI、并口或者其他物理连接,只需在初始化时配置需要使用的物理接口及参数,后续均使用统一的接口.
{
.freq = 24000000,
.color_mode = LCDC_PIXEL_FORMAT_RGB565,
.cfg = {
.spi = {
.dummy_clock = 1,
.vsyn_polarity = 0,
.vsyn_delay_us = 1000,
.hsyn_num = 0,
},
},
};
__ROM_USED void LCDC1_IRQHandler(void)
{
rt_interrupt_enter();
rt_interrupt_leave();
}
{
}
{
uint8_t parameter[14];
HAL_LCDC_ResetLCD(hlcdc, LCDC_RESX_NEG_PULSE, 10);
...
}
{
if (HAL_LCDC_IS_SPI_IF(lcdc_int_cfg.
lcd_itf))
{
if (enable)
{
}
else
{
}
}
}
uint32_t ST7789H2_ReadData(
LCDC_HandleTypeDef *hlcdc, uint16_t RegValue, uint8_t ReadSize)
{
uint32_t rd_data = 0;
ST7789H2_ReadMode(hlcdc, true);
ST7789H2_ReadMode(hlcdc, false);
return rd_data;
}
void ST7789H2_SetRegion(
LCDC_HandleTypeDef *hlcdc, uint16_t Xpos0, uint16_t Ypos0, uint16_t Xpos1, uint16_t Ypos1)
{
uint8_t parameter[4];
parameter[0] = (Xpos0) >> 8;
parameter[1] = (Xpos0) & 0xFF;
parameter[2] = (Xpos1) >> 8;
parameter[3] = (Xpos1) & 0xFF;
parameter[0] = (Ypos0) >> 8;
parameter[1] = (Ypos0) & 0xFF;
parameter[2] = (Ypos1) >> 8;
parameter[3] = (Ypos1) & 0xFF;
}
void ST7789H2_WriteMultiplePixels(
LCDC_HandleTypeDef *hlcdc,
const uint8_t *RGBCode, uint16_t Xpos0, uint16_t Ypos0, uint16_t Xpos1, uint16_t Ypos1)
{
uint32_t size;
if ((Xpos0 > Xpos1) || (Ypos0 > Ypos1))
{
return;
}
}