From b20bbc715216246ac7a93176eac2c5b428b272bf Mon Sep 17 00:00:00 2001 From: Gigahawk Date: Sun, 30 Jan 2022 11:00:22 -0800 Subject: [Keymap]: Create Gigahawk GMMK Pro keymap (#15934) --- keyboards/gmmk/pro/ansi/keymaps/gigahawk/config.h | 6 ++ keyboards/gmmk/pro/ansi/keymaps/gigahawk/keymap.c | 74 +++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 keyboards/gmmk/pro/ansi/keymaps/gigahawk/config.h create mode 100644 keyboards/gmmk/pro/ansi/keymaps/gigahawk/keymap.c (limited to 'keyboards') diff --git a/keyboards/gmmk/pro/ansi/keymaps/gigahawk/config.h b/keyboards/gmmk/pro/ansi/keymaps/gigahawk/config.h new file mode 100644 index 0000000000..9ba8a7b1b7 --- /dev/null +++ b/keyboards/gmmk/pro/ansi/keymaps/gigahawk/config.h @@ -0,0 +1,6 @@ +// Copyright 2021 Jasper Chan (@Gigahawk) +// SPDX-License-Identifier: GPL-2.0-or-later +#pragma once + +#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_SOLID_COLOR +#define RGB_MATRIX_STARTUP_SPD 0 diff --git a/keyboards/gmmk/pro/ansi/keymaps/gigahawk/keymap.c b/keyboards/gmmk/pro/ansi/keymaps/gigahawk/keymap.c new file mode 100644 index 0000000000..8eedeb6e00 --- /dev/null +++ b/keyboards/gmmk/pro/ansi/keymaps/gigahawk/keymap.c @@ -0,0 +1,74 @@ +// Copyright 2021 Jasper Chan (@Gigahawk) +// SPDX-License-Identifier: GPL-2.0-or-later +#include QMK_KEYBOARD_H + +enum layers { + _BASE, + _GAME, + _TRAN, +}; + +#define _BASE_COLOR_RGB 156, 123, 85 +#define _GAME_COLOR_RGB 147, 21, 21 +#define _TRAN_COLOR_RGB 45, 89, 24 +#define _CAPS_COLOR_RGB 146, 140, 16 + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_BASE] = 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_DEL, KC_MUTE, + 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_BSPC, KC_HOME, + KC_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_BSLS, KC_PGUP, + 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_ENT, KC_PGDN, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(2), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + + [_GAME] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + XXXXXXX, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_TRAN] = LAYOUT( + KC_CAPS, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, KC_INS, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + TG(1), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, KC_MPLY, _______, _______, _______, KC_MPRV, _______, KC_MNXT + ), + +}; +// clang-format on + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + return true; +} + +void rgb_matrix_indicators_user(void) { + if (IS_LAYER_ON(_TRAN)) { + rgb_matrix_set_color_all(_TRAN_COLOR_RGB); + } else if (IS_LAYER_ON(_GAME)) { + rgb_matrix_set_color_all(_GAME_COLOR_RGB); + } else if (IS_LAYER_ON(_BASE)) { + rgb_matrix_set_color_all(_BASE_COLOR_RGB); + } + + if (host_keyboard_led_state().caps_lock) { + for (uint8_t i = 0; i < DRIVER_LED_TOTAL; ++i) { + if (HAS_ANY_FLAGS(g_led_config.flags[i], LED_FLAG_UNDERGLOW)) { + rgb_matrix_set_color(i, _CAPS_COLOR_RGB); + } + } + } +} -- cgit v1.2.3