SPI介面的ST7735 TFT顯示器初始化

void ST7735_Init(void) { CS_Pin_LOW; RES_Pin_LOW; delay_ms(5); RES_Pin_HIGH; SendCommand(0x01);//Software Reset delay_ms(150); SendCommand(0x11);//Sleep Out delay_ms(500); SendCommand(0x3A);//Interface Pixel Format SendParameter(0x05);//16-bit/pixel delay_ms(10); SendCommand(0xB1);//Frame Rate Control (In normal mode/ Full colors) SendParameter(0x00);//RTNA=0Frame rate=fosc/((RTNA + 20) x (LINE + FPA + BPA)) fosc = 333kHz SendParameter(0x06);//FPA=6 SendParameter(0x03);//BPA=3 delay_ms(10); SendCommand(0x36);//Memory Data Access Control SendParameter(0x08);//MY=0 Row Address Order MX=0 Column Address Order MV=0 Row/Column Exchange ML=0 Vertical Refresh Order RGB=1 RGB-BGR ORDER MH=0 Horizontal Refresh Order SendCommand(0xB6);//Display Function SendParameter(0x15);//Amount of non-overlap of the gate output 1 clock cycle Delay amount form gate signal rising edge of the source output 1 clock cycle Equalizing period 3 clock cycle SendParameter(0x02);//Gate output in a non-display area Normal scan Source output on non-display area Positive:AGND Negative:AGND VCOM output on non-display area Positive:AGND Negative:AGND delay_ms(10); SendCommand(0xB4);//Display Inversion Control SendParameter(0x00);//Inversion setting in full Colors normal mode:Line InversionInversion setting in Idle mode:Line InversionInversion setting in full Colors partial mode:Line Inversion SendCommand(0xC0);//Power Control 1 SendParameter(0x02);//GVDD:4.7 SendParameter(0x70);//AVDD:1.0uA delay_ms(10); SendCommand(0xC1);//Power Control 2 SendParameter(0x05);//VGH:6X 14.7VGL:-3X -7.35 /* SendCommand(0xC2); //ERROR SendParameter(0x01); SendParameter(0x01); */ SendCommand(0xC5);//VCOM Control 1 SendParameter(0x3C);//VCOMH=4V SendParameter(0x38);//VCOML=-1.1V delay_ms(10); SendCommand(0xFC);//Power Control 5 (in Partial mode + Idle mode) SendParameter(0x11); SendParameter(0x15); SendCommand(0xE0);//Gamma ("+"Ppolarity) Correction Characteristics Setting SendParameter(0x09); SendParameter(0x16); SendParameter(0x09); SendParameter(0x20); SendParameter(0x21); SendParameter(0x1B); SendParameter(0x13); SendParameter(0x19); SendParameter(0x17); SendParameter(0x15); SendParameter(0x1E); SendParameter(0x2B); SendParameter(0x04); SendParameter(0x05); SendParameter(0x02); SendParameter(0x0E); SendCommand(0xE1);//Gamma ("-"Ppolarity) Correction Characteristics Setting SendParameter(0x0B); SendParameter(0x14); SendParameter(0x08); SendParameter(0x1E); SendParameter(0x22); SendParameter(0x1D); SendParameter(0x18); SendParameter(0x1E); SendParameter(0x1B); SendParameter(0x1A); SendParameter(0x24); SendParameter(0x2B); SendParameter(0x06); SendParameter(0x06); SendParameter(0x02); SendParameter(0x0F); SendCommand(0x2A);//Column Address Set SendParameter(0x00); SendParameter(0x00); SendParameter(0x00); SendParameter(0x7F); SendCommand(0x2B);//Row Address Set SendParameter(0x00); SendParameter(0x00); SendParameter(0x00); SendParameter(0x7F); SendCommand(0x13); CS_Pin_HIGH; delay_ms(10); CS_Pin_LOW; SendCommand(0x29); CS_Pin_HIGH; delay_ms(100); CS_Pin_LOW; SendCommand(0x36); SendParameter(0xC8); CS_Pin_HIGH; } 這程式碼是ST7735初始化的細節,請問你們上班時會自己刻初始化,還是只要用Sample Code,然後找到重點後修改成自己要的就好?
愛心
5
6
全部留言