Difference between revisions of "Keypad"

From ArmadeusWiki
Jump to: navigation, search
(kbd)
m (kbd)
Line 119: Line 119:
 
=== kbd ===
 
=== kbd ===
  
kbd is most advanced package that can be selected in config :
+
[http://kbd-project.org/ kbd] is most advanced package that can be selected in config :
 
<pre class="config">
 
<pre class="config">
 
Target packages  --->
 
Target packages  --->

Revision as of 12:10, 22 July 2014

How to connect a keypad to your Armadeus board

Introduction

Your Armadeus board allows you to connect a (matrix or not) keypad as input device. Keypads are a collection of switches assembled together to emulate a kind of keyboard to ease user interaction with your system.

Solutions

There are several solutions to connect a keypad to your Armadeus board:

Keypad directly connected to i.MXL/27

One GPIO for one key

This type of keypad generally called "common ground keypad" is the easiest one to build: connect your switch to an i.MX GPIO (with a pullup) on one side and to the ground on the other side . If you need more than 6 keys, this construction is however "GPIO consuming" and you would better use matrix keypads.
Under Test...

Matrix keypads on i.MX27

The i.MX27 has an internal controller that can drive 8x8 keypads (= 64 keys with 16 dedicated pins): Keypad usage on i.MX27. Please consult the i.MX27 Reference Manual (Chapter 25) for more informations.

Matrix keypads on i.MXL

Driver for i.MX GPIO controlled keypads

By default your board supports a direct connection with a 4x4 matrix keypad using the CSI lines: CSI_MCLK, CSI_D0...CSI_D6.

The driver uses the i.MXL GPIO's internal pull-up, therefore your board does not need any additional external resistor.

  • Connect the 4 (rows) lines of the keypad to CSI_MCLK, CSI_D0, CSI_D1, CSI_D2 (resp. PORT_A pin 3, 4, 5, 6)
  • Connect the 4 (columns) lines of the keypad to CSI_D3, CSI_D4, CSI_D5 CSI_D6 (resp. PORT_A pin 7, 8, 9, 10)

{add a big picture of the keypad link with APF_DEV_LIGHT} {add a big picture of the keypad link with APF_DEV_FULL}

3x4 matrix keypad connected to i.MX GPIOs
Keypad Connection (APF9328_devfull)
4x4 keypad caracters and corresponding CSI signals
CSI signal name D6 D5 D4 D3
X23 pin number 7 8 5 6
MCLK 14 1 2 3 <-
D0 1 4 5 6 ->
D1 4 7 8 9 ENTER
D2 3 * 0 _ ESC

FPGA solution

Development are also ongoing to connect matrix keypads using the FPGA...

Test

Quick try

  • If you have a graphical LCD connected to your board (= virtual terminal), then you should see what you type (if your keypad keys are mapped to alphanumeric keyboard keys).
  • If you don't have any virtual terminal, but only the serial console: (event0 may be event1 if you already have a running touchscreen)
# cat /sys/class/input/input0/event0/device/name       (check if event0 is really attached to keypad, otherwise, try event1, etc...)
MX27 Keypad
# cat /dev/input/event0

Then you should see weirds characters when pressing keyboard keys:

 �,~~_�,}�}�3T,QToT6,TT�,�;��, � �
  • if the test wiped out your console, you can get it back with:
# reset
  • if you want to see hexadecimal values of what your are receiving:
# cat /dev/input/event0 | hexdump
0000000 0283 0000 5a09 000e 0004 0004 0051 0007
0000010 0283 0000 5a30 000e 0001 006c 0001 0000
0000020 0283 0000 5a40 000e 0000 0000 .... ....
  • If corresponding device node in /dev/input/ is not existing, then:
 # cat /sys/class/input/input0/event0/dev
 13:64
 # mkdir -p /dev/input
 # mknod /dev/input/event0 c 13 64

Deeper one

  • use target/demos/keypad_test/ test tool

Tools

evtest

evtest is a tool already installer on bsp to test keys comming from /dev/eventX. To use it simply launch it with path to device :

# evtest /dev/input/event1 
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "gpio-keys.5"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 21 (KEY_Y)
    Event code 49 (KEY_N)
Properties:
Testing ... (interrupt to exit)
Event: time 201.720156, type 1 (EV_KEY), code 21 (KEY_Y), value 0
Event: time 201.720156, -------------- SYN_REPORT ------------
Event: time 202.040401, type 1 (EV_KEY), code 21 (KEY_Y), value 1
Event: time 202.040401, -------------- SYN_REPORT ------------
Event: time 202.580177, type 1 (EV_KEY), code 49 (KEY_N), value 0
Event: time 202.580177, -------------- SYN_REPORT ------------
Event: time 202.930185, type 1 (EV_KEY), code 49 (KEY_N), value 1
Event: time 202.930185, -------------- SYN_REPORT ------------
# 

kbd

kbd is most advanced package that can be selected in config :

Target packages  --->
    Hardware handling  --->
        [*] kbd

TODO

Links

  • external links (for exemple: locomo driver model)