diff options
Diffstat (limited to 'keyboards/xiudi/xd002/keymaps')
-rw-r--r-- | keyboards/xiudi/xd002/keymaps/default/keymap.c | 7 | ||||
-rw-r--r-- | keyboards/xiudi/xd002/keymaps/multilayer_rgb/config.h | 22 | ||||
-rw-r--r-- | keyboards/xiudi/xd002/keymaps/multilayer_rgb/keymap.c | 173 | ||||
-rw-r--r-- | keyboards/xiudi/xd002/keymaps/multilayer_rgb/rgblite.h | 9 | ||||
-rw-r--r-- | keyboards/xiudi/xd002/keymaps/multilayer_rgb/rules.mk | 2 | ||||
-rw-r--r-- | keyboards/xiudi/xd002/keymaps/rgb/keymap.c | 46 | ||||
-rw-r--r-- | keyboards/xiudi/xd002/keymaps/rgb/rules.mk | 1 | ||||
-rw-r--r-- | keyboards/xiudi/xd002/keymaps/rgb_lite/keymap.c | 31 | ||||
-rw-r--r-- | keyboards/xiudi/xd002/keymaps/rgb_lite/rgblite.h | 26 | ||||
-rw-r--r-- | keyboards/xiudi/xd002/keymaps/rgb_lite/rules.mk | 1 | ||||
-rw-r--r-- | keyboards/xiudi/xd002/keymaps/tap_dance/config.h | 3 | ||||
-rw-r--r-- | keyboards/xiudi/xd002/keymaps/tap_dance/keymap.c | 19 | ||||
-rw-r--r-- | keyboards/xiudi/xd002/keymaps/tap_dance/rules.mk | 1 | ||||
-rw-r--r-- | keyboards/xiudi/xd002/keymaps/volume/keymap.c | 7 | ||||
-rw-r--r-- | keyboards/xiudi/xd002/keymaps/volume/rules.mk | 1 |
15 files changed, 349 insertions, 0 deletions
diff --git a/keyboards/xiudi/xd002/keymaps/default/keymap.c b/keyboards/xiudi/xd002/keymaps/default/keymap.c new file mode 100644 index 0000000000..ae53d396d1 --- /dev/null +++ b/keyboards/xiudi/xd002/keymaps/default/keymap.c @@ -0,0 +1,7 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_A, KC_B + ) +}; diff --git a/keyboards/xiudi/xd002/keymaps/multilayer_rgb/config.h b/keyboards/xiudi/xd002/keymaps/multilayer_rgb/config.h new file mode 100644 index 0000000000..f478baf3b3 --- /dev/null +++ b/keyboards/xiudi/xd002/keymaps/multilayer_rgb/config.h @@ -0,0 +1,22 @@ +/* Copyright 2020 elmo-space<mail@elmo.space> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#pragma once + +/*enable layers*/ +#undef NO_ACTION_LAYER + +/* increase tap duration (spotify doesn't like very short taps)*/ +#define TAP_CODE_DELAY 100 diff --git a/keyboards/xiudi/xd002/keymaps/multilayer_rgb/keymap.c b/keyboards/xiudi/xd002/keymaps/multilayer_rgb/keymap.c new file mode 100644 index 0000000000..4ae28fd91b --- /dev/null +++ b/keyboards/xiudi/xd002/keymaps/multilayer_rgb/keymap.c @@ -0,0 +1,173 @@ +/* Copyright 2020 elmo-space<mail@elmo.space> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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 QMK_KEYBOARD_H +#include "rgblite.h" + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _BASE, + _FUNC, +}; + +// set your keycodes here +#define layer1_left KC_PAUS +#define layer1_right KC_MPLY +#define layer2_left KC_MPRV +#define layer2_right KC_MNXT + + +enum custom_keycodes { + LEFT1 = SAFE_RANGE, + RIGHT1, + LEFT2, + RIGHT2 +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BASE] = LAYOUT( + LEFT1, RIGHT1 + ), + [_FUNC] = LAYOUT( + LEFT2, RIGHT2 + ) +}; + +static bool key1_down = false; +static bool key2_down = false; +static char layer_switched = 0; // this prevents the individual keys getting triggered after a layerchange + +bool process_record_user(uint16_t keycode, keyrecord_t *record) +{ + switch (keycode) + { + case LEFT1: + if (record->event.pressed) + { + if (key2_down) + { + layer_on(1); + layer_switched = 2; + return false; + break; + } + key1_down = true; + } + else { + if (layer_switched > 0) { + --layer_switched; + key1_down = false; + } + else { + tap_code(layer1_left); + key1_down = false; + } + } + return false; + break; + case RIGHT1: + if (record->event.pressed) + { + if (key1_down) + { + layer_on(1); + layer_switched = 2; + return false; + break; + } + key2_down = true; + } + else { + if (layer_switched > 0) { + --layer_switched; + key2_down = false; + } + else { + tap_code(layer1_right); + key2_down = false; + } + } + return false; + break; + case LEFT2: + if (record->event.pressed) + { + if (key2_down) + { + layer_off(1); + layer_switched = 2; + return false; + break; + } + key1_down = true; + } + else { + if (layer_switched > 0) { + --layer_switched; + key1_down = false; + } + else { + tap_code(layer2_left); + key1_down = false; + } + } + return false; + break; + case RIGHT2: + if (record->event.pressed) + { + if (key1_down) + { + layer_off(1); + layer_switched = 2; + return false; + break; + } + key2_down = true; + } + else { + if (layer_switched > 0) { + --layer_switched; + key2_down = false; + } + else { + tap_code(layer2_right); + key2_down = false; + } + } + return false; + break; + } + return true; +}; + +// layer colors +layer_state_t layer_state_set_user(layer_state_t state) { + switch (get_highest_layer(state)) { + case _FUNC: + rgblite_setrgb(RGB_RED); + break; + default: // for any other layers, or the default layer + rgblite_setrgb(RGB_GREEN); + break; + } + return state; +} + +// default color +void keyboard_post_init_user(void) { + rgblite_setrgb(RGB_GREEN); +} diff --git a/keyboards/xiudi/xd002/keymaps/multilayer_rgb/rgblite.h b/keyboards/xiudi/xd002/keymaps/multilayer_rgb/rgblite.h new file mode 100644 index 0000000000..8a14a8f956 --- /dev/null +++ b/keyboards/xiudi/xd002/keymaps/multilayer_rgb/rgblite.h @@ -0,0 +1,9 @@ +#pragma once + +#include "ws2812.h" +#include "color.h" + +static inline void rgblite_setrgb(uint8_t _r, uint8_t _g, uint8_t _b) { + LED_TYPE leds[RGBLED_NUM] = {{.r = _r, .g = _g, .b = _b}, {.r = _r, .g = _g, .b = _b}}; + ws2812_setleds(leds, RGBLED_NUM); +} diff --git a/keyboards/xiudi/xd002/keymaps/multilayer_rgb/rules.mk b/keyboards/xiudi/xd002/keymaps/multilayer_rgb/rules.mk new file mode 100644 index 0000000000..69d592aa4b --- /dev/null +++ b/keyboards/xiudi/xd002/keymaps/multilayer_rgb/rules.mk @@ -0,0 +1,2 @@ +SRC += ws2812.c +EXTRAKEY_ENABLE = yes diff --git a/keyboards/xiudi/xd002/keymaps/rgb/keymap.c b/keyboards/xiudi/xd002/keymaps/rgb/keymap.c new file mode 100644 index 0000000000..af04734138 --- /dev/null +++ b/keyboards/xiudi/xd002/keymaps/rgb/keymap.c @@ -0,0 +1,46 @@ +#include QMK_KEYBOARD_H + +// Defines the keycodes used by our macros in process_record_user +enum custom_keycodes { + QMKURL = SAFE_RANGE, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + RGB_HUI, QMKURL + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + switch (keycode) { + case QMKURL: + // Using SEND_STRING here adds 400bytes ... + // SEND_STRING("https://qmk.fm/" SS_TAP(X_ENTER)); + tap_code(KC_H); + tap_code(KC_T); + tap_code(KC_T); + tap_code(KC_P); + tap_code(KC_S); + tap_code16(KC_COLON); + tap_code(KC_SLASH); + tap_code(KC_SLASH); + tap_code(KC_Q); + tap_code(KC_M); + tap_code(KC_K); + tap_code(KC_DOT); + tap_code(KC_F); + tap_code(KC_M); + tap_code(KC_SLASH); + tap_code(KC_ENTER); + break; + } + } + return true; +} + +void keyboard_post_init_user(void) { + rgblight_enable_noeeprom(); // enables Rgb, without saving settings + rgblight_sethsv_noeeprom(180, 255, 255); // sets the color to teal/cyan without saving + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); // sets mode to Fast breathing without saving +} diff --git a/keyboards/xiudi/xd002/keymaps/rgb/rules.mk b/keyboards/xiudi/xd002/keymaps/rgb/rules.mk new file mode 100644 index 0000000000..1e3cebb145 --- /dev/null +++ b/keyboards/xiudi/xd002/keymaps/rgb/rules.mk @@ -0,0 +1 @@ +RGBLIGHT_ENABLE = yes diff --git a/keyboards/xiudi/xd002/keymaps/rgb_lite/keymap.c b/keyboards/xiudi/xd002/keymaps/rgb_lite/keymap.c new file mode 100644 index 0000000000..a795ca8a6d --- /dev/null +++ b/keyboards/xiudi/xd002/keymaps/rgb_lite/keymap.c @@ -0,0 +1,31 @@ +#include QMK_KEYBOARD_H +#include "rgblite.h" + +// Defines the keycodes used by our macros in process_record_user +enum custom_keycodes { + QMKURL = SAFE_RANGE, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + RGB_HUI, QMKURL + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + switch (keycode) { + case RGB_HUI: + rgblite_increase_hue(); + break; + case QMKURL: + SEND_STRING("https://qmk.fm/" SS_TAP(X_ENTER)); + break; + } + } + return true; +} + +void keyboard_post_init_user(void) { + rgblite_increase_hue(); +} diff --git a/keyboards/xiudi/xd002/keymaps/rgb_lite/rgblite.h b/keyboards/xiudi/xd002/keymaps/rgb_lite/rgblite.h new file mode 100644 index 0000000000..b7919f9767 --- /dev/null +++ b/keyboards/xiudi/xd002/keymaps/rgb_lite/rgblite.h @@ -0,0 +1,26 @@ +#pragma once + +#include "ws2812.h" +#include "color.h" + +static inline void rgblite_setrgb(uint8_t _r, uint8_t _g, uint8_t _b) { + LED_TYPE leds[RGBLED_NUM] = {{.r = _r, .g = _g, .b = _b}, {.r = _r, .g = _g, .b = _b}}; + ws2812_setleds(leds, RGBLED_NUM); +} + +static void rgblite_increase_hue(void) { + static uint8_t state = 0; + + state = (state + 1) % 3; + switch (state) { + case 1: + rgblite_setrgb(RGB_RED); + break; + case 2: + rgblite_setrgb(RGB_BLUE); + break; + default: + rgblite_setrgb(RGB_GREEN); + break; + } +} diff --git a/keyboards/xiudi/xd002/keymaps/rgb_lite/rules.mk b/keyboards/xiudi/xd002/keymaps/rgb_lite/rules.mk new file mode 100644 index 0000000000..227bbcae32 --- /dev/null +++ b/keyboards/xiudi/xd002/keymaps/rgb_lite/rules.mk @@ -0,0 +1 @@ +SRC += ws2812.c diff --git a/keyboards/xiudi/xd002/keymaps/tap_dance/config.h b/keyboards/xiudi/xd002/keymaps/tap_dance/config.h new file mode 100644 index 0000000000..b86e862d30 --- /dev/null +++ b/keyboards/xiudi/xd002/keymaps/tap_dance/config.h @@ -0,0 +1,3 @@ +#pragma once + +#define TAPPING_TERM 500 diff --git a/keyboards/xiudi/xd002/keymaps/tap_dance/keymap.c b/keyboards/xiudi/xd002/keymaps/tap_dance/keymap.c new file mode 100644 index 0000000000..0f384ce99f --- /dev/null +++ b/keyboards/xiudi/xd002/keymaps/tap_dance/keymap.c @@ -0,0 +1,19 @@ +#include QMK_KEYBOARD_H + +enum layers { + _BASE = 0, +}; + +enum { + TD_BC = 0 +}; + +qk_tap_dance_action_t tap_dance_actions[] = { + [TD_BC] = ACTION_TAP_DANCE_DOUBLE(KC_B, KC_C) +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BASE] = LAYOUT( + KC_A, TD(TD_BC) + ) +}; diff --git a/keyboards/xiudi/xd002/keymaps/tap_dance/rules.mk b/keyboards/xiudi/xd002/keymaps/tap_dance/rules.mk new file mode 100644 index 0000000000..e5ddcae8d9 --- /dev/null +++ b/keyboards/xiudi/xd002/keymaps/tap_dance/rules.mk @@ -0,0 +1 @@ +TAP_DANCE_ENABLE = yes diff --git a/keyboards/xiudi/xd002/keymaps/volume/keymap.c b/keyboards/xiudi/xd002/keymaps/volume/keymap.c new file mode 100644 index 0000000000..2365d7b245 --- /dev/null +++ b/keyboards/xiudi/xd002/keymaps/volume/keymap.c @@ -0,0 +1,7 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_VOLU, KC_VOLD + ) +}; diff --git a/keyboards/xiudi/xd002/keymaps/volume/rules.mk b/keyboards/xiudi/xd002/keymaps/volume/rules.mk new file mode 100644 index 0000000000..fcfd2225bc --- /dev/null +++ b/keyboards/xiudi/xd002/keymaps/volume/rules.mk @@ -0,0 +1 @@ +EXTRAKEY_ENABLE = yes |