Squashed 'tmk_core/' changes from 8da1898..e5f9940
e5f9940 Merge commit '1bc3dd200b023cecf063a0cb3ba347f77f6d759d' into core_update da03c50 Add note for L/R side bit being ignored e80f3c1 Add in basic documentation for Macro system 35e8a76 core: Swap position of PEQL and PENT in unimap 00751f1 Merge pull request #406 from 39aldo39/patch-1 e50d7de V-USB remote wakeup 4340997 core: Fix typo in definition AC_g 958144d core: Debug print for system and consumer keys e7e1030 core: Fix sleep_led 0866323 core: Change matrix_init and matrix_print 0dbf73d core: Add matrix_clear() and default impl. 3202ca3 core: Add suspend mode options 4cda3aa core: Fix suspend/wake for converters #386 4e15247 core: LUFA_DEBUG_SUART for serial debug b9cf8e7 core: Fix mechanical locking supoort #390 12aa0fd Merge branch 'nemith-master' fccb3fa core: Fix OPT_DEFS for mbed build 2e2d2c8 Merge branch 'master' of github.com:leizzer/tmk_keyboard f1d3634 Change .gitignore for ChibiOS 3aab802 core: Fix build config in protocol.mk 5e43da0 core: Add short names in unimap 7a56998 core: Fix dfu wait in rules.mk 6d9c500 Merge branch 'mediakey-fix' 08382ac core: Fix 'make dfu' message 78cb04e Fix OS X Recognizing keyboard as Mouse/Tablet a114714 core: 'make dfu' waits for bootloader to start d0a8f13 core: Fix unimap UNIMAP_NO case e17abef core: Change lufa NKRO report size 16 to 32 bytes 375b20f core: Fix common.mk for build options 394fdff core: Fix unimap layout comment 912326c core: Add unimap support 00f4011 core: Fix doc/keymap.md for new keymap framework ddbd7b4 core: Add default implemenation of keymap read 671cacc core: action codes are action_t struct now b4fdb27 core: Change chibios repo directory names 7daed10 core: Fix keycode.txt 90399d7 core: Fix USB remote wakeup on ATmega32U2 #361 3677e84 usb_usb: Add multiple keyboard support 54d5b26 core: Fix Logical Maximum in report descriptor bd0d372 core: Fix LUFA report descriptor 95327b5 Merge pull request #355 from papodaca/XT 62bf548 core: change API of adb.c to accept device address 3097c9e Fix function name in host.h 836e209 Merge branch 'core_split_160522' 3918ea2 Merge commit '20b787fc12' 7f87b11 core: Add comment of register 3 of ADB ef6478a core: Add adb_host_talk() 5c665b4 update macro names in bluefruit 4f2c5bf Merge commit '71381457fa' 53a9c08 Merge pull request #321 from njbair/master f08a656 core: Fix media/consumer keys d526de8 Clean up wording in keymap example 0bb3dbb Clarify layer precedence d915c75 clarify layer documentation 72070d4 ps2_usb: Fix for VUSB configuration 170e2dc Mostly working. Is unstable, will emit bad codes after a while. c8e45b5 core: Actionmap support aabaa24 Codes appear to be detected correctly, the break codes are broken. git-subtree-dir: tmk_core git-subtree-split: e5f994033cbc8700745ac0c6d12772820492eed0
This commit is contained in:
parent
20b787fc12
commit
22b6e15a17
55 changed files with 2042 additions and 405 deletions
|
|
@ -1,7 +1,7 @@
|
|||
Keycode Symbol Table
|
||||
====================
|
||||
Keycodes are defined in `common/keycode.h`.
|
||||
Range of 00-A4 and E0-E7 are identical with HID Usage:
|
||||
Range of 00-A4 and E0-E7 are identical with HID Usage of Keyboard/Keypad Page(0x07):
|
||||
<http://www.usb.org/developers/devclass_docs/Hut1_11.pdf>
|
||||
Virtual keycodes are defined out of above range to support special actions.
|
||||
|
||||
|
|
@ -186,30 +186,35 @@ KC_RGUI E7 Keyboard Right GUI(Windows/Apple/Meta key
|
|||
/*
|
||||
* Virtual keycodes
|
||||
*/
|
||||
/* System Control */
|
||||
/* Generic Desktop Page(0x01) - System Control */
|
||||
KC_SYSTEM_POWER KC_PWR System Power Down
|
||||
KC_SYSTEM_SLEEP KC_SLEP System Sleep
|
||||
KC_SYSTEM_WAKE KC_WAKE System Wake
|
||||
/* Consumer Page */
|
||||
KC_AUDIO_MUTE KC_MUTE
|
||||
KC_AUDIO_VOL_UP KC_VOLU
|
||||
KC_AUDIO_VOL_DOWN KC_VOLD
|
||||
KC_MEDIA_NEXT_TRACK KC_MNXT
|
||||
KC_MEDIA_PREV_TRACK KC_MPRV
|
||||
KC_MEDIA_STOP KC_MSTP
|
||||
KC_MEDIA_PLAY_PAUSE KC_MPLY
|
||||
KC_MEDIA_SELECT KC_MSEL
|
||||
KC_MAIL KC_MAIL
|
||||
KC_CALCULATOR KC_CALC
|
||||
KC_MY_COMPUTER KC_MYCM
|
||||
KC_WWW_SEARCH KC_WSCH
|
||||
KC_WWW_HOME KC_WHOM
|
||||
KC_WWW_BACK KC_WBAK
|
||||
KC_WWW_FORWARD KC_WFWD
|
||||
KC_WWW_STOP KC_WSTP
|
||||
KC_WWW_REFRESH KC_WREF
|
||||
KC_WWW_FAVORITES KC_WFAV
|
||||
/* Mousekey */
|
||||
|
||||
/* Consumer Page(0x07) */
|
||||
KC_AUDIO_MUTE KC_MUTE Mute
|
||||
KC_AUDIO_VOL_UP KC_VOLU Volume Increment
|
||||
KC_AUDIO_VOL_DOWN KC_VOLD Volume Decrement
|
||||
KC_MEDIA_NEXT_TRACK KC_MNXT Scan Next Track
|
||||
KC_MEDIA_PREV_TRACK KC_MPRV Scan Previous Track
|
||||
KC_MEDIA_STOP KC_MSTP Stop
|
||||
KC_MEDIA_FAST_FORWARD KC_MFFD Fast Forward
|
||||
KC_MEDIA_REWIND KC_MRWD Rewind
|
||||
KC_MEDIA_PLAY_PAUSE KC_MPLY Play/Pause
|
||||
KC_EJCT KC_MEDIA_EJECT Stop/Eject
|
||||
KC_MEDIA_SELECT KC_MSEL AL Consumer Control Configuration
|
||||
KC_MAIL KC_MAIL AL Email Reader
|
||||
KC_CALCULATOR KC_CALC AL Calculator
|
||||
KC_MY_COMPUTER KC_MYCM AL Local Machine Browser
|
||||
KC_WWW_SEARCH KC_WSCH AC Search
|
||||
KC_WWW_HOME KC_WHOM AC Home
|
||||
KC_WWW_BACK KC_WBAK AC Back
|
||||
KC_WWW_FORWARD KC_WFWD AC Forward
|
||||
KC_WWW_STOP KC_WSTP AC Stop
|
||||
KC_WWW_REFRESH KC_WREF AC Refresh
|
||||
KC_WWW_FAVORITES KC_WFAV AC Bookmarks
|
||||
|
||||
/* Mousekey - TMK specific */
|
||||
KC_MS_UP KC_MS_U Mouse Cursor Up
|
||||
KC_MS_DOWN KC_MS_D Mouse Cursor Down
|
||||
KC_MS_LEFT KC_MS_L Mouse Cursor Left
|
||||
|
|
@ -226,7 +231,8 @@ KC_MS_WH_RIGHT KC_WH_R Mouse Wheel Right
|
|||
KC_MS_ACCEL0 KC_ACL0 Mouse Acceleration 0
|
||||
KC_MS_ACCEL1 KC_ACL1 Mouse Acceleration 1
|
||||
KC_MS_ACCEL2 KC_ACL2 Mouse Acceleration 2
|
||||
/* Fn key */
|
||||
|
||||
/* Fn key - TMK specific */
|
||||
KC_FN0
|
||||
KC_FN1
|
||||
KC_FN2
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ Note that ***higher layers have priority in the layer stack***. The firmware sta
|
|||
|
||||
|
||||
### 0.3 Keymap Example
|
||||
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.
|
||||
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.
|
||||
|
||||
This is a keymap example for the [HHKB](http://en.wikipedia.org/wiki/Happy_Hacking_Keyboard) keyboard.
|
||||
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,
|
|||
|
||||
You can find other keymap definitions in file `keymap.c` located on project directories.
|
||||
|
||||
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* 0: Qwerty
|
||||
* ,-----------------------------------------------------------.
|
||||
* |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
|
|||
LGUI,LALT, BTN1, RALT,TRNS),
|
||||
};
|
||||
|
||||
static const uint16_t PROGMEM fn_actions[] = {
|
||||
const action_t PROGMEM fn_actions[] = {
|
||||
ACTION_LAYER_MOMENTARY(1), // FN0
|
||||
ACTION_LAYER_TAP_KEY(2, KC_SCLN), // FN1
|
||||
ACTION_LAYER_TOGGLE(2), // FN2
|
||||
|
|
@ -214,7 +214,7 @@ There are 8 modifiers which has discrimination between left and right.
|
|||
- `KC_WSCH`, `KC_WHOM`, `KC_WBAK`, `KC_WFWD`, `KC_WSTP`, `KC_WREF`, `KC_WFAV` for web browser operation
|
||||
|
||||
### 1.5 Fn key
|
||||
`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.***
|
||||
`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.***
|
||||
|
||||
### 1.6 Keycode Table
|
||||
See keycode table in [`doc/keycode.txt`](./keycode.txt) for description of keycodes.
|
||||
|
|
@ -379,19 +379,33 @@ Default Layer also has bitwise operations, they are executed when key is release
|
|||
ACTION_DEFAULT_LAYER_BIT_SET(part, bits)
|
||||
|
||||
|
||||
|
||||
### 2.3 Macro action
|
||||
***TBD***
|
||||
`Macro` actions allow you to register a complex sequence of keystrokes when a key is pressed, where macros are simple sequences of keypresses.
|
||||
|
||||
`Macro` action indicates complex key strokes.
|
||||
|
||||
MACRO( D(LSHIFT), D(D), END )
|
||||
MACRO( U(D), U(LSHIFT), END )
|
||||
MACRO( I(255), T(H), T(E), T(L), T(L), W(255), T(O), END )
|
||||
ACTION_MACRO(id)
|
||||
ACTION_MACRO_TAP(id)
|
||||
|
||||
#### 2.3.1 Macro Commands
|
||||
- **MACRO()**
|
||||
- **MACRO_NONE**
|
||||
`id` is an 8-bit user-defined value the macro getter function can use to pick the specific macro.
|
||||
|
||||
|
||||
#### 2.3.1 Implementing Macro getter function
|
||||
To implement `macro` functions, the macro lookup list must be implemented:
|
||||
|
||||
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt);
|
||||
|
||||
The function must always return a valid macro, and default implementation of `action_get_macro` always returns `MACRO_NONE` which has no effect.
|
||||
|
||||
#### 2.3.1.1 Limitations
|
||||
Similar to the Function Action system, the selector functions is passed a `keyrecord_t` object, so it can inspect the key state (e.g. different macros on key press or release), and key itself.
|
||||
|
||||
Unlike the Function Action system,`macros` are pre-recorded key sequences, so you can only select from a list. If you want to use dynamic macros then you should look at the more complex function action system.
|
||||
|
||||
#### 2.3.2 Implementing/Defining Macro sequences
|
||||
Macros are of the form (must be wrapped by the `MACRO` function, and end with an `END` mark)
|
||||
|
||||
MACRO( ..., END )
|
||||
|
||||
Within each macro, the following commands can be used:
|
||||
|
||||
- **I()** change interval of stroke.
|
||||
- **D()** press key
|
||||
|
|
@ -401,19 +415,25 @@ Default Layer also has bitwise operations, they are executed when key is release
|
|||
- **SM()** store modifier state
|
||||
- **RM()** restore modifier state
|
||||
- **CM()** clear modifier state
|
||||
- **END** end mark
|
||||
|
||||
e.g.:
|
||||
|
||||
MACRO( D(LSHIFT), D(D), END ) // hold down LSHIFT and D - will print 'D'
|
||||
MACRO( U(D), U(LSHIFT), END ) // release U and LSHIFT keys (an event.pressed == False counterpart for the one above)
|
||||
MACRO( I(255), T(H), T(E), T(L), T(L), W(255), T(O), END ) // slowly print out h-e-l-l---o
|
||||
|
||||
#### 2.3.2 Examples
|
||||
***TBD***
|
||||
|
||||
in keymap.c, define `action_get_macro`
|
||||
|
||||
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
||||
{
|
||||
switch (id) {
|
||||
case HELLO:
|
||||
case 0:
|
||||
return (record->event.pressed ?
|
||||
MACRO( I(0), T(H), T(E), T(L), T(L), W(255), T(O), END ) :
|
||||
MACRO_NONE );
|
||||
case ALT_TAB:
|
||||
case 1:
|
||||
return (record->event.pressed ?
|
||||
MACRO( D(LALT), D(TAB), END ) :
|
||||
MACRO( U(TAB), END ));
|
||||
|
|
@ -421,7 +441,12 @@ Default Layer also has bitwise operations, they are executed when key is release
|
|||
return MACRO_NONE;
|
||||
}
|
||||
|
||||
|
||||
in keymap.c, bind items in `fn_actions` to the macro function
|
||||
|
||||
const action_t PROGMEM fn_actions[] = {
|
||||
[0] = ACTION_MACRO(0), // will print 'hello' for example
|
||||
[1] = ACTION_MACRO(1),
|
||||
};
|
||||
|
||||
|
||||
### 2.4 Function action
|
||||
|
|
@ -443,7 +468,7 @@ To define tappable `Function` action in keymap use this.
|
|||
#### 2.4.3 Implement user function
|
||||
`Function` actions can be defined freely with C by user in callback function:
|
||||
|
||||
void keymap_call_function(keyrecord_t *event, uint8_t id, uint8_t opt)
|
||||
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt);
|
||||
|
||||
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.
|
||||
|
||||
|
|
@ -544,6 +569,7 @@ This registers modifier key(s) simultaneously with layer switching.
|
|||
|
||||
ACTION_LAYER_MODS(2, MOD_LSFT | MOD_LALT)
|
||||
|
||||
This function can only register left-sided modifiers. The handedness of the modifier (left/right) is an extra bit that is not able to be passed through into the layer system. See: [`common/action_code.h`](../common/action_code.h), the spec for ACT_LAYER_TAP only allows four bits for the mods, whereas the mods themselves require five bits, with the high bit being the left/right handedness.
|
||||
|
||||
|
||||
## 4. Tapping
|
||||
|
|
@ -598,13 +624,13 @@ Legacy Keymap uses two arrays `fn_layer[]` and `fn_keycode[]` to define Fn key.
|
|||
|
||||
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.
|
||||
|
||||
static const uint8_t PROGMEM fn_layer[] = {
|
||||
const uint8_t PROGMEM fn_layer[] = {
|
||||
1, // Fn0
|
||||
2, // Fn1
|
||||
2, // Fn2
|
||||
};
|
||||
|
||||
static const uint8_t PROGMEM fn_keycode[] = {
|
||||
const uint8_t PROGMEM fn_keycode[] = {
|
||||
KC_NO, // Fn0
|
||||
KC_NO, // Fn1
|
||||
KC_SPC, // Fn2
|
||||
|
|
|
|||
51
doc/unimap.txt
Normal file
51
doc/unimap.txt
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
Unimap
|
||||
======
|
||||
universal keymapping framework
|
||||
using logical 128-key keyboard layout independent from physical keyboad matrix
|
||||
|
||||
unimap is actually an actionmap whose size is row:8xcol:16.
|
||||
|
||||
/* Keymapping with 16bit action codes */
|
||||
extern const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS];
|
||||
|
||||
/* Universal 128-key keyboard layout(8x16)
|
||||
,-----------------------------------------------.
|
||||
|F13|F14|F15|F16|F17|F18|F19|F20|F21|F22|F23|F24|
|
||||
,---. |-----------------------------------------------| ,-----------. ,-----------.
|
||||
|Esc| |F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut|
|
||||
`---' `-----------------------------------------------' `-----------' `-----------'
|
||||
,-----------------------------------------------------------. ,-----------. ,---------------.
|
||||
| `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bsp| |Ins|Hom|PgU| |NmL| /| *| -|
|
||||
|-----------------------------------------------------------| |-----------| |---------------|
|
||||
|Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | |Del|End|PgD| | 7| 8| 9| +|
|
||||
|-----------------------------------------------------------| `-----------' |---------------|
|
||||
|CapsL | A| S| D| F| G| H| J| K| L| ;| '| #|Retn| | 4| 5| 6|KP,|
|
||||
|-----------------------------------------------------------| ,---. |---------------|
|
||||
|Shft| <| Z| X| C| V| B| N| M| ,| ,| /| RO|Shift | |Up | | 1| 2| 3|KP=|
|
||||
|-----------------------------------------------------------| ,-----------. |---------------|
|
||||
|Ctl|Gui|Alt|MHEN| Space |HENK|KANA|Alt|Gui|App|Ctl| |Lef|Dow|Rig| | 0 | .|Ent|
|
||||
`-----------------------------------------------------------' `-----------' `---------------'
|
||||
App: Windows Menu key
|
||||
Gui: Windows key, Mac ⌘ key or Meta key
|
||||
VDn Vup Mut: Volume control
|
||||
< #: ISO keys(in UK legend)
|
||||
KP=: Keypad = for Mac
|
||||
KP,: Brazilian Keypad Comma
|
||||
JPY: Japanese Yen(¥)
|
||||
RO: Japanese ろ(Ro) or Brazilian /(Slash)
|
||||
MHEN: Japanese 無変換(Non Conversion) or Korean Hanja
|
||||
HENK: Japanese 変換(Conversion) or Korean Hangul/English
|
||||
KANA: Japanese かな(Hiragana/Katakana)
|
||||
https://en.wikipedia.org/wiki/Keyboard_layout#Japanese
|
||||
https://en.wikipedia.org/wiki/Keyboard_layout#Hangul_.28for_Korean.29
|
||||
*/
|
||||
|
||||
|
||||
when refering to keymapping physical matrix position needed to be translated into logical one on unimap
|
||||
the translation is defined in unimap array
|
||||
|
||||
row and col of unimap positon is encoded as follows
|
||||
position = (row << 4) | col
|
||||
|
||||
// table translates matrix to universal keymap
|
||||
extern const uint8_t unimap_trans[MATRIX_ROWS][MATRIX_COLS];
|
||||
Loading…
Add table
Add a link
Reference in a new issue