diff options
Diffstat (limited to 'keyboards/bastardkb/charybdis')
80 files changed, 2675 insertions, 276 deletions
diff --git a/keyboards/bastardkb/charybdis/3x5/3x5.c b/keyboards/bastardkb/charybdis/3x5/3x5.c index d896cf6923..7b10d322cd 100644 --- a/keyboards/bastardkb/charybdis/3x5/3x5.c +++ b/keyboards/bastardkb/charybdis/3x5/3x5.c @@ -33,6 +33,10 @@ * ╰────────────────────╯ ╰────────────────────╯ * 15 16 17 33 34 XX * ╰────────────╯ ╰────────────╯ + * + * Note: the LED config simulates 36 LEDs instead of the actual 35 to prevent + * confusion when testing LEDs during assembly when handedness is not set + * correctly. Those fake LEDs are bound to the physical top-left corner. */ led_config_t g_led_config = { { /* Key Matrix to LED index. */ @@ -61,7 +65,7 @@ led_config_t g_led_config = { { /* index=24 */ { 188, 42 }, { 188, 21 }, { 188, 0 }, /* index=27 */ { 170, 0 }, { 170, 21 }, { 170, 42 }, /* index=30 */ { 152, 0 }, { 152, 21 }, { 152, 42 }, - /* index=33 */ { 152, 64 }, { 134, 64 }, + /* index=33 */ { 134, 64 }, { 152, 64 }, { 0, 0 }, }, { /* LED index to flag. */ // Left split. @@ -77,7 +81,7 @@ led_config_t g_led_config = { { /* index=24 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, /* index=27 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, /* index=30 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, - /* index=33 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // Thumb cluster + /* index=33 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // Thumb cluster } }; #endif // clang-format on diff --git a/keyboards/bastardkb/charybdis/3x5/blackpill/config.h b/keyboards/bastardkb/charybdis/3x5/blackpill/config.h new file mode 100644 index 0000000000..ddd5e83318 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/blackpill/config.h @@ -0,0 +1,62 @@ +/* + * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) + * Copyright 2021 Stefan Kerkmann (@KarlK90) + * Copyright 2021 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 Publicw 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 + +/* Key matrix configuration. */ +#define MATRIX_ROW_PINS \ + { A2, B8, A8, B9 } +#define MATRIX_COL_PINS \ + { B1, B10, B3, B4, B5 } + +/* Handedness. */ +#define SPLIT_HAND_PIN A3 // High -> left, Low -> right. + +/* RGB settings. */ +#define RGB_DI_PIN A1 +#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 + +/* Serial configuration for split keyboard. */ +#define SERIAL_USART_TX_PIN A9 + +/* CRC. */ +#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 + +/* EEPROM config. */ +#define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A4 + +/* PMW3360 settings. */ +#define PMW33XX_CS_PIN B14 +#define PMW33XX_CS_DIVISOR 64 diff --git a/keyboards/bastardkb/charybdis/3x5/blackpill/halconf.h b/keyboards/bastardkb/charybdis/3x5/blackpill/halconf.h new file mode 100644 index 0000000000..a89dff0cd3 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/blackpill/halconf.h @@ -0,0 +1,29 @@ +/* + * Copyright 2020 Nick Brassel (tzarc) + * Copyright 2021 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_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 +//#define HAL_USE_GPT TRUE + +#include_next "halconf.h" diff --git a/keyboards/bastardkb/charybdis/3x5/blackpill/info.json b/keyboards/bastardkb/charybdis/3x5/blackpill/info.json new file mode 100644 index 0000000000..1e347df9b2 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/blackpill/info.json @@ -0,0 +1,6 @@ +{ + "keyboard_name": "Charybdis Nano (3x5) Blackpill", + "usb": { + "device_version": "1.0.0", + }, +} diff --git a/keyboards/bastardkb/charybdis/3x5/blackpill/mcuconf.h b/keyboards/bastardkb/charybdis/3x5/blackpill/mcuconf.h new file mode 100644 index 0000000000..1615d1bf46 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/blackpill/mcuconf.h @@ -0,0 +1,61 @@ +/* + * Copyright 2020 Nick Brassel (tzarc) + * Copyright 2021 Stefan Kerkmann (@KarlK90) + * Copyright 2021 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 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_PWM_USE_TIM2 +#define STM32_PWM_USE_TIM2 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_SPI1_RX_DMA_STREAM +#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0) +#undef STM32_SPI_SPI1_TX_DMA_STREAM +#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3) + +#undef STM32_SERIAL_USE_USART1 +#define STM32_SERIAL_USE_USART1 TRUE + +// #undef STM32_SERIAL_USE_USART2 +// #define STM32_SERIAL_USE_USART2 TRUE + +// #undef STM32_UART_USART2_RX_DMA_STREAM +// #define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) +// #undef STM32_UART_USART2_TX_DMA_STREAM +// #define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) + +#undef STM32_GPT_USE_TIM4 +#define STM32_GPT_USE_TIM4 TRUE + +#undef STM32_ST_USE_TIMER +#define STM32_ST_USE_TIMER 5 diff --git a/keyboards/bastardkb/charybdis/3x5/blackpill/readme.md b/keyboards/bastardkb/charybdis/3x5/blackpill/readme.md new file mode 100644 index 0000000000..7ef08798b8 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/blackpill/readme.md @@ -0,0 +1,3 @@ +# Charybdis Nano (3x5) BlackPill + +An ergonomic keyboard with integrated trackball, with BlackPill (STM32F411) mod. diff --git a/keyboards/bastardkb/charybdis/3x5/blackpill/rules.mk b/keyboards/bastardkb/charybdis/3x5/blackpill/rules.mk new file mode 100644 index 0000000000..0f732c2cbd --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/blackpill/rules.mk @@ -0,0 +1,41 @@ +# MCU name +MCU = STM32F411 +BOARD = BLACKPILL_STM32_F411 + +# Bootloader selection +BOOTLOADER = stm32-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output + +AUDIO_SUPPORTED = no # Audio is not supported +RGB_MATRIX_SUPPORTED = yes # RGB matrix is supported and enabled by default +RGBLIGHT_SUPPORTED = yes # RGB underglow is supported, but not enabled by default +RGB_MATRIX_ENABLE = yes # Enable keyboard RGB matrix functionality +RGB_MATRIX_DRIVER = WS2812 + +# Charybdis nano is a split 3x5 keyboard with a maximum of 3 thumb keys (2 on +# the trackball side). +SPLIT_KEYBOARD = yes +LAYOUTS = split_3x5_3 # Support community layout, in particular Manna-Harbour's Miryoku layout + +POINTING_DEVICE_ENABLE = yes # Enable trackball +POINTING_DEVICE_DRIVER = pmw3360 +MOUSE_SHARED_EP = no # Unify multiple HID interfaces into a single Endpoint +KEYBOARD_SHARED_EP = yes + +EEPROM_DRIVER = spi +WS2812_DRIVER = pwm +SERIAL_DRIVER = usart + +DEBOUNCE_TYPE = asym_eager_defer_pk diff --git a/keyboards/bastardkb/charybdis/3x5/config.h b/keyboards/bastardkb/charybdis/3x5/config.h index b12603fade..57634258be 100644 --- a/keyboards/bastardkb/charybdis/3x5/config.h +++ b/keyboards/bastardkb/charybdis/3x5/config.h @@ -18,58 +18,24 @@ #pragma once -#define VENDOR_ID 0xA8F8 -#define PRODUCT_ID 0x1832 -#define DEVICE_VER 0x0001 -#define MANUFACTURER Bastard Keyboards -#define PRODUCT Charybdis Nano +#include "config_common.h" /* Key matrix configuration. */ - -// Rows are doubled-up. -#define MATRIX_ROWS 8 +#define MATRIX_ROWS 8 // Rows are doubled-up. #define MATRIX_COLS 5 -// Wiring configuration for each half. -#define MATRIX_ROW_PINS \ - { B7, C6, D4, B5 } -#define MATRIX_COL_PINS \ - { C7, F0, D7, E6, B4 } - -#define MATRIX_ROW_PINS_RIGHT \ - { F0, C6, D4, B5 } -#define MATRIX_COL_PINS_RIGHT \ - { C7, B7, D7, E6, B4 } - #define DIODE_DIRECTION ROW2COL -/* Handedness. */ -#define MASTER_RIGHT - -/* Bootmagic Lite configuration. */ -#define BOOTMAGIC_LITE_ROW 0 -#define BOOTMAGIC_LITE_COLUMN 0 -#define BOOTMAGIC_LITE_ROW_RIGHT 4 -#define BOOTMAGIC_LITE_COLUMN_RIGHT 0 - -/* serial.c configuration (for split keyboard) */ -#define SOFT_SERIAL_PIN D2 - /* Set 0 if debouncing isn't needed. */ #define DEBOUNCE 5 -/* PMW33XX settings. */ -#define PMW33XX_CS_PIN B0 - -// Trackball angle adjustment. +/* Trackball angle adjustment. */ #define ROTATIONAL_TRANSFORM_ANGLE -25 /* RGB settings. */ - -#define RGB_DI_PIN D3 -#define RGBLED_NUM 35 +#define RGBLED_NUM 36 #define RGBLED_SPLIT \ - { 18, 17 } + { 18, 18 } /* RGB matrix support. */ #ifdef RGB_MATRIX_ENABLE diff --git a/keyboards/bastardkb/charybdis/3x5/info.json b/keyboards/bastardkb/charybdis/3x5/info.json index 03fb05664f..ece533944e 100644 --- a/keyboards/bastardkb/charybdis/3x5/info.json +++ b/keyboards/bastardkb/charybdis/3x5/info.json @@ -1,7 +1,8 @@ { - "keyboard_name": "Charybdis Nano", - "url": "https://www.bastardkb.com", - "maintainer": "Quentin Lebastard", + "url": "https://bastardkb.com/charybdis-nano", + "usb": { + "pid": "0x1832", + }, "layouts": { "LAYOUT_charybdis_3x5": { "layout": [ diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/bstiq/README.md b/keyboards/bastardkb/charybdis/3x5/keymaps/bstiq/README.md new file mode 100644 index 0000000000..5d9f7fcd5f --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/bstiq/README.md @@ -0,0 +1,3 @@ +# Charybdis (3x5) @bstiq keymap + +Inspired from Miryoku, using home-rows. diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/bstiq/config.h b/keyboards/bastardkb/charybdis/3x5/keymaps/bstiq/config.h new file mode 100644 index 0000000000..699a700063 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/bstiq/config.h @@ -0,0 +1,166 @@ +/** + * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com> + * Copyright 2021 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 + +#ifdef VIA_ENABLE +/* Via configuration. */ +# define DYNAMIC_KEYMAP_LAYER_COUNT 8 +#endif // VIA_ENABLE + +#ifndef __arm__ +/* Disable unused features. */ +# define NO_ACTION_ONESHOT +#endif // __arm__ + +/** + * Configure the global tapping term (default: 200ms). + * If you have a lot of accidental mod activations, crank up the tapping term. + * + * See docs.qmk.fm/using-qmk/software-features/tap_hold#tapping-term + */ +#ifndef TAPPING_TERM +# define TAPPING_TERM 160 +#endif // TAPPING_TERM + +/** + * Enable rapid switch from tap to hold. Disable auto-repeat when pressing key + * twice, except for one-shot keys. + * + * See docs.qmk.fm/using-qmk/software-features/tap_hold#tapping-force-hold + */ +#define TAPPING_FORCE_HOLD + +/* + * Tap-or-Hold decision modes. + * + * Note that the following flags behave differently when combined (ie. when 2 or + * more are enabled). + * + * See bit.ly/tap-or-hold for a visual explanation of the following tap-or-hold + * decision modes. + */ + +/** + * Faster tap-hold trigger. + * + * Without `PERMISSIVE_HOLD`, within `TAPPING_TERM`: + * Mod(a)🠗 e🠗 e🠕 Mod(a)🠕 ➞ ae + * With `PERMISSIVE_HOLD`, within `TAPPING_TERM`: + * Mod(a)🠗 e🠗 e🠕 Mod(a)🠕 ➞ Mod+e + * + * See docs.qmk.fm/using-qmk/software-features/tap_hold#permissive-hold + */ +#define PERMISSIVE_HOLD + +/** + * Prevent normal rollover on alphas from accidentally triggering mods. + * + * Ignores key presses that interrupt a mod-tap. Must-have for Home Row mod. + * + * Without `IGNORE_MOD_TAP_INTERRUPT`, within `TAPPING_TERM`: + * Mod(a)🠗 e🠗 Mod(a)🠕 e🠕 ➞ Mod+e + * With `IGNORE_MOD_TAP_INTERRUPT`, within `TAPPING_TERM`: + * Mod(a)🠗 e🠗 Mod(a)🠕 e🠕 ➞ ae + * + * See docs.qmk.fm/using-qmk/software-features/tap_hold#ignore-mod-tap-interrupt + */ +#define IGNORE_MOD_TAP_INTERRUPT + +/** Charybdis-specific features. */ + +#ifdef POINTING_DEVICE_ENABLE +// Automatically enable the pointer layer when moving the trackball. See also: +// - `CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS` +// - `CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD` +// #define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE + +// Flip horizontal direction for drag-scroll. +# define CHARYBDIS_DRAGSCROLL_REVERSE_X +// #define CHARYBDIS_DRAGSCROLL_REVERSE_Y +#endif // POINTING_DEVICE_ENABLE + +/** RGB Matrix. */ + +#ifdef RGB_MATRIX_ENABLE +# ifdef __arm__ +// Enable all animations on ARM boards since they have plenty of memory +// available for it. +# define ENABLE_RGB_MATRIX_ALPHAS_MODS +# define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN +# define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_BREATHING +# define ENABLE_RGB_MATRIX_BAND_SAT +# define ENABLE_RGB_MATRIX_BAND_VAL +# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +# define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT +# define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL +# define ENABLE_RGB_MATRIX_CYCLE_ALL +# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL +# define ENABLE_RGB_MATRIX_DUAL_BEACON +# define ENABLE_RGB_MATRIX_RAINBOW_BEACON +# define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS +# define ENABLE_RGB_MATRIX_RAINDROPS +# define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +# define ENABLE_RGB_MATRIX_HUE_BREATHING +# define ENABLE_RGB_MATRIX_HUE_PENDULUM +# define ENABLE_RGB_MATRIX_HUE_WAVE +# define ENABLE_RGB_MATRIX_TYPING_HEATMAP +# define ENABLE_RGB_MATRIX_DIGITAL_RAIN +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS +# define ENABLE_RGB_MATRIX_SPLASH +# define ENABLE_RGB_MATRIX_MULTISPLASH +# define ENABLE_RGB_MATRIX_SOLID_SPLASH +# define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH +# else +// Disable control of RGB matrix by keycodes (must use firmware implementation +// to control the feature). +# define RGB_MATRIX_DISABLE_KEYCODES +# endif + +// Limit maximum brightness to keep power consumption reasonable, and avoid +// disconnects. +# undef RGB_MATRIX_MAXIMUM_BRIGHTNESS +# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 64 + +// Rainbow swirl as startup mode. +# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT + +// Slow swirl at startup. +# define RGB_MATRIX_STARTUP_SPD 32 + +// Startup values. +# define RGB_MATRIX_STARTUP_HUE 0 +# define RGB_MATRIX_STARTUP_SAT 255 +# define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS +# define RGB_MATRIX_STARTUP_HSV RGB_MATRIX_STARTUP_HUE, RGB_MATRIX_STARTUP_SAT, RGB_MATRIX_STARTUP_VAL +#endif // RGB_MATRIX_ENABLE diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/bstiq/keymap.c b/keyboards/bastardkb/charybdis/3x5/keymaps/bstiq/keymap.c new file mode 100644 index 0000000000..ca67dd690c --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/bstiq/keymap.c @@ -0,0 +1,224 @@ +/** + * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com> + * Copyright 2021 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/>. + */ +#include QMK_KEYBOARD_H + +enum charybdis_keymap_bstiq_layers { + LAYER_BASE = 0, + LAYER_MBO, + LAYER_MEDIA, + LAYER_NAV, + LAYER_MOUSE, + LAYER_SYM, + LAYER_NUM, + LAYER_FUN, +}; + +// Automatically enable sniping when the mouse layer is on. +#define CHARYBDIS_AUTO_SNIPING_ON_LAYER LAYER_MOUSE + +#define BSP_NAV LT(LAYER_NAV, KC_BSPC) +#define ENT_MBO LT(LAYER_MBO, KC_ENT) +#define TAB_MED LT(LAYER_MEDIA, KC_TAB) +#define ESC_SYM LT(LAYER_SYM, KC_ESC) +#define SPC_NUM LT(LAYER_NUM, KC_SPC) +#define MOUSE(KC) LT(LAYER_MOUSE, KC) + +#define USR_RDO KC_AGAIN +#define USR_PST S(KC_INS) +#define USR_CPY C(KC_INS) +#define USR_CUT S(KC_DEL) +#define USR_UND KC_UNDO + +#define MS_L KC_MS_LEFT +#define MS_R KC_MS_RIGHT +#define MS_D KC_MS_DOWN +#define MS_U KC_MS_UP + +#define WH_L KC_MS_WH_LEFT +#define WH_R KC_MS_WH_RIGHT +#define WH_D KC_MS_WH_DOWN +#define WH_U KC_MS_WH_UP + +// clang-format off +/** Convenience macro. */ +#define _KC_LAYOUT_wrapper( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, \ + ...) \ + KC_##k00, KC_##k01, KC_##k02, KC_##k03, KC_##k04, KC_##k05, KC_##k06, KC_##k07, KC_##k08, KC_##k09, \ + KC_##k10, KC_##k11, KC_##k12, KC_##k13, KC_##k14, KC_##k15, KC_##k16, KC_##k17, KC_##k18, KC_##k19, \ + KC_##k20, KC_##k21, KC_##k22, KC_##k23, KC_##k24, KC_##k25, KC_##k26, KC_##k27, KC_##k28, KC_##k29, \ + __VA_ARGS__ +#define KC_LAYOUT_wrapper(...) _KC_LAYOUT_wrapper(__VA_ARGS__) + +/** Base layer with BÉPO layout. */ +#define LAYOUT_LAYER_BASE_BEPO KC_LAYOUT_wrapper( \ + B, Z, P, O, QUOT, DOT, V, D, L, J, \ + A, U, I, E, COMM, C, T, S, R, N, \ + W, Y, X, SLSH, K, M, Q, G, H, F, \ + BSP_NAV, ENT_MBO, TAB_MED, ESC_SYM, SPC_NUM) + +/** Convenience key shorthands. */ +#define U_NA KC_NO // Present but not available for use. +#define U_NU KC_NO // Available but not used. + +/** Convenience row shorthands. */ +#define __________________RESET_L__________________ QK_BOOT, U_NA, U_NA, U_NA, U_NA +#define __________________RESET_R__________________ U_NA, U_NA, U_NA, U_NA, QK_BOOT +#define ______________HOME_ROW_GASC_L______________ KC_LGUI, KC_LALT, KC_LSFT, KC_LCTL, U_NA +#define ______________HOME_ROW_ALGR_L______________ U_NA, KC_ALGR, U_NA, U_NA, U_NA +#define ______________HOME_ROW_GASC_R______________ U_NA, KC_LCTL, KC_LSFT, KC_LALT, KC_LGUI +#define ______________HOME_ROW_ALGR_R______________ U_NA, U_NA, U_NA, KC_ALGR, U_NA + +/** Layers. */ + +// Buttons. +#define LAYOUT_LAYER_MBO \ + __________________RESET_L__________________, USR_RDO, USR_PST, USR_CPY, USR_CUT, USR_UND, \ + ______________HOME_ROW_GASC_L______________, KC_CAPS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, \ + KC_BTN3, KC_ALGR, KC_BTN2, KC_BTN1, U_NA, KC_INS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, \ + U_NA, U_NA, U_NA, KC_ENT, KC_DEL + +// Media. +#define LAYOUT_LAYER_MEDIA \ + __________________RESET_L__________________, USR_RDO, USR_PST, USR_CPY, USR_CUT, USR_UND, \ + ______________HOME_ROW_GASC_L______________, U_NU, MS_L, MS_D, MS_U, MS_R, \ + ______________HOME_ROW_ALGR_L______________, U_NU, WH_L, WH_D, WH_U, WH_R, \ + U_NA, U_NA, U_NA, KC_BTN1, KC_BTN3 + +// Navigation. +#define LAYOUT_LAYER_NAV \ + __________________RESET_L__________________, RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, \ + ______________HOME_ROW_GASC_L______________, U_NU, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, \ + ______________HOME_ROW_ALGR_L______________, U_NU, U_NU, U_NU, U_NU, U_NU, \ + U_NA, U_NA, U_NA, KC_MSTP, KC_MPLY + +// Mouse. +#define LAYOUT_LAYER_MOUSE \ + S_D_MOD, USR_PST, USR_CPY, USR_CUT, USR_UND, USR_RDO, USR_PST, USR_CPY, USR_CUT, USR_UND, \ + DPI_MOD, DRGSCRL, KC_LSFT, KC_LCTL, _______, U_NU, MS_L, MS_D, MS_U, MS_R, \ + USR_RDO, USR_PST, USR_CPY, USR_CUT, USR_UND, U_NU, WH_L, WH_D, WH_U, WH_R, \ + KC_BTN2, KC_BTN1, KC_BTN3, KC_BTN1, KC_BTN3 + +// Symbols. +#define LAYOUT_LAYER_SYM \ + KC_LCBR, KC_AMPR, KC_ASTR, KC_LPRN, KC_RCBR, __________________RESET_R__________________, \ + KC_COLN, KC_DLR, KC_PERC, KC_CIRC, KC_PLUS, ______________HOME_ROW_GASC_R______________, \ + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_PIPE, ______________HOME_ROW_ALGR_R______________, \ + KC_LPRN, KC_RPRN, KC_UNDS, U_NA, U_NA + +// Numerals. +#define LAYOUT_LAYER_NUM \ + KC_LBRC, KC_7, KC_8, KC_9, KC_RBRC, __________________RESET_R__________________, \ + KC_SCLN, KC_4, KC_5, KC_6, KC_EQL, ______________HOME_ROW_GASC_R______________, \ + KC_GRV, KC_1, KC_2, KC_3, KC_BSLS, ______________HOME_ROW_ALGR_R______________, \ + KC_DOT, KC_0, KC_MINS, U_NA, U_NA + +// Function keys. +#define LAYOUT_LAYER_FUN \ + KC_F12, KC_F7, KC_F8, KC_F9, KC_PSCR, __________________RESET_R__________________, \ + KC_F11, KC_F4, KC_F5, KC_F6, KC_SLCK, ______________HOME_ROW_GASC_R______________, \ + KC_F10, KC_F1, KC_F2, KC_F3, KC_PAUS, ______________HOME_ROW_ALGR_R______________,\ + KC_APP, KC_SPC, KC_TAB, U_NA, U_NA + +/** + * Add Home Row mod to a layout. + * + * Expects a 10-key per row layout. Adds support for GASC (Gui, Alt, Shift, Ctl) + * home row. The layout passed in parameter must contain at least 20 keycodes. + * + * This is meant to be used with `LAYOUT_LAYER_BASE_BEPO` defined above, eg.: + * + * HOME_ROW_MOD_GASC(LAYOUT_LAYER_BASE_BEPO) + */ +#define _HOME_ROW_MOD_GASC( \ + L00, L01, L02, L03, L04, R05, R06, R07, R08, R09, \ + L10, L11, L12, L13, L14, R15, R16, R17, R18, R19, \ + ...) \ + L00, L01, L02, L03, L04, \ + R05, R06, R07, R08, R09, \ + LGUI_T(L10), LALT_T(L11), LSFT_T(L12), LCTL_T(L13), L14, \ + R15, RCTL_T(R16), RSFT_T(R17), LALT_T(R18), RGUI_T(R19), \ + __VA_ARGS__ +#define HOME_ROW_MOD_GASC(...) _HOME_ROW_MOD_GASC(__VA_ARGS__) + +/** + * Add mouse layer keys to a layout. + * + * Expects a 10-key per row layout. The layout passed in parameter must contain + * at least 30 keycodes. + * + * This is meant to be used with `LAYOUT_LAYER_BASE_BEPO` defined above, eg.: + * + * MOUSE_MOD(LAYOUT_LAYER_BASE_BEPO) + */ +#define _MOUSE_MOD( \ + L00, L01, L02, L03, L04, R05, R06, R07, R08, R09, \ + L10, L11, L12, L13, L14, R15, R16, R17, R18, R19, \ + L20, L21, L22, L23, L24, R25, R26, R27, R28, R29, \ + ...) \ + L00, L01, L02, L03, L04, \ + R05, R06, R07, R08, R09, \ + L10, L11, L12, L13, L14, \ + R15, R16, R17, R18, R19, \ + MOUSE(L20), L21, L22, L23, L24, \ + R25, R26, R27, R28, MOUSE(R29), \ + __VA_ARGS__ +#define MOUSE_MOD(...) _MOUSE_MOD(__VA_ARGS__) + +#define LAYOUT_wrapper(...) LAYOUT_charybdis_3x5(__VA_ARGS__) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [LAYER_BASE] = LAYOUT_wrapper( + MOUSE_MOD(HOME_ROW_MOD_GASC(LAYOUT_LAYER_BASE_BEPO)) + ), + [LAYER_MBO] = LAYOUT_wrapper(LAYOUT_LAYER_MBO), + [LAYER_MEDIA] = LAYOUT_wrapper(LAYOUT_LAYER_MEDIA), + [LAYER_NAV] = LAYOUT_wrapper(LAYOUT_LAYER_NAV), + [LAYER_MOUSE] = LAYOUT_wrapper(LAYOUT_LAYER_MOUSE), + [LAYER_SYM] = LAYOUT_wrapper(LAYOUT_LAYER_SYM), + [LAYER_NUM] = LAYOUT_wrapper(LAYOUT_LAYER_NUM), + [LAYER_FUN] = LAYOUT_wrapper(LAYOUT_LAYER_FUN), +}; +// clang-format on + +#if defined(POINTING_DEVICE_ENABLE) && defined(CHARYBDIS_AUTO_SNIPING_ON_LAYER) +layer_state_t layer_state_set_kb(layer_state_t state) { + state = layer_state_set_user(state); + charybdis_set_pointer_sniping_enabled(layer_state_cmp(state, CHARYBDIS_AUTO_SNIPING_ON_LAYER)); + return state; +} +#endif // POINTING_DEVICE_ENABLE && CHARYBDIS_AUTO_SNIPING_ON_LAYER + +#ifdef RGB_MATRIX_ENABLE +// Forward-declare this helper function since it is defined in rgb_matrix.c. +void rgb_matrix_update_pwm_buffers(void); +#endif + +void shutdown_user(void) { +#ifdef RGBLIGHT_ENABLE + rgblight_enable_noeeprom(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); + rgblight_setrgb_red(); +#endif // RGBLIGHT_ENABLE +#ifdef RGB_MATRIX_ENABLE + rgb_matrix_set_color_all(RGB_RED); + rgb_matrix_update_pwm_buffers(); +#endif // RGB_MATRIX_ENABLE +} diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/bstiq/rules.mk b/keyboards/bastardkb/charybdis/3x5/keymaps/bstiq/rules.mk new file mode 100644 index 0000000000..5d91064607 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/bstiq/rules.mk @@ -0,0 +1,10 @@ +ifeq ($(MCU),atmega32u4) + # Space saving settings. + TAP_DANCE_ENABLE = no + COMBO_ENABLE = no + QMK_SETTINGS = no +else ifeq ($(MCU),STM32F411) + EEPROM_DRIVER = vendor +endif + +VIA_ENABLE = yes diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/default/keymap.c b/keyboards/bastardkb/charybdis/3x5/keymaps/default/keymap.c index cb578aa8d6..148f026740 100644 --- a/keyboards/bastardkb/charybdis/3x5/keymaps/default/keymap.c +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/default/keymap.c @@ -49,7 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // ├─────────────────────────────────────────────┤ ├─────────────────────────────────────────────┤ KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, KC_PPLS, KC_4, KC_5, KC_6, KC_PMNS, // ├─────────────────────────────────────────────┤ ├─────────────────────────────────────────────┤ - XXXXXXX, XXXXXXX, XXXXXXX, EEP_RST, QK_BOOT, KC_PAST, KC_1, KC_2, KC_3, KC_PSLS, + XXXXXXX, XXXXXXX, XXXXXXX, EEP_RST, QK_BOOT, KC_PAST, KC_1, KC_2, KC_3, KC_PSLS, // ╰─────────────────────────────────────────────┤ ├─────────────────────────────────────────────╯ XXXXXXX, XXXXXXX, _______, XXXXXXX, _______ // ╰───────────────────────────╯ ╰──────────────────╯ @@ -61,7 +61,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // ├─────────────────────────────────────────────┤ ├─────────────────────────────────────────────┤ KC_LEFT, KC_UP, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, KC_RSFT, KC_RCTL, KC_RALT, KC_RGUI, // ├─────────────────────────────────────────────┤ ├─────────────────────────────────────────────┤ - KC_HOME, KC_PGUP, KC_PGDN, KC_END, XXXXXXX, QK_BOOT, EEP_RST, XXXXXXX, XXXXXXX, XXXXXXX, + KC_HOME, KC_PGUP, KC_PGDN, KC_END, XXXXXXX, QK_BOOT, EEP_RST, XXXXXXX, XXXXXXX, XXXXXXX, // ╰─────────────────────────────────────────────┤ ├─────────────────────────────────────────────╯ _______, _______, XXXXXXX, _______, XXXXXXX // ╰───────────────────────────╯ ╰──────────────────╯ diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/via/config.h b/keyboards/bastardkb/charybdis/3x5/keymaps/via/config.h index f515d85334..d20131e9cf 100644 --- a/keyboards/bastardkb/charybdis/3x5/keymaps/via/config.h +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/via/config.h @@ -19,7 +19,7 @@ #ifdef VIA_ENABLE /* VIA configuration. */ # define DYNAMIC_KEYMAP_LAYER_COUNT 7 -#endif // VIA_ENABLE +#endif // VIA_ENABLE /* Disable unused features. */ #define NO_ACTION_ONESHOT @@ -33,7 +33,7 @@ * See docs.qmk.fm/using-qmk/software-features/tap_hold#tapping-term */ # define TAPPING_TERM 200 -#endif // TAPPING_TERM +#endif // TAPPING_TERM /** * \brief Enable rapid switch from tap to hold. @@ -84,16 +84,11 @@ /* Charybdis-specific features. */ #ifdef POINTING_DEVICE_ENABLE -// Enable pointer acceleration, which increases the speed by ~2x for large -// displacement, while maintaining 1x speed for slow movements. See also: -// - `CHARYBDIS_POINTER_ACCELERATION_FACTOR` -# define CHARYBDIS_POINTER_ACCELERATION_ENABLE - // Automatically enable the pointer layer when moving the trackball. See also: // - `CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS` // - `CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD` // #define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE -#endif // POINTING_DEVICE_ENABLE +#endif // POINTING_DEVICE_ENABLE /* RGB Matrix. */ @@ -115,4 +110,4 @@ # define RGB_MATRIX_STARTUP_SAT 255 # define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS # define RGB_MATRIX_STARTUP_HSV RGB_MATRIX_STARTUP_HUE, RGB_MATRIX_STARTUP_SAT, RGB_MATRIX_STARTUP_VAL -#endif // RGB_MATRIX_ENABLE +#endif // RGB_MATRIX_ENABLE diff --git a/keyboards/bastardkb/charybdis/3x5/keymaps/via/keymap.c b/keyboards/bastardkb/charybdis/3x5/keymaps/via/keymap.c index dc02ed34c6..b54c58cf0c 100644 --- a/keyboards/bastardkb/charybdis/3x5/keymaps/via/keymap.c +++ b/keyboards/bastardkb/charybdis/3x5/keymaps/via/keymap.c @@ -18,7 +18,7 @@ #ifdef CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE # include "timer.h" -#endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE +#endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE enum charybdis_keymap_layers { LAYER_BASE = 0, @@ -38,12 +38,12 @@ static uint16_t auto_pointer_layer_timer = 0; # ifndef CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS # define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS 1000 -# endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS +# endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS # ifndef CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD # define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD 8 -# endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD -#endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE +# endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD +#endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE #define ESC_MED LT(LAYER_MEDIA, KC_ESC) #define SPC_NAV LT(LAYER_NAVIGATION, KC_SPC) @@ -52,6 +52,13 @@ static uint16_t auto_pointer_layer_timer = 0; #define BSP_NUM LT(LAYER_NUMERAL, KC_BSPC) #define _L_PTR(KC) LT(LAYER_POINTER, KC) +#ifndef POINTING_DEVICE_ENABLE +# define DRGSCRL KC_NO +# define DPI_MOD KC_NO +# define S_D_MOD KC_NO +# define SNIPING KC_NO +#endif // !POINTING_DEVICE_ENABLE + // clang-format off /** \brief QWERTY layout (3 rows, 10 columns). */ #define LAYOUT_LAYER_BASE \ @@ -98,14 +105,14 @@ static uint16_t auto_pointer_layer_timer = 0; #define LAYOUT_LAYER_MEDIA \ XXXXXXX,RGB_RMOD, RGB_TOG, RGB_MOD, XXXXXXX, XXXXXXX,RGB_RMOD, RGB_TOG, RGB_MOD, XXXXXXX, \ KC_MPRV, KC_VOLD, KC_MUTE, KC_VOLU, KC_MNXT, KC_MPRV, KC_VOLD, KC_MUTE, KC_VOLU, KC_MNXT, \ - XXXXXXX, XXXXXXX, XXXXXXX, EEP_RST, QK_BOOT, QK_BOOT, EEP_RST, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, EEP_RST, QK_BOOT, QK_BOOT, EEP_RST, XXXXXXX, XXXXXXX, XXXXXXX, \ _______, KC_MPLY, KC_MSTP, KC_MSTP, KC_MPLY /** \brief Mouse emulation and pointer functions. */ #define LAYOUT_LAYER_POINTER \ XXXXXXX, XXXXXXX, XXXXXXX, DPI_MOD, S_D_MOD, S_D_MOD, DPI_MOD, XXXXXXX, XXXXXXX, XXXXXXX, \ ______________HOME_ROW_GACS_L______________, ______________HOME_ROW_GACS_R______________, \ - _______, DRGSCRL, SNIPING, EEP_RST, QK_BOOT, QK_BOOT, EEP_RST, SNIPING, DRGSCRL, _______, \ + _______, DRGSCRL, SNIPING, EEP_RST, QK_BOOT, QK_BOOT, EEP_RST, SNIPING, DRGSCRL, _______, \ KC_BTN2, KC_BTN1, KC_BTN3, KC_BTN3, KC_BTN1 /** @@ -217,36 +224,35 @@ report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { # ifdef RGB_MATRIX_ENABLE rgb_matrix_mode_noeeprom(RGB_MATRIX_NONE); rgb_matrix_sethsv_noeeprom(HSV_GREEN); -# endif // RGB_MATRIX_ENABLE +# endif // RGB_MATRIX_ENABLE } auto_pointer_layer_timer = timer_read(); } return mouse_report; } -void matrix_scan_kb(void) { +void matrix_scan_user(void) { if (auto_pointer_layer_timer != 0 && TIMER_DIFF_16(timer_read(), auto_pointer_layer_timer) >= CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS) { auto_pointer_layer_timer = 0; layer_off(LAYER_POINTER); # ifdef RGB_MATRIX_ENABLE rgb_matrix_mode_noeeprom(RGB_MATRIX_STARTUP_MODE); -# endif // RGB_MATRIX_ENABLE +# endif // RGB_MATRIX_ENABLE } - matrix_scan_user(); } -# endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE +# endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE # ifdef CHARYBDIS_AUTO_SNIPING_ON_LAYER -layer_state_t layer_state_set_kb(layer_state_t state) { - state = layer_state_set_user(state); +layer_state_t layer_state_set_user(layer_state_t state) { charybdis_set_pointer_sniping_enabled(layer_state_cmp(state, CHARYBDIS_AUTO_SNIPING_ON_LAYER)); return state; } -# endif // CHARYBDIS_AUTO_SNIPING_ON_LAYER -#endif // POINTING_DEVICE_ENABLE +# endif // CHARYBDIS_AUTO_SNIPING_ON_LAYER +#endif // POINTING_DEVICE_ENABLE #ifdef RGB_MATRIX_ENABLE -// Forward-declare this helper function since it is defined in rgb_matrix.c. +// Forward-declare this helper function since it is defined in +// rgb_matrix.c. void rgb_matrix_update_pwm_buffers(void); #endif @@ -255,9 +261,9 @@ void shutdown_user(void) { rgblight_enable_noeeprom(); rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); rgblight_setrgb_red(); -#endif // RGBLIGHT_ENABLE +#endif // RGBLIGHT_ENABLE #ifdef RGB_MATRIX_ENABLE rgb_matrix_set_color_all(RGB_RED); rgb_matrix_update_pwm_buffers(); -#endif // RGB_MATRIX_ENABLE +#endif // RGB_MATRIX_ENABLE } diff --git a/keyboards/bastardkb/charybdis/3x5/v1/elitec/config.h b/keyboards/bastardkb/charybdis/3x5/v1/elitec/config.h new file mode 100644 index 0000000000..3e3d95174c --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/v1/elitec/config.h @@ -0,0 +1,42 @@ +/* + * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) + * Copyright 2021 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 + +/* Key matrix configuration. */ +#define MATRIX_ROW_PINS \ + { B7, C6, D4, B5 } +#define MATRIX_COL_PINS \ + { C7, F0, D7, E6, B4 } + +#define MATRIX_ROW_PINS_RIGHT \ + { F0, C6, D4, B5 } +#define MATRIX_COL_PINS_RIGHT \ + { C7, B7, D7, E6, B4 } + +/* Handedness. */ +#define MASTER_RIGHT + +/* serial.c configuration (for split keyboard). */ +#define SOFT_SERIAL_PIN D2 + +/* RGB settings. */ +#define RGB_DI_PIN D3 + +/* PMW3360 settings. */ +#define PMW33XX_CS_PIN B0 diff --git a/keyboards/bastardkb/charybdis/3x5/v1/elitec/info.json b/keyboards/bastardkb/charybdis/3x5/v1/elitec/info.json new file mode 100644 index 0000000000..9071212f33 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/v1/elitec/info.json @@ -0,0 +1,6 @@ +{ + "keyboard_name": "Charybdis Nano (3x5) Elite-C", + "usb": { + "device_version": "1.0.0", + }, +} diff --git a/keyboards/bastardkb/charybdis/3x5/rules.mk b/keyboards/bastardkb/charybdis/3x5/v1/elitec/rules.mk index c5f3f0fb8c..22bd22652a 100644 --- a/keyboards/bastardkb/charybdis/3x5/rules.mk +++ b/keyboards/bastardkb/charybdis/3x5/v1/elitec/rules.mk @@ -23,10 +23,6 @@ RGBLIGHT_SUPPORTED = yes # RGB underglow is supported, but not enabled by def RGB_MATRIX_ENABLE = yes # Enable keyboard RGB matrix functionality RGB_MATRIX_DRIVER = WS2812 -# Enable link-time optimization by default. The Charybdis packs a lot of -# features (RGB, Via, trackball) in a small atmega32u4 package. -LTO_ENABLE = yes - # Charybdis nano is a split 3x5 keyboard with a maximum of 3 thumb keys (2 on # the trackball side). SPLIT_KEYBOARD = yes @@ -34,5 +30,8 @@ LAYOUTS = split_3x5_3 # Support community layout, in particular Manna-Harbour's POINTING_DEVICE_ENABLE = yes # Enable trackball POINTING_DEVICE_DRIVER = pmw3360 -# https://qmk.fm/changes/2018-11-16-use-a-single-endpoint-for-hid-reports MOUSE_SHARED_EP = no # Unify multiple HID interfaces into a single Endpoint + +# Enable link-time optimization by default. The Charybdis packs a lot of +# features (RGB, Via, trackball) in a small atmega32u4 package. +LTO_ENABLE = yes diff --git a/keyboards/bastardkb/charybdis/3x5/v2/elitec/config.h b/keyboards/bastardkb/charybdis/3x5/v2/elitec/config.h new file mode 100644 index 0000000000..5c11fa3145 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/v2/elitec/config.h @@ -0,0 +1,36 @@ +/* + * 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 + +/* Key matrix configuration. */ +#define MATRIX_ROW_PINS \ + { F7, C6, D4, B5 } +#define MATRIX_COL_PINS \ + { F5, B6, D7, E6, B4 } + +/* Handedness. */ +#define MASTER_RIGHT + +/* serial.c configuration (for split keyboard). */ +#define SOFT_SERIAL_PIN D2 + +/* RGB settings. */ +#define RGB_DI_PIN D3 + +/* PMW3360 settings. */ +#define PMW33XX_CS_PIN F0 diff --git a/keyboards/bastardkb/charybdis/3x5/v2/elitec/info.json b/keyboards/bastardkb/charybdis/3x5/v2/elitec/info.json new file mode 100644 index 0000000000..7c90e5d5a3 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/v2/elitec/info.json @@ -0,0 +1,6 @@ +{ + "keyboard_name": "Charybdis Nano (3x5) Elite-C", + "usb": { + "device_version": "2.0.0", + }, +} diff --git a/keyboards/bastardkb/charybdis/3x5/v2/elitec/rules.mk b/keyboards/bastardkb/charybdis/3x5/v2/elitec/rules.mk new file mode 100644 index 0000000000..22bd22652a --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/v2/elitec/rules.mk @@ -0,0 +1,37 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output + +AUDIO_SUPPORTED = no # Audio is not supported +RGB_MATRIX_SUPPORTED = yes # RGB matrix is supported and enabled by default +RGBLIGHT_SUPPORTED = yes # RGB underglow is supported, but not enabled by default +RGB_MATRIX_ENABLE = yes # Enable keyboard RGB matrix functionality +RGB_MATRIX_DRIVER = WS2812 + +# Charybdis nano is a split 3x5 keyboard with a maximum of 3 thumb keys (2 on +# the trackball side). +SPLIT_KEYBOARD = yes +LAYOUTS = split_3x5_3 # Support community layout, in particular Manna-Harbour's Miryoku layout + +POINTING_DEVICE_ENABLE = yes # Enable trackball +POINTING_DEVICE_DRIVER = pmw3360 +MOUSE_SHARED_EP = no # Unify multiple HID interfaces into a single Endpoint + +# Enable link-time optimization by default. The Charybdis packs a lot of +# features (RGB, Via, trackball) in a small atmega32u4 package. +LTO_ENABLE = yes diff --git a/keyboards/bastardkb/charybdis/3x5/v2/splinky/config.h b/keyboards/bastardkb/charybdis/3x5/v2/splinky/config.h new file mode 100644 index 0000000000..2929d3dd1e --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/v2/splinky/config.h @@ -0,0 +1,50 @@ +/* + * 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 + +/* Key matrix configuration. */ +#define MATRIX_ROW_PINS \ + { GP26, GP5, GP4, GP9 } +#define MATRIX_COL_PINS \ + { GP28, GP15, GP6, GP7, GP8 } + +/* Handedness. */ +#define MASTER_RIGHT + +// To use the handedness pin, resistors need to be installed on the adapter PCB. +// If so, uncomment the following code, and undefine MASTER_RIGHT above. +// #define SPLIT_HAND_PIN GP13 +// #define SPLIT_HAND_PIN_LOW_IS_LEFT // High -> right, Low -> left. + +/* serial.c configuration (for split keyboard). */ +#define SOFT_SERIAL_PIN GP1 + +/* RGB settings. */ +#define RGB_DI_PIN GP0 + +/* SPI & PMW3360 settings. */ +#define SPI_DRIVER SPID0 +#define SPI_SCK_PIN GP18 +#define SPI_MOSI_PIN GP19 +#define SPI_MISO_PIN GP20 +#define PMW33XX_CS_PIN GP14 + +/* Reset. */ +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP17 +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 1000U diff --git a/keyboards/bastardkb/charybdis/3x5/v2/splinky/info.json b/keyboards/bastardkb/charybdis/3x5/v2/splinky/info.json new file mode 100644 index 0000000000..1aa1e8811d --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/v2/splinky/info.json @@ -0,0 +1,6 @@ +{ + "keyboard_name": "Charybdis Nano (3x5) Splinky", + "usb": { + "device_version": "2.0.0", + }, +} diff --git a/keyboards/bastardkb/charybdis/3x5/v2/splinky/mcuconf.h b/keyboards/bastardkb/charybdis/3x5/v2/splinky/mcuconf.h new file mode 100644 index 0000000000..0fdd67c3a2 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/v2/splinky/mcuconf.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 + +#include_next "mcuconf.h" + +#undef RP_SPI_USE_SPI0 +#define RP_SPI_USE_SPI0 TRUE diff --git a/keyboards/bastardkb/charybdis/3x5/v2/splinky/rules.mk b/keyboards/bastardkb/charybdis/3x5/v2/splinky/rules.mk new file mode 100644 index 0000000000..21a9506077 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x5/v2/splinky/rules.mk @@ -0,0 +1,37 @@ +# MCU name +MCU = RP2040 + +# Bootloader selection +BOOTLOADER = rp2040 + +# RP2040-specific options +ALLOW_WARNINGS = yes +PICO_INTRINSICS_ENABLED = no # ATM Unsupported by ChibiOS. + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output + +AUDIO_SUPPORTED = no # Audio is not supported +RGB_MATRIX_SUPPORTED = yes # RGB matrix is supported and enabled by default +RGBLIGHT_SUPPORTED = yes # RGB underglow is supported, but not enabled by default +RGB_MATRIX_ENABLE = yes # Enable keyboard RGB matrix functionality +RGB_MATRIX_DRIVER = WS2812 + +SPLIT_KEYBOARD = yes +LAYOUTS = split_3x5_3 + +POINTING_DEVICE_ENABLE = yes # Enable trackball +POINTING_DEVICE_DRIVER = pmw3360 + +SERIAL_DRIVER = vendor +WS2812_DRIVER = vendor diff --git a/keyboards/bastardkb/charybdis/3x6/3x6.c b/keyboards/bastardkb/charybdis/3x6/3x6.c new file mode 100644 index 0000000000..beb04efc0b --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/3x6.c @@ -0,0 +1,91 @@ +/* + * 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 Publicw License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "3x6.h" + +// clang-format off +#ifdef RGB_MATRIX_ENABLE +/** + * \brief LEDs index. + * + # 0,0 14 28 42 56 70 84 98 126 140 154 168 182 196 210 224,0 + # 0,0 15 30 45 60 75 90 105 119 134 149 164 179 194 209 224,0 + * ╭────────────────────────╮ ╭────────────────────────╮ + * 0 5 6 11 12 15 36 33 32 27 26 21 + * ├────────────────────────┤ ├────────────────────────┤ + * 1 4 7 10 13 16 37 34 31 28 25 22 + * ├────────────────────────┤ ├────────────────────────┤ + * 2 3 8 9 14 17 38 35 30 29 24 23 + * ╰────────────────────────╯ ╰────────────────────────╯ + * 18 19 20 39 40 XX + * ╰────────────╯ ╰────────────╯ + * + * Note: the LED config simulates 42 LEDs instead of the actual 41 to prevent + * confusion when testing LEDs during assembly when handedness is not set + * correctly. Those fake LEDs are bound to the physical top-left corner. + */ +led_config_t g_led_config = { { + /* Key Matrix to LED index. */ + // Left split. + { 0, 5, 6, 11, 12, 15 }, // Top row + { 1, 4, 7, 10, 13, 16 }, // Middle row + { 2, 3, 8, 9, 14, 17 }, // Bottom row + { NO_LED, 20, NO_LED, 18, 19, NO_LED }, // Thumb cluster + // Right split. + { 21, 26, 27, 32, 33, 36 }, // Top row + { 22, 25, 28, 31, 34, 37 }, // Middle row + { 23, 24, 29, 30, 35, 38 }, // Bottom row + { NO_LED, 41, NO_LED, 39, 40, NO_LED }, // Thumb cluster +}, { + /* LED index to physical position. */ + // Left split. + /* index=0 */ { 0, 0 }, { 0, 21 }, { 0, 42 }, // col 1 (left most) + /* index=3 */ { 15, 42 }, { 15, 21 }, { 15, 0 }, // col 2 + /* index=6 */ { 30, 0 }, { 30, 21 }, { 30, 42 }, + /* index=9 */ { 45, 42 }, { 45, 21 }, { 45, 0 }, + /* index=12 */ { 60, 0 }, { 60, 21 }, { 60, 42 }, + /* index=15 */ { 75, 0 }, { 75, 21 }, { 75, 42 }, + /* index=18 */ { 75, 64 }, { 90, 64 }, { 105, 64 }, // Thumb cluster + // Right split. + /* index=21 */ { 224, 0 }, { 224, 21 }, { 224, 42 }, // col 12 (right most) + /* index=24 */ { 209, 42 }, { 209, 21 }, { 209, 0 }, // col 10 + /* index=27 */ { 194, 0 }, { 194, 21 }, { 194, 42 }, + /* index=30 */ { 179, 42 }, { 179, 21 }, { 179, 0 }, + /* index=33 */ { 164, 0 }, { 164, 21 }, { 164, 42 }, + /* index=36 */ { 149, 0 }, { 149, 21 }, { 149, 42 }, + /* index=39 */ { 119, 64 }, { 134, 64 }, { 0, 0 }, // Thumb cluster +}, { + /* LED index to flag. */ + // Left split. + /* index=0 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 1 + /* index=3 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 2 + /* index=6 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, + /* index=9 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, + /* index=12 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, + /* index=15 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, + /* index=18 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // Thumb cluster + // Right split. + /* index=21 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 10 + /* index=24 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 9 + /* index=27 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, + /* index=30 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, + /* index=33 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, + /* index=36 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, + /* index=39 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // Thumb cluster +} }; +#endif +// clang-format on diff --git a/keyboards/bastardkb/charybdis/3x6/3x6.h b/keyboards/bastardkb/charybdis/3x6/3x6.h new file mode 100644 index 0000000000..bf5de31036 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/3x6.h @@ -0,0 +1,62 @@ +/* + * 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 "charybdis.h" + +// clang-format off +#define LAYOUT_charybdis_3x6( \ + k00, k01, k02, k03, k04, k05, k45, k44, k43, k42, k41, k40, \ + k10, k11, k12, k13, k14, k15, k55, k54, k53, k52, k51, k50, \ + k20, k21, k22, k23, k24, k25, k65, k64, k63, k62, k61, k60, \ + k33, k34, k31, k71, k73 \ +) \ +{ \ + { k00, k01, k02, k03, k04, k05 }, \ + { k10, k11, k12, k13, k14, k15 }, \ + { k20, k21, k22, k23, k24, k25 }, \ + { KC_NO, k31, KC_NO, k33, k34, KC_NO }, \ + { k40, k41, k42, k43, k44, k45 }, \ + { k50, k51, k52, k53, k54, k55 }, \ + { k60, k61, k62, k63, k64, k65 }, \ + { KC_NO, k71, KC_NO, k73, KC_NO, KC_NO }, \ +} + +/** + * \brief Compatibility layout with the split_3x5_6 community layout. + * + * This effectively renders the Charbdis Nano compatible with existing layout + * implementations relying on the `split_3x6_3` layout. + */ +#define LAYOUT_split_3x6_3( \ + k00, k01, k02, k03, k04, k05, k45, k44, k43, k42, k41, k40, \ + k10, k11, k12, k13, k14, k15, k55, k54, k53, k52, k51, k50, \ + k20, k21, k22, k23, k24, k25, k65, k64, k63, k62, k61, k60, \ + k33, k34, k31, k71, k73, ___ \ +) \ +{ \ + { k00, k01, k02, k03, k04, k05 }, \ + { k10, k11, k12, k13, k14, k15 }, \ + { k20, k21, k22, k23, k24, k25 }, \ + { KC_NO, k31, KC_NO, k33, k34, KC_NO }, \ + { k40, k41, k42, k43, k44, k45 }, \ + { k50, k51, k52, k53, k54, k55 }, \ + { k60, k61, k62, k63, k64, k65 }, \ + { KC_NO, k71, KC_NO, k73, KC_NO, KC_NO }, \ +} +// clang-format on diff --git a/keyboards/bastardkb/charybdis/3x6/blackpill/config.h b/keyboards/bastardkb/charybdis/3x6/blackpill/config.h new file mode 100644 index 0000000000..1b90a3076b --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/blackpill/config.h @@ -0,0 +1,60 @@ +/* + * 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 Publicw 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 + +/* Key matrix configuration. */ +#define MATRIX_ROW_PINS \ + { A2, B8, A8, B9 } +#define MATRIX_COL_PINS \ + { B0, B1, B10, B3, B4, B5 } + +/* Handedness. */ +#define SPLIT_HAND_PIN A3 // High -> left, Low -> right. + +/* RGB settings. */ +#define RGB_DI_PIN A1 +#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 + +/* Serial configuration for split keyboard. */ +#define SERIAL_USART_TX_PIN A9 + +/* CRC. */ +#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 + +/* EEPROM config. */ +#define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A4 + +/* PMW3360 settings. */ +#define PMW33XX_CS_PIN B14 +#define PMW33XX_CS_DIVISOR 64 diff --git a/keyboards/bastardkb/charybdis/3x6/blackpill/halconf.h b/keyboards/bastardkb/charybdis/3x6/blackpill/halconf.h new file mode 100644 index 0000000000..42d7499907 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/blackpill/halconf.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 + +#define HAL_USE_PWM TRUE +#define HAL_USE_SERIAL 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/3x6/blackpill/info.json b/keyboards/bastardkb/charybdis/3x6/blackpill/info.json new file mode 100644 index 0000000000..73a1359e00 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/blackpill/info.json @@ -0,0 +1,6 @@ +{ + "keyboard_name": "Charybdis Mini (3x6) Blackpill", + "usb": { + "device_version": "1.0.0", + }, +} diff --git a/keyboards/bastardkb/charybdis/3x6/blackpill/mcuconf.h b/keyboards/bastardkb/charybdis/3x6/blackpill/mcuconf.h new file mode 100644 index 0000000000..26645d8c1a --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/blackpill/mcuconf.h @@ -0,0 +1,43 @@ +/* + * 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 STM32_PWM_USE_TIM2 +#define STM32_PWM_USE_TIM2 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_SPI1_RX_DMA_STREAM +#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0) +#undef STM32_SPI_SPI1_TX_DMA_STREAM +#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3) + +#undef STM32_SERIAL_USE_USART1 +#define STM32_SERIAL_USE_USART1 TRUE + +#undef STM32_GPT_USE_TIM4 +#define STM32_GPT_USE_TIM4 TRUE + +#undef STM32_ST_USE_TIMER +#define STM32_ST_USE_TIMER 5 diff --git a/keyboards/bastardkb/charybdis/3x6/blackpill/readme.md b/keyboards/bastardkb/charybdis/3x6/blackpill/readme.md new file mode 100644 index 0000000000..6a9907c2ae --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/blackpill/readme.md @@ -0,0 +1,3 @@ +# Charybdis Mini (3x6) BlackPill + +An ergonomic keyboard with integrated trackball, with BlackPill (STM32F411) mod. diff --git a/keyboards/bastardkb/charybdis/3x6/blackpill/rules.mk b/keyboards/bastardkb/charybdis/3x6/blackpill/rules.mk new file mode 100644 index 0000000000..a29e3e433d --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/blackpill/rules.mk @@ -0,0 +1,39 @@ +# MCU name +MCU = STM32F411 +BOARD = BLACKPILL_STM32_F411 + +# Bootloader selection +BOOTLOADER = stm32-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output + +AUDIO_SUPPORTED = no # Audio is not supported +RGB_MATRIX_SUPPORTED = yes # RGB matrix is supported and enabled by default +RGBLIGHT_SUPPORTED = yes # RGB underglow is supported, but not enabled by default +RGB_MATRIX_ENABLE = yes # Enable keyboard RGB matrix functionality +RGB_MATRIX_DRIVER = WS2812 + +SPLIT_KEYBOARD = yes +LAYOUTS = split_3x6_3 + +POINTING_DEVICE_ENABLE = yes # Enable trackball +POINTING_DEVICE_DRIVER = pmw3360 +MOUSE_SHARED_EP = no # Unify multiple HID interfaces into a single Endpoint +KEYBOARD_SHARED_EP = yes + +EEPROM_DRIVER = spi +WS2812_DRIVER = pwm +SERIAL_DRIVER = usart + +DEBOUNCE_TYPE = asym_eager_defer_pk diff --git a/keyboards/bastardkb/charybdis/3x6/config.h b/keyboards/bastardkb/charybdis/3x6/config.h new file mode 100644 index 0000000000..6b31a773fc --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/config.h @@ -0,0 +1,49 @@ +/* + * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com> + * Copyright 2021 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 "config_common.h" + +/* Key matrix configuration. */ +#define MATRIX_ROWS 8 // Rows are doubled-up. +#define MATRIX_COLS 6 + +#define DIODE_DIRECTION ROW2COL + +/* Set 0 if debouncing isn't needed. */ +#define DEBOUNCE 5 + +/* Trackball angle adjustment. */ +#define ROTATIONAL_TRANSFORM_ANGLE -25 + +/* RGB settings. */ +#define RGBLED_NUM 42 +#define RGBLED_SPLIT \ + { 21, 21 } + +/* RGB matrix support. */ +#ifdef RGB_MATRIX_ENABLE +# define SPLIT_TRANSPORT_MIRROR +# define DRIVER_LED_TOTAL RGBLED_NUM +# define RGB_MATRIX_SPLIT RGBLED_SPLIT +# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 50 +# define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS +# define RGB_DISABLE_WHEN_USB_SUSPENDED +# define RGB_MATRIX_KEYPRESSES +#endif diff --git a/keyboards/bastardkb/charybdis/3x6/info.json b/keyboards/bastardkb/charybdis/3x6/info.json new file mode 100644 index 0000000000..0b4428cdbe --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/info.json @@ -0,0 +1,99 @@ +{ + "url": "https://bastardkb.com", + "usb": { + "pid": "0x1834", + }, + "layouts": { + "LAYOUT_charybdis_3x6": { + "layout": [ + {"label":"L00", "x":0, "y":0}, + {"label":"L01", "x":1, "y":0}, + {"label":"L02", "x":2, "y":0}, + {"label":"L03", "x":3, "y":0}, + {"label":"L04", "x":4, "y":0}, + {"label":"L05", "x":5, "y":0}, + {"label":"R00", "x":11, "y":0}, + {"label":"R01", "x":12, "y":0}, + {"label":"R02", "x":13, "y":0}, + {"label":"R03", "x":14, "y":0}, + {"label":"R04", "x":15, "y":0}, + {"label":"R05", "x":16, "y":0}, + {"label":"L10", "x":0, "y":1}, + {"label":"L11", "x":1, "y":1}, + {"label":"L12", "x":2, "y":1}, + {"label":"L13", "x":3, "y":1}, + {"label":"L14", "x":4, "y":1}, + {"label":"L15", "x":5, "y":1}, + {"label":"R10", "x":11, "y":1}, + {"label":"R11", "x":12, "y":1}, + {"label":"R12", "x":13, "y":1}, + {"label":"R13", "x":14, "y":1}, + {"label":"R14", "x":15, "y":1}, + {"label":"R15", "x":16, "y":1}, + {"label":"L20", "x":0, "y":2}, + {"label":"L21", "x":1, "y":2}, + {"label":"L22", "x":2, "y":2}, + {"label":"L23", "x":3, "y":2}, + {"label":"L24", "x":4, "y":2}, + {"label":"L25", "x":5, "y":2}, + {"label":"R20", "x":11, "y":2}, + {"label":"R21", "x":12, "y":2}, + {"label":"R22", "x":13, "y":2}, + {"label":"R23", "x":14, "y":2}, + {"label":"R24", "x":15, "y":2}, + {"label":"R25", "x":16, "y":2}, + {"label":"L33", "x":5, "y":3}, + {"label":"L34", "x":6, "y":3}, + {"label":"L31", "x":7, "y":3}, + {"label":"R31", "x":9, "y":3}, + {"label":"R33", "x":10, "y":3} + ] + }, + "LAYOUT_split_3x6_3": { + "layout": [ + {"label":"L00", "x":0, "y":0}, + {"label":"L01", "x":1, "y":0}, + {"label":"L02", "x":2, "y":0}, + {"label":"L03", "x":3, "y":0}, + {"label":"L04", "x":4, "y":0}, + {"label":"L05", "x":5, "y":0}, + {"label":"R00", "x":11, "y":0}, + {"label":"R01", "x":12, "y":0}, + {"label":"R02", "x":13, "y":0}, + {"label":"R03", "x":14, "y":0}, + {"label":"R04", "x":15, "y":0}, + {"label":"R05", "x":16, "y":0}, + {"label":"L10", "x":0, "y":1}, + {"label":"L11", "x":1, "y":1}, + {"label":"L12", "x":2, "y":1}, + {"label":"L13", "x":3, "y":1}, + {"label":"L14", "x":4, "y":1}, + {"label":"L15", "x":5, "y":1}, + {"label":"R10", "x":11, "y":1}, + {"label":"R11", "x":12, "y":1}, + {"label":"R12", "x":13, "y":1}, + {"label":"R13", "x":14, "y":1}, + {"label":"R14", "x":15, "y":1}, + {"label":"R15", "x":16, "y":1}, + {"label":"L20", "x":0, "y":2}, + {"label":"L21", "x":1, "y":2}, + {"label":"L22", "x":2, "y":2}, + {"label":"L23", "x":3, "y":2}, + {"label":"L24", "x":4, "y":2}, + {"label":"L25", "x":5, "y":2}, + {"label":"R20", "x":11, "y":2}, + {"label":"R21", "x":12, "y":2}, + {"label":"R22", "x":13, "y":2}, + {"label":"R23", "x":14, "y":2}, + {"label":"R24", "x":15, "y":2}, + {"label":"R25", "x":16, "y":2}, + {"label":"L33", "x":5, "y":3}, + {"label":"L34", "x":6, "y":3}, + {"label":"L31", "x":7, "y":3}, + {"label":"R33", "x":9, "y":3}, + {"label":"R34", "x":10, "y":3}, + {"label":"R31", "x":11, "y":3} + ] + } + } +} diff --git a/keyboards/bastardkb/charybdis/3x6/keymaps/default/config.h b/keyboards/bastardkb/charybdis/3x6/keymaps/default/config.h new file mode 100644 index 0000000000..4b1bae3ca0 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/keymaps/default/config.h @@ -0,0 +1,54 @@ +/** + * 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 + +#ifndef TAPPING_TERM +/** + * \brief Configure the global tapping term (default: 200ms). + * + * If you have a lot of accidental mod activations, crank up the tapping term. + * + * See docs.qmk.fm/using-qmk/software-features/tap_hold#tapping-term + */ +# define TAPPING_TERM 200 +#endif // TAPPING_TERM + +/* RGB Matrix. */ + +#ifdef RGB_MATRIX_ENABLE +// Disable control of RGB matrix by keycodes (must use firmware implementation +// to control the feature). +# define RGB_MATRIX_DISABLE_KEYCODES + +// Limit maximum brightness to keep power consumption reasonable, and avoid +// disconnects. +# undef RGB_MATRIX_MAXIMUM_BRIGHTNESS +# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 64 + +// Rainbow swirl as startup mode. +# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT + +// Slow swirl at startup. +# define RGB_MATRIX_STARTUP_SPD 32 + +// Startup values. +# define RGB_MATRIX_STARTUP_HUE 0 +# define RGB_MATRIX_STARTUP_SAT 255 +# define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS +# define RGB_MATRIX_STARTUP_HSV RGB_MATRIX_STARTUP_HUE, RGB_MATRIX_STARTUP_SAT, RGB_MATRIX_STARTUP_VAL +#endif // RGB_MATRIX_ENABLE diff --git a/keyboards/bastardkb/charybdis/3x6/keymaps/default/keymap.c b/keyboards/bastardkb/charybdis/3x6/keymaps/default/keymap.c new file mode 100644 index 0000000000..fee8d87ad6 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/keymaps/default/keymap.c @@ -0,0 +1,66 @@ +/** + * 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/>. + */ +#include QMK_KEYBOARD_H + +enum charybdis_keymap_layers { + LAYER_BASE = 0, + LAYER_LOWER, + LAYER_RAISE, +}; + +#define LOWER MO(LAYER_LOWER) +#define RAISE MO(LAYER_RAISE) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [LAYER_BASE] = LAYOUT_charybdis_3x6( + // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮ + KC_LGUI, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_RGUI, + // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_RCTL, + // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ + KC_BSPC, KC_SPC, LOWER, RAISE, KC_ENT + // ╰───────────────────────────╯ ╰──────────────────╯ + ), + + [LAYER_LOWER] = LAYOUT_charybdis_3x6( + // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮ + XXXXXXX, RGB_TOG, KC_MNXT, KC_MPLY, KC_MPRV, XXXXXXX, KC_LBRC, KC_7, KC_8, KC_9, KC_RBRC, XXXXXXX, + // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ + XXXXXXX, KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, KC_PPLS, KC_4, KC_5, KC_6, KC_PMNS, XXXXXXX, + // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, EEP_RST, QK_BOOT, KC_PAST, KC_1, KC_2, KC_3, KC_PSLS, XXXXXXX, + // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ + XXXXXXX, XXXXXXX, _______, XXXXXXX, _______ + // ╰───────────────────────────╯ ╰──────────────────╯ + ), + + [LAYER_RAISE] = LAYOUT_charybdis_3x6( + // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLU, KC_MUTE, KC_VOLD, XXXXXXX, XXXXXXX, + // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ + XXXXXXX, KC_LEFT, KC_UP, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, KC_RSFT, KC_RCTL, KC_RALT, KC_RGUI, XXXXXXX, + // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ + XXXXXXX, KC_HOME, KC_PGUP, KC_PGDN, KC_END, XXXXXXX, QK_BOOT, EEP_RST, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ + _______, _______, XXXXXXX, _______, XXXXXXX + // ╰───────────────────────────╯ ╰──────────────────╯ + ), +}; +// clang-format on diff --git a/keyboards/bastardkb/charybdis/3x6/keymaps/default/readme.md b/keyboards/bastardkb/charybdis/3x6/keymaps/default/readme.md new file mode 100644 index 0000000000..8b407f68a2 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/keymaps/default/readme.md @@ -0,0 +1,7 @@ +# Charybdis Mini (3x6) default keymap + +> :bulb: Have a look at the [`via` keymap](../via) for a more feature-rich layout. + +The Charydbis Mini (3x6) default keymap is inspired from the original [Dactyl Manuform](../../../../../handwired/dactyl_manuform) default keymap. + +This layout supports RGB matrix. However, due to space constraints on the MCU, only a limited number of effect can be enabled at once. Look at the `config.h` file and enable your favorite effect. diff --git a/keyboards/bastardkb/charybdis/3x6/keymaps/via/config.h b/keyboards/bastardkb/charybdis/3x6/keymaps/via/config.h new file mode 100644 index 0000000000..abbf492089 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/keymaps/via/config.h @@ -0,0 +1,71 @@ +/** + * 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 + +#ifdef VIA_ENABLE +/* VIA configuration. */ +# define DYNAMIC_KEYMAP_LAYER_COUNT 4 +#endif // VIA_ENABLE + +/* Disable unused features. */ +#define NO_ACTION_ONESHOT + +#ifndef TAPPING_TERM +/** + * \brief Configure the global tapping term (default: 200ms). + * + * If you have a lot of accidental mod activations, crank up the tapping term. + * + * See docs.qmk.fm/using-qmk/software-features/tap_hold#tapping-term + */ +# define TAPPING_TERM 200 +#endif // TAPPING_TERM + +/* Charybdis-specific features. */ + +#ifdef POINTING_DEVICE_ENABLE +// Automatically enable the pointer layer when moving the trackball. See also: +// - `CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS` +// - `CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD` +// #define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE +#endif // POINTING_DEVICE_ENABLE + +/* RGB Matrix. */ + +#ifdef RGB_MATRIX_ENABLE +// Disable control of RGB matrix by keycodes (must use firmware implementation +// to control the feature). +# define RGB_MATRIX_DISABLE_KEYCODES + +// Limit maximum brightness to keep power consumption reasonable, and avoid +// disconnects. +# undef RGB_MATRIX_MAXIMUM_BRIGHTNESS +# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 64 + +// Rainbow swirl as startup mode. +# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT + +// Slow swirl at startup. +# define RGB_MATRIX_STARTUP_SPD 32 + +// Startup values. +# define RGB_MATRIX_STARTUP_HUE 0 +# define RGB_MATRIX_STARTUP_SAT 255 +# define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS +# define RGB_MATRIX_STARTUP_HSV RGB_MATRIX_STARTUP_HUE, RGB_MATRIX_STARTUP_SAT, RGB_MATRIX_STARTUP_VAL +#endif // RGB_MATRIX_ENABLE diff --git a/keyboards/bastardkb/charybdis/3x6/keymaps/via/keymap.c b/keyboards/bastardkb/charybdis/3x6/keymaps/via/keymap.c new file mode 100644 index 0000000000..edfce673fb --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/keymaps/via/keymap.c @@ -0,0 +1,148 @@ +/** + * 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/>. + */ +#include QMK_KEYBOARD_H + +enum charybdis_keymap_layers { + LAYER_BASE = 0, + LAYER_LOWER, + LAYER_RAISE, + LAYER_POINTER, +}; + +/** \brief Automatically enable sniping-mode on the pointer layer. */ +#define CHARYBDIS_AUTO_SNIPING_ON_LAYER LAYER_POINTER + +#ifdef CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE +static uint16_t auto_pointer_layer_timer = 0; + +# ifndef CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS +# define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS 1000 +# endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS + +# ifndef CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD +# define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD 8 +# endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD +#endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE + +#define LOWER MO(LAYER_LOWER) +#define RAISE MO(LAYER_RAISE) +#define PT_Z LT(LAYER_POINTER, KC_Z) +#define PT_SLSH LT(LAYER_POINTER, KC_SLSH) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [LAYER_BASE] = LAYOUT_charybdis_3x6( + // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮ + KC_LGUI, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_RGUI, + // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_RCTL, + // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ + KC_BSPC, KC_SPC, LOWER, RAISE, KC_ENT + // ╰───────────────────────────╯ ╰──────────────────╯ + ), + + [LAYER_LOWER] = LAYOUT_charybdis_3x6( + // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮ + XXXXXXX, RGB_TOG, KC_MNXT, KC_MPLY, KC_MPRV, XXXXXXX, KC_LBRC, KC_7, KC_8, KC_9, KC_RBRC, XXXXXXX, + // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ + XXXXXXX, KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, KC_PPLS, KC_4, KC_5, KC_6, KC_PMNS, XXXXXXX, + // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, EEP_RST, QK_BOOT, KC_PAST, KC_1, KC_2, KC_3, KC_PSLS, XXXXXXX, + // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ + XXXXXXX, XXXXXXX, _______, XXXXXXX, _______ + // ╰───────────────────────────╯ ╰──────────────────╯ + ), + + [LAYER_RAISE] = LAYOUT_charybdis_3x6( + // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLU, KC_MUTE, KC_VOLD, XXXXXXX, XXXXXXX, + // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ + XXXXXXX, KC_LEFT, KC_UP, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, KC_RSFT, KC_RCTL, KC_RALT, KC_RGUI, XXXXXXX, + // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ + XXXXXXX, KC_HOME, KC_PGUP, KC_PGDN, KC_END, XXXXXXX, QK_BOOT, EEP_RST, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ + _______, _______, XXXXXXX, _______, XXXXXXX + // ╰───────────────────────────╯ ╰──────────────────╯ + ), + + [LAYER_POINTER] = LAYOUT_charybdis_3x6( + // ╭──────────────────────────────────────────────────────╮ ╭──────────────────────────────────────────────────────╮ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, DPI_MOD, S_D_MOD, S_D_MOD, DPI_MOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ + XXXXXXX, KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, XXXXXXX, KC_RSFT, KC_RCTL, KC_RALT, KC_RGUI, XXXXXXX, + // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ + XXXXXXX, _______, DRGSCRL, SNIPING, EEP_RST, QK_BOOT, QK_BOOT, EEP_RST, SNIPING, DRGSCRL, _______, XXXXXXX, + // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ + KC_BTN2, KC_BTN1, KC_BTN3, KC_BTN3, KC_BTN1 + // ╰───────────────────────────╯ ╰──────────────────╯ + ), +}; +// clang-format on + +#ifdef POINTING_DEVICE_ENABLE +# ifdef CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE +report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { + if (abs(mouse_report.x) > CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD || abs(mouse_report.y) > CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD) { + if (auto_pointer_layer_timer == 0) { + layer_on(LAYER_POINTER); +# ifdef RGB_MATRIX_ENABLE + rgb_matrix_mode_noeeprom(RGB_MATRIX_NONE); + rgb_matrix_sethsv_noeeprom(HSV_GREEN); +# endif // RGB_MATRIX_ENABLE + } + auto_pointer_layer_timer = timer_read(); + } + return mouse_report; +} + +void matrix_scan_user(void) { + if (auto_pointer_layer_timer != 0 && TIMER_DIFF_16(timer_read(), auto_pointer_layer_timer) >= CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS) { + auto_pointer_layer_timer = 0; + layer_off(LAYER_POINTER); +# ifdef RGB_MATRIX_ENABLE + rgb_matrix_mode_noeeprom(RGB_MATRIX_STARTUP_MODE); +# endif // RGB_MATRIX_ENABLE + } +} +# endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE + +# ifdef CHARYBDIS_AUTO_SNIPING_ON_LAYER +layer_state_t layer_state_set_user(layer_state_t state) { + charybdis_set_pointer_sniping_enabled(layer_state_cmp(state, CHARYBDIS_AUTO_SNIPING_ON_LAYER)); + return state; +} +# endif // CHARYBDIS_AUTO_SNIPING_ON_LAYER +#endif // POINTING_DEVICE_ENABLE + +#ifdef RGB_MATRIX_ENABLE +// Forward-declare this helper function since it is defined in rgb_matrix.c. +void rgb_matrix_update_pwm_buffers(void); +#endif + +void shutdown_user(void) { +#ifdef RGBLIGHT_ENABLE + rgblight_enable_noeeprom(); + rgblight_mode_noeeprom(1); + rgblight_setrgb_red(); +#endif // RGBLIGHT_ENABLE +#ifdef RGB_MATRIX_ENABLE + rgb_matrix_set_color_all(RGB_RED); + rgb_matrix_update_pwm_buffers(); +#endif // RGB_MATRIX_ENABLE +} diff --git a/keyboards/bastardkb/charybdis/3x6/keymaps/via/readme.md b/keyboards/bastardkb/charybdis/3x6/keymaps/via/readme.md new file mode 100644 index 0000000000..fba00cd996 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/keymaps/via/readme.md @@ -0,0 +1,57 @@ +# Charybdis Mini (3x6) `via` keymap + +The Charydbis Mini (3x6) `via` keymap is inspired from the original [Dactyl Manuform](../../../../../handwired/dactyl_manuform) default keymap, with some features and changes specific to the Charybdis. + +This layout supports RGB matrix. However, due to space constraints on the MCU, only a limited number of effect can be enabled at once. Look at the `config.h` file and enable your favorite effect. + +## Customizing the keymap + +### Dynamic DPI scaling + +Use the following keycodes to change the default DPI: + +- `POINTER_DEFAULT_DPI_FORWARD`: increases the DPI; decreases when shifted; +- `POINTER_DEFAULT_DPI_REVERSE`: decreases the DPI; increases when shifted. + +There's a maximum of 16 possible values for the sniping mode DPI. See the [Charybdis documentation](../../README.md) for more information. + +Use the following keycodes to change the sniping mode DPI: + +- `POINTER_SNIPING_DPI_FORWARD`: increases the DPI; decreases when shifted; +- `POINTER_SNIPING_DPI_REVERSE`: decreases the DPI; increases when shifted. + +There's a maximum of 4 possible values for the sniping mode DPI. See the [Charybdis documentation](../../README.md) for more information. + +### Drag-scroll + +Use the `DRAGSCROLL_MODE` keycode to enable drag-scroll on hold. Use the `DRAGSCROLL_TOGGLE` keycode to enable/disable drag-scroll on key press. + +### Sniping + +Use the `SNIPING_MODE` keycode to enable sniping mode on hold. Use the `SNIPING_TOGGLE` keycode to enable/disable sniping mode on key press. + +Change the value of `CHARYBDIS_AUTO_SNIPING_ON_LAYER` to automatically enable sniping mode on layer change. By default, sniping mode is enabled on the pointer layer: + +```c +#define CHARYBDIS_AUTO_SNIPING_ON_LAYER LAYER_POINTER +``` + +### Auto pointer layer + +The pointer layer can be automatically enabled when moving the trackball. To enable or disable this behavior, add or remove the following define: + +```c +#define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE +``` + +By default, the layer is turned off 1 second after the last registered trackball movement: + +```c +#define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS 1000 +``` + +The trigger sensibility can also be tuned. The lower the value, the more sensible the trigger: + +```c +#define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD 8 +``` diff --git a/keyboards/bastardkb/charybdis/3x6/keymaps/via/rules.mk b/keyboards/bastardkb/charybdis/3x6/keymaps/via/rules.mk new file mode 100644 index 0000000000..1e5b99807c --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/bastardkb/charybdis/3x6/readme.md b/keyboards/bastardkb/charybdis/3x6/readme.md new file mode 100644 index 0000000000..c6385ed8f1 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/readme.md @@ -0,0 +1,15 @@ +# Charybdis Nano (3x6) + +An ergonomic keyboard with integrated trackball. + +The Charybdis is available in 4x6, 3x6 and 3x5 form factor at [bastardkb.com](https://bastardkb.com). + +## Keymaps + +### [`default`](keymaps/default) + +A simple QWERTY layout with 4 layers. + +### [`via`](keymaps/via) + +A [Miryoku-inspired](https://github.com/manna-harbour/miryoku), feature-rich, keymap with VIA support. diff --git a/keyboards/bastardkb/charybdis/3x6/v1/elitec/config.h b/keyboards/bastardkb/charybdis/3x6/v1/elitec/config.h new file mode 100644 index 0000000000..05746cf17e --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/v1/elitec/config.h @@ -0,0 +1,41 @@ +/* + * 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 + +/* Key matrix configuration. */ +#define MATRIX_ROW_PINS \ + { B7, C6, D4, B5 } +#define MATRIX_COL_PINS \ + { D5, C7, F0, D7, E6, B4 } + +#define MATRIX_ROW_PINS_RIGHT \ + { F0, C6, D4, B5 } +#define MATRIX_COL_PINS_RIGHT \ + { F1, C7, B7, D7, E6, B4 } + +/* Handedness. */ +#define MASTER_RIGHT + +/* serial.c configuration (for split keyboard). */ +#define SOFT_SERIAL_PIN D2 + +/* RGB settings. */ +#define RGB_DI_PIN D3 + +/* PMW3360 settings. */ +#define PMW33XX_CS_PIN B0 diff --git a/keyboards/bastardkb/charybdis/3x6/v1/elitec/info.json b/keyboards/bastardkb/charybdis/3x6/v1/elitec/info.json new file mode 100644 index 0000000000..bf7f1a35f2 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/v1/elitec/info.json @@ -0,0 +1,6 @@ +{ + "keyboard_name": "Charybdis Mini (3x6) Elite-C", + "usb": { + "device_version": "1.0.0", + }, +} diff --git a/keyboards/bastardkb/charybdis/3x6/v1/elitec/rules.mk b/keyboards/bastardkb/charybdis/3x6/v1/elitec/rules.mk new file mode 100644 index 0000000000..54406bcc1d --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/v1/elitec/rules.mk @@ -0,0 +1,35 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output + +AUDIO_SUPPORTED = no # Audio is not supported +RGB_MATRIX_SUPPORTED = yes # RGB matrix is supported and enabled by default +RGBLIGHT_SUPPORTED = yes # RGB underglow is supported, but not enabled by default +RGB_MATRIX_ENABLE = yes # Enable keyboard RGB matrix functionality +RGB_MATRIX_DRIVER = WS2812 + +SPLIT_KEYBOARD = yes +LAYOUTS = split_3x6_3 + +POINTING_DEVICE_ENABLE = yes # Enable trackball +POINTING_DEVICE_DRIVER = pmw3360 +MOUSE_SHARED_EP = no # Unify multiple HID interfaces into a single Endpoint + +# Enable link-time optimization by default. The Charybdis packs a lot of +# features (RGB, Via, trackball) in a small atmega32u4 package. +LTO_ENABLE = yes diff --git a/keyboards/bastardkb/charybdis/3x6/v2/elitec/config.h b/keyboards/bastardkb/charybdis/3x6/v2/elitec/config.h new file mode 100644 index 0000000000..edd167446b --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/v2/elitec/config.h @@ -0,0 +1,36 @@ +/* + * 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 + +/* Key matrix configuration. */ +#define MATRIX_ROW_PINS \ + { F7, C6, D4, B5 } +#define MATRIX_COL_PINS \ + { F6, F5, B6, D7, E6, B4 } + +/* Handedness. */ +#define MASTER_RIGHT + +/* serial.c configuration (for split keyboard). */ +#define SOFT_SERIAL_PIN D2 + +/* RGB settings. */ +#define RGB_DI_PIN D3 + +/* PMW3360 settings. */ +#define PMW33XX_CS_PIN F0 diff --git a/keyboards/bastardkb/charybdis/3x6/v2/elitec/info.json b/keyboards/bastardkb/charybdis/3x6/v2/elitec/info.json new file mode 100644 index 0000000000..239a10f8a3 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/v2/elitec/info.json @@ -0,0 +1,6 @@ +{ + "keyboard_name": "Charybdis Mini (3x6) Elite-C", + "usb": { + "device_version": "2.0.0", + }, +} diff --git a/keyboards/bastardkb/charybdis/3x6/v2/elitec/rules.mk b/keyboards/bastardkb/charybdis/3x6/v2/elitec/rules.mk new file mode 100644 index 0000000000..54406bcc1d --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/v2/elitec/rules.mk @@ -0,0 +1,35 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output + +AUDIO_SUPPORTED = no # Audio is not supported +RGB_MATRIX_SUPPORTED = yes # RGB matrix is supported and enabled by default +RGBLIGHT_SUPPORTED = yes # RGB underglow is supported, but not enabled by default +RGB_MATRIX_ENABLE = yes # Enable keyboard RGB matrix functionality +RGB_MATRIX_DRIVER = WS2812 + +SPLIT_KEYBOARD = yes +LAYOUTS = split_3x6_3 + +POINTING_DEVICE_ENABLE = yes # Enable trackball +POINTING_DEVICE_DRIVER = pmw3360 +MOUSE_SHARED_EP = no # Unify multiple HID interfaces into a single Endpoint + +# Enable link-time optimization by default. The Charybdis packs a lot of +# features (RGB, Via, trackball) in a small atmega32u4 package. +LTO_ENABLE = yes diff --git a/keyboards/bastardkb/charybdis/3x6/v2/splinky/config.h b/keyboards/bastardkb/charybdis/3x6/v2/splinky/config.h new file mode 100644 index 0000000000..9c4ced817a --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/v2/splinky/config.h @@ -0,0 +1,50 @@ +/* + * 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 + +/* Key matrix configuration. */ +#define MATRIX_ROW_PINS \ + { GP26, GP5, GP4, GP9 } +#define MATRIX_COL_PINS \ + { GP27, GP28, GP15, GP6, GP7, GP8 } + +/* Handedness. */ +#define MASTER_RIGHT + +// To use the handedness pin, resistors need to be installed on the adapter PCB. +// If so, uncomment the following code, and undefine MASTER_RIGHT above. +// #define SPLIT_HAND_PIN GP13 +// #define SPLIT_HAND_PIN_LOW_IS_LEFT // High -> right, Low -> left. + +/* serial.c configuration (for split keyboard). */ +#define SOFT_SERIAL_PIN GP1 + +/* RGB settings. */ +#define RGB_DI_PIN GP0 + +/* SPI & PMW3360 settings. */ +#define SPI_DRIVER SPID0 +#define SPI_SCK_PIN GP18 +#define SPI_MOSI_PIN GP19 +#define SPI_MISO_PIN GP20 +#define PMW33XX_CS_PIN GP14 + +/* Reset. */ +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP17 +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 1000U diff --git a/keyboards/bastardkb/charybdis/3x6/v2/splinky/info.json b/keyboards/bastardkb/charybdis/3x6/v2/splinky/info.json new file mode 100644 index 0000000000..7f3997158f --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/v2/splinky/info.json @@ -0,0 +1,6 @@ +{ + "keyboard_name": "Charybdis Mini (3x6) Splinky", + "usb": { + "device_version": "2.0.0", + }, +} diff --git a/keyboards/bastardkb/charybdis/3x6/v2/splinky/mcuconf.h b/keyboards/bastardkb/charybdis/3x6/v2/splinky/mcuconf.h new file mode 100644 index 0000000000..0fdd67c3a2 --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/v2/splinky/mcuconf.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 + +#include_next "mcuconf.h" + +#undef RP_SPI_USE_SPI0 +#define RP_SPI_USE_SPI0 TRUE diff --git a/keyboards/bastardkb/charybdis/3x6/v2/splinky/rules.mk b/keyboards/bastardkb/charybdis/3x6/v2/splinky/rules.mk new file mode 100644 index 0000000000..6ab474a76f --- /dev/null +++ b/keyboards/bastardkb/charybdis/3x6/v2/splinky/rules.mk @@ -0,0 +1,37 @@ +# MCU name +MCU = RP2040 + +# Bootloader selection +BOOTLOADER = rp2040 + +# RP2040-specific options +ALLOW_WARNINGS = yes +PICO_INTRINSICS_ENABLED = no # ATM Unsupported by ChibiOS. + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output + +AUDIO_SUPPORTED = no # Audio is not supported +RGB_MATRIX_SUPPORTED = yes # RGB matrix is supported and enabled by default +RGBLIGHT_SUPPORTED = yes # RGB underglow is supported, but not enabled by default +RGB_MATRIX_ENABLE = yes # Enable keyboard RGB matrix functionality +RGB_MATRIX_DRIVER = WS2812 + +SPLIT_KEYBOARD = yes +LAYOUTS = split_3x6_3 + +POINTING_DEVICE_ENABLE = yes # Enable trackball +POINTING_DEVICE_DRIVER = pmw3360 + +SERIAL_DRIVER = vendor +WS2812_DRIVER = vendor diff --git a/keyboards/bastardkb/charybdis/4x6/4x6.c b/keyboards/bastardkb/charybdis/4x6/4x6.c index 6cd8fffee7..85e8b5fdd1 100644 --- a/keyboards/bastardkb/charybdis/4x6/4x6.c +++ b/keyboards/bastardkb/charybdis/4x6/4x6.c @@ -36,6 +36,10 @@ * 26 27 28 53 54 XX * 25 24 55 XX * ╰────────────╯ ╰────────────╯ + * + * Note: the LED config simulates 58 LEDs instead of the actual 56 to prevent + * confusion when testing LEDs during assembly when handedness is not set + * correctly. Those fake LEDs are bound to the physical bottom-left corner. */ led_config_t g_led_config = { { /* Key Matrix to LED index. */ @@ -70,6 +74,7 @@ led_config_t g_led_config = { { /* index=45 */ { 160, 0 }, { 160, 12 }, { 160, 24 }, { 160, 36 }, /* index=49 */ { 144, 0 }, { 144, 12 }, { 144, 24 }, { 144, 36 }, /* index=53 */ { 112, 52 }, { 128, 64 }, { 112, 64 }, + /* index=56 */ { 0, 0 }, { 0, 0 }, }, { /* LED index to flag. */ // Left split. @@ -89,6 +94,7 @@ led_config_t g_led_config = { { /* index=45 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, /* index=49 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, /* index=53 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // Thumb cluster + /* index=55 */ LED_FLAG_MODIFIER, LED_FLAG_MODIFIER, // Thumb cluster fakes } }; #endif // clang-format on diff --git a/keyboards/bastardkb/charybdis/4x6/blackpill/config.h b/keyboards/bastardkb/charybdis/4x6/blackpill/config.h new file mode 100644 index 0000000000..2514a52fb0 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/blackpill/config.h @@ -0,0 +1,62 @@ +/* + * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) + * Copyright 2021 Stefan Kerkmann (@KarlK90) + * Copyright 2021 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 Publicw 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 + +/* Key matrix configuration. */ +#define MATRIX_ROW_PINS \ + { B15, A2, B8, A8, B9 } +#define MATRIX_COL_PINS \ + { B0, B1, B10, B3, B4, B5 } + +/* Handedness. */ +#define SPLIT_HAND_PIN A3 // High -> left, Low -> right. + +/* RGB settings. */ +#define RGB_DI_PIN A1 +#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 + +/* Serial configuration for split keyboard. */ +#define SERIAL_USART_TX_PIN A9 + +/* CRC. */ +#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 + +/* EEPROM config. */ +#define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A4 + +/* PMW3360 settings. */ +#define PMW33XX_CS_PIN B14 +#define PMW33XX_CS_DIVISOR 64 diff --git a/keyboards/bastardkb/charybdis/4x6/blackpill/halconf.h b/keyboards/bastardkb/charybdis/4x6/blackpill/halconf.h new file mode 100644 index 0000000000..a89dff0cd3 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/blackpill/halconf.h @@ -0,0 +1,29 @@ +/* + * Copyright 2020 Nick Brassel (tzarc) + * Copyright 2021 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_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 +//#define HAL_USE_GPT TRUE + +#include_next "halconf.h" diff --git a/keyboards/bastardkb/charybdis/4x6/blackpill/info.json b/keyboards/bastardkb/charybdis/4x6/blackpill/info.json new file mode 100644 index 0000000000..788783c679 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/blackpill/info.json @@ -0,0 +1,6 @@ +{ + "keyboard_name": "Charybdis (4x6) Blackpill", + "usb": { + "device_version": "1.0.0", + }, +} diff --git a/keyboards/bastardkb/charybdis/4x6/blackpill/mcuconf.h b/keyboards/bastardkb/charybdis/4x6/blackpill/mcuconf.h new file mode 100644 index 0000000000..1615d1bf46 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/blackpill/mcuconf.h @@ -0,0 +1,61 @@ +/* + * Copyright 2020 Nick Brassel (tzarc) + * Copyright 2021 Stefan Kerkmann (@KarlK90) + * Copyright 2021 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 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_PWM_USE_TIM2 +#define STM32_PWM_USE_TIM2 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_SPI1_RX_DMA_STREAM +#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0) +#undef STM32_SPI_SPI1_TX_DMA_STREAM +#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3) + +#undef STM32_SERIAL_USE_USART1 +#define STM32_SERIAL_USE_USART1 TRUE + +// #undef STM32_SERIAL_USE_USART2 +// #define STM32_SERIAL_USE_USART2 TRUE + +// #undef STM32_UART_USART2_RX_DMA_STREAM +// #define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) +// #undef STM32_UART_USART2_TX_DMA_STREAM +// #define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) + +#undef STM32_GPT_USE_TIM4 +#define STM32_GPT_USE_TIM4 TRUE + +#undef STM32_ST_USE_TIMER +#define STM32_ST_USE_TIMER 5 diff --git a/keyboards/bastardkb/charybdis/4x6/blackpill/readme.md b/keyboards/bastardkb/charybdis/4x6/blackpill/readme.md new file mode 100644 index 0000000000..bbae15bb85 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/blackpill/readme.md @@ -0,0 +1,3 @@ +# Charybdis (4x6) BlackPill + +An ergonomic keyboard with integrated trackball, with BlackPill (STM32F411) mod. diff --git a/keyboards/bastardkb/charybdis/4x6/blackpill/rules.mk b/keyboards/bastardkb/charybdis/4x6/blackpill/rules.mk new file mode 100644 index 0000000000..6123ec58b7 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/blackpill/rules.mk @@ -0,0 +1,40 @@ +# MCU name +MCU = STM32F411 +BOARD = BLACKPILL_STM32_F411 + +# Bootloader selection +BOOTLOADER = stm32-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output + +AUDIO_SUPPORTED = no # Audio is not supported. +RGB_MATRIX_SUPPORTED = yes # RGB matrix is supported and enabled by default. +RGBLIGHT_SUPPORTED = yes # RGB underglow is supported, but not enabled by default. +RGB_MATRIX_ENABLE = yes # Enable keyboard RGB matrix functionality +RGB_MATRIX_DRIVER = WS2812 + +# Charybdis is a split 4x6 keyboard with a maximum of 5 thumb keys (3 on the +# trackball side). +SPLIT_KEYBOARD = yes + +POINTING_DEVICE_ENABLE = yes # Enable trackball +POINTING_DEVICE_DRIVER = pmw3360 +MOUSE_SHARED_EP = no # Unify multiple HID interfaces into a single Endpoint +KEYBOARD_SHARED_EP = yes + +EEPROM_DRIVER = spi +WS2812_DRIVER = pwm +SERIAL_DRIVER = usart + +DEBOUNCE_TYPE = asym_eager_defer_pk diff --git a/keyboards/bastardkb/charybdis/4x6/config.h b/keyboards/bastardkb/charybdis/4x6/config.h index 6760129ef8..f0c1f48cdf 100644 --- a/keyboards/bastardkb/charybdis/4x6/config.h +++ b/keyboards/bastardkb/charybdis/4x6/config.h @@ -18,55 +18,24 @@ #pragma once -#define VENDOR_ID 0xA8F8 -#define PRODUCT_ID 0x1833 -#define DEVICE_VER 0x0001 -#define MANUFACTURER Bastard Keyboards -#define PRODUCT Charybdis +#include "config_common.h" /* Key matrix configuration. */ - -// Rows are doubled-up. -#define MATRIX_ROWS 10 +#define MATRIX_ROWS 10 // Rows are doubled-up. #define MATRIX_COLS 6 -// Wiring configuration for each half. -#define MATRIX_ROW_PINS \ - { F1, B7, C6, D4, B5 } -#define MATRIX_COL_PINS \ - { D5, C7, F0, D7, E6, B4 } - -#define MATRIX_ROW_PINS_RIGHT \ - { D5, F0, C6, D4, B5 } -#define MATRIX_COL_PINS_RIGHT \ - { F1, C7, B7, D7, E6, B4 } - #define DIODE_DIRECTION ROW2COL -#define ROTATIONAL_TRANSFORM_ANGLE -25 - -/* Handedness. */ -#define MASTER_RIGHT - -/* Bootmagic Lite configuration. */ -#define BOOTMAGIC_LITE_ROW 0 -#define BOOTMAGIC_LITE_COLUMN 0 -#define BOOTMAGIC_LITE_ROW_RIGHT 5 -#define BOOTMAGIC_LITE_COLUMN_RIGHT 0 - -/* serial.c configuration (for split keyboard) */ -#define SOFT_SERIAL_PIN D2 - -/* Set 0 if debouncing isn't needed */ +/* Set 0 if debouncing isn't needed. */ #define DEBOUNCE 5 -/* PMW33XX settings. */ -#define PMW33XX_CS_PIN B0 +/* Trackball angle adjustment. */ +#define ROTATIONAL_TRANSFORM_ANGLE -25 -#define RGB_DI_PIN D3 -#define RGBLED_NUM 56 +/* RGB settings. */ +#define RGBLED_NUM 58 #define RGBLED_SPLIT \ - { 29, 27 } + { 29, 29 } /* RGB matrix support. */ #ifdef RGB_MATRIX_ENABLE diff --git a/keyboards/bastardkb/charybdis/4x6/info.json b/keyboards/bastardkb/charybdis/4x6/info.json index 956dfe88f5..4bd0983709 100644 --- a/keyboards/bastardkb/charybdis/4x6/info.json +++ b/keyboards/bastardkb/charybdis/4x6/info.json @@ -1,7 +1,8 @@ { - "keyboard_name": "Charybdis", - "url": "https://www.bastardkb.com", - "maintainer": "Quentin Lebastard", + "url": "https://bastardkb.com/charybdis", + "usb": { + "pid": "0x1833", + }, "layouts": { "LAYOUT_charybdis_4x6": { "layout": [ diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/default/keymap.c b/keyboards/bastardkb/charybdis/4x6/keymaps/default/keymap.c index 1d3142faac..e0cee41221 100644 --- a/keyboards/bastardkb/charybdis/4x6/keymaps/default/keymap.c +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/default/keymap.c @@ -50,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ RGB_TOG, KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, KC_PPLS, KC_P4, KC_P5, KC_P6, KC_PMNS, KC_PEQL, // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ - RGB_RMOD, XXXXXXX, XXXXXXX, XXXXXXX, EEP_RST, QK_BOOT, KC_PAST, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_PDOT, + RGB_RMOD, XXXXXXX, XXXXXXX, XXXXXXX, EEP_RST, QK_BOOT, KC_PAST, KC_P1, KC_P2, KC_P3, KC_PSLS, KC_PDOT, // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ XXXXXXX, XXXXXXX, _______, XXXXXXX, _______, XXXXXXX, XXXXXXX, KC_P0 @@ -65,7 +65,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ KC_MPLY, KC_LEFT, KC_UP, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, KC_RSFT, KC_RCTL, KC_RALT, KC_RGUI, KC_MUTE, // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ - KC_MPRV, KC_HOME, KC_PGUP, KC_PGDN, KC_END, XXXXXXX, QK_BOOT, EEP_RST, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLD, + KC_MPRV, KC_HOME, KC_PGUP, KC_PGDN, KC_END, XXXXXXX, QK_BOOT, EEP_RST, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLD, // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ _______, _______, XXXXXXX, _______, XXXXXXX, _______, _______, XXXXXXX diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/via/config.h b/keyboards/bastardkb/charybdis/4x6/keymaps/via/config.h index 75eb2240f3..c31e39261e 100644 --- a/keyboards/bastardkb/charybdis/4x6/keymaps/via/config.h +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/via/config.h @@ -19,7 +19,7 @@ #ifdef VIA_ENABLE /* VIA configuration. */ # define DYNAMIC_KEYMAP_LAYER_COUNT 4 -#endif // VIA_ENABLE +#endif // VIA_ENABLE /* Disable unused features. */ #define NO_ACTION_ONESHOT @@ -33,21 +33,16 @@ * See docs.qmk.fm/using-qmk/software-features/tap_hold#tapping-term */ # define TAPPING_TERM 200 -#endif // TAPPING_TERM +#endif // TAPPING_TERM /* Charybdis-specific features. */ #ifdef POINTING_DEVICE_ENABLE -// Enable pointer acceleration, which increases the speed by ~2x for large -// displacement, while maintaining 1x speed for slow movements. -// - `CHARYBDIS_POINTER_ACCELERATION_FACTOR` -# define CHARYBDIS_POINTER_ACCELERATION_ENABLE - // Automatically enable the pointer layer when moving the trackball. See also: // - `CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS` // - `CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD` // #define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE -#endif // POINTING_DEVICE_ENABLE +#endif // POINTING_DEVICE_ENABLE /* RGB Matrix. */ @@ -69,4 +64,4 @@ # define RGB_MATRIX_STARTUP_SAT 255 # define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS # define RGB_MATRIX_STARTUP_HSV RGB_MATRIX_STARTUP_HUE, RGB_MATRIX_STARTUP_SAT, RGB_MATRIX_STARTUP_VAL -#endif // RGB_MATRIX_ENABLE +#endif // RGB_MATRIX_ENABLE diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/via/keymap.c b/keyboards/bastardkb/charybdis/4x6/keymaps/via/keymap.c index cf24fea3c0..8c55855af1 100644 --- a/keyboards/bastardkb/charybdis/4x6/keymaps/via/keymap.c +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/via/keymap.c @@ -18,7 +18,7 @@ #ifdef CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE # include "timer.h" -#endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE +#endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE enum charybdis_keymap_layers { LAYER_BASE = 0, @@ -35,18 +35,25 @@ static uint16_t auto_pointer_layer_timer = 0; # ifndef CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS # define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS 1000 -# endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS +# endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS # ifndef CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD # define CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD 8 -# endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD -#endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE +# endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_THRESHOLD +#endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE #define LOWER MO(LAYER_LOWER) #define RAISE MO(LAYER_RAISE) #define PT_Z LT(LAYER_POINTER, KC_Z) #define PT_SLSH LT(LAYER_POINTER, KC_SLSH) +#ifndef POINTING_DEVICE_ENABLE +# define DRGSCRL KC_NO +# define DPI_MOD KC_NO +# define S_D_MOD KC_NO +# define SNIPING KC_NO +#endif // !POINTING_DEVICE_ENABLE + // clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [LAYER_BASE] = LAYOUT_charybdis_4x6( @@ -102,7 +109,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ XXXXXXX, KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, XXXXXXX, KC_RSFT, KC_RCTL, KC_RALT, KC_RGUI, XXXXXXX, // ├──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────┤ - XXXXXXX, _______, DRGSCRL, SNIPING, EEP_RST, QK_BOOT, QK_BOOT, EEP_RST, SNIPING, DRGSCRL, _______, XXXXXXX, + XXXXXXX, _______, DRGSCRL, SNIPING, EEP_RST, QK_BOOT, QK_BOOT, EEP_RST, SNIPING, DRGSCRL, _______, XXXXXXX, // ╰──────────────────────────────────────────────────────┤ ├──────────────────────────────────────────────────────╯ KC_BTN2, KC_BTN1, KC_BTN3, KC_BTN3, KC_BTN1, XXXXXXX, KC_BTN2, KC_BTN2 @@ -120,33 +127,31 @@ report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { # ifdef RGB_MATRIX_ENABLE rgb_matrix_mode_noeeprom(RGB_MATRIX_NONE); rgb_matrix_sethsv_noeeprom(HSV_GREEN); -# endif // RGB_MATRIX_ENABLE +# endif // RGB_MATRIX_ENABLE } auto_pointer_layer_timer = timer_read(); } return mouse_report; } -void matrix_scan_kb(void) { +void matrix_scan_user(void) { if (auto_pointer_layer_timer != 0 && TIMER_DIFF_16(timer_read(), auto_pointer_layer_timer) >= CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_TIMEOUT_MS) { auto_pointer_layer_timer = 0; layer_off(LAYER_POINTER); # ifdef RGB_MATRIX_ENABLE rgb_matrix_mode_noeeprom(RGB_MATRIX_STARTUP_MODE); -# endif // RGB_MATRIX_ENABLE +# endif // RGB_MATRIX_ENABLE } - matrix_scan_user(); } -# endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE +# endif // CHARYBDIS_AUTO_POINTER_LAYER_TRIGGER_ENABLE # ifdef CHARYBDIS_AUTO_SNIPING_ON_LAYER -layer_state_t layer_state_set_kb(layer_state_t state) { - state = layer_state_set_user(state); +layer_state_t layer_state_set_user(layer_state_t state) { charybdis_set_pointer_sniping_enabled(layer_state_cmp(state, CHARYBDIS_AUTO_SNIPING_ON_LAYER)); return state; } -# endif // CHARYBDIS_AUTO_SNIPING_ON_LAYER -#endif // POINTING_DEVICE_ENABLE +# endif // CHARYBDIS_AUTO_SNIPING_ON_LAYER +#endif // POINTING_DEVICE_ENABLE #ifdef RGB_MATRIX_ENABLE // Forward-declare this helper function since it is defined in rgb_matrix.c. @@ -158,9 +163,9 @@ void shutdown_user(void) { rgblight_enable_noeeprom(); rgblight_mode_noeeprom(1); rgblight_setrgb_red(); -#endif // RGBLIGHT_ENABLE +#endif // RGBLIGHT_ENABLE #ifdef RGB_MATRIX_ENABLE rgb_matrix_set_color_all(RGB_RED); rgb_matrix_update_pwm_buffers(); -#endif // RGB_MATRIX_ENABLE +#endif // RGB_MATRIX_ENABLE } diff --git a/keyboards/bastardkb/charybdis/4x6/v1/elitec/config.h b/keyboards/bastardkb/charybdis/4x6/v1/elitec/config.h new file mode 100644 index 0000000000..15044ef645 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/v1/elitec/config.h @@ -0,0 +1,42 @@ +/* + * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna) + * Copyright 2021 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 + +/* Key matrix configuration. */ +#define MATRIX_ROW_PINS \ + { F1, B7, C6, D4, B5 } +#define MATRIX_COL_PINS \ + { D5, C7, F0, D7, E6, B4 } + +#define MATRIX_ROW_PINS_RIGHT \ + { D5, F0, C6, D4, B5 } +#define MATRIX_COL_PINS_RIGHT \ + { F1, C7, B7, D7, E6, B4 } + +/* Handedness. */ +#define MASTER_RIGHT + +/* serial.c configuration (for split keyboard). */ +#define SOFT_SERIAL_PIN D2 + +/* RGB settings. */ +#define RGB_DI_PIN D3 + +/* PMW3360 settings. */ +#define PMW33XX_CS_PIN B0 diff --git a/keyboards/bastardkb/charybdis/4x6/v1/elitec/info.json b/keyboards/bastardkb/charybdis/4x6/v1/elitec/info.json new file mode 100644 index 0000000000..4ea658a7d9 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/v1/elitec/info.json @@ -0,0 +1,6 @@ +{ + "keyboard_name": "Charybdis (4x6) Elite-C", + "usb": { + "device_version": "1.0.0", + }, +} diff --git a/keyboards/bastardkb/charybdis/4x6/rules.mk b/keyboards/bastardkb/charybdis/4x6/v1/elitec/rules.mk index e137f5d4cc..fa5fe80405 100644 --- a/keyboards/bastardkb/charybdis/4x6/rules.mk +++ b/keyboards/bastardkb/charybdis/4x6/v1/elitec/rules.mk @@ -23,15 +23,14 @@ RGBLIGHT_SUPPORTED = yes # RGB underglow is supported, but not enabled by def RGB_MATRIX_ENABLE = yes # Enable keyboard RGB matrix functionality RGB_MATRIX_DRIVER = WS2812 -# Enable link-time optimization by default. The Charybdis packs a lot of -# features (RGB, Via, trackball) in a small atmega32u4 package. -LTO_ENABLE = yes - # Charybdis is a split 4x6 keyboard with a maximum of 5 thumb keys (3 on the # trackball side). SPLIT_KEYBOARD = yes POINTING_DEVICE_ENABLE = yes # Enable trackball POINTING_DEVICE_DRIVER = pmw3360 -# https://qmk.fm/changes/2018-11-16-use-a-single-endpoint-for-hid-reports MOUSE_SHARED_EP = no # Unify multiple HID interfaces into a single Endpoint + +# Enable link-time optimization by default. The Charybdis packs a lot of +# features (RGB, Via, trackball) in a small atmega32u4 package. +LTO_ENABLE = yes diff --git a/keyboards/bastardkb/charybdis/4x6/v2/elitec/config.h b/keyboards/bastardkb/charybdis/4x6/v2/elitec/config.h new file mode 100644 index 0000000000..891e511ccb --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/v2/elitec/config.h @@ -0,0 +1,36 @@ +/* + * 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 + +/* Key matrix configuration. */ +#define MATRIX_ROW_PINS \ + { F4, F7, C6, D4, B5 } +#define MATRIX_COL_PINS \ + { F6, F5, B6, D7, E6, B4 } + +/* Handedness. */ +#define MASTER_RIGHT + +/* serial.c configuration (for split keyboard). */ +#define SOFT_SERIAL_PIN D2 + +/* RGB settings. */ +#define RGB_DI_PIN D3 + +/* PMW3360 settings. */ +#define PMW33XX_CS_PIN F0 diff --git a/keyboards/bastardkb/charybdis/4x6/v2/elitec/info.json b/keyboards/bastardkb/charybdis/4x6/v2/elitec/info.json new file mode 100644 index 0000000000..151c0e1ca3 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/v2/elitec/info.json @@ -0,0 +1,6 @@ +{ + "keyboard_name": "Charybdis (4x6) Elite-C", + "usb": { + "device_version": "2.0.0", + }, +} diff --git a/keyboards/bastardkb/charybdis/4x6/v2/elitec/rules.mk b/keyboards/bastardkb/charybdis/4x6/v2/elitec/rules.mk new file mode 100644 index 0000000000..fa5fe80405 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/v2/elitec/rules.mk @@ -0,0 +1,36 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output + +AUDIO_SUPPORTED = no # Audio is not supported. +RGB_MATRIX_SUPPORTED = yes # RGB matrix is supported and enabled by default. +RGBLIGHT_SUPPORTED = yes # RGB underglow is supported, but not enabled by default. +RGB_MATRIX_ENABLE = yes # Enable keyboard RGB matrix functionality +RGB_MATRIX_DRIVER = WS2812 + +# Charybdis is a split 4x6 keyboard with a maximum of 5 thumb keys (3 on the +# trackball side). +SPLIT_KEYBOARD = yes + +POINTING_DEVICE_ENABLE = yes # Enable trackball +POINTING_DEVICE_DRIVER = pmw3360 +MOUSE_SHARED_EP = no # Unify multiple HID interfaces into a single Endpoint + +# Enable link-time optimization by default. The Charybdis packs a lot of +# features (RGB, Via, trackball) in a small atmega32u4 package. +LTO_ENABLE = yes diff --git a/keyboards/bastardkb/charybdis/4x6/v2/splinky/config.h b/keyboards/bastardkb/charybdis/4x6/v2/splinky/config.h new file mode 100644 index 0000000000..e17ec49726 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/v2/splinky/config.h @@ -0,0 +1,50 @@ +/* + * 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 + +/* Key matrix configuration. */ +#define MATRIX_ROW_PINS \ + { GP29, GP26, GP5, GP4, GP9 } +#define MATRIX_COL_PINS \ + { GP27, GP28, GP15, GP6, GP7, GP8 } + +/* Handedness. */ +#define MASTER_RIGHT + +// To use the handedness pin, resistors need to be installed on the adapter PCB. +// If so, uncomment the following code, and undefine MASTER_RIGHT above. +// #define SPLIT_HAND_PIN GP13 +// #define SPLIT_HAND_PIN_LOW_IS_LEFT // High -> right, Low -> left. + +/* serial.c configuration (for split keyboard). */ +#define SOFT_SERIAL_PIN GP1 + +/* RGB settings. */ +#define RGB_DI_PIN GP0 + +/* SPI & PMW3360 settings. */ +#define SPI_DRIVER SPID0 +#define SPI_SCK_PIN GP18 +#define SPI_MOSI_PIN GP19 +#define SPI_MISO_PIN GP20 +#define PMW33XX_CS_PIN GP14 + +/* Reset. */ +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP17 +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 1000U diff --git a/keyboards/bastardkb/charybdis/4x6/v2/splinky/info.json b/keyboards/bastardkb/charybdis/4x6/v2/splinky/info.json new file mode 100644 index 0000000000..0004eb81c9 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/v2/splinky/info.json @@ -0,0 +1,6 @@ +{ + "keyboard_name": "Charybdis (4x6) Splinky", + "usb": { + "device_version": "2.0.0", + }, +} diff --git a/keyboards/bastardkb/charybdis/4x6/v2/splinky/mcuconf.h b/keyboards/bastardkb/charybdis/4x6/v2/splinky/mcuconf.h new file mode 100644 index 0000000000..0fdd67c3a2 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/v2/splinky/mcuconf.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 + +#include_next "mcuconf.h" + +#undef RP_SPI_USE_SPI0 +#define RP_SPI_USE_SPI0 TRUE diff --git a/keyboards/bastardkb/charybdis/4x6/v2/splinky/rules.mk b/keyboards/bastardkb/charybdis/4x6/v2/splinky/rules.mk new file mode 100644 index 0000000000..13c1b39961 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/v2/splinky/rules.mk @@ -0,0 +1,36 @@ +# MCU name +MCU = RP2040 + +# Bootloader selection +BOOTLOADER = rp2040 + +# RP2040-specific options +ALLOW_WARNINGS = yes +PICO_INTRINSICS_ENABLED = no # ATM Unsupported by ChibiOS. + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output + +AUDIO_SUPPORTED = no # Audio is not supported +RGB_MATRIX_SUPPORTED = yes # RGB matrix is supported and enabled by default +RGBLIGHT_SUPPORTED = yes # RGB underglow is supported, but not enabled by default +RGB_MATRIX_ENABLE = yes # Enable keyboard RGB matrix functionality +RGB_MATRIX_DRIVER = WS2812 + +SPLIT_KEYBOARD = yes + +POINTING_DEVICE_ENABLE = yes # Enable trackball +POINTING_DEVICE_DRIVER = pmw3360 + +SERIAL_DRIVER = vendor +WS2812_DRIVER = vendor diff --git a/keyboards/bastardkb/charybdis/charybdis.c b/keyboards/bastardkb/charybdis/charybdis.c index 29603042b2..d0619ef172 100644 --- a/keyboards/bastardkb/charybdis/charybdis.c +++ b/keyboards/bastardkb/charybdis/charybdis.c @@ -23,43 +23,39 @@ #ifdef CONSOLE_ENABLE # include "print.h" -#endif // CONSOLE_ENABLE +#endif // CONSOLE_ENABLE #ifdef POINTING_DEVICE_ENABLE # ifndef CHARYBDIS_MINIMUM_DEFAULT_DPI # define CHARYBDIS_MINIMUM_DEFAULT_DPI 400 -# endif // CHARYBDIS_MINIMUM_DEFAULT_DPI +# endif // CHARYBDIS_MINIMUM_DEFAULT_DPI # ifndef CHARYBDIS_DEFAULT_DPI_CONFIG_STEP # define CHARYBDIS_DEFAULT_DPI_CONFIG_STEP 200 -# endif // CHARYBDIS_DEFAULT_DPI_CONFIG_STEP +# endif // CHARYBDIS_DEFAULT_DPI_CONFIG_STEP # ifndef CHARYBDIS_MINIMUM_SNIPING_DPI # define CHARYBDIS_MINIMUM_SNIPING_DPI 200 -# endif // CHARYBDIS_MINIMUM_SNIPER_MODE_DPI +# endif // CHARYBDIS_MINIMUM_SNIPER_MODE_DPI # ifndef CHARYBDIS_SNIPING_DPI_CONFIG_STEP # define CHARYBDIS_SNIPING_DPI_CONFIG_STEP 100 -# endif // CHARYBDIS_SNIPING_DPI_CONFIG_STEP +# endif // CHARYBDIS_SNIPING_DPI_CONFIG_STEP // Fixed DPI for drag-scroll. # ifndef CHARYBDIS_DRAGSCROLL_DPI # define CHARYBDIS_DRAGSCROLL_DPI 100 -# endif // CHARYBDIS_DRAGSCROLL_DPI +# endif // CHARYBDIS_DRAGSCROLL_DPI # ifndef CHARYBDIS_DRAGSCROLL_BUFFER_SIZE # define CHARYBDIS_DRAGSCROLL_BUFFER_SIZE 6 -# endif // !CHARYBDIS_DRAGSCROLL_BUFFER_SIZE - -# ifndef CHARYBDIS_POINTER_ACCELERATION_FACTOR -# define CHARYBDIS_POINTER_ACCELERATION_FACTOR 24 -# endif // !CHARYBDIS_POINTER_ACCELERATION_FACTOR +# endif // !CHARYBDIS_DRAGSCROLL_BUFFER_SIZE typedef union { uint8_t raw; struct { - uint8_t pointer_default_dpi : 4; // 16 steps available. - uint8_t pointer_sniping_dpi : 2; // 4 steps available. + uint8_t pointer_default_dpi : 4; // 16 steps available. + uint8_t pointer_sniping_dpi : 2; // 4 steps available. bool is_dragscroll_enabled : 1; bool is_sniping_enabled : 1; } __attribute__((packed)); @@ -89,13 +85,19 @@ static void read_charybdis_config_from_eeprom(charybdis_config_t* config) { * resets these 2 values to `false` since it does not make sense to persist * these across reboots of the board. */ -static void write_charybdis_config_to_eeprom(charybdis_config_t* config) { eeconfig_update_kb(config->raw); } +static void write_charybdis_config_to_eeprom(charybdis_config_t* config) { + eeconfig_update_kb(config->raw); +} /** \brief Return the current value of the pointer's default DPI. */ -static uint16_t get_pointer_default_dpi(charybdis_config_t* config) { return (uint16_t)config->pointer_default_dpi * CHARYBDIS_DEFAULT_DPI_CONFIG_STEP + CHARYBDIS_MINIMUM_DEFAULT_DPI; } +static uint16_t get_pointer_default_dpi(charybdis_config_t* config) { + return (uint16_t)config->pointer_default_dpi * CHARYBDIS_DEFAULT_DPI_CONFIG_STEP + CHARYBDIS_MINIMUM_DEFAULT_DPI; +} /** \brief Return the current value of the pointer's sniper-mode DPI. */ -static uint16_t get_pointer_sniping_dpi(charybdis_config_t* config) { return (uint16_t)config->pointer_sniping_dpi * CHARYBDIS_SNIPING_DPI_CONFIG_STEP + CHARYBDIS_MINIMUM_SNIPING_DPI; } +static uint16_t get_pointer_sniping_dpi(charybdis_config_t* config) { + return (uint16_t)config->pointer_sniping_dpi * CHARYBDIS_SNIPING_DPI_CONFIG_STEP + CHARYBDIS_MINIMUM_SNIPING_DPI; +} /** \brief Set the appropriate DPI for the input config. */ static void maybe_update_pointing_device_cpi(charybdis_config_t* config) { @@ -130,64 +132,54 @@ static void step_pointer_sniping_dpi(charybdis_config_t* config, bool forward) { maybe_update_pointing_device_cpi(config); } -uint16_t charybdis_get_pointer_default_dpi(void) { return get_pointer_default_dpi(&g_charybdis_config); } +uint16_t charybdis_get_pointer_default_dpi(void) { + return get_pointer_default_dpi(&g_charybdis_config); +} -uint16_t charybdis_get_pointer_sniping_dpi(void) { return get_pointer_sniping_dpi(&g_charybdis_config); } +uint16_t charybdis_get_pointer_sniping_dpi(void) { + return get_pointer_sniping_dpi(&g_charybdis_config); +} -void charybdis_cycle_pointer_default_dpi_noeeprom(bool forward) { step_pointer_default_dpi(&g_charybdis_config, forward); } +void charybdis_cycle_pointer_default_dpi_noeeprom(bool forward) { + step_pointer_default_dpi(&g_charybdis_config, forward); +} void charybdis_cycle_pointer_default_dpi(bool forward) { step_pointer_default_dpi(&g_charybdis_config, forward); write_charybdis_config_to_eeprom(&g_charybdis_config); } -void charybdis_cycle_pointer_sniping_dpi_noeeprom(bool forward) { step_pointer_sniping_dpi(&g_charybdis_config, forward); } +void charybdis_cycle_pointer_sniping_dpi_noeeprom(bool forward) { + step_pointer_sniping_dpi(&g_charybdis_config, forward); +} void charybdis_cycle_pointer_sniping_dpi(bool forward) { step_pointer_sniping_dpi(&g_charybdis_config, forward); write_charybdis_config_to_eeprom(&g_charybdis_config); } -bool charybdis_get_pointer_sniping_enabled(void) { return g_charybdis_config.is_sniping_enabled; } +bool charybdis_get_pointer_sniping_enabled(void) { + return g_charybdis_config.is_sniping_enabled; +} void charybdis_set_pointer_sniping_enabled(bool enable) { g_charybdis_config.is_sniping_enabled = enable; maybe_update_pointing_device_cpi(&g_charybdis_config); } -bool charybdis_get_pointer_dragscroll_enabled(void) { return g_charybdis_config.is_dragscroll_enabled; } +bool charybdis_get_pointer_dragscroll_enabled(void) { + return g_charybdis_config.is_dragscroll_enabled; +} void charybdis_set_pointer_dragscroll_enabled(bool enable) { g_charybdis_config.is_dragscroll_enabled = enable; maybe_update_pointing_device_cpi(&g_charybdis_config); } -# ifndef CONSTRAIN_HID -# define CONSTRAIN_HID(value) ((value) < XY_REPORT_MIN ? XY_REPORT_MIN : ((value) > XY_REPORT_MAX ? XY_REPORT_MAX : (value))) -# endif // !CONSTRAIN_HID - -/** - * \brief Add optional acceleration effect. - * - * If `CHARYBDIS_ENABLE_POINTER_ACCELERATION` is defined, add a simple and naive - * acceleration effect to the provided value. Return the value unchanged - * otherwise. - */ -# ifndef DISPLACEMENT_WITH_ACCELERATION -# ifdef CHARYBDIS_POINTER_ACCELERATION_ENABLE -# define DISPLACEMENT_WITH_ACCELERATION(d) (CONSTRAIN_HID(d > 0 ? d * d / CHARYBDIS_POINTER_ACCELERATION_FACTOR + d : -d * d / CHARYBDIS_POINTER_ACCELERATION_FACTOR + d)) -# else // !CHARYBDIS_POINTER_ACCELERATION_ENABLE -# define DISPLACEMENT_WITH_ACCELERATION(d) (d) -# endif // CHARYBDIS_POINTER_ACCELERATION_ENABLE -# endif // !DISPLACEMENT_WITH_ACCELERATION - /** * \brief Augment the pointing device behavior. * - * Implement the Charybdis-specific features for pointing devices: - * - Drag-scroll - * - Sniping - * - Acceleration + * Implement drag-scroll. */ static void pointing_device_task_charybdis(report_mouse_t* mouse_report) { static int16_t scroll_buffer_x = 0; @@ -197,12 +189,12 @@ static void pointing_device_task_charybdis(report_mouse_t* mouse_report) { scroll_buffer_x -= mouse_report->x; # else scroll_buffer_x += mouse_report->x; -# endif // CHARYBDIS_DRAGSCROLL_REVERSE_X +# endif // CHARYBDIS_DRAGSCROLL_REVERSE_X # ifdef CHARYBDIS_DRAGSCROLL_REVERSE_Y scroll_buffer_y -= mouse_report->y; # else scroll_buffer_y += mouse_report->y; -# endif // CHARYBDIS_DRAGSCROLL_REVERSE_Y +# endif // CHARYBDIS_DRAGSCROLL_REVERSE_Y mouse_report->x = 0; mouse_report->y = 0; if (abs(scroll_buffer_x) > CHARYBDIS_DRAGSCROLL_BUFFER_SIZE) { @@ -213,9 +205,6 @@ static void pointing_device_task_charybdis(report_mouse_t* mouse_report) { mouse_report->v = scroll_buffer_y > 0 ? 1 : -1; scroll_buffer_y = 0; } - } else if (!g_charybdis_config.is_sniping_enabled) { - mouse_report->x = DISPLACEMENT_WITH_ACCELERATION(mouse_report->x); - mouse_report->y = DISPLACEMENT_WITH_ACCELERATION(mouse_report->y); } } @@ -234,9 +223,9 @@ static bool has_shift_mod(void) { return mod_config(get_mods()) & MOD_MASK_SHIFT; # else return mod_config(get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT; -# endif // NO_ACTION_ONESHOT +# endif // NO_ACTION_ONESHOT } -# endif // POINTING_DEVICE_ENABLE && !NO_CHARYBDIS_KEYCODES +# endif // POINTING_DEVICE_ENABLE && !NO_CHARYBDIS_KEYCODES /** * \brief Outputs the Charybdis configuration to console. @@ -252,16 +241,16 @@ static bool has_shift_mod(void) { static void debug_charybdis_config_to_console(charybdis_config_t* config) { # ifdef CONSOLE_ENABLE dprintf("(charybdis) process_record_kb: config = {\n" - "\traw = 0x%04X,\n" + "\traw = 0x%X,\n" "\t{\n" "\t\tis_dragscroll_enabled=%b\n" "\t\tis_sniping_enabled=%b\n" - "\t\tdefault_dpi=0x%02X (%ld)\n" - "\t\tsniping_dpi=0x%01X (%ld)\n" + "\t\tdefault_dpi=0x%X (%ld)\n" + "\t\tsniping_dpi=0x%X (%ld)\n" "\t}\n" "}\n", config->raw, config->is_dragscroll_enabled, config->is_sniping_enabled, config->pointer_default_dpi, get_pointer_default_dpi(config), config->pointer_sniping_dpi, get_pointer_sniping_dpi(config)); -# endif // CONSOLE_ENABLE +# endif // CONSOLE_ENABLE } bool process_record_kb(uint16_t keycode, keyrecord_t* record) { @@ -313,7 +302,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) { } break; } -# endif // !NO_CHARYBDIS_KEYCODES +# endif // !NO_CHARYBDIS_KEYCODES # ifndef MOUSEKEY_ENABLE // Simulate mouse keys if full support is not enabled (reduces firmware size // while maintaining support for mouse keys). @@ -323,8 +312,8 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) { pointing_device_set_report(mouse_report); pointing_device_send(); } -# endif // !MOUSEKEY_ENABLE -# endif // POINTING_DEVICE_ENABLE +# endif // !MOUSEKEY_ENABLE +# endif // POINTING_DEVICE_ENABLE debug_charybdis_config_to_console(&g_charybdis_config); return true; } @@ -360,29 +349,44 @@ void keyboard_post_init_kb(void) { # ifdef CHARYBDIS_CONFIG_SYNC void housekeeping_task_kb(void) { if (is_keyboard_master()) { - // Keep track of the last state, so that we can tell if we need to propagate to slave + // Keep track of the last state, so that we can tell if we need to propagate to slave. static charybdis_config_t last_charybdis_config = {0}; static uint32_t last_sync = 0; bool needs_sync = false; - // Check if the state values are different + // Check if the state values are different. if (memcmp(&g_charybdis_config, &last_charybdis_config, sizeof(g_charybdis_config))) { needs_sync = true; memcpy(&last_charybdis_config, &g_charybdis_config, sizeof(g_charybdis_config)); } - // Send to slave every 500ms regardless of state change + // Send to slave every 500ms regardless of state change. if (timer_elapsed32(last_sync) > 500) { needs_sync = true; } - // Perform the sync if requested + // Perform the sync if requested. if (needs_sync) { if (transaction_rpc_send(RPC_ID_KB_CONFIG_SYNC, sizeof(g_charybdis_config), &g_charybdis_config)) { last_sync = timer_read32(); } } } - // no need for user function, is called already + // No need to invoke the user-specific callback, as it's been called + // already. } # endif // CHARYBDIS_CONFIG_SYNC -#endif // POINTING_DEVICE_ENABLE +#endif // POINTING_DEVICE_ENABLE + +#if defined(KEYBOARD_bastardkb_charybdis_3x5_blackpill) || defined(KEYBOARD_bastardkb_charybdis_4x6_blackpill) +void keyboard_pre_init_kb(void) { + setPinInputHigh(A0); + keyboard_pre_init_user(); +} + +void matrix_scan_kb(void) { + if (!readPin(A0)) { + reset_keyboard(); + } + matrix_scan_user(); +} +#endif // KEYBOARD_bastardkb_charybdis_3x5_blackpill || KEYBOARD_bastardkb_charybdis_4x6_blackpill diff --git a/keyboards/bastardkb/charybdis/charybdis.h b/keyboards/bastardkb/charybdis/charybdis.h index 42423c0c92..f624c554f4 100644 --- a/keyboards/bastardkb/charybdis/charybdis.h +++ b/keyboards/bastardkb/charybdis/charybdis.h @@ -21,6 +21,8 @@ // clang-format off #if defined(KEYBOARD_bastardkb_charybdis_3x5) # include "3x5.h" +#elif defined(KEYBOARD_bastardkb_charybdis_3x6) +# include "3x6.h" #elif defined(KEYBOARD_bastardkb_charybdis_4x6) # include "4x6.h" #else @@ -37,7 +39,7 @@ enum charybdis_keycodes { POINTER_DEFAULT_DPI_FORWARD = USER00, # else POINTER_DEFAULT_DPI_FORWARD = SAFE_RANGE, -# endif // VIA_ENABLE +# endif // VIA_ENABLE POINTER_DEFAULT_DPI_REVERSE, POINTER_SNIPING_DPI_FORWARD, POINTER_SNIPING_DPI_REVERSE, @@ -56,7 +58,7 @@ enum charybdis_keycodes { # define SNP_TOG SNIPING_MODE_TOGGLE # define DRGSCRL DRAGSCROLL_MODE # define DRG_TOG DRAGSCROLL_MODE_TOGGLE -# endif // !NO_CHARYBDIS_KEYCODES +# endif // !NO_CHARYBDIS_KEYCODES /** \brief Return the current DPI value for the pointer's default mode. */ uint16_t charybdis_get_pointer_default_dpi(void); @@ -123,4 +125,4 @@ bool charybdis_get_pointer_dragscroll_enabled(void); * are translated into horizontal and vertical scroll movements. */ void charybdis_set_pointer_dragscroll_enabled(bool enable); -#endif // POINTING_DEVICE_ENABLE +#endif // POINTING_DEVICE_ENABLE diff --git a/keyboards/bastardkb/charybdis/post_config.h b/keyboards/bastardkb/charybdis/post_config.h index b769722b64..4cfd24c4b6 100644 --- a/keyboards/bastardkb/charybdis/post_config.h +++ b/keyboards/bastardkb/charybdis/post_config.h @@ -30,85 +30,85 @@ #ifndef MOUSEKEY_MOVE_DELTA # ifndef MK_KINETIC_SPEED # define MOUSEKEY_MOVE_DELTA 5 -# else // MK_KINETIC_SPEED +# else // MK_KINETIC_SPEED # define MOUSEKEY_MOVE_DELTA 25 -# endif // !MK_KINETIC_SPEED -#endif // !MOUSEKEY_MOVE_DELTA +# endif // !MK_KINETIC_SPEED +#endif // !MOUSEKEY_MOVE_DELTA #ifndef MOUSEKEY_DELAY # ifndef MK_KINETIC_SPEED # define MOUSEKEY_DELAY 300 -# else // MK_KINETIC_SPEED +# else // MK_KINETIC_SPEED # define MOUSEKEY_DELAY 8 -# endif // !MK_KINETIC_SPEED -#endif // !MOUSEKEY_DELAY +# endif // !MK_KINETIC_SPEED +#endif // !MOUSEKEY_DELAY #ifndef MOUSEKEY_INTERVAL # ifndef MK_KINETIC_SPEED # define MOUSEKEY_INTERVAL 50 -# else // MK_KINETIC_SPEED +# else // MK_KINETIC_SPEED # define MOUSEKEY_INTERVAL 20 -# endif // !MK_KINETIC_SPEED -#endif // !MOUSEKEY_INTERNAL +# endif // !MK_KINETIC_SPEED +#endif // !MOUSEKEY_INTERNAL #ifndef MOUSEKEY_MAX_SPEED # define MOUSEKEY_MAX_SPEED 7 -#endif // !MOUSEKEY_MAX_SPEED +#endif // !MOUSEKEY_MAX_SPEED #ifndef MOUSEKEY_TIME_TO_MAX # define MOUSEKEY_TIME_TO_MAX 60 -#endif // !MOUSEKEY_TIME_TO_MAX +#endif // !MOUSEKEY_TIME_TO_MAX #ifndef MOUSEKEY_INITIAL_SPEED # define MOUSEKEY_INITIAL_SPEED 100 -#endif // !MOUSEKEY_INITIAL_SPEED +#endif // !MOUSEKEY_INITIAL_SPEED #ifndef MOUSEKEY_BASE_SPEED # define MOUSEKEY_BASE_SPEED 1000 -#endif // !MOUSEKEY_BASE_SPEED +#endif // !MOUSEKEY_BASE_SPEED #ifndef MOUSEKEY_DECELERATED_SPEED # define MOUSEKEY_DECELERATED_SPEED 400 -#endif // !MOUSEKEY_DECELERATED_SPEED +#endif // !MOUSEKEY_DECELERATED_SPEED #ifndef MOUSEKEY_ACCELERATED_SPEED # define MOUSEKEY_ACCELERATED_SPEED 3000 -#endif // !MOUSEKEY_ACCELERATED_SPEED +#endif // !MOUSEKEY_ACCELERATED_SPEED /* Mouse scroll config. */ #ifndef MOUSEKEY_WHEEL_DELAY # define MOUSEKEY_WHEEL_DELAY 15 -#endif // !MOUSEKEY_WHEEL_DELAY +#endif // !MOUSEKEY_WHEEL_DELAY #ifndef MOUSEKEY_WHEEL_DELTA # define MOUSEKEY_WHEEL_DELTA 1 -#endif // !MOUSEKEY_WHEEL_DELTA +#endif // !MOUSEKEY_WHEEL_DELTA #ifndef MOUSEKEY_WHEEL_INTERVAL # define MOUSEKEY_WHEEL_INTERVAL 50 -#endif // !MOUSEKEY_WHEEL_INTERVAL +#endif // !MOUSEKEY_WHEEL_INTERVAL #ifndef MOUSEKEY_WHEEL_MAX_SPEED # define MOUSEKEY_WHEEL_MAX_SPEED 8 -#endif // !MOUSEKEY_WHEEL_MAX_SPEED +#endif // !MOUSEKEY_WHEEL_MAX_SPEED #ifndef MOUSEKEY_WHEEL_TIME_TO_MAX # define MOUSEKEY_WHEEL_TIME_TO_MAX 80 -#endif // !MOUSEKEY_WHEEL_TIME_TO_MAX +#endif // !MOUSEKEY_WHEEL_TIME_TO_MAX #ifndef MOUSEKEY_WHEEL_INITIAL_MOVEMENTS # define MOUSEKEY_WHEEL_INITIAL_MOVEMENTS 8 -#endif // !MOUSEKEY_WHEEL_INITIAL_MOVEMENTS +#endif // !MOUSEKEY_WHEEL_INITIAL_MOVEMENTS #ifndef MOUSEKEY_WHEEL_BASE_MOVEMENTS # define MOUSEKEY_WHEEL_BASE_MOVEMENTS 48 -#endif // !MOUSEKEY_WHEEL_BASE_MOVEMENTS +#endif // !MOUSEKEY_WHEEL_BASE_MOVEMENTS #ifndef MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS # define MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS 48 -#endif // !MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS +#endif // !MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS #ifndef MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS # define MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS 8 -#endif // !MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS +#endif // !MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS diff --git a/keyboards/bastardkb/charybdis/readme.md b/keyboards/bastardkb/charybdis/readme.md index d786abf36e..c112c1150e 100644 --- a/keyboards/bastardkb/charybdis/readme.md +++ b/keyboards/bastardkb/charybdis/readme.md @@ -18,33 +18,32 @@ Check out the [keyboard build guides](https://docs.bastardkb.com) for the Charyb ## Building the firmware -### Charybdis (4x6) - -The `default` keymap is inspired from the original [Dactyl Manuform](../../handwired/dactyl_manuform) layout. +**You must specify the shield version when compiling/flashing the firmware.** +The template is: ```shell -qmk compile -kb bastardkb/charybdis/4x6 -km default +qmk compile -kb bastardkb/charybdis/{LAYOUT}/{VERSION}/elitec -km {KEYMAP} ``` -Check out the `via` layout if you're looking for VIA support: +See below for populated commands per layout -```shell -qmk compile -kb bastardkb/charybdis/4x6 -km via -``` +The `default` keymap is inspired from the original [Dactyl Manuform](../../handwired/dactyl_manuform) layout. -### Charybdis (3x5) +Check out the `via` layout if you're looking for VIA support. -The `default` keymap is inspired from the original [Dactyl Manuform](../../handwired/dactyl_manuform) layout. +### Charybdis (4x6) -```shell -qmk compile -kb bastardkb/charybdis/3x5 -km default -``` +| Shield Version | default | via | +|----------------|-----------------------------------------------------------------|-----------------------------------------------------------------| +| v1 | `qmk compile -kb bastardkb/charybdis/4x6/v1/elitec -km default` | `qmk compile -kb bastardkb/charybdis/4x6/v1/elitec -km via` | +| v2 | `qmk compile -kb bastardkb/charybdis/4x6/v2/elitec -km default` | `qmk compile -kb bastardkb/charybdis/4x6/v2/elitec -km via` | -Check out the `via` layout if you're looking for VIA support: +### Charybdis (3x5) -```shell -qmk compile -kb bastardkb/charybdis/3x5 -km via -``` +| Shield Version | default | via | +|----------------|-----------------------------------------------------------------|-----------------------------------------------------------------| +| v1 | `qmk compile -kb bastardkb/charybdis/3x5/v1/elitec -km default` | `qmk compile -kb bastardkb/charybdis/3x5/v1/elitec -km via` | +| v2 | `qmk compile -kb bastardkb/charybdis/3x5/v2/elitec -km default` | `qmk compile -kb bastardkb/charybdis/3x5/v2/elitec -km via` | ## Customizing the firmware @@ -73,7 +72,7 @@ Drag-scroll enables scrolling with the trackball. When drag-scroll is enabled, t Call `charybdis_set_pointer_dragscroll_enabled(bool enable)` to enable/disable drag-scroll. -`charybdis_get_pointer_dragscroll_enabled()` returns whether sniping mode is currently enabled. +`charybdis_get_pointer_dragscroll_enabled()` returns whether drag-scroll mode is currently enabled. To invert the horizontal scrolling direction, define `CHARYBDIS_DRAGSCROLL_REVERSE_X`: @@ -114,20 +113,6 @@ This behavior can be further customized with the following defines: #define CHARYBDIS_SNIPING_DPI_CONFIG_STEP 100 ``` -### Acceleration - -By default, the pointer's movements are linear. To enable acceleration, add the following define: - -```c -#define CHARYBDIS_POINTER_ACCELERATION_ENABLE -``` - -The acceleration factor can be further tune _via_ the `CHARYBDIS_POINTER_ACCELERATION_FACTOR`: - -```c -#define CHARYBDIS_POINTER_ACCELERATION_FACTOR 24 -``` - ### Custom keycodes The Charybdis firmware defines a number of keycodes to leverage its features, namely: |