From be8907d634ac8967de1ae2ac8346b845f738c9e6 Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 27 Sep 2022 18:37:13 +1000 Subject: Further refactoring of joystick feature (#18437) --- keyboards/synthlabs/solo/keymaps/gamepad/keymap.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'keyboards/synthlabs') 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; } -- cgit v1.2.3 From 52a5949917ba9608fff3ac950310af2affdd2b6c Mon Sep 17 00:00:00 2001 From: James Young <18669334+noroadsleft@users.noreply.github.com> Date: Fri, 7 Oct 2022 19:04:07 -0700 Subject: Synth Labs Solo Configurator Fixes (#18642) * info.json: apply friendly formatting - four-space indent - line breaks between physical rows * info.json: fix key sequence * info.json: fix layout macro reference The macro `LAYOUT` doesn't exist - this data should reference `LAYOUT_all`. * info.json: add LAYOUT_left data * info.json: add LAYOUT_right data * info.json: correct LAYOUT_right key sequence and positioning --- keyboards/synthlabs/solo/info.json | 114 ++++++++++++++++++++++++------------- 1 file changed, 74 insertions(+), 40 deletions(-) (limited to 'keyboards/synthlabs') diff --git a/keyboards/synthlabs/solo/info.json b/keyboards/synthlabs/solo/info.json index 3fd7b1b8f3..9fc26e0ab4 100644 --- a/keyboards/synthlabs/solo/info.json +++ b/keyboards/synthlabs/solo/info.json @@ -1,44 +1,78 @@ { - "keyboard_name": "Solo", - "manufacturer": "Synth Labs", - "url": "http://solo.synthlabs.io", - "maintainer": "hongaaronc", - "bootloader": "atmel-dfu", - "processor": "atmega32u4", - "debounce": 5, - "matrix_pins": { - "direct": [ - ["C6", "D6", "B5", "B4", "D7", "B6", "D4"], - [null, "B7", null, null, null, null, null], - ["F0", "F7", "F4", "F5", "F6", "F1", "C7"] - ] - }, - "usb": { - "vid": "0x534E", - "pid": "0x3031", - "device_version": "0.0.1" - }, - "layouts": { - "LAYOUT": { - "layout": [ - {"label":"P2 1", "x":3, "y":0, "w":0.5, "h":1.5, "matrix":[0,0]}, - {"label":"P1 2", "x":3.5, "y":0, "w":0.5, "h":1.5, "matrix":[0,1]}, - {"label":"P2 3", "x":4, "y":0, "w":0.5, "h":1.5, "matrix":[0,2]}, - {"label":"P1 4", "x":4.5, "y":0, "w":0.5, "h":1.5, "matrix":[0,3]}, - {"label":"P2 5", "x":5, "y":0, "w":0.5, "h":1.5, "matrix":[0,4]}, - {"label":"P1 6", "x":5.5, "y":0, "w":0.5, "h":1.5, "matrix":[0,5]}, - {"label":"P2 7", "x":6, "y":0, "w":0.5, "h":1.5, "matrix":[0,6]}, - {"label":"Knob Press", "x":0.5, "y":1, "w":1.5, "h":1.5, "matrix":[1,1]}, - {"label":"Knob CCW", "x":0, "y":1.25, "w":0.5, "matrix":[1,0]}, - {"label":"Knob CW", "x":2, "y":1.25, "w":0.5, "matrix":[1,2]}, - {"label":"P1 1", "x":3, "y":2, "w":0.5, "h":1.5, "matrix":[2,0]}, - {"label":"P2 2", "x":3.5, "y":2, "w":0.5, "h":1.5, "matrix":[2,1]}, - {"label":"P1 3", "x":4, "y":2, "w":0.5, "h":1.5, "matrix":[2,2]}, - {"label":"P2 4", "x":4.5, "y":2, "w":0.5, "h":1.5, "matrix":[2,3]}, - {"label":"P1 5", "x":5, "y":2, "w":0.5, "h":1.5, "matrix":[2,4]}, - {"label":"P2 6", "x":5.5, "y":2, "w":0.5, "h":1.5, "matrix":[2,5]}, - {"label":"P1 7", "x":6, "y":2, "w":0.5, "h":1.5, "matrix":[2,6]} + "keyboard_name": "Solo", + "manufacturer": "Synth Labs", + "url": "http://solo.synthlabs.io", + "maintainer": "hongaaronc", + "bootloader": "atmel-dfu", + "processor": "atmega32u4", + "debounce": 5, + "matrix_pins": { + "direct": [ + ["C6", "D6", "B5", "B4", "D7", "B6", "D4"], + [null, "B7", null, null, null, null, null], + ["F0", "F7", "F4", "F5", "F6", "F1", "C7"] ] + }, + "usb": { + "vid": "0x534E", + "pid": "0x3031", + "device_version": "0.0.1" + }, + "layouts": { + "LAYOUT_all": { + "layout": [ + {"label":"P2 1", "x":3, "y":0, "w":0.5, "h":1.5, "matrix":[0,0]}, + {"label":"P1 2", "x":3.5, "y":0, "w":0.5, "h":1.5, "matrix":[0,1]}, + {"label":"P2 3", "x":4, "y":0, "w":0.5, "h":1.5, "matrix":[0,2]}, + {"label":"P1 4", "x":4.5, "y":0, "w":0.5, "h":1.5, "matrix":[0,3]}, + {"label":"P2 5", "x":5, "y":0, "w":0.5, "h":1.5, "matrix":[0,4]}, + {"label":"P1 6", "x":5.5, "y":0, "w":0.5, "h":1.5, "matrix":[0,5]}, + {"label":"P2 7", "x":6, "y":0, "w":0.5, "h":1.5, "matrix":[0,6]}, + + {"label":"Knob CCW", "x":0, "y":1.25, "w":0.5, "matrix":[1,0]}, + {"label":"Knob Press", "x":0.5, "y":1, "w":1.5, "h":1.5, "matrix":[1,1]}, + {"label":"Knob CW", "x":2, "y":1.25, "w":0.5, "matrix":[1,2]}, + + {"label":"P1 1", "x":3, "y":2, "w":0.5, "h":1.5, "matrix":[2,0]}, + {"label":"P2 2", "x":3.5, "y":2, "w":0.5, "h":1.5, "matrix":[2,1]}, + {"label":"P1 3", "x":4, "y":2, "w":0.5, "h":1.5, "matrix":[2,2]}, + {"label":"P2 4", "x":4.5, "y":2, "w":0.5, "h":1.5, "matrix":[2,3]}, + {"label":"P1 5", "x":5, "y":2, "w":0.5, "h":1.5, "matrix":[2,4]}, + {"label":"P2 6", "x":5.5, "y":2, "w":0.5, "h":1.5, "matrix":[2,5]}, + {"label":"P1 7", "x":6, "y":2, "w":0.5, "h":1.5, "matrix":[2,6]} + ] + }, + "LAYOUT_left": { + "layout": [ + {"label":"P1 2", "x":3.5, "y":0, "w":0.5, "h":1.5, "matrix":[0,1]}, + {"label":"P1 4", "x":4.5, "y":0, "w":0.5, "h":1.5, "matrix":[0,3]}, + {"label":"P1 6", "x":5.5, "y":0, "w":0.5, "h":1.5, "matrix":[0,5]}, + + {"label":"Knob CCW", "x":0, "y":1.25, "w":0.5, "matrix":[1,0]}, + {"label":"Knob Press", "x":0.5, "y":1, "w":1.5, "h":1.5, "matrix":[1,1]}, + {"label":"Knob CW", "x":2, "y":1.25, "w":0.5, "matrix":[1,2]}, + + {"label":"P1 1", "x":3, "y":2, "w":0.5, "h":1.5, "matrix":[2,0]}, + {"label":"P1 3", "x":4, "y":2, "w":0.5, "h":1.5, "matrix":[2,2]}, + {"label":"P1 5", "x":5, "y":2, "w":0.5, "h":1.5, "matrix":[2,4]}, + {"label":"P1 7", "x":6, "y":2, "w":0.5, "h":1.5, "matrix":[2,6]} + ] + }, + "LAYOUT_right": { + "layout": [ + {"label":"P2 6", "x":0.5, "y":0, "w":0.5, "h":1.5, "matrix":[2,5]}, + {"label":"P2 4", "x":1.5, "y":0, "w":0.5, "h":1.5, "matrix":[2,3]}, + {"label":"P2 2", "x":2.5, "y":0, "w":0.5, "h":1.5, "matrix":[2,1]}, + + {"label":"Knob CCW", "x":4, "y":1.25, "w":0.5, "matrix":[1,0] }, + {"label":"Knob Press", "x":4.5, "y":1, "w":1.5, "h":1.5, "matrix":[1,1]}, + {"label":"Knob CW", "x":6, "y":1.25, "w":0.5, "matrix":[1,2]}, + + {"label":"P2 7", "x":0, "y":2, "w":0.5, "h":1.5, "matrix":[0,6]}, + {"label":"P2 5", "x":1, "y":2, "w":0.5, "h":1.5, "matrix":[0,4]}, + {"label":"P2 3", "x":2, "y":2, "w":0.5, "h":1.5, "matrix":[0,2]}, + {"label":"P2 1", "x":3, "y":2, "w":0.5, "h":1.5, "matrix":[0,0]} + ] + } } - } } -- cgit v1.2.3 From 6bbe8b6eddc56d43f4db07c665bf1791ea2ab871 Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 25 Oct 2022 01:50:33 +1100 Subject: Normalise Joystick and Programmable Button keycodes (#18832) --- keyboards/synthlabs/solo/keymaps/gamepad/keymap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'keyboards/synthlabs') diff --git a/keyboards/synthlabs/solo/keymaps/gamepad/keymap.c b/keyboards/synthlabs/solo/keymaps/gamepad/keymap.c index 8da2afc97a..e6f9678fbb 100644 --- a/keyboards/synthlabs/solo/keymaps/gamepad/keymap.c +++ b/keyboards/synthlabs/solo/keymaps/gamepad/keymap.c @@ -5,9 +5,9 @@ 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, - KC_NO, JS_BUTTON7, KC_NO, - JS_BUTTON0,JS_BUTTON1,JS_BUTTON2,JS_BUTTON3,JS_BUTTON4,JS_BUTTON5,JS_BUTTON6 + JS_0,JS_1,JS_2,JS_3,JS_4,JS_5,JS_6, + KC_NO, JS_7, KC_NO, + JS_0,JS_1,JS_2,JS_3,JS_4,JS_5,JS_6 ) }; -- cgit v1.2.3 From 99d5b5506ae780ffb522075788e3472b570ed7a4 Mon Sep 17 00:00:00 2001 From: Nostril Date: Wed, 26 Oct 2022 12:40:44 -0700 Subject: [Keymap] Add new IIDX gamepad keymap for Synth Labs Solo (#18741) Co-authored-by: Drashna Jaelre --- keyboards/synthlabs/solo/config.h | 2 +- keyboards/synthlabs/solo/keymaps/gamepad/readme.md | 2 +- keyboards/synthlabs/solo/keymaps/iidx/keymap.c | 72 ++++++++++++++++++++++ keyboards/synthlabs/solo/keymaps/iidx/readme.md | 16 +++++ keyboards/synthlabs/solo/keymaps/iidx/rules.mk | 3 + 5 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 keyboards/synthlabs/solo/keymaps/iidx/keymap.c create mode 100644 keyboards/synthlabs/solo/keymaps/iidx/readme.md create mode 100644 keyboards/synthlabs/solo/keymaps/iidx/rules.mk (limited to 'keyboards/synthlabs') diff --git a/keyboards/synthlabs/solo/config.h b/keyboards/synthlabs/solo/config.h index 112d12d1ee..e8d9870e46 100644 --- a/keyboards/synthlabs/solo/config.h +++ b/keyboards/synthlabs/solo/config.h @@ -53,6 +53,6 @@ #define BOOTMAGIC_LITE_ROW 1 #define BOOTMAGIC_LITE_COLUMN 1 -#define JOYSTICK_BUTTON_COUNT 8 +#define JOYSTICK_BUTTON_COUNT 13 #define JOYSTICK_AXES_COUNT 1 #define JOYSTICK_AXES_RESOLUTION 16 diff --git a/keyboards/synthlabs/solo/keymaps/gamepad/readme.md b/keyboards/synthlabs/solo/keymaps/gamepad/readme.md index 9930bb61b4..12e0df2cf2 100644 --- a/keyboards/synthlabs/solo/keymaps/gamepad/readme.md +++ b/keyboards/synthlabs/solo/keymaps/gamepad/readme.md @@ -1,3 +1,3 @@ # Gamepad Synth Labs Solo Layout -This keymap is intended for usage as a IIDX controller. The rotary encoder is mapped as a virtual 1-axis joystick. +This keymap is intended for usage as a generic gamepad. The rotary encoder is mapped as a virtual 1-axis joystick. diff --git a/keyboards/synthlabs/solo/keymaps/iidx/keymap.c b/keyboards/synthlabs/solo/keymaps/iidx/keymap.c new file mode 100644 index 0000000000..f274ba9c06 --- /dev/null +++ b/keyboards/synthlabs/solo/keymaps/iidx/keymap.c @@ -0,0 +1,72 @@ +// Copyright 2022 Aaron Hong (@hongaaronc) +// SPDX-License-Identifier: GPL-2.0-or-later + +#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, + JS_BUTTON8, MO(1), JS_BUTTON7, + JS_BUTTON0,JS_BUTTON1,JS_BUTTON2,JS_BUTTON3,JS_BUTTON4,JS_BUTTON5,JS_BUTTON6 + ), + [1] = LAYOUT_all( + JS_BUTTON9,JS_BUTTON0,JS_BUTTON10, _______,JS_BUTTON11,JS_BUTTON1,JS_BUTTON12, + _______, _______, _______, + JS_BUTTON10,JS_BUTTON0,JS_BUTTON9, _______,JS_BUTTON11,JS_BUTTON1,JS_BUTTON12 + ), +}; + +#if defined(ENCODER_MAP_ENABLE) +/* The amount of time the encoder has to remain stationary, before unregistering encoder bindings */ +uint16_t encoder_stationary_release_delay_ms = 25; + +uint16_t encoder_last_update_time = 0; + +enum { + CCW_JOYSTICK_BUTTON = 8, + CW_JOYSTICK_BUTTON = 7, +}; + +enum { + CCW_MACRO = SAFE_RANGE, + CW_MACRO, +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case CCW_MACRO: + unregister_joystick_button(CW_JOYSTICK_BUTTON); + register_joystick_button(CCW_JOYSTICK_BUTTON); + encoder_last_update_time = timer_read(); /* Update the last time that the encoder was detected as rotated */ + return false; + case CW_MACRO: + unregister_joystick_button(CCW_JOYSTICK_BUTTON); + register_joystick_button(CW_JOYSTICK_BUTTON); + encoder_last_update_time = timer_read(); /* Update the last time that the encoder was detected as rotated */ + return false; + default: + return true; + } +} + +void housekeeping_task_user(void) { + uint16_t current_time = timer_read(); + uint16_t elapsed_time_since_last_update = current_time - encoder_last_update_time; + + /* If an encoder has been stationary for encoder_stationary_release_delay_ms, then unregister the joystick buttons for both directions */ + if (elapsed_time_since_last_update >= encoder_stationary_release_delay_ms) { + unregister_joystick_button(CCW_JOYSTICK_BUTTON); + unregister_joystick_button(CW_JOYSTICK_BUTTON); + } +} + +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [0] = { ENCODER_CCW_CW( + CCW_MACRO, + CW_MACRO + ) }, + [1] = { ENCODER_CCW_CW(_______, _______) }, +}; +#endif diff --git a/keyboards/synthlabs/solo/keymaps/iidx/readme.md b/keyboards/synthlabs/solo/keymaps/iidx/readme.md new file mode 100644 index 0000000000..f56fa622d3 --- /dev/null +++ b/keyboards/synthlabs/solo/keymaps/iidx/readme.md @@ -0,0 +1,16 @@ +# IIDX Synth Labs Solo Layout + +This keymap is intended for usage as a gamepad for [beatmania IIDX INFINITAS](https://p.eagate.573.jp/game/infinitas/2/index.html). + +This keycap follows the default keymapping for the game, shown here: + +![Default Keymapping Settings Screen](https://i.imgur.com/Va48FnZ.png) + +The face buttons correspond directly to ボタン 1 - ボタン 7 + +Turning the knob clockwise corresponds to スクラッチ-右回転 +Turning the knob counter-clockwise corresponds to スクラッチ-左回転 + +While holding down the knob button +* The bottom row of face buttons corresponds to ボタン E1 - ボタン E4 +* The top-left and top-right face buttons correspond to ボタン 1 and ボタン 2, for adjustment of in-game scroll speed diff --git a/keyboards/synthlabs/solo/keymaps/iidx/rules.mk b/keyboards/synthlabs/solo/keymaps/iidx/rules.mk new file mode 100644 index 0000000000..550de16143 --- /dev/null +++ b/keyboards/synthlabs/solo/keymaps/iidx/rules.mk @@ -0,0 +1,3 @@ +JOYSTICK_ENABLE = yes +DEBOUNCE_TYPE = sym_eager_pk +ENCODER_MAP_ENABLE = yes -- cgit v1.2.3 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) --- keyboards/synthlabs/solo/config.h | 4 ++-- keyboards/synthlabs/solo/keymaps/gamepad/keymap.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'keyboards/synthlabs') diff --git a/keyboards/synthlabs/solo/config.h b/keyboards/synthlabs/solo/config.h index e8d9870e46..2352ba2972 100644 --- a/keyboards/synthlabs/solo/config.h +++ b/keyboards/synthlabs/solo/config.h @@ -54,5 +54,5 @@ #define BOOTMAGIC_LITE_COLUMN 1 #define JOYSTICK_BUTTON_COUNT 13 -#define JOYSTICK_AXES_COUNT 1 -#define JOYSTICK_AXES_RESOLUTION 16 +#define JOYSTICK_AXIS_COUNT 1 +#define JOYSTICK_AXIS_RESOLUTION 16 diff --git a/keyboards/synthlabs/solo/keymaps/gamepad/keymap.c b/keyboards/synthlabs/solo/keymaps/gamepad/keymap.c index e6f9678fbb..f450769b43 100644 --- a/keyboards/synthlabs/solo/keymaps/gamepad/keymap.c +++ b/keyboards/synthlabs/solo/keymaps/gamepad/keymap.c @@ -16,7 +16,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { int16_t joystick_position = 0; int16_t pulses_per_revolution = 24; // Depends on encoder model. Usually 18ppr or 24ppr for Bourns EC11s. int16_t full_joystick_value = 32767; // Equivalent to max value of int16. +full_joystick_value is +1.0 axis output. -full_joystick_value is -1.0 axis output. -joystick_config_t joystick_axes[JOYSTICK_AXES_COUNT] = { +joystick_config_t joystick_axes[JOYSTICK_AXIS_COUNT] = { [0] = JOYSTICK_AXIS_VIRTUAL }; -- cgit v1.2.3