Skip to content

Commit

Permalink
[Keyboard] Add Pica40 (qmk#19220)
Browse files Browse the repository at this point in the history
Co-authored-by: Drashna Jaelre <drashna@live.com>
  • Loading branch information
2 people authored and Siddharth Bhal committed Dec 30, 2022
1 parent a35fec2 commit f502f1a
Show file tree
Hide file tree
Showing 18 changed files with 775 additions and 0 deletions.
52 changes: 52 additions & 0 deletions keyboards/pica40/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"keyboard_name": "pica40",
"manufacturer": "zzeneg",
"url": "https://github.com/zzeneg/pica40",
"maintainer": "zzeneg",
"layouts": {
"LAYOUT": {
"layout": [
{ "matrix": [0, 0], "x": 1, "y": 0 },
{ "matrix": [0, 1], "x": 2, "y": 0 },
{ "matrix": [0, 2], "x": 3, "y": 0 },
{ "matrix": [0, 3], "x": 4, "y": 0 },
{ "matrix": [0, 4], "x": 5, "y": 0 },
{ "matrix": [4, 4], "x": 6, "y": 0 },
{ "matrix": [4, 3], "x": 7, "y": 0 },
{ "matrix": [4, 2], "x": 8, "y": 0 },
{ "matrix": [4, 1], "x": 9, "y": 0 },
{ "matrix": [4, 0], "x": 10, "y": 0 },
{ "matrix": [3, 0], "x": 0, "y": 1 },
{ "matrix": [1, 0], "x": 1, "y": 1 },
{ "matrix": [1, 1], "x": 2, "y": 1 },
{ "matrix": [1, 2], "x": 3, "y": 1 },
{ "matrix": [1, 3], "x": 4, "y": 1 },
{ "matrix": [1, 4], "x": 5, "y": 1 },
{ "matrix": [5, 4], "x": 6, "y": 1 },
{ "matrix": [5, 3], "x": 7, "y": 1 },
{ "matrix": [5, 2], "x": 8, "y": 1 },
{ "matrix": [5, 1], "x": 9, "y": 1 },
{ "matrix": [5, 0], "x": 10, "y": 1 },
{ "matrix": [7, 0], "x": 11, "y": 1 },
{ "matrix": [3, 1], "x": 0, "y": 2 },
{ "matrix": [2, 0], "x": 1, "y": 2 },
{ "matrix": [2, 1], "x": 2, "y": 2 },
{ "matrix": [2, 2], "x": 3, "y": 2 },
{ "matrix": [2, 3], "x": 4, "y": 2 },
{ "matrix": [2, 4], "x": 5, "y": 2 },
{ "matrix": [6, 4], "x": 6, "y": 2 },
{ "matrix": [6, 3], "x": 7, "y": 2 },
{ "matrix": [6, 2], "x": 8, "y": 2 },
{ "matrix": [6, 1], "x": 9, "y": 2 },
{ "matrix": [6, 0], "x": 10, "y": 2 },
{ "matrix": [7, 1], "x": 11, "y": 2 },
{ "matrix": [3, 2], "x": 3, "y": 3 },
{ "matrix": [3, 3], "x": 4, "y": 3 },
{ "matrix": [3, 4], "x": 5, "y": 3 },
{ "matrix": [7, 4], "x": 6, "y": 3 },
{ "matrix": [7, 3], "x": 7, "y": 3 },
{ "matrix": [7, 2], "x": 8, "y": 3 }
]
}
}
}
44 changes: 44 additions & 0 deletions keyboards/pica40/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright 2022 zzeneg (@zzeneg)
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H

