From 6e62fd0c17001ad968bd184f72a39102223c0048 Mon Sep 17 00:00:00 2001 From: Gondolindrim Date: Sun, 20 Mar 2022 16:15:16 -0300 Subject: [PATCH 01/18] First Shark Beta support --- keyboards/acheron/shark_beta/chconf.h | 25 +++++++ keyboards/acheron/shark_beta/config.h | 65 +++++++++++++++++++ keyboards/acheron/shark_beta/halconf.h | 24 +++++++ .../shark_beta/keymaps/default/keymap.c | 52 +++++++++++++++ .../acheron/shark_beta/keymaps/via/keymap.c | 43 ++++++++++++ .../acheron/shark_beta/keymaps/via/rules.mk | 2 + keyboards/acheron/shark_beta/mcuconf.h | 44 +++++++++++++ keyboards/acheron/shark_beta/rules.mk | 27 ++++++++ keyboards/acheron/shark_beta/shark_beta.c | 22 +++++++ keyboards/acheron/shark_beta/shark_beta.h | 31 +++++++++ 10 files changed, 335 insertions(+) create mode 100644 keyboards/acheron/shark_beta/chconf.h create mode 100644 keyboards/acheron/shark_beta/config.h create mode 100644 keyboards/acheron/shark_beta/halconf.h create mode 100644 keyboards/acheron/shark_beta/keymaps/default/keymap.c create mode 100644 keyboards/acheron/shark_beta/keymaps/via/keymap.c create mode 100644 keyboards/acheron/shark_beta/keymaps/via/rules.mk create mode 100644 keyboards/acheron/shark_beta/mcuconf.h create mode 100644 keyboards/acheron/shark_beta/rules.mk create mode 100644 keyboards/acheron/shark_beta/shark_beta.c create mode 100644 keyboards/acheron/shark_beta/shark_beta.h diff --git a/keyboards/acheron/shark_beta/chconf.h b/keyboards/acheron/shark_beta/chconf.h new file mode 100644 index 000000000000..cbbae31079fb --- /dev/null +++ b/keyboards/acheron/shark_beta/chconf.h @@ -0,0 +1,25 @@ +/* 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 . + */ + +#pragma once + +#define CH_CFG_ST_FREQUENCY 10000 + +#define CH_CFG_OPTIMIZE_SPEED FALSE + +#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE + +#include_next diff --git a/keyboards/acheron/shark_beta/config.h b/keyboards/acheron/shark_beta/config.h new file mode 100644 index 000000000000..b1f481968b69 --- /dev/null +++ b/keyboards/acheron/shark_beta/config.h @@ -0,0 +1,65 @@ +/* +Copyright 2020 Gondolindrim + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xAC11 +#define PRODUCT_ID 0x5369 // For Shark+1 +#define DEVICE_VER 0x0002 +#define MANUFACTURER AcheronProject +#define PRODUCT SharkPCB rev. Beta + +#define MATRIX_ROWS 4 +#define MATRIX_COLS 12 + +#define MATRIX_COL_PINS { C5 , A10, C13, B9 , B8 , B5 , B4 , B3 , A15, A0 , A1 , A2 } +#define MATRIX_ROW_PINS { A8 , B14, A4 , A3 } +#define DIODE_DIRECTION COL2ROW + +#define DEBOUNCE 5 + +#define LOCKING_SUPPORT_ENABLE +#define LOCKING_RESYNC_ENABLE + +#define BACKLIGHT_PIN A6 +#define BACKLIGHT_PWM_DRIVER PWMD3 +#define BACKLIGHT_PWM_CHANNEL 1 +#define BACKLIGHT_PAL_MODE 2 +#define BACKLIGHT_LEVELS 20 +#define BACKLIGHT_BREATHING +#define BREATHING_PERIOD 5 +#define BACKLIGHT_ON_STATE 0 + +#define STM32_HSECLK 8000000 + +#define RGB_DI_PIN B15 +#define RGBLED_NUM 34 +#define RGBLIGHT_ANIMATIONS + +#define WS2812_PWM_COMPLEMENTARY_OUTPUT +#define WS2812_PWM_DRIVER PWMD1 +#define WS2812_PWM_CHANNEL 3 +#define WS2812_PWM_PAL_MODE 1 +#define WS2812_DMA_STREAM STM32_DMA2_STREAM5 +#define WS2812_DMA_CHANNEL 6 + +#define ENCODERS_PAD_A { C15 } +#define ENCODERS_PAD_B { C14 } +#define ENCODER_RESOLUTION 4 diff --git a/keyboards/acheron/shark_beta/halconf.h b/keyboards/acheron/shark_beta/halconf.h new file mode 100644 index 000000000000..ebdb4954a17c --- /dev/null +++ b/keyboards/acheron/shark_beta/halconf.h @@ -0,0 +1,24 @@ +/* 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 . + */ + +#pragma once + +#define HAL_USE_PWM TRUE +#define HAL_USE_PAL TRUE + +#define HAL_USE_I2C TRUE + +#include_next diff --git a/keyboards/acheron/shark_beta/keymaps/default/keymap.c b/keyboards/acheron/shark_beta/keymaps/default/keymap.c new file mode 100644 index 000000000000..692eb5167033 --- /dev/null +++ b/keyboards/acheron/shark_beta/keymaps/default/keymap.c @@ -0,0 +1,52 @@ +/* Copyright 2019 + * + * 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 QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_ortho_4x12( + KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P , KC_BSPC, + KC_ESC , KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN , KC_QUOT, + KC_LSFT , KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM , KC_DOT , KC_SLSH , KC_ENT , + KC_LCTL , KC_LALT , KC_LGUI , KC_NO , MO(1) , KC_SPC , KC_SPC , MO(2) , KC_LEFT , KC_DOWN , KC_UP , KC_RGHT + ), + [1] = LAYOUT_ortho_4x12( + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS + ), + [2] = LAYOUT_ortho_4x12( + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS + ), + [3] = LAYOUT_ortho_4x12( + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS + ) +}; + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (clockwise) { + tap_code_delay(KC_VOLU, 10); + } else { + tap_code_delay(KC_VOLD, 10); + } + return false; +} diff --git a/keyboards/acheron/shark_beta/keymaps/via/keymap.c b/keyboards/acheron/shark_beta/keymaps/via/keymap.c new file mode 100644 index 000000000000..5cf5ac40da96 --- /dev/null +++ b/keyboards/acheron/shark_beta/keymaps/via/keymap.c @@ -0,0 +1,43 @@ +/* Copyright 2019 + * + * 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 QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_ortho_4x12( + KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P , KC_BSPC, + KC_ESC , KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN , KC_QUOT, + KC_LSFT , KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM , KC_DOT , KC_SLSH , KC_ENT , + KC_LCTL , KC_LALT , KC_LGUI , KC_NO , MO(1) , KC_SPC , KC_SPC , MO(2) , KC_LEFT , KC_DOWN , KC_UP , KC_RGHT + ), + [1] = LAYOUT_ortho_4x12( + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS + ), + [2] = LAYOUT_ortho_4x12( + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS + ), + [3] = LAYOUT_ortho_4x12( + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , + KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS + ) +}; diff --git a/keyboards/acheron/shark_beta/keymaps/via/rules.mk b/keyboards/acheron/shark_beta/keymaps/via/rules.mk new file mode 100644 index 000000000000..666e72557b07 --- /dev/null +++ b/keyboards/acheron/shark_beta/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE = yes +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite diff --git a/keyboards/acheron/shark_beta/mcuconf.h b/keyboards/acheron/shark_beta/mcuconf.h new file mode 100644 index 000000000000..0ea015be4f9d --- /dev/null +++ b/keyboards/acheron/shark_beta/mcuconf.h @@ -0,0 +1,44 @@ +/* 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 . + */ + +#pragma once + +#include_next +#undef STM32_PLLM_VALUE +#undef STM32_PLLN_VALUE +#undef STM32_PLLP_VALUE +#undef STM32_PLLQ_VALUE +#undef STM32_PPRE1 +#undef STM32_PPRE2 + +#define STM32_PLLM_VALUE 4 +#define STM32_PLLN_VALUE 72 +#define STM32_PLLP_VALUE 2 +#define STM32_PLLQ_VALUE 3 +#define STM32_PPRE1 STM32_PPRE1_DIV2 +#define STM32_PPRE2 STM32_PPRE2_DIV1 + +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE + +#undef STM32_PWM_USE_ADVANCED +#define STM32_PWM_USE_ADVANCED TRUE + +#undef STM32_PWM_USE_TIM3 +#define STM32_PWM_USE_TIM3 TRUE + +#undef STM32_PWM_USE_TIM1 +#define STM32_PWM_USE_TIM1 TRUE diff --git a/keyboards/acheron/shark_beta/rules.mk b/keyboards/acheron/shark_beta/rules.mk new file mode 100644 index 000000000000..f13b2dadb4e7 --- /dev/null +++ b/keyboards/acheron/shark_beta/rules.mk @@ -0,0 +1,27 @@ +MCU = STM32F411 + +# Bootloader selection +BOOTLOADER = stm32-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 = yes # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = yes # USB Nkey Rollover +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +BACKLIGHT_DRIVER = pwm +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +LTO_ENABLE = yes +ENCODER_ENABLE = no +LAYOUTS=ortho_4x12 +ENCODER_ENABLE=yes +# Enter lower-power sleep mode when on the ChibiOS idle thread +OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE diff --git a/keyboards/acheron/shark_beta/shark_beta.c b/keyboards/acheron/shark_beta/shark_beta.c new file mode 100644 index 000000000000..03beb43bbe2e --- /dev/null +++ b/keyboards/acheron/shark_beta/shark_beta.c @@ -0,0 +1,22 @@ +/* Copyright 2020 Gondolindrim + * + * 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 "shark_beta.h" + +void board_init(void) { + setPinInput(B6); + setPinInput(B7); +} diff --git a/keyboards/acheron/shark_beta/shark_beta.h b/keyboards/acheron/shark_beta/shark_beta.h new file mode 100644 index 000000000000..1002659d3d2c --- /dev/null +++ b/keyboards/acheron/shark_beta/shark_beta.h @@ -0,0 +1,31 @@ +/* Copyright 2020 Gondolindrim + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once +#include "quantum.h" + +#define LAYOUT_ortho_4x12( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B \ +)\ +{\ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B } \ +} From 0bae7f0714bbb014ef8bcc6c507d174be308aaf5 Mon Sep 17 00:00:00 2001 From: Gondolindrim Date: Mon, 21 Mar 2022 13:53:10 -0300 Subject: [PATCH 02/18] RGB num update, encoder callback --- keyboards/acheron/shark_beta/config.h | 6 +++--- keyboards/acheron/shark_beta/keymaps/via/keymap.c | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/keyboards/acheron/shark_beta/config.h b/keyboards/acheron/shark_beta/config.h index b1f481968b69..ff4f8a2f6c9a 100644 --- a/keyboards/acheron/shark_beta/config.h +++ b/keyboards/acheron/shark_beta/config.h @@ -29,7 +29,7 @@ along with this program. If not, see . #define MATRIX_ROWS 4 #define MATRIX_COLS 12 -#define MATRIX_COL_PINS { C5 , A10, C13, B9 , B8 , B5 , B4 , B3 , A15, A0 , A1 , A2 } +#define MATRIX_COL_PINS { A5 , A10, C13, B9 , B8 , B5 , B4 , B3 , A15, A0 , A1 , A2 } #define MATRIX_ROW_PINS { A8 , B14, A4 , A3 } #define DIODE_DIRECTION COL2ROW @@ -45,12 +45,12 @@ along with this program. If not, see . #define BACKLIGHT_LEVELS 20 #define BACKLIGHT_BREATHING #define BREATHING_PERIOD 5 -#define BACKLIGHT_ON_STATE 0 +#define BACKLIGHT_ON_STATE 1 #define STM32_HSECLK 8000000 #define RGB_DI_PIN B15 -#define RGBLED_NUM 34 +#define RGBLED_NUM 24 #define RGBLIGHT_ANIMATIONS #define WS2812_PWM_COMPLEMENTARY_OUTPUT diff --git a/keyboards/acheron/shark_beta/keymaps/via/keymap.c b/keyboards/acheron/shark_beta/keymaps/via/keymap.c index 5cf5ac40da96..692eb5167033 100644 --- a/keyboards/acheron/shark_beta/keymaps/via/keymap.c +++ b/keyboards/acheron/shark_beta/keymaps/via/keymap.c @@ -41,3 +41,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS ) }; + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (clockwise) { + tap_code_delay(KC_VOLU, 10); + } else { + tap_code_delay(KC_VOLD, 10); + } + return false; +} From 4984bfbcf1303065dd2dcc192cca8e6f3e6e2ee1 Mon Sep 17 00:00:00 2001 From: Gondolindrim Date: Tue, 22 Mar 2022 22:33:06 -0300 Subject: [PATCH 03/18] First encoder modes implementation --- keyboards/acheron/shark_beta/config.h | 4 +- .../shark_beta/keymaps/gondolindrim/keymap.c | 228 ++++++++++++++++++ .../shark_beta/keymaps/gondolindrim/rules.mk | 1 + keyboards/acheron/shark_beta/rules.mk | 2 +- keyboards/acheron/shark_beta/shark_beta.c | 7 +- 5 files changed, 237 insertions(+), 5 deletions(-) create mode 100755 keyboards/acheron/shark_beta/keymaps/gondolindrim/keymap.c create mode 100644 keyboards/acheron/shark_beta/keymaps/gondolindrim/rules.mk diff --git a/keyboards/acheron/shark_beta/config.h b/keyboards/acheron/shark_beta/config.h index ff4f8a2f6c9a..e110713725f8 100644 --- a/keyboards/acheron/shark_beta/config.h +++ b/keyboards/acheron/shark_beta/config.h @@ -60,6 +60,6 @@ along with this program. If not, see . #define WS2812_DMA_STREAM STM32_DMA2_STREAM5 #define WS2812_DMA_CHANNEL 6 -#define ENCODERS_PAD_A { C15 } -#define ENCODERS_PAD_B { C14 } +#define ENCODERS_PAD_A { C14 } +#define ENCODERS_PAD_B { C15 } #define ENCODER_RESOLUTION 4 diff --git a/keyboards/acheron/shark_beta/keymaps/gondolindrim/keymap.c b/keyboards/acheron/shark_beta/keymaps/gondolindrim/keymap.c new file mode 100755 index 000000000000..64338060c612 --- /dev/null +++ b/keyboards/acheron/shark_beta/keymaps/gondolindrim/keymap.c @@ -0,0 +1,228 @@ +/* +Copyright 2020 Álvaro "Gondolindrim" Volpato + +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 QMK_KEYBOARD_H +#include "config_common.h" +#define MEDIA_KEY_DELAY 10 +#define ALT_TAB_DELAY 1000 + +#define ENCODER_MODE_CHANGE_DELAY 500 + +// Defining encoder click keycode +enum keyboard_keycodes { + ECLICK = 0x5F80, // Encoder click + ALTTABS , // For alt-tab-switch + ALTTABC , // For alt-tab-click + ENCMUP , // Encoder mode up + ENCMDN // Encoder mode down +}; + +uint16_t encoder_click_delay = ENCODER_MODE_CHANGE_DELAY; + +uint8_t startup_color[3] = {0xFF,0xFF,0xFF}; + +typedef struct _encoder_mode_t { + uint8_t indicator_color[3]; + uint16_t clockwise_key[4]; + uint16_t counterclockwise_key[4]; + uint16_t clicked_key[4] ; +} encoder_mode_t; + +encoder_mode_t encoder_modes[] = { + { .indicator_color = {0x22,0x00,0xFF} , .clockwise_key = {KC_VOLD, KC_VOLD, ENCMDN, KC_VOLD}, .counterclockwise_key = {KC_VOLU, KC_VOLU, ENCMUP, KC_VOLU}, .clicked_key = {KC_MUTE, KC_MPLY, KC_MUTE, KC_MUTE} }, + { .indicator_color = {0x00,0x33,0xFF} , .clockwise_key = {KC_WH_D, KC_WH_D, ENCMDN, KC_WH_D}, .counterclockwise_key = {KC_WH_U, KC_WH_U, ENCMUP, KC_WH_U}, .clicked_key = {KC_BTN1, KC_BTN1, KC_BTN1, KC_BTN1} }, + { .indicator_color = {0xFF,0x88,0x00} , .clockwise_key = {ALTTABS, ALTTABS, ENCMDN, ALTTABS}, .counterclockwise_key = {ALTTABS, ALTTABS, ENCMUP, ALTTABS}, .clicked_key = {ALTTABC, ALTTABC, ALTTABC, ALTTABC} } + // Insert your custom encoder mode here +}; + +#define NUM_ENCODER_MODES (sizeof(encoder_modes)/sizeof(encoder_modes[0])) + +// This counter is used to track what encoder mode is being used at a certain time +int encoder_mode_count = 0; + +void set_indicator_colors(uint8_t color[3]){ + rgblight_setrgb(color[0], color[1], color[2]); +} + +// Board init: RGB indicator is set to startup_color +void board_init_keymap(void){ + set_indicator_colors(startup_color); +}; + +void keyboard_post_init_user(void){ + set_indicator_colors(encoder_modes[0].indicator_color); +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_ortho_4x12( + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, ECLICK , + KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , + KC_LCTL, KC_LALT, KC_LGUI, _______, MO(1), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT + ), + [1] = LAYOUT_ortho_4x12( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + [2] = LAYOUT_ortho_4x12( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + [3] = LAYOUT_ortho_4x12( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ) +}; + +// ------------------------------------------------------------------------------------------------ + +bool is_alt_tab_active = false; // Flag to check if alt tab is active +uint32_t alt_tab_timer = 0; // Time trigger for alt tab +uint16_t mapped_code = 0; +uint32_t held_keycode_timer = 0; + +int current_layer = 0 ; // Updated in layer_state_set_user each time a layer change is made + +void cycle_encoder_mode(bool forward){ + if (forward) encoder_mode_count++ ; // Shifts encoder mode forward + else encoder_mode_count-- ; + if (encoder_mode_count == -1) encoder_mode_count = NUM_ENCODER_MODES - 1; + // Shifts encoder mode backward + encoder_mode_count = encoder_mode_count%NUM_ENCODER_MODES ; // This makes sure encoder_mode_count keeps cycling between 0,1,...,NUM_ENCODER_MODES and doesnt eventually overflow + set_indicator_colors( encoder_modes[ encoder_mode_count ].indicator_color ); // Set indicator color to the corresponding defined color +} + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (clockwise) mapped_code = encoder_modes[ encoder_mode_count ].clockwise_key[ current_layer ]; + else mapped_code = encoder_modes[ encoder_mode_count ].counterclockwise_key[ current_layer ]; + switch (mapped_code) { + case ALTTABS: + if(!is_alt_tab_active) { + is_alt_tab_active = true; + register_code(KC_LALT); + } + alt_tab_timer = timer_read32(); + tap_code16(!clockwise ? KC_TAB : S(KC_TAB)); + break; + case ENCMUP: + cycle_encoder_mode(true); + break; + case ENCMDN: + cycle_encoder_mode(false); + break; + default: + { + register_code(mapped_code); + held_keycode_timer = timer_read32(); + while (timer_elapsed32(held_keycode_timer) < MEDIA_KEY_DELAY) + ; /* no-op */ + unregister_code(mapped_code); + break; + } + } + return true; +} + +uint32_t held_click_timer = 0; +bool is_click_held = false; +bool is_shift_held = false; +bool automatic_encoder_mode_cycle = false; // This flag registers if the encoder mode was automatically cycled + +// This bool records if LALT is pressed or not. Due to the automatic disabling of the ALT-TAB of the ALTTABS custom keystroke, the automatic disabling can un-register KC_LALT even when the LALT key is phisically pressed. Hence there needs to be two bools: one that keebs track of the ALT-TAB activity and one that keeps track of LALT so that the automatic disabling will not disable LALT if it is phisically pressed. +bool is_lalt_pressed = false; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_LSFT: + case KC_RSFT: + if (record->event.pressed) is_shift_held = true; + else is_shift_held = false; + return true; + case ECLICK: + if (record->event.pressed) { // What to do when the encoder is pressed + is_click_held = true; + held_click_timer = timer_read32(); // If the encoder delayed mode change is on, triggers a timer + } else { // What to do when encoder is released + is_click_held = false; + + // Scans for the time the click was pressed and does what it has to do -- sample the timer which was triggered on press and use the sampled time to either send out the click key or change mode in case the click is held for more than ENCODER_MODE_CHANGE_DELAY + if (timer_elapsed32(held_click_timer) < encoder_click_delay && !automatic_encoder_mode_cycle ){ // Checking if the time the encoder click was held was smaller than the delay defined and if an automatic mode change was not already performed. If it was, just register whatever it is the click does. + switch ( encoder_modes[ encoder_mode_count ].clicked_key[ current_layer ] ){ + case ALTTABC: + if (is_alt_tab_active) { + if (!is_lalt_pressed) unregister_code(KC_LALT); + is_alt_tab_active = false; + } + break; + case ENCMUP: + cycle_encoder_mode(true); + break; + case ENCMDN: + cycle_encoder_mode(false); + break; + default: + register_code( encoder_modes[ encoder_mode_count ].clicked_key[ current_layer ] ); + held_keycode_timer = timer_read32(); + while (timer_elapsed32(held_keycode_timer) < MEDIA_KEY_DELAY); + unregister_code( encoder_modes[ encoder_mode_count ].clicked_key[ current_layer ] ); + break; + } + } else { // If the encoder click was held for more time than the delay: + if (!automatic_encoder_mode_cycle) { + if (is_shift_held) cycle_encoder_mode(false); + else cycle_encoder_mode(true); + } + }; + // held_click_timer = 0; + automatic_encoder_mode_cycle = false; + }; + return false; // Skip all further processing of this key + case KC_LALT: // If this is not defined, if the encoder is activated in the alt-tab mode while the LALT key is pressed, the menu goes away. + if (record->event.pressed) is_lalt_pressed = true; + else is_lalt_pressed = false; + return true; + case ENCMUP: + cycle_encoder_mode(true); + return false; + case ENCMDN: + cycle_encoder_mode(false); + return false; + default: + return true; // Process all other keycodes normally + } +} + +void housekeeping_task_user(void) { // The very important timer. + if (is_alt_tab_active){ + if (is_lalt_pressed) alt_tab_timer = timer_read32(); + else if (timer_elapsed32(alt_tab_timer) > ALT_TAB_DELAY) { + unregister_code(KC_LALT); + is_alt_tab_active = false; + } + } + if (is_click_held && timer_elapsed32(held_click_timer) > encoder_click_delay ){ + automatic_encoder_mode_cycle = true; + held_click_timer = timer_read32(); + if (is_shift_held) cycle_encoder_mode(false); + else cycle_encoder_mode(true); + } +} diff --git a/keyboards/acheron/shark_beta/keymaps/gondolindrim/rules.mk b/keyboards/acheron/shark_beta/keymaps/gondolindrim/rules.mk new file mode 100644 index 000000000000..1e5b99807cb7 --- /dev/null +++ b/keyboards/acheron/shark_beta/keymaps/gondolindrim/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/acheron/shark_beta/rules.mk b/keyboards/acheron/shark_beta/rules.mk index f13b2dadb4e7..acdfda720616 100644 --- a/keyboards/acheron/shark_beta/rules.mk +++ b/keyboards/acheron/shark_beta/rules.mk @@ -7,7 +7,7 @@ BOOTLOADER = stm32-dfu # change yes to no to disable # BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = no # Mouse keys +MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = yes # Commands for debug and configuration diff --git a/keyboards/acheron/shark_beta/shark_beta.c b/keyboards/acheron/shark_beta/shark_beta.c index 03beb43bbe2e..89dedc17d33b 100644 --- a/keyboards/acheron/shark_beta/shark_beta.c +++ b/keyboards/acheron/shark_beta/shark_beta.c @@ -16,7 +16,10 @@ #include "shark_beta.h" +void board_init_keymap(void); + void board_init(void) { - setPinInput(B6); - setPinInput(B7); + setPinInput(B6); + setPinInput(B7); + board_init_keymap(); } From e77636a4e179d0c6032607b6da23fe8b74142ad7 Mon Sep 17 00:00:00 2001 From: Gondolindrim Date: Wed, 23 Mar 2022 12:55:31 -0300 Subject: [PATCH 04/18] Single folder for both versions --- keyboards/acheron/shark/alpha/alpha.c | 16 ++++++++ keyboards/acheron/shark/alpha/alpha.h | 39 ++++++++++++++++++ keyboards/acheron/shark/{ => alpha}/config.h | 0 keyboards/acheron/shark/{ => alpha}/info.json | 0 .../{ => alpha}/keymaps/ajp10304/readme.md | 0 .../{ => alpha}/keymaps/default/keymap.c | 0 .../shark/{ => alpha}/keymaps/via/keymap.c | 0 .../shark/{ => alpha}/keymaps/via/rules.mk | 0 keyboards/acheron/shark/{ => alpha}/readme.md | 0 keyboards/acheron/shark/{ => alpha}/rules.mk | 0 .../shark_beta.c => shark/beta/beta.c} | 2 +- .../shark_beta.h => shark/beta/beta.h} | 0 .../{shark_beta => shark/beta}/chconf.h | 0 .../{shark_beta => shark/beta}/config.h | 0 .../{shark_beta => shark/beta}/halconf.h | 0 .../beta}/keymaps/default/keymap.c | 0 .../beta}/keymaps/gondolindrim/keymap.c | 0 .../beta}/keymaps/gondolindrim/rules.mk | 0 .../beta}/keymaps/via/keymap.c | 0 .../beta}/keymaps/via/rules.mk | 0 .../{shark_beta => shark/beta}/mcuconf.h | 0 .../{shark_beta => shark/beta}/rules.mk | 0 keyboards/acheron/shark/shark.c | 28 ++++++------- keyboards/acheron/shark/shark.h | 40 +++---------------- 24 files changed, 74 insertions(+), 51 deletions(-) create mode 100644 keyboards/acheron/shark/alpha/alpha.c create mode 100644 keyboards/acheron/shark/alpha/alpha.h rename keyboards/acheron/shark/{ => alpha}/config.h (100%) rename keyboards/acheron/shark/{ => alpha}/info.json (100%) rename keyboards/acheron/shark/{ => alpha}/keymaps/ajp10304/readme.md (100%) rename keyboards/acheron/shark/{ => alpha}/keymaps/default/keymap.c (100%) rename keyboards/acheron/shark/{ => alpha}/keymaps/via/keymap.c (100%) rename keyboards/acheron/shark/{ => alpha}/keymaps/via/rules.mk (100%) rename keyboards/acheron/shark/{ => alpha}/readme.md (100%) rename keyboards/acheron/shark/{ => alpha}/rules.mk (100%) rename keyboards/acheron/{shark_beta/shark_beta.c => shark/beta/beta.c} (97%) rename keyboards/acheron/{shark_beta/shark_beta.h => shark/beta/beta.h} (100%) rename keyboards/acheron/{shark_beta => shark/beta}/chconf.h (100%) rename keyboards/acheron/{shark_beta => shark/beta}/config.h (100%) rename keyboards/acheron/{shark_beta => shark/beta}/halconf.h (100%) rename keyboards/acheron/{shark_beta => shark/beta}/keymaps/default/keymap.c (100%) rename keyboards/acheron/{shark_beta => shark/beta}/keymaps/gondolindrim/keymap.c (100%) rename keyboards/acheron/{shark_beta => shark/beta}/keymaps/gondolindrim/rules.mk (100%) rename keyboards/acheron/{shark_beta => shark/beta}/keymaps/via/keymap.c (100%) rename keyboards/acheron/{shark_beta => shark/beta}/keymaps/via/rules.mk (100%) rename keyboards/acheron/{shark_beta => shark/beta}/mcuconf.h (100%) rename keyboards/acheron/{shark_beta => shark/beta}/rules.mk (100%) diff --git a/keyboards/acheron/shark/alpha/alpha.c b/keyboards/acheron/shark/alpha/alpha.c new file mode 100644 index 000000000000..e841f3fbd58f --- /dev/null +++ b/keyboards/acheron/shark/alpha/alpha.c @@ -0,0 +1,16 @@ +/* Copyright 2019 Álvaro "Gondolindrim" Volpato + * + * 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 "alpha.h" diff --git a/keyboards/acheron/shark/alpha/alpha.h b/keyboards/acheron/shark/alpha/alpha.h new file mode 100644 index 000000000000..d58b72548aa6 --- /dev/null +++ b/keyboards/acheron/shark/alpha/alpha.h @@ -0,0 +1,39 @@ +/* Copyright 2019 Álvaro "Gondolindrim" Volpato + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once + +#include "quantum.h" + +/* This a shortcut to help you visually see your layout. + * + * The first section contains all of the arguments representing the physical + * layout of the board and position of the keys. + * + * The second converts the arguments into a two-dimensional array which + * represents the switch matrix. + */ +#define LAYOUT_ortho_4x12( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B \ +) \ +{ \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B } \ +} diff --git a/keyboards/acheron/shark/config.h b/keyboards/acheron/shark/alpha/config.h similarity index 100% rename from keyboards/acheron/shark/config.h rename to keyboards/acheron/shark/alpha/config.h diff --git a/keyboards/acheron/shark/info.json b/keyboards/acheron/shark/alpha/info.json similarity index 100% rename from keyboards/acheron/shark/info.json rename to keyboards/acheron/shark/alpha/info.json diff --git a/keyboards/acheron/shark/keymaps/ajp10304/readme.md b/keyboards/acheron/shark/alpha/keymaps/ajp10304/readme.md similarity index 100% rename from keyboards/acheron/shark/keymaps/ajp10304/readme.md rename to keyboards/acheron/shark/alpha/keymaps/ajp10304/readme.md diff --git a/keyboards/acheron/shark/keymaps/default/keymap.c b/keyboards/acheron/shark/alpha/keymaps/default/keymap.c similarity index 100% rename from keyboards/acheron/shark/keymaps/default/keymap.c rename to keyboards/acheron/shark/alpha/keymaps/default/keymap.c diff --git a/keyboards/acheron/shark/keymaps/via/keymap.c b/keyboards/acheron/shark/alpha/keymaps/via/keymap.c similarity index 100% rename from keyboards/acheron/shark/keymaps/via/keymap.c rename to keyboards/acheron/shark/alpha/keymaps/via/keymap.c diff --git a/keyboards/acheron/shark/keymaps/via/rules.mk b/keyboards/acheron/shark/alpha/keymaps/via/rules.mk similarity index 100% rename from keyboards/acheron/shark/keymaps/via/rules.mk rename to keyboards/acheron/shark/alpha/keymaps/via/rules.mk diff --git a/keyboards/acheron/shark/readme.md b/keyboards/acheron/shark/alpha/readme.md similarity index 100% rename from keyboards/acheron/shark/readme.md rename to keyboards/acheron/shark/alpha/readme.md diff --git a/keyboards/acheron/shark/rules.mk b/keyboards/acheron/shark/alpha/rules.mk similarity index 100% rename from keyboards/acheron/shark/rules.mk rename to keyboards/acheron/shark/alpha/rules.mk diff --git a/keyboards/acheron/shark_beta/shark_beta.c b/keyboards/acheron/shark/beta/beta.c similarity index 97% rename from keyboards/acheron/shark_beta/shark_beta.c rename to keyboards/acheron/shark/beta/beta.c index 89dedc17d33b..f2051cf30240 100644 --- a/keyboards/acheron/shark_beta/shark_beta.c +++ b/keyboards/acheron/shark/beta/beta.c @@ -14,7 +14,7 @@ * along with this program. If not, see . */ -#include "shark_beta.h" +#include "beta.h" void board_init_keymap(void); diff --git a/keyboards/acheron/shark_beta/shark_beta.h b/keyboards/acheron/shark/beta/beta.h similarity index 100% rename from keyboards/acheron/shark_beta/shark_beta.h rename to keyboards/acheron/shark/beta/beta.h diff --git a/keyboards/acheron/shark_beta/chconf.h b/keyboards/acheron/shark/beta/chconf.h similarity index 100% rename from keyboards/acheron/shark_beta/chconf.h rename to keyboards/acheron/shark/beta/chconf.h diff --git a/keyboards/acheron/shark_beta/config.h b/keyboards/acheron/shark/beta/config.h similarity index 100% rename from keyboards/acheron/shark_beta/config.h rename to keyboards/acheron/shark/beta/config.h diff --git a/keyboards/acheron/shark_beta/halconf.h b/keyboards/acheron/shark/beta/halconf.h similarity index 100% rename from keyboards/acheron/shark_beta/halconf.h rename to keyboards/acheron/shark/beta/halconf.h diff --git a/keyboards/acheron/shark_beta/keymaps/default/keymap.c b/keyboards/acheron/shark/beta/keymaps/default/keymap.c similarity index 100% rename from keyboards/acheron/shark_beta/keymaps/default/keymap.c rename to keyboards/acheron/shark/beta/keymaps/default/keymap.c diff --git a/keyboards/acheron/shark_beta/keymaps/gondolindrim/keymap.c b/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c similarity index 100% rename from keyboards/acheron/shark_beta/keymaps/gondolindrim/keymap.c rename to keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c diff --git a/keyboards/acheron/shark_beta/keymaps/gondolindrim/rules.mk b/keyboards/acheron/shark/beta/keymaps/gondolindrim/rules.mk similarity index 100% rename from keyboards/acheron/shark_beta/keymaps/gondolindrim/rules.mk rename to keyboards/acheron/shark/beta/keymaps/gondolindrim/rules.mk diff --git a/keyboards/acheron/shark_beta/keymaps/via/keymap.c b/keyboards/acheron/shark/beta/keymaps/via/keymap.c similarity index 100% rename from keyboards/acheron/shark_beta/keymaps/via/keymap.c rename to keyboards/acheron/shark/beta/keymaps/via/keymap.c diff --git a/keyboards/acheron/shark_beta/keymaps/via/rules.mk b/keyboards/acheron/shark/beta/keymaps/via/rules.mk similarity index 100% rename from keyboards/acheron/shark_beta/keymaps/via/rules.mk rename to keyboards/acheron/shark/beta/keymaps/via/rules.mk diff --git a/keyboards/acheron/shark_beta/mcuconf.h b/keyboards/acheron/shark/beta/mcuconf.h similarity index 100% rename from keyboards/acheron/shark_beta/mcuconf.h rename to keyboards/acheron/shark/beta/mcuconf.h diff --git a/keyboards/acheron/shark_beta/rules.mk b/keyboards/acheron/shark/beta/rules.mk similarity index 100% rename from keyboards/acheron/shark_beta/rules.mk rename to keyboards/acheron/shark/beta/rules.mk diff --git a/keyboards/acheron/shark/shark.c b/keyboards/acheron/shark/shark.c index ab607edae1f2..1a660019e2bb 100644 --- a/keyboards/acheron/shark/shark.c +++ b/keyboards/acheron/shark/shark.c @@ -1,16 +1,14 @@ -/* Copyright 2019 Álvaro "Gondolindrim" Volpato - * - * 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 . - */ + /* Copyright 2022 Álvaro "Gondolindrim" Volpato + * + * 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. + */ + #include "shark.h" diff --git a/keyboards/acheron/shark/shark.h b/keyboards/acheron/shark/shark.h index d58b72548aa6..0f6541988556 100644 --- a/keyboards/acheron/shark/shark.h +++ b/keyboards/acheron/shark/shark.h @@ -1,39 +1,9 @@ -/* Copyright 2019 Álvaro "Gondolindrim" Volpato - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ #pragma once #include "quantum.h" -/* This a shortcut to help you visually see your layout. - * - * The first section contains all of the arguments representing the physical - * layout of the board and position of the keys. - * - * The second converts the arguments into a two-dimensional array which - * represents the switch matrix. - */ -#define LAYOUT_ortho_4x12( \ - K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ - K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ - K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ - K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B \ -) \ -{ \ - { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B }, \ - { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B }, \ - { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B }, \ - { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B } \ -} +#if defined(KEYBOARD_acheron_shark_alpha) + #include "alpha.h" +#elif defined(KEYBOARD_acheron_shark_beta) + #include "beta.h" +#endif From 2bb0a7d9cef0ae0a34a82c059b2225a5ad78e80b Mon Sep 17 00:00:00 2001 From: Gondolindrim Date: Wed, 23 Mar 2022 14:08:11 -0300 Subject: [PATCH 05/18] Add ifdef for keymap function and update readme --- keyboards/acheron/shark/beta/beta.c | 4 +- .../shark/beta/keymaps/gondolindrim/keymap.c | 1 + keyboards/acheron/shark/readme.md | 46 +++++++++++++++++++ 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 keyboards/acheron/shark/readme.md diff --git a/keyboards/acheron/shark/beta/beta.c b/keyboards/acheron/shark/beta/beta.c index f2051cf30240..3a7ea56c162f 100644 --- a/keyboards/acheron/shark/beta/beta.c +++ b/keyboards/acheron/shark/beta/beta.c @@ -16,10 +16,10 @@ #include "beta.h" -void board_init_keymap(void); - void board_init(void) { setPinInput(B6); setPinInput(B7); +#ifdef BOARD_INIT_KEYMAP board_init_keymap(); +#endif } diff --git a/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c b/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c index 64338060c612..a73c62181c06 100755 --- a/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c +++ b/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c @@ -58,6 +58,7 @@ void set_indicator_colors(uint8_t color[3]){ } // Board init: RGB indicator is set to startup_color +#define BOARD_INIT_KEYMAP void board_init_keymap(void){ set_indicator_colors(startup_color); }; diff --git a/keyboards/acheron/shark/readme.md b/keyboards/acheron/shark/readme.md new file mode 100644 index 000000000000..4191e53e8d7f --- /dev/null +++ b/keyboards/acheron/shark/readme.md @@ -0,0 +1,46 @@ +# SharkPCB QMK firmware + +![sharkpcb](https://acheronproject.com/images/shark/shark_beta_pic3.jpg) + +The SharkPCB is an open-source ortholinear 40% layout designed by Gondolindrim for the AcheronProject. + +* Keyboard Maintainer: [Gondolindrim](https://github.com/gondolindrim) +* Hardware Availability: you can get release Beta SharkPCBs using the JLCPCB manufacturer using the files at [its documentation](http:/acheronproject.com/pcbs/shark/shark/) + +## How to flash + +### Enter bootloader + +### Release Alpha: + +The DFU state in the bootloader can be accessed in 2 ways: + +* **Bootmagic reset**: hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard +* **Physical reset button**: press the button on the back of the PCB +* **Keycode in layout**: press the key mapped to `RESET` if it is available (ESC key at layer 1 in the default layout) + +### Release Beta: + +The DFU state in the bootloader can be accessed in 3 ways: + +* **Bootmagic reset**: hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard +* **Physical reset button**: press the button on the back of the PCB, for at least five seconds +* **Keycode in layout**: press the key mapped to `RESET` if it is available (ESC key at layer 1 in the default layout) + +## Compile firmware + +### Release Alpha + +After accessing the DFU state in your PCB, build the default layout using: + + make acheron/shark/alpha:default + +### Release Beta + +After accessing the DFU state in your PCB, build the default layout using: + + make acheron/shark/beta:default + +Then download the resulting binary `*bin` file using `dfu-util` or QMK Toolbox. + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). From 1af174c68b9537c4ef33f9038795634aeb1aa4ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20A=2E=20Volpato?= Date: Wed, 23 Mar 2022 21:20:02 -0300 Subject: [PATCH 06/18] Remove ENCODER_RESOLUTION def Co-authored-by: Drashna Jaelre --- keyboards/acheron/shark/beta/config.h | 1 - 1 file changed, 1 deletion(-) diff --git a/keyboards/acheron/shark/beta/config.h b/keyboards/acheron/shark/beta/config.h index e110713725f8..f17f350585f3 100644 --- a/keyboards/acheron/shark/beta/config.h +++ b/keyboards/acheron/shark/beta/config.h @@ -62,4 +62,3 @@ along with this program. If not, see . #define ENCODERS_PAD_A { C14 } #define ENCODERS_PAD_B { C15 } -#define ENCODER_RESOLUTION 4 From 9d939d252cac9c112b61392bf2a0fef76f1db78a Mon Sep 17 00:00:00 2001 From: Gondolindrim Date: Wed, 23 Mar 2022 21:22:09 -0300 Subject: [PATCH 07/18] Remove Shark Alpha readme --- keyboards/acheron/shark/alpha/readme.md | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 keyboards/acheron/shark/alpha/readme.md diff --git a/keyboards/acheron/shark/alpha/readme.md b/keyboards/acheron/shark/alpha/readme.md deleted file mode 100644 index 962a73c6d127..000000000000 --- a/keyboards/acheron/shark/alpha/readme.md +++ /dev/null @@ -1,17 +0,0 @@ -# Acheron Aχξρων 40-SM-O-MX-TH-WI (Codename "SharkPCB") QMK firmware - -

