~ruther/qmk_firmware

1af65a22487927f667e8d193dd893a9c8d9cdf38 — Christian Sandven 3 years ago b2fcc92
[Keyboard] Add keyprez unicorn (#15998)

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Joel Challis <git@zvecr.com>
A keyboards/keyprez/unicorn/config.h => keyboards/keyprez/unicorn/config.h +148 -0
@@ 0,0 1,148 @@
// Copyright 2022 Keyprez (https://github.com/keyprez)
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include "config_common.h"

/* USB Device descriptor parameter */
#define VENDOR_ID    0x6B7A
#define PRODUCT_ID   0x7563
#define DEVICE_VER   0x0001
#define MANUFACTURER keyprez
#define PRODUCT      unicorn

/* key matrix size */
#define MATRIX_ROWS 12
#define MATRIX_COLS 8

/*
 * Keyboard Matrix Assignments
 *
 * Change this to how you wired your keyboard
 * COLS: AVR pins used for columns, left to right
 * ROWS: AVR pins used for rows, top to bottom
 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
 *                  ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
 *
 */
#define MASTER_RIGHT
#define MATRIX_ROW_PINS { F4, D3, F6, F7, B1, B3 }
#define MATRIX_COL_PINS { F5, B2, B5, D7, B4, B6, E6, D4 }
#define MATRIX_ROW_PINS_RIGHT { F4, B2, F6, F7, B1, B3 }
#define MATRIX_COL_PINS_RIGHT { F5, D3, B5, D7, B4, B6, E6, C6 }
#define UNUSED_PINS

/* COL2ROW, ROW2COL */
#define DIODE_DIRECTION COL2ROW

/*
 * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN.
 */
#define SOFT_SERIAL_PIN D0  // or D1, D2, D3, E6

//#define LED_NUM_LOCK_PIN B0
//#define LED_CAPS_LOCK_PIN B1
//#define LED_SCROLL_LOCK_PIN B2
//#define LED_COMPOSE_PIN B3
//#define LED_KANA_PIN B4

//#define BACKLIGHT_PIN B7
//#define BACKLIGHT_LEVELS 3
//#define BACKLIGHT_BREATHING

//#define RGB_DI_PIN E2
//#ifdef RGB_DI_PIN
//#    define RGBLED_NUM 16
//#    define RGBLIGHT_HUE_STEP 8
//#    define RGBLIGHT_SAT_STEP 8
//#    define RGBLIGHT_VAL_STEP 8
//#    define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
//#    define RGBLIGHT_SLEEP  /* If defined, the RGB lighting will be switched off when the host goes to sleep */
/*== all animations enable ==*/
//#    define RGBLIGHT_ANIMATIONS
/*== or choose animations ==*/
//#    define RGBLIGHT_EFFECT_BREATHING
//#    define RGBLIGHT_EFFECT_RAINBOW_MOOD
//#    define RGBLIGHT_EFFECT_RAINBOW_SWIRL
//#    define RGBLIGHT_EFFECT_SNAKE
//#    define RGBLIGHT_EFFECT_KNIGHT
//#    define RGBLIGHT_EFFECT_CHRISTMAS
//#    define RGBLIGHT_EFFECT_STATIC_GRADIENT
//#    define RGBLIGHT_EFFECT_RGB_TEST
//#    define RGBLIGHT_EFFECT_ALTERNATING
/*== customize breathing effect ==*/
/*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/
//#    define RGBLIGHT_BREATHE_TABLE_SIZE 256      // 256(default) or 128 or 64
/*==== use exp() and sin() ====*/
//#    define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85  // 1 to 2.7
//#    define RGBLIGHT_EFFECT_BREATHE_MAX    255   // 0 to 255
//#endif

/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5

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

/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE

/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
 * This is useful for the Windows task manager shortcut (ctrl+shift+esc).
 */
//#define GRAVE_ESC_CTRL_OVERRIDE

/*
 * Force NKRO
 *
 * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
 * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
 * makefile for this to work.)
 *
 * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
 * until the next keyboard reset.
 *
 * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
 * fully operational during normal computer usage.
 *
 * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
 * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
 * bootmagic, NKRO mode will always be enabled until it is toggled again during a
 * power-up.
 *
 */
//#define FORCE_NKRO

/*
 * 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

/* disable these deprecated features by default */
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION

/* Bootmagic Lite key configuration */
//#define BOOTMAGIC_LITE_ROW 0
//#define BOOTMAGIC_LITE_COLUMN 0

#define ENCODERS_PAD_A { D2 }
#define ENCODERS_PAD_B { D4 }
#define ENCODER_RESOLUTIONS { 4 }
#define ENCODERS_PAD_A_RIGHT { D2 }
#define ENCODERS_PAD_B_RIGHT { D4 }
#define ENCODER_RESOLUTIONS_RIGHT {4}

A keyboards/keyprez/unicorn/info.json => keyboards/keyprez/unicorn/info.json +10 -0
@@ 0,0 1,10 @@
{
    "keyboard_name": "Unicorn",
    "url": "",
    "maintainer": "Keyprez",
    "layouts": {
        "LAYOUT": {
            "layout": [{"label":"|", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"\"", "x":2, "y":0}, {"label":"\u00a3", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":8, "y":0}, {"label":"*", "x":9, "y":0}, {"label":"(", "x":10, "y":0}, {"label":")", "x":11, "y":0}, {"label":"_", "x":12, "y":0}, {"label":"+", "x":13, "y":0}, {"label":"Backspace", "x":14, "y":0, "w":2}, {"label":"Home", "x":16, "y":0}, {"label":"Rotary", "x":17, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"q", "x":1.5, "y":1}, {"label":"w", "x":2.5, "y":1}, {"label":"e", "x":3.5, "y":1}, {"label":"r", "x":4.5, "y":1}, {"label":"t", "x":5.5, "y":1}, {"label":"y", "x":7.5, "y":1}, {"label":"u", "x":8.5, "y":1}, {"label":"i", "x":9.5, "y":1}, {"label":"o", "x":10.5, "y":1}, {"label":"p", "x":11.5, "y":1}, {"label":"\u00e5", "x":12.5, "y":1}, {"label":"^", "x":13.5, "y":1}, {"label":"Enter", "x":14.75, "y":1, "w":1.25, "h":2}, {"label":"End", "x":16, "y":1}, {"label":"Delete", "x":17, "y":1}, {"label":"Esc", "x":0, "y":2, "w":1.75}, {"label":"a", "x":1.75, "y":2}, {"label":"s", "x":2.75, "y":2}, {"label":"d", "x":3.75, "y":2}, {"label":"f", "x":4.75, "y":2}, {"label":"g", "x":5.75, "y":2}, {"label":"h", "x":7.75, "y":2}, {"label":"j", "x":8.75, "y":2}, {"label":"k", "x":9.75, "y":2}, {"label":"l", "x":10.75, "y":2}, {"label":"\u00f8", "x":11.75, "y":2}, {"label":"\u00e6", "x":12.75, "y":2}, {"label":"'", "x":13.75, "y":2}, {"label":"PgUp", "x":16, "y":2}, {"label":"Insert", "x":17, "y":2}, {"label":"Shift", "x":0, "y":3, "w":1.25}, {"label":"<", "x":1.25, "y":3}, {"label":"z", "x":2.25, "y":3}, {"label":"x", "x":3.25, "y":3}, {"label":"c", "x":4.25, "y":3}, {"label":"v", "x":5.25, "y":3}, {"label":"b", "x":6.25, "y":3}, {"label":"n", "x":8.25, "y":3}, {"label":"m", "x":9.25, "y":3}, {"label":",", "x":10.25, "y":3}, {"label":".", "x":11.25, "y":3}, {"label":"-", "x":12.25, "y":3}, {"label":"Shift", "x":13.25, "y":3, "w":1.75}, {"label":"\u2191", "x":15, "y":3}, {"label":"PgDn", "x":16, "y":3}, {"label":"Copy", "x":17, "y":3}, {"label":"Ctrl", "x":0, "y":4, "w":1.25}, {"label":"Win", "x":1.25, "y":4, "w":1.25}, {"label":"Alt", "x":2.5, "y":4, "w":1.25}, {"label":"space", "x":3.75, "y":4, "w":2.25}, {"label":"space", "x":6, "y":4, "w":1.25}, {"label":"space", "x":8.25, "y":4, "w":2.75}, {"label":"AltGr", "x":11, "y":4}, {"label":"Mod", "x":12, "y":4}, {"label":"Ctrl", "x":13, "y":4}, {"label":"\u2190", "x":14, "y":4}, {"label":"\u2193", "x":15, "y":4}, {"label":"\u2192", "x":16, "y":4}, {"label":"Paste", "x":17, "y":4}]
        }
    }
}

A keyboards/keyprez/unicorn/keymaps/default/keymap.c => keyboards/keyprez/unicorn/keymaps/default/keymap.c +31 -0
@@ 0,0 1,31 @@
// Copyright 2022 Keyprez (https://github.com/keyprez)
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H

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

#define FN MO(_FN)

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    [_BASE] = LAYOUT(
        KC_GESC, 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_BSPC, KC_HOME, KC_MUTE,
        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_END, KC_DEL,
        KC_CAPS, KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_PGUP, KC_INSERT,
        KC_LSFT, KC_NUBS, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, KC_COPY,
        KC_LCTL, KC_LGUI, KC_LALT, KC_SPC,  KC_SPC,                             KC_SPC,  KC_RALT, FN,      KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_PASTE
    ),

    [_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,  _______, _______, _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______, _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET,   _______, _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
    ),
};


A keyboards/keyprez/unicorn/keymaps/default/readme.md => keyboards/keyprez/unicorn/keymaps/default/readme.md +1 -0
@@ 0,0 1,1 @@
# The default keymap for unicorn

A keyboards/keyprez/unicorn/keymaps/jorge/keymap.c => keyboards/keyprez/unicorn/keymaps/jorge/keymap.c +33 -0
@@ 0,0 1,33 @@
// Copyright 2022 Keyprez (https://github.com/keyprez)
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H

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

#define FN   MO(_FN)
#define CMD   MO(_CMD)

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    [_BASE] = LAYOUT(
        KC_GRV, 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_BSPC, KC_HOME, KC_MUTE,
        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_END, KC_DEL,
        KC_ESC, KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_PGUP, KC_INSERT,
        KC_LSFT, KC_NUBS, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, KC_COPY,
        KC_LCTL, KC_LGUI, KC_LALT, KC_SPC,  FN,                             KC_SPC,  KC_RALT, FN,      KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_PASTE
    ),

    [_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,  _______, _______, _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,          _______, _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET,   KC_BRIU, _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_BRID, _______,
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_CALC
    ),
};


A keyboards/keyprez/unicorn/keymaps/jorge/readme.md => keyboards/keyprez/unicorn/keymaps/jorge/readme.md +1 -0
@@ 0,0 1,1 @@
# The default keymap for unicorn

A keyboards/keyprez/unicorn/readme.md => keyboards/keyprez/unicorn/readme.md +25 -0
@@ 0,0 1,25 @@
# Unicorn

Unicorn is a split 65% keyboard with an extra column on the right side. 
It has support for optional hot swap sockets and a rotary encoder on the right side.

* Keyboard Maintainer: [Keyprez](https://github.com/keyprez)
* Hardware Supported: *Pro micro compatible controllers*
* Hardware Availability: *TBA*

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

    make keyprez/unicorn:default

Flashing example for this keyboard:

    make keyprez/unicorns: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:

* **Physical reset button**: Briefly press the button on the back of the PCB
* **Keycode in layout**: Press the Enter key while holding down the right fn key

A keyboards/keyprez/unicorn/rules.mk => keyboards/keyprez/unicorn/rules.mk +20 -0
@@ 0,0 1,20 @@
# MCU name
MCU = atmega32u4

# Bootloader selection
BOOTLOADER = caterina

# Build Options
#   change yes to no to disable
#
BOOTMAGIC_ENABLE = no      # 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 = no            # Enable N-Key Rollover
BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no        # Enable keyboard RGB underglow
AUDIO_ENABLE = no           # Audio output
SPLIT_KEYBOARD = yes
ENCODER_ENABLE = yes

A keyboards/keyprez/unicorn/unicorn.c => keyboards/keyprez/unicorn/unicorn.c +18 -0
@@ 0,0 1,18 @@
// Copyright 2022 Keyprez (https://github.com/keyprez)
// SPDX-License-Identifier: GPL-2.0-or-later

#include "unicorn.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

A keyboards/keyprez/unicorn/unicorn.h => keyboards/keyprez/unicorn/unicorn.h +36 -0
@@ 0,0 1,36 @@
// Copyright 2022 Keyprez (https://github.com/keyprez)
// SPDX-License-Identifier: GPL-2.0-or-later

#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( \
  LA1, LA2, LA3, LA4, LA5, LA6, LA7, RA1, RA2, RA3, RA4, RA5, RA6, RA7, RA8, RA9, \
  LB1, LB2, LB3, LB4, LB5, LB6,      RB1, RB2, RB3, RB4, RB5, RB6, RB7, RB8, RB9, \
  LC1, LC2, LC3, LC4, LC5, LC6,      RC1, RC2, RC3, RC4, RC5, RC6, RC7, RC8, RC9, RC10, \
  LD1, LD2, LD3, LD4, LD5, LD6, LD7, RD1, RD2, RD3, RD4, RD5, RD6, RD7, RD8, RD9, \
  LE1, LE2, LE3,      LE5, LE6,      RE1, RE2, RE3, RE4, RE5, RE6, RE7, RE8 \
  ) \
  { \
    { LA1, LA2, LA3, LA4, LA5, LA6, LA7, KC_NO }, \
    { LB1, LB2, LB3, LB4, LB5, LB6, KC_NO, KC_NO }, \
    { LC1, LC2, LC3, LC4, LC5, LC6, KC_NO, KC_NO }, \
    { LD1, LD2, LD3, LD4, LD5, LD6, LD7, KC_NO }, \
    { LE1, LE2, LE3, KC_NO, LE5, LE6, KC_NO, KC_NO }, \
    { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
    { RA1, RA2, RA3, RA4, RA5, RA6, RA7, RA8 }, \
    { RB1, RB2, RB3, RB4, RB5, RB6, RB7, KC_NO }, \
    { RC1, RC2, RC3, RC4, RC5, RC6, RC7, RC8 }, \
    { RD1, RD2, RD3, RD4, RD5, RD6, RD7, RD8 }, \
    { RE1, RE2, RE3, RE4, RE5, RE6, RE7, RE8 }, \
    { KC_NO, KC_NO, RA9, RB9, RB8, RC10, RC9, RD9 } \
  }