(盈鹏飞嵌入式T113-S4主板)-Tina5.0系统按键测试

SBC-T113S产品特性:

  • 采用Allwinner公司Cortex-A7双核T113-S3/S4处理器,运行最高速度为1.2GHZ;
  • 内置64-bit XuanTie C906 RISC-V协处理器(仅T113-S4支持);
  • 支持JPEG/MJPEG视频编码,最大分辨率1080p@60fps;支持多格式1080P@60fps视频解码 (H.265,H.264, MPEG-1/2/4);
  • 支持RGB666/LVDS/MIPI-DSI,分辨率最高1920x1080;
  • 支持128-256M Bytes DDR3 SDRAM,其中T113-S3内置128MB;T113-S4内置256MB;
  • 支持SPI NAND存储和启动(默认:256MB)或者EMMC启动(默认:4GB,最大32GB);
  • 支持一路USB2.0 OTG(设计为TYPE-A接口);支持二路USB2.0 HOST;
  • 支持七路RS232通信或者6路RS232和1路RS485(非隔离);
  • 支持一路CAN BUS通信(非隔离);
  • 支持一路10/100M以太网;
  • 稳定的操作系统的支持,可预装LINUX 5.4(Preempt)或者OpenWRT;
  • 经典尺寸主板,尺寸为120*100MM;

SBC-T113S产品功能评估图: 

按键:

SBC-T113S主板一共有3个按键,其中一个是固件升级按键SW4(MASKROM);SW3 是User按键;SW1是复位键,这些按键在主板的位置如下:

固件升级按键是固件升级时使用;复位按键是需要主板热复位时使用;只有SW3是用户按键,该按键是由T113-S3/S4处理器内部的GPADC实现,可通过软件进行测试验证。

Linux的/dev/input/eventx 设备节点可以用来方便地调试鼠标、键盘、触摸板、按键等输入设备。本节主要是测试按键设备。通过evtest命令来查看按键是否有反应。

  • 查看输入设备event和设备的对应关系,指令如下:
cat /proc/bus/input/devices

  指令执行结果如下:

root@T113-Embfly:~# cat /proc/bus/input/devices
I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="sunxi-ts"
P: Phys=sunxi_ts/input0
S: Sysfs=/devices/platform/soc@3000000/2009c00.rtp/input/input1
U: Uniq=
H: Handlers=event1
B: PROP=0
B: EV=b
B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: ABS=3

I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="sunxi-gpadc0"
P: Phys=sunxigpadc0/input0
S: Sysfs=/devices/virtual/input/input2
U: Uniq=
H: Handlers=kbd event2
B: PROP=0
B: EV=100003
B: KEY=c0000 0 0 0

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="audiocodec sunxi Audio Jack"
P: Phys=ALSA
S: Sysfs=/devices/platform/soc@3000000/2030340.sound/sound/card0/input3
U: Uniq=
H: Handlers=kbd event3
B: PROP=0
B: EV=23
B: KEY=40 0 0 0 0 0 0 0 0 0 0 4 0 0 0 c0000 0 0 0
B: SW=14

SW3是由GPADC实现的,它的设备名字是"sunxi-gpadc0",根据以上信息可以得出,它对应的事件号是event2。

GPADC可以实现5个键盘,硬件原理图如下:

图12 GPADC按键实现原理图 

对应的sunxi-gpadc0的设备树信息如下,从信息中我们可以看到key0_vol = <210>,这个和按键SW3按键对应,当SW3按下时,GPADC能够采集的电压是0.21V;key1_vol = <410>;这个和原理图中的SW4按键对应,当SW4按下时,GPADC能够采集的电压是0.41V;其他按键可以依次类推。

&gpadc {
	channel_num = <1>;
	channel_select = <0x1>;
	channel_data_select = <0>;
	channel_compare_select = <0x1>;
	channel_cld_select = <0x1>;
	channel_chd_select = <0>;
	channel0_compare_lowdata = <1100000>;
	channel0_compare_higdata = <120000>;
	channel1_compare_lowdata = <460000>;
	channel1_compare_higdata = <1200000>;
	key_cnt = <5>;
	key0_vol = <210>;
	key0_val = <115>;
	key1_vol = <410>;
	key1_val = <114>;
	key2_vol = <590>;
	key2_val = <119>;
	key3_vol = <750>;
	key3_val = <373>;
	key4_vol = <880>;
	key4_val = <28>;
	wakeup-source;
	status = "okay";
};
  • evtest 测试按键信息 

执行下面命令,操作按键SW3,串口终端会打印出如下信息:

root@T113-Embfly:~# evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:      sunxi-keyboard
/dev/input/event1:      sunxi-ts
/dev/input/event2:      sunxi-gpadc0
/dev/input/event3:      audiocodec sunxi Audio Jack
Select the device event number [0-3]: 2
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "sunxi-gpadc0"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 114 (KEY_VOLUMEDOWN)
    Event code 115 (KEY_VOLUMEUP)
Key repeat handling:
  Repeat type 20 (EV_REP)
    Repeat code 0 (REP_DELAY)
      Value    250
    Repeat code 1 (REP_PERIOD)
      Value     33
Properties:
Testing ... (interrupt to exit)
Event: time 267.178942, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 1
Event: time 267.178942, -------------- SYN_REPORT ------------
Event: time 267.356012, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 0
Event: time 267.356012, -------------- SYN_REPORT ------------
Event: time 268.061289, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 1
Event: time 268.061289, -------------- SYN_REPORT ------------
Event: time 268.201342, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 0
Event: time 268.201342, -------------- SYN_REPORT ------------
Event: time 268.420444, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 1
Event: time 268.420444, -------------- SYN_REPORT ------------
Event: time 268.540492, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 0
Event: time 268.540492, -------------- SYN_REPORT ------------
Event: time 268.714546, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 1
Event: time 268.714546, -------------- SYN_REPORT ------------
Event: time 268.871617, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 0
Event: time 268.871617, -------------- SYN_REPORT ------------
Event: time 269.039691, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 1
Event: time 269.039691, -------------- SYN_REPORT ------------
Event: time 269.184742, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 0
Event: time 269.184742, -------------- SYN_REPORT ------------
Event: time 269.256769, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 1
Event: time 269.256769, -------------- SYN_REPORT ------------
Event: time 269.385819, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 0
Event: time 269.385819, -------------- SYN_REPORT ------------
Event: time 269.860037, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 1
Event: time 269.860037, -------------- SYN_REPORT ------------
Event: time 269.972068, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 0
Event: time 269.972068, -------------- SYN_REPORT ------------
root@T113-Embfly:~#

每按一次SW3当前终端会打印出当前事件码值,即按键正常。

  • 15
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值