From f8a5eaa3fab683f630390c7ca553810db64d15d6 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Sun, 24 Jan 2016 01:39:00 -0500 Subject: debugging --- quantum/keymap_common.c | 26 ++++++++++++++------------ quantum/keymap_common.h | 13 ++++++------- quantum/keymap_unicode.c | 8 ++++---- 3 files changed, 24 insertions(+), 23 deletions(-) (limited to 'quantum') diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index 6cc7adf51f..94588ef41c 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c @@ -26,14 +26,16 @@ along with this program. If not, see . #include "backlight.h" #include "keymap_midi.h" -static action_t keycode_to_action(uint16_t keycode); +static action_t keycode_to_action(uint32_t keycode); /* converts key to action */ action_t action_for_key(uint8_t layer, keypos_t key) { // 16bit keycodes - important - uint16_t keycode = keymap_key_to_keycode(layer, key); - + uint32_t keycode = keymap_key_to_keycode(layer, key); + dprintln(); + dprintf("keycode: %16X", keycode); + dprintln(); if (keycode >= 0x0100 && keycode < 0x2000) { // Has a modifier action_t action; @@ -126,10 +128,10 @@ action_t action_for_key(uint8_t layer, keypos_t key) action.code = ACTION_LAYER_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF); return action; #ifdef UNICODE_ENABLE - } else if (keycode >= 0x8000000) { + } else if (keycode >= 0x9000) { action_t action; - uint16_t unicode = keycode & ~(0x8000); - action.code = ACTION_FUNCTION_OPT(unicode & 0xFF, (unicode & 0xFF00) >> 8); + action.code = keycode; + action.custom.kind = 0x8; return action; #endif } else { @@ -224,7 +226,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) } /* translates keycode to action */ -static action_t keycode_to_action(uint16_t keycode) +static action_t keycode_to_action(uint32_t keycode) { action_t action; switch (keycode) { @@ -253,19 +255,19 @@ static action_t keycode_to_action(uint16_t keycode) /* translates key to keycode */ -uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) +uint32_t keymap_key_to_keycode(uint8_t layer, keypos_t key) { - // Read entire word (16bits) - return pgm_read_word(&keymaps[(layer)][(key.row)][(key.col)]); + // Read dword (32bits) + return pgm_read_dword(&keymaps[(layer)][(key.row)][(key.col)]); } /* translates Fn keycode to action */ -action_t keymap_fn_to_action(uint16_t keycode) +action_t keymap_fn_to_action(uint32_t keycode) { return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) }; } -action_t keymap_func_to_action(uint16_t keycode) +action_t keymap_func_to_action(uint32_t keycode) { // For FUNC without 8bit limit return (action_t){ .code = pgm_read_word(&fn_actions[(int)keycode]) }; diff --git a/quantum/keymap_common.h b/quantum/keymap_common.h index 3db40772e0..396fead332 100644 --- a/quantum/keymap_common.h +++ b/quantum/keymap_common.h @@ -50,15 +50,15 @@ keymap_config_t keymap_config; /* translates key to keycode */ -uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key); +uint32_t keymap_key_to_keycode(uint8_t layer, keypos_t key); /* translates Fn keycode to action */ -action_t keymap_fn_to_action(uint16_t keycode); +action_t keymap_fn_to_action(uint32_t keycode); /* translates Fn keycode to action */ -action_t keymap_func_to_action(uint16_t keycode); +action_t keymap_func_to_action(uint32_t keycode); -extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; +extern const uint32_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; extern const uint16_t fn_actions[]; // Ability to use mods in layouts @@ -204,10 +204,9 @@ extern const uint16_t fn_actions[]; // L-ayer, T-ap - 256 keycode max, 16 layer max #define LT(layer, kc) (kc | 0x8000 | ((layer & 0xF) << 8)) -// For sending unicode codes. -// You may not send codes over 1FFF -- this supports most of UTF8. +// For sending unicode characters. // To have a key that sends out Œ, go UC(0x0152) -#define UNICODE(n) (n | 0x8000) +#define UNICODE(n) (0x80000000 | n) #define UC(n) UNICODE(n) diff --git a/quantum/keymap_unicode.c b/quantum/keymap_unicode.c index a44965e611..3a480878b7 100644 --- a/quantum/keymap_unicode.c +++ b/quantum/keymap_unicode.c @@ -27,14 +27,14 @@ uint16_t hextokeycode(int hex) { } } -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) +void action_custom(keyrecord_t *record, uint32_t code) { // For more info on how this works per OS, see here: https://en.wikipedia.org/wiki/Unicode_input#Hexadecimal_code_input if (record->event.pressed) { - uint16_t unicode = (opt << 8) | id; - register_code(KC_LALT); + uint32_t unicode = code; + // register_code(KC_LALT); register_code(hextokeycode((unicode & 0xF000) >> 12)); unregister_code(hextokeycode((unicode & 0xF000) >> 12)); @@ -55,7 +55,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) // register_code(hextokeycode(0x1)); // unregister_code(hextokeycode(0x1)); - unregister_code(KC_LALT); + // unregister_code(KC_LALT); } return; } \ No newline at end of file -- cgit v1.2.3