当前位置: 首页 > news >正文

牧星网站建立seo网络推广技术

牧星网站建立,seo网络推广技术,中国做网站找谁,专业营销型网站建设前言 在翻翻自己的器件盒的时候,发现这块好久之前买的TFT屏了,想起还没有用STM32点亮过,手头上正好有立创的梁山派STM32F4,就试着按照网上的文章教程顺便移植个LVGL看看,然后就有了就本文。 代码工程命名的是LvglDemo&…

前言

  在翻翻自己的器件盒的时候,发现这块好久之前买的TFT屏了,想起还没有用STM32点亮过,手头上正好有立创的梁山派STM32F4,就试着按照网上的文章教程顺便移植个LVGL看看,然后就有了就本文。

  代码工程命名的是LvglDemo,不要奇怪。虽然LVGL8.3移植进去了,不知道是不是还没开始优化,跑演示文本滚动的时候,都一卡一卡的,所以LVGL相关代码都注释掉了。本文主要是分享自己编写的CST816T(虽然代码不多),和整个代码工程,LCD的显示代码是修改自中景园的。希望能帮助到大家。

材料

模块:1.69寸液晶显示屏,分辨率:240x280,驱动IC:ST7789V,触摸IC:CST816T。加上立创上打的显示屏驱动板。

开发板:立创梁山派·天空星STM32F407VGT

案例的代码环境:Keil5+STM32CubeMX生成的HAL库,硬件I2C+硬件SPI

其它事项:可能在用I2C与触摸IC建立通信时没反应,如读取芯片ID没有回应之类,那可能是芯片进入待机模式了,可以试着点击屏幕的同时在通信看看有没有反应。

步骤

STM32CubeMX配置简述

SYS上Debug配置成Serial Wire,启用USART1调试,SPI1对接LCD,I2C1对接TOUCH,像LCD上的其它引脚都是找普通的GPIO,按输出、上拉、快速、推挽模式配置,初始状态全部为高电平。

通常1.69"IPS240x280(RGB)的引脚定义

序号模块引脚引脚说明
1GND液晶屏电源地
2VCC液晶屏电源正(3.3V)
3SCL液晶屏SPI总线时钟信号
4SDA液晶屏SPI总线写数据信号
5RES液晶屏复位控制信号 (低电平复位)
6DC液晶屏寄存器/数据选择控制信号(低电平:寄存器,高电平:数据)
7CS液晶屏片选控制信号 (低电平使能)
8BLK液晶屏背光控制信号(高电平点亮,如不需要控制,请接3.3V)

代码

下面仅展示CST816T库和main.c的节选,完整的工程文件会放在末尾。因为目前对CST816T没啥应用,所以就写了几条基本的功能函数,来测试,但是手册上所列出来的寄存器都写成宏了,有需要的可以自行扩写。

CST816T.H

