From ff6c70415c536e6435023627197550889ffa1501 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Sun, 6 Mar 2022 22:12:17 -0800 Subject: [Keymap] Drashna Mouse keys and oled updates (#16556) --- .../charybdis/4x6/keymaps/drashna/chconf.h | 38 ++++++ .../charybdis/4x6/keymaps/drashna/config.h | 91 ++++++++++++++ .../charybdis/4x6/keymaps/drashna/halconf.h | 26 ++++ .../charybdis/4x6/keymaps/drashna/keymap.c | 132 +++++++++++++++++++++ .../charybdis/4x6/keymaps/drashna/mcuconf.h | 44 +++++++ .../charybdis/4x6/keymaps/drashna/rules.mk | 24 ++++ 6 files changed, 355 insertions(+) create mode 100644 keyboards/bastardkb/charybdis/4x6/keymaps/drashna/chconf.h create mode 100644 keyboards/bastardkb/charybdis/4x6/keymaps/drashna/config.h create mode 100644 keyboards/bastardkb/charybdis/4x6/keymaps/drashna/halconf.h create mode 100644 keyboards/bastardkb/charybdis/4x6/keymaps/drashna/keymap.c create mode 100644 keyboards/bastardkb/charybdis/4x6/keymaps/drashna/mcuconf.h create mode 100644 keyboards/bastardkb/charybdis/4x6/keymaps/drashna/rules.mk (limited to 'keyboards/bastardkb/charybdis/4x6/keymaps/drashna') diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/chconf.h b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/chconf.h new file mode 100644 index 0000000000..8b55eaeef0 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/chconf.h @@ -0,0 +1,38 @@ +/* Copyright 2020 QMK + * + * 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 . + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/handwired/onekey/blackpill_f411/chconf.h -r platforms/chibios/common/configs/chconf.h` + */ + +#pragma once + +#define CH_CFG_ST_FREQUENCY 10000 + +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE + +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE + +#define CH_CFG_FACTORY_SEMAPHORES TRUE + +#define CH_CFG_FACTORY_MAILBOXES TRUE + +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE + +#define CH_CFG_FACTORY_PIPES TRUE + +#include_next diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/config.h b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/config.h new file mode 100644 index 0000000000..f384318dc4 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/config.h @@ -0,0 +1,91 @@ +/** + * Copyright 2021 Charly Delay (@0xcharly) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once + +#undef MATRIX_COL_PINS +#define MATRIX_COL_PINS \ + { B0, B1, B10, B3, B4, B5 } +#undef MATRIX_COL_PINS_RIGHT +#define MATRIX_COL_PINS_RIGHT \ + { B0, B1, B10, B3, B4, B5 } + +#undef MATRIX_ROW_PINS +#define MATRIX_ROW_PINS \ + { B15, A2, B8, A8, B9 } +#undef MATRIX_ROW_PINS_RIGHT +#define MATRIX_ROW_PINS_RIGHT \ + { B15, A2, B8, A8, B9 } + +#define DIODE_DIRECTION ROW2COL +#define SPLIT_HAND_PIN A3 + +#undef RGB_DI_PIN +#define RGB_DI_PIN A1 +#define WS2812_EXTERNAL_PULLUP +#define WS2812_PWM_DRIVER PWMD2 +#define WS2812_PWM_CHANNEL 2 +#define WS2812_PWM_PAL_MODE 1 +#define WS2812_EXTERNAL_PULLUP +#define WS2812_DMA_STREAM STM32_DMA1_STREAM1 +#define WS2812_DMA_CHANNEL 3 +#define WS2812_PWM_TARGET_PERIOD 800000 + +#define DEBUG_LED_PIN C13 + +#undef SOFT_SERIAL_PIN +// #define SERIAL_USART_FULL_DUPLEX // Enable full duplex operation mode. +#define SERIAL_USART_TX_PIN A9 +// #define SERIAL_USART_RX_PIN A3 +// #define SERIAL_USART_DRIVER SD2 +// #define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7 +// #define SERIAL_USART_RX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7 +// #define SERIAL_USART_TIMEOUT 100 // USART driver timeout. default 100 +// // #define SERIAL_USART_PIN_SWAP // swap RX and TX pins on master +// // To use the highest possible baudrate (3.75Mbit/s) uncomment the following +// // line, this can result in dropped communications so lower the speed if there +// // are many timeouts. +// // #define SERIAL_USART_SPEED (STM32_PCLK2 >> 4) + +#define CRC8_USE_TABLE +#define CRC8_OPTIMIZE_SPEED + +/* spi config for eeprom and pmw3360 sensor */ +#define SPI_DRIVER SPID1 +#define SPI_SCK_PIN A5 +#define SPI_SCK_PAL_MODE 5 +#define SPI_MOSI_PIN A7 +#define SPI_MOSI_PAL_MODE 5 +#define SPI_MISO_PIN A6 +#define SPI_MISO_PAL_MODE 5 + +#define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A4 +#define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 64 + +#undef PMW3360_CS_PIN +#define PMW3360_CS_PIN B14 +#define PMW3360_CS_MODE 3 +#define PMW3360_CS_DIVISOR 64 + +#define CHARYBDIS_MINIMUM_DEFAULT_DPI 1200 +#define CHARYBDIS_DEFAULT_DPI_CONFIG_STEP 400 +#define CHARYBDIS_MINIMUM_SNIPING_DPI 200 +#define CHARYBDIS_SNIPING_DPI_CONFIG_STEP 100 + +/* RGB Matrix. */ + +#undef RGB_MATRIX_MAXIMUM_BRIGHTNESS +#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/halconf.h b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/halconf.h new file mode 100644 index 0000000000..97a288d7bd --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/halconf.h @@ -0,0 +1,26 @@ +/* Copyright 2020 Nick Brassel (tzarc) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once + +#define HAL_USE_PWM TRUE +#define HAL_USE_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 diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/keymap.c b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/keymap.c new file mode 100644 index 0000000000..e26ffc14aa --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/keymap.c @@ -0,0 +1,132 @@ +/** + * Copyright 2021 Charly Delay (@0xcharly) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "drashna.h" + +#define LAYOUT_charybdis_4x6_wrapper(...) LAYOUT_charybdis_4x6(__VA_ARGS__) +#define LAYOUT_charybdis_4x6_base( \ + K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \ + K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \ + ) \ + LAYOUT_charybdis_4x6_wrapper( \ + KC_ESC, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, UC_CLUE, \ + SH_TT, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, SH_TT, \ + LALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(K1B), \ + OS_LSFT, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \ + KC_GRV, OS_LALT, OS_LGUI, TT(_MOUSE), KC_ENT, \ + KC_SPC, BK_LWER, DL_RAIS \ + ) + +#define LAYOUT_base_wrapper(...) LAYOUT_charybdis_4x6_base(__VA_ARGS__) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_DEFAULT_LAYER_1] = LAYOUT_base_wrapper( + _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, + _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, + _________________QWERTY_L3_________________, _________________QWERTY_R3_________________ + ), + + [_DEFAULT_LAYER_2] = LAYOUT_base_wrapper( + ______________COLEMAK_MOD_DH_L1____________, ______________COLEMAK_MOD_DH_R1____________, + ______________COLEMAK_MOD_DH_L2____________, ______________COLEMAK_MOD_DH_R2____________, + ______________COLEMAK_MOD_DH_L3____________, ______________COLEMAK_MOD_DH_R3____________ + ), + [_DEFAULT_LAYER_3] = LAYOUT_base_wrapper( + _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, + _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, + _________________COLEMAK_L3________________, _________________COLEMAK_R3________________ + ), + + [_DEFAULT_LAYER_4] = LAYOUT_base_wrapper( + _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, + _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, + _________________DVORAK_L3_________________, _________________DVORAK_R3_________________ + ), + + + + [_MOUSE] = LAYOUT_charybdis_4x6( + _______, _______, _______, _______, _______, _______, DRGSCRL, DPI_RMOD,DPI_MOD, S_D_RMOD,S_D_MOD, SNP_TOG, + _______, _______, _______, _______, _______, _______, KC_WH_U, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, KC_WH_D, KC_BTN1, KC_BTN3, KC_BTN2, KC_BTN6, SNIPING, + _______, _______, _______, _______, _______, _______, KC_BTN7, KC_BTN4, KC_BTN5, KC_BTN8, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______ + ), + [_GAMEPAD] = LAYOUT_charybdis_4x6( + KC_ESC, KC_NO, KC_1, KC_2, KC_3, KC_4, _______, _______, _______, _______, _______, _______, + KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, _______, _______, _______, _______, _______, _______, + KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F, _______, _______, _______, _______, _______, _______, + KC_LCTL, KC_LSFT, KC_Z, KC_X, KC_C, KC_H, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______ + ), + [_DIABLO] = LAYOUT_charybdis_4x6( + KC_ESC, KC_V, KC_D, KC_LALT, KC_NO, KC_NO, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO, + KC_TAB, KC_S, KC_I, KC_F, KC_M, KC_T, _______, _______, _______, _______, _______, _______, + KC_Q, KC_1, KC_2, KC_3, KC_4, KC_G, _______, _______, _______, _______, _______, _______, + KC_LCTL, KC_D3_1, KC_D3_2, KC_D3_3, KC_D3_4, KC_Z, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______ + ), + [_DIABLOII] = LAYOUT_charybdis_4x6( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_GRV, _______, _______, _______, _______, _______, _______, + KC_TAB, KC_A, KC_T, KC_Q, KC_I, KC_M, _______, _______, _______, _______, _______, _______, + KC_S, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, _______, _______, _______, + KC_LCTL, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, _______ + ), + + [_LOWER] = LAYOUT_charybdis_4x6_wrapper( + KC_F12, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, KC_F11, + _______, _________________LOWER_L1__________________, _________________LOWER_R1__________________, _______, + _______, _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE, + _______, _________________LOWER_L3__________________, _________________LOWER_R3__________________, _______, + _______, _______, _______, _______, _______, + _______, _______, _______ + ), + + [_RAISE] = LAYOUT_charybdis_4x6_wrapper( + KC_F12, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, KC_F11, + KC_GRV, _________________RAISE_L1__________________, _________________RAISE_R1__________________, _______, + _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS, + _______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______, + _______, _______, _______, _______, _______, + _______, _______, _______ + ) + +}; +// clang-format on + + +void matrix_init_keyemap(void) { setPinInputHigh(A0); } + +void matrix_scan_keymap(void) { + if (!readPin(A0)) { + reset_keyboard(); + } +} + +#ifdef USB_VBUS_PIN +bool usb_vbus_state(void) { + setPinInputLow(USB_VBUS_PIN); + wait_us(5); + return readPin(USB_VBUS_PIN); +} +#endif diff --git a/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/mcuconf.h b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/mcuconf.h new file mode 100644 index 0000000000..0f60612d79 --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/mcuconf.h @@ -0,0 +1,44 @@ +/* Copyright 2020 Nick Brassel (tzarc) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#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_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/4x6/keymaps/drashna/rules.mk b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/rules.mk new file mode 100644 index 0000000000..ab86b1b8ba --- /dev/null +++ b/keyboards/bastardkb/charybdis/4x6/keymaps/drashna/rules.mk @@ -0,0 +1,24 @@ +# MCU name +MCU = STM32F411 + +# Bootloader selection +BOOTLOADER = stm32-dfu +# BOOTLOADER := tinyuf2 + +LTO_ENABLE := no + +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +KEYBOARD_SHARED_EP = yes +MOUSE_SHARED_EP = yes + +EEPROM_DRIVER = spi +WS2812_DRIVER = pwm +SERIAL_DRIVER = usart + +MOUSEKEY_ENABLE = yes +NKRO_ENABLE = yes +CONSOLE_ENABLE = yes + +AUTOCORRECTION_ENABLE = yes + +DEBOUNCE_TYPE = asym_eager_defer_pk -- cgit v1.2.3