diff options
author | Drashna Jaelre <drashna@live.com> | 2021-01-22 08:23:03 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-22 08:23:03 -0800 |
commit | 7a08b9d374dfcf9d872738af44b231862064b96f (patch) | |
tree | a83e16b5b6afd67b22fcbdf81ced5896554ca631 /layouts/community/split_3x6_3 | |
parent | c16a3dcb5458bc8d237d26c20a434c333b48d5c8 (diff) |
[Keymap] Cleanup and updating of drashna keymap code (#11516)
* Update other keyboards for rgb matrix changes
* Remove customized bootmagic code
* Fix corne layout compilation error
* Fix compiler errors with all keymaps
* Add Simple Visualizer for ergodox infinity
* Fix compile issue with Corne
* Fix keymap stuff
* Add alias for mouse layer
* Add Halmak Keyboard layout
* Updates for Kyria
* Add support for oled interval
* Change RGB stuff
[CHANGE] Fix coexistence issues
* Fix rgb_stuff
* Add custom ploopyco mouse keymap
* Decrease default dwell time
* Updates based on last breaking changes update
* Disable command on dactyl
* Update ergodox to use proper commands for rgb matrix indicators
* Update all rgb matrix indicator functions
* Update rules for dactyl-manuform
* Reduce wait time for mouse layer off event
* Add more info to logger
* Add wrappers for get_tapping term
* Move version.h include into only file that actually needs it
* Update rgb sleep stuff
* Update key print function
* Change DM keymap settings
* Change pin for DM Manuform
* Add Proton C stuff for Corne keymap
* more arm corne tinkering
* Even more arm stuff for corne
* Cleanup corne stuff
* redirect default keymap to drashna
because I am a very bad man
* change corne rgb priority
* Update tractyl manuform to not conflict
* Add more secret stuff
* more dactyl tweaks
* Add more options to split transport
* Changes of oled support
* Change split settings
* Improve keylogger formatting more
* tweak oled stuff
* Oled and such tweaks
* Reduce brightness due to leds
* Decrease brightness more
* Only run layer code if master
Diffstat (limited to 'layouts/community/split_3x6_3')
-rw-r--r-- | layouts/community/split_3x6_3/drashna/config.h | 36 | ||||
-rw-r--r-- | layouts/community/split_3x6_3/drashna/halconf.h | 22 | ||||
-rw-r--r-- | layouts/community/split_3x6_3/drashna/keymap.c | 81 | ||||
-rw-r--r-- | layouts/community/split_3x6_3/drashna/mcuconf.h | 32 | ||||
-rw-r--r-- | layouts/community/split_3x6_3/drashna/rules.mk | 10 | ||||
-rw-r--r-- | layouts/community/split_3x6_3/drashna/ssd1306.c | 0 |
6 files changed, 122 insertions, 59 deletions
diff --git a/layouts/community/split_3x6_3/drashna/config.h b/layouts/community/split_3x6_3/drashna/config.h index 7db51fb6e9..b9b1d073d6 100644 --- a/layouts/community/split_3x6_3/drashna/config.h +++ b/layouts/community/split_3x6_3/drashna/config.h @@ -19,14 +19,11 @@ /* Select hand configuration */ // #define MASTER_LEFT -// #define MASTER_RIGHT -#define EE_HANDS - +#define MASTER_RIGHT +// #define EE_HAND #undef USE_I2C #undef SSD1306OLED -#define USE_SERIAL_PD2 - // #define TAPPING_FORCE_HOLD // #define TAPPING_TERM 100 @@ -41,6 +38,10 @@ #endif #ifdef RGB_MATRIX_ENABLE +# ifdef CONVERT_TO_PROTON_C +# undef RGB_DI_PIN +# define RGB_DI_PIN PAL_LINE(GPIOA, 3) +# endif # define RGB_MATRIX_KEYPRESSES // reacts to keypresses // # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses) // # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects @@ -54,6 +55,24 @@ # define RGB_MATRIX_SPD_STEP 10 #endif +#ifdef CONVERT_TO_PROTON_C +# define WS2812_PWM_DRIVER PWMD15 // default: PWMD2 +# define WS2812_PWM_CHANNEL 2 // default: 2 +# define WS2812_PWM_PAL_MODE 9 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 2 +# define WS2812_DMA_STREAM STM32_DMA1_STREAM5 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. +# define WS2812_DMA_CHANNEL 5 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. +# define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM15_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. + +# undef SOFT_SERIAL_PIN +# define SOFT_SERIAL_PIN D3 +# 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 + + +// #define INIT_EE_HANDS_LEFT +// #define INIT_EE_HANDS_RIGHT +#endif + #ifdef AUDIO_ENABLE # define B6_AUDIO # define NO_MUSIC_MODE @@ -64,8 +83,11 @@ #endif #undef PRODUCT -#define PRODUCT Drashna Hacked Corne Keyboard - +#ifdef CONVERT_TO_PROTON_C +# define PRODUCT Drashna Hacked ARM Corne Keyboard +#else +# define PRODUCT Drashna Hacked Corne Keyboard +#endif #define OLED_FONT_H "layouts/community/split_3x6_3/drashna/glcdfont.c" // #define OLED_FONT_WIDTH 5 // #define OLED_FONT_HEIGHT 7 diff --git a/layouts/community/split_3x6_3/drashna/halconf.h b/layouts/community/split_3x6_3/drashna/halconf.h new file mode 100644 index 0000000000..b099320b30 --- /dev/null +++ b/layouts/community/split_3x6_3/drashna/halconf.h @@ -0,0 +1,22 @@ +/* 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 + +// #define HAL_USE_DAC TRUE +#define HAL_USE_PWM TRUE +#define HAL_USE_SERIAL TRUE + +#include_next <halconf.h> diff --git a/layouts/community/split_3x6_3/drashna/keymap.c b/layouts/community/split_3x6_3/drashna/keymap.c index e53d053973..513cc7f7dc 100644 --- a/layouts/community/split_3x6_3/drashna/keymap.c +++ b/layouts/community/split_3x6_3/drashna/keymap.c @@ -16,11 +16,6 @@ #include "drashna.h" -#ifdef RGBLIGHT_ENABLE -// Following line allows macro to read current RGB settings -extern rgblight_config_t rgblight_config; -#endif - enum crkbd_keycodes { RGBRST = NEW_SAFE_RANGE }; /* @@ -31,6 +26,7 @@ enum crkbd_keycodes { RGBRST = NEW_SAFE_RANGE }; * of use. K## is a placeholder to pass through the individual keycodes */ +// clang-format off #define LAYOUT_split_3x6_3_base( \ K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \ K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \ @@ -40,7 +36,7 @@ enum crkbd_keycodes { RGBRST = NEW_SAFE_RANGE }; KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \ ALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(KC_QUOT), \ OS_LSFT, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \ - KC_GRV, KC_SPC, BK_LWER, DL_RAIS, KC_ENT, OS_RGUI \ + RGB_MOD, KC_SPC, BK_LWER, DL_RAIS, KC_ENT, OS_RGUI \ ) #define LAYOUT_split_3x6_3_base_wrapper(...) LAYOUT_split_3x6_3_base(__VA_ARGS__) @@ -123,31 +119,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; // clang-format on -bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { - if (record->event.pressed) { -#ifndef SPLIT_KEYBOARD - if (keycode == RESET && !is_master) { - return false; - } -#endif - } - return true; -} - #ifdef OLED_DRIVER_ENABLE oled_rotation_t oled_init_user(oled_rotation_t rotation) { -# ifndef SPLIT_KEYBOARD - if (is_master) { -# endif + if (is_keyboard_master()) { return OLED_ROTATION_270; -# ifndef SPLIT_KEYBOARD - } else { + } else { return rotation; } -# endif } #endif +#ifdef TAPPING_TERM_PER_KEY uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case ALT_T(KC_A): @@ -156,75 +138,74 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { return TAPPING_TERM; } } +#endif + +void matrix_slave_scan_user(void) { #ifdef RGB_MATRIX_ENABLE + rgb_matrix_task(); +#endif +} +#ifdef RGB_MATRIX_ENABLE void suspend_power_down_keymap(void) { rgb_matrix_set_suspend_state(true); } void suspend_wakeup_init_keymap(void) { rgb_matrix_set_suspend_state(false); } -void check_default_layer(uint8_t mode, uint8_t type) { +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(HSV_CYAN, mode, rgb_matrix_config.speed, type); + rgb_matrix_layer_helper(HSV_CYAN, mode, rgb_matrix_config.speed, type, led_min, led_max); break; case _COLEMAK: - rgb_matrix_layer_helper(HSV_MAGENTA, mode, rgb_matrix_config.speed, type); + rgb_matrix_layer_helper(HSV_MAGENTA, mode, rgb_matrix_config.speed, type, led_min, led_max); break; case _DVORAK: - rgb_matrix_layer_helper(HSV_SPRINGGREEN, mode, rgb_matrix_config.speed, type); + rgb_matrix_layer_helper(HSV_SPRINGGREEN, mode, rgb_matrix_config.speed, type, led_min, led_max); break; case _WORKMAN: - rgb_matrix_layer_helper(HSV_GOLDENROD, mode, rgb_matrix_config.speed, type); + rgb_matrix_layer_helper(HSV_GOLDENROD, mode, rgb_matrix_config.speed, type, led_min, led_max); break; case _NORMAN: - rgb_matrix_layer_helper(HSV_CORAL, mode, rgb_matrix_config.speed, type); + rgb_matrix_layer_helper(HSV_CORAL, mode, rgb_matrix_config.speed, type, led_min, led_max); break; case _MALTRON: - rgb_matrix_layer_helper(HSV_YELLOW, mode, rgb_matrix_config.speed, type); + rgb_matrix_layer_helper(HSV_YELLOW, mode, rgb_matrix_config.speed, type, led_min, led_max); break; case _EUCALYN: - rgb_matrix_layer_helper(HSV_PINK, mode, rgb_matrix_config.speed, type); + rgb_matrix_layer_helper(HSV_PINK, mode, rgb_matrix_config.speed, type, led_min, led_max); break; case _CARPLAX: - rgb_matrix_layer_helper(HSV_BLUE, mode, rgb_matrix_config.speed, type); + rgb_matrix_layer_helper(HSV_BLUE, mode, rgb_matrix_config.speed, type, led_min, led_max); break; } } -void rgb_matrix_indicators_user(void) { - if (userspace_config.rgb_layer_change && -# ifdef RGB_DISABLE_WHEN_USB_SUSPENDED - !g_suspend_state && -# endif -# if defined(RGBLIGHT_ENABLE) - (!rgblight_config.enable && rgb_matrix_config.enable) -# else - rgb_matrix_config.enable -# endif - ) { +void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + if (!is_keyboard_master()) return; + 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); + 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); + 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); + 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); + 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); + rgb_matrix_layer_helper(HSV_RED, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max); break; default: { - check_default_layer(IS_LAYER_ON(_MODS), LED_FLAG_UNDERGLOW); + check_default_layer(IS_LAYER_ON(_MODS), LED_FLAG_UNDERGLOW, led_min, led_max); break; } } - check_default_layer(0, LED_FLAG_MODIFIER); + check_default_layer(0, LED_FLAG_MODIFIER, led_min, led_max); } } #endif diff --git a/layouts/community/split_3x6_3/drashna/mcuconf.h b/layouts/community/split_3x6_3/drashna/mcuconf.h new file mode 100644 index 0000000000..429e4e1cdd --- /dev/null +++ b/layouts/community/split_3x6_3/drashna/mcuconf.h @@ -0,0 +1,32 @@ +/* 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> + +// #undef STM32_HSE_ENABLED +// #define STM32_HSE_ENABLED FALSE +#undef STM32_GPT_USE_TIM15 +#define STM32_GPT_USE_TIM15 FALSE + +#undef STM32_PWM_USE_TIM15 +#define STM32_PWM_USE_TIM15 TRUE + +#undef STM32_SERIAL_USE_USART1 +#define STM32_SERIAL_USE_USART1 TRUE + +#undef STM32_PWM_TIM15_IRQ_PRIORITY +#define STM32_PWM_TIM15_IRQ_PRIORITY 16 diff --git a/layouts/community/split_3x6_3/drashna/rules.mk b/layouts/community/split_3x6_3/drashna/rules.mk index 46f543f4e8..5358cb0ac8 100644 --- a/layouts/community/split_3x6_3/drashna/rules.mk +++ b/layouts/community/split_3x6_3/drashna/rules.mk @@ -3,7 +3,7 @@ # change to "no" to disable the options, or define them in the Makefile in # the appropriate keymap folder that will get included automatically # -BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000) MOUSEKEY_ENABLE = no # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) CONSOLE_ENABLE = no # Console for debug(+400) @@ -20,9 +20,15 @@ SWAP_HANDS_ENABLE = no # Enable one-hand typing # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend -ifeq ($(strip $(KEYBOARD)), crkbd/rev1) +ifeq ($(strip $(KEYBOARD)), crkbd/rev1/common) OLED_DRIVER_ENABLE = yes RGB_MATRIX_ENABLE = yes HAPTIC_ENABLE = SOLENOID BOOTLOADER = qmk-dfu endif + +ifeq ($(strip $(CTPC)), yes) + HAPTIC_ENABLE = no + WS2812_DRIVER = pwm + SERIAL_DRIVER = usart +endif diff --git a/layouts/community/split_3x6_3/drashna/ssd1306.c b/layouts/community/split_3x6_3/drashna/ssd1306.c new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/layouts/community/split_3x6_3/drashna/ssd1306.c |