This commit is contained in:
spacehangover 2024-11-20 22:22:14 -08:00 committed by GitHub
commit 0f60630b12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 155 additions and 0 deletions

View File

@ -0,0 +1,5 @@
#pragma once
#define POT1_PIN GP26
#define ENCODER_DIRECTION_FLIP

View File

@ -0,0 +1,79 @@
{
"manufacturer": "spacehangover",
"keyboard_name": "SoyuzXL_Encoder",
"maintainer": "spacehangover",
"bootloader": "rp2040",
"diode_direction": "COL2ROW",
"features": {
"bootmagic": true,
"extrakey": true,
"mousekey": true,
"nkro": true,
"encoder": true,
},
"matrix_pins": {
"cols": ["GP0", "GP1", "GP2", "GP3", "GP4", "GP5", "GP6"],
"rows": ["GP7", "GP8", "GP9"]
},
"processor": "RP2040",
"url": "",
"usb": {
"device_version": "1.0.0",
"pid": "0x0007",
"vid": "0x5757"
},
"layouts": {
"LAYOUT": {
"layout": [
{"matrix": [0, 0], "x": 0, "y": 0},
{"matrix": [0, 1], "x": 1, "y": 0},
{"matrix": [0, 2], "x": 2, "y": 0},
{"matrix": [0, 3], "x": 3, "y": 0},
{"matrix": [0, 4], "x": 4, "y": 0},
{"matrix": [0, 5], "x": 5, "y": 0},
{"matrix": [0, 6], "x": 6, "y": 0},
{"matrix": [1, 0], "x": 0, "y": 1},
{"matrix": [1, 1], "x": 1, "y": 1},
{"matrix": [1, 2], "x": 2, "y": 1},
{"matrix": [1, 3], "x": 3, "y": 1},
{"matrix": [1, 4], "x": 4, "y": 1},
{"matrix": [1, 5], "x": 5, "y": 1},
{"matrix": [1, 6], "x": 6, "y": 1},
{"matrix": [2, 0], "x": 0, "y": 2},
{"matrix": [2, 1], "x": 1, "y": 2},
{"matrix": [2, 2], "x": 2, "y": 2},
{"matrix": [2, 3], "x": 3, "y": 2},
{"matrix": [2, 4], "x": 4, "y": 2},
{"matrix": [2, 5], "x": 5, "y": 2},
{"matrix": [2, 6], "x": 6, "y": 2}
]
}
},
"encoder": {
"rotary": [
{
"pin_a": "GP14",
"pin_b": "GP15",
"resolution": 4
},
{
"pin_a": "GP16",
"pin_b": "GP17",
"resolution": 4
},
{
"pin_a": "GP18",
"pin_b": "GP19",
"resolution": 4
},
{
"pin_a": "GP20",
"pin_b": "GP21",
"resolution": 4
}
]
}
}

View File

@ -0,0 +1,41 @@
// Copyright 2023 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
#include "analog.h"
#include "qmk_midi.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10,
KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17,
KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24
)
};
uint8_t divisor = 0;
void slider(void) {
static int previousPotValue = 0;
int currentPotValue = analogReadPin(POT1_PIN);
int threshold = 75;
if (abs(currentPotValue - previousPotValue) > threshold) {
midi_send_cc(&midi_device, 2, 0x0A, 0x7F - (currentPotValue >> 3));
previousPotValue = currentPotValue;
}
}
#if defined(ENCODER_MAP_ENABLE)
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
};
#endif
void housekeeping_task_user(void) {
slider();
}

View File

@ -0,0 +1,3 @@
ENCODER_MAP_ENABLE = yes
MIDI_ENABLE = yes
ANALOG_DRIVER_REQUIRED = yes

View File

@ -0,0 +1,27 @@
# soyuzxl_encoder
![soyuzxl_encoder](https://i.imgur.com/KwwORGSh.jpeg)
21 Key, 4 Encoder and 1 Slider Macro Keyboard
* Keyboard Maintainer: [spacehangover](https://github.com/spacehangover)
* Hardware Supported: RP2040 Handwired
* Hardware Availability: RP2040 Pico
Make example for this keyboard (after setting up your build environment):
make handwired/wwa/soyuzxl_encoder:default
Flashing example for this keyboard:
make handwired/wwa/soyuzxl_encoder: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 (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead
* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available