~ruther/qmk_firmware

27671d8a43bbca7b65defb94ab95102ac0334f44 — Yoichiro Tanaka 3 years ago 8c793c1
[Keyboard] Add Lunakey Pico (#18202)

Co-authored-by: Joel Challis <git@zvecr.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
A keyboards/yoichiro/lunakey_pico/config.h => keyboards/yoichiro/lunakey_pico/config.h +38 -0
@@ 0,0 1,38 @@
// Copyright 2022 Yoichiro Tanaka (@yoichiro)
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP25
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U

#define SERIAL_USART_FULL_DUPLEX
#define SERIAL_USART_TX_PIN GP0
#define SERIAL_USART_RX_PIN GP1

//#define SERIAL_DEBUG

#define WS2812_PIO_USE_PIO1

#define RGBLIGHT_LED_MAP { 0, 1, 2, 3, 4, 5, \
                           11, 10, 9, 8, 7, 6 }

/* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST

/*
 * Feature disable options
 *  These options are also useful to firmware size reduction.
 */

/* disable debug print */
//#define NO_DEBUG

/* disable print */
//#define NO_PRINT

/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT

A keyboards/yoichiro/lunakey_pico/halconf.h => keyboards/yoichiro/lunakey_pico/halconf.h +8 -0
@@ 0,0 1,8 @@
// Copyright 2022 Yoichiro Tanaka (@yoichiro)
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#define HAL_USE_SIO TRUE

#include_next <halconf.h>

A keyboards/yoichiro/lunakey_pico/info.json => keyboards/yoichiro/lunakey_pico/info.json +106 -0
@@ 0,0 1,106 @@
{
    "keyboard_name": "Lunakey Pico",
    "manufacturer": "yoichiro",
    "maintainer": "Yoichiro Tanaka",
    "bootloader": "rp2040",
    "diode_direction": "COL2ROW",
    "features": {
        "bootmagic": false,
        "mousekey": true,
        "extrakey": true,
        "console": false,
        "command": false,
        "nkro": false,
        "rgblight": true,
        "audio": false
    },
    "matrix_pins": {
        "cols": ["GP21", "GP20", "GP19", "GP18", "GP17", "GP16"],
        "rows": ["GP12", "GP13", "GP14", "GP15"]
    },
    "debounce": 5,
    "processor": "RP2040",
    "usb": {
        "device_version": "3.0.0",
        "pid": "0x0003",
        "vid": "0x5954"
    },
    "rgblight": {
        "led_count": 12,
        "pin": "GP6",
        "sleep": true,
        "split": true,
        "split_count": [6, 6],
        "animations": {
            "alternating": true,
            "breathing": true,
            "christmas": true,
            "knight": true,
            "rainbow_mood": true,
            "rainbow_swirl": true,
            "rgb_test": false,
            "snake": true,
            "static_gradient": true,
            "twinkle": true
        },
        "hue_steps": 8,
        "saturation_steps": 8,
        "brightness_steps": 8,
        "max_brightness": 255
    },
    "split": {
        "enabled": true
    },
    "layout_aliases": {
        "LAYOUT": "LAYOUT_split_3x6_4"
    },
    "layouts": {
        "LAYOUT_split_3x6_4": {
            "layout": [
                {"label":"L00", "x":0, "y":1.5},
                {"label":"L01", "x":1, "y":1.25},
                {"label":"L02", "x":2, "y":0.5},
                {"label":"L03", "x":3, "y":0},
                {"label":"L04", "x":4, "y":0.25},
                {"label":"L05", "x":5, "y":0.5},
                {"label":"R00", "x":8.75, "y":0.5},
                {"label":"R01", "x":9.75, "y":0.25},
                {"label":"R02", "x":10.75, "y":0},
                {"label":"R03", "x":11.75, "y":0.5},
                {"label":"R04", "x":12.75, "y":1.25},
                {"label":"R05", "x":13.75, "y":1.5},
                {"label":"L10", "x":0, "y":2.5},
                {"label":"L11", "x":1, "y":2.25},
                {"label":"L12", "x":2, "y":1.5},
                {"label":"L13", "x":3, "y":1},
                {"label":"L14", "x":4, "y":1.25},
                {"label":"L15", "x":5, "y":1.5},
                {"label":"R10", "x":8.75, "y":1.5},
                {"label":"R11", "x":9.75, "y":1.25},
                {"label":"R12", "x":10.75, "y":1},
                {"label":"R13", "x":11.75, "y":1.5},
                {"label":"R14", "x":12.75, "y":2.25},
                {"label":"R15", "x":13.75, "y":2.5},
                {"label":"L20", "x":0, "y":3.5},
                {"label":"L21", "x":1, "y":3.25},
                {"label":"L22", "x":2, "y":2.5},
                {"label":"L23", "x":3, "y":2},
                {"label":"L24", "x":4, "y":2.25},
                {"label":"L25", "x":5, "y":2.5},
                {"label":"R20", "x":8.75, "y":2.5},
                {"label":"R21", "x":9.75, "y":2.25},
                {"label":"R22", "x":10.75, "y":2},
                {"label":"R23", "x":11.75, "y":2.5},
                {"label":"R24", "x":12.75, "y":3.25},
                {"label":"R25", "x":13.75, "y":3.5},
                {"label":"L30", "x":3, "y":4},
                {"label":"L31", "x":4, "y":3.75},
                {"label":"L32", "x":5, "y":3.75},
                {"label":"L33", "x":6, "y":4},
                {"label":"R30", "x":7.75, "y":4},
                {"label":"R31", "x":8.75, "y":3.75},
                {"label":"R32", "x":9.75, "y":3.75},
                {"label":"R33", "x":10.75, "y":4}]
        }
    }
}