enum layer_number {
_QWERTY,
_LOWER,
_RAISE
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* QWERTY
* .----------------------------------. ,----------------------------------.
* | Q | W | E | R | T | | Y | U | I | O | P |
* .------+------+------+------+------+------| |------+------+------+------+------+------.
* | LCTRL| A | S | D | F | G | | H | J | K | L | ; | BSPC |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | LSFT | Z | X | C | V | B |-------. .-------| N | M | , | . | / | RSFT |
* `-----------------------------------------/ / \ \-----------------------------------------'
* | LALT | LOWER| / Space / \ Enter \ | RAISE| RGUI |
* `-------------' '-------' '-------' '-------------'
*/
[_QWERTY] = LAYOUT(
KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_BSPC,
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_LALT, MO(_LOWER), KC_SPC, KC_ENT, MO(_RAISE), KC_RGUI
),

[_LOWER] = LAYOUT(
KC_ESC, KC_7, KC_8, KC_9, KC_0, KC_BSLS, KC_F7, KC_F8, KC_F9, KC_F12,
_______, KC_EQL, KC_4, KC_5, KC_6, KC_LBRC, KC_QUOT, KC_F4, KC_F5, KC_F6, KC_F11, _______,
_______, KC_MINS, KC_1, KC_2, KC_3, KC_RBRC, KC_GRV, KC_F1, KC_F2, KC_F3, KC_F10, _______,
_______, _______, XXXXXXX, KC_MPLY, _______, _______
),

[_RAISE] = LAYOUT(
KC_TAB, LSFT(KC_7), LSFT(KC_8), LSFT(KC_9), LSFT(KC_0), LSFT(KC_BSLS), KC_DEL, KC_PGDN, KC_PGUP, KC_INS,
_______, LSFT(KC_EQL), LSFT(KC_4), LSFT(KC_5), LSFT(KC_6), LSFT(KC_LBRC), LSFT(KC_QUOT), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______,
_______, LSFT(KC_MINS), LSFT(KC_1), LSFT(KC_2), LSFT(KC_3), LSFT(KC_RBRC), LSFT(KC_GRV), KC_HOME, KC_END, XXXXXXX, XXXXXXX, _______,
_______, _______, KC_CAPS, XXXXXXX, _______, _______
),
};
12 changes: 12 additions & 0 deletions keyboards/pica40/keymaps/zzeneg/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2022 zzeneg (@zzeneg)
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#define IGNORE_MOD_TAP_INTERRUPT
#define TAPPING_FORCE_HOLD
#define TAPPING_FORCE_HOLD_PER_KEY
#define TAPPING_TERM 150
#define TAPPING_TERM_PER_KEY

#define BOTH_SHIFTS_TURNS_ON_CAPS_WORD
196 changes: 196 additions & 0 deletions keyboards/pica40/keymaps/zzeneg/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
// Copyright 2022 zzeneg (@zzeneg)
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H

enum layer_number {
_QWERTY = 0,
_GAME,
_NAV,
_NUMBER,
_SYMBOL,
_FUNC
};

// Left-hand home row mods
#define HOME_A LGUI_T(KC_A)
#define HOME_S LALT_T(KC_S)
#define HOME_D LCTL_T(KC_D)
#define HOME_F LSFT_T(KC_F)

// Right-hand home row mods
#define HOME_J RSFT_T(KC_J)
#define HOME_K RCTL_T(KC_K)
#define HOME_L LALT_T(KC_L)
#define HOME_SCLN RGUI_T(KC_SCLN)

// bottom mods
#define SYM_SPC LT(_SYMBOL, KC_SPC)
#define NUM_TAB LT(_NUMBER, KC_TAB)
#define FUNC_ESC LT(_FUNC, KC_ESC)
#define FUNC_ENT LT(_FUNC, KC_ENT)
#define NAV_BSPC LT(_NAV, KC_BSPC)
#define RALT_DEL RALT_T(KC_DEL)

