资源简介
STM32的硬件SPI驱动的ILI9341,本人产品上亲测通过。如有不解,请联系我。
代码片段和文件信息
#define _LCD_ODEV_C_
#include “LCD_odev.h“
#include “fonts.h“ //ASCII字符型字库
void LCD_Delay(unsigned short int i)
{
while(i--);
}
void LCD_wt8bitData(unsigned char da) //发送数据-8位参数
{
LCD_CS_en();
LCD_DC_data();
SPI1_ReadWriteByte(da);
LCD_CS_dis();
}
void LCD_wt16bitData(unsigned short int da)
{
LCD_CS_en();
LCD_DC_data();
SPI1_ReadWriteByte(da>>8);
SPI1_ReadWriteByte(da&0xFF);
LCD_CS_dis();
}
void LCD_wtREG(unsigned char cmd)
{
LCD_CS_en();
LCD_DC_reg();
SPI1_ReadWriteByte(cmd);
LCD_CS_dis();
}
void LCD_wtREG_DATA(unsigned char regunsigned short int da)
{
LCD_wtREG(reg);
LCD_wt16bitData(da);
}
unsigned char LCD_Read_Data(void)
{
LCD_CS_en();
LCD_DC_data();
//此处禁止disbale掉CS脚,CS脚必须一直使能,否则读取的数据全是0xff
return SPI1_ReadWriteByte(0xFF);
}
void LCD_odev_init(void)
{
ILI9341_io_Init();
lcddev.width = LCD_Wide;
lcddev.height = LCD_High;
LCD_RST_Clr();
delay_ms(20);
LCD_RST_Set();
delay_ms(20);
//LCD_BLK_Set();
//************* Start Initial Sequence **********//
LCD_wtREG(0xCF);
LCD_wt8bitData(0x00);
LCD_wt8bitData(0xD9);
LCD_wt8bitData(0X30);
LCD_wtREG(0xED);
LCD_wt8bitData(0x64);
LCD_wt8bitData(0x03);
LCD_wt8bitData(0X12);
LCD_wt8bitData(0X81);
LCD_wtREG(0xE8);
LCD_wt8bitData(0x85);
LCD_wt8bitData(0x10);
LCD_wt8bitData(0x78);
LCD_wtREG(0xCB);
LCD_wt8bitData(0x39);
LCD_wt8bitData(0x2C);
LCD_wt8bitData(0x00);
LCD_wt8bitData(0x34);
LCD_wt8bitData(0x02);
LCD_wtREG(0xF7);
LCD_wt8bitData(0x20);
LCD_wtREG(0xEA);
LCD_wt8bitData(0x00);
LCD_wt8bitData(0x00);
LCD_wtREG(0xC0); //Power control
LCD_wt8bitData(0x21); //VRH[5:0]
LCD_wtREG(0xC1); //Power control
LCD_wt8bitData(0x12); //SAP[2:0];BT[3:0]
LCD_wtREG(0xC5); //VCM control
LCD_wt8bitData(0x32);
LCD_wt8bitData(0x3C);
LCD_wtREG(0xC7); //VCM control2
LCD_wt8bitData(0XC1);
LCD_wtREG(0x36); // Memory Access Control
LCD_wt8bitData(0x68);
LCD_wtREG(0x2A); //行地址设置
LCD_wt8bitData(0x00);
LCD_wt8bitData(0x00);
LCD_wt8bitData(0x01);
LCD_wt8bitData(0x3f);
LCD_wtREG(0x2B); //列地址设置
LCD_wt8bitData(0x00);
LCD_wt8bitData(0x00);
LCD_wt8bitData(0x00);
LCD_wt8bitData(0xef);
LCD_wtREG(0x3A);
LCD_wt8bitData(0x55);
LCD_wtREG(0xB1);
LCD_wt8bitData(0x00);
LCD_wt8bitData(0x18);
LCD_wtREG(0xB6); // Display Function Control
LCD_wt8bitData(0x0A);
LCD_wt8bitData(0xA2);
LCD_wtREG(0xF2); // 3Gamma Function Disable
LCD_wt8bitData(0x00);
LCD_wtREG(0x26); //Gamma curve selected
LCD_wt8bitData(0x01);
LCD_wtREG(0xE0); //Set Gamma
LCD_wt8bitData(0x0F);
LCD_wt8bitData(0x20);
LCD_wt8bitData(0x1E);
LCD_wt8bitData(0x09);
LCD_wt8bitData(0x12);
LCD_wt8bitData(0x0B);
LCD_wt8bitData(0x50);
LCD_wt8bitData(0XBA);
LCD_wt8bitData(0x44);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 35006 2017-11-13 18:45 STM32的硬件SPI驱动的ILI9341代码\fonts.h
文件 21304 2018-01-09 11:26 STM32的硬件SPI驱动的ILI9341代码\LCD_odev.c
文件 6686 2018-01-09 11:26 STM32的硬件SPI驱动的ILI9341代码\LCD_odev.h
文件 4123 2018-01-04 16:52 STM32的硬件SPI驱动的ILI9341代码\spi_idev.c
文件 567 2017-09-29 10:06 STM32的硬件SPI驱动的ILI9341代码\spi_idev.h
目录 0 2018-01-09 13:06 STM32的硬件SPI驱动的ILI9341代码
----------- --------- ---------- ----- ----
67686 6
相关资源
- Spin-1目标的广义parton分布的多项式和
- 介子和S波氘核的四极矩以及对spin-1系
- 基于STM32F4x9的LCD显示
- 基于SPCE061A和PTR8000的模拟SPI总线通信
- VS1053B编解码器的VDR分布式声音采集卡
- stm32的DAC播放音乐文件
- 用8位spi实现16位spi
- linux SPI设备注册和驱动小结
- 用Verilog语言写的CPLD和MCU通讯的SPI接口
- STM32+TMC5160代码电路图.rar
- 基于STM32的深海钻机甲板控制系统
- stm32f103.SchDoc
- STM32F103 USART+DMA
- DMA+stm32 407.zip
- 4_USART串口通信(空闲中断+DMA.zip
- stm32f105-usart-DMA收发demo
- STM32F042F6P6 Uart12DMA;发送中断接收
- 基于STM32的嵌入式双目图像采集系统设
- 基于STM32F103C8单片机的晶联讯电子JL
- 基于STM32的温湿度检测系统实现
- stm32F4+w5300
- 14284969_《STM32单片机应用与全案例实践
-
ST-li
nk-V2的SWD仿真使用方法.docx - 安富莱STM32开发板资料
- Spirent iTest用户手册详细介绍iTest的各
- 精确结果为3d N $$ \\ mathcal {N} $$ = 2 S
- STM32F103实现OV7670摄像头显示
- STM32F207学习板例程
- 从Poincaré代数的闭合中得
- STM32F103VCT6TR - High-density performance lin
评论
共有 条评论