From 4a87af0e9af046d5fc00d930476920c0c34a57a7 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Tue, 29 Nov 2022 11:43:42 -0800 Subject: [Keymap] Drashna updates for 0.19 (#19175) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- .../charybdis/3x5/keymaps/drashna/config.h | 119 +++++++++++---------- .../charybdis/3x5/keymaps/drashna/halconf.h | 14 +-- .../charybdis/3x5/keymaps/drashna/keymap.c | 12 ++- .../charybdis/3x5/keymaps/drashna/mcuconf.h | 30 +++--- .../charybdis/3x5/keymaps/drashna/rules.mk | 59 ++++++---- .../charybdis/4x6/keymaps/drashna/config.h | 108 +++++-------------- .../charybdis/4x6/keymaps/drashna/halconf.h | 26 ----- .../charybdis/4x6/keymaps/drashna/keymap.c | 26 +++-- .../charybdis/4x6/keymaps/drashna/mcuconf.h | 25 ++--- .../charybdis/4x6/keymaps/drashna/rules.mk | 90 ++++++++++------ .../dilemma/3x5_2/keymaps/drashna/halconf.h | 23 ++++ .../dilemma/3x5_2/keymaps/drashna/keymap.c | 18 +++- .../dilemma/3x5_2/keymaps/drashna/mcuconf.h | 26 +++++ 13 files changed, 304 insertions(+), 272 deletions(-) delete mode 100644 keyboards/bastardkb/charybdis/4x6/keymaps/drashna/halconf.h create mode 100644 keyboards/bastardkb/dilemma/3x5_2/keymaps/drashna/halconf.h create mode 100644 keyboards/bastardkb/dilemma/3x5_2/keymaps/drashna/mcuconf.h (limited to 'keyboards/bastardkb') 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 . #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 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 . - */ -#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 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 (@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 . + */ + +#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 (@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 . + */ + +#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 -- cgit v1.2.3