使用 C++ 处理 GPIO 按钮事件 [英] Handle GPIO Button event with C++

查看:32
本文介绍了使用 C++ 处理 GPIO 按钮事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我需要一些帮助.我正在 ARM 中制作一个 C++ 嵌入式应用程序.我需要获得一个按钮事件,我一直在互联网上寻找,我发现最好的方法是中断.我知道我可以像这样通过终端设置一个引脚echo raise >/sys/.../gpio/gpio81/edge".但是我需要知道如何在发生中断时从我的 C++ 应用程序中获取中断,我只需要一些示例,因为我不知道是否必须使用某些特殊库.

Hi guys I need some help. I am making a c++ embedded application in an ARM. I need to get a push button event, I was looking for in internet and I find that the best way to do it is with interruptions. I know that I can set one pin through terminal like this "echo raise > /sys/.../gpio/gpio81/edge". But I need to know how can I get the interrupt from my C++ application when it happend, I just need some example, because I do not know if I have to use some special library.

谢谢你们,我希望有人能帮助我.

Thank you guys I hope someone can help me.

推荐答案

大家好,我找到了我想要的解决方案:

Hi guys I find the solution what I just wanted is here:

https://developer.ridgerun.com/wiki/index.php/Gpio-int-test.c

还是谢谢你

这篇关于使用 C++ 处理 GPIO 按钮事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