Firefly开源社区

How to control GPIO in Android application?

26

积分

0

威望

0

贡献

游客

积分
26
发表于 2015-9-9 16:10:05     
Hi,

I want to create android application that is able to control GPIO, LED, Serial port.
I've searched a lot but can't get enough of good solution.
The following is the programming path which I understand.

Android App (Java) ---> Android JNI ---> Android Native Code (C/C++) ---> ??? ---> Device Drivers

. How can I access the Device Drivers (GPIO, LED, Serial port) in Android Native C/C++ code?

. Do I need to modify or create existing device driver for using GPIO, LED, Serial port?

. Is there library provided to read/write specific resource like "/sys/class/gpio/gpio91/value"?

. Would you let me know how to access GPIO, LED, Serial port in Android App with sample source code or SDK?


Thanks.
回复

使用道具 举报

265

积分

5

威望

6

贡献

实习版主

Rank: 7Rank: 7Rank: 7

积分
265

活跃会员热心会员突出贡献

发表于 2015-9-9 16:14:56     
回复

使用道具 举报

26

积分

0

威望

0

贡献

游客

积分
26
发表于 2015-9-10 09:06:23     
thanks.

in your sample, how can I build luobogpio.c (driver) file and put luobogpio.o (maybe..) file into dev/luobogpio?
回复

使用道具 举报

265

积分

5

威望

6

贡献

实习版主

Rank: 7Rank: 7Rank: 7

积分
265

活跃会员热心会员突出贡献

发表于 2015-9-10 09:53:09     
本帖最后由 carlinluo 于 2015-9-10 10:16 编辑
zamster 发表于 2015-9-10 09:06
thanks.

in your sample, how can I build luobogpio.c (driver) file and put luobogpio.o (maybe..) f ...

http://wiki.t-firefly.com/index.php/Firefly-RK3288/Build_android
回复

使用道具 举报

26

积分

0

威望

0

贡献

游客

积分
26
发表于 2015-9-10 13:38:42     
I want to know how to build custom driver file. (not to build android sdk)
meaning of build custom driver file indicates that adding a new file (luobogpio.c into where?), modifying Makefile, creating object file, and so on.

still don't get it enough...
回复

使用道具 举报

13

积分

0

威望

0

贡献

游客

积分
13
发表于 2015-9-11 08:48:47     
Serial ------ demo ./base/tests/SerialChat/src/com/android/serialchat/SerialChat.java
gpoi  --------- usage  cd /sys/class/gpio&& echo 18 > export &&cd gpio18&echo out > direction &&echo 1 > value.
回复

使用道具 举报

13

积分

0

威望

0

贡献

游客

积分
13
发表于 2015-9-11 08:55:04     
you also need add chmod 0666  /sys/class/gpio* init.rc
add  ueventd.rc /sys/class/gpio/*             0666   root       root
回复

使用道具 举报

*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

友情链接 : 爱板网 电子发烧友论坛 云汉电子社区 粤ICP备14022046号-2
快速回复 返回顶部 返回列表