Skip to content

Commit

Permalink
[Keyboard] Add Synth Labs Solo keyboard (#16103)
Browse files Browse the repository at this point in the history
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
  • Loading branch information
3 people authored Apr 13, 2022
1 parent 8cc8649 commit e1c777a
Show file tree
Hide file tree
Showing 13 changed files with 337 additions and 0 deletions.
64 changes: 64 additions & 0 deletions keyboards/synthlabs/solo/config.h
Original file line number Diff line number Diff line change
@@ -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
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": {
"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

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

#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
1 change: 1 addition & 0 deletions keyboards/synthlabs/solo/keymaps/via/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VIA_ENABLE = yes
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/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
*
13 changes: 13 additions & 0 deletions keyboards/synthlabs/solo/rules.mk
Original file line number Diff line number Diff line change
@@ -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
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"

#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
41 changes: 41 additions & 0 deletions keyboards/synthlabs/solo/solo.h
Original file line number Diff line number Diff line change
@@ -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 } \
}

0 comments on commit e1c777a

Please sign in to comment.