A keyboards/yoichiro/lunakey_pico/keymaps/default/keymap.c => keyboards/yoichiro/lunakey_pico/keymaps/default/keymap.c +69 -0
@@ 0,0 1,69 @@
// Copyright 2022 Yoichiro Tanaka (@yoichiro)
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H

enum layer_number {
  _QWERTY = 0,
  _LOWER,
  _RAISE,
  _ADJUST,
};

#define LOWER MO(_LOWER)
#define RAISE MO(_RAISE)

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

  [_QWERTY] = LAYOUT_split_3x6_4(
//+--------+--------+--------+--------+--------+--------+                 +--------+--------+--------+--------+--------+--------+
   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_LGUI, KC_LALT, LOWER,   KC_SPC,  KC_ENT,  RAISE,   KC_RALT, KC_RGUI
//+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
  ),

  [_LOWER] = LAYOUT_split_3x6_4(
//+--------+--------+--------+--------+--------+--------+                 +--------+--------+--------+--------+--------+--------+
   KC_ESC,  KC_1,    KC_2,    KC_3,    KC_4,    KC_5,                      KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_BSPC,
//+--------+--------+--------+--------+--------+--------+                 +--------+--------+--------+--------+--------+--------+
   KC_LCTL, _______, _______, _______, _______, _______,                   KC_LEFT, KC_DOWN, KC_UP,   KC_RIGHT,_______, _______,
//+--------+--------+--------+--------+--------+--------+                 +--------+--------+--------+--------+--------+--------+
   KC_LSFT, _______, _______, _______, _______, _______,                   _______, _______, _______, _______, _______, _______,
//+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
                              KC_LGUI, KC_LALT, LOWER,   KC_SPC,  KC_ENT,  RAISE,   KC_RALT, KC_RGUI
//+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
  ),

  [_RAISE] = LAYOUT_split_3x6_4(
//+--------+--------+--------+--------+--------+--------+                 +--------+--------+--------+--------+--------+--------+
   KC_ESC,  KC_EXLM, KC_AT,   KC_HASH, KC_DLR,  KC_PERC,                   KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,
//+--------+--------+--------+--------+--------+--------+                 +--------+--------+--------+--------+--------+--------+
   KC_LCTL, _______, _______, _______, _______, _______,                   KC_MINS, KC_EQL,  KC_LCBR, KC_RCBR, KC_PIPE, KC_GRV,
//+--------+--------+--------+--------+--------+--------+                 +--------+--------+--------+--------+--------+--------+
   KC_LSFT, KC_TILD, _______, _______, _______, _______,                   KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_BSLS, KC_TILD,
//+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
                              KC_LGUI, KC_LALT, LOWER,   KC_SPC,  KC_ENT,  RAISE,   KC_RALT, KC_RGUI
//+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
  ),

  [_ADJUST] = LAYOUT_split_3x6_4(
//+--------+--------+--------+--------+--------+--------+                 +--------+--------+--------+--------+--------+--------+
   QK_BOOT,   _______, _______, _______, _______, _______,                   KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,
//+--------+--------+--------+--------+--------+--------+                 +--------+--------+--------+--------+--------+--------+
   RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______,                   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,
//+--------+--------+--------+--------+--------+--------+                 +--------+--------+--------+--------+--------+--------+
   RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______,                   _______, _______, _______, _______, _______, _______,
//+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
                              KC_LGUI, KC_LALT, LOWER,   KC_SPC,  KC_ENT,  RAISE,   KC_RALT, KC_RGUI
//+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
  )
};

