diff --git a/keyboards/keebit/coral/config.h b/keyboards/keebit/coral/config.h new file mode 100644 index 00000000000..fcd7ca8ed0b --- /dev/null +++ b/keyboards/keebit/coral/config.h @@ -0,0 +1,10 @@ +// Copyright 2023 numToStr (@numToStr) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 220U +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP16 + +#define WS2812_PIO_USE_PIO1 diff --git a/keyboards/keebit/coral/coral.c b/keyboards/keebit/coral/coral.c new file mode 100644 index 00000000000..2fd6569c8c9 --- /dev/null +++ b/keyboards/keebit/coral/coral.c @@ -0,0 +1,46 @@ +// Copyright 2023 QMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "quantum.h" + +#ifdef RGBLIGHT_ENABLE + +// ===== LED/RGB INDICATOR ===== +enum RGB_LAYERS { + RGBL_CAPSL = 0, + RGBL_CAPSW = 1, +}; + +const rgblight_segment_t PROGMEM capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, RGBLIGHT_LED_COUNT, HSV_BLUE} +); + +const rgblight_segment_t PROGMEM capsword_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, RGBLIGHT_LED_COUNT, HSV_WHITE} +); + +// Now define the array of layers. Later layers take precedence +const rgblight_segment_t* const PROGMEM rgb_layers[] = RGBLIGHT_LAYERS_LIST( + [RGBL_CAPSL] = capslock_layer, + [RGBL_CAPSW] = capsword_layer +); + +bool led_update_kb(led_t led_state) { + if (!led_update_user(led_state)) { + return false; + } + rgblight_set_layer_state(RGBL_CAPSL, led_state.caps_lock); + return true; +} + +__attribute__((weak)) void caps_word_set_user(bool active) { + rgblight_set_layer_state(RGBL_CAPSW, active); +} + +void keyboard_post_init_kb(void) { + // Enable the LED layers + rgblight_layers = rgb_layers; + keyboard_post_init_user(); +} + +#endif /* ifdef RGBLIGHT_ENABLE */ diff --git a/keyboards/keebit/coral/keyboard.json b/keyboards/keebit/coral/keyboard.json new file mode 100644 index 00000000000..e4689eca0bf --- /dev/null +++ b/keyboards/keebit/coral/keyboard.json @@ -0,0 +1,146 @@ +{ + "manufacturer": "keeb.it!", + "keyboard_name": "coral", + "maintainer": "numToStr", + "bootloader": "rp2040", + "build": { + "lto": true + }, + "diode_direction": "COL2ROW", + "encoder": { + "enabled": true, + "rotary": [ + {"pin_a": "GP9", "pin_b": "GP8", "resolution": 2} + ] + }, + "features": { + "bootmagic": true, + "caps_word": true, + "extrakey": true, + "mousekey": true, + "nkro": true, + "rgblight": true + }, + "matrix_pins": { + "cols": ["GP1", "GP0", "GP27", "GP26", "GP15", "GP5"], + "rows": ["GP29", "GP28", "GP14", "GP6", "GP7"] + }, + "processor": "RP2040", + "rgblight": { + "brightness_steps": 8, + "hue_steps": 8, + "layers": { + "enabled": true, + "override_rgb": true + }, + "led_count": 2, + "max_brightness": 180, + "saturation_steps": 8, + "sleep": true, + "split": true, + "split_count": [1, 1] + }, + "split": { + "enabled": true, + "encoder": { + "right": { + "rotary": [ + {"pin_a": "GP9", "pin_b": "GP8", "resolution": 2} + ] + } + }, + "matrix_pins": { + "right": { + "cols": ["GP5", "GP15", "GP26", "GP27", "GP0", "GP1"], + "rows": ["GP29", "GP28", "GP14", "GP6", "GP7"] + } + }, + "serial": { + "driver": "vendor", + "pin": "GP13" + }, + "transport": { + "protocol": "serial", + "watchdog": true + }, + "usb_detect": { + "enabled": true, + "polling_interval": 1, + "timeout": 5000 + } + }, + "url": "https://github.com/keeb-it/coral", + "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.375}, + {"matrix": [0, 1], "x": 1, "y": 0.375}, + {"matrix": [0, 2], "x": 2, "y": 0.125}, + {"matrix": [0, 3], "x": 3, "y": 0}, + {"matrix": [0, 4], "x": 4, "y": 0.125}, + {"matrix": [0, 5], "x": 5, "y": 0.25}, + {"matrix": [5, 0], "x": 10, "y": 0.25}, + {"matrix": [5, 1], "x": 11, "y": 0.125}, + {"matrix": [5, 2], "x": 12, "y": 0}, + {"matrix": [5, 3], "x": 13, "y": 0.125}, + {"matrix": [5, 4], "x": 14, "y": 0.375}, + {"matrix": [5, 5], "x": 15, "y": 0.375}, + {"matrix": [1, 0], "x": 0, "y": 1.375}, + {"matrix": [1, 1], "x": 1, "y": 1.375}, + {"matrix": [1, 2], "x": 2, "y": 1.125}, + {"matrix": [1, 3], "x": 3, "y": 1}, + {"matrix": [1, 4], "x": 4, "y": 1.125}, + {"matrix": [1, 5], "x": 5, "y": 1.25}, + {"matrix": [6, 0], "x": 10, "y": 1.25}, + {"matrix": [6, 1], "x": 11, "y": 1.125}, + {"matrix": [6, 2], "x": 12, "y": 1}, + {"matrix": [6, 3], "x": 13, "y": 1.125}, + {"matrix": [6, 4], "x": 14, "y": 1.375}, + {"matrix": [6, 5], "x": 15, "y": 1.375}, + {"matrix": [2, 0], "x": 0, "y": 2.375}, + {"matrix": [2, 1], "x": 1, "y": 2.375}, + {"matrix": [2, 2], "x": 2, "y": 2.125}, + {"matrix": [2, 3], "x": 3, "y": 2}, + {"matrix": [2, 4], "x": 4, "y": 2.125}, + {"matrix": [2, 5], "x": 5, "y": 2.25}, + {"matrix": [7, 0], "x": 10, "y": 2.25}, + {"matrix": [7, 1], "x": 11, "y": 2.125}, + {"matrix": [7, 2], "x": 12, "y": 2}, + {"matrix": [7, 3], "x": 13, "y": 2.125}, + {"matrix": [7, 4], "x": 14, "y": 2.375}, + {"matrix": [7, 5], "x": 15, "y": 2.375}, + {"matrix": [3, 0], "x": 0, "y": 3.375}, + {"matrix": [3, 1], "x": 1, "y": 3.375}, + {"matrix": [3, 2], "x": 2, "y": 3.125}, + {"matrix": [3, 3], "x": 3, "y": 3}, + {"matrix": [3, 4], "x": 4, "y": 3.125}, + {"matrix": [3, 5], "x": 5, "y": 3.25}, + {"matrix": [4, 5], "x": 6.25, "y": 2.5}, + {"matrix": [9, 0], "x": 8.75, "y": 2.5}, + {"matrix": [8, 0], "x": 10, "y": 3.25}, + {"matrix": [8, 1], "x": 11, "y": 3.125}, + {"matrix": [8, 2], "x": 12, "y": 3}, + {"matrix": [8, 3], "x": 13, "y": 3.125}, + {"matrix": [8, 4], "x": 14, "y": 3.375}, + {"matrix": [8, 5], "x": 15, "y": 3.375}, + {"matrix": [4, 1], "x": 2.375, "y": 4.125}, + {"matrix": [4, 2], "x": 3.49, "y": 4.2}, + {"matrix": [4, 3], "x": 4.6, "y": 4.35}, + {"matrix": [4, 4], "x": 5.7, "y": 4.5, "w": 1.5}, + {"matrix": [9, 1], "x": 8.8, "y": 4.5, "w": 1.5}, + {"matrix": [9, 2], "x": 10.4, "y": 4.35}, + {"matrix": [9, 3], "x": 11.51, "y": 4.2}, + {"matrix": [9, 4], "x": 12.625, "y": 4.125} + ] + } + } +} diff --git a/keyboards/keebit/coral/keymaps/default/keymap.c b/keyboards/keebit/coral/keymaps/default/keymap.c new file mode 100644 index 00000000000..eb42d97cbcc --- /dev/null +++ b/keyboards/keebit/coral/keymaps/default/keymap.c @@ -0,0 +1,85 @@ +// Copyright 2023 QMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +// Thumb Keys +#define L_THUMB LT(_LOWER, KC_ENTER) +#define R_THUMB LT(_RAISE, KC_SPACE) + +enum coral_layers { + _QWRTY, + _CLMK, + _LOWER, + _RAISE, + _ADJUST, +}; + +enum coral_keycodes { + KC_QWRTY = SAFE_RANGE, + KC_CLMK, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWRTY] = LAYOUT( + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, /**/ KC_6, KC_7, KC_8, KC_9, KC_0, KC_GRV, + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, /**/ KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + KC_TAB, 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_MNXT, /**/ KC_MPLY, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + KC_LGUI, KC_LALT, KC_LCTL, L_THUMB, /**/ R_THUMB, KC_RCTL, KC_RALT, KC_RGUI + ), + [_CLMK] = LAYOUT( + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, /**/ KC_6, KC_7, KC_8, KC_9, KC_0, KC_GRV, + KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, /**/ KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, + KC_TAB, 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_MNXT, /**/ KC_MPLY, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + KC_LGUI, KC_LALT, KC_LCTL, L_THUMB, /**/ R_THUMB, KC_RCTL, KC_RALT, KC_RGUI + ), + [_LOWER] = LAYOUT( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, /**/ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, /**/ KC_6, KC_7, KC_8, KC_9, KC_0, KC_F12, + _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, /**/ KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_PIPE, + _______, KC_EQL, KC_MINS, KC_PLUS, KC_LCBR, KC_RCBR, _______, /**/ _______, KC_LBRC, KC_RBRC, KC_SCLN, KC_COLN, KC_BSLS, _______, + _______, _______, _______, _______, /**/ _______, _______, _______, _______ + ), + [_RAISE] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, KC_INS, KC_PSCR, KC_APP, XXXXXXX, XXXXXXX, KC_PGUP, C(KC_LEFT), KC_UP, C(KC_RIGHT), C(KC_BSPC), KC_BSPC, + _______, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, KC_CAPS, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_DEL, KC_BSPC, + _______, C(KC_Z), C(KC_X), C(KC_C), C(KC_V), XXXXXXX, _______, /**/ _______, XXXXXXX, KC_HOME, XXXXXXX, KC_END, XXXXXXX, _______, + _______, _______, _______, _______, /**/ _______, _______, _______, _______ + ), + [_ADJUST] = LAYOUT( + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, /**/ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + QK_BOOT, XXXXXXX, KC_QWRTY, KC_CLMK, CG_TOGG, XXXXXXX, /**/ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, CG_TOGG, XXXXXXX, XXXXXXX, XXXXXXX, /**/ XXXXXXX, KC_VOLD, KC_MUTE, KC_VOLU, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, /**/ _______, XXXXXXX, KC_MPRV, KC_MPLY, KC_MNXT, XXXXXXX, XXXXXXX, + _______, _______, _______, _______, /**/ _______, _______, _______, _______ + ) +}; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [_QWRTY] = { ENCODER_CCW_CW(MS_WHLU, MS_WHLD), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_CLMK] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }, + [_LOWER] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }, + [_RAISE] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }, + [_ADJUST] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }, +}; +#endif + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_QWRTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWRTY); + } + return false; + case KC_CLMK: + if (record->event.pressed) { + set_single_persistent_default_layer(_CLMK); + } + return false; + } + return true; +} diff --git a/keyboards/keebit/coral/keymaps/default/rules.mk b/keyboards/keebit/coral/keymaps/default/rules.mk new file mode 100644 index 00000000000..ee325681483 --- /dev/null +++ b/keyboards/keebit/coral/keymaps/default/rules.mk @@ -0,0 +1 @@ +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/keebit/coral/readme.md b/keyboards/keebit/coral/readme.md new file mode 100644 index 00000000000..98d9ac00e6f --- /dev/null +++ b/keyboards/keebit/coral/readme.md @@ -0,0 +1,29 @@ +# Coral | Split Keyboard + +![keebit/coral](https://i.imgur.com/wPt8oUih.jpg) + +_A 58 keys (56 MX + 2 EC11) 5x6 column-staggered wired split keyboard using Waveshare RP2040-Zero inspired by corne and sofle_v1_ + +- Keyboard Maintainer: [numToStr](https://github.com/numToStr) +- Hardware Supported: _Coral PCB, Waveshare RP2040-Zero_ +- Hardware Availability: _https://discord.gg/TkazrGqKYn_ + +Make example for this keyboard (after setting up your build environment): + + make keebit/coral:default + +Flashing example for this keyboard: + + make keebit/coral: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**: + - Press and hold the `BOOT` button on the MCU while connecting the board. + - Double press the `RESET` button on the MCU when connected, if you already flashed the firmware. +- **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available