Skip to content

Commit 00f4011

Browse files
committed
core: Fix doc/keymap.md for new keymap framework
1 parent ddbd7b4 commit 00f4011

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ Source code is available here: <https://github.com/tmk/tmk_keyboard/tree/core>
77

88
Updates
99
-------
10+
#### 2016/06/26
11+
Keymap framework was updated. `fn_actions[]` should be defined as `action_t` instead of `uint16_t`. And default code for keymap handling is now included in core you just need define `uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]` and `action_t fn_actions[]`.
12+
1013
#### 2016/02/10
1114
flabbergast's Chibios protocol was merged from <https://github.com/flabbergast/tmk_keyboard/tree/chibios>. See [protocol/chibios/README.md](protocol/chibios/README.md). Chibios protocol supports Cortex-M such as STM32 and Kinetis.
1215

doc/keymap.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Note that ***higher layers have priority in the layer stack***. The firmware sta
9595
9696
9797
### 0.3 Keymap Example
98-
The keymap is defined in the **`keymaps[]`** array, a 2-dimensional array of rows and columns corresponding to positions in the keyboard matrix. But most often the layers are defined using C macros to allow for easier reading and editing of the keymap files. To use complex actions you need to define `Fn` keycodes in the **`fn_actions[]`** array.
98+
The keymap is defined in the **`uint8_t keymaps[]`** array, a 2-dimensional array of rows and columns corresponding to positions in the keyboard matrix. But most often the layers are defined using C macros to allow for easier reading and editing of the keymap files. To use complex actions you need to define `Fn` action in the **`action_t fn_actions[]`** array.
9999
100100
This is a keymap example for the [HHKB](http://en.wikipedia.org/wiki/Happy_Hacking_Keyboard) keyboard.
101101
This example has three layers: the QWERTY base layer, and two overlay layers for cursor and mousekey control, respectively.
@@ -109,7 +109,7 @@ In this example,
109109
110110
You can find other keymap definitions in file `keymap.c` located on project directories.
111111
112-
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
112+
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
113113
/* 0: Qwerty
114114
* ,-----------------------------------------------------------.
115115
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `|
@@ -167,7 +167,7 @@ You can find other keymap definitions in file `keymap.c` located on project dire
167167
LGUI,LALT, BTN1, RALT,TRNS),
168168
};
169169
170-
static const uint16_t PROGMEM fn_actions[] = {
170+
const action_t PROGMEM fn_actions[] = {
171171
ACTION_LAYER_MOMENTARY(1), // FN0
172172
ACTION_LAYER_TAP_KEY(2, KC_SCLN), // FN1
173173
ACTION_LAYER_TOGGLE(2), // FN2
@@ -214,7 +214,7 @@ There are 8 modifiers which has discrimination between left and right.
214214
- `KC_WSCH`, `KC_WHOM`, `KC_WBAK`, `KC_WFWD`, `KC_WSTP`, `KC_WREF`, `KC_WFAV` for web browser operation
215215
216216
### 1.5 Fn key
217-
`KC_FNnn` are keycodes for `Fn` key which not given any actions at the beginning unlike most of keycodes has its own inborn action. To use these keycodes in `KEYMAP()` you need to assign action you want at first. Action of `Fn` key is defined in `fn_actions[]` and its index of the array is identical with number part of `KC_FNnn`. Thus `KC_FN0` keycode indicates the action defined in first element of the array. ***32 `Fn` keys can be defined at most.***
217+
`KC_FNnn` are keycodes for `Fn` key which not given any actions at the beginning unlike most of keycodes has its own inborn action. To use these keycodes in `KEYMAP()` you need to assign action you want at first. Action of `Fn` key is defined in `action_t fn_actions[]` and its index of the array is identical with number part of `KC_FNnn`. Thus `KC_FN0` keycode indicates the action defined in first element of the array. ***32 `Fn` keys can be defined at most.***
218218
219219
### 1.6 Keycode Table
220220
See keycode table in [`doc/keycode.txt`](./keycode.txt) for description of keycodes.
@@ -443,7 +443,7 @@ To define tappable `Function` action in keymap use this.
443443
#### 2.4.3 Implement user function
444444
`Function` actions can be defined freely with C by user in callback function:
445445
446-
void keymap_call_function(keyrecord_t *event, uint8_t id, uint8_t opt)
446+
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt);
447447
448448
This C function is called every time key is operated, argument `id` selects action to be performed and `opt` can be used for option. Function `id` can be 0-255 and `opt` can be 0-15.
449449
@@ -598,13 +598,13 @@ Legacy Keymap uses two arrays `fn_layer[]` and `fn_keycode[]` to define Fn key.
598598
599599
In following setting example, `Fn0`, `Fn1` and `Fn2` switch layer to 1, 2 and 2 respectively. `Fn2` registers `Space` key when tapping while `Fn0` and `Fn1` doesn't send any key.
600600
601-
static const uint8_t PROGMEM fn_layer[] = {
601+
const uint8_t PROGMEM fn_layer[] = {
602602
1, // Fn0
603603
2, // Fn1
604604
2, // Fn2
605605
};
606606
607-
static const uint8_t PROGMEM fn_keycode[] = {
607+
const uint8_t PROGMEM fn_keycode[] = {
608608
KC_NO, // Fn0
609609
KC_NO, // Fn1
610610
KC_SPC, // Fn2

0 commit comments

Comments
 (0)