diff options
author | noroadsleft <18669334+noroadsleft@users.noreply.github.com> | 2019-01-18 07:32:21 -0800 |
---|---|---|
committer | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-01-18 07:32:21 -0800 |
commit | 12406c646f917b7451ec265d767f07a34ecf906a (patch) | |
tree | 6a5bb1502bd082cd851471187bef3b59de1139d4 /keyboards/tkc1800/keymaps/smt/keymap.c | |
parent | e2f7c3d5a59933519e8cf7b4d9176587334d7b70 (diff) |
TKC1800 refactor and Configurator visual fixes (#4870)
* TKC1800: refactor
- tkc1800.h
- updated to use #pragma once
- visual alignment
- update config.h files to use #pragma once
- update all keymaps to use #include QMK_KEYBOARD_H
- delete redundant mod mask, KC_TRNS, and KC_NO definitions
- reformat keymap layers for readability
- add block comment for Function layer in default keymap
- delete commented action_get_macro code blocks (deprecated function)
- update files to better conform with QMK coding conventions
- update smt keymap to use set_single_persistent_default_layer (instead of persistent_default_layer_set)
- replace instances of `?=` with `=` in rules.mk
* TKC1800: Configurator visual fixes
- correct key sizes and positioning
- reformat file so each physical key object has its own line for readability
- update and add `label` keys for readability
* TKC1800: readme update
- fix image gallery link
- update Hardware Supported and Hardware Availability lines
- update make example (add :default suffix)
- update QMK Docs links (Newbs Guide; grammar)
* Add missing semicolons to smt keymap
Diffstat (limited to 'keyboards/tkc1800/keymaps/smt/keymap.c')
-rw-r--r-- | keyboards/tkc1800/keymaps/smt/keymap.c | 135 |
1 files changed, 61 insertions, 74 deletions
diff --git a/keyboards/tkc1800/keymaps/smt/keymap.c b/keyboards/tkc1800/keymaps/smt/keymap.c index 6683416e36..9f506b443b 100644 --- a/keyboards/tkc1800/keymaps/smt/keymap.c +++ b/keyboards/tkc1800/keymaps/smt/keymap.c @@ -13,30 +13,23 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "tkc1800.h" +#include QMK_KEYBOARD_H #include "LUFA/Drivers/Peripheral/TWI.h" #include "i2c.h" #include "ssd1306.h" -#define MODS_SHFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) -#define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) - // Custom macros #define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl #define HPR_TAB ALL_T(KC_TAB) // Tap for Tab, hold for Hyper (Super+Ctrl+Shift+Alt) #define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift -// Helpful defines -#define ______ KC_TRNS -#define XXXXXX KC_NO - //Layers enum { - QWERTY = 0, - COLEMAK, - DVORAK, - FUNCTION, + QWERTY = 0, + COLEMAK, + DVORAK, + FUNCTION, }; //13 characters max without re-writing the "Layer: " format in iota_gfx_task_user() @@ -62,15 +55,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Ctrl|Gui |Alt | Space |Alt |Gui|Ctr|Left |Down|Rght| 0 | . | | * `---------------------------------------------------------------------------------' */ - [QWERTY] = LAYOUT( - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_HOME, KC_PGUP, KC_PSCR, \ - KC_DEL, KC_END, KC_PGDN, KC_SLCK, \ - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, KC_NLCK, KC_PSLS, KC_PAST, KC_PAUS, \ - HPR_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, KC_P7, KC_P8, KC_P9, KC_PMNS, \ - CTL_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, XXXXXX, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, \ - KC_LSFT, XXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT,KC_SLSH, SFT_ENT, KC_UP, KC_P1, KC_P2, KC_P3, XXXXXX, \ - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(FUNCTION), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT - ), + [QWERTY] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_HOME, KC_PGUP, KC_PSCR, \ + KC_DEL, KC_END, KC_PGDN, KC_SLCK, \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, KC_NLCK, KC_PSLS, KC_PAST, KC_PAUS, \ + HPR_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, KC_P7, KC_P8, KC_P9, KC_PMNS, \ + CTL_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, XXXXXXX, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, \ + KC_LSFT, XXXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT, KC_UP, KC_P1, KC_P2, KC_P3, XXXXXXX, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(FUNCTION), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT \ + ), /* Keymap COLEMAK: (Colemak Layer) Default Layer * ,-------------------------------------------------------. ,-------------------. * |Esc| F1| F2| F3| F4| | F5| F6| F7| F8| | F9|F10|F11|F12| |Ins |Home|PgUp|PrSc| @@ -88,15 +81,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Ctrl|Gui |Alt | Space |Alt |Gui|Ctr|Left |Down|Rght| 0 | . | | * `---------------------------------------------------------------------------------' */ - [COLEMAK] = LAYOUT( - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_HOME, KC_PGUP, KC_PSCR, \ - KC_DEL, KC_END, KC_PGDN, KC_SLCK, \ - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, KC_NLCK, KC_PSLS, KC_PAST, KC_PAUS, \ - HPR_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, KC_RBRC, KC_BSPC, KC_P7, KC_P8, KC_P9, KC_PMNS, \ - CTL_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, XXXXXX, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, \ - KC_LSFT, XXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT,KC_SLSH, SFT_ENT, KC_UP, KC_P1, KC_P2, KC_P3, XXXXXX, \ - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(FUNCTION), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT - ), + [COLEMAK] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_HOME, KC_PGUP, KC_PSCR, \ + KC_DEL, KC_END, KC_PGDN, KC_SLCK, \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, KC_NLCK, KC_PSLS, KC_PAST, KC_PAUS, \ + HPR_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, KC_RBRC, KC_BSPC, KC_P7, KC_P8, KC_P9, KC_PMNS, \ + CTL_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, XXXXXXX, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, \ + KC_LSFT, XXXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT, KC_UP, KC_P1, KC_P2, KC_P3, XXXXXXX, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(FUNCTION), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT \ + ), /* Keymap DVORAK: (Dvorak Layer) Default Layer * ,-------------------------------------------------------. ,-------------------. * |Esc| F1| F2| F3| F4| | F5| F6| F7| F8| | F9|F10|F11|F12| |Ins |Home|PgUp|PrSc| @@ -114,50 +107,43 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Ctrl|Gui |Alt | Space |Alt |Gui|Ctr|Left |Down|Rght| 0 | . | | * `---------------------------------------------------------------------------------' */ - [DVORAK] = LAYOUT( - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_HOME, KC_PGUP, KC_PSCR, \ - KC_DEL, KC_END, KC_PGDN, KC_SLCK, \ - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_RBRC, KC_BSLS, KC_GRV, KC_NLCK, KC_PSLS, KC_PAST, KC_PAUS, \ - HPR_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL, KC_BSPC, KC_P7, KC_P8, KC_P9, KC_PMNS, \ - CTL_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, XXXXXX, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, \ - KC_LSFT, XXXXXX, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, SFT_ENT, KC_UP, KC_P1, KC_P2, KC_P3, XXXXXX, \ - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(FUNCTION), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT - ), - [FUNCTION] = LAYOUT( - ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, KC_INS, KC_HOME, KC_PGUP, KC_PSCR, \ - KC_DEL, KC_END, KC_PGDN, KC_SLCK, \ - ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, RESET, KC_NLCK, KC_PSLS, KC_PAST, KC_PAUS, \ - ______, ______, ______, ______, ______, ______, ______, QWERTY, COLEMAK,DVORAK, ______, ______, ______, ______, KC_P7, KC_P8, KC_P9, KC_PMNS, \ - ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, XXXXXX, ______, KC_P4, KC_P5, KC_P6, KC_PPLS, \ - ______, XXXXXX, RGB_TOG,RGB_MOD,RGB_HUI,RGB_HUD,RGB_SAI,RGB_SAD,RGB_VAI,RGB_VAD, BL_STEP,______, ______, KC_UP, KC_P1, KC_P2, KC_P3, XXXXXX, \ - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, ______, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT - ), + [DVORAK] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_HOME, KC_PGUP, KC_PSCR, \ + KC_DEL, KC_END, KC_PGDN, KC_SLCK, \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_RBRC, KC_BSLS, KC_GRV, KC_NLCK, KC_PSLS, KC_PAST, KC_PAUS, \ + HPR_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL, KC_BSPC, KC_P7, KC_P8, KC_P9, KC_PMNS, \ + CTL_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, XXXXXXX, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, \ + KC_LSFT, XXXXXXX, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, SFT_ENT, KC_UP, KC_P1, KC_P2, KC_P3, XXXXXXX, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(FUNCTION), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT \ + ), + [FUNCTION] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, KC_HOME, KC_PGUP, KC_PSCR, \ + KC_DEL, KC_END, KC_PGDN, KC_SLCK, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET, KC_NLCK, KC_PSLS, KC_PAST, KC_PAUS, \ + _______, _______, _______, _______, _______, _______, _______, QWERTY, COLEMAK, DVORAK, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PMNS, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, XXXXXXX, _______, KC_P4, KC_P5, KC_P6, KC_PPLS, \ + _______, XXXXXXX, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, BL_STEP, _______, _______, KC_UP, KC_P1, KC_P2, KC_P3, XXXXXXX, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, _______, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT \ + ), }; -// const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {}; - -void persistent_default_layer_set(uint16_t default_layer) { - eeconfig_update_default_layer(default_layer); - default_layer_set(default_layer); -} - bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case QWERTY: if (record->event.pressed) { - persistent_default_layer_set(1UL<<QWERTY); + set_single_persistent_default_layer(QWERTY); } return false; break; case COLEMAK: if (record->event.pressed) { - persistent_default_layer_set(1UL<<COLEMAK); + set_single_persistent_default_layer(COLEMAK); } return false; break; case DVORAK: if (record->event.pressed) { - persistent_default_layer_set(1UL<<DVORAK); + set_single_persistent_default_layer(DVORAK); } return false; break; @@ -168,25 +154,26 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { void led_set_user(uint8_t usb_led) { } + void matrix_init_user(void) { #ifdef USE_I2C i2c_master_init(); - #ifdef SSD1306OLED - // calls code for the SSD1306 OLED - _delay_ms(400); - TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); - iota_gfx_init(); // turns on the display + #ifdef SSD1306OLED + // calls code for the SSD1306 OLED + _delay_ms(400); + TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); + iota_gfx_init(); // turns on the display + #endif #endif + #ifdef AUDIO_ENABLE + startup_user(); #endif - #ifdef AUDIO_ENABLE - startup_user(); - #endif } void matrix_scan_user(void) { - #ifdef SSD1306OLED - iota_gfx_task(); // this is what updates the display continuously - #endif + #ifdef SSD1306OLED + iota_gfx_task(); // this is what updates the display continuously + #endif } void matrix_update(struct CharacterMatrix *dest, @@ -198,11 +185,11 @@ void matrix_update(struct CharacterMatrix *dest, } void iota_gfx_task_user(void) { -#if DEBUG_TO_SCREEN - if (debug_enable) { - return; - } -#endif + #if DEBUG_TO_SCREEN + if (debug_enable) { + return; + } + #endif struct CharacterMatrix matrix; |