资源简介
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
- 上一篇:BCM5892芯片Datasheet
- 下一篇:液体点滴智能监控系统的研究与设计
相关资源
- TP_msg2238.rar
- Altium PCB元件库
- onenet_http_上传温湿度
- LastProject2.zip
- Xlight Ftp服务器
- PrimeTime- PX user guide 2016
- Leela Zero 0.16 + AutoGTP v17 CPU版本 无需显
- ctpcode.rar
-
TP-li
nk WR840N V2和TP-li nk WR841N V8互刷 - apache-httpd-2.2.24-x64-openssl安装版 msi安装
- TP_841N_V7__4M编程器固件
- httpd-2.2.22-win32-x86-openssl-0.9.8t.msi
- FTP批量扫描工具,不是黑帽,SEO必备
- httpd-2.4.9.tar.gz
- 实验六 Linux中的网络服务一
- httpd-2.2.3.tar.gz
- matpower5.0
- ContentProvider访问通信录中的联系人和
- 基于IOCP的简单HTTP,与通用服务开发框
- sp370用户编程手册
- SP40编程器使用手册
- FTP图片上传
- Qt属性表控件-QtPropertyBrowser
- ttp226触摸感应芯片51程序
- FTP服务器源码大全
- STM32驱动W5100实现http的网页浏览
- httpclient-4.5.3 api 中文版
- IdHTTPServer+utf8转换+json解析
- atpdraw5.7安装软件
- 校园网双核心MSTP+VRRP的拓扑实现和配
评论
共有 条评论