Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
PIN_GPIO通用驱动
touch_屏幕触摸
系统中断
touch驱动使能引脚中断无法触发
发布于 2025-04-21 11:13:20 浏览:94
订阅该版
```C static void touch(void *param) { struct rt_touch_data data[GT911_MAX_TOUCH]; rt_size_t point_num; static rt_uint32_t touch_count = 0; /* 查找触摸设备 */ touch_dev = rt_device_find("gt911"); rt_kprintf("flag1\n"); if (touch_dev == RT_NULL) { rt_kprintf("[GT911] Error: Touch device not found!\n"); return -1; } rt_kprintf("flag2\n"); /* 打开触摸设备 */ if (rt_touch_open(touch_dev, RT_DEVICE_FLAG_INT_RX) != RT_EOK) { rt_kprintf("[GT911] Error: Open device failed!\n"); return -1; } rt_kprintf("flag3\n"); rt_uint16_t x = 240; if (rt_touch_control(touch_dev, RT_TOUCH_CTRL_SET_X_RANGE, &x) != RT_EOK) { rt_kprintf("[GT911] Error: Set x failed!\n"); return -1; } rt_uint16_t y = 320; if (rt_touch_control(touch_dev, RT_TOUCH_CTRL_SET_Y_RANGE, &y) != RT_EOK) { rt_kprintf("[GT911] Error: Set y failed!\n"); return -1; } rt_kprintf("flag4\n"); // 信号量 touch_sem = rt_sem_create("tsem", 0, RT_IPC_FLAG_PRIO); if (touch_sem == RT_NULL) { LOG_E("create dynamic semaphore failed.\n"); } if (rt_device_set_rx_indicate(touch_dev, touch_handler) != RT_EOK) { rt_kprintf("[GT911] Error: Set int handler failed!\n"); } if (rt_touch_control(touch_dev, RT_TOUCH_CTRL_ENABLE_INT, RT_NULL) != RT_EOK) { rt_kprintf("[GT911] Error: Enable int failed!\n"); } /* 获取触摸屏信息 */ struct rt_touch_info info; if (rt_touch_control(touch_dev, RT_TOUCH_CTRL_GET_INFO, &info) != RT_EOK) { rt_kprintf("[GT911] Error: Get touch info failed!\n"); return -1; } rt_kprintf("\n[GT911] Touch screen test start\n"); rt_kprintf("type :%d\n", info.type); /* 类型:电容型/电阻型*/ rt_kprintf("vendor :%s\n", info.vendor); /* 厂商 */ rt_kprintf("point_num :%d\n", info.point_num); /* 支持的触点个数 */ rt_kprintf("range_x :%d\n", info.range_x); /* X 轴分辨率 */ rt_kprintf("range_y :%d\n", info.range_y); /* Y 轴分辨率*/ rt_kprintf("[GT911] Press any point to test, press ESC to exit\n\n"); gt911_thread = rt_thread_create("gt911", touch_callback, RT_NULL, 1024, 15, 10); if (gt911_thread != RT_NULL) { rt_thread_startup(gt911_thread); } //rt_touch_t touch_dev_1 = rt rt_touch_irq_init((rt_touch_t)touch_dev); rt_touch_irq_enable((rt_touch_t)touch_dev); return 0; } ``` 以上为我创建的测试触摸的线程入口函数,使用open和control都使能了引脚中断,甚至在结尾又使用rt_touch_irq_init再次初始化了引脚中断,但是这个中断仍无法触发,给中断引脚手动输入高低电平也无法触发。 跪求大佬指点迷津
查看更多
0
个回答
默认排序
按发布时间排序
暂无答案,快来添加答案吧
撰写答案
登录
注册新账号
关注者
0
被浏览
94
关于作者
DXJF_5992
这家伙很懒,什么也没写!
提问
2
回答
0
被采纳
0
关注TA
发私信
相关问题
1
在RTT下使用普通IO口模拟串口时序,如何才能做到不被系统干扰?
2
系统在什么时候开启中断
3
在系统初始化之前一定要关中断吗,如果中断开启,系统会紊乱吗?
4
rt-thread 定时器 HARD_TIMER 模式 中断
5
Rt-thread的系统中断在哪里开启
6
bug反馈:中断号有问题
7
在中断环境下进行线程的切换,from线程的R4-R11为何不保存
8
在操作系统的下,进入中断后,使用rt_interrupt_enter还是 关闭中断呢?
9
完成量的使用,rt_completion_done()函数可以在中断里调用吗?
10
RTThread-nano在C66xDSP上的移植问题
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
6
五分钟玩转RT-Thread新社区
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
睿擎工业开发平台--ModbusRTU_Master控制数字电阻应用
2
STM32F429 搭配 CherryUSB 实现 AIR780E 上网(RNDIS + lwIP)
3
睿擎工业开发平台--I2C1驱动AMP2301读取温湿度
4
睿擎平台RK3506使用总结
5
使用deepseek协助开发,基于RK3506睿擎派开发板读取传感器数据
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
Bootloader
AT
Hardfault
CAN总线
ART-Pi
FinSH
DMA
USB
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
FAL
RTC
rt-smart
I2C_IIC
UART
cubemx
BSP
ESP8266
PWM
ota在线升级
WIZnet_W5500
packages_软件包
flash
freemodbus
GD32
潘多拉开发板_Pandora
ADC
编译报错
keil_MDK
定时器
flashDB
ulog
socket
rt_mq_消息队列_msg_queue
msh
中断
Debug
SFUD
C++_cpp
at_device
本月问答贡献
踩姑娘的小蘑菇
6
个答案
3
次被采纳
加缪
9
个答案
1
次被采纳
RTT_逍遥
5
个答案
1
次被采纳
用户名由3_15位
5
个答案
1
次被采纳
Ryan_CW
4
个答案
1
次被采纳
本月文章贡献
纯白酱
2
篇文章
3
次点赞
530china
1
篇文章
7
次点赞
rv666
1
篇文章
7
次点赞
踩姑娘的小蘑菇
1
篇文章
3
次点赞
Lipiah
1
篇文章
3
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部