diff options
author | Drashna Jaelre <drashna@live.com> | 2022-11-29 11:43:42 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-29 11:43:42 -0800 |
commit | 4a87af0e9af046d5fc00d930476920c0c34a57a7 (patch) | |
tree | cb2da20c670a49b9fcada84822a7bdb2bd144d60 | |
parent | 8a8000b4ec379448848f561f57bbe2c781376357 (diff) |
[Keymap] Drashna updates for 0.19 (#19175)
* Fix up bastardkb boards since blackpill support is officially added.
* Check for blackpill version, not elite c.
* Add checks in chibiOS config since multiple ARM controllers supported.
* Rework rules.mk for keymaps to better handle arm vs avr support
* Start moving away from `matrix_*_*` functions.
* `housekeeping_task_*` instead of `matrix_scan_*`
* `keyboard_(pre|post)_init_*` instead of `matrix_init_*`
* Add ℂℴmⅈℂ unicode input method.
* Clean up unicode code to be more compact and flexible.
* Remove/move Pro Micro LED commands to userspace and better filter them
* Fixup OLED code
* Use newer quantum keycode functions/preprocessors rather than manual bit manipulation
* Make unicode mode render much more compact/simple.
* Make qmk secrets more self contained
* Remove custom implementation of split watchdog
49 files changed, 630 insertions, 568 deletions
diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/config.h b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/config.h index ad549a5e22..514a153623 100644 --- a/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/config.h +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/config.h @@ -18,87 +18,90 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #pragma once -#undef PRODUCT -#define PRODUCT "Charybdis Nano (Blackpill)" - -#undef MATRIX_ROW_PINS -#define MATRIX_ROW_PINS \ - { B12, B13, B14, B15 } -#undef MATRIX_COL_PINS -#define MATRIX_COL_PINS \ - { A15, B3, B4, B5, B6 } - - -#undef MATRIX_ROW_PINS_RIGHT -#define MATRIX_ROW_PINS_RIGHT \ - { B12, B13, B14, B15 } -#undef MATRIX_COL_PINS_RIGHT -#define MATRIX_COL_PINS_RIGHT \ - { A15, B3, B4, B5, B6 } - -#define USB_VBUS_PIN B10 -#define SPLIT_HAND_PIN C14 // high = left, low = right +#ifdef KEYBOARD_bastardkb_charybdis_3x5_blackpill + +# undef MATRIX_ROW_PINS +# define MATRIX_ROW_PINS \ + { B12, B13, B14, B15 } +# undef MATRIX_COL_PINS +# define MATRIX_COL_PINS \ + { A15, B3, B4, B5, B6 } + +# undef MATRIX_ROW_PINS_RIGHT +# define MATRIX_ROW_PINS_RIGHT \ + { B12, B13, B14, B15 } +# undef MATRIX_COL_PINS_RIGHT +# define MATRIX_COL_PINS_RIGHT \ + { A15, B3, B4, B5, B6 } + +# define USB_VBUS_PIN B10 +# undef SPLIT_HAND_PIN +# define SPLIT_HAND_PIN C14 // high = left, low = right // WS2812 RGB LED strip input and number of LEDs -#undef RGB_DI_PIN -#define RGB_DI_PIN A1 -#undef RGB_MATRIX_MAXIMUM_BRIGHTNESS -#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 -#define WS2812_PWM_DRIVER PWMD2 // default: PWMD2 -#define WS2812_PWM_CHANNEL 2 // 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_EXTERNAL_PULLUP +# undef RGB_DI_PIN +# define RGB_DI_PIN A1 +# undef RGB_MATRIX_MAXIMUM_BRIGHTNESS +# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 +# define WS2812_PWM_DRIVER PWMD2 // default: PWMD2 +# define WS2812_PWM_CHANNEL 2 // 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_EXTERNAL_PULLUP //#define WS2812_PWM_COMPLEMENTARY_OUTPUT // Define for a complementary timer output (TIMx_CHyN); omit for a normal timer output (TIMx_CHy). -#define WS2812_DMA_STREAM STM32_DMA1_STREAM7 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. -#define WS2812_DMA_CHANNEL 3 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. -#define WS2812_PWM_TARGET_PERIOD 800000 +# undef WS2812_DMA_STREAM +# define WS2812_DMA_STREAM STM32_DMA1_STREAM7 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. +# define WS2812_DMA_CHANNEL 3 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. +# define WS2812_PWM_TARGET_PERIOD 800000 -#define DEBUG_LED_PIN C13 +# define DEBUG_LED_PIN C13 /* Audio config */ -#define AUDIO_PIN B1 -#define AUDIO_PWM_DRIVER PWMD3 -#define AUDIO_PWM_CHANNEL 4 -#define AUDIO_PWM_PAL_MODE 2 +# define AUDIO_PIN B1 +# define AUDIO_PWM_DRIVER PWMD3 +# define AUDIO_PWM_CHANNEL 4 +# define AUDIO_PWM_PAL_MODE 2 /* serial.c configuration for split keyboard */ -#undef SOFT_SERIAL_PIN -#define SERIAL_USART_FULL_DUPLEX // Enable full duplex operation mode. -#define SERIAL_USART_TX_PIN A2 -#define SERIAL_USART_RX_PIN A3 -#define SERIAL_USART_DRIVER SD2 -#define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7 -#define SERIAL_USART_RX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7 -#define SERIAL_USART_TIMEOUT 100 // USART driver timeout. default 100 -#define SERIAL_USART_SPEED 921600 +# undef SOFT_SERIAL_PIN +# define SERIAL_USART_FULL_DUPLEX // Enable full duplex operation mode. +# undef SERIAL_USART_TX_PIN +# define SERIAL_USART_TX_PIN A2 +# undef SERIAL_USART_RX_PIN +# define SERIAL_USART_RX_PIN A3 +# define SERIAL_USART_DRIVER SD2 +# define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7 +# define SERIAL_USART_RX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7 +# define SERIAL_USART_TIMEOUT 100 // USART driver timeout. default 100 +# define SERIAL_USART_SPEED 921600 // #define SERIAL_USART_PIN_SWAP // swap RX and TX pins on master // To use the highest possible baudrate (3.75Mbit/s) uncomment the following // line, this can result in dropped communications so lower the speed if there // are many timeouts. // #define SERIAL_USART_SPEED (STM32_PCLK2 >> 4) -#define CRC8_USE_TABLE -#define CRC8_OPTIMIZE_SPEED +# define CRC8_USE_TABLE +# define CRC8_OPTIMIZE_SPEED /* spi config for eeprom and pmw3360 sensor */ -#define SPI_DRIVER SPID1 -#define SPI_SCK_PIN A5 -#define SPI_SCK_PAL_MODE 5 -#define SPI_MOSI_PIN A7 -#define SPI_MOSI_PAL_MODE 5 -#define SPI_MISO_PIN A6 -#define SPI_MISO_PAL_MODE 5 +# define SPI_DRIVER SPID1 +# define SPI_SCK_PIN A5 +# define SPI_SCK_PAL_MODE 5 +# define SPI_MOSI_PIN A7 +# define SPI_MOSI_PAL_MODE 5 +# define SPI_MISO_PIN A6 +# define SPI_MISO_PAL_MODE 5 /* eeprom config */ -#define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A4 -#define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 64 +# define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A4 +# define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 64 // #define EXTERNAL_EEPROM_BYTE_COUNT 8196 // #define EXTERNAL_EEPROM_PAGE_SIZE 32 // #define EXTERNAL_EEPROM_ADDRESS_SIZE 2 /* pmw3360 config */ -#undef PMW33XX_CS_PIN -#define PMW33XX_CS_PIN B0 +# undef PMW33XX_CS_PIN +# define PMW33XX_CS_PIN B0 +#endif #define CHARYBDIS_MINIMUM_DEFAULT_DPI 1200 #define CHARYBDIS_DEFAULT_DPI_CONFIG_STEP 400 diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/halconf.h b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/halconf.h index bc07c10527..3b254172b4 100644 --- a/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/halconf.h +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/halconf.h @@ -15,11 +15,13 @@ */ #pragma once -#define HAL_USE_PWM TRUE -#define HAL_USE_SERIAL TRUE -#define HAL_USE_I2C TRUE -#define HAL_USE_SPI TRUE -#define SPI_USE_WAIT TRUE -#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD +#if defined(KEYBOARD_bastardkb_charybdis_3x5_blackpill) +# define HAL_USE_PWM TRUE +# define HAL_USE_SERIAL TRUE +# define HAL_USE_I2C TRUE +# define HAL_USE_SPI TRUE +# define SPI_USE_WAIT TRUE +# define SPI_SELECT_MODE SPI_SELECT_MODE_PAD +#endif #include_next <halconf.h> diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/keymap.c b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/keymap.c index a923a80b40..02cb89fe65 100644 --- a/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/keymap.c +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/keymap.c @@ -83,24 +83,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), }; -void matrix_init_keyemap(void) { setPinInputHigh(A0); } +#if defined(KEYBOARD_bastardkb_charybdis_3x5_blackpill) +void keyboard_pre_init_keymap(void) { + setPinInputHigh(A0); +} -void matrix_scan_keymap(void) { +void housekeeping_task_keymap(void) { if (!readPin(A0)) { reset_keyboard(); } } -#ifdef USB_VBUS_PIN +# ifdef USB_VBUS_PIN bool usb_vbus_state(void) { setPinInputLow(USB_VBUS_PIN); wait_us(5); return readPin(USB_VBUS_PIN); } -#endif +# endif void matrix_output_unselect_delay(uint8_t line, bool key_pressed) { for (int32_t i = 0; i < 40; i++) { __asm__ volatile("nop" ::: "memory"); } } +#endif diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/mcuconf.h b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/mcuconf.h index fd71b54b77..9c40967015 100644 --- a/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/mcuconf.h +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/mcuconf.h @@ -18,25 +18,27 @@ #include_next "mcuconf.h" -#undef STM32_I2C_USE_I2C1 -#define STM32_I2C_USE_I2C1 TRUE +#if defined(KEYBOARD_bastardkb_charybdis_3x5_blackpill) +# undef STM32_I2C_USE_I2C1 +# define STM32_I2C_USE_I2C1 TRUE // #undef STM32_I2C_I2C1_RX_DMA_STREAM // #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) -#undef STM32_I2C_I2C1_TX_DMA_STREAM -#define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 1) +# undef STM32_I2C_I2C1_TX_DMA_STREAM +# define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 1) -#undef STM32_PWM_USE_TIM2 -#define STM32_PWM_USE_TIM2 TRUE +# undef STM32_PWM_USE_TIM2 +# define STM32_PWM_USE_TIM2 TRUE -#undef STM32_PWM_USE_TIM3 -#define STM32_PWM_USE_TIM3 TRUE +# undef STM32_PWM_USE_TIM3 +# define STM32_PWM_USE_TIM3 TRUE -#undef STM32_SPI_USE_SPI1 -#define STM32_SPI_USE_SPI1 TRUE +# undef STM32_SPI_USE_SPI1 +# define STM32_SPI_USE_SPI1 TRUE -#undef STM32_SERIAL_USE_USART2 -#define STM32_SERIAL_USE_USART2 TRUE +# undef STM32_SERIAL_USE_USART2 +# define STM32_SERIAL_USE_USART2 TRUE -#undef STM32_ST_USE_TIMER -#define STM32_ST_USE_TIMER 5 +# undef STM32_ST_USE_TIMER +# define STM32_ST_USE_TIMER 5 +#endif diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/rules.mk b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/rules.mk index dc0395c800..ff4ede45ca 100644 --- a/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/rules.mk +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/drashna/rules.mk @@ -1,28 +1,45 @@ -# MCU name -MCU = STM32F411 -BOARD = BLACKPILL_STM32_F411 +RGB_MATRIX_ENABLE = no +CUSTOM_UNICODE_ENABLE = no +CUSTOM_POINTING_DEVICE = no +CUSTOM_SPLIT_TRANSPORT_SYNC = no -# Bootloader selection -# BOOTLOADER = stm32-dfu -BOOTLOADER := tinyuf2 -LTO_ENABLE := no +ifeq ($(strip $(KEYBOARD)), bastardkb/charybdis/3x5/blackpill) + # Bootloader selection + BOOTLOADER := tinyuf2 -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -KEYBOARD_SHARED_EP = yes -MOUSE_SHARED_EP = yes + LTO_ENABLE := no -EEPROM_DRIVER = spi -WS2812_DRIVER = pwm -SERIAL_DRIVER = usart -AUDIO_DRIVER = pwm_hardware + AUDIO_SUPPORTED = yes + AUDIO_ENABLE = yes + AUDIO_DRIVER = pwm_hardware -AUDIO_SUPPORTED = yes -AUDIO_ENABLE = yes -MOUSEKEY_ENABLE = yes -NKRO_ENABLE = yes -CONSOLE_ENABLE = yes + OVERLOAD_FEATURES = yes +endif -AUTOCORRECT_ENABLE = yes +ifeq ($(strip $(KEYBOARD)), bastardkb/charybdis/3x5/v2/stemcell) + OVERLOAD_FEATURES = yes +endif +ifeq ($(strip $(KEYBOARD)), bastardkb/charybdis/3x5/v2/splinky) + OVERLOAD_FEATURES = yes +endif -DEBOUNCE_TYPE = asym_eager_defer_pk + +ifeq ($(strip $(OVERLOAD_FEATURES)), yes) + BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite + KEYBOARD_SHARED_EP = yes + MOUSE_SHARED_EP = yes + + MOUSEKEY_ENABLE = yes + NKRO_ENABLE = yes + CONSOLE_ENABLE = yes + RGB_MATRIX_ENABLE = yes + + AUTOCORRECT_ENABLE = yes + + CUSTOM_UNICODE_ENABLE = yes + CUSTOM_POINTING_DEVICE = yes + CUSTOM_SPLIT_TRANSPORT_SYNC = yes + + DEBOUNCE_TYPE = asym_eager_defer_pk +endif diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/config.h b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/config.h index e29ff644da..cb11ea2748 100644 --- a/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/config.h +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/config.h @@ -16,99 +16,49 @@ */ #pragma once -#undef PRODUCT -#define PRODUCT "Charybdis (4x6) Blackpill" +#if defined(KEYBOARD_bastardkb_charybdis_4x6_blackpill) +# undef MATRIX_COL_PINS +# define MATRIX_COL_PINS \ + { B0, B1, B12, B3, B4, B5 } -#undef MATRIX_COL_PINS -#define MATRIX_COL_PINS \ - { B0, B1, B12, B3, B4, B5 } -#undef MATRIX_COL_PINS_RIGHT -#define MATRIX_COL_PINS_RIGHT \ - { B0, B1, B12, B3, B4, B5 } +# define USB_VBUS_PIN B10 +# define DEBUG_LED_PIN C13 -#undef MATRIX_ROW_PINS -#define MATRIX_ROW_PINS \ - { B15, A2, B8, A8, B9 } -#undef MATRIX_ROW_PINS_RIGHT -#define MATRIX_ROW_PINS_RIGHT \ - { B15, A2, B8, A8, B9 } +# define AUDIO_PIN B7 +# define AUDIO_PWM_DRIVER PWMD4 +# define AUDIO_PWM_CHANNEL 2 +# define AUDIO_PWM_PAL_MODE 2 +# define AUDIO_INIT_DELAY +# define AUDIO_ENABLE_TONE_MULTIPLEXING +# define AUDIO_TONE_MULTIPLEXING_RATE_DEFAULT 10 +# define SERIAL_USART_SPEED (1 * 1024 * 1024) -#define DIODE_DIRECTION ROW2COL -#define SPLIT_HAND_PIN A3 -#undef MASTER_RIGHT -#define USB_VBUS_PIN B10 +# undef POINTING_DEVICE_CS_PIN +# define POINTING_DEVICE_CS_PIN A15 // b14 +# define PMW33XX_LIFTOFF_DISTANCE 0b1111 +#endif -#undef RGB_DI_PIN -#define RGB_DI_PIN A1 -#define WS2812_EXTERNAL_PULLUP -#define WS2812_PWM_DRIVER PWMD2 -#define WS2812_PWM_CHANNEL 2 -#define WS2812_PWM_PAL_MODE 1 -#define WS2812_EXTERNAL_PULLUP -#define WS2812_DMA_STREAM STM32_DMA1_STREAM1 -#define WS2812_DMA_CHANNEL 3 -#define WS2812_PWM_TARGET_PERIOD 800000 - -#define DEBUG_LED_PIN C13 - -#define AUDIO_PIN B7 -#define AUDIO_PWM_DRIVER PWMD4 -#define AUDIO_PWM_CHANNEL 2 -#define AUDIO_PWM_PAL_MODE 2 -#define AUDIO_INIT_DELAY -#define AUDIO_ENABLE_TONE_MULTIPLEXING -#define AUDIO_TONE_MULTIPLEXING_RATE_DEFAULT 10 - -#undef SOFT_SERIAL_PIN -// #define SERIAL_USART_FULL_DUPLEX // Enable full duplex operation mode. -#define SERIAL_USART_TX_PIN A9 -// #define SERIAL_USART_RX_PIN A3 -// #define SERIAL_USART_DRIVER SD2 -// #define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7 -// #define SERIAL_USART_RX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7 -// #define SERIAL_USART_TIMEOUT 100 // USART driver timeout. default 100 -// #define SERIAL_USART_SPEED 921600 -#define SERIAL_USART_SPEED (1.5 * 1024 * 1024) - -#define CRC8_USE_TABLE -#define CRC8_OPTIMIZE_SPEED - -/* spi config for eeprom and pmw3360 sensor */ -#define SPI_DRIVER SPID1 -#define SPI_SCK_PIN A5 -#define SPI_SCK_PAL_MODE 5 -#define SPI_MOSI_PIN A7 -#define SPI_MOSI_PAL_MODE 5 -#define SPI_MISO_PIN A6 -#define SPI_MISO_PAL_MODE 5 - -#define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A4 -#define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 64 - -#undef PMW33XX_CS_PIN -#define PMW33XX_CS_PIN A15 // b14 -#define PMW33XX_LIFTOFF_DISTANCE 0b1111 #undef ROTATIONAL_TRANSFORM_ANGLE -#define ROTATIONAL_TRANSFORM_ANGLE -65 - -#define CHARYBDIS_MINIMUM_DEFAULT_DPI 1200 -#define CHARYBDIS_DEFAULT_DPI_CONFIG_STEP 400 -#define CHARYBDIS_MINIMUM_SNIPING_DPI 200 -#define CHARYBDIS_SNIPING_DPI_CONFIG_STEP 100 +#define ROTATIONAL_TRANSFORM_ANGLE 25 +#define POINTING_DEVICE_ROTATION_270 /* RGB Matrix. */ - #undef RGB_MATRIX_MAXIMUM_BRIGHTNESS #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 +#define CHARYBDIS_MINIMUM_DEFAULT_DPI 1200 +#define CHARYBDIS_DEFAULT_DPI_CONFIG_STEP 400 +#define CHARYBDIS_MINIMUM_SNIPING_DPI 200 +#define CHARYBDIS_SNIPING_DPI_CONFIG_STEP 100 + #define CHARYBDIS_CONFIG_SYNC -#define BOOTMAGIC_LITE_ROW 0 +#define BOOTMAGIC_LITE_ROW 0 #define BOOTMAGIC_LITE_COLUMN 0 -#define BOOTMAGIC_LITE_ROW_RIGHT 5 +#define BOOTMAGIC_LITE_ROW_RIGHT 5 #define BOOTMAGIC_LITE_COLUMN_RIGHT 0 -#define BOOTMAGIC_LITE_EEPROM_ROW 1 +#define BOOTMAGIC_LITE_EEPROM_ROW 1 #define BOOTMAGIC_LITE_EEPROM_COLUMN 0 -#define BOOTMAGIC_LITE_EEPROM_ROW_RIGHT 1 +#define BOOTMAGIC_LITE_EEPROM_ROW_RIGHT 1 #define BOOTMAGIC_LITE_EEPROM_COLUMN_RIGHT 0 diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/halconf.h b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/halconf.h deleted file mode 100644 index 8aad829e5c..0000000000 --- a/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/halconf.h +++ /dev/null @@ -1,26 +0,0 @@ -/* 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_PWM TRUE -#define HAL_USE_PAL TRUE -#define HAL_USE_SERIAL TRUE -// #define HAL_USE_I2C TRUE -#define HAL_USE_SPI TRUE -#define SPI_USE_WAIT TRUE -#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD - -#include_next <halconf.h> diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/keymap.c b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/keymap.c index cc6dbc34e9..50a05e1b35 100644 --- a/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/keymap.c +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/keymap.c @@ -83,12 +83,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { SFT_T(KC_SPACE), ALT_T(KC_Q), _______ ), [_MOUSE] = LAYOUT_charybdis_4x6( - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, KC_WH_U, DPI_RMOD,DPI_MOD, S_D_RMOD,S_D_MOD, _______, + _______, _______, _______, _______, _______, _______, _______, DPI_RMOD,DPI_MOD, S_D_RMOD,S_D_MOD, _______, + _______, _______, _______, _______, _______, _______, KC_WH_U, _______, _______, _______, _______, DRGSCRL, _______, _______, _______, _______, _______, _______, KC_WH_D, KC_BTN1, KC_BTN3, KC_BTN2, KC_BTN6, SNIPING, - _______, _______, _______, _______, _______, _______, KC_BTN7, KC_BTN4, KC_BTN5, KC_BTN8, DRGSCRL, _______, - _______, SNIPING, SNIPING, _______, _______, - _______, _______, _______ + _______, _______, _______, _______, _______, _______, KC_BTN7, KC_BTN4, KC_BTN5, KC_BTN8, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______ ), [_LOWER] = LAYOUT_charybdis_4x6_wrapper( @@ -110,7 +110,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_ADJUST] = LAYOUT_charybdis_4x6_wrapper( - QK_MAKE, KC_WIDE,KC_AUSSIE,KC_SCRIPT,KC_ZALGO,KC_SUPER, KC_NOMODE,KC_BLOCKS,KC_REGIONAL,TG_GAME,TG_DBLO, QK_BOOT, + QK_MAKE, KC_WIDE,KC_AUSSIE,KC_SCRIPT,KC_ZALGO,KC_SUPER, KC_NOMODE,KC_COMIC,KC_REGIONAL,TG_GAME,TG_DBLO, QK_BOOT, VRSN, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, EE_CLR, KEYLOCK, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, TG_MODS, UC_NEXT, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, KC_MPLY, @@ -121,8 +121,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // clang-format on -void matrix_init_keymap(void) { - setPinInputHigh(A0); +void keyboard_post_init_keymap(void) { #ifdef RGB_MATRIX_ENABLE g_led_config.flags[53] = g_led_config.flags[54] = g_led_config.flags[55] = g_led_config.flags[0] = g_led_config.flags[1] = g_led_config.flags[2] = g_led_config.flags[3] = @@ -131,11 +130,17 @@ void matrix_init_keymap(void) { #endif } -void matrix_scan_keymap(void) { +#if defined(KEYBOARD_bastardkb_charybdis_4x6_blackpill) +void keyboard_pre_init_keymap(void) { + setPinInputHigh(A0); +} + +void housekeeping_task_keymap(void) { if (!readPin(A0)) { reset_keyboard(); } } +#endif #ifdef USB_VBUS_PIN bool usb_vbus_state(void) { @@ -145,12 +150,13 @@ bool usb_vbus_state(void) { } #endif +#if defined(KEYBOARD_bastardkb_charybdis_4x6_blackpill) void matrix_output_unselect_delay(uint8_t line, bool key_pressed) { for (int32_t i = 0; i < 40; i++) { __asm__ volatile("nop" ::: "memory"); } } - +#endif #ifdef SWAP_HANDS_ENABLE const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/mcuconf.h b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/mcuconf.h index 4f04811e54..3a23d5f370 100644 --- a/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/mcuconf.h +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/mcuconf.h @@ -18,23 +18,10 @@ #include_next "mcuconf.h" -#undef STM32_PWM_USE_ADVANCED -#define STM32_PWM_USE_ADVANCED TRUE +#if defined(KEYBOARD_bastardkb_charybdis_4x6_blackpill) +# undef STM32_PWM_USE_ADVANCED +# define STM32_PWM_USE_ADVANCED TRUE -#undef STM32_PWM_USE_TIM1 -#define STM32_PWM_USE_TIM1 TRUE - -#undef STM32_PWM_USE_TIM2 -#define STM32_PWM_USE_TIM2 TRUE - -#undef STM32_PWM_USE_TIM4 -#define STM32_PWM_USE_TIM4 TRUE - -#undef STM32_SPI_USE_SPI1 -#define STM32_SPI_USE_SPI1 TRUE - -#undef STM32_SERIAL_USE_USART1 -#define STM32_SERIAL_USE_USART1 TRUE - -#undef STM32_ST_USE_TIMER -#define STM32_ST_USE_TIMER 5 +# undef STM32_PWM_USE_TIM4 +# define STM32_PWM_USE_TIM4 TRUE +#endif diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/rules.mk b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/rules.mk index d655fbd5dc..12e9cecda0 100644 --- a/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/rules.mk +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/rules.mk @@ -1,34 +1,56 @@ -# MCU name -MCU = STM32F411 -BOARD = BLACKPILL_STM32_F411 - -# Bootloader selection -BOOTLOADER := tinyuf2 - -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = yes # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Enable N-Key Rollover -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow -AUDIO_ENABLE = yes # Audio output -AUDIO_SUPPORTED = yes # is set to no in kb, needs to be forcibly enabled - -KEYBOARD_SHARED_EP = yes -MOUSE_SHARED_EP = yes - -EEPROM_DRIVER = spi -WS2812_DRIVER = pwm -SERIAL_DRIVER = usart -AUDIO_DRIVER = pwm_hardware -BACKLIGHT_DRIVER = pwm - -AUTOCORRECT_ENABLE = yes -CAPS_WORD_ENABLE = yes -SWAP_HANDS_ENABLE = yes -TAP_DANCE_ENABLE = yes -DEBOUNCE_TYPE = asym_eager_defer_pk -WPM_ENABLE = yes -LTO_ENABLE = no -# OPT = 3 +CUSTOM_UNICODE_ENABLE = no +CUSTOM_POINTING_DEVICE = no +CUSTOM_SPLIT_TRANSPORT_SYNC = no + +ifeq ($(strip $(KEYBOARD)), bastardkb/charybdis/4x6/blackpill) + # MCU name + # Bootloader selection + BOOTLOADER := tinyuf2 + + AUDIO_ENABLE = yes # Audio output + AUDIO_SUPPORTED = yes # is set to no in kb, needs to be forcibly enabled + AUDIO_DRIVER = pwm_hardware + + BACKLIGHT_DRIVER = pwm + + OVERLOAD_FEATURES = yes +endif + +ifeq ($(strip $(KEYBOARD)), bastardkb/charybdis/4x6/v2/stemcell) + OVERLOAD_FEATURES = yes +endif +ifeq ($(strip $(KEYBOARD)), bastardkb/charybdis/4x6/v2/splinky) + OVERLOAD_FEATURES = yes +endif +ifeq ($(strip $(MCU)), atmega32u4) + LTO_ENABLE = yes + BOOTLOADER = qmk-hid + BOOTLOADER_SIZE = 512 +endif + +ifeq ($(strip $(OVERLOAD_FEATURES)), yes) + BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite + MOUSEKEY_ENABLE = yes # Mouse keys + EXTRAKEY_ENABLE = yes # Audio control and System control + CONSOLE_ENABLE = yes # Console for debug + COMMAND_ENABLE = no # Commands for debug and configuration + NKRO_ENABLE = yes # Enable N-Key Rollover + RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow + + KEYBOARD_SHARED_EP = yes + MOUSE_SHARED_EP = yes + + AUTOCORRECT_ENABLE = yes + CAPS_WORD_ENABLE = yes + SWAP_HANDS_ENABLE = yes + TAP_DANCE_ENABLE = yes + DEBOUNCE_TYPE = asym_eager_defer_pk + WPM_ENABLE = yes + LTO_ENABLE = no + # OPT = 3 + + CUSTOM_UNICODE_ENABLE = yes + CUSTOM_POINTING_DEVICE = yes + CUSTOM_SPLIT_TRANSPORT_SYNC = yes + +endif diff --git a/keyboards/bastardkb/dilemma/3x5_2/keymaps/drashna/halconf.h b/keyboards/bastardkb/dilemma/3x5_2/keymaps/drashna/halconf.h new file mode 100644 index 0000000000..135994a43c --- /dev/null +++ b/keyboards/bastardkb/dilemma/3x5_2/keymaps/drashna/halconf.h @@ -0,0 +1,23 @@ +/** + * Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly) + * + * 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 + +#define HAL_USE_SPI TRUE +#define HAL_USE_I2C TRUE + +#include_next "halconf.h" diff --git a/keyboards/bastardkb/dilemma/3x5_2/keymaps/drashna/keymap.c b/keyboards/bastardkb/dilemma/3x5_2/keymaps/drashna/keymap.c index 9cd21c3c1f..d4aa71440d 100644 --- a/keyboards/bastardkb/dilemma/3x5_2/keymaps/drashna/keymap.c +++ b/keyboards/bastardkb/dilemma/3x5_2/keymaps/drashna/keymap.c @@ -112,7 +112,7 @@ bool oled_task_keymap(void) { }; oled_write_raw_P(header_image, sizeof(header_image)); oled_set_cursor(7, 0); - oled_write_P(PSTR("Rock On"), true); + oled_write_P(PSTR("Dilemma"), true); render_default_layer_state(1, 1); render_layer_state(1, 2); @@ -158,3 +158,19 @@ bool oled_task_keymap(void) { return false; } #endif + + +#ifdef SWAP_HANDS_ENABLE +const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { + /* Left hand, matrix positions */ + {{0, 4}, {3, 4}, {2, 4}, {5, 4}, {4, 4}}, + {{0, 5}, {1, 5}, {2, 5}, {3, 5}, {4, 5}}, + {{0, 6}, {1, 6}, {2, 6}, {3, 6}, {4, 6}}, + {{0, 7}, {1, 7}, {2, 7}, {3, 7}, {4, 7}}, + /* Right hand, matrix positions */ + {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}}, + {{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}}, + {{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}}, + {{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}}, + }; +#endif diff --git a/keyboards/bastardkb/dilemma/3x5_2/keymaps/drashna/mcuconf.h b/keyboards/bastardkb/dilemma/3x5_2/keymaps/drashna/mcuconf.h new file mode 100644 index 0000000000..f9aa894665 --- /dev/null +++ b/keyboards/bastardkb/dilemma/3x5_2/keymaps/drashna/mcuconf.h @@ -0,0 +1,26 @@ +/** + * Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly) + * + * 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 + +#include_next "mcuconf.h" + +#undef RP_SPI_USE_SPI1 +#define RP_SPI_USE_SPI1 TRUE + +#undef RP_I2C_USE_I2C1 +#define RP_I2C_USE_I2C1 TRUE diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/keymap.c b/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/keymap.c index 1ea0eba7d3..a7d7528dfb 100644 --- a/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/keymap.c +++ b/keyboards/handwired/tractyl_manuform/4x6_right/keymaps/drashna/keymap.c @@ -60,8 +60,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_MOUSE] = LAYOUT_4x6_right( - _______, _______, _______, _______, _______, _______, KC_WH_U, _______, _______, _______, DPI_CONFIG, _______, - _______, _______, _______, _______, _______, _______, KC_WH_D, KC_BTN1, KC_BTN3, KC_BTN2, KC_BTN6, _______, + _______, _______, _______, _______, _______, _______, KC_WH_U, DPI_RMOD,DPI_MOD, S_D_RMOD,S_D_MOD, SNP_TOG, + _______, _______, _______, _______, _______, _______, KC_WH_D, KC_BTN1, KC_BTN3, KC_BTN2, KC_BTN6, SNIPING, _______, _______, _______, _______, _______, _______, KC_BTN7, KC_BTN4, KC_BTN5, KC_BTN8, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c index a96630842d..afcc9b0a7a 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c @@ -132,6 +132,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; +#ifdef ENCODER_ENABLE #ifdef ENCODER_MAP_ENABLE const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { [_DEFAULT_LAYER_1] = { { KC_VOLD, KC_VOLU }, { KC_WH_D, KC_WH_U } }, @@ -185,6 +186,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) { return false; } #endif +#endif #ifdef OLED_ENABLE # include "keyrecords/unicode.h" @@ -209,36 +211,7 @@ void oled_render_large_display(bool side) { // clang-format on oled_write_P(logo, false); -# ifdef CUSTOM_UNICODE_ENABLE - oled_set_cursor(1, 14); - oled_write_ln_P(PSTR("Unicode:"), false); - switch (typing_mode) { - case UCTM_WIDE: - oled_write_P(PSTR(" Wide"), false); - break; - case UCTM_SCRIPT: - oled_write_P(PSTR(" Script"), false); - break; - case UCTM_BLOCKS: - oled_write_P(PSTR(" Blocks"), false); - break; - case UCTM_REGIONAL: - oled_write_P(PSTR(" Regional"), false); - break; - case UCTM_AUSSIE: - oled_write_P(PSTR(" Aussie"), false); - break; - case UCTM_ZALGO: - oled_write_P(PSTR(" Zalgo"), false); - break; - case UCTM_NO_MODE: - oled_write_P(PSTR(" Normal"), false); - break; - default: - oled_write_P(PSTR(" Unknown"), false); - break; - } -# endif + render_unicode_mode(1, 14); } } #endif diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk index 8b227d4cbd..acec28fa6e 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk @@ -1,40 +1,52 @@ -COMMAND_ENABLE = no -RGBLIGHT_ENABLE = yes -RGBLIGHT_STARTUP_ANIMATION = yes -AUDIO_ENABLE = yes +AUTOCORRECT_ENABLE = no +AUDIO_ENABLE = no +ENCODER_ENABLE = no +CUSTOM_BOOTMAGIC_ENABLE = no +CUSTOM_UNICODE_ENABLE = no HAPTIC_ENABLE = no -TAP_DANCE_ENABLE = yes -OLED_ENABLE = yes -WPM_ENABLE = yes -ENCODER_ENABLE = yes -ENCODER_MAP_ENABLE = yes -AUTOCORRECT_ENABLE = yes -CAPS_WORD_ENABLE = yes -DEFERRED_EXEC_ENABLE = yes +OLED_ENABLE = no +OLED_DRIVER = custom +RGBLIGHT_ENABLE = no +SWAP_HANDS_ENABLE = no +TAP_DANCE_ENABLE = no +WPM_ENABLE = no ifeq ($(strip $(KEYBOARD)), handwired/tractyl_manuform/5x6_right/elite_c) - RGBLIGHT_ENABLE = no - AUDIO_ENABLE = no - HAPTIC_ENABLE = no - TAP_DANCE_ENABLE = no - OLED_ENABLE = no - WPM_ENABLE = no - ENCODER_ENABLE = no - AUTOCORRECT_ENABLE = no - LTO_SUPPORTED = yes - SWAP_HANDS_ENABLE = no - CUSTOM_UNICODE_ENABLE = no - CAPS_WORD_ENABLE = no - BOOTLOADER = qmk-hid - BOOTLOADER_SIZE = 512 + BOOTLOADER = qmk-hid + BOOTLOADER_SIZE = 512 + CUSTOM_SPLIT_TRANSPORT_SYNC = no + LTO_ENABLE = yes +endif +ifeq ($(strip $(KEYBOARD)), handwired/tractyl_manuform/5x6_right/arduinomicro) + BOOTLOADER = qmk-hid + BOOTLOADER_SIZE = 512 + CUSTOM_SPLIT_TRANSPORT_SYNC = no + LTO_ENABLE = yes endif ifeq ($(strip $(KEYBOARD)), handwired/tractyl_manuform/5x6_right/teensy2pp) - AUTOCORRECT_ENABLE = no - CAPS_WORD_ENABLE = yes + AUTOCORRECT_ENABLE = no + OVERLOAD_FEATURES = yes + LTO_ENABLE = yes endif ifeq ($(strip $(KEYBOARD)), handwired/tractyl_manuform/5x6_right/f411) - BOOTLOADER = tinyuf2 + BOOTLOADER = tinyuf2 + AUTOCORRECT_ENABLE = yes + LTO_SUPPORTED = no + OVERLOAD_FEATURES = yes endif # DEBOUNCE_TYPE = sym_eager_pk -OLED_DRIVER = custom +ifeq ($(strip $(OVERLOAD_FEATURES)), yes) + AUDIO_ENABLE = yes + CAPS_WORD_ENABLE = yes + CUSTOM_BOOTMAGIC_ENABLE = yes + CUSTOM_UNICODE_ENABLE = yes + ENCODER_ENABLE = yes + ENCODER_MAP_ENABLE = yes + OLED_ENABLE = yes + RGBLIGHT_ENABLE = yes + RGBLIGHT_STARTUP_ANIMATION = yes + TAP_DANCE_ENABLE = yes + SWAP_HANDS_ENABLE = yes + WPM_ENABLE = yes +endif diff --git a/keyboards/keebio/iris/keymaps/drashna/config.h b/keyboards/keebio/iris/keymaps/drashna/config.h index 0569f30744..a4d2def67c 100644 --- a/keyboards/keebio/iris/keymaps/drashna/config.h +++ b/keyboards/keebio/iris/keymaps/drashna/config.h @@ -30,7 +30,9 @@ # define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2 # define RGBLIGHT_EFFECT_SNAKE_LENGTH 2 -# define RGBLIGHT_LIMIT_VAL 225 +# ifndef RGBLIGHT_LIMIT_VAL +# define RGBLIGHT_LIMIT_VAL 225 +# endif #endif // RGBLIGHT_ENABLE #ifdef AUDIO_ENABLE @@ -49,12 +51,14 @@ # define QMK_SPEAKER C6 #endif -#undef PRODUCT #if defined(KEYBOARD_keebio_iris_rev2) +# undef PRODUCT # define PRODUCT "Drashna Hacked Iris Rev 2" #elif defined(KEYBOARD_keebio_iris_rev3) +# undef PRODUCT # define PRODUCT "Drashna Hacked Iris Rev 3" #elif defined(KEYBOARD_keebio_iris_rev4) +# undef PRODUCT # define PRODUCT "Drashna Hacked Iris Rev 4" #endif diff --git a/keyboards/keebio/iris/keymaps/drashna/keymap.c b/keyboards/keebio/iris/keymaps/drashna/keymap.c index a6199f1efe..02d0011f5c 100644 --- a/keyboards/keebio/iris/keymaps/drashna/keymap.c +++ b/keyboards/keebio/iris/keymaps/drashna/keymap.c @@ -101,16 +101,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; // clang-format on -void matrix_init_keymap(void) { -#ifndef CONVERT_TO_PROTON_C - setPinOutput(D5); - writePinHigh(D5); - - setPinOutput(B0); - writePinHigh(B0); -#endif -} - void keyboard_post_init_keymap(void) { #if BACKLIGHT_ENABLE backlight_enable(); diff --git a/keyboards/keebio/iris/keymaps/drashna/rules.mk b/keyboards/keebio/iris/keymaps/drashna/rules.mk index 51b9a105d2..f531c74a56 100644 --- a/keyboards/keebio/iris/keymaps/drashna/rules.mk +++ b/keyboards/keebio/iris/keymaps/drashna/rules.mk @@ -14,7 +14,3 @@ INDICATOR_LIGHTS = no RGBLIGHT_STARTUP_ANIMATION = no CUSTOM_UNICODE_ENABLE = no CUSTOM_SPLIT_TRANSPORT_SYNC = no - -ifneq ($(strip $(KEYBOARD)), keebio/iris/rev6) - RGBLIGHT_ENABLE = yes -endif diff --git a/keyboards/keebio/viterbi/keymaps/drashna/keymap.c b/keyboards/keebio/viterbi/keymaps/drashna/keymap.c index cc9f3f82eb..4e393e4196 100644 --- a/keyboards/keebio/viterbi/keymaps/drashna/keymap.c +++ b/keyboards/keebio/viterbi/keymaps/drashna/keymap.c @@ -74,13 +74,3 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { //} return true; } - -void matrix_init_keymap(void) { -#ifndef CONVERT_TO_PROTON_C - setPinOutput(D5); - writePinHigh(D5); - - setPinOutput(B0); - writePinHigh(B0); -#endif -} diff --git a/keyboards/keebio/viterbi/keymaps/drashna/rules.mk b/keyboards/keebio/viterbi/keymaps/drashna/rules.mk index 487031b36d..86a693c3b1 100644 --- a/keyboards/keebio/viterbi/keymaps/drashna/rules.mk +++ b/keyboards/keebio/viterbi/keymaps/drashna/rules.mk @@ -21,4 +21,5 @@ LAYOUTS = ortho_5x7 # SRC := $(filter-out split_util.c,$(SRC)) # SRC += quantum/matrix.c -BOOTLOADER = qmk-dfu +BOOTLOADER = qmk-hid +BOOTLOADER_SIZE = 512 diff --git a/keyboards/orthodox/keymaps/drashna/config.h b/keyboards/orthodox/keymaps/drashna/config.h index ca6a91f42d..f17deefb4e 100644 --- a/keyboards/orthodox/keymaps/drashna/config.h +++ b/keyboards/orthodox/keymaps/drashna/config.h @@ -53,10 +53,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. # endif #endif // AUDIO_ENABLE -#undef PRODUCT #ifdef KEYBOARD_orthodox_rev1 +# undef PRODUCT # define PRODUCT "Drashna Hacked Orthodox Rev .1" #elif KEYBOARD_orthodox_rev3 +# undef PRODUCT # define PRODUCT "Drashna Hacked Orthodox Rev .3" #endif diff --git a/keyboards/orthodox/keymaps/drashna/keymap.c b/keyboards/orthodox/keymaps/drashna/keymap.c index 09ac5bd914..6d4b49fe59 100644 --- a/keyboards/orthodox/keymaps/drashna/keymap.c +++ b/keyboards/orthodox/keymaps/drashna/keymap.c @@ -68,13 +68,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; // clang-format on - -void matrix_init_keymap(void) { -#ifndef CONVERT_TO_PROTON_C - setPinOutput(D5); - writePinHigh(D5); - - setPinOutput(B0); - writePinHigh(B0); -#endif -} diff --git a/keyboards/splitkb/kyria/keymaps/drashna/keymap.c b/keyboards/splitkb/kyria/keymaps/drashna/keymap.c index 6b18e7c3bc..8c028985ef 100644 --- a/keyboards/splitkb/kyria/keymaps/drashna/keymap.c +++ b/keyboards/splitkb/kyria/keymaps/drashna/keymap.c @@ -144,6 +144,7 @@ void oled_render_large_display(bool side) { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 3, 7, 15, 14, 30, 28, 60, 56,120,112,112,112,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,112,112,112,120, 56, 60, 28, 30, 14, 15, 7, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // clang-format on + oled_set_cursor(0,7); oled_write_raw_P(kyria_logo, sizeof(kyria_logo)); } } @@ -157,9 +158,11 @@ const rgblight_segment_t PROGMEM gui_layers[] = RGBLIGHT_LAYER_SEGMENTS({7, const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(shift_layers, control_layers, alt_layers, gui_layers); -void keyboard_post_init_keymap(void) { rgblight_layers = my_rgb_layers; } +void keyboard_post_init_keymap(void) { + rgblight_layers = my_rgb_layers; +} -void matrix_scan_keymap(void) { +void housekeeping_task_keymap(void) { uint8_t mods = mod_config(get_mods() | get_oneshot_mods()); rgblight_set_layer_state(0, mods & MOD_MASK_SHIFT); rgblight_set_layer_state(1, mods & MOD_MASK_CTRL); diff --git a/layouts/community/ergodox/drashna/keymap.c b/layouts/community/ergodox/drashna/keymap.c index 64ef098280..e5675854e1 100644 --- a/layouts/community/ergodox/drashna/keymap.c +++ b/layouts/community/ergodox/drashna/keymap.c @@ -268,7 +268,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } -void matrix_scan_keymap(void) { // runs frequently to update info +void housekeeping_task_keymap(void) { // runs frequently to update info uint8_t modifiers = get_mods(); uint8_t led_usb_state = host_keyboard_leds(); uint8_t one_shot = get_oneshot_mods(); diff --git a/layouts/community/ortho_4x12/drashna/config.h b/layouts/community/ortho_4x12/drashna/config.h index e2154cbe2f..85112d8ce4 100644 --- a/layouts/community/ortho_4x12/drashna/config.h +++ b/layouts/community/ortho_4x12/drashna/config.h @@ -66,12 +66,14 @@ #endif // KEYBOARD_planck_light #if defined(KEYBOARD_planck) -# undef PRODUCT # if defined(KEYBOARD_planck_light) +# undef PRODUCT # define PRODUCT "Drashna Hacked RGB Beacon(Planck Light)" # elif defined(KEYBOARD_planck_rev6) +# undef PRODUCT # define PRODUCT "Drashna Hacked Planck Rev6" # elif defined(KEYBOARD_planck_ez) +# undef PRODUCT # define PRODUCT "Drashna Hacked Planck EZ" # define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 4095 # endif diff --git a/layouts/community/ortho_4x12/drashna/keymap.c b/layouts/community/ortho_4x12/drashna/keymap.c index b7a132db12..b22401a77e 100644 --- a/layouts/community/ortho_4x12/drashna/keymap.c +++ b/layouts/community/ortho_4x12/drashna/keymap.c @@ -249,23 +249,12 @@ bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) { return true; } -void matrix_init_keymap(void) { +void keyboard_post_init_keymap(void) { # ifdef KEYBOARD_planck_light writePinLow(D6); # endif // rgblight_mode(RGB_MATRIX_MULTISPLASH); } -#else // RGB_MATRIX_INIT - -void matrix_init_keymap(void) { -# if !defined(CONVERT_TO_PROTON_C) && !defined(KEYBOARD_planck) - setPinOutput(D5); - writePinHigh(D5); - - setPinOutput(B0); - writePinHigh(B0); -# endif -} #endif // RGB_MATRIX_INIT #ifdef ENCODER_ENABLE diff --git a/layouts/community/ortho_4x12/drashna/rules.mk b/layouts/community/ortho_4x12/drashna/rules.mk index e5c25d6fd5..a2278e931d 100644 --- a/layouts/community/ortho_4x12/drashna/rules.mk +++ b/layouts/community/ortho_4x12/drashna/rules.mk @@ -20,7 +20,7 @@ ifeq ($(strip $(KEYBOARD)), planck/rev6) AUDIO_ENABLE = yes EEPROM_DRIVER = i2c ENCODER_MAP_ENABLE = yes - AUTOCORRECTION_ENABLE = yes + AUTOCORRECT_ENABLE = yes CAPS_WORD_ENABLE = yes endif ifeq ($(strip $(KEYBOARD)), planck/light) @@ -39,6 +39,13 @@ ifeq ($(strip $(KEYBOARD)), planck/ez) CONSOLE_ENABLE = yes COMMAND_ENABLE = yes AUDIO_ENABLE = yes - AUTOCORRECTION_ENABLE = yes + AUTOCORRECT_ENABLE = yes CAPS_WORD_ENABLE = yes endif + +ifeq ($(strip $(MCU)), atmega32u4) + BOOTLOADER = qmk-hid + BOOTLOADER_SIZE = 512 + LTO_ENABLE = yes + CUSTOM_UNICODE_ENABLE = no +endif diff --git a/layouts/community/ortho_5x12/drashna/rules.mk b/layouts/community/ortho_5x12/drashna/rules.mk index 57cc3ce0be..c3b417f1bd 100644 --- a/layouts/community/ortho_5x12/drashna/rules.mk +++ b/layouts/community/ortho_5x12/drashna/rules.mk @@ -16,3 +16,9 @@ ifeq ($(strip $(KEYBOARD)), fractal) BOOTLOADER = qmk-dfu CUSTOM_UNICODE_ENABLE = no endif + +ifeq ($(strip $(MCU)), atmega32u4) + BOOTLOADER = qmk-dfu + BOOTLOADER_SIZE = 512 + LTO_ENABLE = yes +endif diff --git a/layouts/community/split_3x6_3/drashna/chconf.h b/layouts/community/split_3x6_3/drashna/chconf.h index ffcfb19896..9dbc78b973 100644 --- a/layouts/community/split_3x6_3/drashna/chconf.h +++ b/layouts/community/split_3x6_3/drashna/chconf.h @@ -1,6 +1,8 @@ -#define CH_CFG_ST_RESOLUTION 16 -#define CH_CFG_ST_FREQUENCY 10000 +#if defined(KEYBOARD_crkbd) +# define CH_CFG_ST_RESOLUTION 16 +# define CH_CFG_ST_FREQUENCY 10000 +#endif #if __has_include("platforms/chibios/common/configs/chconf.h") # include_next "platforms/chibios/common/configs/chconf.h" diff --git a/layouts/community/split_3x6_3/drashna/config.h b/layouts/community/split_3x6_3/drashna/config.h index 0944e37077..0ef36d1f32 100644 --- a/layouts/community/split_3x6_3/drashna/config.h +++ b/layouts/community/split_3x6_3/drashna/config.h @@ -80,8 +80,13 @@ # define NO_MUSIC_MODE #endif -#ifdef HAPTIC_ENABLE -# define SOLENOID_PIN B7 +#if defined(HAPTIC_ENABLE) +# if defined(CONVERT_TO_PROTON_C) +# define A13 PAL_LINE(GPIOA, 13) +# define SOLENOID_PIN A13 +# else +# define SOLENOID_PIN B7 +# endif #endif #undef PRODUCT diff --git a/layouts/community/split_3x6_3/drashna/halconf.h b/layouts/community/split_3x6_3/drashna/halconf.h index b099320b30..7cc1306598 100644 --- a/layouts/community/split_3x6_3/drashna/halconf.h +++ b/layouts/community/split_3x6_3/drashna/halconf.h @@ -15,8 +15,9 @@ */ #pragma once -// #define HAL_USE_DAC TRUE -#define HAL_USE_PWM TRUE -#define HAL_USE_SERIAL TRUE +#if defined(KEYBOARD_crkbd) +# define HAL_USE_PWM TRUE +# define HAL_USE_SERIAL TRUE +#endif #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 707e688267..59f5fefb48 100644 --- a/layouts/community/split_3x6_3/drashna/keymap.c +++ b/layouts/community/split_3x6_3/drashna/keymap.c @@ -238,8 +238,7 @@ void render_small_kitty(void) { void oled_driver_render_logo_right(void) { render_small_kitty(); - oled_set_cursor(0, 4); - render_default_layer_state(); + render_default_layer_state(0, 4); } # endif #endif diff --git a/layouts/community/split_3x6_3/drashna/mcuconf.h b/layouts/community/split_3x6_3/drashna/mcuconf.h index 649af5d1f4..920261476c 100644 --- a/layouts/community/split_3x6_3/drashna/mcuconf.h +++ b/layouts/community/split_3x6_3/drashna/mcuconf.h @@ -17,20 +17,16 @@ #include_next <mcuconf.h> -// #undef STM32_HSE_ENABLED -// #define STM32_HSE_ENABLED FALSE -// #undef STM32_GPT_USE_TIM15 -// #define STM32_GPT_USE_TIM15 FALSE +#if defined(KEYBOARD_crkbd) -#undef STM32_PWM_USE_TIM2 -#define STM32_PWM_USE_TIM2 TRUE -#undef STM32_PWM_USE_TIM3 -#define STM32_PWM_USE_TIM3 FALSE +# 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_SERIAL_USE_USART1 +# define STM32_SERIAL_USE_USART1 TRUE -// #undef STM32_PWM_TIM15_IRQ_PRIORITY -// #define STM32_PWM_TIM15_IRQ_PRIORITY 16 -#undef STM32_ST_USE_TIMER -#define STM32_ST_USE_TIMER 3 +# undef STM32_ST_USE_TIMER +# define STM32_ST_USE_TIMER 3 +#endif diff --git a/layouts/community/split_3x6_3/drashna/rules.mk b/layouts/community/split_3x6_3/drashna/rules.mk index 83eb699812..3fd4279bef 100644 --- a/layouts/community/split_3x6_3/drashna/rules.mk +++ b/layouts/community/split_3x6_3/drashna/rules.mk @@ -13,6 +13,10 @@ AUDIO_ENABLE = no # Audio output UNICODE_ENABLE = no # Unicode RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. SWAP_HANDS_ENABLE = no # Enable one-hand typing +OS_DETECTION_ENABLE = no +CUSTOM_UNICODE_ENABLE = no +CUSTOM_POINTING_DEVICE = no +CUSTOM_SPLIT_TRANSPORT_SYNC = no USE_ARM_CONFIG ?= no ifeq ($(strip $(CONVERT_TO)), proton_c) @@ -27,19 +31,26 @@ endif ifeq ($(strip $(MCU)), STM32F401) USE_ARM_CONFIG = yes endif +ifeq ($(strip $(MCU)), STM32F411) + USE_ARM_CONFIG = yes +endif + +ifeq ($(strip $(MCU)), atmega32u4) + BOOTLOADER = qmk-hid + BOOTLOADER_SIZE = 512 +endif ifeq ($(strip $(USE_ARM_CONFIG)), yes) HAPTIC_ENABLE = no WS2812_DRIVER = pwm # won't work without a patch to the ctpc mk file SERIAL_DRIVER = usart - SWAP_HANDS_ENABLE = yes WPM_ENABLE = yes - AUTOCORRECTION_ENABLE = yes + AUTOCORRECT_ENABLE = yes CAPS_WORD_ENABLE = yes -else - CUSTOM_UNICODE_ENABLE = no - BOOTLOADER = qmk-hid - BOOTLOADER_SIZE = 512 + OS_DETECTION_ENABLE = yes + CUSTOM_UNICODE_ENABLE = no + CUSTOM_POINTING_DEVICE = no + CUSTOM_SPLIT_TRANSPORT_SYNC = no endif ifeq ($(strip $(KEYBOARD)), crkbd/rev1) @@ -47,7 +58,3 @@ ifeq ($(strip $(KEYBOARD)), crkbd/rev1) RGB_MATRIX_ENABLE = yes HAPTIC_ENABLE = no endif - -ifeq ($(strip $(KEYBOARD)), cantor) - SWAP_HANDS_ENABLE = no -endif diff --git a/users/drashna/bootmagic_better.c b/users/drashna/bootmagic_better.c index 4932e25f1d..ffd2e609ae 100644 --- a/users/drashna/bootmagic_better.c +++ b/users/drashna/bootmagic_better.c @@ -44,7 +44,7 @@ void bootmagic_lite(void) { if (matrix_get_row(row) & (1 << col)) { perform_reset = true; } -#ifdef STM32F411xE +#if defined(STM32F411xE) && !defined(CONVERTER_ENABLED) if (!readPin(A0)) { perform_reset = true; } diff --git a/users/drashna/callbacks.c b/users/drashna/callbacks.c index 40383f124f..c2f1156cee 100644 --- a/users/drashna/callbacks.c +++ b/users/drashna/callbacks.c @@ -20,22 +20,6 @@ void keyboard_pre_init_user(void) { // functions in the keymaps // Call user matrix init, set default RGB colors and then // call the keymap's init function -__attribute__((weak)) void matrix_init_keymap(void) {} -__attribute__((weak)) void matrix_init_secret(void) {} -void matrix_init_user(void) { -#if defined(BOOTLOADER_CATERINA) && defined(__AVR__) && defined(__AVR_ATmega32U4__) - DDRD &= ~(1 << 5); - PORTD &= ~(1 << 5); - - DDRB &= ~(1 << 0); - PORTB &= ~(1 << 0); -#endif -#ifdef CUSTOM_UNICODE_ENABLE - matrix_init_unicode(); -#endif - matrix_init_secret(); - matrix_init_keymap(); -} __attribute__((weak)) void keyboard_post_init_keymap(void) {} void keyboard_post_init_user(void) { @@ -51,6 +35,17 @@ void keyboard_post_init_user(void) { #ifdef I2C_SCANNER_ENABLE keyboard_post_init_i2c(); #endif +#ifdef CUSTOM_UNICODE_ENABLE + keyboard_post_init_unicode(); +#endif + +#if defined(BOOTLOADER_CATERINA) && defined(__AVR__) && defined(__AVR_ATmega32U4__) + DDRD &= ~(1 << 5); + PORTD &= ~(1 << 5); + + DDRB &= ~(1 << 0); + PORTB &= ~(1 << 0); +#endif keyboard_post_init_keymap(); } @@ -106,7 +101,6 @@ void suspend_wakeup_init_user(void) { // No global matrix scan code, so just run keymap's matrix // scan function __attribute__((weak)) void matrix_scan_keymap(void) {} -__attribute__((weak)) void matrix_scan_secret(void) {} void matrix_scan_user(void) { static bool has_ran_yet; if (!has_ran_yet) { @@ -117,9 +111,6 @@ void matrix_scan_user(void) { #ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. run_diablo_macro_check(); #endif // TAP_DANCE_ENABLE -#ifdef CAPS_WORD_ENABLE - caps_word_task(); -#endif #if defined(CUSTOM_RGB_MATRIX) matrix_scan_rgb_matrix(); #endif @@ -129,7 +120,6 @@ void matrix_scan_user(void) { #ifdef CUSTOM_OLED_DRIVER matrix_scan_oled(); #endif - matrix_scan_secret(); matrix_scan_keymap(); } diff --git a/users/drashna/callbacks.h b/users/drashna/callbacks.h index 15f8997619..d3d260378d 100644 --- a/users/drashna/callbacks.h +++ b/users/drashna/callbacks.h @@ -5,7 +5,7 @@ #include "quantum.h" -void matrix_init_keymap(void); +void keyboard_post_init_keymap(void); void matrix_init_secret(void); void shutdown_keymap(void); void suspend_power_down_keymap(void); @@ -19,7 +19,7 @@ void eeconfig_init_keymap(void); void housekeeping_task_keymap(void); #ifdef CUSTOM_UNICODE_ENABLE -void matrix_init_unicode(void); +void keyboard_post_init_unicode(void); #endif #ifdef SPLIT_KEYBOARD void matrix_slave_scan_keymap(void); diff --git a/users/drashna/callbacks.md b/users/drashna/callbacks.md index a0f0d9fdae..5908a66142 100644 --- a/users/drashna/callbacks.md +++ b/users/drashna/callbacks.md @@ -15,11 +15,6 @@ My [Ergodox EZ Keymap](https://github.com/qmk/qmk_firmware/blob/master/layouts/c You can see a list of these files in [callbacks.c](callbacks.c), or a shortend list here ```c -__attribute__((weak)) void matrix_init_keymap(void) {} -void matrix_init_user(void) { - matrix_init_keymap(); -} - __attribute__((weak)) void keyboard_post_init_keymap(void) {} void keyboard_post_init_user(void) { keyboard_post_init_keymap(); diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index d63f05b590..283e82d13d 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -130,14 +130,35 @@ void keyboard_post_init_i2c(void) { } #endif -#if defined(AUTOCORRECT_ENABLE) && defined(AUDIO_ENABLE) -# ifdef USER_SONG_LIST +#if defined(AUTOCORRECT_ENABLE) +# if defined(AUDIO_ENABLE) +# ifdef USER_SONG_LIST float autocorrect_song[][2] = SONG(MARIO_GAMEOVER); -# else +# else float autocorrect_song[][2] = SONG(PLOVER_GOODBYE_SOUND); +# endif # endif + bool apply_autocorrect(uint8_t backspaces, const char *str) { + if (layer_state_is(_GAMEPAD)) { + return false; + } + // TO-DO use unicode stuff for this. Will probably have to reverse engineer + // send string to get working properly, to send char string. + +# if defined(AUDIO_ENABLE) PLAY_SONG(autocorrect_song); +# endif return true; } #endif + +#if defined(CAPS_WORD_ENABLE) && !defined(NO_ACTION_ONESHOT) +void oneshot_locked_mods_changed_user(uint8_t mods) { + if (mods & MOD_MASK_SHIFT) { + del_mods(MOD_MASK_SHIFT); + set_oneshot_locked_mods(~MOD_MASK_SHIFT & get_oneshot_locked_mods()); + caps_word_on(); + } +} +#endif diff --git a/users/drashna/keyrecords/process_records.h b/users/drashna/keyrecords/process_records.h index 2ee7551648..0acd7e010d 100644 --- a/users/drashna/keyrecords/process_records.h +++ b/users/drashna/keyrecords/process_records.h @@ -45,6 +45,7 @@ enum userspace_custom_keycodes { KC_AUSSIE, KC_ZALGO, KC_SUPER, + KC_COMIC, KC_ACCEL, NEW_SAFE_RANGE // use "NEWPLACEHOLDER for keymap specific codes }; diff --git a/users/drashna/keyrecords/unicode.c b/users/drashna/keyrecords/unicode.c index 753fca3231..16390074ca 100644 --- a/users/drashna/keyrecords/unicode.c +++ b/users/drashna/keyrecords/unicode.c @@ -7,7 +7,18 @@ #include "unicode.h" #include "process_unicode_common.h" -uint8_t typing_mode = UCTM_NO_MODE; +uint8_t unicode_typing_mode = UCTM_NO_MODE; +const char unicode_mode_str[UNCODES_MODE_END][13] PROGMEM = { + " Normal\0", + " Wide\0", + " Script\0", + " Blocks\0", + " Regional\0", + " Aussie\0", + " Zalgo\0", + "Super Script\0", + " Comic\0", +}; /** * @brief Registers the unicode keystrokes based on desired unicode @@ -91,6 +102,45 @@ DEFINE_UNICODE_RANGE_TRANSLATOR(unicode_range_translator_script, 0x1D4EA, 0x1D4D DEFINE_UNICODE_RANGE_TRANSLATOR(unicode_range_translator_boxes, 0x1F170, 0x1F170, '0', '1', 0x2002); DEFINE_UNICODE_RANGE_TRANSLATOR(unicode_range_translator_regional, 0x1F1E6, 0x1F1E6, '0', '1', 0x2003); +// DEFINE_UNICODE_LUT_TRANSLATOR(unicode_lut_translator_normal, +// 'a', // a +// 'b', // b +// 'c', // c +// 'd', // d +// 'e', // e +// 'f', // f +// 'g', // g +// 'h', // h +// 'i', // i +// 'j', // j +// 'k', // k +// 'l', // l +// 'm', // m +// 'n', // n +// 'o', // o +// 'p', // p +// 'q', // q +// 'r', // r +// 's', // s +// 't', // t +// 'u', // u +// 'v', // v +// 'w', // w +// 'x', // x +// 'y', // y +// 'z', // z +// '1', // 1 +// '2', // 2 +// '3', // 3 +// '4', // 4 +// '5', // 5 +// '6', // 6 +// '7', // 7 +// '8', // 8 +// '9', // 9 +// '0' // 0 +// ); + DEFINE_UNICODE_LUT_TRANSLATOR(unicode_lut_translator_aussie, 0x0250, // a 'q', // b @@ -169,6 +219,45 @@ DEFINE_UNICODE_LUT_TRANSLATOR(unicode_lut_translator_super, 0x2070 // 0 ); +DEFINE_UNICODE_LUT_TRANSLATOR(unicode_lut_translator_comic, + 0x212B, // a + 0x212C, // b + 0x2102, // c + 0x2145, // d + 0x2107, // e + 0x2132, // f + 0x2141, // g + 0x210D, // h + 0x2148, // i + 0x2111, // j + 'k', // k + 0x2143, // l + 'm', // m + 0x2115, // n + 0x2134, // o + 0x2119, // p + 0x211A, // q + 0x211B, // r + 0x20B7, // s + 0x20B8, // t + 0x2127, // u + 'v', // v + 0x20A9, // w + 'x', // x + 0x213D, // y + 'z', // z + '1', // 1 + '2', // 2 + '3', // 3 + '4', // 4 + '5', // 5 + '6', // 6 + '7', // 7 + '8', // 8 + '9', // 9 + '0' // 0 +); + bool process_record_aussie(uint16_t keycode, keyrecord_t *record) { bool is_shifted = (get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT; if ((KC_A <= keycode) && (keycode <= KC_0)) { @@ -280,12 +369,12 @@ bool process_record_unicode(uint16_t keycode, keyrecord_t *record) { register_unicode(0x203D); } break; - case KC_NOMODE ... KC_SUPER: + case KC_NOMODE ... KC_COMIC: if (record->event.pressed) { - if (typing_mode != keycode - KC_NOMODE) { - typing_mode = keycode - KC_NOMODE; + if (unicode_typing_mode != keycode - KC_NOMODE) { + unicode_typing_mode = keycode - KC_NOMODE; } else { - typing_mode = UCTM_NO_MODE; + unicode_typing_mode = UCTM_NO_MODE; } } break; @@ -295,23 +384,26 @@ bool process_record_unicode(uint16_t keycode, keyrecord_t *record) { return true; } - if (((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) && record->tap.count) { - keycode &= 0xFF; + if (IS_QK_MOD_TAP(keycode) && record->tap.count) { + keycode = QK_MOD_TAP_GET_TAP_KEYCODE(keycode); + } + if (IS_QK_LAYER_TAP(keycode) && record->tap.count) { + keycode = QK_LAYER_TAP_GET_TAP_KEYCODE(keycode); } - if (typing_mode == UCTM_WIDE) { + if (unicode_typing_mode == UCTM_WIDE) { if (((KC_A <= keycode) && (keycode <= KC_0)) || keycode == KC_SPACE) { return process_record_glyph_replacement(keycode, record, unicode_range_translator_wide); } - } else if (typing_mode == UCTM_SCRIPT) { + } else if (unicode_typing_mode == UCTM_SCRIPT) { if (((KC_A <= keycode) && (keycode <= KC_0)) || keycode == KC_SPACE) { return process_record_glyph_replacement(keycode, record, unicode_range_translator_script); } - } else if (typing_mode == UCTM_BLOCKS) { + } else if (unicode_typing_mode == UCTM_BLOCKS) { if (((KC_A <= keycode) && (keycode <= KC_0)) || keycode == KC_SPACE) { return process_record_glyph_replacement(keycode, record, unicode_range_translator_boxes); } - } else if (typing_mode == UCTM_REGIONAL) { + } else if (unicode_typing_mode == UCTM_REGIONAL) { if (((KC_A <= keycode) && (keycode <= KC_0)) || keycode == KC_SPACE) { if (!process_record_glyph_replacement(keycode, record, unicode_range_translator_regional)) { wait_us(500); @@ -319,22 +411,26 @@ bool process_record_unicode(uint16_t keycode, keyrecord_t *record) { return false; } } - } else if (typing_mode == UCTM_SUPER) { + } else if (unicode_typing_mode == UCTM_SUPER) { if (((KC_A <= keycode) && (keycode <= KC_0))) { return process_record_glyph_replacement(keycode, record, unicode_lut_translator_super); } - } else if (typing_mode == UCTM_AUSSIE) { + } else if (unicode_typing_mode == UCTM_COMIC) { + if (((KC_A <= keycode) && (keycode <= KC_0))) { + return process_record_glyph_replacement(keycode, record, unicode_lut_translator_comic); + } + } else if (unicode_typing_mode == UCTM_AUSSIE) { return process_record_aussie(keycode, record); - } else if (typing_mode == UCTM_ZALGO) { + } else if (unicode_typing_mode == UCTM_ZALGO) { return process_record_zalgo(keycode, record); } return true; } /** - * @brief Initialize the default unicode mode on firmware startu + * @brief Initialize the default unicode mode on firmware startup * */ -void matrix_init_unicode(void) { +void keyboard_post_init_unicode(void) { unicode_input_mode_init(); } diff --git a/users/drashna/keyrecords/unicode.h b/users/drashna/keyrecords/unicode.h index 6885d4dd7f..43c2db89c0 100644 --- a/users/drashna/keyrecords/unicode.h +++ b/users/drashna/keyrecords/unicode.h @@ -3,7 +3,7 @@ #pragma once -enum unicode_typing_mode { +enum unicode_typing_modes { UCTM_NO_MODE, UCTM_WIDE, UCTM_SCRIPT, @@ -12,6 +12,9 @@ enum unicode_typing_mode { UCTM_AUSSIE, UCTM_ZALGO, UCTM_SUPER, + UCTM_COMIC, + UNCODES_MODE_END, }; -extern uint8_t typing_mode; +extern uint8_t unicode_typing_mode; +extern const PROGMEM char unicode_mode_str[UNCODES_MODE_END][13]; diff --git a/users/drashna/oled/oled_stuff.c b/users/drashna/oled/oled_stuff.c index 85a66eec7e..6dbe3b4812 100644 --- a/users/drashna/oled/oled_stuff.c +++ b/users/drashna/oled/oled_stuff.c @@ -67,18 +67,22 @@ static const char PROGMEM code_to_name[256] = { * @param record keyrecord_t data structure */ void add_keylog(uint16_t keycode, keyrecord_t *record) { - if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) || (keycode >= QK_MODS && keycode <= QK_MODS_MAX)) { - if (((keycode & 0xFF) == KC_BSPC) && mod_config(get_mods() | get_oneshot_mods()) & MOD_MASK_CTRL) { - memset(keylog_str, ' ', OLED_KEYLOGGER_LENGTH); - return; - } - if (record->tap.count) { - keycode &= 0xFF; - } else if (keycode > 0xFF) { - return; - } + if (keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) { + keycode = QK_MOD_TAP_GET_TAP_KEYCODE(keycode); + } else if (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) { + keycode = QK_LAYER_TAP_GET_TAP_KEYCODE(keycode); + } else if (keycode >= QK_MODS && keycode <= QK_MODS_MAX) { + keycode = QK_MODS_GET_BASIC_KEYCODE(keycode); } - if (keycode > 0xFF) { + + + if ((keycode == KC_BSPC) && mod_config(get_mods() | get_oneshot_mods()) & MOD_MASK_CTRL) { + memset(keylog_str, ' ', OLED_KEYLOGGER_LENGTH); + return; + } + if (record->tap.count) { + keycode &= 0xFF; + } else if (keycode > 0xFF) { return; } @@ -426,13 +430,14 @@ void render_bootmagic_status(uint8_t col, uint8_t line) { oled_write_P(logo[0][0], !is_bootmagic_on); } #ifndef OLED_DISPLAY_VERBOSE + oled_write_P(PSTR(" "), false); oled_write_P(logo[1][1], is_bootmagic_on); oled_write_P(logo[0][1], !is_bootmagic_on); #endif oled_write_P(PSTR(" "), false); oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NKRO), keymap_config.nkro); oled_write_P(PSTR(" "), false); -#if defined(AUTOCORRECTION_ENABLE) || defined(AUTOCORRECT_ENABLE) +#if defined(AUTOCORRECT_ENABLE) oled_write_P(PSTR("CRCT"), autocorrect_is_enabled()); oled_write_P(PSTR(" "), false); #else @@ -732,33 +737,8 @@ void render_kitty(uint8_t col, uint8_t line) { void render_unicode_mode(uint8_t col, uint8_t line) { #ifdef CUSTOM_UNICODE_ENABLE oled_set_cursor(col, line); - oled_write_ln_P(PSTR("Unicode:"), false); - switch (typing_mode) { - case UCTM_WIDE: - oled_write_P(PSTR(" Wide"), false); - break; - case UCTM_SCRIPT: - oled_write_P(PSTR(" Script"), false); - break; - case UCTM_BLOCKS: - oled_write_P(PSTR(" Blocks"), false); - break; - case UCTM_REGIONAL: - oled_write_P(PSTR(" Regional"), false); - break; - case UCTM_AUSSIE: - oled_write_P(PSTR(" Aussie"), false); - break; - case UCTM_ZALGO: - oled_write_P(PSTR(" Zalgo"), false); - break; - case UCTM_NO_MODE: - oled_write_P(PSTR(" Normal"), false); - break; - default: - oled_write_P(PSTR(" Unknown"), false); - break; - } + oled_write_P(PSTR("Unicode:"), false); + oled_write_P(unicode_mode_str[unicode_typing_mode], false); #endif } diff --git a/users/drashna/post_config.h b/users/drashna/post_config.h index 59b8cd7e42..85e60df681 100644 --- a/users/drashna/post_config.h +++ b/users/drashna/post_config.h @@ -43,6 +43,7 @@ # define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN # endif # endif +# undef RGB_MATRIX_DEFAULT_MODE # define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_REST_MODE #endif @@ -128,15 +129,15 @@ # define TAPPING_TERM 175 #endif -#ifndef SECURE_UNLOCK_SEQUENCE -# define SECURE_UNLOCK_SEQUENCE \ - { \ - {2, 1}, {2, 2}, {2, 3}, { \ - 2, 4 \ - } \ - } +#if (__has_include("../../../qmk_secrets/config.h") && !defined(NO_SECRETS)) +# include "../../../qmk_secrets/config.h" #endif #if defined(SPLIT_KEYBOARD) && defined(PROTOCOL_CHIBIOS) && !defined(USB_SUSPEND_WAKEUP_DELAY) # define USB_SUSPEND_WAKEUP_DELAY 200 #endif + +#ifdef XAP_ENABLE +# undef DYNAMIC_KEYMAP_LAYER_COUNT +# define DYNAMIC_KEYMAP_LAYER_COUNT 12 +#endif diff --git a/users/drashna/rgb/rgblight_config.h b/users/drashna/rgb/rgblight_config.h index bb2bc3b3ef..d5a6917f1c 100644 --- a/users/drashna/rgb/rgblight_config.h +++ b/users/drashna/rgb/rgblight_config.h @@ -3,6 +3,10 @@ #pragma once -# define RGBLIGHT_SLEEP -# define RGBLIGHT_EFFECT_TWINKLE_LIFE 250 -# define RGBLIGHT_EFFECT_TWINKLE_PROBABILITY 1 / 24 +#define RGBLIGHT_SLEEP +#define RGBLIGHT_EFFECT_TWINKLE_LIFE 250 +#define RGBLIGHT_EFFECT_TWINKLE_PROBABILITY 1 / 24 + +#ifdef RGBLIGHT_DEFAULT_MODE +# undef RGBLIGHT_DEFAULT_MODE +#endif diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk index 76bb5debe1..980d09576b 100644 --- a/users/drashna/rules.mk +++ b/users/drashna/rules.mk @@ -132,6 +132,9 @@ ifeq ($(strip $(AUTOCORRECTION_ENABLE)), yes) AUTOCORRECT_ENABLE = yes endif -ifeq ($(strip $(BOOTMAGIC_ENABLE)), yes) - SRC += bootmagic_better.c +CUSTOM_BOOTMAGIC_ENABLE ?= yes +ifeq ($(strip $(CUSTOM_BOOTMAGIC_ENABLE)), yes) + ifeq ($(strip $(BOOTMAGIC_ENABLE)), yes) + SRC += bootmagic_better.c + endif endif diff --git a/users/drashna/split/split_config.h b/users/drashna/split/split_config.h index 66c12392d9..21ff3829bb 100644 --- a/users/drashna/split/split_config.h +++ b/users/drashna/split/split_config.h @@ -7,6 +7,9 @@ #define SPLIT_LAYER_STATE_ENABLE #define SPLIT_LED_STATE_ENABLE #define SPLIT_MODS_ENABLE +#ifndef POINTING_DEVICE_ENABLE +# define SPLIT_WATCHDOG_ENABLE +#endif #ifdef WPM_ENABLE # define SPLIT_WPM_ENABLE #endif @@ -17,5 +20,5 @@ # define SELECT_SOFT_SERIAL_SPEED 1 #endif #ifdef CUSTOM_SPLIT_TRANSPORT_SYNC -# define SPLIT_TRANSACTION_IDS_USER RPC_ID_USER_STATE_SYNC, RPC_ID_USER_KEYMAP_SYNC, RPC_ID_USER_CONFIG_SYNC, RPC_ID_USER_WATCHDOG_SYNC, RPC_ID_USER_KEYLOG_STR +# define SPLIT_TRANSACTION_IDS_USER RPC_ID_USER_STATE_SYNC, RPC_ID_USER_KEYMAP_SYNC, RPC_ID_USER_CONFIG_SYNC, RPC_ID_USER_PLACEHOLDER, RPC_ID_USER_KEYLOG_STR #endif diff --git a/users/drashna/split/transport_sync.c b/users/drashna/split/transport_sync.c index 11c56849eb..0284627ed2 100644 --- a/users/drashna/split/transport_sync.c +++ b/users/drashna/split/transport_sync.c @@ -25,11 +25,6 @@ extern bool tap_toggling; extern bool swap_hands; #endif -#if defined(SPLIT_WATCHDOG_TIMEOUT) -static bool watchdog_ping_done = false; -static uint32_t watchdog_timer = 0; -#endif - extern userspace_config_t userspace_config; extern bool host_driver_disabled; @@ -54,12 +49,6 @@ void user_config_sync(uint8_t initiator2target_buffer_size, const void* initiato } } -#if defined(SPLIT_WATCHDOG_TIMEOUT) -void watchdog_handler(uint8_t in_buflen, const void* in_data, uint8_t out_buflen, void* out_data) { - watchdog_ping_done = true; -} -#endif - #ifdef CUSTOM_OLED_DRIVER # include "oled/oled_stuff.h" void keylogger_string_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) { @@ -77,14 +66,6 @@ void keyboard_post_init_transport_sync(void) { #ifdef CUSTOM_OLED_DRIVER transaction_register_rpc(RPC_ID_USER_KEYLOG_STR, keylogger_string_sync); #endif - -#if defined(SPLIT_WATCHDOG_TIMEOUT) -# if defined(PROTOCOL_LUFA) - wdt_disable(); -# endif - transaction_register_rpc(RPC_ID_USER_WATCHDOG_SYNC, watchdog_handler); - watchdog_timer = timer_read32(); -#endif } void user_transport_update(void) { @@ -103,7 +84,7 @@ void user_transport_update(void) { #endif #ifdef UNICODE_COMMON_ENABLE user_state.unicode_mode = unicode_config.input_mode; - user_state.unicode_typing_mode = typing_mode; + user_state.unicode_typing_mode = unicode_typing_mode; #endif #ifdef SWAP_HANDS_ENABLE user_state.swap_hands = swap_hands; @@ -117,7 +98,7 @@ void user_transport_update(void) { user_state.raw = transport_user_state; #ifdef UNICODE_COMMON_ENABLE unicode_config.input_mode = user_state.unicode_mode; - typing_mode = user_state.unicode_typing_mode; + unicode_typing_mode = user_state.unicode_typing_mode; #endif #if defined(OLED_ENABLE) && !defined(SPLIT_OLED_ENABLE) && defined(CUSTOM_OLED_DRIVER) is_oled_enabled = user_state.is_oled_enabled; @@ -219,28 +200,6 @@ void user_transport_sync(void) { } #endif } - -#if defined(SPLIT_WATCHDOG_TIMEOUT) - if (!watchdog_ping_done) { - if (is_keyboard_master()) { - if (timer_elapsed32(watchdog_timer) > 100) { - uint8_t any_data = 1; - if (transaction_rpc_send(RPC_ID_USER_WATCHDOG_SYNC, sizeof(any_data), &any_data)) { - watchdog_ping_done = true; // successful ping - } else { - dprint("Watchdog ping failed!\n"); - } - watchdog_timer = timer_read32(); - } - } else { - if (timer_elapsed32(watchdog_timer) > 3500) { - mcu_reset(); - while (1) { - } - } - } - } -#endif } void housekeeping_task_transport_sync(void) { |