summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-01-24 01:39:00 -0500
committerJack Humbert <jack.humb@gmail.com>2016-01-24 01:39:00 -0500
commitf8a5eaa3fab683f630390c7ca553810db64d15d6 (patch)
treee6456b65ff9a082709d999330ee639db3e9ef46f
parentfd72a46c139c0450299e6e4ebbf4ffba531c9e2d (diff)
debugging
-rw-r--r--keyboard/planck/Makefile8
-rw-r--r--keyboard/planck/config.h13
-rw-r--r--keyboard/planck/keymaps/lock/keymap.c51
-rw-r--r--quantum/keymap_common.c26
-rw-r--r--quantum/keymap_common.h13
-rw-r--r--quantum/keymap_unicode.c8
-rw-r--r--tmk_core/common/action.c7
-rw-r--r--tmk_core/common/action.h1
-rw-r--r--tmk_core/common/action_code.h14
9 files changed, 77 insertions, 64 deletions
diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile
index 8414b2ccc0..8c710188cc 100644
--- a/keyboard/planck/Makefile
+++ b/keyboard/planck/Makefile
@@ -131,17 +131,17 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096
# comment out to disable the options.
#
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
-MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
+# MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = yes # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
# SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
# NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
-BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
+# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
# MIDI_ENABLE = YES # MIDI controls
-# AUDIO_ENABLE = YES # Audio output on port C6
-# UNICODE_ENABLE = YES # Unicode
+AUDIO_ENABLE = YES # Audio output on port C6
+UNICODE_ENABLE = YES # Unicode
# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
ifdef BACKLIGHT_ENABLE
diff --git a/keyboard/planck/config.h b/keyboard/planck/config.h
index a4c711db82..f51db10871 100644
--- a/keyboard/planck/config.h
+++ b/keyboard/planck/config.h
@@ -64,16 +64,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* disable debug print */
-#define NO_DEBUG
-
+// #define NO_DEBUG
+#define DEBUG_ACTION
+
/* disable print */
-#define NO_PRINT
+// #define NO_PRINT
/* disable action features */
//#define NO_ACTION_LAYER
-//#define NO_ACTION_TAPPING
-//#define NO_ACTION_ONESHOT
+// #define NO_ACTION_TAPPING
+#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
-//#define NO_ACTION_FUNCTION
+#define NO_ACTION_FUNCTION
#endif
diff --git a/keyboard/planck/keymaps/lock/keymap.c b/keyboard/planck/keymaps/lock/keymap.c
index 9585764629..cad5fc37e3 100644
--- a/keyboard/planck/keymaps/lock/keymap.c
+++ b/keyboard/planck/keymaps/lock/keymap.c
@@ -5,11 +5,12 @@
#include "backlight.h"
#endif
#include "action_layer.h"
-#include "keymap_midi.h"
+// #include "keymap_midi.h"
#include "audio.h"
#include <avr/boot.h>
+#include <debug.h>
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+const uint32_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = { /* Qwerty */
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
{KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
@@ -25,27 +26,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
},
[2] = { /* RAISE */
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
- {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
+ {KC_TRNS, FUNC(3), FUNC(4), RESET, UC(0x1028), KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
{KC_TRNS, KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
[3] = { /* LOWER */
{S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC},
- {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)},
+ {KC_TRNS, FUNC(3), FUNC(4), RESET, UC(0x1028), KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)},
{KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
-},
-[4] = { /* TENKEY */
- {KC_TAB, N_C5, N_D5, N_E5, N_F5, N_G5, N_A5, KC_KP_7, KC_KP_8, KC_KP_9, KC_P, KC_BSPC},
- {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_KP_4, KC_KP_5, KC_KP_6, KC_SCLN, KC_QUOT},
- {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_KP_1, KC_KP_2, KC_KP_3, KC_SLSH, KC_ENT},
- {KC_TRNS, KC_LCTL, KC_LALT, KC_LGUI, KC_TRNS, KC_SPC, KC_SPC, KC_KP_0, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
-},
-[5] = {
- { MIDI12 },
- { MIDI12 },
- { MIDI12 },
- {M(0), KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, KC_SPC, KC_SPC, FUNC(1), MIDI, MIDI, MIDI, MIDI}
}
};
@@ -58,15 +47,15 @@ const uint16_t PROGMEM fn_actions[] = {
};
-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);
- }
-}
+// 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);
+// }
+// }
float walk_up[][2] = {
{440.0*pow(2.0,(60)/12.0), 400},
@@ -93,8 +82,9 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
#ifdef BACKLIGHT_ENABLE
backlight_set(BACKLIGHT_LEVELS);
#endif
- default_layer_and(0);
- default_layer_or((1<<5));
+ debug_enable = true;
+ // default_layer_and(0);
+ // default_layer_or((1<<1));
// uint8_t low = boot_lock_fuse_bits_get(0x0000);
// uint8_t high = boot_lock_fuse_bits_get(0x0003);
@@ -125,13 +115,14 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
// unregister_code(hextokeycode((lock & 0x0F)));
} else {
- unregister_code(KC_RSFT);
+ debug_enable = false;
play_notes(&walk_dn, 3, false);
+ // unregister_code(KC_RSFT);
#ifdef BACKLIGHT_ENABLE
backlight_set(0);
#endif
- default_layer_and(0);
- default_layer_or(0);
+ // default_layer_and(0);
+ // default_layer_or(0);
}
break;
}
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 <http://www.gnu.org/licenses/>.
#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
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c
index 77ea39e942..7a47100a54 100644
--- a/tmk_core/common/action.c
+++ b/tmk_core/common/action.c
@@ -70,6 +70,12 @@ void process_action(keyrecord_t *record)
#endif
dprintln();
+ // if (action.code >= 0x80000000) {
+ // action_custom(record, action.custom.id);
+ // return;
+ // }
+ dprintf("%X", action.custom.kind);
+
switch (action.kind.id) {
/* Key and Mods */
case ACT_LMODS:
@@ -337,6 +343,7 @@ void process_action(keyrecord_t *record)
default:
break;
}
+
}
diff --git a/tmk_core/common/action.h b/tmk_core/common/action.h
index 8a4736d7bc..16f38926ca 100644
--- a/tmk_core/common/action.h
+++ b/tmk_core/common/action.h
@@ -57,6 +57,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt);
/* user defined special function */
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt);
+void action_custom(keyrecord_t *record, uint32_t code);
/* Utilities for actions. */
void process_action(keyrecord_t *record);
diff --git a/tmk_core/common/action_code.h b/tmk_core/common/action_code.h
index 4fe9c1d581..94f215a41b 100644
--- a/tmk_core/common/action_code.h
+++ b/tmk_core/common/action_code.h
@@ -134,15 +134,17 @@ enum action_kind_id {
* 0x12 0x34 0x34 0x12
*/
typedef union {
- uint16_t code;
+ uint32_t code;
struct action_kind {
uint16_t param :12;
uint8_t id :4;
+ uint16_t other :16;
} kind;
struct action_key {
uint8_t code :8;
uint8_t mods :4;
uint8_t kind :4;
+ uint16_t other :16;
} key;
struct action_layer_bitop {
uint8_t bits :4;
@@ -151,32 +153,42 @@ typedef union {
uint8_t on :2;
uint8_t op :2;
uint8_t kind :4;
+ uint16_t other :16;
} layer_bitop;
struct action_layer_tap {
uint8_t code :8;
uint8_t val :5;
uint8_t kind :3;
+ uint16_t other :16;
} layer_tap;
struct action_usage {
uint16_t code :10;
uint8_t page :2;
uint8_t kind :4;
+ uint16_t other :16;
} usage;
struct action_backlight {
uint8_t level :8;
uint8_t opt :4;
uint8_t kind :4;
+ uint16_t other :16;
} backlight;
struct action_command {
uint8_t id :8;
uint8_t opt :4;
uint8_t kind :4;
+ uint16_t other :16;
} command;
struct action_function {
uint8_t id :8;
uint8_t opt :4;
uint8_t kind :4;
+ uint16_t other :16;
} func;
+ struct action_custom {
+ uint32_t id :28;
+ uint8_t kind :4;
+ } custom;
} action_t;