资源简介
龙邱TFT、逐飞TFT、逐飞IPS屏多合一驱动库,基于龙邱软件SPI通信编写,修改部分代码,增加对IPS屏的支持。通过修改宏定义可使本程序驱动以上三款显示屏!!s测试硬件KV58核心板、龙邱TFT、逐飞TFT、逐飞IPS屏,理论上兼容龙邱家的所有芯片例程,如需再次开发,请自行修改!
代码片段和文件信息
/*********************************************************************************
** Powered by YanMingXiao **
** 基于龙邱1.8TFT程序修改,核心为模拟spi通信 **
** 2019.5.26 **
*********************************************************************************/
#include “include.h“
#include “picture.h“
/**********************************************************
函数名称:TFTSPI_init()
入口参数:无
出口参数:无
时间:2018/1/26
功能说明:器件初始化
其他说明:无
**********************************************************/
void TFTSPI_Init_LCD(void)
{
//-----端口初始化----//
GPIO_Init(GPIOC12GPO0);
GPIO_Init(GPIOC13GPO0);
GPIO_Init(GPIOC14GPO0);
GPIO_Init(GPIOC15GPO0);
GPIO_Init(GPIOC16GPO0);
TFTSPI_RST=0;
time_delay_ms(50);
TFTSPI_RST=1;
time_delay_ms(50);
TFTSPI_Write_Cmd(0x11); //关闭睡眠,振荡器工作
time_delay_ms(5);
TFTSPI_Write_Cmd(0x3a); //每次传送16位数据(VIPF3-0=0101),每个像素16位(IFPF2-0=101)
TFTSPI_Write_Byte(0x55);
TFTSPI_Write_Cmd(0x26);
TFTSPI_Write_Byte(0x04);
TFTSPI_Write_Cmd(0xf2); //Driver Output Control(1)
TFTSPI_Write_Byte(0x01);
TFTSPI_Write_Cmd(0xe0); //Driver Output Control(1)
TFTSPI_Write_Byte(0x3f);
TFTSPI_Write_Byte(0x25);
TFTSPI_Write_Byte(0x1c);
TFTSPI_Write_Byte(0x1e);
TFTSPI_Write_Byte(0x20);
TFTSPI_Write_Byte(0x12);
TFTSPI_Write_Byte(0x2a);
TFTSPI_Write_Byte(0x90);
TFTSPI_Write_Byte(0x24);
TFTSPI_Write_Byte(0x11);
TFTSPI_Write_Byte(0x00);
TFTSPI_Write_Byte(0x00);
TFTSPI_Write_Byte(0x00);
TFTSPI_Write_Byte(0x00);
TFTSPI_Write_Byte(0x00);
TFTSPI_Write_Cmd(0xe1); //Driver Output Control(1)
TFTSPI_Write_Byte(0x20);
TFTSPI_Write_Byte(0x20);
TFTSPI_Write_Byte(0x20);
TFTSPI_Write_Byte(0x20);
TFTSPI_Write_Byte(0x05);
TFTSPI_Write_Byte(0x00);
TFTSPI_Write_Byte(0x15);
TFTSPI_Write_Byte(0xa7);
TFTSPI_Write_Byte(0x3d);
TFTSPI_Write_Byte(0x18);
TFTSPI_Write_Byte(0x25);
TFTSPI_Write_Byte(0x2a);
TFTSPI_Write_Byte(0x2b);
TFTSPI_Write_Byte(0x2b);
TFTSPI_Write_Byte(0x3a);
TFTSPI_Write_Cmd(0xb1); //0xb1 //设置屏幕刷新频率
TFTSPI_Write_Byte(0x00); //0x08 //DIVA=8
TFTSPI_Write_Byte(0x00); //0x08 //VPA =8,约90Hz
TFTSPI_Write_Cmd(0xb4); //LCD Driveing control
TFTSPI_Write_Byte(0x07); //NLA=1NLB=1NLC=1
TFTSPI_Write_Cmd(0xc0); //LCD Driveing control Power_Control1
TFTSPI_Write_Byte(0x0a);
TFTSPI_Write_Byte(0x02);
TFTSPI_Write_Cmd(0xc1); //LCD Driveing control
TFTSPI_Write_Byte(0x02);
TFTSPI_Write_Cmd(0xc5); //LCD Driveing control
TFTSPI_Write_Byte(0x4f);
TFTSPI_Write_Byte(0x5a);
TFTSPI_Write_Cmd(0xc7); //LCD Driveing control
TFTSPI_W
评论
共有 条评论