Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2301_76519099
rt-thread
提交
f82705db
R
rt-thread
项目概览
2301_76519099
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
3
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f82705db
编写于
7月 23, 2022
作者:
还_没_想_好
提交者:
GitHub
7月 23, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[touch] 调整触摸头文件至 rtdevice.h 中 (#6180)
上级
1008a770
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
119 addition
and
103 deletion
+119
-103
components/drivers/include/drivers/touch.h
components/drivers/include/drivers/touch.h
+115
-0
components/drivers/include/rtdevice.h
components/drivers/include/rtdevice.h
+4
-0
components/drivers/touch/touch.h
components/drivers/touch/touch.h
+0
-103
未找到文件。
components/drivers/include/drivers/touch.h
0 → 100644
浏览文件 @
f82705db
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2019-05-20 tyustli the first version
*/
#ifndef __TOUCH_H__
#define __TOUCH_H__
#include <rtthread.h>
#include "pin.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#ifdef RT_USING_RTC
#define rt_touch_get_ts() time(RT_NULL)
/* API for the touch to get the timestamp */
#else
#define rt_touch_get_ts() rt_tick_get()
/* API for the touch to get the timestamp */
#endif
#define RT_PIN_NONE 0xFFFF
/* RT PIN NONE */
/* Touch vendor types */
#define RT_TOUCH_VENDOR_UNKNOWN (0)
/* unknown */
#define RT_TOUCH_VENDOR_GT (1)
/* GTxx series */
#define RT_TOUCH_VENDOR_FT (2)
/* FTxx series */
/* Touch ic type*/
#define RT_TOUCH_TYPE_NONE (0)
/* touch ic none */
#define RT_TOUCH_TYPE_CAPACITANCE (1)
/* capacitance ic */
#define RT_TOUCH_TYPE_RESISTANCE (2)
/* resistance ic */
/* Touch control cmd types */
#define RT_TOUCH_CTRL_GET_ID (RT_DEVICE_CTRL_BASE(Touch) + 0)
/* Get device id */
#define RT_TOUCH_CTRL_GET_INFO (RT_DEVICE_CTRL_BASE(Touch) + 1)
/* Get touch info */
#define RT_TOUCH_CTRL_SET_MODE (RT_DEVICE_CTRL_BASE(Touch) + 2)
/* Set touch's work mode. ex. RT_TOUCH_MODE_POLLING,RT_TOUCH_MODE_INT */
#define RT_TOUCH_CTRL_SET_X_RANGE (RT_DEVICE_CTRL_BASE(Touch) + 3)
/* Set x coordinate range */
#define RT_TOUCH_CTRL_SET_Y_RANGE (RT_DEVICE_CTRL_BASE(Touch) + 4)
/* Set y coordinate range */
#define RT_TOUCH_CTRL_SET_X_TO_Y (RT_DEVICE_CTRL_BASE(Touch) + 5)
/* Set X Y coordinate exchange */
#define RT_TOUCH_CTRL_DISABLE_INT (RT_DEVICE_CTRL_BASE(Touch) + 6)
/* Disable interrupt */
#define RT_TOUCH_CTRL_ENABLE_INT (RT_DEVICE_CTRL_BASE(Touch) + 7)
/* Enable interrupt */
#define RT_TOUCH_CTRL_POWER_ON (RT_DEVICE_CTRL_BASE(Touch) + 8)
/* Touch Power On */
#define RT_TOUCH_CTRL_POWER_OFF (RT_DEVICE_CTRL_BASE(Touch) + 9)
/* Touch Power Off */
#define RT_TOUCH_CTRL_GET_STATUS (RT_DEVICE_CTRL_BASE(Touch) + 10)
/* Get Touch Power Status */
/* Touch event */
#define RT_TOUCH_EVENT_NONE (0)
/* Touch none */
#define RT_TOUCH_EVENT_UP (1)
/* Touch up event */
#define RT_TOUCH_EVENT_DOWN (2)
/* Touch down event */
#define RT_TOUCH_EVENT_MOVE (3)
/* Touch move event */
struct
rt_touch_info
{
rt_uint8_t
type
;
/* The touch type */
rt_uint8_t
vendor
;
/* Vendor of touchs */
rt_uint8_t
point_num
;
/* Support point num */
rt_int32_t
range_x
;
/* X coordinate range */
rt_int32_t
range_y
;
/* Y coordinate range */
};
struct
rt_touch_config
{
#ifdef RT_TOUCH_PIN_IRQ
struct
rt_device_pin_mode
irq_pin
;
/* Interrupt pin, The purpose of this pin is to notification read data */
#endif
char
*
dev_name
;
/* The name of the communication device */
void
*
user_data
;
};
typedef
struct
rt_touch_device
*
rt_touch_t
;
struct
rt_touch_device
{
struct
rt_device
parent
;
/* The standard device */
struct
rt_touch_info
info
;
/* The touch info data */
struct
rt_touch_config
config
;
/* The touch config data */
const
struct
rt_touch_ops
*
ops
;
/* The touch ops */
rt_err_t
(
*
irq_handle
)(
rt_touch_t
touch
);
/* Called when an interrupt is generated, registered by the driver */
};
struct
rt_touch_data
{
rt_uint8_t
event
;
/* The touch event of the data */
rt_uint8_t
track_id
;
/* Track id of point */
rt_uint8_t
width
;
/* Point of width */
rt_uint16_t
x_coordinate
;
/* Point of x coordinate */
rt_uint16_t
y_coordinate
;
/* Point of y coordinate */
rt_tick_t
timestamp
;
/* The timestamp when the data was received */
};
struct
rt_touch_ops
{
rt_size_t
(
*
touch_readpoint
)(
struct
rt_touch_device
*
touch
,
void
*
buf
,
rt_size_t
touch_num
);
rt_err_t
(
*
touch_control
)(
struct
rt_touch_device
*
touch
,
int
cmd
,
void
*
arg
);
};
int
rt_hw_touch_register
(
rt_touch_t
touch
,
const
char
*
name
,
rt_uint32_t
flag
,
void
*
data
);
/* if you doesn't use pin device. you must call this function in your touch irq callback */
void
rt_hw_touch_isr
(
rt_touch_t
touch
);
#ifdef __cplusplus
}
#endif
#endif
/* __TOUCH_H__ */
components/drivers/include/rtdevice.h
浏览文件 @
f82705db
...
...
@@ -153,6 +153,10 @@ extern "C" {
#include "drivers/rt_inputcapture.h"
#endif
/* RT_USING_INPUT_CAPTURE */
#ifdef RT_USING_TOUCH
#include "drivers/touch.h"
#endif
#ifdef __cplusplus
}
#endif
...
...
components/drivers/touch/touch.h
浏览文件 @
f82705db
...
...
@@ -8,108 +8,5 @@
* 2019-05-20 tyustli the first version
*/
#ifndef __TOUCH_H__
#define __TOUCH_H__
#include <rtthread.h>
#include <rtdevice.h>
#ifdef __cplusplus
extern
"C"
{
#endif
#ifdef RT_USING_RTC
#define rt_touch_get_ts() time(RT_NULL)
/* API for the touch to get the timestamp */
#else
#define rt_touch_get_ts() rt_tick_get()
/* API for the touch to get the timestamp */
#endif
#define RT_PIN_NONE 0xFFFF
/* RT PIN NONE */
/* Touch vendor types */
#define RT_TOUCH_VENDOR_UNKNOWN (0)
/* unknown */
#define RT_TOUCH_VENDOR_GT (1)
/* GTxx series */
#define RT_TOUCH_VENDOR_FT (2)
/* FTxx series */
/* Touch ic type*/
#define RT_TOUCH_TYPE_NONE (0)
/* touch ic none */
#define RT_TOUCH_TYPE_CAPACITANCE (1)
/* capacitance ic */
#define RT_TOUCH_TYPE_RESISTANCE (2)
/* resistance ic */
/* Touch control cmd types */
#define RT_TOUCH_CTRL_GET_ID (RT_DEVICE_CTRL_BASE(Touch) + 0)
/* Get device id */
#define RT_TOUCH_CTRL_GET_INFO (RT_DEVICE_CTRL_BASE(Touch) + 1)
/* Get touch info */
#define RT_TOUCH_CTRL_SET_MODE (RT_DEVICE_CTRL_BASE(Touch) + 2)
/* Set touch's work mode. ex. RT_TOUCH_MODE_POLLING,RT_TOUCH_MODE_INT */
#define RT_TOUCH_CTRL_SET_X_RANGE (RT_DEVICE_CTRL_BASE(Touch) + 3)
/* Set x coordinate range */
#define RT_TOUCH_CTRL_SET_Y_RANGE (RT_DEVICE_CTRL_BASE(Touch) + 4)
/* Set y coordinate range */
#define RT_TOUCH_CTRL_SET_X_TO_Y (RT_DEVICE_CTRL_BASE(Touch) + 5)
/* Set X Y coordinate exchange */
#define RT_TOUCH_CTRL_DISABLE_INT (RT_DEVICE_CTRL_BASE(Touch) + 6)
/* Disable interrupt */
#define RT_TOUCH_CTRL_ENABLE_INT (RT_DEVICE_CTRL_BASE(Touch) + 7)
/* Enable interrupt */
#define RT_TOUCH_CTRL_POWER_ON (RT_DEVICE_CTRL_BASE(Touch) + 8)
/* Touch Power On */
#define RT_TOUCH_CTRL_POWER_OFF (RT_DEVICE_CTRL_BASE(Touch) + 9)
/* Touch Power Off */
#define RT_TOUCH_CTRL_GET_STATUS (RT_DEVICE_CTRL_BASE(Touch) + 10)
/* Get Touch Power Status */
/* Touch event */
#define RT_TOUCH_EVENT_NONE (0)
/* Touch none */
#define RT_TOUCH_EVENT_UP (1)
/* Touch up event */
#define RT_TOUCH_EVENT_DOWN (2)
/* Touch down event */
#define RT_TOUCH_EVENT_MOVE (3)
/* Touch move event */
struct
rt_touch_info
{
rt_uint8_t
type
;
/* The touch type */
rt_uint8_t
vendor
;
/* Vendor of touchs */
rt_uint8_t
point_num
;
/* Support point num */
rt_int32_t
range_x
;
/* X coordinate range */
rt_int32_t
range_y
;
/* Y coordinate range */
};
struct
rt_touch_config
{
#ifdef RT_TOUCH_PIN_IRQ
struct
rt_device_pin_mode
irq_pin
;
/* Interrupt pin, The purpose of this pin is to notification read data */
#endif
char
*
dev_name
;
/* The name of the communication device */
void
*
user_data
;
};
typedef
struct
rt_touch_device
*
rt_touch_t
;
struct
rt_touch_device
{
struct
rt_device
parent
;
/* The standard device */
struct
rt_touch_info
info
;
/* The touch info data */
struct
rt_touch_config
config
;
/* The touch config data */
const
struct
rt_touch_ops
*
ops
;
/* The touch ops */
rt_err_t
(
*
irq_handle
)(
rt_touch_t
touch
);
/* Called when an interrupt is generated, registered by the driver */
};
struct
rt_touch_data
{
rt_uint8_t
event
;
/* The touch event of the data */
rt_uint8_t
track_id
;
/* Track id of point */
rt_uint8_t
width
;
/* Point of width */
rt_uint16_t
x_coordinate
;
/* Point of x coordinate */
rt_uint16_t
y_coordinate
;
/* Point of y coordinate */
rt_tick_t
timestamp
;
/* The timestamp when the data was received */
};
struct
rt_touch_ops
{
rt_size_t
(
*
touch_readpoint
)(
struct
rt_touch_device
*
touch
,
void
*
buf
,
rt_size_t
touch_num
);
rt_err_t
(
*
touch_control
)(
struct
rt_touch_device
*
touch
,
int
cmd
,
void
*
arg
);
};
int
rt_hw_touch_register
(
rt_touch_t
touch
,
const
char
*
name
,
rt_uint32_t
flag
,
void
*
data
);
/* if you doesn't use pin device. you must call this function in your touch irq callback */
void
rt_hw_touch_isr
(
rt_touch_t
touch
);
#ifdef __cplusplus
}
#endif
#endif
/* __TOUCH_H__ */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录