CubieBoard中文论坛

 找回密码
 立即注册
搜索
热搜: unable
查看: 5785|回复: 4

a33 按键驱动移植和管脚控制

[复制链接]
发表于 2016-3-9 19:43:12 | 显示全部楼层 |阅读模式
本帖最后由 xiaolonghun1 于 2016-3-9 19:50 编辑

http://www.cubie.cc/forum.php?mo ... =4229&highlight=a33
谢谢这个人把代码贴出来了。
我继续把他完善一下。
root@xiaolonghun-virtual-machine:/home/xiaolonghun/new_try/button1# make
make -C /home/xiaolonghun/new_try/lichee/linux-3.4  M=/home/xiaolonghun/new_try/button1 modules ARCH=arm CROSS_COMPILE=/home/xiaolonghun/usr/local/arm/4.6.3/bin/arm-linux-gnueabi-
make[1]: Entering directory `/home/xiaolonghun/new_try/lichee/linux-3.4'
  CC [M]  /home/xiaolonghun/new_try/button1/a33_button.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/xiaolonghun/new_try/button1/a33_button.mod.o
  LD [M]  /home/xiaolonghun/new_try/button1/a33_button.ko
make[1]: Leaving directory `/home/xiaolonghun/new_try/lichee/linux-3.4'
root@xiaolonghun-virtual-machine:/home/xiaolonghun/new_try/button1#
至少可以编译通过。




本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

 楼主| 发表于 2016-3-9 20:19:35 | 显示全部楼层
本帖最后由 xiaolonghun1 于 2016-3-9 20:26 编辑

LARDC0是什么管脚?这个貌似不是普通IO,怎么进行管脚赋值,这个是一个麻烦。还是一定要用adc数值才可以。



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复 支持 反对

使用道具 举报

 楼主| 发表于 2016-3-9 20:21:28 | 显示全部楼层
本帖最后由 xiaolonghun1 于 2016-3-10 08:52 编辑

LRADC0是什么管脚,这个好像只能够作为ad数值的输入,这下子普通的
按键中断测试好像不怎么行得通。
255|shell@astar-y3:/system/vendor/modules # insmod a33_button.ko
[   62.227604] the lcd is on work
[   62.231119] the major is on job
[   62.236983] the valid value is 1
[   62.240674] the irq value is 1
[   62.244087] the value of error is 0
shell@astar-y3:/system/vendor/modules # insmod a33_button.ko
insmod: init_module 'a33_button.ko' failed (File exists)
255|shell@astar-y3:/system/vendor/modules # rmmod a33_button
[   71.126937] the dev is unregister
[   71.130677] the lcd is off work
shell@astar-y3:/system/vendor/modules #
我报管脚改成了GPIOG(11)的,不知道是不是没有设置上拉或者输出的其他缘故,好像灯还是不亮
在模块加载的时候,管脚置为1,在模块移除的时候,管脚置为0.

回复 支持 反对

使用道具 举报

 楼主| 发表于 2016-3-10 15:45:37 | 显示全部楼层
xiaolonghun1 发表于 2016-3-9 20:21
LRADC0是什么管脚,这个好像只能够作为ad数值的输入,这下子普通的
按键中断测试好像不怎么行得通。
255|sh ...

gpio_direction_output 这个就可以了,不要使用这个gpio_set_value。
这样子就可以管脚控制了
在内核源代码/home/xiaolonghun/new_try/lichee/linux-3.4/drivers/input/keyboard# vim sunxi-keyboard.c
把他拖出来改改就好了。
回复 支持 反对

使用道具 举报

发表于 2016-3-11 10:38:14 | 显示全部楼层
LRADC0是个ADC输入引脚,通过不同的电平来判断按键具体是哪一个。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|粤ICP备13051116号|cubie.cc---深刻的嵌入式技术讨论社区

GMT+8, 2024-5-7 07:34 , Processed in 0.022315 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2012 Comsenz Inc. | Style by Coxxs

返回顶部