Home Contents | # keyboard:setMap | Keyboard | Core4 Lua Event System

## SYNOPSIS

kbdhandle:setMap(map)

## DESCRIPTION

Configures the key to unicode mapping of a matrix keypad. The parameter map is a list of codepoints for all keys in the matrix.

Starting with SDK 2.91.0, this call is mandatory to use a matrix keypad.
There is no default mapping.
This is necessary so the GPIO pins of the keypad matrix can be used for other purposes if there is no keypad.
To disable keypad scanning, call with an explicit nil: kbdhandle:setMap(nil)

## EXAMPLE

For example, the keypad connector on the V4½ is numbered like this:

| COL0 | COL1 | COL2 | COL3
--- | --- | --- | --- | ---
ROW0 | 1 | 2 | 3 | 4
ROW1 | 5 | 6 | 7 | 8
ROW2 | 9 | 10 | 11 | 12
ROW3 | 13 | 14 | 15 | 16

A typical keypad available from multiple sources has this arrangement:

| COL0 | COL1 | COL2 | COL3
--- | --- | --- | --- | ---
ROW0 | 1 | 4 | 7 | A
ROW1 | 2 | 5 | 8 | 0
ROW2 | 3 | 6 | 9 | B
ROW3 | F | E | D | C

Which will result in a map table of:

map = { '1', '4', '7', 'A', '2', '5', '8', '0', '3', '6', '9', 'B', 'F', 'E', 'D', 'C', }

## SEE ALSO

keyboard.event, keyboard.key