layer_state_t layer_state_set_user(layer_state_t state) {
  return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
}

A keyboards/yoichiro/lunakey_pico/keymaps/via/keymap.c => keyboards/yoichiro/lunakey_pico/keymaps/via/keymap.c +65 -0
@@ 0,0 1,65 @@
// Copyright 2022 Yoichiro Tanaka (@yoichiro)
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H

enum layer_number {
  _QWERTY = 0,
  _LOWER,
  _RAISE,
  _ADJUST,
};

#define LOWER FN_MO13
#define RAISE FN_MO23

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

  [_QWERTY] = LAYOUT_split_3x6_4(
//+--------+--------+--------+--------+--------+--------+                 +--------+--------+--------+--------+--------+--------+
   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_LGUI, KC_LALT, LOWER,   KC_SPC,  KC_ENT,  RAISE,   KC_RALT, KC_RGUI
//+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
  ),

  [_LOWER] = LAYOUT_split_3x6_4(
//+--------+--------+--------+--------+--------+--------+                 +--------+--------+--------+--------+--------+--------+
   KC_ESC,  KC_1,    KC_2,    KC_3,    KC_4,    KC_5,                      KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_BSPC,
//+--------+--------+--------+--------+--------+--------+                 +--------+--------+--------+--------+--------+--------+
   KC_LCTL, _______, _______, _______, _______, _______,                   KC_LEFT, KC_DOWN, KC_UP,   KC_RIGHT,_______, _______,
//+--------+--------+--------+--------+--------+--------+                 +--------+--------+--------+--------+--------+--------+
   KC_LSFT, _______, _______, _______, _______, _______,                   _______, _______, _______, _______, _______, _______,
//+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
                              KC_LGUI, KC_LALT, LOWER,   KC_SPC,  KC_ENT,  RAISE,   KC_RALT, KC_RGUI
//+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
  ),

  [_RAISE] = LAYOUT_split_3x6_4(
//+--------+--------+--------+--------+--------+--------+                 +--------+--------+--------+--------+--------+--------+
   KC_ESC,  KC_EXLM, KC_AT,   KC_HASH, KC_DLR,  KC_PERC,                   KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,
//+--------+--------+--------+--------+--------+--------+                 +--------+--------+--------+--------+--------+--------+
   KC_LCTL, _______, _______, _______, _______, _______,                   KC_MINS, KC_EQL,  KC_LCBR, KC_RCBR, KC_PIPE, KC_GRV,
//+--------+--------+--------+--------+--------+--------+                 +--------+--------+--------+--------+--------+--------+
   KC_LSFT, KC_TILD, _______, _______, _______, _______,                   KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_BSLS, KC_TILD,
//+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
                              KC_LGUI, KC_LALT, LOWER,   KC_SPC,  KC_ENT,  RAISE,   KC_RALT, KC_RGUI
//+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
  ),

  [_ADJUST] = LAYOUT_split_3x6_4(
//+--------+--------+--------+--------+--------+--------+                 +--------+--------+--------+--------+--------+--------+
   QK_BOOT,   _______, _______, _______, _______, _______,                   KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,
//+--------+--------+--------+--------+--------+--------+                 +--------+--------+--------+--------+--------+--------+
   RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______,                   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,
//+--------+--------+--------+--------+--------+--------+                 +--------+--------+--------+--------+--------+--------+
   RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______,                   _______, _______, _______, _______, _______, _______,
//+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
                              KC_LGUI, KC_LALT, LOWER,   KC_SPC,  KC_ENT,  RAISE,   KC_RALT, KC_RGUI
//+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+
  )
};