// game layer mods
#define LALT_EQL LALT_T(KC_EQL)
#define LSFT_MINS LSFT_T(KC_MINS)
#define LCTL_ESC LCTL_T(KC_ESC)
#define LGUI_QUOT LGUI_T(KC_QUOT)

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* QWERTY
* .----------------------------------. ,----------------------------------.
* | Q | W | E | R | T | | Y | U | I | O | P |
* .------+------+------+------+------+------| |------+------+------+------+------+------.
* | = | A | S | D | F | G | | H | J | K | L | ; | ' |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | - | Z | X | C | V | B |-------. .-------| N | M | , | . | / | ` |
* `-----------------------------------------/ / \ \-----------------------------------------'
* | Esc | Tab | / Space / \ Enter \ | Bsps | Del |
* |_FUNC | _NUM | /_SYMBOL/ \ _FUNC \ | _NAV | RAlt |
* `-------------''-------' '-------''-------------'
*/
[_QWERTY] = LAYOUT(
KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,
KC_EQL, HOME_A, HOME_S, HOME_D, HOME_F, KC_G, KC_H, HOME_J, HOME_K, HOME_L, HOME_SCLN, KC_QUOT,
KC_MINS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_GRV,
FUNC_ESC, NUM_TAB, SYM_SPC, FUNC_ENT, NAV_BSPC, RALT_DEL
),

[_GAME] = LAYOUT(
KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,
LALT_EQL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, LGUI_QUOT,
LSFT_MINS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, TG(_GAME),
LCTL_ESC, NUM_TAB, SYM_SPC, FUNC_ENT, NAV_BSPC, RALT_DEL
),

[_NAV] = LAYOUT(
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PGDN, KC_PGUP, XXXXXXX,
XXXXXXX, KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, LALT(KC_UP), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_INS,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, LALT(KC_DOWN), KC_HOME, KC_END, KC_APP, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX
),

[_NUMBER] = LAYOUT(
KC_BSLS, KC_7, KC_8, KC_9, KC_0, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
KC_LCTL, KC_COMM, KC_4, KC_5, KC_6, KC_LBRC, XXXXXXX, KC_RSFT, KC_RCTL, KC_LALT, KC_RGUI, XXXXXXX,
KC_ENT, KC_DOT, KC_1, KC_2, KC_3, KC_RBRC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
KC_BSPC, _______, TG(_GAME), XXXXXXX, XXXXXXX, XXXXXXX
),

[_SYMBOL] = LAYOUT(
LSFT(KC_BSLS), LSFT(KC_7), LSFT(KC_8), LSFT(KC_9), LSFT(KC_0), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
KC_LCTL, LSFT(KC_COMM), LSFT(KC_4), LSFT(KC_5), LSFT(KC_6), LSFT(KC_LBRC), XXXXXXX, KC_RSFT, KC_RCTL, KC_LALT, KC_RGUI, XXXXXXX,
KC_ENT, LSFT(KC_DOT), LSFT(KC_1), LSFT(KC_2), LSFT(KC_3), LSFT(KC_RBRC), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, KC_BSPC, _______, XXXXXXX, XXXXXXX, XXXXXXX
),

[_FUNC] = LAYOUT(
KC_F12, KC_F7, KC_F8, KC_F9, KC_PSCR, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
KC_LCTL, KC_F11, KC_F4, KC_F5, KC_F6, KC_PAUS, XXXXXXX, KC_RSFT, KC_RCTL, KC_LALT, KC_RGUI, XXXXXXX,
KC_DEL, KC_F10, KC_F1, KC_F2, KC_F3, KC_CAPS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
_______, KC_MNXT, KC_MPLY, _______, XXXXXXX, XXXXXXX
)
};

bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
// allow multiple space, backspace, delete
case SYM_SPC:
case NAV_BSPC:
case RALT_DEL:
return false;
default:
return true;
}
}

uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
// different tapping term for different fingers
switch (keycode) {
// pinkies
case HOME_A:
case HOME_SCLN:
return TAPPING_TERM + 70;
// ring
case HOME_S:
case HOME_L:
return TAPPING_TERM + 40;
// middle
case HOME_D:
case HOME_K:
return TAPPING_TERM + 20;
// index and thumb
default:
return TAPPING_TERM;
}
}

#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[_QWERTY] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[_GAME] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[_NAV] = { ENCODER_CCW_CW(KC_MPRV, KC_MNXT) },
[_NUMBER] = { ENCODER_CCW_CW(KC_MPRV, KC_MNXT) },
[_SYMBOL] = { ENCODER_CCW_CW(KC_MPRV, KC_MNXT) },
[_FUNC] = { ENCODER_CCW_CW(KC_MPRV, KC_MNXT) }
};
#endif // ENCODER_MAP_ENABLE

