Macropad 2x5

This commit is contained in:
Stanislav 2024-10-22 11:42:20 +03:00
parent 3565b16ff5
commit ef00c5b044
11 changed files with 0 additions and 486 deletions

View File

@ -1,27 +0,0 @@
/* Copyright 2024 set_st
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#define OLED_DISPLAY_128X64
#define I2C_DRIVER I2CD1
#define I2C1_SDA_PIN GP26
#define I2C1_SCL_PIN GP27
/* Double tap the side button to enter bootloader */
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP13
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U

View File

@ -1,122 +0,0 @@
/* Copyright 2024 set_st
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
#ifdef OLED_ENABLE
bool oled_task_kb(void) {
if (!oled_task_user()) {
return false;
}
// Switch on current active layer
switch (get_highest_layer(layer_state)) {
case BASE :
oled_write_ln_P("1:Base", false);
break;
case FN :
oled_write_ln_P("2:Functions", false);
break;
case MEDIA :
oled_write_ln_P("3:Media", false);
break;
case LIGHT :
oled_write_ln_P("4:Lights controll", false);
break;
}
oled_write(PSTR("Keys: "), false);
#ifdef OS_DETECTION_ENABLE
os_variant_t os = detected_host_os();
switch (os){
case OS_MACOS:
oled_write("MAC", false);
break;
case OS_LINUX:
oled_write("LIN", false);
break;
case OS_WINDOWS:
oled_write("WIN", false);
break;
default:
break;
}
oled_advance_page(true);
#endif // OS_DETECTION_ENABLE
for (int i = 0; i < MATRIX_ROWS; i++) {
for (int j = 0; j < MATRIX_COLS; j++) {
uint16_t keycode = keymaps[get_highest_layer(layer_state)][i][j];
if(keycode == KC_NO || keycode == KC_TRANSPARENT){
oled_write(" ", false);
}
else{
oled_write("(", false);
if (IS_CONSUMER_KEYCODE(keycode) || IS_SYSTEM_KEYCODE(keycode)) {
oled_write("M", false);
}
else if (IS_BASIC_KEYCODE(keycode))
{
oled_write("A", false);
}
else{
oled_write("D", false);
}
oled_write(") ", false);
}
}
oled_advance_page(true);
}
return false;
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}
switch (keycode) {
case KC_CYCLE_LAYERS:
if (!record->event.pressed) {
return false;
}
uint8_t current_layer = get_highest_layer(layer_state);
if (current_layer > LAYER_CYCLE_END || current_layer < LAYER_CYCLE_START) {
return false;
}
uint8_t next_layer = current_layer + 1;
if (next_layer >= LAYER_CYCLE_END) {
next_layer = LAYER_CYCLE_START;
}
layer_move(next_layer);
return false;
default:
oled_clear();
oled_set_cursor(0, 6);
oled_write("Keycode: ", false);
char keycode_str[6];
itoa(keycode, keycode_str, 10);
oled_write(keycode_str, false);
oled_write_ln("", false);
return true;
}
}
#endif

View File

@ -1,21 +0,0 @@
/* Copyright 2024 set_st
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#define HAL_USE_I2C TRUE
#include_next <halconf.h>

View File

@ -1,124 +0,0 @@
{
"keyboard_name": "Macropad 10",
"manufacturer": "PDAINUA",
"url": "https://pda.in.ua",
"maintainer": "set-st",
"features": {
"bootmagic": true,
"command": false,
"console": false,
"extrakey": true,
"mousekey": true,
"nkro": true,
"encoder": true,
"rgb_matrix": true,
"oled": true,
"os_detection": true
},
"usb": {
"vid": "0x20A0",
"pid": "0x42F9",
"device_version": "0.0.2"
},
"encoder": {
"rotary": [
{"pin_a": "GP11", "pin_b": "GP12"}
]
},
"rgb_matrix": {
"driver": "ws2812",
"animations": {
"alphas_mods": true,
"gradient_up_down": true,
"gradient_left_right": true,
"breathing": true,
"band_sat": true,
"band_val": true,
"band_pinwheel_sat": true,
"band_pinwheel_val": true,
"band_spiral_sat": true,
"band_spiral_val": true,
"cycle_all": true,
"cycle_left_right": true,
"cycle_up_down": true,
"rainbow_moving_chevron": true,
"cycle_out_in": true,
"cycle_out_in_dual": true,
"cycle_pinwheel": true,
"cycle_spiral": true,
"dual_beacon": true,
"rainbow_beacon": true,
"rainbow_pinwheels": true,
"flower_blooming": true,
"raindrops": true,
"jellybean_raindrops": true,
"hue_breathing": true,
"hue_pendulum": true,
"hue_wave": true,
"pixel_fractal": true,
"pixel_flow": true,
"pixel_rain": true,
"typing_heatmap": true,
"digital_rain": true,
"solid_reactive_simple": true,
"solid_reactive": true,
"solid_reactive_wide": true,
"solid_reactive_multiwide": true,
"solid_reactive_cross": true,
"solid_reactive_multicross": true,
"solid_reactive_nexus": true,
"solid_reactive_multinexus": true,
"splash": true,
"multisplash": true,
"solid_splash": true,
"solid_multisplash": true
},
"react_on_keyup": true,
"timeout": 360000,
"layout": [
{"matrix": [1, 0], "x": 1, "y": 0, "flags": 2},
{"matrix": [1, 1], "x": 1, "y": 1, "flags": 2},
{"matrix": [1, 2], "x": 1, "y": 2, "flags": 2},
{"matrix": [1, 3], "x": 1, "y": 3, "flags": 2},
{"matrix": [1, 4], "x": 1, "y": 4, "flags": 2},
{"matrix": [2, 4], "x": 2, "y": 4, "flags": 2},
{"matrix": [2, 3], "x": 2, "y": 3, "flags": 2},
{"matrix": [2, 2], "x": 2, "y": 2, "flags": 2},
{"matrix": [2, 1], "x": 2, "y": 1, "flags": 2},
{"matrix": [2, 0], "x": 2, "y": 0, "flags": 2}
]
},
"bootmagic": {
"matrix": [1, 2]
},
"ws2812": {
"pin": "GP13",
"driver": "vendor"
},
"processor": "RP2040",
"bootloader": "rp2040",
"matrix_pins": {
"direct": [
[null, null, null, "GP0", null],
["GP1", "GP2", "GP3","GP4", "GP5"],
["GP6","GP7", "GP8", "GP9", "GP10"]
]
},
"layouts": {
"LAYOUT": {
"layout": [
{"x": 3, "y": 0, "matrix": [0, 3]},
{"x": 0, "y": 1, "matrix": [1, 0]},
{"x": 1, "y": 1, "matrix": [1, 1]},
{"x": 2, "y": 1, "matrix": [1, 2]},
{"x": 3, "y": 1, "matrix": [1, 3]},
{"x": 4, "y": 1, "matrix": [1, 4]},
{"x": 0, "y": 2, "matrix": [2, 0]},
{"x": 1, "y": 2, "matrix": [2, 1]},
{"x": 2, "y": 2, "matrix": [2, 2]},
{"x": 3, "y": 2, "matrix": [2, 3]},
{"x": 4, "y": 2, "matrix": [2, 4]}
]
}
}
}

View File

@ -1,69 +0,0 @@
/* Copyright 2024 set_st
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
enum keycodes {
KC_CYCLE_LAYERS = QK_USER,
};
enum layers{
BASE,
FN,
MEDIA,
LIGHT
};
#define KC_TASK LGUI(KC_TAB)
#define KC_FLXP LGUI(KC_E)
// 1st layer on the cycle
#define LAYER_CYCLE_START 0
// Last layer on the cycle
#define LAYER_CYCLE_END 4
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[BASE] = LAYOUT(
KC_MEDIA_PLAY_PAUSE,
KC_CYCLE_LAYERS, LGUI(KC_C), LGUI(KC_V), LCTL(KC_SPC), KC_KP_5,
KC_KP_6, KC_KP_7, KC_KP_8, LCTL(KC_LEFT), LCTL(KC_RIGHT)
),
[FN] = LAYOUT(
_______,
KC_CYCLE_LAYERS, _______, _______, _______, _______,
_______, _______, _______, _______, _______
),
[MEDIA] = LAYOUT(
KC_MEDIA_PLAY_PAUSE,
KC_CYCLE_LAYERS, _______, _______, _______, _______,
KC_MEDIA_PLAY_PAUSE, _______, _______, KC_VOLD, KC_VOLU
),
[LIGHT] = LAYOUT(
_______,
KC_CYCLE_LAYERS, RGB_MOD, RGB_RMOD, _______, _______,
RGB_TOG, _______, _______, RGB_VAD, RGB_VAI
),
};
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
[BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[FN] = { ENCODER_CCW_CW(LCTL(KC_LEFT), LCTL(KC_RIGHT)) },
[MEDIA] = { ENCODER_CCW_CW(_______, _______) },
[LIGHT] = { ENCODER_CCW_CW(_______, _______) }
};
#endif

View File

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

View File

@ -1,69 +0,0 @@
/* Copyright 2024 set_st
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
enum keycodes {
KC_CYCLE_LAYERS = QK_USER,
};
enum layers{
BASE,
FN,
MEDIA,
LIGHT
};
#define KC_TASK LGUI(KC_TAB)
#define KC_FLXP LGUI(KC_E)
// 1st layer on the cycle
#define LAYER_CYCLE_START 0
// Last layer on the cycle
#define LAYER_CYCLE_END 4
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[BASE] = LAYOUT(
KC_MEDIA_PLAY_PAUSE,
KC_CYCLE_LAYERS, LGUI(KC_C), LGUI(KC_V), LCTL(KC_SPC), KC_KP_5,
KC_KP_6, KC_KP_7, KC_KP_8, LCTL(KC_LEFT), LCTL(KC_RIGHT)
),
[FN] = LAYOUT(
_______,
KC_CYCLE_LAYERS, _______, _______, _______, _______,
_______, _______, _______, _______, _______
),
[MEDIA] = LAYOUT(
KC_MEDIA_PLAY_PAUSE,
KC_CYCLE_LAYERS, _______, _______, _______, _______,
KC_MEDIA_PLAY_PAUSE, _______, _______, KC_VOLD, KC_VOLU
),
[LIGHT] = LAYOUT(
_______,
KC_CYCLE_LAYERS, RGB_MOD, RGB_RMOD, _______, _______,
RGB_TOG, _______, _______, RGB_VAD, RGB_VAI
),
};
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
[BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[FN] = { ENCODER_CCW_CW(LCTL(KC_LEFT), LCTL(KC_RIGHT)) },
[MEDIA] = { ENCODER_CCW_CW(_______, _______) },
[LIGHT] = { ENCODER_CCW_CW(_______, _______) }
};
#endif

View File

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

View File

@ -1,22 +0,0 @@
/* Copyright 2024 set_st
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include_next <mcuconf.h>
#undef RP_I2C_USE_I2C0
#define RP_I2C_USE_I2C0 TRUE

View File

@ -1,28 +0,0 @@
# MacroPad 10 RP2040
A RP2040-powered Macropad with a 2x5 layout.
Make example for this board (after setting up your build environment):
```sh
qmk compile -kb handwired/set_st/rp2040 -km via
```
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).
## Features
- Raspberry Pi RP2040 Zero or Plus.
- 2x10 Mechanical key switch sockets - accepts any Cherry MX-compatible switches. Individually tied to GPIO pins (not matrix wired)
- One NeoPixel RGB LED per switch, on north side.
- Rotary encoder, 20 detents per rotation, with push-switch on GPIO pin.
- 128x64 SH1306 Monochrome OLED i2c display.
## Bootloader
Enter the bootloader in 4 ways:
* **Bootmagic reset**: Hold down the key just below the rotary encoder push-button on power-up.
* **Physical reset button**: Press twice the button on the side while the board is connected.
* **BOOT button** Hold down the rotary encoder push-button on power-up or reset.
* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available.

View File

@ -1 +0,0 @@
# This file intentionally left blank