From 1e95f7be8f214c544bf99f415916a4a5f07a1e9b Mon Sep 17 00:00:00 2001 From: Ryan Date: Sun, 27 Nov 2022 03:14:45 +1100 Subject: Joystick feature improvements (#19052) --- .../battleship_gamepad/battleship_gamepad.c | 2 +- keyboards/handwired/battleship_gamepad/config.h | 4 ++-- .../handwired/misterdeck/keymaps/default/config.h | 2 +- .../handwired/misterdeck/keymaps/default/keymap.c | 2 +- .../misterdeck/keymaps/nobuttons/config.h | 2 +- .../misterdeck/keymaps/nobuttons/keymap.c | 2 +- .../handwired/onekey/keymaps/joystick/config.h | 2 +- .../handwired/onekey/keymaps/joystick/keymap.c | 2 +- keyboards/handwired/onekey/proton_c/halconf.h | 26 ++++++++++++++++++++++ keyboards/handwired/onekey/proton_c/mcuconf.h | 22 ++++++++++++++++++ 10 files changed, 57 insertions(+), 9 deletions(-) create mode 100644 keyboards/handwired/onekey/proton_c/halconf.h create mode 100644 keyboards/handwired/onekey/proton_c/mcuconf.h (limited to 'keyboards/handwired') diff --git a/keyboards/handwired/battleship_gamepad/battleship_gamepad.c b/keyboards/handwired/battleship_gamepad/battleship_gamepad.c index 2c9de15a9f..faec437f36 100644 --- a/keyboards/handwired/battleship_gamepad/battleship_gamepad.c +++ b/keyboards/handwired/battleship_gamepad/battleship_gamepad.c @@ -17,7 +17,7 @@ #include "battleship_gamepad.h" /* joystick config */ -joystick_config_t joystick_axes[JOYSTICK_AXES_COUNT] = { +joystick_config_t joystick_axes[JOYSTICK_AXIS_COUNT] = { [0] = JOYSTICK_AXIS_IN(F5, 1023, 512, 0), [1] = JOYSTICK_AXIS_IN(F4, 0, 512, 1023) }; diff --git a/keyboards/handwired/battleship_gamepad/config.h b/keyboards/handwired/battleship_gamepad/config.h index 25389c0245..a1ebc585de 100644 --- a/keyboards/handwired/battleship_gamepad/config.h +++ b/keyboards/handwired/battleship_gamepad/config.h @@ -28,8 +28,8 @@ /* joystick configuration */ #define JOYSTICK_BUTTON_COUNT 25 -#define JOYSTICK_AXES_COUNT 2 -#define JOYSTICK_AXES_RESOLUTION 10 +#define JOYSTICK_AXIS_COUNT 2 +#define JOYSTICK_AXIS_RESOLUTION 10 /* COL2ROW or ROW2COL */ #define DIODE_DIRECTION COL2ROW diff --git a/keyboards/handwired/misterdeck/keymaps/default/config.h b/keyboards/handwired/misterdeck/keymaps/default/config.h index 92157a0938..f96ac1468b 100644 --- a/keyboards/handwired/misterdeck/keymaps/default/config.h +++ b/keyboards/handwired/misterdeck/keymaps/default/config.h @@ -17,5 +17,5 @@ #pragma once -#define JOYSTICK_AXES_COUNT 4 +#define JOYSTICK_AXIS_COUNT 4 #define JOYSTICK_BUTTON_COUNT 4 diff --git a/keyboards/handwired/misterdeck/keymaps/default/keymap.c b/keyboards/handwired/misterdeck/keymaps/default/keymap.c index 0992e06f87..2da6737e17 100644 --- a/keyboards/handwired/misterdeck/keymaps/default/keymap.c +++ b/keyboards/handwired/misterdeck/keymaps/default/keymap.c @@ -28,7 +28,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ) }; -joystick_config_t joystick_axes[JOYSTICK_AXES_COUNT] = { +joystick_config_t joystick_axes[JOYSTICK_AXIS_COUNT] = { [0] = JOYSTICK_AXIS_IN(F4, 0, 512, 1023), [1] = JOYSTICK_AXIS_IN(F5, 0, 512, 1023), [2] = JOYSTICK_AXIS_IN(F6, 0, 512, 1023), diff --git a/keyboards/handwired/misterdeck/keymaps/nobuttons/config.h b/keyboards/handwired/misterdeck/keymaps/nobuttons/config.h index f609bf2962..59fdfc3e7a 100644 --- a/keyboards/handwired/misterdeck/keymaps/nobuttons/config.h +++ b/keyboards/handwired/misterdeck/keymaps/nobuttons/config.h @@ -17,5 +17,5 @@ #pragma once -#define JOYSTICK_AXES_COUNT 4 +#define JOYSTICK_AXIS_COUNT 4 #define JOYSTICK_BUTTON_COUNT 0 diff --git a/keyboards/handwired/misterdeck/keymaps/nobuttons/keymap.c b/keyboards/handwired/misterdeck/keymaps/nobuttons/keymap.c index 5c69d2bc21..51a75fe204 100644 --- a/keyboards/handwired/misterdeck/keymaps/nobuttons/keymap.c +++ b/keyboards/handwired/misterdeck/keymaps/nobuttons/keymap.c @@ -28,7 +28,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), }; -joystick_config_t joystick_axes[JOYSTICK_AXES_COUNT] = { +joystick_config_t joystick_axes[JOYSTICK_AXIS_COUNT] = { [0] = JOYSTICK_AXIS_IN(F4, 0, 512, 1023), [1] = JOYSTICK_AXIS_IN(F5, 0, 512, 1023), [2] = JOYSTICK_AXIS_IN(F6, 0, 512, 1023), diff --git a/keyboards/handwired/onekey/keymaps/joystick/config.h b/keyboards/handwired/onekey/keymaps/joystick/config.h index a3b5858ad2..8a4e461b27 100644 --- a/keyboards/handwired/onekey/keymaps/joystick/config.h +++ b/keyboards/handwired/onekey/keymaps/joystick/config.h @@ -1,4 +1,4 @@ #pragma once -#define JOYSTICK_AXES_COUNT 2 +#define JOYSTICK_AXIS_COUNT 2 #define JOYSTICK_BUTTON_COUNT 1 diff --git a/keyboards/handwired/onekey/keymaps/joystick/keymap.c b/keyboards/handwired/onekey/keymaps/joystick/keymap.c index 96115aa496..6463900b7b 100644 --- a/keyboards/handwired/onekey/keymaps/joystick/keymap.c +++ b/keyboards/handwired/onekey/keymaps/joystick/keymap.c @@ -14,7 +14,7 @@ void matrix_scan_user() { } // Joystick config -joystick_config_t joystick_axes[JOYSTICK_AXES_COUNT] = { +joystick_config_t joystick_axes[JOYSTICK_AXIS_COUNT] = { [0] = JOYSTICK_AXIS_IN(ADC_PIN, 0, 512, 1023), [1] = JOYSTICK_AXIS_VIRTUAL }; diff --git a/keyboards/handwired/onekey/proton_c/halconf.h b/keyboards/handwired/onekey/proton_c/halconf.h new file mode 100644 index 0000000000..4c66e56bba --- /dev/null +++ b/keyboards/handwired/onekey/proton_c/halconf.h @@ -0,0 +1,26 @@ +/* Copyright 2020 QMK + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/handwired/onekey/blackpill_f401/halconf.h -r platforms/chibios/common/configs/halconf.h` + */ + +#pragma once + +#define HAL_USE_ADC TRUE + +#include_next diff --git a/keyboards/handwired/onekey/proton_c/mcuconf.h b/keyboards/handwired/onekey/proton_c/mcuconf.h new file mode 100644 index 0000000000..935056eb6a --- /dev/null +++ b/keyboards/handwired/onekey/proton_c/mcuconf.h @@ -0,0 +1,22 @@ +/* Copyright 2020 Nick Brassel (tzarc) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include_next "mcuconf.h" + +#undef STM32_ADC_USE_ADC1 +#define STM32_ADC_USE_ADC1 TRUE -- cgit v1.2.3