diff options
| author | Drashna Jaelre <drashna@live.com> | 2025-05-05 23:19:38 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-05 23:19:38 -0700 |
| commit | 55909141ef49ac87b29486c95cff6fa52bda69ed (patch) | |
| tree | 83fa1b1f54defd1551eb9268de4dcdb55a2b36db | |
| parent | cd6e065f6e25aa87f4ebca29be2dd6dcbdffb1ba (diff) | |
[Keyboard] Update Tractyl Manuform and add F405 (weact) variant (#24764)
18 files changed, 719 insertions, 275 deletions
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/config.h index 194874b5cf..686cb30fc2 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/config.h +++ b/keyboards/handwired/tractyl_manuform/5x6_right/config.h | |||
| @@ -21,13 +21,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 21 | #define ROTATIONAL_TRANSFORM_ANGLE -25 | 21 | #define ROTATIONAL_TRANSFORM_ANGLE -25 |
| 22 | #define POINTING_DEVICE_INVERT_X | 22 | #define POINTING_DEVICE_INVERT_X |
| 23 | 23 | ||
| 24 | #define DYNAMIC_KEYMAP_LAYER_COUNT 16 | ||
| 25 | #define LAYER_STATE_16BIT | ||
| 26 | |||
| 27 | |||
| 28 | /* disable action features */ | ||
| 29 | //#define NO_ACTION_LAYER | ||
| 30 | //#define NO_ACTION_TAPPING | ||
| 31 | //#define NO_ACTION_ONESHOT | ||
| 32 | |||
| 33 | #define POINTING_DEVICE_RIGHT | 24 | #define POINTING_DEVICE_RIGHT |
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f405/board.h b/keyboards/handwired/tractyl_manuform/5x6_right/f405/board.h new file mode 100644 index 0000000000..9be86942d6 --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f405/board.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | /* Copyright 2020 Nick Brassel (tzarc) | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 3 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #pragma once | ||
| 17 | |||
| 18 | #include_next <board.h> | ||
| 19 | |||
| 20 | #undef STM32_HSECLK | ||
| 21 | #define STM32_HSECLK 8000000U | ||
| 22 | #undef STM32_LSECLK | ||
| 23 | #define STM32_LSECLK 32768U | ||
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f405/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/f405/config.h new file mode 100644 index 0000000000..3878d9c671 --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f405/config.h | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | Copyright 2015 Jack Humbert | ||
| 4 | |||
| 5 | This program is free software: you can redistribute it and/or modify | ||
| 6 | it under the terms of the GNU General Public License as published by | ||
| 7 | the Free Software Foundation, either version 2 of the License, or | ||
| 8 | (at your option) any later version. | ||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, | ||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | GNU General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License | ||
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #pragma once | ||
| 20 | |||
| 21 | #define USER_BUTTON_PIN C13 | ||
| 22 | #define DEBUG_LED_PIN B2 | ||
| 23 | #define USB_VBUS_PIN B10 | ||
| 24 | |||
| 25 | #ifdef USE_USB_OTG_HS_PORT | ||
| 26 | # define USB_DRIVER USBD2 | ||
| 27 | #endif | ||
| 28 | |||
| 29 | // WS2812 RGB LED strip input and number of LEDs | ||
| 30 | #define WS2812_PWM_DRIVER PWMD3 | ||
| 31 | #define WS2812_PWM_CHANNEL 1 | ||
| 32 | #define WS2812_PWM_PAL_MODE 2 | ||
| 33 | #define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM2 | ||
| 34 | #define WS2812_PWM_DMA_CHANNEL 5 | ||
| 35 | #define WS2812_EXTERNAL_PULLUP | ||
| 36 | |||
| 37 | #define BACKLIGHT_PWM_DRIVER PWMD8 | ||
| 38 | #define BACKLIGHT_PWM_CHANNEL 2 | ||
| 39 | #define BACKLIGHT_PAL_MODE 3 | ||
| 40 | |||
| 41 | /* Audio config */ | ||
| 42 | #define AUDIO_PIN A4 | ||
| 43 | #define AUDIO_PIN_ALT A5 | ||
| 44 | #define AUDIO_PIN_ALT_AS_NEGATIVE | ||
| 45 | |||
| 46 | /* serial.c configuration for split keyboard */ | ||
| 47 | #define SERIAL_USART_DRIVER SD1 | ||
| 48 | #define SERIAL_USART_TX_PIN A10 | ||
| 49 | #define SERIAL_USART_TX_PAL_MODE 7 | ||
| 50 | #define SERIAL_USART_RX_PIN A9 | ||
| 51 | #define SERIAL_USART_RX_PAL_MODE 7 | ||
| 52 | #define SERIAL_USART_TIMEOUT 10 | ||
| 53 | #define SERIAL_USART_SPEED (1 * 1024 * 1024) | ||
| 54 | #define SERIAL_USART_FULL_DUPLEX | ||
| 55 | |||
| 56 | |||
| 57 | /* i2c config for oleds */ | ||
| 58 | #define I2C_DRIVER I2CD1 | ||
| 59 | #define I2C1_CLOCK_SPEED 400000 | ||
| 60 | #define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_16_9 | ||
| 61 | |||
| 62 | /* spi config for eeprom and pmw3360 sensor */ | ||
| 63 | #define SPI_DRIVER SPID1 | ||
| 64 | #define SPI_SCK_PIN B3 | ||
| 65 | #define SPI_SCK_PAL_MODE 5 | ||
| 66 | #define SPI_MOSI_PIN B5 | ||
| 67 | #define SPI_MOSI_PAL_MODE 5 | ||
| 68 | #define SPI_MISO_PIN B4 | ||
| 69 | #define SPI_MISO_PAL_MODE 5 | ||
| 70 | |||
| 71 | #define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN B13 | ||
| 72 | #define EXTERNAL_FLASH_SPI_CLOCK_DIVISOR 4 | ||
| 73 | #define EXTERNAL_FLASH_SIZE (8 * 1024 * 1024) | ||
| 74 | |||
| 75 | /* pmw3360 config */ | ||
| 76 | #define POINTING_DEVICE_CS_PIN B8 | ||
| 77 | #define POINTING_DEVICE_ROTATION_270 | ||
| 78 | #undef ROTATIONAL_TRANSFORM_ANGLE | ||
| 79 | #define PMW33XX_SPI_DIVISOR 16 | ||
| 80 | |||
| 81 | // lcd | ||
| 82 | #define DISPLAY_RST_PIN NO_PIN | ||
| 83 | #define DISPLAY_DC_PIN B12 | ||
| 84 | #define DISPLAY_CS_PIN B9 | ||
| 85 | #define DISPLAY_SPI_DIVIDER 1 | ||
| 86 | |||
| 87 | #define DRV2605L_FB_ERM_LRA 0 | ||
| 88 | #define DRV2605L_GREETING DRV2605L_EFFECT_750_MS_ALERT_100 | ||
| 89 | #define DRV2605L_DEFAULT_MODE DRV2605L_EFFECT_BUZZ_1_100 | ||
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f405/f405.c b/keyboards/handwired/tractyl_manuform/5x6_right/f405/f405.c new file mode 100644 index 0000000000..5aabc70dca --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f405/f405.c | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | /* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "tractyl_manuform.h" | ||
| 18 | |||
| 19 | #ifdef USB_VBUS_PIN | ||
| 20 | bool usb_vbus_state(void) { | ||
| 21 | gpio_set_pin_input_low(USB_VBUS_PIN); | ||
| 22 | wait_us(5); | ||
| 23 | return gpio_read_pin(USB_VBUS_PIN); | ||
| 24 | } | ||
| 25 | #endif | ||
| 26 | |||
| 27 | #ifdef USER_BUTTON_PIN | ||
| 28 | void user_button_init(void) { | ||
| 29 | // Pin needs to be configured as input low | ||
| 30 | gpio_set_pin_input_low(USER_BUTTON_PIN); | ||
| 31 | } | ||
| 32 | |||
| 33 | bool check_user_button_state(void) { | ||
| 34 | return gpio_read_pin(USER_BUTTON_PIN); | ||
| 35 | } | ||
| 36 | #endif // USER_BUTTON_PIN | ||
| 37 | |||
| 38 | void board_init(void) { | ||
| 39 | // Board setup sets these pins as SPI, but we aren't using them as such. | ||
| 40 | // So to prevent them from misbehaving, we need to set them to a different, non-spi mode. | ||
| 41 | // This is a bit of a hack, but nothing else runs soon enough, without re-implementing spi_init(). | ||
| 42 | gpio_set_pin_input(A5); | ||
| 43 | gpio_set_pin_input(A6); | ||
| 44 | gpio_set_pin_input(A7); | ||
| 45 | |||
| 46 | // If using USB_OTG_HS, we need to set the data pins since they're set wrong for our needs by default. | ||
| 47 | // We set it here by default, in case it's bridged with A11/A12, as to reduce the chance of issues. | ||
| 48 | palSetLineMode( | ||
| 49 | B14, PAL_MODE_ALTERNATE(12) | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUPDR_FLOATING); | ||
| 50 | palSetLineMode( | ||
| 51 | B15, PAL_MODE_ALTERNATE(12) | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUPDR_FLOATING); | ||
| 52 | } | ||
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f405/halconf.h b/keyboards/handwired/tractyl_manuform/5x6_right/f405/halconf.h new file mode 100644 index 0000000000..23f8e5c934 --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f405/halconf.h | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | /* Copyright 2020 Nick Brassel (tzarc) | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 3 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #pragma once | ||
| 17 | |||
| 18 | #define HAL_USE_SERIAL TRUE | ||
| 19 | #define SERIAL_BUFFERS_SIZE 256 | ||
| 20 | |||
| 21 | #if defined(WS2812_PWM) || defined(BACKLIGHT_PWM) | ||
| 22 | # define HAL_USE_PWM TRUE | ||
| 23 | #endif // defined(WS2812_PWM) || defined(BACKLIGHT_PWM) | ||
| 24 | |||
| 25 | #if HAL_USE_SPI == TRUE | ||
| 26 | # define SPI_USE_WAIT TRUE | ||
| 27 | # define SPI_SELECT_MODE SPI_SELECT_MODE_PAD | ||
| 28 | #endif | ||
| 29 | |||
| 30 | #ifdef AUDIO_DRIVER_DAC | ||
| 31 | # define HAL_USE_GPT TRUE | ||
| 32 | # define HAL_USE_DAC TRUE | ||
| 33 | #endif | ||
| 34 | |||
| 35 | #include_next <halconf.h> | ||
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f405/keyboard.json b/keyboards/handwired/tractyl_manuform/5x6_right/f405/keyboard.json new file mode 100644 index 0000000000..b56e2d31c2 --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f405/keyboard.json | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | { | ||
| 2 | "keyboard_name": "Tractyl Manuform (5x6) WeAct STM32F405", | ||
| 3 | "audio": { | ||
| 4 | "driver": "dac_additive", | ||
| 5 | "power_control": { | ||
| 6 | "pin": "A3" | ||
| 7 | } | ||
| 8 | }, | ||
| 9 | "backlight": { | ||
| 10 | "levels": 16, | ||
| 11 | "pin": "C7" | ||
| 12 | }, | ||
| 13 | "bootloader": "stm32-dfu", | ||
| 14 | "build": { | ||
| 15 | "debounce_type": "asym_eager_defer_pk" | ||
| 16 | }, | ||
| 17 | "diode_direction": "COL2ROW", | ||
| 18 | "encoder": { | ||
| 19 | "rotary": [ | ||
| 20 | {"pin_a": "C0", "pin_b": "A15"} | ||
| 21 | ] | ||
| 22 | }, | ||
| 23 | "eeprom": { | ||
| 24 | "driver": "wear_leveling", | ||
| 25 | "wear_leveling": { | ||
| 26 | "driver": "spi_flash", | ||
| 27 | "backing_size": 16384, | ||
| 28 | "logical_size": 4096 | ||
| 29 | } | ||
| 30 | }, | ||
| 31 | "features": { | ||
| 32 | "console": true, | ||
| 33 | "haptic": true | ||
| 34 | }, | ||
| 35 | "haptic": { | ||
| 36 | "driver": "drv2605l" | ||
| 37 | }, | ||
| 38 | "matrix_pins": { | ||
| 39 | "cols": ["C1", "C2", "C3", "A0", "A1", "A2"], | ||
| 40 | "rows": ["A6", "A7", "C4", "C5", "B0", "B1"] | ||
| 41 | }, | ||
| 42 | "processor": "STM32F405", | ||
| 43 | "rgblight": { | ||
| 44 | "led_count": 24, | ||
| 45 | "split": true | ||
| 46 | }, | ||
| 47 | "split": { | ||
| 48 | "handedness": { | ||
| 49 | "pin": "B11" | ||
| 50 | }, | ||
| 51 | "serial": { | ||
| 52 | "driver": "usart" | ||
| 53 | }, | ||
| 54 | "transport": { | ||
| 55 | "sync": { | ||
| 56 | "activity": true, | ||
| 57 | "haptic": true, | ||
| 58 | "matrix_state": true | ||
| 59 | } | ||
| 60 | } | ||
| 61 | }, | ||
| 62 | "ws2812": { | ||
| 63 | "driver": "pwm", | ||
| 64 | "pin": "C6" | ||
| 65 | } | ||
| 66 | } | ||
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f405/mcuconf.h b/keyboards/handwired/tractyl_manuform/5x6_right/f405/mcuconf.h new file mode 100644 index 0000000000..46920b17b3 --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f405/mcuconf.h | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | /* Copyright 2020 Nick Brassel (tzarc) | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 3 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #include_next <mcuconf.h> | ||
| 20 | |||
| 21 | #undef STM32_LSE_ENABLED | ||
| 22 | #define STM32_LSE_ENABLED TRUE | ||
| 23 | |||
| 24 | #undef STM32_PLLM_VALUE | ||
| 25 | #define STM32_PLLM_VALUE 8 | ||
| 26 | |||
| 27 | #undef STM32_RTCSEL | ||
| 28 | #define STM32_RTCSEL STM32_RTCSEL_LSE | ||
| 29 | |||
| 30 | #undef STM32_SERIAL_USE_USART1 | ||
| 31 | #define STM32_SERIAL_USE_USART1 TRUE | ||
| 32 | |||
| 33 | #if HAL_USE_WDG == TRUE | ||
| 34 | # undef STM32_WDG_USE_IWDG | ||
| 35 | # define STM32_WDG_USE_IWDG TRUE | ||
| 36 | #endif | ||
| 37 | |||
| 38 | #if HAL_USE_I2C == TRUE | ||
| 39 | # undef STM32_I2C_USE_I2C1 | ||
| 40 | # define STM32_I2C_USE_I2C1 TRUE | ||
| 41 | |||
| 42 | # undef STM32_I2C_BUSY_TIMEOUT | ||
| 43 | # define STM32_I2C_BUSY_TIMEOUT 10 | ||
| 44 | |||
| 45 | # undef STM32_I2C_I2C1_RX_DMA_STREAM | ||
| 46 | # define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) | ||
| 47 | # undef STM32_I2C_I2C1_TX_DMA_STREAM | ||
| 48 | # define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) | ||
| 49 | #endif // HAL_USE_I2C | ||
| 50 | |||
| 51 | #ifdef WS2812_PWM | ||
| 52 | # undef STM32_PWM_USE_TIM3 | ||
| 53 | # define STM32_PWM_USE_TIM3 TRUE | ||
| 54 | #endif // WS2812_PWM | ||
| 55 | |||
| 56 | #ifdef BACKLIGHT_PWM | ||
| 57 | # undef STM32_PWM_USE_TIM8 | ||
| 58 | # define STM32_PWM_USE_TIM8 TRUE | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #if HAL_USE_SPI == TRUE | ||
| 62 | # undef STM32_SPI_USE_SPI1 | ||
| 63 | # define STM32_SPI_USE_SPI1 TRUE | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #ifdef AUDIO_DRIVER_DAC | ||
| 67 | # undef STM32_DAC_USE_DAC1_CH1 | ||
| 68 | # define STM32_DAC_USE_DAC1_CH1 TRUE | ||
| 69 | # undef STM32_DAC_USE_DAC1_CH2 | ||
| 70 | # define STM32_DAC_USE_DAC1_CH2 TRUE | ||
| 71 | |||
| 72 | # undef STM32_GPT_USE_TIM6 | ||
| 73 | # define STM32_GPT_USE_TIM6 TRUE | ||
| 74 | #endif // AUDIO_DRIVER_DAC | ||
| 75 | |||
| 76 | |||
| 77 | #ifdef USE_USB_OTG_HS_PORT | ||
| 78 | # undef STM32_USB_USE_OTG1 | ||
| 79 | # define STM32_USB_USE_OTG1 FALSE | ||
| 80 | # undef STM32_USB_USE_OTG2 | ||
| 81 | # define STM32_USB_USE_OTG2 TRUE | ||
| 82 | #endif | ||
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h index 28acc1e69b..bbbc16e3ea 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h | |||
| @@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 19 | #pragma once | 19 | #pragma once |
| 20 | 20 | ||
| 21 | // #define USB_VBUS_PIN B10 // doesn't seem to work for me on one of my controllers... */ | 21 | // #define USB_VBUS_PIN B10 // doesn't seem to work for me on one of my controllers... */ |
| 22 | #define USER_BUTTON_PIN A0 | ||
| 22 | 23 | ||
| 23 | // WS2812 RGB LED strip input and number of LEDs | 24 | // WS2812 RGB LED strip input and number of LEDs |
| 24 | #define WS2812_PWM_DRIVER PWMD2 // default: PWMD2 | 25 | #define WS2812_PWM_DRIVER PWMD2 // default: PWMD2 |
| @@ -70,7 +71,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 70 | 71 | ||
| 71 | /* eeprom config */ | 72 | /* eeprom config */ |
| 72 | #define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A4 | 73 | #define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A4 |
| 73 | #define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 64 | 74 | #define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 8 |
| 74 | 75 | ||
| 75 | /* pmw3360 config */ | 76 | /* pmw3360 config */ |
| 76 | #define PMW33XX_CS_PIN B0 | 77 | #define PMW33XX_CS_PIN B0 |
| 78 | #define PMW33XX_SPI_DIVISOR 8 | ||
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.c b/keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.c index dbacb1685c..cfe97d6318 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.c +++ b/keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.c | |||
| @@ -16,41 +16,6 @@ | |||
| 16 | 16 | ||
| 17 | #include "tractyl_manuform.h" | 17 | #include "tractyl_manuform.h" |
| 18 | 18 | ||
| 19 | void keyboard_pre_init_sub(void) { gpio_set_pin_input_high(A0); } | ||
| 20 | |||
| 21 | void matrix_scan_sub_kb(void) { | ||
| 22 | if (!gpio_read_pin(A0)) { | ||
| 23 | reset_keyboard(); | ||
| 24 | } | ||
| 25 | } | ||
| 26 | |||
| 27 | __attribute__((weak)) void bootmagic_scan(void) { | ||
| 28 | // We need multiple scans because debouncing can't be turned off. | ||
| 29 | matrix_scan(); | ||
| 30 | #if defined(DEBOUNCE) && DEBOUNCE > 0 | ||
| 31 | wait_ms(DEBOUNCE * 2); | ||
| 32 | #else | ||
| 33 | wait_ms(30); | ||
| 34 | #endif | ||
| 35 | matrix_scan(); | ||
| 36 | |||
| 37 | uint8_t row = BOOTMAGIC_ROW; | ||
| 38 | uint8_t col = BOOTMAGIC_COLUMN; | ||
| 39 | |||
| 40 | #if defined(SPLIT_KEYBOARD) && defined(BOOTMAGIC_ROW_RIGHT) && defined(BOOTMAGIC_COLUMN_RIGHT) | ||
| 41 | if (!is_keyboard_left()) { | ||
| 42 | row = BOOTMAGIC_ROW_RIGHT; | ||
| 43 | col = BOOTMAGIC_COLUMN_RIGHT; | ||
| 44 | } | ||
| 45 | #endif | ||
| 46 | |||
| 47 | if (matrix_get_row(row) & (1 << col) || !gpio_read_pin(A0)) { | ||
| 48 | eeconfig_disable(); | ||
| 49 | bootloader_jump(); | ||
| 50 | } | ||
| 51 | } | ||
| 52 | |||
| 53 | |||
| 54 | #ifdef USB_VBUS_PIN | 19 | #ifdef USB_VBUS_PIN |
| 55 | bool usb_vbus_state(void) { | 20 | bool usb_vbus_state(void) { |
| 56 | gpio_set_pin_input_low(USB_VBUS_PIN); | 21 | gpio_set_pin_input_low(USB_VBUS_PIN); |
| @@ -58,9 +23,3 @@ bool usb_vbus_state(void) { | |||
| 58 | return gpio_read_pin(USB_VBUS_PIN); | 23 | return gpio_read_pin(USB_VBUS_PIN); |
| 59 | } | 24 | } |
| 60 | #endif | 25 | #endif |
| 61 | |||
| 62 | void matrix_output_unselect_delay(uint8_t line, bool key_pressed) { | ||
| 63 | for (int32_t i = 0; i < 40; i++) { | ||
| 64 | __asm__ volatile("nop" ::: "memory"); | ||
| 65 | } | ||
| 66 | } | ||
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk deleted file mode 100644 index 4aa582e7a2..0000000000 --- a/keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk +++ /dev/null | |||
| @@ -1,2 +0,0 @@ | |||
| 1 | KEYBOARD_SHARED_EP = yes | ||
| 2 | MOUSE_SHARED_EP = yes | ||
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/info.json b/keyboards/handwired/tractyl_manuform/5x6_right/info.json index fe3f2432ca..0264000b20 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/info.json +++ b/keyboards/handwired/tractyl_manuform/5x6_right/info.json | |||
| @@ -98,6 +98,209 @@ | |||
| 98 | {"matrix": [11, 2], "x": 9, "y": 7}, | 98 | {"matrix": [11, 2], "x": 9, "y": 7}, |
| 99 | {"matrix": [11, 3], "x": 10, "y": 7} | 99 | {"matrix": [11, 3], "x": 10, "y": 7} |
| 100 | ] | 100 | ] |
| 101 | }, | ||
| 102 | "LAYOUT_5x6_full_right": { | ||
| 103 | "layout": [ | ||
| 104 | {"matrix": [0, 0], "x": 0, "y": 0}, | ||
| 105 | {"matrix": [0, 1], "x": 1, "y": 0}, | ||
| 106 | {"matrix": [0, 2], "x": 2, "y": 0}, | ||
| 107 | {"matrix": [0, 3], "x": 3, "y": 0}, | ||
| 108 | {"matrix": [0, 4], "x": 4, "y": 0}, | ||
| 109 | {"matrix": [0, 5], "x": 5, "y": 0}, | ||
| 110 | |||
| 111 | {"matrix": [6, 0], "x": 11, "y": 0}, | ||
| 112 | {"matrix": [6, 1], "x": 12, "y": 0}, | ||
| 113 | {"matrix": [6, 2], "x": 13, "y": 0}, | ||
| 114 | {"matrix": [6, 3], "x": 14, "y": 0}, | ||
| 115 | {"matrix": [6, 4], "x": 15, "y": 0}, | ||
| 116 | {"matrix": [6, 5], "x": 16, "y": 0}, | ||
| 117 | |||
| 118 | {"matrix": [1, 0], "x": 0, "y": 1}, | ||
| 119 | {"matrix": [1, 1], "x": 1, "y": 1}, | ||
| 120 | {"matrix": [1, 2], "x": 2, "y": 1}, | ||
| 121 | {"matrix": [1, 3], "x": 3, "y": 1}, | ||
| 122 | {"matrix": [1, 4], "x": 4, "y": 1}, | ||
| 123 | {"matrix": [1, 5], "x": 5, "y": 1}, | ||
| 124 | |||
| 125 | {"matrix": [7, 0], "x": 11, "y": 1}, | ||
| 126 | {"matrix": [7, 1], "x": 12, "y": 1}, | ||
| 127 | {"matrix": [7, 2], "x": 13, "y": 1}, | ||
| 128 | {"matrix": [7, 3], "x": 14, "y": 1}, | ||
| 129 | {"matrix": [7, 4], "x": 15, "y": 1}, | ||
| 130 | {"matrix": [7, 5], "x": 16, "y": 1}, | ||
| 131 | |||
| 132 | {"matrix": [2, 0], "x": 0, "y": 2}, | ||
| 133 | {"matrix": [2, 1], "x": 1, "y": 2}, | ||
| 134 | {"matrix": [2, 2], "x": 2, "y": 2}, | ||
| 135 | {"matrix": [2, 3], "x": 3, "y": 2}, | ||
| 136 | {"matrix": [2, 4], "x": 4, "y": 2}, | ||
| 137 | {"matrix": [2, 5], "x": 5, "y": 2}, | ||
| 138 | |||
| 139 | {"matrix": [8, 0], "x": 11, "y": 2}, | ||
| 140 | {"matrix": [8, 1], "x": 12, "y": 2}, | ||
| 141 | {"matrix": [8, 2], "x": 13, "y": 2}, | ||
| 142 | {"matrix": [8, 3], "x": 14, "y": 2}, | ||
| 143 | {"matrix": [8, 4], "x": 15, "y": 2}, | ||
| 144 | {"matrix": [8, 5], "x": 16, "y": 2}, | ||
| 145 | |||
| 146 | {"matrix": [3, 0], "x": 0, "y": 3}, | ||
| 147 | {"matrix": [3, 1], "x": 1, "y": 3}, | ||
| 148 | {"matrix": [3, 2], "x": 2, "y": 3}, | ||
| 149 | {"matrix": [3, 3], "x": 3, "y": 3}, | ||
| 150 | {"matrix": [3, 4], "x": 4, "y": 3}, | ||
| 151 | {"matrix": [3, 5], "x": 5, "y": 3}, | ||
| 152 | |||
| 153 | {"matrix": [9, 0], "x": 11, "y": 3}, | ||
| 154 | {"matrix": [9, 1], "x": 12, "y": 3}, | ||
| 155 | {"matrix": [9, 2], "x": 13, "y": 3}, | ||
| 156 | {"matrix": [9, 3], "x": 14, "y": 3}, | ||
| 157 | {"matrix": [9, 4], "x": 15, "y": 3}, | ||
| 158 | {"matrix": [9, 5], "x": 16, "y": 3}, | ||
| 159 | |||
| 160 | {"matrix": [4, 0], "x": 0, "y": 4}, | ||
| 161 | {"matrix": [4, 1], "x": 1, "y": 4}, | ||
| 162 | {"matrix": [4, 2], "x": 2, "y": 4}, | ||
| 163 | {"matrix": [4, 3], "x": 3, "y": 4}, | ||
| 164 | |||
| 165 | {"matrix": [10, 2], "x": 13, "y": 4}, | ||
| 166 | {"matrix": [10, 3], "x": 14, "y": 4}, | ||
| 167 | {"matrix": [10, 4], "x": 15, "y": 4}, | ||
| 168 | {"matrix": [10, 5], "x": 16, "y": 4}, | ||
| 169 | |||
| 170 | {"matrix": [4, 4], "x": 4, "y": 5}, | ||
| 171 | {"matrix": [4, 5], "x": 5, "y": 5}, | ||
| 172 | |||
| 173 | {"matrix": [10, 1], "x": 12, "y": 5}, | ||
| 174 | |||
| 175 | {"matrix": [5, 4], "x": 6, "y": 6}, | ||
| 176 | {"matrix": [5, 5], "x": 7, "y": 6}, | ||
| 177 | |||
| 178 | {"matrix": [11, 1], "x": 10, "y": 6}, | ||
| 179 | |||
| 180 | {"matrix": [5, 2], "x": 6, "y": 7}, | ||
| 181 | {"matrix": [5, 3], "x": 7, "y": 7}, | ||
| 182 | |||
| 183 | {"matrix": [11, 2], "x": 9, "y": 7}, | ||
| 184 | {"matrix": [11, 3], "x": 10, "y": 7} | ||
| 185 | ] | ||
| 101 | } | 186 | } |
| 187 | }, | ||
| 188 | "rgb_matrix": { | ||
| 189 | "animations": { | ||
| 190 | "alphas_mods": true, | ||
| 191 | "gradient_up_down": true, | ||
| 192 | "gradient_left_right": true, | ||
| 193 | "breathing": true, | ||
| 194 | "band_sat": true, | ||
| 195 | "band_val": true, | ||
| 196 | "band_pinwheel_sat": true, | ||
| 197 | "band_pinwheel_val": true, | ||
| 198 | "band_spiral_sat": true, | ||
| 199 | "band_spiral_val": true, | ||
| 200 | "cycle_all": true, | ||
| 201 | "cycle_left_right": true, | ||
| 202 | "cycle_up_down": true, | ||
| 203 | "rainbow_moving_chevron": true, | ||
| 204 | "cycle_out_in": true, | ||
| 205 | "cycle_out_in_dual": true, | ||
| 206 | "cycle_pinwheel": true, | ||
| 207 | "cycle_spiral": true, | ||
| 208 | "dual_beacon": true, | ||
| 209 | "rainbow_beacon": true, | ||
| 210 | "rainbow_pinwheels": true, | ||
| 211 | "raindrops": true, | ||
| 212 | "jellybean_raindrops": true, | ||
| 213 | "hue_breathing": true, | ||
| 214 | "hue_pendulum": true, | ||
| 215 | "hue_wave": true, | ||
| 216 | "pixel_rain": true, | ||
| 217 | "pixel_flow": true, | ||
| 218 | "pixel_fractal": true, | ||
| 219 | "typing_heatmap": true, | ||
| 220 | "digital_rain": true, | ||
| 221 | "solid_reactive_simple": true, | ||
| 222 | "solid_reactive": true, | ||
| 223 | "solid_reactive_wide": true, | ||
| 224 | "solid_reactive_multiwide": true, | ||
| 225 | "solid_reactive_cross": true, | ||
| 226 | "solid_reactive_multicross": true, | ||
| 227 | "solid_reactive_nexus": true, | ||
| 228 | "solid_reactive_multinexus": true, | ||
| 229 | "splash": true, | ||
| 230 | "multisplash": true, | ||
| 231 | "solid_splash": true, | ||
| 232 | "solid_multisplash": true | ||
| 233 | }, | ||
| 234 | "driver": "ws2812", | ||
| 235 | "led_count": 64, | ||
| 236 | "max_brightness": 100, | ||
| 237 | "split_count": [33, 31], | ||
| 238 | "sleep": true, | ||
| 239 | "layout": [ | ||
| 240 | {"matrix": [0, 0], "x": 0, "y": 0, "flags": 1}, | ||
| 241 | {"matrix": [1, 0], "x": 0, "y": 10, "flags": 1}, | ||
| 242 | {"matrix": [2, 0], "x": 0, "y": 20, "flags": 1}, | ||
| 243 | {"matrix": [3, 0], "x": 0, "y": 30, "flags": 1}, | ||
| 244 | {"matrix": [3, 1], "x": 12, "y": 30, "flags": 4}, | ||
| 245 | {"matrix": [2, 1], "x": 12, "y": 20, "flags": 4}, | ||
| 246 | {"matrix": [1, 1], "x": 12, "y": 10, "flags": 4}, | ||
| 247 | {"matrix": [0, 1], "x": 12, "y": 0, "flags": 4}, | ||
| 248 | {"matrix": [0, 2], "x": 24, "y": 0, "flags": 4}, | ||
| 249 | {"matrix": [1, 2], "x": 24, "y": 10, "flags": 4}, | ||
| 250 | {"matrix": [2, 2], "x": 24, "y": 20, "flags": 4}, | ||
| 251 | {"matrix": [3, 2], "x": 24, "y": 30, "flags": 4}, | ||
| 252 | {"matrix": [4, 2], "x": 24, "y": 40, "flags": 1}, | ||
| 253 | {"matrix": [4, 3], "x": 36, "y": 40, "flags": 1}, | ||
| 254 | {"matrix": [3, 3], "x": 36, "y": 30, "flags": 4}, | ||
| 255 | {"matrix": [2, 3], "x": 36, "y": 20, "flags": 4}, | ||
| 256 | {"matrix": [1, 3], "x": 36, "y": 10, "flags": 4}, | ||
| 257 | {"matrix": [0, 3], "x": 36, "y": 0, "flags": 4}, | ||
| 258 | {"matrix": [0, 4], "x": 48, "y": 0, "flags": 4}, | ||
| 259 | {"matrix": [1, 4], "x": 48, "y": 10, "flags": 4}, | ||
| 260 | {"matrix": [2, 4], "x": 48, "y": 40, "flags": 4}, | ||
| 261 | {"matrix": [3, 4], "x": 48, "y": 30, "flags": 4}, | ||
| 262 | {"matrix": [3, 5], "x": 60, "y": 30, "flags": 4}, | ||
| 263 | {"matrix": [2, 5], "x": 60, "y": 20, "flags": 4}, | ||
| 264 | {"matrix": [1, 5], "x": 60, "y": 10, "flags": 4}, | ||
| 265 | {"matrix": [0, 5], "x": 60, "y": 0, "flags": 4}, | ||
| 266 | {"matrix": [4, 4], "x": 48, "y": 50, "flags": 1}, | ||
| 267 | {"matrix": [5, 4], "x": 65, "y": 56, "flags": 1}, | ||
| 268 | {"matrix": [5, 5], "x": 70, "y": 60, "flags": 1}, | ||
| 269 | {"matrix": [5, 3], "x": 65, "y": 64, "flags": 1}, | ||
| 270 | {"matrix": [5, 2], "x": 60, "y": 60, "flags": 1}, | ||
| 271 | {"matrix": [4, 1], "x": 0, "y": 40, "flags": 1}, | ||
| 272 | {"matrix": [4, 0], "x": 12, "y": 40, "flags": 1}, | ||
| 273 | {"matrix": [6, 5], "x": 224, "y": 0, "flags": 1}, | ||
| 274 | {"matrix": [7, 5], "x": 224, "y": 10, "flags": 1}, | ||
| 275 | {"matrix": [8, 5], "x": 224, "y": 20, "flags": 1}, | ||
| 276 | {"matrix": [9, 5], "x": 224, "y": 30, "flags": 1}, | ||
| 277 | {"matrix": [9, 4], "x": 212, "y": 30, "flags": 4}, | ||
| 278 | {"matrix": [8, 4], "x": 212, "y": 20, "flags": 4}, | ||
| 279 | {"matrix": [7, 4], "x": 212, "y": 10, "flags": 4}, | ||
| 280 | {"matrix": [6, 4], "x": 212, "y": 0, "flags": 4}, | ||
| 281 | {"matrix": [6, 3], "x": 200, "y": 0, "flags": 4}, | ||
| 282 | {"matrix": [7, 3], "x": 200, "y": 10, "flags": 4}, | ||
| 283 | {"matrix": [8, 3], "x": 200, "y": 20, "flags": 4}, | ||
| 284 | {"matrix": [9, 3], "x": 200, "y": 30, "flags": 4}, | ||
| 285 | {"matrix": [10, 3], "x": 200, "y": 40, "flags": 1}, | ||
| 286 | {"matrix": [10, 2], "x": 188, "y": 40, "flags": 1}, | ||
| 287 | {"matrix": [9, 2], "x": 188, "y": 30, "flags": 4}, | ||
| 288 | {"matrix": [8, 2], "x": 188, "y": 20, "flags": 4}, | ||
| 289 | {"matrix": [7, 2], "x": 188, "y": 10, "flags": 4}, | ||
| 290 | {"matrix": [6, 2], "x": 188, "y": 0, "flags": 4}, | ||
| 291 | {"matrix": [6, 1], "x": 176, "y": 0, "flags": 4}, | ||
| 292 | {"matrix": [7, 1], "x": 176, "y": 10, "flags": 4}, | ||
| 293 | {"matrix": [8, 1], "x": 176, "y": 20, "flags": 4}, | ||
| 294 | {"matrix": [9, 1], "x": 176, "y": 30, "flags": 4}, | ||
| 295 | {"matrix": [9, 0], "x": 164, "y": 30, "flags": 4}, | ||
| 296 | {"matrix": [8, 0], "x": 164, "y": 20, "flags": 4}, | ||
| 297 | {"matrix": [7, 0], "x": 164, "y": 10, "flags": 4}, | ||
| 298 | {"matrix": [6, 0], "x": 164, "y": 0, "flags": 4}, | ||
| 299 | {"matrix": [11, 1], "x": 164, "y": 60, "flags": 1}, | ||
| 300 | {"matrix": [11, 3], "x": 152, "y": 70, "flags": 1}, | ||
| 301 | {"matrix": [11, 2], "x": 140, "y": 70, "flags": 1}, | ||
| 302 | {"matrix": [10, 4], "x": 224, "y": 40, "flags": 1}, | ||
| 303 | {"matrix": [10, 5], "x": 208, "y": 40, "flags": 1} | ||
| 304 | ] | ||
| 102 | } | 305 | } |
| 103 | } | 306 | } |
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/post_rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/post_rules.mk new file mode 100644 index 0000000000..fab9162dc6 --- /dev/null +++ b/keyboards/handwired/tractyl_manuform/5x6_right/post_rules.mk | |||
| @@ -0,0 +1 @@ | |||
| POINTING_DEVICE_DRIVER = pmw3360 | |||
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/rules.mk deleted file mode 100644 index b7f7c949ec..0000000000 --- a/keyboards/handwired/tractyl_manuform/5x6_right/rules.mk +++ /dev/null | |||
| @@ -1,4 +0,0 @@ | |||
| 1 | POINTING_DEVICE_DRIVER = pmw3360 | ||
| 2 | MOUSE_SHARED_EP = yes | ||
| 3 | |||
| 4 | DEFAULT_FOLDER = handwired/tractyl_manuform/5x6_right/teensy2pp | ||
diff --git a/keyboards/handwired/tractyl_manuform/config.h b/keyboards/handwired/tractyl_manuform/config.h index 9f4dd8651b..5a8091a098 100644 --- a/keyboards/handwired/tractyl_manuform/config.h +++ b/keyboards/handwired/tractyl_manuform/config.h | |||
| @@ -18,18 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 18 | 18 | ||
| 19 | #pragma once | 19 | #pragma once |
| 20 | 20 | ||
| 21 | |||
| 22 | /* disable debug print */ | ||
| 23 | // #define NO_DEBUG | ||
| 24 | |||
| 25 | /* disable print */ | ||
| 26 | // #define NO_PRINT | ||
| 27 | |||
| 28 | /* disable action features */ | ||
| 29 | //#define NO_ACTION_LAYER | ||
| 30 | //#define NO_ACTION_TAPPING | ||
| 31 | //#define NO_ACTION_ONESHOT | ||
| 32 | |||
| 33 | #define SPLIT_POINTING_ENABLE | 21 | #define SPLIT_POINTING_ENABLE |
| 34 | #define POINTING_DEVICE_TASK_THROTTLE_MS 1 | 22 | #define POINTING_DEVICE_TASK_THROTTLE_MS 1 |
| 35 | 23 | ||
diff --git a/keyboards/handwired/tractyl_manuform/info.json b/keyboards/handwired/tractyl_manuform/info.json index c84d008e15..fb50c8d359 100644 --- a/keyboards/handwired/tractyl_manuform/info.json +++ b/keyboards/handwired/tractyl_manuform/info.json | |||
| @@ -2,6 +2,10 @@ | |||
| 2 | "manufacturer": "QMK Community", | 2 | "manufacturer": "QMK Community", |
| 3 | "maintainer": "Drashna Jael're", | 3 | "maintainer": "Drashna Jael're", |
| 4 | "usb": { | 4 | "usb": { |
| 5 | "vid": "0x44DD" | 5 | "vid": "0x44DD", |
| 6 | "shared_endpoint": { | ||
| 7 | "keyboard": true, | ||
| 8 | "mouse": true | ||
| 9 | } | ||
| 6 | } | 10 | } |
| 7 | } | 11 | } |
diff --git a/keyboards/handwired/tractyl_manuform/post_config.h b/keyboards/handwired/tractyl_manuform/post_config.h deleted file mode 100644 index b5d67132b2..0000000000 --- a/keyboards/handwired/tractyl_manuform/post_config.h +++ /dev/null | |||
| @@ -1,112 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | Copyright 2015 Jack Humbert | ||
| 4 | |||
| 5 | This program is free software: you can redistribute it and/or modify | ||
| 6 | it under the terms of the GNU General Public License as published by | ||
| 7 | the Free Software Foundation, either version 2 of the License, or | ||
| 8 | (at your option) any later version. | ||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, | ||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | GNU General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License | ||
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #pragma once | ||
| 20 | |||
| 21 | // mouse config | ||
| 22 | #ifdef MOUSEKEY_ENABLE | ||
| 23 | # ifndef MOUSEKEY_MOVE_DELTA | ||
| 24 | # ifndef MK_KINETIC_SPEED | ||
| 25 | # define MOUSEKEY_MOVE_DELTA 5 | ||
| 26 | # else | ||
| 27 | # define MOUSEKEY_MOVE_DELTA 25 | ||
| 28 | # endif | ||
| 29 | # endif | ||
| 30 | # ifndef MOUSEKEY_DELAY | ||
| 31 | # ifndef MK_KINETIC_SPEED | ||
| 32 | # define MOUSEKEY_DELAY 300 | ||
| 33 | # else | ||
| 34 | # define MOUSEKEY_DELAY 8 | ||
| 35 | # endif | ||
| 36 | # endif | ||
| 37 | # ifndef MOUSEKEY_INTERVAL | ||
| 38 | # ifndef MK_KINETIC_SPEED | ||
| 39 | # define MOUSEKEY_INTERVAL 50 | ||
| 40 | # else | ||
| 41 | # define MOUSEKEY_INTERVAL 20 | ||
| 42 | # endif | ||
| 43 | # endif | ||
| 44 | # ifndef MOUSEKEY_MAX_SPEED | ||
| 45 | # define MOUSEKEY_MAX_SPEED 7 | ||
| 46 | # endif | ||
| 47 | # ifndef MOUSEKEY_TIME_TO_MAX | ||
| 48 | # define MOUSEKEY_TIME_TO_MAX 60 | ||
| 49 | # endif | ||
| 50 | # ifndef MOUSEKEY_INITIAL_SPEED | ||
| 51 | # define MOUSEKEY_INITIAL_SPEED 100 | ||
| 52 | # endif | ||
| 53 | # ifndef MOUSEKEY_BASE_SPEED | ||
| 54 | # define MOUSEKEY_BASE_SPEED 1000 | ||
| 55 | # endif | ||
| 56 | # ifndef MOUSEKEY_DECELERATED_SPEED | ||
| 57 | # define MOUSEKEY_DECELERATED_SPEED 400 | ||
| 58 | # endif | ||
| 59 | # ifndef MOUSEKEY_ACCELERATED_SPEED | ||
| 60 | # define MOUSEKEY_ACCELERATED_SPEED 3000 | ||
| 61 | # endif | ||
| 62 | |||
| 63 | // mouse scroll config | ||
| 64 | # ifndef MOUSEKEY_WHEEL_DELAY | ||
| 65 | # define MOUSEKEY_WHEEL_DELAY 15 | ||
| 66 | # endif | ||
| 67 | # ifndef MOUSEKEY_WHEEL_DELTA | ||
| 68 | # define MOUSEKEY_WHEEL_DELTA 1 | ||
| 69 | # endif | ||
| 70 | # ifndef MOUSEKEY_WHEEL_INTERVAL | ||
| 71 | # define MOUSEKEY_WHEEL_INTERVAL 50 | ||
| 72 | # endif | ||
| 73 | # ifndef MOUSEKEY_WHEEL_MAX_SPEED | ||
| 74 | # define MOUSEKEY_WHEEL_MAX_SPEED 8 | ||
| 75 | # endif | ||
| 76 | # ifndef MOUSEKEY_WHEEL_TIME_TO_MAX | ||
| 77 | # define MOUSEKEY_WHEEL_TIME_TO_MAX 80 | ||
| 78 | # endif | ||
| 79 | |||
| 80 | # ifndef MOUSEKEY_WHEEL_INITIAL_MOVEMENTS | ||
| 81 | # define MOUSEKEY_WHEEL_INITIAL_MOVEMENTS 8 | ||
| 82 | # endif | ||
| 83 | # ifndef MOUSEKEY_WHEEL_BASE_MOVEMENTS | ||
| 84 | # define MOUSEKEY_WHEEL_BASE_MOVEMENTS 48 | ||
| 85 | # endif | ||
| 86 | # ifndef MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS | ||
| 87 | # define MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS 48 | ||
| 88 | # endif | ||
| 89 | # ifndef MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS | ||
| 90 | # define MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS 8 | ||
| 91 | # endif | ||
| 92 | #endif | ||
| 93 | |||
| 94 | #ifndef DEBOUNCE | ||
| 95 | # define DEBOUNCE 5 | ||
| 96 | #endif | ||
| 97 | |||
| 98 | #if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_LIMIT_VAL) | ||
| 99 | # if defined(OLED_ENABLE) | ||
| 100 | # define RGBLIGHT_LIMIT_VAL 100 | ||
| 101 | # else | ||
| 102 | # define RGBLIGHT_LIMIT_VAL 150 | ||
| 103 | # endif | ||
| 104 | #endif | ||
| 105 | |||
| 106 | #if !defined(OLED_BRIGHTNESS) | ||
| 107 | # if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) | ||
| 108 | # define OLED_BRIGHTNESS 80 | ||
| 109 | # else | ||
| 110 | # define OLED_BRIGHTNESS 150 | ||
| 111 | # endif | ||
| 112 | #endif | ||
diff --git a/keyboards/handwired/tractyl_manuform/tractyl_manuform.c b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c index 7ded835a6e..3ae74be47f 100644 --- a/keyboards/handwired/tractyl_manuform/tractyl_manuform.c +++ b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c | |||
| @@ -15,48 +15,47 @@ | |||
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #include "tractyl_manuform.h" | 17 | #include "tractyl_manuform.h" |
| 18 | #ifdef POINTING_DEVICE_ENABLE | ||
| 19 | # include "pointing_device.h" | ||
| 20 | #endif | ||
| 18 | #include "transactions.h" | 21 | #include "transactions.h" |
| 19 | #include <string.h> | 22 | #include <string.h> |
| 20 | 23 | ||
| 21 | #ifdef CONSOLE_ENABLE | 24 | #ifdef CONSOLE_ENABLE |
| 22 | # include "print.h" | 25 | # include "print.h" |
| 23 | #endif // CONSOLE_ENABLE | 26 | #endif // CONSOLE_ENABLE |
| 24 | 27 | ||
| 25 | #ifdef POINTING_DEVICE_ENABLE | 28 | #ifdef POINTING_DEVICE_ENABLE |
| 26 | # ifndef CHARYBDIS_MINIMUM_DEFAULT_DPI | 29 | # ifndef CHARYBDIS_MINIMUM_DEFAULT_DPI |
| 27 | # define CHARYBDIS_MINIMUM_DEFAULT_DPI 400 | 30 | # define CHARYBDIS_MINIMUM_DEFAULT_DPI 400 |
| 28 | # endif // CHARYBDIS_MINIMUM_DEFAULT_DPI | 31 | # endif // CHARYBDIS_MINIMUM_DEFAULT_DPI |
| 29 | 32 | ||
| 30 | # ifndef CHARYBDIS_DEFAULT_DPI_CONFIG_STEP | 33 | # ifndef CHARYBDIS_DEFAULT_DPI_CONFIG_STEP |
| 31 | # define CHARYBDIS_DEFAULT_DPI_CONFIG_STEP 200 | 34 | # define CHARYBDIS_DEFAULT_DPI_CONFIG_STEP 200 |
| 32 | # endif // CHARYBDIS_DEFAULT_DPI_CONFIG_STEP | 35 | # endif // CHARYBDIS_DEFAULT_DPI_CONFIG_STEP |
| 33 | 36 | ||
| 34 | # ifndef CHARYBDIS_MINIMUM_SNIPING_DPI | 37 | # ifndef CHARYBDIS_MINIMUM_SNIPING_DPI |
| 35 | # define CHARYBDIS_MINIMUM_SNIPING_DPI 200 | 38 | # define CHARYBDIS_MINIMUM_SNIPING_DPI 200 |
| 36 | # endif // CHARYBDIS_MINIMUM_SNIPER_MODE_DPI | 39 | # endif // CHARYBDIS_MINIMUM_SNIPER_MODE_DPI |
| 37 | 40 | ||
| 38 | # ifndef CHARYBDIS_SNIPING_DPI_CONFIG_STEP | 41 | # ifndef CHARYBDIS_SNIPING_DPI_CONFIG_STEP |
| 39 | # define CHARYBDIS_SNIPING_DPI_CONFIG_STEP 100 | 42 | # define CHARYBDIS_SNIPING_DPI_CONFIG_STEP 100 |
| 40 | # endif // CHARYBDIS_SNIPING_DPI_CONFIG_STEP | 43 | # endif // CHARYBDIS_SNIPING_DPI_CONFIG_STEP |
| 41 | 44 | ||
| 42 | // Fixed DPI for drag-scroll. | 45 | // Fixed DPI for drag-scroll. |
| 43 | # ifndef CHARYBDIS_DRAGSCROLL_DPI | 46 | # ifndef CHARYBDIS_DRAGSCROLL_DPI |
| 44 | # define CHARYBDIS_DRAGSCROLL_DPI 100 | 47 | # define CHARYBDIS_DRAGSCROLL_DPI 100 |
| 45 | # endif // CHARYBDIS_DRAGSCROLL_DPI | 48 | # endif // CHARYBDIS_DRAGSCROLL_DPI |
| 46 | 49 | ||
| 47 | # ifndef CHARYBDIS_DRAGSCROLL_BUFFER_SIZE | 50 | # ifndef CHARYBDIS_DRAGSCROLL_BUFFER_SIZE |
| 48 | # define CHARYBDIS_DRAGSCROLL_BUFFER_SIZE 6 | 51 | # define CHARYBDIS_DRAGSCROLL_BUFFER_SIZE 6 |
| 49 | # endif // !CHARYBDIS_DRAGSCROLL_BUFFER_SIZE | 52 | # endif // !CHARYBDIS_DRAGSCROLL_BUFFER_SIZE |
| 50 | |||
| 51 | # ifndef CHARYBDIS_POINTER_ACCELERATION_FACTOR | ||
| 52 | # define CHARYBDIS_POINTER_ACCELERATION_FACTOR 24 | ||
| 53 | # endif // !CHARYBDIS_POINTER_ACCELERATION_FACTOR | ||
| 54 | 53 | ||
| 55 | typedef union { | 54 | typedef union { |
| 56 | uint8_t raw; | 55 | uint8_t raw; |
| 57 | struct { | 56 | struct { |
| 58 | uint8_t pointer_default_dpi : 4; // 16 steps available. | 57 | uint8_t pointer_default_dpi : 4; // 16 steps available. |
| 59 | uint8_t pointer_sniping_dpi : 2; // 4 steps available. | 58 | uint8_t pointer_sniping_dpi : 2; // 4 steps available. |
| 60 | bool is_dragscroll_enabled : 1; | 59 | bool is_dragscroll_enabled : 1; |
| 61 | bool is_sniping_enabled : 1; | 60 | bool is_sniping_enabled : 1; |
| 62 | } __attribute__((packed)); | 61 | } __attribute__((packed)); |
| @@ -86,13 +85,19 @@ static void read_charybdis_config_from_eeprom(charybdis_config_t* config) { | |||
| 86 | * resets these 2 values to `false` since it does not make sense to persist | 85 | * resets these 2 values to `false` since it does not make sense to persist |
| 87 | * these across reboots of the board. | 86 | * these across reboots of the board. |
| 88 | */ | 87 | */ |
| 89 | static void write_charybdis_config_to_eeprom(charybdis_config_t* config) { eeconfig_update_kb(config->raw); } | 88 | static void write_charybdis_config_to_eeprom(charybdis_config_t* config) { |
| 89 | eeconfig_update_kb(config->raw); | ||
| 90 | } | ||
| 90 | 91 | ||
| 91 | /** \brief Return the current value of the pointer's default DPI. */ | 92 | /** \brief Return the current value of the pointer's default DPI. */ |
| 92 | static uint16_t get_pointer_default_dpi(charybdis_config_t* config) { return (uint16_t)config->pointer_default_dpi * CHARYBDIS_DEFAULT_DPI_CONFIG_STEP + CHARYBDIS_MINIMUM_DEFAULT_DPI; } | 93 | static uint16_t get_pointer_default_dpi(charybdis_config_t* config) { |
| 94 | return (uint16_t)config->pointer_default_dpi * CHARYBDIS_DEFAULT_DPI_CONFIG_STEP + CHARYBDIS_MINIMUM_DEFAULT_DPI; | ||
| 95 | } | ||
| 93 | 96 | ||
| 94 | /** \brief Return the current value of the pointer's sniper-mode DPI. */ | 97 | /** \brief Return the current value of the pointer's sniper-mode DPI. */ |
| 95 | static uint16_t get_pointer_sniping_dpi(charybdis_config_t* config) { return (uint16_t)config->pointer_sniping_dpi * CHARYBDIS_SNIPING_DPI_CONFIG_STEP + CHARYBDIS_MINIMUM_SNIPING_DPI; } | 98 | static uint16_t get_pointer_sniping_dpi(charybdis_config_t* config) { |
| 99 | return (uint16_t)config->pointer_sniping_dpi * CHARYBDIS_SNIPING_DPI_CONFIG_STEP + CHARYBDIS_MINIMUM_SNIPING_DPI; | ||
| 100 | } | ||
| 96 | 101 | ||
| 97 | /** \brief Set the appropriate DPI for the input config. */ | 102 | /** \brief Set the appropriate DPI for the input config. */ |
| 98 | static void maybe_update_pointing_device_cpi(charybdis_config_t* config) { | 103 | static void maybe_update_pointing_device_cpi(charybdis_config_t* config) { |
| @@ -127,64 +132,54 @@ static void step_pointer_sniping_dpi(charybdis_config_t* config, bool forward) { | |||
| 127 | maybe_update_pointing_device_cpi(config); | 132 | maybe_update_pointing_device_cpi(config); |
| 128 | } | 133 | } |
| 129 | 134 | ||
| 130 | uint16_t charybdis_get_pointer_default_dpi(void) { return get_pointer_default_dpi(&g_charybdis_config); } | 135 | uint16_t charybdis_get_pointer_default_dpi(void) { |
| 136 | return get_pointer_default_dpi(&g_charybdis_config); | ||
| 137 | } | ||
| 131 | 138 | ||
| 132 | uint16_t charybdis_get_pointer_sniping_dpi(void) { return get_pointer_sniping_dpi(&g_charybdis_config); } | 139 | uint16_t charybdis_get_pointer_sniping_dpi(void) { |
| 140 | return get_pointer_sniping_dpi(&g_charybdis_config); | ||
| 141 | } | ||
| 133 | 142 | ||
| 134 | void charybdis_cycle_pointer_default_dpi_noeeprom(bool forward) { step_pointer_default_dpi(&g_charybdis_config, forward); } | 143 | void charybdis_cycle_pointer_default_dpi_noeeprom(bool forward) { |
| 144 | step_pointer_default_dpi(&g_charybdis_config, forward); | ||
| 145 | } | ||
| 135 | 146 | ||
| 136 | void charybdis_cycle_pointer_default_dpi(bool forward) { | 147 | void charybdis_cycle_pointer_default_dpi(bool forward) { |
| 137 | step_pointer_default_dpi(&g_charybdis_config, forward); | 148 | step_pointer_default_dpi(&g_charybdis_config, forward); |
| 138 | write_charybdis_config_to_eeprom(&g_charybdis_config); | 149 | write_charybdis_config_to_eeprom(&g_charybdis_config); |
| 139 | } | 150 | } |
| 140 | 151 | ||
| 141 | void charybdis_cycle_pointer_sniping_dpi_noeeprom(bool forward) { step_pointer_sniping_dpi(&g_charybdis_config, forward); } | 152 | void charybdis_cycle_pointer_sniping_dpi_noeeprom(bool forward) { |
| 153 | step_pointer_sniping_dpi(&g_charybdis_config, forward); | ||
| 154 | } | ||
| 142 | 155 | ||
| 143 | void charybdis_cycle_pointer_sniping_dpi(bool forward) { | 156 | void charybdis_cycle_pointer_sniping_dpi(bool forward) { |
| 144 | step_pointer_sniping_dpi(&g_charybdis_config, forward); | 157 | step_pointer_sniping_dpi(&g_charybdis_config, forward); |
| 145 | write_charybdis_config_to_eeprom(&g_charybdis_config); | 158 | write_charybdis_config_to_eeprom(&g_charybdis_config); |
| 146 | } | 159 | } |
| 147 | 160 | ||
| 148 | bool charybdis_get_pointer_sniping_enabled(void) { return g_charybdis_config.is_sniping_enabled; } | 161 | bool charybdis_get_pointer_sniping_enabled(void) { |
| 162 | return g_charybdis_config.is_sniping_enabled; | ||
| 163 | } | ||
| 149 | 164 | ||
| 150 | void charybdis_set_pointer_sniping_enabled(bool enable) { | 165 | void charybdis_set_pointer_sniping_enabled(bool enable) { |
| 151 | g_charybdis_config.is_sniping_enabled = enable; | 166 | g_charybdis_config.is_sniping_enabled = enable; |
| 152 | maybe_update_pointing_device_cpi(&g_charybdis_config); | 167 | maybe_update_pointing_device_cpi(&g_charybdis_config); |
| 153 | } | 168 | } |
| 154 | 169 | ||
| 155 | bool charybdis_get_pointer_dragscroll_enabled(void) { return g_charybdis_config.is_dragscroll_enabled; } | 170 | bool charybdis_get_pointer_dragscroll_enabled(void) { |
| 171 | return g_charybdis_config.is_dragscroll_enabled; | ||
| 172 | } | ||
| 156 | 173 | ||
| 157 | void charybdis_set_pointer_dragscroll_enabled(bool enable) { | 174 | void charybdis_set_pointer_dragscroll_enabled(bool enable) { |
| 158 | g_charybdis_config.is_dragscroll_enabled = enable; | 175 | g_charybdis_config.is_dragscroll_enabled = enable; |
| 159 | maybe_update_pointing_device_cpi(&g_charybdis_config); | 176 | maybe_update_pointing_device_cpi(&g_charybdis_config); |
| 160 | } | 177 | } |
| 161 | 178 | ||
| 162 | # ifndef CONSTRAIN_HID | ||
| 163 | # define CONSTRAIN_HID(value) ((value) < XY_REPORT_MIN ? XY_REPORT_MIN : ((value) > XY_REPORT_MAX ? XY_REPORT_MAX : (value))) | ||
| 164 | # endif // !CONSTRAIN_HID | ||
| 165 | |||
| 166 | /** | ||
| 167 | * \brief Add optional acceleration effect. | ||
| 168 | * | ||
| 169 | * If `CHARYBDIS_ENABLE_POINTER_ACCELERATION` is defined, add a simple and naive | ||
| 170 | * acceleration effect to the provided value. Return the value unchanged | ||
| 171 | * otherwise. | ||
| 172 | */ | ||
| 173 | # ifndef DISPLACEMENT_WITH_ACCELERATION | ||
| 174 | # ifdef CHARYBDIS_POINTER_ACCELERATION_ENABLE | ||
| 175 | # define DISPLACEMENT_WITH_ACCELERATION(d) (CONSTRAIN_HID(d > 0 ? d * d / CHARYBDIS_POINTER_ACCELERATION_FACTOR + d : -d * d / CHARYBDIS_POINTER_ACCELERATION_FACTOR + d)) | ||
| 176 | # else // !CHARYBDIS_POINTER_ACCELERATION_ENABLE | ||
| 177 | # define DISPLACEMENT_WITH_ACCELERATION(d) (d) | ||
| 178 | # endif // CHARYBDIS_POINTER_ACCELERATION_ENABLE | ||
| 179 | # endif // !DISPLACEMENT_WITH_ACCELERATION | ||
| 180 | |||
| 181 | /** | 179 | /** |
| 182 | * \brief Augment the pointing device behavior. | 180 | * \brief Augment the pointing device behavior. |
| 183 | * | 181 | * |
| 184 | * Implement the Charybdis-specific features for pointing devices: | 182 | * Implement drag-scroll. |
| 185 | * - Drag-scroll | ||
| 186 | * - Sniping | ||
| 187 | * - Acceleration | ||
| 188 | */ | 183 | */ |
| 189 | static void pointing_device_task_charybdis(report_mouse_t* mouse_report) { | 184 | static void pointing_device_task_charybdis(report_mouse_t* mouse_report) { |
| 190 | static int16_t scroll_buffer_x = 0; | 185 | static int16_t scroll_buffer_x = 0; |
| @@ -194,12 +189,12 @@ static void pointing_device_task_charybdis(report_mouse_t* mouse_report) { | |||
| 194 | scroll_buffer_x -= mouse_report->x; | 189 | scroll_buffer_x -= mouse_report->x; |
| 195 | # else | 190 | # else |
| 196 | scroll_buffer_x += mouse_report->x; | 191 | scroll_buffer_x += mouse_report->x; |
| 197 | # endif // CHARYBDIS_DRAGSCROLL_REVERSE_X | 192 | # endif // CHARYBDIS_DRAGSCROLL_REVERSE_X |
| 198 | # ifdef CHARYBDIS_DRAGSCROLL_REVERSE_Y | 193 | # ifdef CHARYBDIS_DRAGSCROLL_REVERSE_Y |
| 199 | scroll_buffer_y -= mouse_report->y; | 194 | scroll_buffer_y -= mouse_report->y; |
| 200 | # else | 195 | # else |
| 201 | scroll_buffer_y += mouse_report->y; | 196 | scroll_buffer_y += mouse_report->y; |
| 202 | # endif // CHARYBDIS_DRAGSCROLL_REVERSE_Y | 197 | # endif // CHARYBDIS_DRAGSCROLL_REVERSE_Y |
| 203 | mouse_report->x = 0; | 198 | mouse_report->x = 0; |
| 204 | mouse_report->y = 0; | 199 | mouse_report->y = 0; |
| 205 | if (abs(scroll_buffer_x) > CHARYBDIS_DRAGSCROLL_BUFFER_SIZE) { | 200 | if (abs(scroll_buffer_x) > CHARYBDIS_DRAGSCROLL_BUFFER_SIZE) { |
| @@ -210,16 +205,14 @@ static void pointing_device_task_charybdis(report_mouse_t* mouse_report) { | |||
| 210 | mouse_report->v = scroll_buffer_y > 0 ? 1 : -1; | 205 | mouse_report->v = scroll_buffer_y > 0 ? 1 : -1; |
| 211 | scroll_buffer_y = 0; | 206 | scroll_buffer_y = 0; |
| 212 | } | 207 | } |
| 213 | } else if (!g_charybdis_config.is_sniping_enabled) { | ||
| 214 | mouse_report->x = DISPLACEMENT_WITH_ACCELERATION(mouse_report->x); | ||
| 215 | mouse_report->y = DISPLACEMENT_WITH_ACCELERATION(mouse_report->y); | ||
| 216 | } | 208 | } |
| 217 | } | 209 | } |
| 218 | 210 | ||
| 219 | report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { | 211 | report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { |
| 220 | pointing_device_task_charybdis(&mouse_report); | 212 | if (is_keyboard_master()) { |
| 221 | mouse_report = pointing_device_task_user(mouse_report); | 213 | pointing_device_task_charybdis(&mouse_report); |
| 222 | 214 | mouse_report = pointing_device_task_user(mouse_report); | |
| 215 | } | ||
| 223 | return mouse_report; | 216 | return mouse_report; |
| 224 | } | 217 | } |
| 225 | 218 | ||
| @@ -230,9 +223,9 @@ static bool has_shift_mod(void) { | |||
| 230 | return mod_config(get_mods()) & MOD_MASK_SHIFT; | 223 | return mod_config(get_mods()) & MOD_MASK_SHIFT; |
| 231 | # else | 224 | # else |
| 232 | return mod_config(get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT; | 225 | return mod_config(get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT; |
| 233 | # endif // NO_ACTION_ONESHOT | 226 | # endif // NO_ACTION_ONESHOT |
| 234 | } | 227 | } |
| 235 | # endif // POINTING_DEVICE_ENABLE && !NO_CHARYBDIS_KEYCODES | 228 | # endif // POINTING_DEVICE_ENABLE && !NO_CHARYBDIS_KEYCODES |
| 236 | 229 | ||
| 237 | /** | 230 | /** |
| 238 | * \brief Outputs the Charybdis configuration to console. | 231 | * \brief Outputs the Charybdis configuration to console. |
| @@ -247,16 +240,16 @@ static bool has_shift_mod(void) { | |||
| 247 | */ | 240 | */ |
| 248 | __attribute__((unused)) static void debug_charybdis_config_to_console(charybdis_config_t* config) { | 241 | __attribute__((unused)) static void debug_charybdis_config_to_console(charybdis_config_t* config) { |
| 249 | # ifdef CONSOLE_ENABLE | 242 | # ifdef CONSOLE_ENABLE |
| 250 | IGNORE_FORMAT_WARNING(dprintf("(charybdis) process_record_kb: config = {\n" | 243 | dprintf("(charybdis) process_record_kb: config = {\n" |
| 251 | "\traw = 0x%04X,\n" | 244 | "\traw = 0x%X,\n" |
| 252 | "\t{\n" | 245 | "\t{\n" |
| 253 | "\t\tis_dragscroll_enabled=%b\n" | 246 | "\t\tis_dragscroll_enabled=%u\n" |
| 254 | "\t\tis_sniping_enabled=%b\n" | 247 | "\t\tis_sniping_enabled=%u\n" |
| 255 | "\t\tdefault_dpi=0x%02X (%ld)\n" | 248 | "\t\tdefault_dpi=0x%X (%u)\n" |
| 256 | "\t\tsniping_dpi=0x%01X (%ld)\n" | 249 | "\t\tsniping_dpi=0x%X (%u)\n" |
| 257 | "\t}\n" | 250 | "\t}\n" |
| 258 | "}\n", | 251 | "}\n", |
| 259 | config->raw, config->is_dragscroll_enabled, config->is_sniping_enabled, config->pointer_default_dpi, get_pointer_default_dpi(config), config->pointer_sniping_dpi, get_pointer_sniping_dpi(config))); | 252 | config->raw, config->is_dragscroll_enabled, config->is_sniping_enabled, config->pointer_default_dpi, get_pointer_default_dpi(config), config->pointer_sniping_dpi, get_pointer_sniping_dpi(config)); |
| 260 | # endif // CONSOLE_ENABLE | 253 | # endif // CONSOLE_ENABLE |
| 261 | } | 254 | } |
| 262 | 255 | ||
| @@ -307,7 +300,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) { | |||
| 307 | } | 300 | } |
| 308 | break; | 301 | break; |
| 309 | } | 302 | } |
| 310 | # endif // !NO_CHARYBDIS_KEYCODES | 303 | # endif // !NO_CHARYBDIS_KEYCODES |
| 311 | return true; | 304 | return true; |
| 312 | } | 305 | } |
| 313 | 306 | ||
| @@ -318,22 +311,70 @@ void eeconfig_init_kb(void) { | |||
| 318 | eeconfig_init_user(); | 311 | eeconfig_init_user(); |
| 319 | } | 312 | } |
| 320 | 313 | ||
| 321 | void matrix_power_up(void) { pointing_device_task(); } | 314 | void matrix_power_up(void) { |
| 315 | pointing_device_task(); | ||
| 316 | } | ||
| 322 | 317 | ||
| 323 | void charybdis_config_sync_handler(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) { | 318 | void charybdis_config_sync_handler(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) { |
| 324 | if (initiator2target_buffer_size == sizeof(g_charybdis_config)) { | 319 | if (initiator2target_buffer_size == sizeof(g_charybdis_config)) { |
| 325 | memcpy(&g_charybdis_config, initiator2target_buffer, sizeof(g_charybdis_config)); | 320 | memcpy(&g_charybdis_config, initiator2target_buffer, sizeof(g_charybdis_config)); |
| 326 | } | 321 | } |
| 327 | } | 322 | } |
| 323 | #endif // POINTING_DEVICE_ENABLE | ||
| 324 | |||
| 325 | __attribute__((weak)) void user_button_init(void) { | ||
| 326 | #ifdef USER_BUTTON_PIN | ||
| 327 | gpio_set_pin_input_high(USER_BUTTON_PIN); | ||
| 328 | #endif // USER_BUTTON_PIN | ||
| 329 | } | ||
| 330 | |||
| 331 | __attribute__((weak)) bool check_user_button_state(void) { | ||
| 332 | #ifdef USER_BUTTON_PIN | ||
| 333 | return !gpio_read_pin(USER_BUTTON_PIN); | ||
| 334 | #endif // USER_BUTTON_PIN | ||
| 335 | return false; | ||
| 336 | } | ||
| 328 | 337 | ||
| 329 | void keyboard_post_init_kb(void) { | 338 | void keyboard_post_init_kb(void) { |
| 339 | #ifdef DEBUG_LED_PIN | ||
| 340 | gpio_set_pin_output(DEBUG_LED_PIN); | ||
| 341 | gpio_write_pin_low(DEBUG_LED_PIN); | ||
| 342 | #endif // DEBUG_LED_PIN | ||
| 343 | |||
| 344 | #ifdef POINTING_DEVICE_ENABLE | ||
| 330 | maybe_update_pointing_device_cpi(&g_charybdis_config); | 345 | maybe_update_pointing_device_cpi(&g_charybdis_config); |
| 331 | transaction_register_rpc(RPC_ID_KB_CONFIG_SYNC, charybdis_config_sync_handler); | 346 | transaction_register_rpc(RPC_ID_KB_CONFIG_SYNC, charybdis_config_sync_handler); |
| 332 | 347 | #endif // POINTING_DEVICE_ENABLE | |
| 333 | keyboard_post_init_user(); | 348 | keyboard_post_init_user(); |
| 334 | } | 349 | } |
| 335 | 350 | ||
| 351 | void keyboard_pre_init_kb(void) { | ||
| 352 | user_button_init(); | ||
| 353 | #ifdef POINTING_DEVICE_ENABLE | ||
| 354 | read_charybdis_config_from_eeprom(&g_charybdis_config); | ||
| 355 | #endif // POINTING_DEVICE_ENAcBLE | ||
| 356 | keyboard_pre_init_user(); | ||
| 357 | } | ||
| 358 | |||
| 359 | __attribute__((weak)) void execute_user_button_action(bool state) { | ||
| 360 | if (state) { | ||
| 361 | if (is_keyboard_master()) { | ||
| 362 | reset_keyboard(); | ||
| 363 | } else { | ||
| 364 | soft_reset_keyboard(); | ||
| 365 | } | ||
| 366 | } | ||
| 367 | } | ||
| 368 | |||
| 336 | void housekeeping_task_kb(void) { | 369 | void housekeeping_task_kb(void) { |
| 370 | static bool last_state = false; | ||
| 371 | bool state = check_user_button_state(); | ||
| 372 | if (state != last_state) { | ||
| 373 | last_state = state; | ||
| 374 | execute_user_button_action(state); | ||
| 375 | } | ||
| 376 | |||
| 377 | #ifdef POINTING_DEVICE_ENABLE | ||
| 337 | if (is_keyboard_master()) { | 378 | if (is_keyboard_master()) { |
| 338 | // Keep track of the last state, so that we can tell if we need to propagate to slave | 379 | // Keep track of the last state, so that we can tell if we need to propagate to slave |
| 339 | static charybdis_config_t last_charybdis_config = {0}; | 380 | static charybdis_config_t last_charybdis_config = {0}; |
| @@ -357,22 +398,50 @@ void housekeeping_task_kb(void) { | |||
| 357 | } | 398 | } |
| 358 | } | 399 | } |
| 359 | } | 400 | } |
| 360 | // no need for user function, is called already | 401 | #endif // POINTING_DEVICE_ENABLE |
| 402 | // no need for user function, is called already | ||
| 361 | } | 403 | } |
| 362 | 404 | ||
| 363 | #endif // POINTING_DEVICE_ENABLE | 405 | #ifdef USER_BUTTON_PIN |
| 406 | /** | ||
| 407 | * @brief Replace and add upon the default bootmagic reset function. | ||
| 408 | * In this case, we also check the user button. | ||
| 409 | * | ||
| 410 | * @return true if the user button is pressed, or normal bootmagic key position. | ||
| 411 | * @return false if the user button is not pressed and normal bootmagic key position is not pressed. | ||
| 412 | */ | ||
| 413 | __attribute__((weak)) bool bootmagic_should_reset(void) { | ||
| 414 | uint8_t row = BOOTMAGIC_ROW; | ||
| 415 | uint8_t col = BOOTMAGIC_COLUMN; | ||
| 416 | |||
| 417 | # if defined(SPLIT_KEYBOARD) && defined(BOOTMAGIC_ROW_RIGHT) && defined(BOOTMAGIC_COLUMN_RIGHT) | ||
| 418 | if (!is_keyboard_left()) { | ||
| 419 | row = BOOTMAGIC_ROW_RIGHT; | ||
| 420 | col = BOOTMAGIC_COLUMN_RIGHT; | ||
| 421 | } | ||
| 422 | # endif | ||
| 364 | 423 | ||
| 365 | __attribute__((weak)) void matrix_init_sub_kb(void) {} | 424 | return matrix_get_row(row) & (1 << col) || check_user_button_state(); |
| 366 | void matrix_init_kb(void) { | ||
| 367 | #ifdef POINTING_DEVICE_ENABLE | ||
| 368 | read_charybdis_config_from_eeprom(&g_charybdis_config); | ||
| 369 | #endif // POINTING_DEVICE_ENABLE | ||
| 370 | matrix_init_sub_kb(); | ||
| 371 | matrix_init_user(); | ||
| 372 | } | 425 | } |
| 426 | #endif // USER_BUTTON_PIN | ||
| 373 | 427 | ||
| 374 | __attribute__((weak)) void matrix_scan_sub_kb(void) {} | 428 | bool shutdown_kb(bool jump_to_bootloader) { |
| 375 | void matrix_scan_kb(void) { | 429 | if (!shutdown_user(jump_to_bootloader)) { |
| 376 | matrix_scan_sub_kb(); | 430 | return false; |
| 377 | matrix_scan_user(); | 431 | } |
| 432 | #ifdef RGB_MATRIX_ENABLE | ||
| 433 | void rgb_matrix_update_pwm_buffers(void); | ||
| 434 | rgb_matrix_set_color_all(RGB_RED); | ||
| 435 | rgb_matrix_update_pwm_buffers(); | ||
| 436 | #endif // RGB_MATRIX_ENABLE | ||
| 437 | return true; | ||
| 438 | } | ||
| 439 | |||
| 440 | #ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE | ||
| 441 | bool is_mouse_record_kb(uint16_t keycode, keyrecord_t* record) { | ||
| 442 | if (IS_KB_KEYCODE(keycode)) { | ||
| 443 | return true; | ||
| 444 | } | ||
| 445 | return is_mouse_record_user(keycode, record); | ||
| 378 | } | 446 | } |
| 447 | #endif // POINTING_DEVICE_AUTO_MOUSE_ENABLE | ||
diff --git a/keyboards/handwired/tractyl_manuform/tractyl_manuform.h b/keyboards/handwired/tractyl_manuform/tractyl_manuform.h index 48020c89bd..0c473517c7 100644 --- a/keyboards/handwired/tractyl_manuform/tractyl_manuform.h +++ b/keyboards/handwired/tractyl_manuform/tractyl_manuform.h | |||
| @@ -28,14 +28,15 @@ enum charybdis_keycodes { | |||
| 28 | DRAGSCROLL_MODE, | 28 | DRAGSCROLL_MODE, |
| 29 | DRAGSCROLL_MODE_TOGGLE, | 29 | DRAGSCROLL_MODE_TOGGLE, |
| 30 | }; | 30 | }; |
| 31 | # define DPI_MOD POINTER_DEFAULT_DPI_FORWARD | 31 | |
| 32 | # define DPI_RMOD POINTER_DEFAULT_DPI_REVERSE | 32 | #define DPI_MOD POINTER_DEFAULT_DPI_FORWARD |
| 33 | # define S_D_MOD POINTER_SNIPING_DPI_FORWARD | 33 | #define DPI_RMOD POINTER_DEFAULT_DPI_REVERSE |
| 34 | # define S_D_RMOD POINTER_SNIPING_DPI_REVERSE | 34 | #define S_D_MOD POINTER_SNIPING_DPI_FORWARD |
| 35 | # define SNIPING SNIPING_MODE | 35 | #define S_D_RMOD POINTER_SNIPING_DPI_REVERSE |
| 36 | # define SNP_TOG SNIPING_MODE_TOGGLE | 36 | #define SNIPING SNIPING_MODE |
| 37 | # define DRGSCRL DRAGSCROLL_MODE | 37 | #define SNP_TOG SNIPING_MODE_TOGGLE |
| 38 | # define DRG_TOG DRAGSCROLL_MODE_TOGGLE | 38 | #define DRGSCRL DRAGSCROLL_MODE |
| 39 | #define DRG_TOG DRAGSCROLL_MODE_TOGGLE | ||
| 39 | 40 | ||
| 40 | #ifdef POINTING_DEVICE_ENABLE | 41 | #ifdef POINTING_DEVICE_ENABLE |
| 41 | /** \brief Return the current DPI value for the pointer's default mode. */ | 42 | /** \brief Return the current DPI value for the pointer's default mode. */ |
| @@ -103,7 +104,4 @@ bool charybdis_get_pointer_dragscroll_enabled(void); | |||
| 103 | * are translated into horizontal and vertical scroll movements. | 104 | * are translated into horizontal and vertical scroll movements. |
| 104 | */ | 105 | */ |
| 105 | void charybdis_set_pointer_dragscroll_enabled(bool enable); | 106 | void charybdis_set_pointer_dragscroll_enabled(bool enable); |
| 106 | #endif // POINTING_DEVICE_ENABLE | 107 | #endif // POINTING_DEVICE_ENABLE |
| 107 | |||
| 108 | void matrix_init_sub_kb(void); | ||
| 109 | void matrix_scan_sub_kb(void); | ||
