新手入门
- 积分
- 6
- 金钱
- 6
- 注册时间
- 2024-1-5
- 在线时间
- 0 小时
|
1金钱
看了正点原子通过FSMC驱动LCD的教程,LCD_ex_ili9341_reginit初始化函数没太看明白,有没有大哥能帮忙解释一下这个函数中这些写操作的用途。源码贴下面了
void lcd_ex_ili9341_reginit(void)
{
lcd_wr_regno(0xCF);
lcd_wr_data(0x00);
lcd_wr_data(0xC1);
lcd_wr_data(0x30);
lcd_wr_regno(0xED);
lcd_wr_data(0x64);
lcd_wr_data(0x03);
lcd_wr_data(0x12);
lcd_wr_data(0x81);
lcd_wr_regno(0xE8);
lcd_wr_data(0x85);
lcd_wr_data(0x10);
lcd_wr_data(0x7A);
lcd_wr_regno(0xCB);
lcd_wr_data(0x39);
lcd_wr_data(0x2C);
lcd_wr_data(0x00);
lcd_wr_data(0x34);
lcd_wr_data(0x02);
lcd_wr_regno(0xF7);
lcd_wr_data(0x20);
lcd_wr_regno(0xEA);
lcd_wr_data(0x00);
lcd_wr_data(0x00);
lcd_wr_regno(0xC0); /* Power control */
lcd_wr_data(0x1B); /* VRH[5:0] */
lcd_wr_regno(0xC1); /* Power control */
lcd_wr_data(0x01); /* SAP[2:0];BT[3:0] */
lcd_wr_regno(0xC5); /* VCM control */
lcd_wr_data(0x30); /* 3F */
lcd_wr_data(0x30); /* 3C */
lcd_wr_regno(0xC7); /* VCM control2 */
lcd_wr_data(0xB7);
lcd_wr_regno(0x36); /* Memory Access Control */
lcd_wr_data(0x48);
lcd_wr_regno(0x3A);
lcd_wr_data(0x55);
lcd_wr_regno(0xB1);
lcd_wr_data(0x00);
lcd_wr_data(0x1A);
lcd_wr_regno(0xB6); /* Display Function Control */
lcd_wr_data(0x0A);
lcd_wr_data(0xA2);
lcd_wr_regno(0xF2); /* 3Gamma Function Disable */
lcd_wr_data(0x00);
lcd_wr_regno(0x26); /* Gamma curve selected */
lcd_wr_data(0x01);
lcd_wr_regno(0xE0); /* Set Gamma */
lcd_wr_data(0x0F);
lcd_wr_data(0x2A);
lcd_wr_data(0x28);
lcd_wr_data(0x08);
lcd_wr_data(0x0E);
lcd_wr_data(0x08);
lcd_wr_data(0x54);
lcd_wr_data(0xA9);
lcd_wr_data(0x43);
lcd_wr_data(0x0A);
lcd_wr_data(0x0F);
lcd_wr_data(0x00);
lcd_wr_data(0x00);
lcd_wr_data(0x00);
lcd_wr_data(0x00);
lcd_wr_regno(0xE1); /* Set Gamma */
lcd_wr_data(0x00);
lcd_wr_data(0x15);
lcd_wr_data(0x17);
lcd_wr_data(0x07);
lcd_wr_data(0x11);
lcd_wr_data(0x06);
lcd_wr_data(0x2B);
lcd_wr_data(0x56);
lcd_wr_data(0x3C);
lcd_wr_data(0x05);
lcd_wr_data(0x10);
lcd_wr_data(0x0F);
lcd_wr_data(0x3F);
lcd_wr_data(0x3F);
lcd_wr_data(0x0F);
lcd_wr_regno(0x2B);
lcd_wr_data(0x00);
lcd_wr_data(0x00);
lcd_wr_data(0x01);
lcd_wr_data(0x3f);
lcd_wr_regno(0x2A);
lcd_wr_data(0x00);
lcd_wr_data(0x00);
lcd_wr_data(0x00);
lcd_wr_data(0xef);
lcd_wr_regno(0x11); /* Exit Sleep */
HAL_Delay(120);
lcd_wr_regno(0x29); /* display on */
}
void lcd_wr_data(volatile uint16_t data)
{
data = data;
LCD->LCD_RAM = data;
}
void lcd_wr_regno(volatile uint16_t regno)
{
regno = regno;
LCD->LCD_REG = regno;
}
typedef struct
{
volatile uint16_t LCD_REG;
volatile uint16_t LCD_RAM;
} LCD_TypeDef;
#define LCD_BASE (uint32_t)((0x60000000 + (0x4000000 * (LCD_FSMC_NEX - 1))) | (((1 << LCD_FSMC_AX) * 2) -2))
#define LCD ((LCD_TypeDef *) LCD_BASE)
|
最佳答案
查看完整内容[请看2#楼]
这是lcd初始化,原厂会给你的,绝大部分你不需要去搞懂, 只需要搞懂几个关键指令即可,这个可以看我们教程,比如设置X,Y坐标,窗口啥的,这些命令是要搞懂的
|