From cfe8c4dee3599335ec21117b1eb16839934878cd Mon Sep 17 00:00:00 2001 From: Steven Karrmann Date: Sun, 11 Feb 2024 20:26:22 -0500 Subject: [PATCH] Add Sha keyboard (#22664) * Implement Sha keyboard with default layout * Adjust readme and info.json per PR checklist * Fix RGB Light description in default keymap readme * Update keyboards/sha/rules.mk Move configuration to info.json Co-authored-by: Joel Challis * Update keyboards/sha/info.json Move configuration to info.json Co-authored-by: Joel Challis * Update keyboards/sha/info.json Move configuration to info.json Co-authored-by: Joel Challis * Update keyboards/sha/info.json Define RGB animations in info.json Co-authored-by: Joel Challis * Enable RGB Lighting Layers at keymap level, not keyboard level --------- Co-authored-by: Joel Challis --- keyboards/sha/config.h | 6 ++ keyboards/sha/info.json | 107 ++++++++++++++++++++++++ keyboards/sha/keymaps/default/config.h | 6 ++ keyboards/sha/keymaps/default/keymap.c | 90 ++++++++++++++++++++ keyboards/sha/keymaps/default/readme.md | 13 +++ keyboards/sha/readme.md | 27 ++++++ keyboards/sha/rules.mk | 1 + 7 files changed, 250 insertions(+) create mode 100644 keyboards/sha/config.h create mode 100644 keyboards/sha/info.json create mode 100644 keyboards/sha/keymaps/default/config.h create mode 100644 keyboards/sha/keymaps/default/keymap.c create mode 100644 keyboards/sha/keymaps/default/readme.md create mode 100644 keyboards/sha/readme.md create mode 100644 keyboards/sha/rules.mk diff --git a/keyboards/sha/config.h b/keyboards/sha/config.h new file mode 100644 index 00000000000..f936d7b4737 --- /dev/null +++ b/keyboards/sha/config.h @@ -0,0 +1,6 @@ +// Copyright 2023 Steven Karrmann (@skarrmann) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define WS2812_BYTE_ORDER WS2812_BYTE_ORDER_RGB \ No newline at end of file diff --git a/keyboards/sha/info.json b/keyboards/sha/info.json new file mode 100644 index 00000000000..8bb4091843a --- /dev/null +++ b/keyboards/sha/info.json @@ -0,0 +1,107 @@ +{ + "manufacturer": "Steven Karrmann", + "keyboard_name": "Sha", + "maintainer": "skarrmann", + "bootloader": "rp2040", + "diode_direction": "COL2ROW", + "features": { + "bootmagic": true, + "command": false, + "console": false, + "extrakey": true, + "mousekey": true, + "nkro": true, + "rgblight": true + }, + "matrix_pins": { + "cols": ["GP8", "GP9", "GP10", "GP11", "GP12", "GP13", "GP14"], + "rows": ["GP28", "GP4", "GP27", "GP5", "GP26", "GP6", "GP15", "GP7"] + }, + "processor": "RP2040", + "rgblight": { + "animations": { + "breathing": true, + "rainbow_mood": true, + "rainbow_swirl": true, + "snake": true, + "knight": true, + "christmas": true, + "static_gradient": true, + "rgb_test": true, + "alternating": true, + "twinkle": true + }, + "default": { + "val": 0 + }, + "led_count": 25, + "max_brightness": 24, + "sleep": true + }, + "url": "https://github.com/skarrmann/sha", + "usb": { + "device_version": "1.0.0", + "pid": "0x0000", + "vid": "0xFEED" + }, + "ws2812": { + "driver": "vendor", + "pin": "GP16" + }, + "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": [1, 1], "x": 8, "y": 0}, + {"matrix": [1, 2], "x": 9, "y": 0}, + {"matrix": [1, 3], "x": 10, "y": 0}, + {"matrix": [1, 4], "x": 11, "y": 0}, + {"matrix": [1, 5], "x": 12, "y": 0}, + {"matrix": [1, 6], "x": 13, "y": 0}, + {"matrix": [2, 0], "x": 0, "y": 1}, + {"matrix": [2, 1], "x": 1, "y": 1}, + {"matrix": [2, 2], "x": 2, "y": 1}, + {"matrix": [2, 3], "x": 3, "y": 1}, + {"matrix": [2, 4], "x": 4, "y": 1}, + {"matrix": [2, 5], "x": 5, "y": 1}, + {"matrix": [3, 1], "x": 8, "y": 1}, + {"matrix": [3, 2], "x": 9, "y": 1}, + {"matrix": [3, 3], "x": 10, "y": 1}, + {"matrix": [3, 4], "x": 11, "y": 1}, + {"matrix": [3, 5], "x": 12, "y": 1}, + {"matrix": [3, 6], "x": 13, "y": 1}, + {"matrix": [4, 0], "x": 0, "y": 2}, + {"matrix": [4, 1], "x": 1, "y": 2}, + {"matrix": [4, 2], "x": 2, "y": 2}, + {"matrix": [4, 3], "x": 3, "y": 2}, + {"matrix": [4, 4], "x": 4, "y": 2}, + {"matrix": [4, 5], "x": 5, "y": 2}, + {"matrix": [5, 1], "x": 8, "y": 2}, + {"matrix": [5, 2], "x": 9, "y": 2}, + {"matrix": [5, 3], "x": 10, "y": 2}, + {"matrix": [5, 4], "x": 11, "y": 2}, + {"matrix": [5, 5], "x": 12, "y": 2}, + {"matrix": [5, 6], "x": 13, "y": 2}, + {"matrix": [6, 0], "x": 0, "y": 3}, + {"matrix": [6, 1], "x": 1, "y": 3}, + {"matrix": [6, 2], "x": 2, "y": 3}, + {"matrix": [6, 3], "x": 3, "y": 3}, + {"matrix": [6, 4], "x": 4, "y": 3}, + {"matrix": [6, 5], "x": 5, "y": 3}, + {"matrix": [6, 6], "x": 6, "y": 3}, + {"matrix": [7, 0], "x": 7, "y": 3}, + {"matrix": [7, 1], "x": 8, "y": 3}, + {"matrix": [7, 2], "x": 9, "y": 3}, + {"matrix": [7, 3], "x": 10, "y": 3}, + {"matrix": [7, 4], "x": 11, "y": 3}, + {"matrix": [7, 5], "x": 12, "y": 3}, + {"matrix": [7, 6], "x": 13, "y": 3} + ] + } + } +} \ No newline at end of file diff --git a/keyboards/sha/keymaps/default/config.h b/keyboards/sha/keymaps/default/config.h new file mode 100644 index 00000000000..12d21f94ccc --- /dev/null +++ b/keyboards/sha/keymaps/default/config.h @@ -0,0 +1,6 @@ +// Copyright 2023 Steven Karrmann (@skarrmann) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define RGBLIGHT_LAYERS \ No newline at end of file diff --git a/keyboards/sha/keymaps/default/keymap.c b/keyboards/sha/keymaps/default/keymap.c new file mode 100644 index 00000000000..f3a2bbf3659 --- /dev/null +++ b/keyboards/sha/keymaps/default/keymap.c @@ -0,0 +1,90 @@ +// Copyright 2023 Steven Karrmann +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +enum layer_names { + _QWERTY, + _COLEMAK, + _SYMBOL, + _FUNCTION +}; + +#define SYM_TAB LT(_SYMBOL, KC_TAB) +#define FUN_SPC LT(_FUNCTION, KC_SPC) +#define QWERTY DF(_QWERTY) +#define COLEMAK DF(_COLEMAK) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT( + KC_GRV , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P , KC_MINS, + KC_EQL , 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_LCTL, KC_LALT, KC_LGUI, KC_APP , KC_DEL , SYM_TAB, KC_ESC , KC_ENT , FUN_SPC, KC_BSPC, KC_APP , KC_RGUI, KC_RALT, KC_RCTL + ), + [_COLEMAK] = LAYOUT( + KC_GRV , KC_Q , KC_W , KC_F , KC_P , KC_G , KC_J , KC_L , KC_U , KC_Y , KC_SCLN, KC_MINS, + KC_EQL , KC_A , KC_R , KC_S , KC_T , KC_D , KC_H , KC_N , KC_E , KC_I , KC_O , KC_QUOT, + KC_LSFT, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_K , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_RSFT, + KC_LCTL, KC_LALT, KC_LGUI, KC_APP , KC_DEL , SYM_TAB, KC_ESC , KC_ENT , FUN_SPC, KC_BSPC, KC_APP , KC_RGUI, KC_RALT, KC_RCTL + ), + [_SYMBOL] = LAYOUT( + KC_TILD, KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_UNDS, + KC_PLUS, KC_EXLM, KC_LPRN, KC_RPRN, KC_DLR , KC_AMPR, KC_PIPE, KC_HASH, KC_LCBR, KC_RCBR, KC_COLN, KC_DQUO, + _______, KC_AT , KC_LBRC, KC_RBRC, KC_BSLS, KC_PERC, KC_CIRC, KC_ASTR, KC_LABK, KC_RABK, KC_QUES, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + [_FUNCTION] = LAYOUT( + QK_BOOT, KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_PSCR, KC_SCRL, KC_HOME, KC_PGDN, KC_PGUP, KC_END , QWERTY , + _______, KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_INS , KC_CAPS, KC_LEFT, KC_DOWN, KC_UP , KC_RGHT, COLEMAK, + _______, KC_F9 , KC_F10 , KC_F11 , KC_F12 , RGB_TOG, KC_NUM , KC_MUTE, KC_VOLD, KC_VOLU, KC_PAUS, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ) +}; + +const rgblight_segment_t PROGMEM rgb_scroll_lock[] = RGBLIGHT_LAYER_SEGMENTS( + {6, 3, HSV_BLUE} +); +const rgblight_segment_t PROGMEM rgb_caps_lock[] = RGBLIGHT_LAYER_SEGMENTS( + {11, 3, HSV_GREEN} +); +const rgblight_segment_t PROGMEM rgb_num_lock[] = RGBLIGHT_LAYER_SEGMENTS( + {16, 3, HSV_RED} +); +const rgblight_segment_t PROGMEM rgb_qwerty[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 6, HSV_YELLOW}, + {9, 2, HSV_YELLOW}, + {14, 2, HSV_YELLOW}, + {19, 6, HSV_YELLOW} +); +const rgblight_segment_t PROGMEM rgb_colemak[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 6, HSV_CYAN}, + {9, 2, HSV_CYAN}, + {14, 2, HSV_CYAN}, + {19, 6, HSV_CYAN} +); + +const rgblight_segment_t* const PROGMEM rgb_layers[] = RGBLIGHT_LAYERS_LIST( + rgb_scroll_lock, + rgb_caps_lock, + rgb_num_lock, + rgb_qwerty, + rgb_colemak +); + +void keyboard_post_init_user(void) { + rgblight_layers = rgb_layers; +} + +bool led_update_user(led_t led_state) { + rgblight_set_layer_state(0, led_state.scroll_lock); + rgblight_set_layer_state(1, led_state.caps_lock); + rgblight_set_layer_state(2, led_state.num_lock); + return true; +} + +layer_state_t default_layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(3, layer_state_cmp(state, _QWERTY)); + rgblight_set_layer_state(4, layer_state_cmp(state, _COLEMAK)); + return state; +} \ No newline at end of file diff --git a/keyboards/sha/keymaps/default/readme.md b/keyboards/sha/keymaps/default/readme.md new file mode 100644 index 00000000000..0ff118c21a2 --- /dev/null +++ b/keyboards/sha/keymaps/default/readme.md @@ -0,0 +1,13 @@ +# Sha Default Keymap + +The default keymap uses a QWERTY base layout, with a secondary Colemak base layout. Both layouts have symbol placement adjustments on the outer columns, and editing keys and layers on the thumb keys. + +There are two extended layers: + +* SYMBOL: For typing additional symbols. Activated by layer-tap on the main left thumb key. +* FUNCTION: For function and navigation keys. Activated by layer-tap on the main right thumb key. + +When using a Waveshare RP2040-Matrix, the [RGB Light - Lighting Layers](https://docs.qmk.fm/#/feature_rgblight?id=lighting-layers) feature is used to demonstrate how the 5x5 RGB LEDs can indicate keyboard state. The indicators are: + +* Base layer on the outer LED ring: QWERTY = yellow, Colemak = cyan +* Lock status indicators using the center 3x3 LEDs: Scroll lock = blue, Caps lock = green, Num lock = red \ No newline at end of file diff --git a/keyboards/sha/readme.md b/keyboards/sha/readme.md new file mode 100644 index 00000000000..ac1b1d970c7 --- /dev/null +++ b/keyboards/sha/readme.md @@ -0,0 +1,27 @@ +# Sha + +![Sha](https://i.imgur.com/4yuQwRXh.jpg) + +Sha is a 50 key ortholinear keyboard, powered by a Waveshare RP2040-Zero or Waveshare RP2040-Matrix. + +* Keyboard Maintainer: [Steven Karrmann](https://github.com/skarrmann) +* Hardware Supported: Sha PCBs with either RP2040-Zero or RP2040-Matrix +* Hardware Availability: [Sha GitHub repository](https://github.com/skarrmann/sha) + +Make example for this keyboard (after setting up your build environment): + + make sha:default + +Flashing example for this keyboard: + + make sha: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 (the top left key) and plug in the keyboard. +* **Physical reset button**: Doublet-tap the EN/RESET button on the MCU board. +* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available. diff --git a/keyboards/sha/rules.mk b/keyboards/sha/rules.mk new file mode 100644 index 00000000000..7ff128fa692 --- /dev/null +++ b/keyboards/sha/rules.mk @@ -0,0 +1 @@ +# This file intentionally left blank \ No newline at end of file