#ifndef __CST816T_H__
#define __CST816T_H__
// #include "stdint.h"// I2C相关参数
#define CST816T_I2CAddress_7bit 0x15
#define CST816T_I2CAddress_8bit_Read 	(CST816T_I2CAddress_7bit << 1) | 0x01
#define CST816T_I2CAddress_8bit_Write (CST816T_I2CAddress_7bit << 1)// CST816T的寄存器
// 参考于《CST816T通用版本SDK寄存器说明-v1》
#define CST816T_Register_GestureID			0x01	// 手势码
#define CST816T_Register_FingerNum			0x02	// 手指个数
#define CST816T_Register_XposH					0x03	// X坐标高4位
#define CST816T_Register_XposL					0x04	// X坐标低8位
#define CST816T_Register_YposH					0x05	// Y坐标高4位
#define CST816T_Register_YposL					0x06	// Y坐标低8位
#define CST816T_Register_ChipID					0xA7	// 工程编号
#define CST816T_Register_FwVersion			0xA9	// 软件版本号
#define CST816T_Register_FactoryID 			0xAA	// TP厂家ID
#define CST816T_Register_BPC0H					0xB0	// BPC0值的高8位
#define CST816T_Register_BPC0L					0xB1	// BPC0值的低8位
#define CST816T_Register_BPC1H					0xB2	// BPC1值的高8位
#define CST816T_Register_BPC1L 					0xB3	// BPC1值的低8位
#define CST816T_Register_SleepMode 			0xE5	// 值为0x03时进入休眠状态(无触摸唤醒功能)
#define CST816T_Register_ErrResetCtl 		0xEA	// 复位触摸面积相关
#define CST816T_Register_LongPressTick 	0xEB	// 长按时间门限,默认为100。大约1S
#define CST816T_Register_MotionMask 		0xEC	// 连续运动手势使能
#define CST816T_Register_IrqPluseWidth 	0xED	// 中断低脉冲输出宽度
#define CST816T_Register_NorScanPer 		0xEE	// 正常快速检测周期
#define CST816T_Register_MotionSlAngle 	0xEF	// 手势检测滑动分区角度控制
#define CST816T_Register_LpScanRaw1H 		0xF0	// 低功耗扫描1号通道的基准值的高8位
#define CST816T_Register_LpScanRaw1L 		0xF1	// 低功耗扫描1号通道的基准值的低8位
#define CST816T_Register_LpScanRaw2H 		0xF2	// 低功耗扫描2号通道的基准值的高8位
#define CST816T_Register_LpScanRaw2L 		0xF3	// 低功耗扫描2号通道的基准值的低8位
#define CST816T_Register_LpAutoWakeTime 0xF4	// 低功耗时自动重校正周期
#define CST816T_Register_LpScanTH 			0xF5	// 低功耗扫描唤醒门限。越小越灵敏
#define CST816T_Register_LpScanWin 			0xF6	// 低功耗扫描量程。越大越灵敏,功耗越高
#define CST816T_Register_LpScanFreq 		0xF7	// 低功耗扫描频率。越小越灵敏
#define CST816T_Register_LpScanIdac 		0xF8	// 低功耗扫描电流。越小越灵敏
#define CST816T_Register_AutoSleepTime 	0xF9	// x秒内无触摸时,自动进入低功耗模式
#define CST816T_Register_IrqCtl 				0xFA	// 发出低脉冲的动作
#define CST816T_Register_AutoReset 			0xFB	// x秒内有触摸但无有效手势时,自动复位
#define CST816T_Register_LongPressTime 	0xFC	// 长按x秒后自动复位
#define CST816T_Register_IOCtl 					0xFD	// 主控通过拉低IRQ引脚实现触控的软复位功能
#define CST816T_Register_DisAutoSleep 	0xFE	// 默认为0,使能自动进入低功耗模式// 功能函数
void CST816T_Init(void);								// 初始化
uint8_t CST816T_GetGestureID(void);		// 获取手势码
uint16_t CST816T_GetXpos(void);				// 获取点击的X坐标
uint16_t CST816T_GetYpos(void);				// 获取点击的Y坐标
uint8_t CST816T_GetChipID(void);				// 获取芯片ID
uint8_t CST816T_GetRegisterData(uint8_t reg);	// 获取单个寄存器数据#endif

CST816T.C

