diff --git a/keyboards/handwired/erikpeyronson/erkbd/config.h b/keyboards/handwired/erikpeyronson/erkbd/config.h new file mode 100644 index 00000000000..acbafbfaa72 --- /dev/null +++ b/keyboards/handwired/erikpeyronson/erkbd/config.h @@ -0,0 +1,13 @@ +// Copyright 2025 Erik Peyronson @erikpeyronson +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U + +#define I2C_DRIVER I2CD1 +#define OLED_IC OLED_IC_SH1106 +#define OLED_COLUMN_OFFSET 2 + +#define OLED_DISPLAY_128X64 diff --git a/keyboards/handwired/erikpeyronson/erkbd/erkbd.c b/keyboards/handwired/erikpeyronson/erkbd/erkbd.c new file mode 100644 index 00000000000..af236df93c0 --- /dev/null +++ b/keyboards/handwired/erikpeyronson/erkbd/erkbd.c @@ -0,0 +1,63 @@ +// Copyright 2025 Erik Peyronson @erikpeyronson +// SPDX-License-Identifier: GPL-3.0-or-later +#include QMK_KEYBOARD_H + +static void oled_render_logo(void) { + // clang-format off + static const char PROGMEM qmk_logo[] = { + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, + 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, + 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0x00 + }; + // clang-format on + + oled_write_P(qmk_logo, false); +} + +static void render_layer(void) { + oled_write_P(PSTR("Layer: "), false); + oled_write_ln(get_u8_str(get_highest_layer(layer_state), ' '), false); +} + +static void render_locks(void) { + led_t led_config = host_keyboard_led_state(); + oled_write_P(PSTR("Caps "), led_config.caps_lock); + oled_write_P(PSTR("Scrl "), led_config.scroll_lock); + oled_write_P(PSTR("Num "), led_config.num_lock); +#ifdef CAPS_WORD_ENABLE + oled_write_P(PSTR("Word "), is_caps_word_on()); +#endif + oled_advance_page(true); +} + +static void render_mods(void) { + uint8_t mod_state = get_mods(); + oled_write_P("Ctrl ", mod_state & MOD_MASK_CTRL); + oled_write_P("Shift ", mod_state & MOD_MASK_SHIFT); + oled_write_P("Alt ", mod_state & MOD_MASK_ALT); + oled_write_P("Gui", mod_state & MOD_MASK_GUI); + oled_advance_page(true); +} + +static void render_delimeter(void) { + oled_write_ln_P(PSTR("------------------"), false); +} + +bool oled_task_kb(void) { + if (!oled_task_user()) { + return false; + } + if (is_keyboard_left()) { + oled_render_logo(); + } else { + render_delimeter(); + render_locks(); + render_delimeter(); + render_mods(); + render_delimeter(); + render_layer(); + render_delimeter(); + } + + return false; +} diff --git a/keyboards/handwired/erikpeyronson/erkbd/keyboard.json b/keyboards/handwired/erikpeyronson/erkbd/keyboard.json new file mode 100644 index 00000000000..d3ef5147f43 --- /dev/null +++ b/keyboards/handwired/erikpeyronson/erkbd/keyboard.json @@ -0,0 +1,107 @@ +{ + "manufacturer": "Erik Peyronson", + "keyboard_name": "erkbd", + "maintainer": "erikpeyronson", + "bootloader": "rp2040", + "bootloader_instructions": "Double tap the reset button on the controller board if accessable. If not hold down bootmagic key while powering on. Left side: row 0 column 0. (The tab key on regular keyboard). Right side: row 5 column 4 (the Backspace key on regular keyboard)", + "diode_direction": "COL2ROW", + "encoder": { + "rotary": [ + {"pin_a": "GP7", "pin_b": "GP8"} + ] + }, + "features": { + "bootmagic": true, + "encoder": true, + "oled": true + }, + "matrix_pins": { + "cols": ["GP8", "GP9", "GP10", "GP11", "GP12", "GP13"], + "rows": ["GP4", "GP5", "GP6", "GP7"] + }, + "processor": "RP2040", + "split": { + "bootmagic": { + "matrix": [4, 5] + }, + "enabled": true, + "encoder": { + "right": { + "rotary": [ + {"pin_a": "GP7", "pin_b": "GP8"} + ] + } + }, + "handedness": { + "pin": "GP1" + }, + "matrix_pins": { + "right": { + "cols": ["GP9", "GP10", "GP11", "GP12", "GP13", "GP14"], + "rows": ["GP28", "GP27", "GP26", "GP15"] + } + }, + "serial": { + "driver": "vendor", + "pin": "GP0" + } + }, + "url": "https://github.com/erikpeyronson/erkbd", + "usb": { + "device_version": "1.0.0", + "pid": "0x1234", + "vid": "0xFEED" + }, + "layouts": { + "LAYOUT_split_3x6_5": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0.4}, + {"matrix": [0, 1], "x": 1, "y": 0.3}, + {"matrix": [0, 2], "x": 2, "y": 0.1}, + {"matrix": [0, 3], "x": 3, "y": 0}, + {"matrix": [0, 4], "x": 4, "y": 0.1}, + {"matrix": [0, 5], "x": 5, "y": 0.2}, + {"matrix": [4, 0], "x": 9, "y": 0.2}, + {"matrix": [4, 1], "x": 10, "y": 0.1}, + {"matrix": [4, 2], "x": 11, "y": 0}, + {"matrix": [4, 3], "x": 12, "y": 0.1}, + {"matrix": [4, 4], "x": 13, "y": 0.3}, + {"matrix": [4, 5], "x": 14, "y": 0.4}, + {"matrix": [1, 0], "x": 0, "y": 1.4}, + {"matrix": [1, 1], "x": 1, "y": 1.3}, + {"matrix": [1, 2], "x": 2, "y": 1.1}, + {"matrix": [1, 3], "x": 3, "y": 1}, + {"matrix": [1, 4], "x": 4, "y": 1.1}, + {"matrix": [1, 5], "x": 5, "y": 1.2}, + {"matrix": [5, 0], "x": 9, "y": 1.2}, + {"matrix": [5, 1], "x": 10, "y": 1.1}, + {"matrix": [5, 2], "x": 11, "y": 1}, + {"matrix": [5, 3], "x": 12, "y": 1.1}, + {"matrix": [5, 4], "x": 13, "y": 1.3}, + {"matrix": [5, 5], "x": 14, "y": 1.4}, + {"matrix": [2, 0], "x": 0, "y": 2.4}, + {"matrix": [2, 1], "x": 1, "y": 2.3}, + {"matrix": [2, 2], "x": 2, "y": 2.1}, + {"matrix": [2, 3], "x": 3, "y": 2}, + {"matrix": [2, 4], "x": 4, "y": 2.1}, + {"matrix": [2, 5], "x": 5, "y": 2.2}, + {"matrix": [6, 0], "x": 9, "y": 2.2}, + {"matrix": [6, 1], "x": 10, "y": 2.1}, + {"matrix": [6, 2], "x": 11, "y": 2}, + {"matrix": [6, 3], "x": 12, "y": 2.1}, + {"matrix": [6, 4], "x": 13, "y": 2.3}, + {"matrix": [6, 5], "x": 14, "y": 2.4}, + {"matrix": [3, 1], "x": 3, "y": 3.4}, + {"matrix": [3, 2], "x": 4, "y": 3.4}, + {"matrix": [3, 3], "x": 5, "y": 3.5}, + {"matrix": [3, 4], "x": 6, "y": 3.7}, + {"matrix": [3, 5], "x": 6, "y": 2.7}, + {"matrix": [7, 0], "x": 8, "y": 2.7}, + {"matrix": [7, 1], "x": 8, "y": 3.7}, + {"matrix": [7, 2], "x": 9, "y": 3.5}, + {"matrix": [7, 3], "x": 10, "y": 3.4}, + {"matrix": [7, 4], "x": 11, "y": 3.4} + ] + } + } +} diff --git a/keyboards/handwired/erikpeyronson/erkbd/keymaps/debug/keymap.c b/keyboards/handwired/erikpeyronson/erkbd/keymaps/debug/keymap.c new file mode 100644 index 00000000000..8884702c814 --- /dev/null +++ b/keyboards/handwired/erikpeyronson/erkbd/keymaps/debug/keymap.c @@ -0,0 +1,52 @@ +// Copyright 2025 Qmk, Erik Peyronson @erikpeyronson +// SPDX-License-Identifier: GPL-3.0-or-later + +// NOTE: This keymap is for debugging purposes to have firmware to test the matrix when building the keyboard. If you intend to build this keyboard +// you should copy this to your fork or userspace repository and create your own. + +#include QMK_KEYBOARD_H + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_split_3x6_5( + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + KC_LBRC, KC_RBRC, KC_LGUI, KC_BSPC, KC_SPC, KC_SPC, KC_ENT, KC_RALT, KC_LPRN, KC_RPRN + ) +}; +// clang-format on + +void keyboard_post_init_user(void) { +#ifdef CONSOLE_ENABLE + debug_enable = true; + debug_matrix = true; +#endif +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + // If console is enabled, it will print the matrix position and status of each key pressed +#ifdef CONSOLE_ENABLE + uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %u, time: %5u, int: %u, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count); +#endif + return true; +} + +// This function prints which half the keyboard considers itself to be which is +// useful for verify if the handedness pin and display is correctly set up when building +#ifdef OLED_ENABLE +bool oled_task_user(void) { + if (is_keyboard_left()) { + oled_write_P(PSTR("left"), false); + } else { + oled_write_P(PSTR("right"), false); + } + return false; +} +#endif + +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [0] = {ENCODER_CCW_CW(KC_UP, KC_DOWN), ENCODER_CCW_CW(KC_RIGHT, KC_LEFT)} +}; +#endif diff --git a/keyboards/handwired/erikpeyronson/erkbd/keymaps/debug/rules.mk b/keyboards/handwired/erikpeyronson/erkbd/keymaps/debug/rules.mk new file mode 100644 index 00000000000..14094ea22cd --- /dev/null +++ b/keyboards/handwired/erikpeyronson/erkbd/keymaps/debug/rules.mk @@ -0,0 +1,2 @@ +ENCODER_MAP_ENABLE = yes +CONSOLE_ENABLE = yes diff --git a/keyboards/handwired/erikpeyronson/erkbd/keymaps/default/keymap.json b/keyboards/handwired/erikpeyronson/erkbd/keymaps/default/keymap.json new file mode 100644 index 00000000000..0b733d9fb64 --- /dev/null +++ b/keyboards/handwired/erikpeyronson/erkbd/keymaps/default/keymap.json @@ -0,0 +1,24 @@ +{ + "keyboard": "handwired/erikpeyronson/erkbd", + "keymap": "default", + "layout": "LAYOUT_split_3x6_5", + "layers": [ + [ + "KC_TAB", "KC_Q", "KC_W", "KC_E", "KC_R", "KC_T", "KC_Y", "KC_U", "KC_I", "KC_O", "KC_P", "KC_BSPC", + "KC_LCTL", "KC_A", "KC_S", "KC_D", "KC_F", "KC_G", "KC_H", "KC_J", "KC_K", "KC_L", "KC_SCLN", "KC_QUOT", + "KC_LSFT", "KC_Z", "KC_X", "KC_C", "KC_V", "KC_B", "KC_N", "KC_M", "KC_COMM", "KC_DOT", "KC_SLSH", "KC_RSFT", + "KC_LBRC", "KC_RBRC", "KC_LGUI", "KC_BSPC", "KC_SPC", "KC_SPC", "KC_ENT", "KC_RALT", "KC_LPRN", "KC_RPRN" + ] + ], + "config": { + "features": { + "encoder_map": true + } + }, + "encoders": [ + [ + { "ccw": "KC_UP", "cw": "KC_DOWN" }, + { "ccw": "KC_RIGHT", "cw": "KC_LEFT" } + ] + ] +} diff --git a/keyboards/handwired/erikpeyronson/erkbd/readme.md b/keyboards/handwired/erikpeyronson/erkbd/readme.md new file mode 100644 index 00000000000..3f4fe0175e1 --- /dev/null +++ b/keyboards/handwired/erikpeyronson/erkbd/readme.md @@ -0,0 +1,28 @@ +# handwired/erikpeyronson/erkbd + +![Erkbd](https://i.imgur.com/VViiXIN.jpeg) + +3D printed, handwired 44 key split keyboard featuring two encoders, two 1.3" 128x64 oled displays using the waveshare rp2040zero development board. + +* Keyboard Maintainer: [Erik Peyronson](https://github.com/erikpeyronson) +* Hardware Supported: See keyboard repository on [github](https://github.com/erikpeyronson/erkbd) +* Hardware Availability: See keyboard repository on [github](https://github.com/erikpeyronson/erkbd) + +Make example for this keyboard (after setting up your build environment): + + make handwired/erikpeyronson/erkbd:default + +Flashing example for this keyboard: + + Enter bootloader, drag and drop .uft2 file on the removable storage + +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**: For left half hold down the key at (0,0) in the matrix (correspons with the tab key) and plug in the keyboard. +For left half half the key is (4,5) (corresponds with the backspace key) +* **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 +Enter the bootloader in 3 ways: