From e1c777a1c993efa6c739fde71f995ee386456237 Mon Sep 17 00:00:00 2001 From: Nostril Date: Tue, 12 Apr 2022 22:50:38 -0700 Subject: [Keyboard] Add Synth Labs Solo keyboard (#16103) Co-authored-by: Drashna Jaelre Co-authored-by: Ryan --- keyboards/synthlabs/solo/config.h | 64 +++++++++++++++++++ keyboards/synthlabs/solo/info.json | 43 +++++++++++++ keyboards/synthlabs/solo/keymaps/default/keymap.c | 12 ++++ keyboards/synthlabs/solo/keymaps/default/readme.md | 3 + keyboards/synthlabs/solo/keymaps/gamepad/keymap.c | 35 ++++++++++ keyboards/synthlabs/solo/keymaps/gamepad/readme.md | 3 + keyboards/synthlabs/solo/keymaps/gamepad/rules.mk | 2 + keyboards/synthlabs/solo/keymaps/via/keymap.c | 74 ++++++++++++++++++++++ keyboards/synthlabs/solo/keymaps/via/rules.mk | 1 + keyboards/synthlabs/solo/readme.md | 28 ++++++++ keyboards/synthlabs/solo/rules.mk | 13 ++++ keyboards/synthlabs/solo/solo.c | 18 ++++++ keyboards/synthlabs/solo/solo.h | 41 ++++++++++++ 13 files changed, 337 insertions(+) create mode 100644 keyboards/synthlabs/solo/config.h create mode 100644 keyboards/synthlabs/solo/info.json create mode 100644 keyboards/synthlabs/solo/keymaps/default/keymap.c create mode 100644 keyboards/synthlabs/solo/keymaps/default/readme.md create mode 100644 keyboards/synthlabs/solo/keymaps/gamepad/keymap.c create mode 100644 keyboards/synthlabs/solo/keymaps/gamepad/readme.md create mode 100644 keyboards/synthlabs/solo/keymaps/gamepad/rules.mk create mode 100644 keyboards/synthlabs/solo/keymaps/via/keymap.c create mode 100644 keyboards/synthlabs/solo/keymaps/via/rules.mk create mode 100644 keyboards/synthlabs/solo/readme.md create mode 100644 keyboards/synthlabs/solo/rules.mk create mode 100644 keyboards/synthlabs/solo/solo.c create mode 100644 keyboards/synthlabs/solo/solo.h (limited to 'keyboards/synthlabs/solo') diff --git a/keyboards/synthlabs/solo/config.h b/keyboards/synthlabs/solo/config.h new file mode 100644 index 0000000000..02fbd7abe0 --- /dev/null +++ b/keyboards/synthlabs/solo/config.h @@ -0,0 +1,64 @@ +// Copyright 2022 Aaron Hong (@hongaaronc) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define MANUFACTURER Synth Labs +#define PRODUCT Solo + +#define ENCODERS 1 +#define ENCODER_RESOLUTION 4 +#define ENCODERS_PAD_A { B2 } +#define ENCODERS_PAD_B { B3 } +#define ENCODERS_CW_KEY { { 2, 1 } } +#define ENCODERS_CCW_KEY { { 0, 1 } } + +/* key matrix size */ +#define MATRIX_ROWS 3 +#define MATRIX_COLS 7 + +#define QMK_KEYS_PER_SCAN 17 + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ + +#define FORCE_NKRO + +/* + * Magic Key Options + * + * Magic keys are hotkey commands that allow control over firmware functions of + * the keyboard. They are best used in combination with the HID Listen program, + * found here: https://www.pjrc.com/teensy/hid_listen.html + * + * The options below allow the magic key functionality to be changed. This is + * useful if your keyboard/keypad is missing keys and you want magic key support. + * + */ + +#define BOOTMAGIC_LITE_ROW 1 +#define BOOTMAGIC_LITE_COLUMN 1 + +#define JOYSTICK_BUTTON_COUNT 8 +#define JOYSTICK_AXES_COUNT 1 +#define JOYSTICK_AXES_RESOLUTION 16 diff --git a/keyboards/synthlabs/solo/info.json b/keyboards/synthlabs/solo/info.json new file mode 100644 index 0000000000..18a144a8b3 --- /dev/null +++ b/keyboards/synthlabs/solo/info.json @@ -0,0 +1,43 @@ +{ + "keyboard_name": "Synth Labs Solo", + "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_ver": "0x0001" + }, + "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]} + ] + } + } +} diff --git a/keyboards/synthlabs/solo/keymaps/default/keymap.c b/keyboards/synthlabs/solo/keymaps/default/keymap.c new file mode 100644 index 0000000000..fa54111fe8 --- /dev/null +++ b/keyboards/synthlabs/solo/keymaps/default/keymap.c @@ -0,0 +1,12 @@ +// Copyright 2022 Aaron Hong (@hongaaronc) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_all( + KC_J, KC_U, KC_K, KC_I, KC_L, KC_O, KC_SCLN, + _______, KC_MUTE, _______, + KC_J, KC_U, KC_K, KC_I, KC_L, KC_O, KC_SCLN + ) +}; diff --git a/keyboards/synthlabs/solo/keymaps/default/readme.md b/keyboards/synthlabs/solo/keymaps/default/readme.md new file mode 100644 index 0000000000..625bd392b6 --- /dev/null +++ b/keyboards/synthlabs/solo/keymaps/default/readme.md @@ -0,0 +1,3 @@ +# Default Synth Labs Solo Layout + +This keymap is intended for usage as a macropad. diff --git a/keyboards/synthlabs/solo/keymaps/gamepad/keymap.c b/keyboards/synthlabs/solo/keymaps/gamepad/keymap.c new file mode 100644 index 0000000000..3e55f346f1 --- /dev/null +++ b/keyboards/synthlabs/solo/keymaps/gamepad/keymap.c @@ -0,0 +1,35 @@ +// 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, + KC_NO, JS_BUTTON7, KC_NO, + JS_BUTTON0,JS_BUTTON1,JS_BUTTON2,JS_BUTTON3,JS_BUTTON4,JS_BUTTON5,JS_BUTTON6 + ) +}; + +#if defined(JOYSTICK_ENABLE) && defined(ENCODER_ENABLE) + +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] = { + [0] = JOYSTICK_AXIS_VIRTUAL +}; + +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 + + if (joystick_position != joystick_status.axes[0]) { + joystick_status.axes[0] = joystick_position; + joystick_status.status |= JS_UPDATED; + } + return true; +} + +#endif diff --git a/keyboards/synthlabs/solo/keymaps/gamepad/readme.md b/keyboards/synthlabs/solo/keymaps/gamepad/readme.md new file mode 100644 index 0000000000..9930bb61b4 --- /dev/null +++ b/keyboards/synthlabs/solo/keymaps/gamepad/readme.md @@ -0,0 +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. diff --git a/keyboards/synthlabs/solo/keymaps/gamepad/rules.mk b/keyboards/synthlabs/solo/keymaps/gamepad/rules.mk new file mode 100644 index 0000000000..30c23b8763 --- /dev/null +++ b/keyboards/synthlabs/solo/keymaps/gamepad/rules.mk @@ -0,0 +1,2 @@ +JOYSTICK_ENABLE = yes +DEBOUNCE_TYPE = sym_eager_pk diff --git a/keyboards/synthlabs/solo/keymaps/via/keymap.c b/keyboards/synthlabs/solo/keymaps/via/keymap.c new file mode 100644 index 0000000000..7949c61375 --- /dev/null +++ b/keyboards/synthlabs/solo/keymaps/via/keymap.c @@ -0,0 +1,74 @@ +// Copyright 2022 Aaron Hong (@hongaaronc) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_all( + KC_J, KC_U, KC_K, KC_I, KC_L, KC_O, KC_SCLN, + KC_VOLD, KC_MUTE, KC_VOLU, + KC_J, KC_U, KC_K, KC_I, KC_L, KC_O, KC_SCLN + ), + [1] = LAYOUT_all( + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______ + ), + [2] = LAYOUT_all( + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______ + ), + [3] = LAYOUT_all( + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______ + ) +}; + +#if defined(VIA_ENABLE) && defined(ENCODER_ENABLE) + +#ifdef ENCODERS +static uint8_t encoder_state[] = {0}; +static keypos_t encoder_cw[] = ENCODERS_CW_KEY; +static keypos_t encoder_ccw[] = ENCODERS_CCW_KEY; +#endif + +void encoder_action_unregister(void) { +#ifdef ENCODERS + for (int index = 0; index < ENCODERS; ++index) { + if (encoder_state[index]) { + keyevent_t encoder_event = (keyevent_t) { + .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], + .pressed = false, + .time = (timer_read() | 1) + }; + encoder_state[index] = 0; + action_exec(encoder_event); + } + } +#endif +} + +void encoder_action_register(uint8_t index, bool clockwise) { +#ifdef ENCODERS + keyevent_t encoder_event = (keyevent_t) { + .key = clockwise ? encoder_cw[index] : encoder_ccw[index], + .pressed = true, + .time = (timer_read() | 1) + }; + encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); + action_exec(encoder_event); +#endif +} + +void matrix_scan_user(void) { + encoder_action_unregister(); +} + +bool encoder_update_user(uint8_t index, bool clockwise) { + encoder_action_register(index, clockwise); + return false; +} + +#endif diff --git a/keyboards/synthlabs/solo/keymaps/via/rules.mk b/keyboards/synthlabs/solo/keymaps/via/rules.mk new file mode 100644 index 0000000000..1e5b99807c --- /dev/null +++ b/keyboards/synthlabs/solo/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/synthlabs/solo/readme.md b/keyboards/synthlabs/solo/readme.md new file mode 100644 index 0000000000..204bc3857f --- /dev/null +++ b/keyboards/synthlabs/solo/readme.md @@ -0,0 +1,28 @@ +# Synth Labs Solo + +![Synth Labs Solo](https://i.imgur.com/uVUtfksh.png) + +The Solo Macropad by Synth Labs. + +* Keyboard Maintainer: [Nostril](https://github.com/hongaaronc) +* Hardware Supported: Synth Labs Solo +* Hardware Availability: [https://solo.synthlabs.io/](https://solo.synthlabs.io/) + +Make example for this keyboard (after setting up your build environment): + + make synthlabs/solo:default + +Flashing example for this keyboard: + + make synthlabs/solo:default:flash + +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). + +## Bootloader + +Enter the bootloader in 3 ways: + +* **Bootmagic reset**: Hold down the key at (1,1) in the matrix (the rotary encoder button) and plug in the keyboard +* **Physical reset button**: Briefly press the button on the back of the PCB +* **Keycode in layout**: Press the key mapped to `RESET` if it is available +* diff --git a/keyboards/synthlabs/solo/rules.mk b/keyboards/synthlabs/solo/rules.mk new file mode 100644 index 0000000000..131aa72aeb --- /dev/null +++ b/keyboards/synthlabs/solo/rules.mk @@ -0,0 +1,13 @@ +# Build Options +# change yes to no to disable +# +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 = no # Commands for debug and configuration +NKRO_ENABLE = yes # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +ENCODER_ENABLE = yes diff --git a/keyboards/synthlabs/solo/solo.c b/keyboards/synthlabs/solo/solo.c new file mode 100644 index 0000000000..b557a3505c --- /dev/null +++ b/keyboards/synthlabs/solo/solo.c @@ -0,0 +1,18 @@ +// Copyright 2022 Aaron Hong (@hongaaronc) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "solo.h" + +#if !defined(VIA_ENABLE) && !defined(JOYSTICK_ENABLE) && defined(ENCODER_ENABLE) +bool encoder_update_kb(uint8_t index, bool clockwise) { + 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/synthlabs/solo/solo.h b/keyboards/synthlabs/solo/solo.h new file mode 100644 index 0000000000..c487446a49 --- /dev/null +++ b/keyboards/synthlabs/solo/solo.h @@ -0,0 +1,41 @@ +// Copyright 2022 Aaron Hong (@hongaaronc) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "quantum.h" + +#define XXX KC_NO + +// This a shortcut to help you visually see your layout. +// The first section contains all of the arguments +// The second converts the arguments into a two-dimensional array +#define LAYOUT_all( \ + k00, k01, k02, k03, k04, k05, k06, \ + k10, k11, k12, \ + k20, k21, k22, k23, k24, k25, k26 \ +) { \ + { k00, k01, k02, k03, k04, k05, k06 }, \ + { k10, k11, k12, XXX, XXX, XXX, XXX }, \ + { k20, k21, k22, k23, k24, k25, k26 } \ +} + +#define LAYOUT_left( \ + k01, k03, k05, \ + k10, k11, k12, \ + k20, k22, k24, k26 \ +) { \ + { XXX, k01, XXX, k03, XXX, k05, XXX }, \ + { k10, k11, k12, XXX, XXX, XXX, XXX }, \ + { k20, XXX, k22, XXX, k24, XXX, k26 } \ +} + +#define LAYOUT_right( \ + k25, k23, k21, \ + k10, k11, k12, \ + k06, k04, k02, k00 \ +) { \ + { k00, XXX, k02, XXX, k04, XXX, k06 }, \ + { k10, k11, k12, XXX, XXX, XXX, XXX }, \ + { XXX, k21, XXX, k23, XXX, k25, XXX } \ +} -- cgit v1.2.3