Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Keyboard] Add Synth Labs Solo keyboard #16103

Merged
merged 18 commits into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions keyboards/synthlabs/solo/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// 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 USB_POLLING_INTERVAL_MS 1
#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
43 changes: 43 additions & 0 deletions keyboards/synthlabs/solo/info.json
Original file line number Diff line number Diff line change
@@ -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": {
hongaaronc marked this conversation as resolved.
Show resolved Hide resolved
"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]}
]
}
}
}
12 changes: 12 additions & 0 deletions keyboards/synthlabs/solo/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2022 Aaron Hong (@hongaaronc)
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H
hongaaronc marked this conversation as resolved.
Show resolved Hide resolved

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
)
};
3 changes: 3 additions & 0 deletions keyboards/synthlabs/solo/keymaps/default/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Default Synth Labs Solo Layout

This keymap is intended for usage as a macropad.
35 changes: 35 additions & 0 deletions keyboards/synthlabs/solo/keymaps/gamepad/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2022 Aaron Hong (@hongaaronc)
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H
hongaaronc marked this conversation as resolved.
Show resolved Hide resolved

#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
3 changes: 3 additions & 0 deletions keyboards/synthlabs/solo/keymaps/gamepad/readme.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions keyboards/synthlabs/solo/keymaps/gamepad/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
JOYSTICK_ENABLE = yes
DEBOUNCE_TYPE = sym_eager_pk
74 changes: 74 additions & 0 deletions keyboards/synthlabs/solo/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions keyboards/synthlabs/solo/keymaps/via/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VIA_ENABLE = yes
BOOTLOADER = atmel-dfu
hongaaronc marked this conversation as resolved.
Show resolved Hide resolved
28 changes: 28 additions & 0 deletions keyboards/synthlabs/solo/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Synth Labs Solo

![Synth Labs Solo](https://i.imgur.com/uVUtfks.png)
hongaaronc marked this conversation as resolved.
Show resolved Hide resolved

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/)
hongaaronc marked this conversation as resolved.
Show resolved Hide resolved

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
*
14 changes: 14 additions & 0 deletions keyboards/synthlabs/solo/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 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 # Disable keyboard backlight functionality
AUDIO_ENABLE = no # Audio output
RGBLIGHT_ENABLE = no # Disable WS2812 RGB underlight. Do not enable this with audio at the same time.
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
ENCODER_ENABLE = yes # Enable Rotary Encoder support
hongaaronc marked this conversation as resolved.
Show resolved Hide resolved
18 changes: 18 additions & 0 deletions keyboards/synthlabs/solo/solo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2022 Aaron Hong (@hongaaronc)
// SPDX-License-Identifier: GPL-2.0-or-later

#include "solo.h"
hongaaronc marked this conversation as resolved.
Show resolved Hide resolved

#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
40 changes: 40 additions & 0 deletions keyboards/synthlabs/solo/solo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright 2022 Aaron Hong (@hongaaronc)
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once
hongaaronc marked this conversation as resolved.
Show resolved Hide resolved

#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( \
K01, K02, K03, K04, K05, K06, K07, \
K08, K09, K10, \
K11, K12, K13, K14, K15, K16, K17 \
) { \
{ K01, K02, K03, K04, K05, K06, K07 }, \
{ K08, K09, K10 }, \
{ K11, K12, K13, K14, K15, K16, K17 } \
}
#define LAYOUT_left( \
K02, K04, K06, \
K08, K09, K10, \
K11, K13, K15, K17 \
) { \
{ XXX, K02, XXX, K04, XXX, K06, XXX }, \
{ K08, K09, K10 }, \
{ K11, XXX, K13, XXX, K15, XXX, K17 } \
}
#define LAYOUT_right( \
K16, K14, K12, \
K08, K09, K10, \
K07, K05, K03, K01 \
) { \
{ K01, XXX, K03, XXX, K05, XXX, K07 }, \
{ K08, K09, K10 }, \
{ XXX, K12, XXX, K14, XXX, K16, XXX } \
}
hongaaronc marked this conversation as resolved.
Show resolved Hide resolved