diff options
Diffstat (limited to 'keyboards/splitkb')
-rw-r--r-- | keyboards/splitkb/kyria/keymaps/drashna/chconf.h | 24 | ||||
-rw-r--r-- | keyboards/splitkb/kyria/keymaps/drashna/config.h | 43 | ||||
-rw-r--r-- | keyboards/splitkb/kyria/keymaps/drashna/halconf.h | 24 | ||||
-rw-r--r-- | keyboards/splitkb/kyria/keymaps/drashna/keymap.c | 60 | ||||
-rw-r--r-- | keyboards/splitkb/kyria/keymaps/drashna/mcuconf.h | 35 | ||||
-rw-r--r-- | keyboards/splitkb/kyria/keymaps/drashna/rules.mk | 13 | ||||
-rw-r--r-- | keyboards/splitkb/zima/keymaps/drashna/keymap.c | 10 | ||||
-rw-r--r-- | keyboards/splitkb/zima/keymaps/drashna/readme.md | 7 |
8 files changed, 183 insertions, 33 deletions
diff --git a/keyboards/splitkb/kyria/keymaps/drashna/chconf.h b/keyboards/splitkb/kyria/keymaps/drashna/chconf.h new file mode 100644 index 0000000000..1ee8438cdf --- /dev/null +++ b/keyboards/splitkb/kyria/keymaps/drashna/chconf.h @@ -0,0 +1,24 @@ +/* Copyright 2020 QMK + * + * 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 + +#if defined(KEYBOARD_splitkb_kyria_rev3) +#define CH_CFG_ST_RESOLUTION 16 +#define CH_CFG_ST_FREQUENCY 10000 +#endif + +#include_next <chconf.h> diff --git a/keyboards/splitkb/kyria/keymaps/drashna/config.h b/keyboards/splitkb/kyria/keymaps/drashna/config.h index 2d1fbdcb02..702599605c 100644 --- a/keyboards/splitkb/kyria/keymaps/drashna/config.h +++ b/keyboards/splitkb/kyria/keymaps/drashna/config.h @@ -19,10 +19,10 @@ #define EE_HANDS #ifdef OLED_ENABLE -# ifdef OLED_DRIVER_SH1107 -# undef OLED_DISPLAY_128X64 -# define OLED_DISPLAY_128X128 -# endif +# undef OLED_DISPLAY_128X64 +# define OLED_DISPLAY_128X128 +# define OLED_PRE_CHARGE_PERIOD 0x22 +# define OLED_VCOM_DETECT 0x35 #endif #ifdef RGBLIGHT_ENABLE @@ -36,12 +36,41 @@ # define RGBLIGHT_LAYERS #endif -#define KEYLOGGER_LENGTH 10 #define QMK_ESC_INPUT D4 #define QMK_ESC_OUTPUT B2 -#ifndef KEYBOARD_splitkb_kyria_rev3 +#ifdef KEYBOARD_splitkb_kyria_rev3 +# define SERIAL_USART_FULL_DUPLEX // Enable full duplex operation mode. +# define SERIAL_USART_PIN_SWAP // Swap TX and RX pins if keyboard is master halve. +# define SERIAL_USART_DRIVER SD1 // USART driver of TX pin. default: SD1 +# define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7 +# undef SOFT_SERIAL_PIN +# define SERIAL_USART_TX_PIN D3 +# define SERIAL_USART_RX_PIN D2 + +# undef WS2812_DI_PIN +# define WS2812_DI_PIN PAL_LINE(GPIOA, 3) +# define WS2812_PWM_DRIVER PWMD2 // default: PWMD2 +# define WS2812_PWM_CHANNEL 4 // default: 2 +# define WS2812_PWM_PAL_MODE 1 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 2 +# define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. +# define WS2812_DMA_CHANNEL 2 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. +# define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM2_UP // DMAMUX configuration for TIMx_UP -- only required if your MCU has a DMAMUX peripheral, see the respective reference manual for the appropriate values for your MCU. + +# define BOOTMAGIC_LITE_ROW 0 +# define BOOTMAGIC_LITE_COLUMN 6 +# define BOOTMAGIC_LITE_ROW_RIGHT 4 +# define BOOTMAGIC_LITE_COLUMN_RIGHT 6 + +# define BOOTMAGIC_LITE_EEPROM_ROW 1 +# define BOOTMAGIC_LITE_EEPROM_COLUMN 6 +# define BOOTMAGIC_LITE_EEPROM_ROW_RIGHT 5 +# define BOOTMAGIC_LITE_EEPROM_COLUMN_RIGHT 6 +# define SECURE_UNLOCK_SEQUENCE { {1, 5}, {1, 4}, {1, 3}, {1, 2} } + +# define ENCODER_RESOLUTION 2 +#else # define BOOTMAGIC_LITE_ROW 0 # define BOOTMAGIC_LITE_COLUMN 7 # define BOOTMAGIC_LITE_ROW_RIGHT 4 @@ -55,7 +84,7 @@ #define SERIAL_USART_SPEED 921600 -#if defined(KEYBOARD_splitkb_kyria_rev1_proton_c) +#if defined(KEYBOARD_splitkb_kyria_rev1_proton_c) || defined(KEYBOARD_splitkb_kyria_rev3) # define WEAR_LEVELING_BACKING_SIZE 16384 # define WEAR_LEVELING_LOGICAL_SIZE 8192 #endif diff --git a/keyboards/splitkb/kyria/keymaps/drashna/halconf.h b/keyboards/splitkb/kyria/keymaps/drashna/halconf.h new file mode 100644 index 0000000000..b23c85d0f1 --- /dev/null +++ b/keyboards/splitkb/kyria/keymaps/drashna/halconf.h @@ -0,0 +1,24 @@ +/* Copyright 2020 QMK + * + * 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 3 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 <https://www.gnu.org/licenses/>. + */ +#pragma once + +#if defined(KEYBOARD_splitkb_kyria_rev3) +# define HAL_USE_I2C TRUE +# define HAL_USE_PWM TRUE +# define HAL_USE_SERIAL TRUE +#endif + +#include_next <halconf.h> diff --git a/keyboards/splitkb/kyria/keymaps/drashna/keymap.c b/keyboards/splitkb/kyria/keymaps/drashna/keymap.c index 34f6e0d8e2..5a2b886fe4 100644 --- a/keyboards/splitkb/kyria/keymaps/drashna/keymap.c +++ b/keyboards/splitkb/kyria/keymaps/drashna/keymap.c @@ -32,7 +32,7 @@ K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \ ) \ LAYOUT_wrapper( \ - KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \ + SH_T(KC_ESC), K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, SH_T(KC_MINS), \ LALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(K1B), \ OS_LSFT, CTL_T(K21), K22, K23, K24, K25, TG_GAME, MEH(KC_MINS), TG_DBLO, KC_CAPS, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \ KC_MUTE, OS_LALT, KC_GRV, KC_SPC, BK_LWER, DL_RAIS, KC_ENT, OS_RGUI, UC(0x03A8), UC(0x2E2E) \ @@ -126,7 +126,7 @@ void render_oled_title(bool side) { } oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { -# ifdef OLED_DRIVER_SH1107 +# ifdef OLED_DISPLAY_128X128 return OLED_ROTATION_0; # else return OLED_ROTATION_180; @@ -155,7 +155,7 @@ void oled_render_large_display(bool side) { } #endif -#ifdef RGBLIGHT_LAYERS +#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS) const rgblight_segment_t PROGMEM shift_layers[] = RGBLIGHT_LAYER_SEGMENTS({8, 1, 120, 255, 255}, {18, 1, 120, 255, 255}); const rgblight_segment_t PROGMEM control_layers[] = RGBLIGHT_LAYER_SEGMENTS({6, 1, 0, 255, 255}, {16, 1, 0, 255, 255}); const rgblight_segment_t PROGMEM alt_layers[] = RGBLIGHT_LAYER_SEGMENTS({2, 1, 240, 255, 255}, {17, 1, 250, 255, 255}); @@ -174,12 +174,56 @@ void housekeeping_task_keymap(void) { rgblight_set_layer_state(2, mods & MOD_MASK_ALT); rgblight_set_layer_state(3, mods & MOD_MASK_GUI); } -#endif +#elif defined(RGB_MATRIX_ENABLE) && defined(KEYBOARD_splitkb_kyria_rev3) +void keyboard_post_init_keymap(void) { + extern led_config_t g_led_config; + g_led_config.flags[30] = g_led_config.flags[24] = g_led_config.flags[18] = g_led_config.flags[12] = g_led_config.flags[11] = g_led_config.flags[10] = g_led_config.flags[9] = g_led_config.flags[8] = g_led_config.flags[7] = g_led_config.flags[6] = g_led_config.flags[37] = g_led_config.flags[38] = g_led_config.flags[39] = g_led_config.flags[40] = g_led_config.flags[41] = g_led_config.flags[42] = g_led_config.flags[43] = g_led_config.flags[49] = g_led_config.flags[55] = g_led_config.flags[61] = LED_FLAG_MODIFIER; +} + +void check_default_layer(uint8_t mode, uint8_t type, uint8_t led_min, uint8_t led_max) { + switch (get_highest_layer(default_layer_state)) { + case _QWERTY: + rgb_matrix_layer_helper(DEFAULT_LAYER_1_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max); + break; + case _COLEMAK_DH: + rgb_matrix_layer_helper(DEFAULT_LAYER_2_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max); + break; + case _COLEMAK: + rgb_matrix_layer_helper(DEFAULT_LAYER_3_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max); + break; + case _DVORAK: + rgb_matrix_layer_helper(DEFAULT_LAYER_4_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max); + break; + } +} -#ifdef KEYBOARD_splitkb_kyria_rev1_proton_c -void matrix_output_unselect_delay(uint8_t line, bool key_pressed) { - for (int32_t i = 0; i < 40; i++) { - __asm__ volatile("nop" ::: "memory"); +bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) { + if (userspace_config.rgb_layer_change) { + switch (get_highest_layer(layer_state)) { + case _GAMEPAD: + rgb_matrix_layer_helper(HSV_ORANGE, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max); + break; + case _DIABLO: + rgb_matrix_layer_helper(HSV_RED, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max); + break; + case _RAISE: + rgb_matrix_layer_helper(HSV_YELLOW, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max); + break; + case _LOWER: + rgb_matrix_layer_helper(HSV_GREEN, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max); + break; + case _ADJUST: + rgb_matrix_layer_helper(HSV_RED, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max); + break; + case _MOUSE: + rgb_matrix_layer_helper(HSV_PURPLE, 1, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max); + break; + default: + check_default_layer(0, LED_FLAG_UNDERGLOW, led_min, led_max); + break; + } + check_default_layer(0, LED_FLAG_MODIFIER, led_min, led_max); } + return false; } #endif diff --git a/keyboards/splitkb/kyria/keymaps/drashna/mcuconf.h b/keyboards/splitkb/kyria/keymaps/drashna/mcuconf.h new file mode 100644 index 0000000000..2bee30b342 --- /dev/null +++ b/keyboards/splitkb/kyria/keymaps/drashna/mcuconf.h @@ -0,0 +1,35 @@ +/* Copyright 2020 Nick Brassel (tzarc) + * + * 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 3 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 <https://www.gnu.org/licenses/>. + */ + +#pragma once + +#include_next <mcuconf.h> + +#if defined(KEYBOARD_splitkb_kyria_rev3) +# undef STM32_PWM_USE_ADVANCED +# define STM32_PWM_USE_ADVANCED TRUE + +# undef STM32_PWM_USE_TIM2 +# define STM32_PWM_USE_TIM2 TRUE +# undef STM32_PWM_USE_TIM3 +# define STM32_PWM_USE_TIM3 FALSE + +# undef STM32_SERIAL_USE_USART1 +# define STM32_SERIAL_USE_USART1 TRUE + +# undef STM32_ST_USE_TIMER +# define STM32_ST_USE_TIMER 3 +#endif diff --git a/keyboards/splitkb/kyria/keymaps/drashna/rules.mk b/keyboards/splitkb/kyria/keymaps/drashna/rules.mk index 882a3fba09..bb872743b7 100644 --- a/keyboards/splitkb/kyria/keymaps/drashna/rules.mk +++ b/keyboards/splitkb/kyria/keymaps/drashna/rules.mk @@ -11,6 +11,16 @@ KEY_LOCK_ENABLE = no WPM_ENABLE = yes ifeq ($(strip $(KEYBOARD)), splitkb/kyria/rev1/proton_c) + OVERLOAD_FEATURES = yes +endif +ifeq ($(strip $(KEYBOARD)), splitkb/kyria/rev3) + OVERLOAD_FEATURES = yes + CONVERT_TO = proton_c + WS2812_DRIVER = pwm + SERIAL_DRIVER = usart +endif + +ifeq ($(strip $(OVERLOAD_FEATURES)), yes) RGB_MATRIX_ENABLE = yes CONSOLE_ENABLE = yes # Console for debug MOUSEKEY_ENABLE = yes # Mouse keys @@ -20,7 +30,8 @@ ifeq ($(strip $(KEYBOARD)), splitkb/kyria/rev1/proton_c) ENCODER_MAP_ENABLE = yes AUTOCORRECT_ENABLE = yes CAPS_WORD_ENABLE = yes - OLED_DRIVER = custom + AUDIO_ENABLE = no + DEBUG_MATRIX_SCAN_RATE_ENABLE = api else LTO_ENABLE = yes BOOTLOADER = qmk-hid diff --git a/keyboards/splitkb/zima/keymaps/drashna/keymap.c b/keyboards/splitkb/zima/keymaps/drashna/keymap.c index de3d74474e..f7f3b54fbd 100644 --- a/keyboards/splitkb/zima/keymaps/drashna/keymap.c +++ b/keyboards/splitkb/zima/keymaps/drashna/keymap.c @@ -143,13 +143,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) { return true; } - -bool encoder_update_user(uint8_t index, bool clockwise) { - oled_timer = timer_read32(); - if (clockwise) { - tap_code_delay(KC_VOLU, 10); - } else { - tap_code_delay(KC_VOLD, 10); - } - return false; -} diff --git a/keyboards/splitkb/zima/keymaps/drashna/readme.md b/keyboards/splitkb/zima/keymaps/drashna/readme.md deleted file mode 100644 index 0f78f4bf18..0000000000 --- a/keyboards/splitkb/zima/keymaps/drashna/readme.md +++ /dev/null @@ -1,7 +0,0 @@ -# The default keymap for zima - -This includes support for the OLED and Encoder. However, the actual code is found in the `zima.c` file. This can be replaced by adding your own `oled_task_user(void)` and `encoder_update_user` functinons. These will replace what is in the keyboard, and allow you to customize these features. - -The reason that this is done this way, is so that this functionality will work on the [QMK Configurator](https://config.qmk.fm/#/splitkb/zima/LAYOUT_ortho_4x3) - -For reference, the code used for the oled and encoder defaults is in [zima.c](https://github.com/qmk/qmk_firmware/tree/master/keyboards/splitkb/zima/zima.c). |