- -

- -This is the QMK firmware repository for the Shark, updated until [revision Alpha](https://github.com/Gondolindrim/SharkPCB/releases/tag/Alpha). - -The SharkPCB is an Open-Hardware guidelines compliant PCB which files can be found at [this link](https://github.com/Gondolindrim/SharkPCB). Its designer and maintainer is [Gondolindrim](https://github.com/Gondolindrim). - -See the [AcheronDocs](https://gondolindrim.github.io/AcheronDocs/shark/intro.html) page for the SharkPCB full documentation. - -Make example for this keyboard (after setting up your build environment): - - make acheron/shark:default - -See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). From 2ed915e088cd40d61fd3585147f6a91c6ac252d9 Mon Sep 17 00:00:00 2001 From: Gondolindrim Date: Thu, 24 Mar 2022 16:53:14 -0300 Subject: [PATCH 08/18] Tweak encoder callbacks --- keyboards/acheron/shark/beta/beta.c | 22 +++++++++++++++++++ keyboards/acheron/shark/beta/config.h | 3 +++ .../shark/beta/keymaps/gondolindrim/keymap.c | 3 ++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/keyboards/acheron/shark/beta/beta.c b/keyboards/acheron/shark/beta/beta.c index 3a7ea56c162f..8ddfa91b2ac1 100644 --- a/keyboards/acheron/shark/beta/beta.c +++ b/keyboards/acheron/shark/beta/beta.c @@ -23,3 +23,25 @@ void board_init(void) { board_init_keymap(); #endif } + +#ifdef ENCODER_ENABLE +bool encoder_update_kb(uint8_t index, bool clockwise) { + +/* +User callback: if encoder_update_user is defined in keymap.c, use + +#define USER_ENCODER + +in config.h to inhibit encoder_update_kb. If this is not defined then encoder_update_kb supersedes _user and the encoder behavior will be the default volume up and down +*/ +#ifdef USER_ENCODER + return encoder_update_user(index, clockwise); +#else + if (index == 0) { + if (clockwise) tap_code_delay(KC_VOLD, 10); + else tap_code_delay(KC_VOLU, 10); + } + return true; +#endif +} +#endif diff --git a/keyboards/acheron/shark/beta/config.h b/keyboards/acheron/shark/beta/config.h index f17f350585f3..39a831da7dec 100644 --- a/keyboards/acheron/shark/beta/config.h +++ b/keyboards/acheron/shark/beta/config.h @@ -62,3 +62,6 @@ along with this program. If not, see . #define ENCODERS_PAD_A { C14 } #define ENCODERS_PAD_B { C15 } + +// Use this define if you want to use a non-standard encoder callback. This will inhibit the action of encoder_update_kb and replace it with the encoder_update_user defined in the keymap +//#define USER_ENCODER diff --git a/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c b/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c index a73c62181c06..46fe502e9b36 100755 --- a/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c +++ b/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c @@ -16,6 +16,7 @@ along with this program. If not, see . */ #include QMK_KEYBOARD_H #include "config_common.h" + #define MEDIA_KEY_DELAY 10 #define ALT_TAB_DELAY 1000 @@ -140,7 +141,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) { break; } } - return true; + return false; } uint32_t held_click_timer = 0; From 12d2f2ea64adda25290ad110ba076030058e387c Mon Sep 17 00:00:00 2001 From: Gondolindrim Date: Mon, 28 Mar 2022 11:25:57 -0300 Subject: [PATCH 09/18] Update encoder function to suport user-defined callback --- keyboards/acheron/shark/beta/beta.c | 23 ++++++----------------- keyboards/acheron/shark/beta/config.h | 3 --- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/keyboards/acheron/shark/beta/beta.c b/keyboards/acheron/shark/beta/beta.c index 8ddfa91b2ac1..f568fd66423d 100644 --- a/keyboards/acheron/shark/beta/beta.c +++ b/keyboards/acheron/shark/beta/beta.c @@ -26,22 +26,11 @@ void board_init(void) { #ifdef ENCODER_ENABLE bool encoder_update_kb(uint8_t index, bool clockwise) { - -/* -User callback: if encoder_update_user is defined in keymap.c, use - -#define USER_ENCODER - -in config.h to inhibit encoder_update_kb. If this is not defined then encoder_update_kb supersedes _user and the encoder behavior will be the default volume up and down -*/ -#ifdef USER_ENCODER - return encoder_update_user(index, clockwise); -#else - if (index == 0) { - if (clockwise) tap_code_delay(KC_VOLD, 10); - else tap_code_delay(KC_VOLU, 10); - } - return true; -#endif + if(!encoder_update_user(index, clockwise)) return false; + if (index == 0) { + if (clockwise) tap_code_delay(KC_VOLU, 10); + else tap_code_delay(KC_VOLD, 10); + } + return true; } #endif diff --git a/keyboards/acheron/shark/beta/config.h b/keyboards/acheron/shark/beta/config.h index 39a831da7dec..f17f350585f3 100644 --- a/keyboards/acheron/shark/beta/config.h +++ b/keyboards/acheron/shark/beta/config.h @@ -62,6 +62,3 @@ along with this program. If not, see . #define ENCODERS_PAD_A { C14 } #define ENCODERS_PAD_B { C15 } - -// Use this define if you want to use a non-standard encoder callback. This will inhibit the action of encoder_update_kb and replace it with the encoder_update_user defined in the keymap -//#define USER_ENCODER From 443099704026f03feac5002706e06af50f2c839d Mon Sep 17 00:00:00 2001 From: Gondolindrim Date: Mon, 28 Mar 2022 15:10:24 -0300 Subject: [PATCH 10/18] Tidy up encode callbacks --- keyboards/acheron/shark/beta/beta.c | 4 - keyboards/acheron/shark/beta/config.h | 4 +- .../shark/beta/keymaps/default/keymap.c | 9 - .../shark/beta/keymaps/gondolindrim/keymap.c | 171 ++++++++++-------- .../acheron/shark/beta/keymaps/via/keymap.c | 9 - 5 files changed, 93 insertions(+), 104 deletions(-) diff --git a/keyboards/acheron/shark/beta/beta.c b/keyboards/acheron/shark/beta/beta.c index f568fd66423d..597dc785485d 100644 --- a/keyboards/acheron/shark/beta/beta.c +++ b/keyboards/acheron/shark/beta/beta.c @@ -15,13 +15,9 @@ */ #include "beta.h" - void board_init(void) { setPinInput(B6); setPinInput(B7); -#ifdef BOARD_INIT_KEYMAP - board_init_keymap(); -#endif } #ifdef ENCODER_ENABLE diff --git a/keyboards/acheron/shark/beta/config.h b/keyboards/acheron/shark/beta/config.h index f17f350585f3..496f75a101ba 100644 --- a/keyboards/acheron/shark/beta/config.h +++ b/keyboards/acheron/shark/beta/config.h @@ -60,5 +60,5 @@ along with this program. If not, see . #define WS2812_DMA_STREAM STM32_DMA2_STREAM5 #define WS2812_DMA_CHANNEL 6 -#define ENCODERS_PAD_A { C14 } -#define ENCODERS_PAD_B { C15 } +#define ENCODERS_PAD_A { C15 } +#define ENCODERS_PAD_B { C14 } diff --git a/keyboards/acheron/shark/beta/keymaps/default/keymap.c b/keyboards/acheron/shark/beta/keymaps/default/keymap.c index 692eb5167033..5cf5ac40da96 100644 --- a/keyboards/acheron/shark/beta/keymaps/default/keymap.c +++ b/keyboards/acheron/shark/beta/keymaps/default/keymap.c @@ -41,12 +41,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS ) }; - -bool encoder_update_user(uint8_t index, bool clockwise) { - if (clockwise) { - tap_code_delay(KC_VOLU, 10); - } else { - tap_code_delay(KC_VOLD, 10); - } - return false; -} diff --git a/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c b/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c index 46fe502e9b36..9b685f125961 100755 --- a/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c +++ b/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c @@ -24,13 +24,54 @@ along with this program. If not, see . // Defining encoder click keycode enum keyboard_keycodes { - ECLICK = 0x5F80, // Encoder click - ALTTABS , // For alt-tab-switch + ECLICK = SAFE_RANGE, // Encoder click + ALTTABF , // ALT-TAB forward + ALTTABB , // ALT-TAB backwards ALTTABC , // For alt-tab-click ENCMUP , // Encoder mode up - ENCMDN // Encoder mode down + ENCMDN , // Encoder mode down + NEW_SAFE_RANGE }; +// Creates sample keyevents and keyrecords to be used in the processing of the custom keycodes +const keyevent_t sample_pressed_keyevent = { + .key = (keypos_t){.row = 5, .col = 13}, + .pressed = true, + .time = 0 +}; + +keyrecord_t sample_pressed_keyrecord = { + .event = sample_pressed_keyevent +}; + +const keyevent_t sample_released_keyevent = { + .key = (keypos_t){.row = 5, .col = 13}, + .pressed = false, + .time = 0 +}; + +keyrecord_t sample_released_keyrecord = { + .event = sample_released_keyevent +}; + +// tap_process_record_user calls process_record_user with the pressed and released sample keyrecords with a delay of MEDIA_KEY_DELAY. The idea is to allow custom keycodes a simulation of a key press and release, allowing them to be treated in process_record_user. This, in turn, allows the custom keycodes to be used both in the encoder callback and the keyboard keymap. +uint16_t temp_timer = 0; +void tap_process_record_user(uint16_t keycode) +{ + temp_timer = timer_read(); + sample_pressed_keyrecord.event.time = timer_read(); + process_record_user( keycode, &sample_pressed_keyrecord ); + while (timer_elapsed(temp_timer) < MEDIA_KEY_DELAY); + sample_released_keyrecord.event.time = timer_read(); + process_record_user( keycode, &sample_released_keyrecord ); +} + +// process_special_keycode is a function that distinguishes between the native keycodes and the ones custom-defined here. Normal keycodes are tapped, while keycodes in the SAFE_RANGE - NEW_SAFE_RANGE interval are treated with tap_process_record_user. +void process_special_keycode(uint16_t keycode) { + if (SAFE_RANGE <= keycode && keycode < NEW_SAFE_RANGE) tap_process_record_user(keycode); + else tap_code(keycode); +} + uint16_t encoder_click_delay = ENCODER_MODE_CHANGE_DELAY; uint8_t startup_color[3] = {0xFF,0xFF,0xFF}; @@ -40,12 +81,13 @@ typedef struct _encoder_mode_t { uint16_t clockwise_key[4]; uint16_t counterclockwise_key[4]; uint16_t clicked_key[4] ; + uint16_t hold_key; } encoder_mode_t; encoder_mode_t encoder_modes[] = { - { .indicator_color = {0x22,0x00,0xFF} , .clockwise_key = {KC_VOLD, KC_VOLD, ENCMDN, KC_VOLD}, .counterclockwise_key = {KC_VOLU, KC_VOLU, ENCMUP, KC_VOLU}, .clicked_key = {KC_MUTE, KC_MPLY, KC_MUTE, KC_MUTE} }, - { .indicator_color = {0x00,0x33,0xFF} , .clockwise_key = {KC_WH_D, KC_WH_D, ENCMDN, KC_WH_D}, .counterclockwise_key = {KC_WH_U, KC_WH_U, ENCMUP, KC_WH_U}, .clicked_key = {KC_BTN1, KC_BTN1, KC_BTN1, KC_BTN1} }, - { .indicator_color = {0xFF,0x88,0x00} , .clockwise_key = {ALTTABS, ALTTABS, ENCMDN, ALTTABS}, .counterclockwise_key = {ALTTABS, ALTTABS, ENCMUP, ALTTABS}, .clicked_key = {ALTTABC, ALTTABC, ALTTABC, ALTTABC} } + { .indicator_color = {0x22,0x00,0xFF} , .clockwise_key = {KC_VOLU, KC_VOLU, ENCMUP, KC_VOLU}, .counterclockwise_key = {KC_VOLD, KC_VOLD, ENCMDN, KC_VOLD}, .clicked_key = {KC_MUTE, KC_MPLY, KC_MUTE, KC_MUTE}, .hold_key = ENCMUP }, + { .indicator_color = {0x00,0x33,0xFF} , .clockwise_key = {KC_WH_D, KC_WH_D, ENCMUP, KC_WH_D}, .counterclockwise_key = {KC_WH_U, KC_WH_U, ENCMDN, KC_WH_U}, .clicked_key = {KC_BTN1, KC_BTN1, KC_BTN1, KC_BTN1}, .hold_key = ENCMUP }, + { .indicator_color = {0xFF,0x88,0x00} , .clockwise_key = {ALTTABF, ALTTABF, ENCMUP, ALTTABF}, .counterclockwise_key = {ALTTABB, ALTTABB, ENCMDN, ALTTABB}, .clicked_key = {ALTTABC, ALTTABC, ALTTABC, ALTTABC}, .hold_key = ENCMUP } // Insert your custom encoder mode here }; @@ -59,8 +101,7 @@ void set_indicator_colors(uint8_t color[3]){ } // Board init: RGB indicator is set to startup_color -#define BOARD_INIT_KEYMAP -void board_init_keymap(void){ +void keyboard_pre_init_user(void){ set_indicator_colors(startup_color); }; @@ -109,45 +150,19 @@ void cycle_encoder_mode(bool forward){ else encoder_mode_count-- ; if (encoder_mode_count == -1) encoder_mode_count = NUM_ENCODER_MODES - 1; // Shifts encoder mode backward - encoder_mode_count = encoder_mode_count%NUM_ENCODER_MODES ; // This makes sure encoder_mode_count keeps cycling between 0,1,...,NUM_ENCODER_MODES and doesnt eventually overflow + encoder_mode_count = encoder_mode_count % NUM_ENCODER_MODES ; // This makes sure encoder_mode_count keeps cycling between 0,1,...,NUM_ENCODER_MODES and doesnt eventually overflow set_indicator_colors( encoder_modes[ encoder_mode_count ].indicator_color ); // Set indicator color to the corresponding defined color } bool encoder_update_user(uint8_t index, bool clockwise) { - if (clockwise) mapped_code = encoder_modes[ encoder_mode_count ].clockwise_key[ current_layer ]; - else mapped_code = encoder_modes[ encoder_mode_count ].counterclockwise_key[ current_layer ]; - switch (mapped_code) { - case ALTTABS: - if(!is_alt_tab_active) { - is_alt_tab_active = true; - register_code(KC_LALT); - } - alt_tab_timer = timer_read32(); - tap_code16(!clockwise ? KC_TAB : S(KC_TAB)); - break; - case ENCMUP: - cycle_encoder_mode(true); - break; - case ENCMDN: - cycle_encoder_mode(false); - break; - default: - { - register_code(mapped_code); - held_keycode_timer = timer_read32(); - while (timer_elapsed32(held_keycode_timer) < MEDIA_KEY_DELAY) - ; /* no-op */ - unregister_code(mapped_code); - break; - } - } + process_special_keycode(clockwise ? encoder_modes[ encoder_mode_count ].clockwise_key[ current_layer ] : encoder_modes[ encoder_mode_count ].counterclockwise_key[ current_layer ]); return false; } uint32_t held_click_timer = 0; bool is_click_held = false; bool is_shift_held = false; -bool automatic_encoder_mode_cycle = false; // This flag registers if the encoder mode was automatically cycled +bool automatic_hold_cycle = false; // This flag registers if the encoder hold was automatically cycled // This bool records if LALT is pressed or not. Due to the automatic disabling of the ALT-TAB of the ALTTABS custom keystroke, the automatic disabling can un-register KC_LALT even when the LALT key is phisically pressed. Hence there needs to be two bools: one that keebs track of the ALT-TAB activity and one that keeps track of LALT so that the automatic disabling will not disable LALT if it is phisically pressed. bool is_lalt_pressed = false; @@ -160,71 +175,67 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { else is_shift_held = false; return true; case ECLICK: - if (record->event.pressed) { // What to do when the encoder is pressed + // Checks if the encoder has been pressed; if so, sets the corresponding flag and starts the corresponding timer + if (record->event.pressed) { is_click_held = true; - held_click_timer = timer_read32(); // If the encoder delayed mode change is on, triggers a timer - } else { // What to do when encoder is released + held_click_timer = timer_read32(); + // Checks if the encoder has been released: samples the duration of the encoder push; if this time was less than the encoder_click_delay, processes the clicked key. If it was bigger, processes the hold key. This behavior is adjusted using the ENCODER_MODE_CHANGE_DELAY macro. There is an exception made when automatic_hold_cycle is true; this means that the encoder push has been pressed enough to trigger a hold cycle. This case is taken care of in the housekeeping routine, where the held key is triggered and the timer reset. Hence the automatic_hold_cycle needs to be checked because without this check the function will trigger the clicked key after the hold cycle has been cycled more than once. + } else { is_click_held = false; - - // Scans for the time the click was pressed and does what it has to do -- sample the timer which was triggered on press and use the sampled time to either send out the click key or change mode in case the click is held for more than ENCODER_MODE_CHANGE_DELAY - if (timer_elapsed32(held_click_timer) < encoder_click_delay && !automatic_encoder_mode_cycle ){ // Checking if the time the encoder click was held was smaller than the delay defined and if an automatic mode change was not already performed. If it was, just register whatever it is the click does. - switch ( encoder_modes[ encoder_mode_count ].clicked_key[ current_layer ] ){ - case ALTTABC: - if (is_alt_tab_active) { - if (!is_lalt_pressed) unregister_code(KC_LALT); - is_alt_tab_active = false; - } - break; - case ENCMUP: - cycle_encoder_mode(true); - break; - case ENCMDN: - cycle_encoder_mode(false); - break; - default: - register_code( encoder_modes[ encoder_mode_count ].clicked_key[ current_layer ] ); - held_keycode_timer = timer_read32(); - while (timer_elapsed32(held_keycode_timer) < MEDIA_KEY_DELAY); - unregister_code( encoder_modes[ encoder_mode_count ].clicked_key[ current_layer ] ); - break; - } - } else { // If the encoder click was held for more time than the delay: - if (!automatic_encoder_mode_cycle) { - if (is_shift_held) cycle_encoder_mode(false); - else cycle_encoder_mode(true); - } - }; - // held_click_timer = 0; - automatic_encoder_mode_cycle = false; - }; - return false; // Skip all further processing of this key + if (timer_elapsed32(held_click_timer) < encoder_click_delay && !automatic_hold_cycle ) process_special_keycode( encoder_modes[ encoder_mode_count ].clicked_key[ current_layer ] ) ; + automatic_hold_cycle = false; + } + return true; // Skip all further processing of this key case KC_LALT: // If this is not defined, if the encoder is activated in the alt-tab mode while the LALT key is pressed, the menu goes away. if (record->event.pressed) is_lalt_pressed = true; else is_lalt_pressed = false; return true; case ENCMUP: - cycle_encoder_mode(true); - return false; case ENCMDN: - cycle_encoder_mode(false); + if (record->event.pressed) cycle_encoder_mode(keycode == ENCMUP); // If keycode == ENCMUP the expression returns true and the cycle function cycles the modes forward. If not, then cycles backwards. + return false; + case ALTTABF: + case ALTTABB: + if (record->event.pressed) { + if (!is_alt_tab_active) { + is_alt_tab_active = true; + register_code(KC_LALT); + + } + tap_code16(keycode == ALTTABF ? KC_TAB : S(KC_TAB)); // Due to S(KC_TAB), the 16-bit tap_code16 is needed. + alt_tab_timer = timer_read32(); + } + return true; + case ALTTABC: + if (record->event.pressed) { + if (is_alt_tab_active) { + if (!is_lalt_pressed) unregister_code(KC_LALT); + is_alt_tab_active = false; + } + } return false; default: return true; // Process all other keycodes normally } } +//sample_pressed_key_keyrecord->event.pressed = true; void housekeeping_task_user(void) { // The very important timer. - if (is_alt_tab_active){ + if (is_alt_tab_active) { if (is_lalt_pressed) alt_tab_timer = timer_read32(); else if (timer_elapsed32(alt_tab_timer) > ALT_TAB_DELAY) { unregister_code(KC_LALT); is_alt_tab_active = false; } } +/* This piece of the code checks for the encoder push timer. If the encoder push interval was less than encoder_click_delay then it is automatically processed by process_record_user by triggering the current mode's click key. However, if the encoder push is held for more time than the defined delay, then the encoder hold "cycles", that is, gets activated and the timer needs to be reset. This does three things: +- (1) Sets the automatic_hold_cycle flag which prevents process_record_user from triggering the click key when the push is released +- (2) Processes the current mode's hold key in process_record_user +- (3) Resets the click timer +*/ if (is_click_held && timer_elapsed32(held_click_timer) > encoder_click_delay ){ - automatic_encoder_mode_cycle = true; + automatic_hold_cycle = true; + process_special_keycode( encoder_modes[ encoder_mode_count ].hold_key ); held_click_timer = timer_read32(); - if (is_shift_held) cycle_encoder_mode(false); - else cycle_encoder_mode(true); } } diff --git a/keyboards/acheron/shark/beta/keymaps/via/keymap.c b/keyboards/acheron/shark/beta/keymaps/via/keymap.c index 692eb5167033..5cf5ac40da96 100644 --- a/keyboards/acheron/shark/beta/keymaps/via/keymap.c +++ b/keyboards/acheron/shark/beta/keymaps/via/keymap.c @@ -41,12 +41,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS , KC_TRNS ) }; - -bool encoder_update_user(uint8_t index, bool clockwise) { - if (clockwise) { - tap_code_delay(KC_VOLU, 10); - } else { - tap_code_delay(KC_VOLD, 10); - } - return false; -} From 545e3e8542beb00edc4939ca0af1e7a3b35969f5 Mon Sep 17 00:00:00 2001 From: Gondolindrim Date: Mon, 28 Mar 2022 15:13:26 -0300 Subject: [PATCH 11/18] Remove unnecessary comment --- keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c b/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c index 9b685f125961..1a04452ba6ea 100755 --- a/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c +++ b/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c @@ -219,8 +219,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } } -//sample_pressed_key_keyrecord->event.pressed = true; -void housekeeping_task_user(void) { // The very important timer. +void housekeeping_task_user(void) { if (is_alt_tab_active) { if (is_lalt_pressed) alt_tab_timer = timer_read32(); else if (timer_elapsed32(alt_tab_timer) > ALT_TAB_DELAY) { From 1da7a6a4ca37e1422f72bd4340b3743f173e24fb Mon Sep 17 00:00:00 2001 From: Gondolindrim Date: Mon, 28 Mar 2022 15:50:02 -0300 Subject: [PATCH 12/18] Add persistent encoder modes feature --- .../shark/beta/keymaps/gondolindrim/keymap.c | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c b/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c index 1a04452ba6ea..759b402b1bbb 100755 --- a/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c +++ b/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c @@ -20,9 +20,12 @@ along with this program. If not, see . #define MEDIA_KEY_DELAY 10 #define ALT_TAB_DELAY 1000 +// Persistent encoder modes: the current encoder mode is written into EEPROM memory, and retrieved at the keyboard initialization. This means the current encoder mode is persistent even if the keyboard is reset or turned off +#define PERSISTENT_ENCODER_MODES + #define ENCODER_MODE_CHANGE_DELAY 500 -// Defining encoder click keycode +// Defining special keycodes enum keyboard_keycodes { ECLICK = SAFE_RANGE, // Encoder click ALTTABF , // ALT-TAB forward @@ -33,7 +36,7 @@ enum keyboard_keycodes { NEW_SAFE_RANGE }; -// Creates sample keyevents and keyrecords to be used in the processing of the custom keycodes +// Creates sample keyevents and keyrecords to be used in the processing of the custom keycodes. Their time should be resampled everytime they are used; their cols and rows are set to be "impossible", that is, outside the normal key matrix bounds. const keyevent_t sample_pressed_keyevent = { .key = (keypos_t){.row = 5, .col = 13}, .pressed = true, @@ -96,9 +99,19 @@ encoder_mode_t encoder_modes[] = { // This counter is used to track what encoder mode is being used at a certain time int encoder_mode_count = 0; -void set_indicator_colors(uint8_t color[3]){ - rgblight_setrgb(color[0], color[1], color[2]); -} + +#ifdef PERSISTENT_ENCODER_MODES +typedef union { + uint32_t raw; + struct { + int user_encoder_mode_count; +}; +} user_config_t; + +user_config_t user_config; +#endif + +void set_indicator_colors(uint8_t color[3]) rgblight_setrgb(color[0], color[1], color[2]); // Board init: RGB indicator is set to startup_color void keyboard_pre_init_user(void){ @@ -106,7 +119,13 @@ void keyboard_pre_init_user(void){ }; void keyboard_post_init_user(void){ - set_indicator_colors(encoder_modes[0].indicator_color); +#ifdef PERSISTENT_ENCODER_MODES + user_config.raw = eeconfig_read_user(); + encoder_mode_count = user_config.user_encoder_mode_count ; +#else + encoder_mode_count = 0; +#endif + set_indicator_colors(encoder_modes[ encoder_mode_count ].indicator_color); }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -151,6 +170,10 @@ void cycle_encoder_mode(bool forward){ if (encoder_mode_count == -1) encoder_mode_count = NUM_ENCODER_MODES - 1; // Shifts encoder mode backward encoder_mode_count = encoder_mode_count % NUM_ENCODER_MODES ; // This makes sure encoder_mode_count keeps cycling between 0,1,...,NUM_ENCODER_MODES and doesnt eventually overflow +#ifdef PERSISTENT_ENCODER_MODES + user_config.user_encoder_mode_count = encoder_mode_count ; + eeconfig_update_user(user_config.raw); +#endif set_indicator_colors( encoder_modes[ encoder_mode_count ].indicator_color ); // Set indicator color to the corresponding defined color } From 76f8ca56261715bf1d07b9feaacf72285a050a3a Mon Sep 17 00:00:00 2001 From: Gondolindrim Date: Sat, 9 Apr 2022 16:18:25 -0300 Subject: [PATCH 13/18] Fix function on keymap --- keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c b/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c index 759b402b1bbb..cae98411d6e8 100755 --- a/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c +++ b/keyboards/acheron/shark/beta/keymaps/gondolindrim/keymap.c @@ -111,7 +111,9 @@ typedef union { user_config_t user_config; #endif -void set_indicator_colors(uint8_t color[3]) rgblight_setrgb(color[0], color[1], color[2]); +void set_indicator_colors(uint8_t color[3]){ + rgblight_setrgb(color[0], color[1], color[2]); +} // Board init: RGB indicator is set to startup_color void keyboard_pre_init_user(void){ From ba5473a3abe715bfb478dc3bfb34d76d2249dd98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20A=2E=20Volpato?= Date: Wed, 13 Apr 2022 16:58:10 -0300 Subject: [PATCH 14/18] Remove BOOTMAGIC_ENABLE from via rules Co-authored-by: Ryan --- keyboards/acheron/shark/beta/keymaps/via/rules.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/keyboards/acheron/shark/beta/keymaps/via/rules.mk b/keyboards/acheron/shark/beta/keymaps/via/rules.mk index 666e72557b07..1e5b99807cb7 100644 --- a/keyboards/acheron/shark/beta/keymaps/via/rules.mk +++ b/keyboards/acheron/shark/beta/keymaps/via/rules.mk @@ -1,2 +1 @@ VIA_ENABLE = yes -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite From e249143b74746acf5b33f15db77b0fb8a533c707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20A=2E=20Volpato?= Date: Wed, 13 Apr 2022 16:58:34 -0300 Subject: [PATCH 15/18] Formatting of rules.mk Co-authored-by: Ryan --- keyboards/acheron/shark/beta/rules.mk | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/keyboards/acheron/shark/beta/rules.mk b/keyboards/acheron/shark/beta/rules.mk index acdfda720616..7cf13086bce1 100644 --- a/keyboards/acheron/shark/beta/rules.mk +++ b/keyboards/acheron/shark/beta/rules.mk @@ -6,22 +6,20 @@ BOOTLOADER = stm32-dfu # Build Options # change yes to no to disable # -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -MOUSEKEY_ENABLE = yes # Mouse keys +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 = yes # Commands for debug and configuration -# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend -# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -NKRO_ENABLE = yes # USB Nkey Rollover -BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality -BACKLIGHT_DRIVER = pwm -RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +NKRO_ENABLE = yes # Enable N-Key rollover +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow AUDIO_ENABLE = no # Audio output +BACKLIGHT_DRIVER = pwm LTO_ENABLE = yes -ENCODER_ENABLE = no -LAYOUTS=ortho_4x12 -ENCODER_ENABLE=yes +ENCODER_ENABLE = yes + +LAYOUTS = ortho_4x12 + # Enter lower-power sleep mode when on the ChibiOS idle thread OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE From 5d858009e8528c0a059dd026ee05dda12acf5984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20A=2E=20Volpato?= Date: Wed, 13 Apr 2022 17:25:19 -0300 Subject: [PATCH 16/18] Use smaller README image --- keyboards/acheron/shark/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/acheron/shark/readme.md b/keyboards/acheron/shark/readme.md index 4191e53e8d7f..d805571ebb2b 100644 --- a/keyboards/acheron/shark/readme.md +++ b/keyboards/acheron/shark/readme.md @@ -1,6 +1,6 @@ # SharkPCB QMK firmware -![sharkpcb](https://acheronproject.com/images/shark/shark_beta_pic3.jpg) +![sharkpcb](https://acheronproject.com/images/shark/shark_beta_pic3_small.jpg) The SharkPCB is an open-source ortholinear 40% layout designed by Gondolindrim for the AcheronProject. From d07cfddff10e684b81aeafc6d0559d5b7b7dbe90 Mon Sep 17 00:00:00 2001 From: Gondolindrim Date: Thu, 14 Apr 2022 23:41:50 -0300 Subject: [PATCH 17/18] Adjust PLL multipliers for 96MHz and reintroduce I2C EEPROM --- keyboards/acheron/shark/beta/config.h | 2 ++ keyboards/acheron/shark/beta/mcuconf.h | 4 ++-- keyboards/acheron/shark/beta/rules.mk | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/keyboards/acheron/shark/beta/config.h b/keyboards/acheron/shark/beta/config.h index 496f75a101ba..54fa270336b3 100644 --- a/keyboards/acheron/shark/beta/config.h +++ b/keyboards/acheron/shark/beta/config.h @@ -62,3 +62,5 @@ along with this program. If not, see . #define ENCODERS_PAD_A { C15 } #define ENCODERS_PAD_B { C14 } + +#define EEPROM_I2C_24LC256 diff --git a/keyboards/acheron/shark/beta/mcuconf.h b/keyboards/acheron/shark/beta/mcuconf.h index 0ea015be4f9d..35d7e95f57e0 100644 --- a/keyboards/acheron/shark/beta/mcuconf.h +++ b/keyboards/acheron/shark/beta/mcuconf.h @@ -25,9 +25,9 @@ #undef STM32_PPRE2 #define STM32_PLLM_VALUE 4 -#define STM32_PLLN_VALUE 72 +#define STM32_PLLN_VALUE 96 #define STM32_PLLP_VALUE 2 -#define STM32_PLLQ_VALUE 3 +#define STM32_PLLQ_VALUE 4 #define STM32_PPRE1 STM32_PPRE1_DIV2 #define STM32_PPRE2 STM32_PPRE2_DIV1 diff --git a/keyboards/acheron/shark/beta/rules.mk b/keyboards/acheron/shark/beta/rules.mk index 7cf13086bce1..b3c7ab8bfcfc 100644 --- a/keyboards/acheron/shark/beta/rules.mk +++ b/keyboards/acheron/shark/beta/rules.mk @@ -20,6 +20,7 @@ LTO_ENABLE = yes ENCODER_ENABLE = yes LAYOUTS = ortho_4x12 +EEPROM_DRIVER = i2c # Enter lower-power sleep mode when on the ChibiOS idle thread OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE From 57463eafa07ffa22bd1c7597d0861b55ecaaee40 Mon Sep 17 00:00:00 2001 From: Gondolindrim Date: Sat, 16 Apr 2022 19:47:19 -0300 Subject: [PATCH 18/18] Disable LTO --- keyboards/acheron/shark/beta/rules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/acheron/shark/beta/rules.mk b/keyboards/acheron/shark/beta/rules.mk index b3c7ab8bfcfc..928ad2d49af4 100644 --- a/keyboards/acheron/shark/beta/rules.mk +++ b/keyboards/acheron/shark/beta/rules.mk @@ -16,7 +16,7 @@ BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow AUDIO_ENABLE = no # Audio output BACKLIGHT_DRIVER = pwm -LTO_ENABLE = yes +LTO_ENABLE = no ENCODER_ENABLE = yes LAYOUTS = ortho_4x12