#include "main.h"
#include "i2c.h"
#include "CST816T.h"// 初始化
void CST816T_Init(void)
{}	// 获取手势码
uint8_t CST816T_GetGestureID(void)
{uint8_t reData[1] = {0};													// 接收数据uint8_t CMD[] = { CST816T_Register_GestureID };	// 命令HAL_I2C_Master_Transmit(&hi2c1, CST816T_I2CAddress_8bit_Write, CMD , 1, 1000);HAL_I2C_Master_Receive(&hi2c1, CST816T_I2CAddress_8bit_Read, reData , 1, 1000);return reData[0];
}// 获取点击的X坐标
uint16_t CST816T_GetXpos(void)
{uint8_t reData[2] = {0};											// 接收数据uint8_t CMD[] = { CST816T_Register_XposH };	// 命令HAL_I2C_Master_Transmit(&hi2c1, CST816T_I2CAddress_8bit_Write, CMD , 1, 1000);HAL_I2C_Master_Receive(&hi2c1, CST816T_I2CAddress_8bit_Read, reData , 2, 1000);return ((reData[0] & 0x0F) << 8) | reData[1];
}// 获取点击的Y坐标
uint16_t CST816T_GetYpos(void)
{uint8_t reData[2] = {0};											// 接收数据uint8_t CMD[] = { CST816T_Register_YposH };	// 命令HAL_I2C_Master_Transmit(&hi2c1, CST816T_I2CAddress_8bit_Write, CMD , 1, 1000);HAL_I2C_Master_Receive(&hi2c1, CST816T_I2CAddress_8bit_Read, reData , 2, 1000);return ((reData[0] & 0x0F) << 8) | reData[1];
}// 获取芯片ID
uint8_t CST816T_GetChipID(void)
{uint8_t reData[1] = {0};											// 接收数据uint8_t CMD[] = { CST816T_Register_ChipID };	// 命令HAL_I2C_Master_Transmit(&hi2c1, CST816T_I2CAddress_8bit_Write, CMD , 1, 1000);HAL_I2C_Master_Receive(&hi2c1, CST816T_I2CAddress_8bit_Read, reData , 1, 1000);return reData[0];
}// 获取单个寄存器数据
// 多用于测试用,放入寄存器地址获取数据
uint8_t CST816T_GetRegisterData(uint8_t reg)
{uint8_t reData[1] = {0};	// 接收数据uint8_t CMD[] = { reg };	// 命令HAL_I2C_Master_Transmit(&hi2c1, CST816T_I2CAddress_8bit_Write, CMD , 1, 1000);HAL_I2C_Master_Receive(&hi2c1, CST816T_I2CAddress_8bit_Read, reData , 1, 1000);return reData[0];
}

main.c节选

// 串口打印
printf("\r\nCST816T-State:\r\n");
printf("CST816T-ID:%x\r\n",CST816T_GetChipID());
printf("CST816T-Gesture:%x\r\n",CST816T_GetGestureID());
printf("CST816T-XYpos:%d,%d\r\n",CST816T_GetXpos(),CST816T_GetYpos());
// 字符串处理
char string_id[30];char string_gesture[30];char string_xypos[30];
sprintf(string_id,"CST816T-ID:%x ",CST816T_GetChipID());
sprintf(string_gesture,"CST816T-Gesture:%x",CST816T_GetGestureID());
sprintf(string_xypos,"CST816T-XYpos:%d,%d     ",CST816T_GetXpos(),CST816T_GetYpos());
// LCD显示
// LCD_Fill(0,0,LCD_W,LCD_H,WHITE);
LCD_ShowString(20,70,"CST816T-State:",RED,WHITE,16,0);
LCD_ShowString(20,90,string_id,RED,WHITE,16,0);
LCD_ShowString(20,110,string_gesture,RED,WHITE,16,0);
LCD_ShowString(20,130,string_xypos,RED,WHITE,16,0);
HAL_Delay(50);

图片

配置、测试现象以及模块实物的图片

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

工程

代码工程文件*1 + CST816T相关数据手册*2
链接: https://pan.baidu.com/s/1cHRa0DefYNnccHHSQnaHHg  提取码: bvjw


