summaryrefslogtreecommitdiff
path: root/keyboards
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2022-09-27 18:37:13 +1000
committerGitHub <noreply@github.com>2022-09-27 18:37:13 +1000
commitbe8907d634ac8967de1ae2ac8346b845f738c9e6 (patch)
tree5a56127946000bbd648f8a5f52d90eb6711be222 /keyboards
parentfb400f2ac2c57fa0fc82ca803f6450b818bb32f9 (diff)
Further refactoring of joystick feature (#18437)
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/handwired/onekey/keymaps/joystick/keymap.c6
-rw-r--r--keyboards/synthlabs/solo/keymaps/gamepad/keymap.c7
2 files changed, 2 insertions, 11 deletions
diff --git a/keyboards/handwired/onekey/keymaps/joystick/keymap.c b/keyboards/handwired/onekey/keymaps/joystick/keymap.c
index 7a2f138b28..c74707e931 100644
--- a/keyboards/handwired/onekey/keymaps/joystick/keymap.c
+++ b/keyboards/handwired/onekey/keymaps/joystick/keymap.c
@@ -10,11 +10,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
void matrix_scan_user() {
int16_t val = (((uint32_t)timer_read() % 5000 - 2500) * 255) / 5000;
-
- if (val != joystick_status.axes[1]) {
- joystick_status.axes[1] = val;
- joystick_status.status |= JS_UPDATED;
- }
+ joystick_set_axis(1, val);
}
// Joystick config
diff --git a/keyboards/synthlabs/solo/keymaps/gamepad/keymap.c b/keyboards/synthlabs/solo/keymaps/gamepad/keymap.c
index 3e55f346f1..8da2afc97a 100644
--- a/keyboards/synthlabs/solo/keymaps/gamepad/keymap.c
+++ b/keyboards/synthlabs/solo/keymaps/gamepad/keymap.c
@@ -3,8 +3,6 @@
#include QMK_KEYBOARD_H
-#include "joystick.h"
-
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_all(
JS_BUTTON0,JS_BUTTON1,JS_BUTTON2,JS_BUTTON3,JS_BUTTON4,JS_BUTTON5,JS_BUTTON6,
@@ -24,11 +22,8 @@ joystick_config_t joystick_axes[JOYSTICK_AXES_COUNT] = {
bool encoder_update_kb(uint8_t index, bool clockwise) {
joystick_position += (clockwise ? 2 : -2) * (full_joystick_value / pulses_per_revolution); // +2 and -2 are used, since +1.0 and -1.0 axis output refers to positions at half of a full rotation
+ joystick_set_axis(0, joystick_position);
- if (joystick_position != joystick_status.axes[0]) {
- joystick_status.axes[0] = joystick_position;
- joystick_status.status |= JS_UPDATED;
- }
return true;
}