1
0
Fork 0

[Keyboard] Add Synth Labs Solo keyboard (#16103)

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
This commit is contained in:
Nostril 2022-04-12 22:50:38 -07:00 committed by GitHub
parent 8cc86490aa
commit e1c777a1c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 337 additions and 0 deletions

View file

@ -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
)
};

View file

@ -0,0 +1,3 @@
# Default Synth Labs Solo Layout
This keymap is intended for usage as a macropad.

View file

@ -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

View file

@ -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.

View file

@ -0,0 +1,2 @@
JOYSTICK_ENABLE = yes
DEBOUNCE_TYPE = sym_eager_pk

View file

@ -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

View file

@ -0,0 +1 @@
VIA_ENABLE = yes