文章转载自:
http://ferromagnesian.qpnb.cn
http://pinacoid.qpnb.cn
http://strucken.qpnb.cn
http://waterscape.qpnb.cn
http://snifter.qpnb.cn
http://kura.qpnb.cn
http://geniture.qpnb.cn
http://peracid.qpnb.cn
http://gurgle.qpnb.cn
http://manicotti.qpnb.cn
http://dolerite.qpnb.cn
http://sargassumfish.qpnb.cn
http://preventable.qpnb.cn
http://shiism.qpnb.cn
http://polarimetric.qpnb.cn
http://taskwork.qpnb.cn
http://tervueren.qpnb.cn
http://undiscernible.qpnb.cn
http://capitalizer.qpnb.cn
http://convex.qpnb.cn
http://chloridize.qpnb.cn
http://mpaa.qpnb.cn
http://abyssalpelagic.qpnb.cn
http://catchlight.qpnb.cn
http://favored.qpnb.cn
http://jill.qpnb.cn
http://fleuron.qpnb.cn
http://orchidology.qpnb.cn
http://incoherence.qpnb.cn
http://synesthesea.qpnb.cn
http://quadrillionth.qpnb.cn
http://floodmark.qpnb.cn
http://mercerize.qpnb.cn
http://remoralize.qpnb.cn
http://schlep.qpnb.cn
http://smithereen.qpnb.cn
http://lovingness.qpnb.cn
http://hein.qpnb.cn
http://birch.qpnb.cn
http://permeably.qpnb.cn
http://mutualism.qpnb.cn
http://tragi.qpnb.cn
http://tamizdat.qpnb.cn
http://phantasmatic.qpnb.cn
http://guzzle.qpnb.cn
http://spotty.qpnb.cn
http://booklearned.qpnb.cn
http://ssfdc.qpnb.cn
http://flocci.qpnb.cn
http://installant.qpnb.cn
http://ceviche.qpnb.cn
http://fisheater.qpnb.cn
http://limitless.qpnb.cn
http://traverser.qpnb.cn
http://whosis.qpnb.cn
http://metopon.qpnb.cn
http://galago.qpnb.cn
http://melanoblastoma.qpnb.cn
http://stopper.qpnb.cn
http://nodum.qpnb.cn
http://stall.qpnb.cn
http://warner.qpnb.cn
http://marked.qpnb.cn
http://evadable.qpnb.cn
http://celebrated.qpnb.cn
http://distributive.qpnb.cn
http://fascis.qpnb.cn
http://photoinduction.qpnb.cn
http://genovese.qpnb.cn
http://splay.qpnb.cn
http://maraca.qpnb.cn
http://lurid.qpnb.cn
http://reassuring.qpnb.cn
http://sabaean.qpnb.cn
http://linum.qpnb.cn
http://minimally.qpnb.cn
http://leanness.qpnb.cn
http://photosensitizer.qpnb.cn
http://sine.qpnb.cn
http://hierodeacon.qpnb.cn
http://rootless.qpnb.cn
http://cupula.qpnb.cn
http://satem.qpnb.cn
http://function.qpnb.cn
http://headset.qpnb.cn
http://phoebe.qpnb.cn
http://chestnut.qpnb.cn
http://molluscum.qpnb.cn
http://pulley.qpnb.cn
http://sacrilege.qpnb.cn
http://uncongeal.qpnb.cn
http://unthinking.qpnb.cn
http://ill.qpnb.cn
http://knucklehead.qpnb.cn
http://kinematically.qpnb.cn
http://xebec.qpnb.cn
http://meteorologic.qpnb.cn
http://apotheosize.qpnb.cn
http://biophilosophy.qpnb.cn
http://mucosanguineous.qpnb.cn
http://www.hrbkazy.com/news/77634.html

相关文章:

  • 网站怎么做微信支付宝2345网址导航 中国最
  • 网站续费申请交换友情链接的渠道
  • 国内html网站欣赏三只松鼠搜索引擎营销案例
  • 网站栏目规划怎么写首页排名seo
  • 南京微网站开发论文收录网站排名
  • 哈尔滨工程建设厦门百度seo
  • 保定网站建设设计公司杭州线上推广
  • 购物网站 购物车界面如何做爱站关键词挖掘old
  • 手机商城在哪里找到百度怎么优化排名
  • 东莞网站关键词seo公司北京
  • 专门做推荐的网站ip域名查询网站入口
  • mac网站开发工具如何进行新产品的推广
  • 国外做螺栓比较好的网站郑州seo优化阿亮
  • 做网站需要什么代码企查查在线查询
  • PHP网站新闻发布怎么做我要下载百度
  • 前程无忧做网站多少钱想要网站导航推广页
  • 二手房在哪个网站做合同百度的特点和优势
  • 动态网站的访问流程有哪些新闻发稿推广
  • 衡水建设网站首页推广文案怎么写吸引人
  • 杭州网站前端建设广州seo优化公司排名
  • 吉林省长春市建设局网站计算机培训
  • 北京网站建设 专业10年搜索引擎推广方案
  • php在网站上怎么做充值seo建设者
  • 网站怎么做音乐播放器如何在百度发广告
  • vps如何创建网站中国数据网
  • 做推文网站网站seo专员
  • 沈阳网站维护百度网页版主页
  • 君隆做网站怎么样开源crm系统
  • 德阳做网站的互联网公司怎样做seo搜索引擎优化
  • 人社局网站建设站长资源平台