From 678fae6ccef96ee1f7a722d4781e18c8314e3b29 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Mon, 14 May 2018 07:11:12 -0700 Subject: Reformat 40% Ortho boards to work with Layouts feature (#2804) * Reformat 40% Ortho boards to work with Layouts feature * Fix krusli keymap to compile properly * Fix mt40 compile errors * Fix layouts * fix RGB? --- keyboards/mt40/config.h | 11 ++---- keyboards/mt40/keymaps/default/config.h | 11 ++++++ keyboards/mt40/keymaps/default/keymap.c | 24 +++++-------- keyboards/mt40/matrix.c | 24 ++++++++++++- keyboards/mt40/mt40.c | 3 +- keyboards/mt40/mt40.h | 63 ++++++++++----------------------- keyboards/mt40/rules.mk | 5 ++- 7 files changed, 71 insertions(+), 70 deletions(-) create mode 100644 keyboards/mt40/keymaps/default/config.h (limited to 'keyboards/mt40') diff --git a/keyboards/mt40/config.h b/keyboards/mt40/config.h index 6c82b2c74f..cf3326d7bf 100644 --- a/keyboards/mt40/config.h +++ b/keyboards/mt40/config.h @@ -35,17 +35,12 @@ along with this program. If not, see . #define MATRIX_ROWS 8 #define MATRIX_COLS 15 -#define RGB_DI_PIN C0 -#define RGBLED_NUM 12 -#define RGBLIGHT_ANIMATIONS - -#define RGBLIGHT_HUE_STEP 12 -#define RGBLIGHT_SAT_STEP 15 -#define RGBLIGHT_VAL_STEP 18 #define NO_UART 1 -#define TAPPING_TERM 200 +#define RGB_DI_PIN C0 +#define RGBLED_NUM 12 +#define RGBLIGHT_ANIMATIONS /* * Keyboard Matrix Assignments diff --git a/keyboards/mt40/keymaps/default/config.h b/keyboards/mt40/keymaps/default/config.h new file mode 100644 index 0000000000..9f9a9fc107 --- /dev/null +++ b/keyboards/mt40/keymaps/default/config.h @@ -0,0 +1,11 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#define TAPPING_TERM 200 + + +#define RGBLIGHT_HUE_STEP 12 +#define RGBLIGHT_SAT_STEP 15 +#define RGBLIGHT_VAL_STEP 18 + +#endif diff --git a/keyboards/mt40/keymaps/default/keymap.c b/keyboards/mt40/keymaps/default/keymap.c index 2da5dd6458..193e548f9e 100644 --- a/keyboards/mt40/keymaps/default/keymap.c +++ b/keyboards/mt40/keymaps/default/keymap.c @@ -13,9 +13,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include "mt40.h" -#include "action_layer.h" -#include "rgblight.h" +#include QMK_KEYBOARD_H + #define _______ KC_TRNS #define OOOOOOO KC_TRNS @@ -30,7 +29,7 @@ #define C_ENT MT(MOD_RCTL, KC_ENT) -/* +/* * ,-----------------------------------------------------------------------------------. * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | * |------+------+------+------+------+------+------+------+------+------+------+------| @@ -42,31 +41,31 @@ * `-----------------------------------------------------------------------------------' */ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = KEYMAP( + [0] = LAYOUT_ortho_4x12( KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ C_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, C_ENT, \ KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, \ C_LCTL, C_LGUI, MOD_LALT, MO(3), MO(1), KC_SPC, KC_SPC, MO(2), MO(4), MOD_RALT, C_RGUI, C_RCTL), - [1] = KEYMAP( + [1] = LAYOUT_ortho_4x12( _______, KC_F9, KC_F10, KC_F11, KC_F12, RGB_TOG, RGB_MOD, KC_P7, KC_P8, KC_P9, KC_PSLS, _______, \ _______, KC_F5, KC_F6, KC_F7, KC_F8, RGB_VAD, RGB_VAI, KC_P4, KC_P5, KC_P6, KC_PAST, _______, \ _______, KC_F1, KC_F2, KC_F3, KC_F4, BL_TOGG, BL_INC, KC_P1, KC_P2, KC_P3, KC_PMNS, KC_PGUP, \ _______, _______, _______, _______, OOOOOOO, _______, _______, KC_P0, KC_PDOT, KC_PENT, KC_PPLS, KC_PGDN), - [2] = KEYMAP( + [2] = LAYOUT_ortho_4x12( _______, _______, _______, _______, _______, _______, _______, KC_QUOT, KC_EQL, KC_LBRC, KC_RBRC, KC_NUBS, \ KC_GRAVE, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, \ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ _______, _______, _______, _______, _______, _______, _______, OOOOOOO, KC_HOME, KC_PGDOWN, KC_PGUP, KC_END), - [3] = KEYMAP( + [3] = LAYOUT_ortho_4x12( _______, _______, _______, _______, _______, _______, KC_COPY, KC_PGUP, _______, _______, KC_PASTE, KC_DEL, \ _______, _______, _______, KC_PGDN, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, _______, _______, \ _______, _______, KC_CUT, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ _______, _______, _______, OOOOOOO, _______, _______, _______, _______, _______, _______, _______, _______), - [4] = KEYMAP( + [4] = LAYOUT_ortho_4x12( _______, _______, _______, _______, _______, _______, _______, KC_ACL0, KC_ACL1, KC_ACL2, _______, _______, \ KC_PSCR, KC_INS, KC_MUTE, KC_VOLD, KC_VOLU, _______, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, _______, _______, \ KC_CAPS, _______, KC_MPLY, KC_MRWD, KC_MFFD, _______, _______, _______, KC_BTN1, KC_BTN2, _______, _______, \ @@ -75,10 +74,5 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_LAYER_MOMENTARY(1), - [1] = ACTION_LAYER_MOMENTARY(2), - [2] = ACTION_LAYER_MOMENTARY(3), - [3] = ACTION_LAYER_MOMENTARY(4), -}; + diff --git a/keyboards/mt40/matrix.c b/keyboards/mt40/matrix.c index 140026013f..d75fcc221a 100644 --- a/keyboards/mt40/matrix.c +++ b/keyboards/mt40/matrix.c @@ -19,6 +19,7 @@ along with this program. If not, see . #include #include "matrix.h" +#include "config.h" #ifndef DEBOUNCE # define DEBOUNCE 5 @@ -29,6 +30,26 @@ static uint8_t debouncing = DEBOUNCE; static matrix_row_t matrix[MATRIX_ROWS]; static matrix_row_t matrix_debouncing[MATRIX_ROWS]; +__attribute__ ((weak)) +void matrix_init_kb(void) { + matrix_init_user(); +} + +__attribute__ ((weak)) +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +__attribute__ ((weak)) +void matrix_init_user(void) { +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { +} + + + void matrix_init(void) { // all outputs for rows high DDRB = 0xFF; @@ -47,6 +68,7 @@ void matrix_init(void) { matrix[row] = 0x00; matrix_debouncing[row] = 0x00; } + matrix_init_kb(); } void matrix_set_row_status(uint8_t row) { @@ -93,7 +115,7 @@ uint8_t matrix_scan(void) { } } - matrix_scan_user(); + matrix_scan_kb(); return 1; } diff --git a/keyboards/mt40/mt40.c b/keyboards/mt40/mt40.c index 0e7a30d99f..555689f872 100644 --- a/keyboards/mt40/mt40.c +++ b/keyboards/mt40/mt40.c @@ -38,6 +38,7 @@ void rgblight_set(void) { } __attribute__ ((weak)) -void matrix_scan_user(void) { +void matrix_scan_kb(void) { rgblight_task(); + matrix_init_user(); } diff --git a/keyboards/mt40/mt40.h b/keyboards/mt40/mt40.h index 18cefd827b..23a3d3c2bd 100644 --- a/keyboards/mt40/mt40.h +++ b/keyboards/mt40/mt40.h @@ -16,9 +16,8 @@ #ifndef MT40_H #define MT40_H -#include "quantum_keycodes.h" -#include "keycode.h" -#include "action.h" +#include "quantum.h" + // This a shortcut to help you visually see your layout. // The following is an example using the Planck MIT layout @@ -40,48 +39,24 @@ { KC_NO, KC_NO, K09, K19, K29, KC_NO, K2B, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K08, K18, K28 } \ } -/* #define KC_KEYMAP( \ */ -/* k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ */ -/* k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ */ -/* k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ */ -/* k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b \ */ -/* ) \ */ -/* { \ */ -/* { KC_##k31, KC_##k32, KC_##k33, KC_NO, KC_##k34, KC_##k35, KC_NO, KC_NO, KC_NO, KC_NO, KC_##k37, KC_NO, KC_NO, KC_NO, KC_NO }, \ */ -/* { KC_##k20, KC_##k21, KC_##k22, KC_##k23, KC_##k24, KC_##k25, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_##k2a, KC_NO, KC_NO, KC_NO }, \ */ -/* { KC_##k30, KC_##k11, KC_##k12, KC_##k13, KC_##k14, KC_##k15, KC_NO, KC_NO, KC_NO, KC_NO, KC_##k1b, KC_##k1a, KC_NO, KC_NO, KC_NO }, \ */ -/* { KC_##k10, KC_##k01, KC_##k02, KC_##k03, KC_##k04, KC_##k05, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_##k0a, KC_NO, KC_NO, KC_NO }, \ */ -/* { KC_##k00, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_##k0b }, \ */ -/* { KC_NO, KC_NO, KC_##k06, KC_##k16, KC_##k26, KC_##k36, KC_##k38, KC_##k3a, KC_##k17, KC_##k07, KC_NO, KC_NO, KC_##k3b, KC_##k39, KC_##k27 } \ */ -/* { KC_NO, KC_NO, KC_##k09, KC_##k19, KC_##k29, KC_NO, KC_NO, KC_##k2b, KC_##k18, KC_##k08, KC_NO, KC_NO, KC_NO, KC_NO, KC_##k28 } \ */ -/* } */ +#define KC_KEYMAP( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ + k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b \ + ) \ + KEYMAP( \ + KC_##k00, KC_##k01, KC_##k02, KC_##k03, KC_##k04, KC_##k05, KC_##k06, KC_##k07, KC_##k08, KC_##k09, KC_##k0a, KC_##k0b, \ + KC_##k10, KC_##k11, KC_##k12, KC_##k13, KC_##k14, KC_##k15, KC_##k16, KC_##k17, KC_##k18, KC_##k19, KC_##k1a, KC_##k1b, \ + KC_##k20, KC_##k21, KC_##k22, KC_##k23, KC_##k24, KC_##k25, KC_##k26, KC_##k27, KC_##k28, KC_##k29, KC_##k2a, KC_##k2b, \ + KC_##k30, KC_##k31, KC_##k32, KC_##k33, KC_##k34, KC_##k35, KC_##k36, KC_##k37, KC_##k38, KC_##k39, KC_##k3a, KC_##k3b \ + ) + +#define LAYOUT KEYMAP +#define LAYOUT_ortho_4x12 KEYMAP +#define KC_LAYOUT_ortho_4x12 KC_KEYMAP +#define LAYOUT_kc_ortho_4x12 KC_KEYMAP -/* #define FR_A KC_A */ -/* #define FR_B KC_B */ -/* #define FR_C KC_C */ -/* #define FR_D KC_D */ -/* #define FR_E KC_E */ -/* #define FR_F KC_F */ -/* #define FR_G KC_G */ -/* #define FR_H KC_H */ -/* #define FR_I KC_I */ -/* #define FR_J KC_J */ -/* #define FR_K KC_K */ -/* #define FR_L KC_L */ -/* #define FR_M KC_M */ -/* #define FR_N KC_N */ -/* #define FR_O KC_O */ -/* #define FR_P KC_P */ -/* #define FR_Q KC_Q */ -/* #define FR_R KC_R */ -/* #define FR_S KC_S */ -/* #define FR_T KC_T */ -/* #define FR_U KC_U */ -/* #define FR_V KC_V */ -/* #define FR_W KC_W */ -/* #define FR_X KC_X */ -/* #define FR_Y KC_Y */ -/* #define FR_Z KC_Z */ #endif diff --git a/keyboards/mt40/rules.mk b/keyboards/mt40/rules.mk index 9d230d2388..e7dc061eca 100644 --- a/keyboards/mt40/rules.mk +++ b/keyboards/mt40/rules.mk @@ -11,7 +11,7 @@ F_CPU = 12000000 # Bootloader # This definition is optional, and if your keyboard supports multiple bootloaders of -# different sizes, comment this out, and the correct address will be loaded +# different sizes, comment this out, and the correct address will be loaded # automatically (+60). See bootloader.mk for all options. BOOTLOADER = bootloadHID @@ -39,3 +39,6 @@ SRC = matrix.c i2c.c # programming options PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex + +LAYOUTS = ortho_4x12 planck_mit planck_grid +LAYOUTS_HAS_RGB = no -- cgit v1.2.3