资源简介
1、代码为个人原创,基于MH1902通过GPIO模拟IIC获取TP的坐标;
2、包含TP相关寄存器的详细文档资料;
3、TP先由AP端控制,当适用于特定用途时,由SP接管TP完成相对应的工作,最终再交给AP端控制;
代码片段和文件信息
#define EXT_CTP_GLOBALS
#include “common.h“
#include “mhscpu_exti.h“
#include “mhscpu_gpio.h“
#include “si2c_delay.h“
#include “simulation_i2c.h“
#include “softtimer.h“
#include “ctp.h“
enum pinkey_type {
PINKEY_NUMBER = 1
PINKEY_ENTER = 3
PINKEY_CANCEL = 4
PINKEY_CLEAR = 7
};
enum button_no {
BUTTON_CANCEL = 10
BUTTON_CLEAR = 11
BUTTON_ENTER = 12
};
#define isNumber(no) ((no) <= 9) // unsigned char is >= 0 so compare with 9 only
#define isCancel(no) ((no) == BUTTON_CANCEL)
#define isClear(no) ((no) == BUTTON_CLEAR)
#define isEnter(no) ((no) == BUTTON_ENTER)
/*
* Note.
* Please do not change the below setting.
* there are 13 buttons accordding to the pinblock layout
* so do not change it.
*/
#define PIN_BUTTON_MAX 13
struct button_info {
unsigned char b_no;
unsigned short x1;
unsigned short y1;
unsigned short x2;
unsigned short y2;
};
/*
* touch screen supports 2 points at most
* but here use one point only.
*/
#define TPD_SUPPORT_POINTS 2
struct xy_info {
unsigned short x[TPD_SUPPORT_POINTS];
unsigned short y[TPD_SUPPORT_POINTS];
unsigned char p[TPD_SUPPORT_POINTS];
unsigned char id[TPD_SUPPORT_POINTS];
unsigned short count;
};
struct ctp_dev {
unsigned char slave_addr;
unsigned int touch_cnt;
unsigned int b_cnt;
unsigned int min_len;
unsigned int max_len;
unsigned short timer_id;
int irq;
unsigned int ext_int_line;
unsigned int irq_gpio;
unsigned int reset_gpio;
GPIO_TypeDef *port;
unsigned int circ_size;
struct xy_info t_info;
struct button_info b_table[PIN_BUTTON_MAX];
struct _strRecvPack pin_block_info;
struct circ_buf circ;
struct __TIMER timer;
int (*init)(struct ctp_dev *ctp);
void (*timerstart)(struct ctp_dev *ctp);
void (*timerstop)(struct ctp_dev *ctp);
void (*reset_circ_buf)(struct ctp_dev *ctp);
void (*release_button)(struct ctp_dev *ctp);
int (*get_xy)(struct ctp_dev *ctp);
};
static unsigned char g_key_buf[32] = {0};
static void CTPINT_GPIO_Configuration(struct ctp_dev *ctp)
{
GPIO_InitTypeDef GPIO_InitStruct;
NVIC_InitTypeDef NVIC_InitStructure;
GPIO_InitStruct.GPIO_Pin = ctp->irq_gpio;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_InitStruct.GPIO_Remap = GPIO_Remap_1;
GPIO_Init(ctp->port &GPIO_InitStruct);
GPIO_InitStruct.GPIO_Pin = ctp->reset_gpio;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStruct.GPIO_Remap = GPIO_Remap_1;
GPIO_Init(ctp->port &GPIO_InitStruct);
GPIO_SetBits(ctp->port GPIO_InitStruct.GPIO_Pin);
NVIC_SetPriorityGrouping(NVIC_PriorityGroup_3);
EXTI_DeInit();
NVIC_InitStructure.NVIC_IRQChannel = ctp->irq;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 3;
NVIC_InitStructure.NVIC_IRQChannelSubPriority =
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 192907 2018-11-09 14:10 FT6336\AN_CTPM_Standard_eng——new.pdf
文件 984619 2018-11-09 14:17 FT6336\FT5x46i_FT34x7_Firmware 外部寄存器 (20160123).pdf
文件 25388 2018-11-09 11:34 FT6336\Ft6336GU_Firmware 外部寄存器_20151112.xlsx
文件 1172691 2018-11-09 14:09 FT6336\FTS IC 上电时序要求.pdf
文件 12517 2018-11-14 17:55 FT6336\i2c\ctp.c
文件 531 2018-11-14 17:56 FT6336\i2c\ctp.h
文件 3070 2018-11-14 17:57 FT6336\i2c\si2c_delay.c
文件 942 2018-11-14 17:58 FT6336\i2c\si2c_delay.h
文件 14319 2018-11-14 17:59 FT6336\i2c\simulation_i2c.c
文件 1483 2018-11-14 18:00 FT6336\i2c\simulation_i2c.h
文件 5365 2018-11-14 18:01 FT6336\i2c\SoftTimer.c
文件 1049 2018-11-14 18:02 FT6336\i2c\SoftTimer.h
文件 1477 2018-11-09 11:34 FT6336\TXDT500WYPA_ILI9881P_LD050HF1L02_Column_4lane_20170919.txt
目录 0 2018-11-14 18:02 FT6336\i2c
目录 0 2018-11-14 17:41 FT6336
----------- --------- ---------- ----- ----
2416358 15
- 上一篇:科沃兹导航VK162 VK172模块驱动.rar
- 下一篇:W-代数的伽利略收缩
相关资源
- MT6771T_LTE-A_Smartphone_Application_Processor
- 通用数据传输平台GTP
- 基于GTP修正的R3DGM建模与可视化方法
- 一个简单方便的服务端ftp搭建工具
- 20cn的ftp服务器超好用 简洁
- 最好用的FTP服务器
-
notepad++包含xm
l tools等插件 - MTP USB驱动win7 32+64位可用版
- 烽火网络外置式MSTP解决方案在河北宽
- Post Processing Profiles 3.1
- 戴尔dell TP713无线触摸板驱动 v1.0 官网
-
tp-li
nk tl-pa201 电线网络适配器应用程 - CuteFTP8.0绿色破解版免安装无需序列号
- PSFTP.EXE 工具
- CuteFTP8.0简体中文破解版
- TPG图片转换器V1.0绿色免费版
- 由AT91M55800A和MC68HC908RF2构成的TPMS
- 北洋BTP-M280B打印机驱动 v1.41 官方最新
- ICOFormatphotoshop制作ico图标插件
- Wing FTP Server FTP服务器 v6.1.9
- tp路由器管理员密码config.bin解密
- http协议rfc2616中英文双版
- 易语言绵绵FTP网络验证操作模块源码
- httpclient4.3工具类
- 在QT中使用RTP进行视频的采集和传输
- 流媒体相关协议标准RTP/RTSP/RTCP PDF文档
- MTP设备驱动安装失败修复工具.zip
- 西门子TP1200触屏使用说明书
- 地址转化器 迅雷,电驴,网盘,快车
- apache-httpd2.5安装及配置(包含教程及
评论
共有 条评论