~ruther/qmk_firmware

24bf0dfb37f09d6202b245cef146fbc8b5c17dda — Kuribayashi Atsushi 2 years ago 3b89fb6
[Keyboard] Add tsubasa keyboard (#19352)

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: jack <0x6a73@protonmail.com>
A keyboards/handwired/tsubasa/config.h => keyboards/handwired/tsubasa/config.h +36 -0
@@ 0,0 1,36 @@
/*
Copyright 2021 @kuriatsu

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 MASTER_RIGHT

#define RGB_DI_PIN D2
#ifdef RGB_DI_PIN
#    define RGBLED_NUM 12
#    define RGBLIGHT_SPLIT
#    define RGBLED_SPLIT {6, 6}
#    define RGBLIGHT_HUE_STEP 8
#    define RGBLIGHT_SAT_STEP 1
#    define RGBLIGHT_VAL_STEP 1
#    define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
#    define RGBLIGHT_EFFECT_BREATHING
#    define RGBLIGHT_EFFECT_RAINBOW_MOOD
#    define RGBLIGHT_EFFECT_RAINBOW_SWIRL
#endif

#define SPLIT_WPM_ENABLE
#define SPLIT_LAYER_STATE_ENABLE

A keyboards/handwired/tsubasa/info.json => keyboards/handwired/tsubasa/info.json +94 -0
@@ 0,0 1,94 @@
{
    "keyboard_name": "tsubasa",
    "url": "https://github.com/kuriatsu/TSUBASA",
    "maintainer": "kuriatsu",
    "manufacturer": "kuriatsu",
    "usb": {
        "vid": "0xFEED",
        "pid": "0x0000",
        "device_version": "1.0.0"
    },
    "matrix_pins": {
        "cols": ["F6", "F7", "B1", "B3", "B2", "B6"],
        "rows": ["C6", "D7", "E6", "B4", "B5"]
    },
    "processor": "atmega32u4",
    "bootloader": "caterina",
    "diode_direction": "COL2ROW",
    "split": {
        "enabled": true,
        "soft_serial_pin": "D3",
        "encoder": {
            "right": {
                "rotary": [
                    {"pin_a": "F4", "pin_b": "F5"}
                ]
            }
        }
    },
    "layouts": {
        "LAYOUT": {
            "layout": [
            {"label":"!", "x":0.5, "y":0},
            {"label":"@", "x":1.5, "y":0},
            {"label":"#", "x":2.5, "y":0},
            {"label":"$", "x":3.5, "y":0},
            {"label":"%", "x":4.5, "y":0},
            {"label":"^", "x":5.5, "y":0},
            {"label":"&", "x":9.5, "y":0},
            {"label":"*", "x":10.5, "y":0},
            {"label":"(", "x":11.5, "y":0},
            {"label":")", "x":12.5, "y":0},
            {"label":"_", "x":13.5, "y":0},
            {"label":"+", "x":14.5, "y":0},
            {"label":"TAB", "x":0, "y":1},
            {"label":"Q", "x":1, "y":1},
            {"label":"W", "x":2, "y":1},
            {"label":"E", "x":3, "y":1},
            {"label":"R", "x":4, "y":1},
            {"label":"T", "x":5, "y":1},
            {"label":"Y", "x":9, "y":1},
            {"label":"U", "x":10, "y":1},
            {"label":"I", "x":11, "y":1},
            {"label":"O", "x":12, "y":1},
            {"label":"P", "x":13, "y":1},
            {"label":"{", "x":14, "y":1},
            {"label":"Caps Lock", "x":0.25, "y":2},
            {"label":"A", "x":1.25, "y":2},
            {"label":"S", "x":2.25, "y":2},
            {"label":"D", "x":3.25, "y":2},
            {"label":"F", "x":4.25, "y":2},
            {"label":"G", "x":5.25, "y":2},
            {"label":"H", "x":9.25, "y":2},
            {"label":"J", "x":10.25, "y":2},
            {"label":"K", "x":11.25, "y":2},
            {"label":"L", "x":12.25, "y":2},
            {"label":":", "x":13.25, "y":2},
            {"label":"\"", "x":14.25, "y":2},
            {"label":"}", "x":15, "y":1},
            {"label":"SHIFT", "x":0.75, "y":3},
            {"label":"Z", "x":1.75, "y":3},
            {"label":"X", "x":2.75, "y":3},
            {"label":"C", "x":3.75, "y":3},
            {"label":"V", "x":4.75, "y":3},
            {"label":"B", "x":5.75, "y":3},
            {"label":"Encoder Mode", "x":8.75, "y":3},
            {"label":"N", "x":9.75, "y":3},
            {"label":"M", "x":10.75, "y":3},
            {"label":"<", "x":11.75, "y":3},
            {"label":">", "x":12.75, "y":3},
            {"label":"?", "x":13.75, "y":3},
            {"label":"Esc", "x":2.25, "y":4},
            {"label":"Super", "x":3.25, "y":4},
            {"label":"Alt", "x":4.25, "y":4.25},
            {"label":"Space", "x":5.25, "y":4.5},
            {"label":"Shift", "x":6.25, "y":4.75},
            {"label":"BS", "x":8.25, "y":4.75},
            {"label":"Enter", "x":9.25, "y":4.5},
            {"label":"Fn", "x":10.25, "y":4.25},
            {"label":"|", "x":11.25, "y":4},
            {"label":"~", "x":12.25, "y":4}
            ]
        }
    }
}

A keyboards/handwired/tsubasa/keymaps/default/keymap.c => keyboards/handwired/tsubasa/keymaps/default/keymap.c +50 -0
@@ 0,0 1,50 @@
/* Copyright 2021 kuriatsu
 *
 * 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

// Defines names for use in layer keycodes and the keymap
enum layer_names {
    _BASE,
    _FN
};


const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    [_BASE] = LAYOUT(
         KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,                          KC_7,    KC_8,    KC_9,    KC_0, KC_MINS,  KC_EQL,
       KC_TAB,    KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,                          KC_Y,    KC_U,    KC_I,    KC_O,    KC_P, KC_LBRC, KC_RBRC,
      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,              XXXXXXX,    KC_N,    KC_M, KC_COMM,  KC_DOT, KC_SLSH,
                         KC_ESC, KC_RGUI, KC_LALT,  KC_SPC, KC_LSFT,     KC_BSPC,  KC_ENT, MO(_FN), KC_BSLS,  KC_GRV
    ),
    [_FN] = LAYOUT(
        KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,                         KC_F7,   KC_F8,   KC_F9,  KC_F10,  KC_F11,  KC_F12,
      _______, XXXXXXX, KC_BTN1, KC_MS_U, KC_BTN2, RGB_TOG,                       KC_PGUP, XXXXXXX,   KC_UP, XXXXXXX, KC_PSCR, XXXXXXX, XXXXXXX,
      _______, XXXXXXX, KC_MS_L, KC_MS_D, KC_MS_R, RGB_MOD,                       KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX,
      _______, XXXXXXX, XXXXXXX, XXXXXXX, RGB_VAI, RGB_HUI,              _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
      _______, _______, _______, _______, _______,                        KC_DEL, _______, _______, _______, _______
    )
};


#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
    [_BASE] =   { ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN) },
    [_FN]   =   { ENCODER_CCW_CW(    KC_VOLU,       KC_VOLD)}
};
#endif



A keyboards/handwired/tsubasa/keymaps/default/readme.md => keyboards/handwired/tsubasa/keymaps/default/readme.md +2 -0
@@ 0,0 1,2 @@
# The default keymap for tsubasa
![keymap](https://i.imgur.com/wIRs6Ebh.png)

A keyboards/handwired/tsubasa/keymaps/default/rules.mk => keyboards/handwired/tsubasa/keymaps/default/rules.mk +1 -0
@@ 0,0 1,1 @@
ENCODER_MAP_ENABLE = yes

A keyboards/handwired/tsubasa/readme.md => keyboards/handwired/tsubasa/readme.md +23 -0
@@ 0,0 1,23 @@
# TSUBASA

![tsubasa](https://i.imgur.com/q5JlhvMh.jpeg)

Hotswap split row-staggerd keyboard with an OLED and a rotary encoder

* Keyboard Maintainer: [kuriatsu](https://github.com/kuriatsu)
* Hardware Supported: ProMicro
* Hardware Availability and Build Guide: [Repository](https://github.com/kuriatsu/TSUBASA)

Make example for this keyboard (after setting up your build environment):

    make handwired/tsubasa:default

Flashing example for this keyboard:

    make handwired/tsubasa: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

**Physical reset**: Ground Reset of ProMicro

A keyboards/handwired/tsubasa/rules.mk => keyboards/handwired/tsubasa/rules.mk +19 -0
@@ 0,0 1,19 @@
# Build Options
#   change yes to no to disable
#
BOOTMAGIC_ENABLE = yes      # Enable Bootmagic Lite
MOUSEKEY_ENABLE = yes       # Mouse keys
EXTRAKEY_ENABLE = yes       # Audio control and System control
CONSOLE_ENABLE = no         # Console for debug
COMMAND_ENABLE = no         # Commands for debug and configuration
NKRO_ENABLE = yes           # Enable N-Key Rollover
BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = yes        # Enable keyboard RGB underglow
AUDIO_ENABLE = no           # Audio output
LTO_ENABLE = yes

ENCODER_ENABLE = yes

OLED_ENABLE = yes
OLED_DRIVER = SSD1306
WPM_ENABLE = yes

A keyboards/handwired/tsubasa/tsubasa.c => keyboards/handwired/tsubasa/tsubasa.c +51 -0
@@ 0,0 1,51 @@
/* Copyright 2021 @kuriatsu
 *
 * 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 "tsubasa.h"

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
    if (!encoder_update_user(index, clockwise)) { return false; }
    if (index == 0) {
        if (clockwise) {
            tap_code_delay(KC_VOLU, 10);
        } else {
            tap_code_delay(KC_VOLD, 10);
        }
    }
    return true;
}
#endif

#ifdef OLED_ENABLE
static void render_scrl(void) {
    static const char PROGMEM raw_scrl[] = {
        128,192,192,224, 96, 48, 48, 48, 48, 48, 48, 48,240,240,240,240,240,112,112, 56, 56, 56, 56, 24, 28, 28, 28,124,248,248,240, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,192,192,224,112, 56, 56, 56, 56,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
        7, 15, 28, 24, 24, 24, 12, 12,  0,  0,192,254,255,255,255, 15, 32, 32, 48, 48, 16, 24, 24,  8, 12,140,156,254,255, 51,129,192,192,224,224,224,224,224,192,192,192,224,224,224,  0,  0,  0,  0,192,192,224, 96,  0,  0,  0,240,254,255,255,135,192,224,224,224,224,224,128,  0,  0,128,128,192,224, 96, 96,224,224,224,224,224, 96,  0,  0,  0,128,192,192,224,224,224,224,224, 64,  0,128,128,192,224, 96,224,224,224,224,224,224, 96,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
        0,  0,  0,  0,  0,  0,  0,128,192,252,255,255,127, 15,  1, 16, 24,  8, 12, 12, 12,132,134,198,238,127, 59,131,  0, 30, 63, 63,124,248,240,240,  3,  1,193,253,255,127,  7,  0,  0,128,240,254,255, 63,  7,  0,128,224,254,255,127,  7,  1,  0,  0,192,252,255,127, 63,251,252,255,127,  7,  1,  0,128,192,252,255,255, 31,  1,128,192,192, 30, 63, 63,124,248,240,240,193,224,252,255,255,  7,  1,  0,128,192,252,255,255, 31,  1,128,128,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
        96,112,112, 48, 56, 28, 14, 15,  3,  3,  5,  4,  4,  6,  6,  2,  2,  2,  3,  3,  1,  1,  1,  1,  7,  7, 15, 31, 31, 12, 12, 12,  6,  7,  3,  1,  0,  0, 31, 31, 15, 14,  6,  7,  3, 15, 31, 15, 15,  7,  7,  3, 63, 31, 31, 31, 30, 14, 14,  6,  7,  3,  3,  1,  0,  0, 15, 31, 31, 15,  6,  6,  3, 11, 31, 15, 15,  7,  7,  7, 15, 31, 31, 12, 12, 12,  6,  7,  3,  1,  0, 15, 31, 31, 15,  6,  6,  3, 11, 31, 15, 15,  7,  7,  3,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
    };
    oled_write_raw_P(raw_scrl, sizeof(raw_scrl));
}
bool oled_task_kb(void) {
    if (!oled_task_user()) { return false; }
    render_scrl();
    oled_set_cursor(14, 0);
    oled_write_P(PSTR("WPM:"), false);
    oled_write(get_u8_str(get_current_wpm(), ' '), false);
    return false;
}
#endif

A keyboards/handwired/tsubasa/tsubasa.h => keyboards/handwired/tsubasa/tsubasa.h +47 -0
@@ 0,0 1,47 @@
/* Copyright 2021 @kuriatsu
 *
 * 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 "quantum.h"

/* This is a shortcut to help you visually see your layout.
 *
 * The first section contains all of the arguments representing the physical
 * layout of the board and position of the keys.
 *
 * The second converts the arguments into a two-dimensional array which
 * represents the switch matrix.
 */
#define LAYOUT( \
    L00, L01, L02, L03, L04, L05,            R00, R01, R02, R03, R04, R05, \
  L10, L11, L12, L13, L14, L15,            R10, R11, R12, R13, R14, R15, R35, \
   L20, L21, L22, L23, L24, L25,            R20, R21, R22, R23, R24, R25, \
     L30, L31, L32, L33, L34, L35,       R40, R30, R31, R32, R33, R34, \
      L40, L41, L42, L43, L44,            R41, R42, R43, R44, R45 \
) { \
  { L00, L01, L02, L03, L04, L05 }, \
  { L10, L11, L12, L13, L14, L15 }, \
  { L20, L21, L22, L23, L24, L25 }, \
  { L30, L31, L32, L33, L34, L35 }, \
  { L40, L41, L42, L43, L44, KC_NO }, \
  { R00, R01, R02, R03, R04, R05 }, \
  { R10, R11, R12, R13, R14, R15 }, \
  { R20, R21, R22, R23, R24, R25 }, \
  { R30, R31, R32, R33, R34, R35 }, \
  { R40, R41, R42, R43, R44, R45 } \
}