diff options
author | QMK Bot <hello@qmk.fm> | 2021-01-22 16:23:41 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2021-01-22 16:23:41 +0000 |
commit | b58d164504f5c4e60657afb7e9854b2bea04f266 (patch) | |
tree | 3ba4d070152eb0f6204e0016082c3c5bbd1a3dd4 /layouts/community | |
parent | 37ebbe8d9e4cadfe33d74d9534a146b0d21f8805 (diff) | |
parent | 7a08b9d374dfcf9d872738af44b231862064b96f (diff) |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'layouts/community')
-rw-r--r-- | layouts/community/ergodox/drashna/config.h | 1 | ||||
-rw-r--r-- | layouts/community/ergodox/drashna/keymap.c | 63 | ||||
-rw-r--r-- | layouts/community/ergodox/drashna/visualizer.c | 77 | ||||
-rw-r--r-- | layouts/community/ortho_4x12/drashna/config.h | 2 | ||||
-rw-r--r-- | layouts/community/ortho_4x12/drashna/keymap.c | 56 | ||||
-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 |
11 files changed, 257 insertions, 123 deletions
diff --git a/layouts/community/ergodox/drashna/config.h b/layouts/community/ergodox/drashna/config.h index a595a93c43..4ccba8f04b 100644 --- a/layouts/community/ergodox/drashna/config.h +++ b/layouts/community/ergodox/drashna/config.h @@ -42,7 +42,6 @@ # undef RGB_MATRIX_LED_FLUSH_LIMIT # if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE) # define RGBLIGHT_LIMIT_VAL 100 -# undef RGBLIGHT_SLEEP # endif #endif diff --git a/layouts/community/ergodox/drashna/keymap.c b/layouts/community/ergodox/drashna/keymap.c index 5f1c0c8a09..fb5bcc6bd7 100644 --- a/layouts/community/ergodox/drashna/keymap.c +++ b/layouts/community/ergodox/drashna/keymap.c @@ -446,70 +446,65 @@ 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 rgb_matrix_indicators_user(void) { - if (g_suspend_state || !rgb_matrix_config.enable) return; +void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { if (layer_state_is(_GAMEPAD)) { - rgb_matrix_set_color(32, 0x00, 0xFF, 0x00); // Q - rgb_matrix_set_color(31, 0x00, 0xFF, 0xFF); // W - rgb_matrix_set_color(30, 0xFF, 0x00, 0x00); // E - rgb_matrix_set_color(29, 0xFF, 0x80, 0x00); // R - rgb_matrix_set_color(37, 0x00, 0xFF, 0xFF); // A - rgb_matrix_set_color(36, 0x00, 0xFF, 0xFF); // S - rgb_matrix_set_color(35, 0x00, 0xFF, 0xFF); // D - rgb_matrix_set_color(34, 0x7A, 0x00, 0xFF); // F - - rgb_matrix_set_color(userspace_config.swapped_numbers ? 27 : 26, 0xFF, 0xFF, 0xFF); // 1 - rgb_matrix_set_color(userspace_config.swapped_numbers ? 26 : 27, 0x00, 0xFF, 0x00); // 2 - rgb_matrix_set_color(25, 0x7A, 0x00, 0xFF); // 3 + RGB_MATRIX_INDICATOR_SET_COLOR(32, 0x00, 0xFF, 0x00); // Q + RGB_MATRIX_INDICATOR_SET_COLOR(31, 0x00, 0xFF, 0xFF); // W + RGB_MATRIX_INDICATOR_SET_COLOR(30, 0xFF, 0x00, 0x00); // E + RGB_MATRIX_INDICATOR_SET_COLOR(29, 0xFF, 0x80, 0x00); // R + RGB_MATRIX_INDICATOR_SET_COLOR(37, 0x00, 0xFF, 0xFF); // A + RGB_MATRIX_INDICATOR_SET_COLOR(36, 0x00, 0xFF, 0xFF); // S + RGB_MATRIX_INDICATOR_SET_COLOR(35, 0x00, 0xFF, 0xFF); // D + RGB_MATRIX_INDICATOR_SET_COLOR(34, 0x7A, 0x00, 0xFF); // F + + RGB_MATRIX_INDICATOR_SET_COLOR((userspace_config.swapped_numbers ? 26 : 27), 0xFF, 0xFF, 0xFF); // 1 + RGB_MATRIX_INDICATOR_SET_COLOR((userspace_config.swapped_numbers ? 27 : 26), 0x00, 0xFF, 0x00); // 2 + RGB_MATRIX_INDICATOR_SET_COLOR(25, 0x7A, 0x00, 0xFF); // 3 } -# if defined(RGBLIGHT_ENABLE) - if (!userspace_config.rgb_layer_change) -# else - if (userspace_config.rgb_layer_change) -# endif - { + + if (userspace_config.rgb_layer_change) { bool mods_enabled = IS_LAYER_ON(_MODS); switch (get_highest_layer(layer_state|default_layer_state)) { case _GAMEPAD: - rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _DIABLO: - rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_MODIFIER, led_min, led_max); break; case _RAISE: - rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _LOWER: - rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _ADJUST: - rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _QWERTY: - rgb_matrix_layer_helper(HSV_CYAN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_CYAN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _COLEMAK: - rgb_matrix_layer_helper(HSV_MAGENTA, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_MAGENTA, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _DVORAK: - rgb_matrix_layer_helper(HSV_SPRINGGREEN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_SPRINGGREEN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _WORKMAN: - rgb_matrix_layer_helper(HSV_GOLDENROD, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_GOLDENROD, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _NORMAN: - rgb_matrix_layer_helper(HSV_CORAL, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_CORAL, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _MALTRON: - rgb_matrix_layer_helper(HSV_YELLOW, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_YELLOW, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _EUCALYN: - rgb_matrix_layer_helper(HSV_PINK, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_PINK, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _CARPLAX: - rgb_matrix_layer_helper(HSV_BLUE, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_BLUE, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; } } @@ -517,6 +512,7 @@ void rgb_matrix_indicators_user(void) { #endif // RGB_MATRIX_INIT +#ifdef TAPPING_TERM_PER_KEY uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { if (keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) { if (mod_config(keycode & 0xf) & MOD_MASK_ALT) { @@ -525,3 +521,4 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { } return TAPPING_TERM; } +#endif diff --git a/layouts/community/ergodox/drashna/visualizer.c b/layouts/community/ergodox/drashna/visualizer.c new file mode 100644 index 0000000000..6b1c3ff498 --- /dev/null +++ b/layouts/community/ergodox/drashna/visualizer.c @@ -0,0 +1,77 @@ +/* +Copyright 2017 Fred Sundvik + +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 "./simple_visualizer.h" +#include "util.h" +#include "drashna.h" +#include "rgblight_list.h" + +#define LCD_COLOR_wrapper(...) LCD_COLOR(__VA_ARGS__) +// This function should be implemented by the keymap visualizer +// Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing +// that the simple_visualizer assumes that you are updating +// Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is +// stopped. This can be done by either double buffering it or by using constant strings +static void get_visualizer_layer_and_color(visualizer_state_t* state) { + + switch(get_highest_layer(state->status.layer|default_layer_state)) { + case _LOWER: + state->layer_text = "Lower"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_GREEN); + break; + case _RAISE: + state->layer_text = "Raise"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_YELLOW); + break; + case _ADJUST: + state->layer_text = "Adjust"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_RED); + break; + case _MACROS: + state->layer_text = "Macros"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_ORANGE); + break; + case _MEDIA: + state->layer_text = "Media"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_CHARTREUSE); + break; + case _GAMEPAD: + state->layer_text = "Game"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_ORANGE); + break; + case _QWERTY: + state->layer_text = "QWERTY"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_CYAN); + break; + case _WORKMAN: + state->layer_text = "Workman"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_GOLDENROD); + break; + case _DVORAK: + state->layer_text = "Dvorak"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_SPRINGGREEN); + break; + case _COLEMAK: + state->layer_text = "Colemak"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_MAGENTA); + break; break; + default: + state->layer_text = "NONE"; + state->target_lcd_color = LCD_COLOR_wrapper(HSV_RED); + break; + } +} diff --git a/layouts/community/ortho_4x12/drashna/config.h b/layouts/community/ortho_4x12/drashna/config.h index 6a99fcda01..4a1d1babe2 100644 --- a/layouts/community/ortho_4x12/drashna/config.h +++ b/layouts/community/ortho_4x12/drashna/config.h @@ -77,6 +77,8 @@ # define PRODUCT Drashna Hacked Planck EZ # endif #endif +#undef NO_USB_STARTUP_CHECK + #define EEPROM_I2C_RM24C512C diff --git a/layouts/community/ortho_4x12/drashna/keymap.c b/layouts/community/ortho_4x12/drashna/keymap.c index 8070a7d35e..d0df7f5c37 100644 --- a/layouts/community/ortho_4x12/drashna/keymap.c +++ b/layouts/community/ortho_4x12/drashna/keymap.c @@ -16,9 +16,6 @@ #include "drashna.h" -#ifdef RGBLIGHT_ENABLE -extern rgblight_config_t rgblight_config; -#endif #ifdef BACKLIGHT_ENABLE enum planck_keycodes { @@ -231,7 +228,8 @@ void suspend_wakeup_init_keymap(void) { } // clang-format on -void rgb_matrix_indicators_user(void) { + +void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { uint8_t this_mod = get_mods(); uint8_t this_led = host_keyboard_leds(); uint8_t this_osm = get_oneshot_mods(); @@ -240,8 +238,6 @@ void rgb_matrix_indicators_user(void) { is_ez = true; # endif - if (g_suspend_state || !rgb_matrix_config.enable) return; - # if defined(RGBLIGHT_ENABLE) if (!userspace_config.rgb_layer_change) # else @@ -250,46 +246,46 @@ void rgb_matrix_indicators_user(void) { { switch (get_highest_layer(layer_state)) { case _GAMEPAD: - rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _DIABLO: - rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_MODIFIER, led_min, led_max); break; case _RAISE: - rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _LOWER: - rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _ADJUST: - rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; default: { bool mods_enabled = IS_LAYER_ON(_MODS); switch (get_highest_layer(default_layer_state)) { case _QWERTY: - rgb_matrix_layer_helper(HSV_CYAN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_CYAN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _COLEMAK: - rgb_matrix_layer_helper(HSV_MAGENTA, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_MAGENTA, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _DVORAK: - rgb_matrix_layer_helper(HSV_SPRINGGREEN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_SPRINGGREEN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _WORKMAN: - rgb_matrix_layer_helper(HSV_GOLDENROD, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_GOLDENROD, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _NORMAN: - rgb_matrix_layer_helper(HSV_CORAL, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_CORAL, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _MALTRON: - rgb_matrix_layer_helper(HSV_YELLOW, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_YELLOW, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _EUCALYN: - rgb_matrix_layer_helper(HSV_PINK, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_PINK, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; case _CARPLAX: - rgb_matrix_layer_helper(HSV_BLUE, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); + rgb_matrix_layer_helper(HSV_BLUE, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; } break; @@ -299,35 +295,35 @@ void rgb_matrix_indicators_user(void) { switch (get_highest_layer(default_layer_state)) { case _QWERTY: - rgb_matrix_set_color(is_ez ? 41 : 42, 0x00, 0xFF, 0xFF); + RGB_MATRIX_INDICATOR_SET_COLOR((is_ez ? 41 : 42), 0x00, 0xFF, 0xFF); break; case _COLEMAK: - rgb_matrix_set_color(is_ez ? 41 : 42, 0xFF, 0x00, 0xFF); + RGB_MATRIX_INDICATOR_SET_COLOR((is_ez ? 41 : 42), 0xFF, 0x00, 0xFF); break; case _DVORAK: - rgb_matrix_set_color(is_ez ? 41 : 42, 0x00, 0xFF, 0x00); + RGB_MATRIX_INDICATOR_SET_COLOR((is_ez ? 41 : 42), 0x00, 0xFF, 0x00); break; case _WORKMAN: - rgb_matrix_set_color(is_ez ? 41 : 42, 0xD9, 0xA5, 0x21); + RGB_MATRIX_INDICATOR_SET_COLOR((is_ez ? 41 : 42), 0xD9, 0xA5, 0x21); break; } if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1 << USB_LED_CAPS_LOCK)) { if (!layer_state_cmp(layer_state, _ADJUST)) { - rgb_matrix_set_color(24, 0x00, 0xFF, 0x00); + RGB_MATRIX_INDICATOR_SET_COLOR(24, 0x00, 0xFF, 0x00); } - rgb_matrix_set_color(36, 0x00, 0xFF, 0x00); + RGB_MATRIX_INDICATOR_SET_COLOR(36, 0x00, 0xFF, 0x00); } if ((this_mod | this_osm) & MOD_MASK_CTRL) { - rgb_matrix_set_color(25, 0xFF, 0x00, 0x00); - rgb_matrix_set_color(34, 0xFF, 0x00, 0x00); - rgb_matrix_set_color(37, 0xFF, 0x00, 0x00); + RGB_MATRIX_INDICATOR_SET_COLOR(25, 0xFF, 0x00, 0x00); + RGB_MATRIX_INDICATOR_SET_COLOR(34, 0xFF, 0x00, 0x00); + RGB_MATRIX_INDICATOR_SET_COLOR(37, 0xFF, 0x00, 0x00); } if ((this_mod | this_osm) & MOD_MASK_GUI) { - rgb_matrix_set_color(39, 0xFF, 0xD9, 0x00); + RGB_MATRIX_INDICATOR_SET_COLOR(39, 0xFF, 0xD9, 0x00); } if ((this_mod | this_osm) & MOD_MASK_ALT) { - rgb_matrix_set_color(38, 0x00, 0x00, 0xFF); + RGB_MATRIX_INDICATOR_SET_COLOR(38, 0x00, 0x00, 0xFF); } } 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 |