diff options
author | Jack Humbert <jack.humb@gmail.com> | 2015-09-14 23:54:49 -0400 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2015-09-14 23:54:49 -0400 |
commit | 6ec03b22187fb3c16677c4c0583e66d6d6a5c4f1 (patch) | |
tree | 37265cdf66290a33ce588e9b12ce0ecc816543c4 /keyboard/planck/keymap_common.c | |
parent | 5bb7ef0012378cd800bff74680b08c587e6338e4 (diff) | |
download | firmware-6ec03b22187fb3c16677c4c0583e66d6d6a5c4f1.tar.gz firmware-6ec03b22187fb3c16677c4c0583e66d6d6a5c4f1.tar.bz2 firmware-6ec03b22187fb3c16677c4c0583e66d6d6a5c4f1.zip |
unicode working, i think
Diffstat (limited to 'keyboard/planck/keymap_common.c')
-rw-r--r-- | keyboard/planck/keymap_common.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/keyboard/planck/keymap_common.c b/keyboard/planck/keymap_common.c index 886bfe23c..dd6639113 100644 --- a/keyboard/planck/keymap_common.c +++ b/keyboard/planck/keymap_common.c @@ -28,6 +28,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. static action_t keycode_to_action(uint16_t keycode); +uint16_t hextokeycode(int hex) { + if (hex == 0x0) { + return KC_0; + } else if (hex < 0xA) { + return KC_1 + (hex - 0x1); + } else { + return KC_A + (hex - 0xA); + } +} + /* converts key to action */ action_t action_for_key(uint8_t layer, keypos_t key) { @@ -78,6 +88,11 @@ action_t action_for_key(uint8_t layer, keypos_t key) action_t action; action.code = ACTION_FUNCTION_OPT(keycode & 0xFF, (keycode & 0x0F00) >> 8); return action; + } else if (keycode >= 0x8000 && keycode < 0x9000) { + action_t action; + uint16_t unicode = keycode & ~(0x8000); + action.code = ACTION_FUNCTION_OPT(unicode & 0xFF, (unicode & 0xFF00) >> 8); + return action; } switch (keycode) { |