#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS)

const rgblight_segment_t PROGMEM game_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, 1, HSV_ORANGE});
const rgblight_segment_t PROGMEM capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, 1, HSV_PURPLE});
const rgblight_segment_t PROGMEM capslockword_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, 1, HSV_MAGENTA});
const rgblight_segment_t* const PROGMEM rgb_layers[] = RGBLIGHT_LAYERS_LIST(game_layer, capslock_layer, capslockword_layer);

bool led_update_user(led_t led_state) {
rgblight_set_layer_state(1, led_state.caps_lock);
return true;
}

layer_state_t layer_state_set_user(layer_state_t state) {
rgblight_set_layer_state(0, layer_state_cmp(state, _GAME));
return state;
}

void caps_word_set_user(bool active) {
rgblight_set_layer_state(2, active);
}

void keyboard_post_init_user(void) {
rgblight_layers = rgb_layers;
}

#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS)

#ifdef OLED_ENABLE

void render_layer(void) {
switch (get_highest_layer(layer_state)) {
case _NUMBER:
oled_write_ln_P(PSTR("NMBR"), false);
break;
case _SYMBOL:
oled_write_ln_P(PSTR("SMBL"), false);
break;
case _NAV:
oled_write_ln_P(PSTR("NAV"), false);
break;
case _FUNC:
oled_write_ln_P(PSTR("FUNC"), false);
break;
default:
oled_write_ln_P(PSTR(" "), false);
break;
}
}

bool oled_task_user(void) {
render_layer();
return true;
}

#endif // OLED_ENABLE

2 changes: 2 additions & 0 deletions keyboards/pica40/keymaps/zzeneg/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CAPS_WORD_ENABLE = yes
ENCODER_MAP_ENABLE = yes
29 changes: 29 additions & 0 deletions keyboards/pica40/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# pica40

![pica40](https://i.imgur.com/CKImjAPh.jpg)

A family of 40-key split ortholinear keyboards with rotary encoder.

- Keyboard Maintainer: [zzeneg](https://github.com/zzeneg)
- Hardware Supported: Pica40 PCBs, Pro Micro (rev1), XIAO RP2040/nRF52840 (rev2)
- Hardware Availability: [GitHub](https://github.com/zzeneg/pica40)

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

make pica40:default
make pica40/rev1:default

Flashing example for this keyboard:

make pica40:default:flash
make pica40/rev1: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**: 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
9 changes: 9 additions & 0 deletions keyboards/pica40/rev1/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2022 zzeneg (@zzeneg)
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#ifdef RGBLIGHT_ENABLE
# define RGBLIGHT_DISABLE_KEYCODES // disable keycodes for RGB Light controls, only status LED is supported
# define PICA40_RGBLIGHT_TIMEOUT 5 // turn RGB off after N minutes
#endif
39 changes: 39 additions & 0 deletions keyboards/pica40/rev1/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"processor": "atmega32u4",
"bootloader": "caterina",
"diode_direction": "COL2ROW",
"matrix_pins": {
"cols": ["D2", "B5", "B4", "E6", "D7"],
"rows": ["B1", "B3", "B2", "B6", "F4", "F5", "F6", "F7"]
},
"features": {
"bootmagic": true,
"command": false,
"console": false,
"mousekey": true,
"extrakey": true,
"encoder": true,
"oled": true,
"rgblight": true,
"nkro": true
},
"rgblight": {
"led_count": 1,
"pin": "D3",
"layers": {
"enabled": true,
"max": 3
}
},
"encoder": {
"rotary": [{ "pin_a": "C6", "pin_b": "D4" }]
},
"usb": {
"device_version": "1.0.0",
"pid": "0x0841",
"vid": "0xFEED"
},
"build": {
"lto": true
}
}
Loading

0 comments on commit f502f1a

Please sign in to comment.