A keyboards/yoichiro/lunakey_pico/keymaps/via/rules.mk => keyboards/yoichiro/lunakey_pico/keymaps/via/rules.mk +1 -0
@@ 0,0 1,1 @@
VIA_ENABLE = yes

A keyboards/yoichiro/lunakey_pico/lunakey_pico.c => keyboards/yoichiro/lunakey_pico/lunakey_pico.c +4 -0
@@ 0,0 1,4 @@
// Copyright 2022 Yoichiro Tanaka (@yoichiro)
// SPDX-License-Identifier: GPL-2.0-or-later

#include "lunakey_pico.h"

A keyboards/yoichiro/lunakey_pico/lunakey_pico.h => keyboards/yoichiro/lunakey_pico/lunakey_pico.h +23 -0
@@ 0,0 1,23 @@
// Copyright 2022 Yoichiro Tanaka (@yoichiro)
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include "quantum.h"

#define LAYOUT_split_3x6_4( \
  L00, L01, L02, L03, L04, L05,           R00, R01, R02, R03, R04, R05, \
  L10, L11, L12, L13, L14, L15,           R10, R11, R12, R13, R14, R15, \
  L20, L21, L22, L23, L24, L25,           R20, R21, R22, R23, R24, R25, \
                 L30, L31, L32, L33, R30, R31, R32, R33 \
  ) \
  { \
    { L00, L01, L02, L03, L04, L05 }, \
    { L10, L11, L12, L13, L14, L15 }, \
    { L20, L21, L22, L23, L24, L25 }, \
    { KC_NO, KC_NO, L30, L31, L32, L33 }, \
    { R05, R04, R03, R02, R01, R00 }, \
    { R15, R14, R13, R12, R11, R10 }, \
    { R25, R24, R23, R22, R21, R20 }, \
    { KC_NO, KC_NO, R33, R32, R31, R30 } \
  }

A keyboards/yoichiro/lunakey_pico/mcuconf.h => keyboards/yoichiro/lunakey_pico/mcuconf.h +11 -0
@@ 0,0 1,11 @@
// Copyright 2022 Yoichiro Tanaka (@yoichiro)
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include_next <mcuconf.h>

#undef RP_SIO_USE_UART0
#define RP_SIO_USE_UART0 TRUE
#undef RP_SIO_USE_UART1
#define RP_SIO_USE_UART1 FALSE

A keyboards/yoichiro/lunakey_pico/readme.md => keyboards/yoichiro/lunakey_pico/readme.md +27 -0
@@ 0,0 1,27 @@
# Lunakey Pico

![lunakey_pico](https://i.imgur.com/S5N8AFhh.jpg)

This is a 40% split keyboard which has 3x6 vertically staggered keys and 4 thumbnail keys.

* Keyboard Maintainer: [Yoichiro Tanaka](https://github.com/yoichiro)
* Hardware Supported: Lunakey Pico PCB, Raspberry Pi Pico MCU.
* Hardware Availability: https://booth.pm/ja/items/3324672

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

    qmk compile -kb yoichiro/lunakey_pico -km default

Flashing example for this keyboard:

    qmk flash -kb yoichiro/lunakey_pico -km default -bl avrdude

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**: 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 `RESET` if it is available

A keyboards/yoichiro/lunakey_pico/rules.mk => keyboards/yoichiro/lunakey_pico/rules.mk +2 -0
@@ 0,0 1,2 @@
WS2812_DRIVER = vendor
SERIAL_DRIVER = vendor