From f4e6af2dbe8c2b0d24dfa14e58d3be02bd6b2b7d Mon Sep 17 00:00:00 2001 From: Diego Andres Rabaioli Date: Wed, 6 Nov 2024 08:46:17 +0100 Subject: [PATCH] Adding SdraKb00 keyboard (#24552) Co-authored-by: jack Co-authored-by: Duncan Sutherland --- keyboards/sdrakbs/sdrakb00/keyboard.json | 71 ++++++++++++++++++ .../sdrakbs/sdrakb00/keymaps/default/keymap.c | 74 +++++++++++++++++++ keyboards/sdrakbs/sdrakb00/readme.md | 52 +++++++++++++ 3 files changed, 197 insertions(+) create mode 100644 keyboards/sdrakbs/sdrakb00/keyboard.json create mode 100644 keyboards/sdrakbs/sdrakb00/keymaps/default/keymap.c create mode 100644 keyboards/sdrakbs/sdrakb00/readme.md diff --git a/keyboards/sdrakbs/sdrakb00/keyboard.json b/keyboards/sdrakbs/sdrakb00/keyboard.json new file mode 100644 index 0000000000..f9e24cc63f --- /dev/null +++ b/keyboards/sdrakbs/sdrakb00/keyboard.json @@ -0,0 +1,71 @@ +{ + "manufacturer": "Diego Andres Rabaioli", + "keyboard_name": "sdrakb00", + "maintainer": "drabaioli", + "bootloader": "atmel-dfu", + "diode_direction": "COL2ROW", + "encoder": { + "rotary": [ + {"pin_a": "B5", "pin_b": "B6", "resolution": 2} + ] + }, + "features": { + "bootmagic": true, + "encoder": true, + "extrakey": true, + "mousekey": true, + "nkro": true, + "rgb_matrix": true + }, + "matrix_pins": { + "cols": ["F0", "F1", "F4", "F5"], + "rows": ["D4", "D6", "D7"] + }, + "processor": "atmega32u4", + "rgb_matrix": { + "driver": "ws2812", + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0, "flags": 4}, + {"matrix": [0, 1], "x": 16, "y": 0, "flags": 4}, + {"matrix": [0, 2], "x": 32, "y": 0, "flags": 4}, + {"matrix": [1, 0], "x": 0, "y": 16, "flags": 4}, + {"matrix": [1, 1], "x": 16, "y": 16, "flags": 4}, + {"matrix": [1, 2], "x": 32, "y": 16, "flags": 4}, + {"matrix": [1, 3], "x": 48, "y": 16, "flags": 4}, + {"matrix": [2, 0], "x": 0, "y": 32, "flags": 4}, + {"matrix": [2, 1], "x": 16, "y": 32, "flags": 4}, + {"matrix": [2, 2], "x": 32, "y": 32, "flags": 4}, + {"matrix": [2, 3], "x": 48, "y": 32, "flags": 4} + ], + "max_brightness": 100, + "sleep": true, + "timeout": 300000 + }, + "url": "https://github.com/drabaioli/SdraKb00", + "usb": { + "device_version": "1.0.0", + "pid": "0x4200", + "vid": "0x7331" + }, + "ws2812": { + "pin": "B0" + }, + "layouts": { + "LAYOUT_ortho_3x4": { + "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, "encoder": 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": [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} + ] + } + } +} diff --git a/keyboards/sdrakbs/sdrakb00/keymaps/default/keymap.c b/keyboards/sdrakbs/sdrakb00/keymaps/default/keymap.c new file mode 100644 index 0000000000..c5481b1076 --- /dev/null +++ b/keyboards/sdrakbs/sdrakb00/keymaps/default/keymap.c @@ -0,0 +1,74 @@ +// Copyright 2023 QMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +/* Keymap for 3x4 Macropad + * + * Layer 0 (Base Layer) - Numpad layout with mute button and layer toggle: + * ,----------------------, + * | 7 | 8 | 9 | MUTE | + * |-------+-------+-------+--------| + * | 4 | 5 | 6 | Layer1 | + * |-------+-------+-------+--------| + * | 1 | 2 | 3 | 0 | + * `-----------------------^--------' + * + * Layer 1 (Function Layer) - Accessed by holding MO(1): + * ,----------------------, + * | BKSP | / | - | ---- | + * |-------+-------+-------+--------| + * | = | * | + | ---- | + * |-------+-------+-------+--------| + * | ENTER | ---- | ---- | . | + * `-----------------------^--------' + * + * The base layer (0) provides standard numpad functionality with: + * - Numbers 0-9 in traditional numpad layout + * - Mute button in top right + * - Layer 1 momentary toggle (MO1) in middle right + * + * The function layer (1) adds: + * - Basic mathematical operators (+, -, *, /) + * - Backspace, Enter, and decimal point + * - Equal sign for calculations + * - Empty slots marked as ---- (KC_NO) + */ +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [0] = LAYOUT_ortho_3x4( + KC_KP_7, KC_KP_8, KC_KP_9, KC_MUTE, + KC_KP_4, KC_KP_5, KC_KP_6, MO(1), + KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_0 + ), + + [1] = LAYOUT_ortho_3x4( + KC_BACKSPACE, KC_KP_SLASH, KC_KP_MINUS, _______, + KC_EQUAL, KC_KP_ASTERISK, KC_KP_PLUS, _______, + KC_ENTER, _______, _______, KC_KP_DOT + ) +}; + + +/* + * Handle layer state changes by updating RGB matrix colors + * + * Sets RGB matrix colors based on active layer: + * - Layer 0: Light green (#88FB7A) + * - Layer 1: Red + * - Other layers: Red (fallback) + */ +layer_state_t layer_state_set_user(layer_state_t state) { + switch (get_highest_layer(state)) { + case 0: + rgb_matrix_sethsv(85, 255, 251); // #88FB7A for layer 0 + break; + case 1: + rgb_matrix_sethsv(0, 255, 255); // Red for layer 1 + break; + default: + rgb_matrix_sethsv(0, 255, 255); // Red for any other layer + break; + } + return state; +} diff --git a/keyboards/sdrakbs/sdrakb00/readme.md b/keyboards/sdrakbs/sdrakb00/readme.md new file mode 100644 index 0000000000..21e56f9595 --- /dev/null +++ b/keyboards/sdrakbs/sdrakb00/readme.md @@ -0,0 +1,52 @@ +# sdrakb00 + +![sdrakb00](https://i.imgur.com/0HfpFqW.jpeg) + +11 keys hot-swap macropad with rotary encoder. + +Macropad features: +- 11 hot-swap keys +- Rotary encoder with push button +- AtMega32U4 MCU +- Per-key RGB led for backlighting +- USB-C connector +- On PCB SPI header +- MCU reset button +- Switch mounting plate +- Power LED indicator + +* Keyboard Maintainer: [Diego Andres Rabaioli](https://github.com/drabaioli) +* Hardware Supported: Pro Micro Atmega32u4 based macropad with 11 keys, RGB LED chain and rotary encoder +* Hardware Availability: [Get the gerbers and have fun building it your self ;)](https://github.com/drabaioli/SdraKb00) + +Build SdraKb00 firmware: + + make sdrakbs/sdrakb00:default + +Flashing SdraKb00 firmware, execute: + + make sdrakbs/sdrakb00:default:flash + +Then press the reset button on the back side of the PCB. + +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: + +* **Physical reset button** (preferred): Briefly press the button on the back of the PCB +* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard + +## Default Keymap + +### Base Layer (0) +- NumPad layout (1-9, 0) +- Encoder: Volume Up/Down +- Encoder Push: Mute +- Layer Switch: Hold (1,3) key for function layer + +### Function Layer (1) +- NumPad operators (+, -, *, /) +- Enter, "=" and backspace keys +- Decimal point