From 5273c73befb132acfa7b4169ba1fe2ea42f0dfc7 Mon Sep 17 00:00:00 2001 From: Christopher Browne Date: Mon, 1 Feb 2016 11:11:21 -0500 Subject: [PATCH 1/4] Many of the changes I wanted --- keyboard/planck/keymaps/cbbrowne/keymap.c | 38 ++++++++++++----------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/keyboard/planck/keymaps/cbbrowne/keymap.c b/keyboard/planck/keymaps/cbbrowne/keymap.c index f4b85955de..bd09f65c87 100644 --- a/keyboard/planck/keymaps/cbbrowne/keymap.c +++ b/keyboard/planck/keymaps/cbbrowne/keymap.c @@ -29,6 +29,8 @@ be on the first column. - I think I wanna swap ' and ENTER + - All of the above are done :-) + - I'm keeping Colemak and Dvorak around for reference, and added Workman just for fun. They're useless to me, though. */ @@ -58,28 +60,28 @@ enum layers { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_QW] = { /* 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}, - {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, - {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, + {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT }, + {KC_TAB, M(0), KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} }, [_CM] = { /* Colemak */ - {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, - {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, - {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, - {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + {KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, + {KC_LCTL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT }, + {KC_TAB, M(0), KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} }, [_DV] = { /* Dvorak */ - {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, - {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, + {KC_ESC, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, + {KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, - {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + {KC_TAB, M(0), KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} }, [_WK] = { /* Workman */ - {KC_TAB, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_BSPC}, - {KC_ESC, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, KC_QUOT}, - {KC_LSFT, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, - {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + {KC_ESC, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_BSPC}, + {KC_LCTL, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, KC_ENT}, + {KC_LSFT, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT }, + {KC_TAB, M(0), KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} }, [_RS] = { /* 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}, @@ -94,10 +96,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {KC_TRNS, DF(_KP), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} }, [_KP] = { /* Key Pad */ - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_KP_ENTER, KC_KP_PLUS, KC_KP_PLUS, KC_KP_ENTER, KC_KP_ENTER}, - {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_KP_MINUS, KC_7, KC_8, KC_9, KC_KP_DOT}, + {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_KP_ENTER, KC_KP_PLUS, KC_KP_PLUS, KC_KP_ENTER, KC_KP_ENTER}, + {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_KP_MINUS, KC_7, KC_8, KC_9, KC_KP_DOT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_KP_PLUS, KC_4, KC_5, KC_6, KC_0}, - {BL_STEP, KC_LCTL, KC_LALT, KC_LGUI, KC_NO, KC_SPC, KC_SPC, DF(_QW), KC_1, KC_2, KC_3, KC_0} + {BL_STEP, M(0), KC_LALT, KC_LGUI, KC_NO, KC_SPC, KC_SPC, DF(_QW), KC_1, KC_2, KC_3, KC_0} } }; From 41c17baccf858980dfd387400ab3347dc5b5028e Mon Sep 17 00:00:00 2001 From: Christopher Browne Date: Mon, 1 Feb 2016 11:37:17 -0500 Subject: [PATCH 2/4] Add notes on what sorts of actions are risky --- keyboard/planck/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/keyboard/planck/README.md b/keyboard/planck/README.md index 5c3a52498a..60f0136c48 100644 --- a/keyboard/planck/README.md +++ b/keyboard/planck/README.md @@ -171,6 +171,27 @@ Depending on which keymap you would like to use, you will have to compile slight ### Default To build with the default keymap, simply run `make`. +## Safety Considerations + +You probably don't want to "brick" your keyboard, making it impossible +to rewrite firmware onto it. Here are some of the parameters to show +what things are (and likely aren't) too risky. + +- If a keyboard map does not include RESET, then, to get into DFU + mode, you will need to press the reset button on the PCB, which + requires unscrewing some bits. +- Messing with tmk_core / common files might make the keyboard + inoperable +- Too large a .hex file is trouble; `make dfu` will erase the block, + test the size (oops, wrong order!), which errors out, failing to + flash the keyboard +- DFU tools do /not/ allow you to write into the bootloader (unless + you throw in extra fruitsalad of options), so there is little risk + there. +- EEPROM has around a 100000 write cycle. You shouldn't rewrite the + firmware repeatedly and continually; that'll burn the EEPROM + eventually. + ### Other Keymaps Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `.c` and see keymap document (you can find in top README.md) and existent keymap files. From 91c46816568ce76ff22b3c469ff1d624b96a535e Mon Sep 17 00:00:00 2001 From: Christopher Browne Date: Mon, 1 Feb 2016 18:50:19 -0500 Subject: [PATCH 3/4] More samples, some not entirely working yet. I am trying to mess around with MACRO(), but it is not there quite yet... --- keyboard/planck/keymaps/cbbrowne/keymap.c | 39 +++++++++++++++-------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/keyboard/planck/keymaps/cbbrowne/keymap.c b/keyboard/planck/keymaps/cbbrowne/keymap.c index bd09f65c87..97ef72407d 100644 --- a/keyboard/planck/keymaps/cbbrowne/keymap.c +++ b/keyboard/planck/keymaps/cbbrowne/keymap.c @@ -44,6 +44,15 @@ - What's the keystroke to get from X to console these days? - I do indeed want a sweet number pad! - A layer for doing console switching would not be a bad idea + - Random data generator + - A key that generates values in the range 0-9 at random + - A key that generates values in the range a-z at random + - A key that generates values in the range a-z,A-Z,0-9 at random + + - Figure out the MACRO example in https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/doc/keymap.md + - section 2.3.2 + - where does the HELLO come from??? + - What are the types of the T() calls? */ enum layers { @@ -126,17 +135,21 @@ const uint16_t PROGMEM fn_actions[] = { const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { // MACRODOWN only works in this function - switch(id) { - case 0: - if (record->event.pressed) { - register_code(KC_RSFT); - #ifdef BACKLIGHT_ENABLE - backlight_step(); - #endif - } else { - unregister_code(KC_RSFT); - } - break; - } - return MACRO_NONE; + switch(id) { + case 0: + if (record->event.pressed) { + register_code(KC_RSFT); +#ifdef BACKLIGHT_ENABLE + backlight_step(); +#endif + } else { + unregister_code(KC_RSFT); + } + case 2550: + return (record->event.pressed ? + MACRO( I(55), T(C), T(B), T(B), T(R), T(O), T(W), T(N), T(E)) : + MACRO_NONE ); + break; + } + return MACRO_NONE; }; From 1466f5a36e24f4b5925e306a10abbfdcde50dd04 Mon Sep 17 00:00:00 2001 From: Christopher Browne Date: Mon, 1 Feb 2016 19:13:23 -0500 Subject: [PATCH 4/4] Set up a macro that writes cbbrowne. So that is a nice example of how it works. Probably ought to write up some docs on this to improve it. --- keyboard/planck/keymaps/cbbrowne/keymap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/keyboard/planck/keymaps/cbbrowne/keymap.c b/keyboard/planck/keymaps/cbbrowne/keymap.c index 97ef72407d..03bea940f0 100644 --- a/keyboard/planck/keymaps/cbbrowne/keymap.c +++ b/keyboard/planck/keymaps/cbbrowne/keymap.c @@ -105,7 +105,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {KC_TRNS, DF(_KP), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} }, [_KP] = { /* Key Pad */ - {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_KP_ENTER, KC_KP_PLUS, KC_KP_PLUS, KC_KP_ENTER, KC_KP_ENTER}, + {KC_ESC, M(1), KC_W, KC_E, KC_R, KC_T, KC_Y, KC_KP_ENTER, KC_KP_PLUS, KC_KP_PLUS, KC_KP_ENTER, KC_KP_ENTER}, {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_KP_MINUS, KC_7, KC_8, KC_9, KC_KP_DOT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_KP_PLUS, KC_4, KC_5, KC_6, KC_0}, {BL_STEP, M(0), KC_LALT, KC_LGUI, KC_NO, KC_SPC, KC_SPC, DF(_QW), KC_1, KC_2, KC_3, KC_0} @@ -127,7 +127,6 @@ enum macro_id { M_USERNAME }; - const uint16_t PROGMEM fn_actions[] = { }; @@ -145,9 +144,10 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) } else { unregister_code(KC_RSFT); } - case 2550: + break; + case 1: return (record->event.pressed ? - MACRO( I(55), T(C), T(B), T(B), T(R), T(O), T(W), T(N), T(E)) : + MACRO( T(C), T(B), T(B), T(R), T(O), T(W), T(N), T(E)) : MACRO_NONE ); break; }