Merge remote-tracking branch 'origin/master' into develop
commit
62d101b886
|
@ -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 }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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, _______, _______
|
||||||
|
),
|
||||||
|
};
|
|
@ -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
|
|
@ -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
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
CAPS_WORD_ENABLE = yes
|
||||||
|
ENCODER_MAP_ENABLE = yes
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
// Copyright 2022 zzeneg (@zzeneg)
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "rev1.h"
|
||||||
|
|
||||||
|
#ifdef PICA40_RGBLIGHT_TIMEOUT
|
||||||
|
|
||||||
|
uint16_t check_rgblight_timer = 0;
|
||||||
|
uint16_t idle_timer = 0;
|
||||||
|
uint8_t counter = 0;
|
||||||
|
|
||||||
|
void housekeeping_task_kb(void) {
|
||||||
|
if (timer_elapsed(check_rgblight_timer) > 1000) {
|
||||||
|
check_rgblight_timer = timer_read();
|
||||||
|
|
||||||
|
if (rgblight_is_enabled() && timer_elapsed(idle_timer) > 10000) {
|
||||||
|
idle_timer = timer_read();
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rgblight_is_enabled() && counter > PICA40_RGBLIGHT_TIMEOUT * 6) {
|
||||||
|
counter = 0;
|
||||||
|
rgblight_disable_noeeprom();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
housekeeping_task_user();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
if (record->event.pressed && timer_elapsed(idle_timer) > 1000) {
|
||||||
|
idle_timer = timer_read();
|
||||||
|
counter = 0;
|
||||||
|
if (!rgblight_is_enabled()) {
|
||||||
|
rgblight_enable_noeeprom();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return process_record_user(keycode, record);
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyboard_post_init_kb(void) {
|
||||||
|
check_rgblight_timer = timer_read();
|
||||||
|
idle_timer = timer_read();
|
||||||
|
rgblight_enable_noeeprom();
|
||||||
|
|
||||||
|
keyboard_post_init_user();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // PICA40_RGBLIGHT_TIMEOUT
|
||||||
|
|
||||||
|
#ifdef OLED_ENABLE
|
||||||
|
|
||||||
|
oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
|
||||||
|
return OLED_ROTATION_270;
|
||||||
|
}
|
||||||
|
|
||||||
|
void render_mods(uint8_t modifiers) {
|
||||||
|
oled_write_ln_P((modifiers & MOD_MASK_CTRL) ? PSTR("Ctrl") : PSTR(" "), false);
|
||||||
|
oled_write_ln_P((modifiers & MOD_MASK_ALT) ? PSTR("Alt") : PSTR(" "), false);
|
||||||
|
oled_write_ln_P((modifiers & MOD_MASK_SHIFT) ? PSTR("Shft") : PSTR(" "), false);
|
||||||
|
oled_write_ln_P((modifiers & MOD_MASK_GUI) ? PSTR("GUI") : PSTR(" "), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool oled_task_kb(void) {
|
||||||
|
// display's top is hidden by cover
|
||||||
|
oled_write_ln_P(PSTR(" "), false);
|
||||||
|
oled_write_ln_P(PSTR(" "), false);
|
||||||
|
oled_write_ln_P(PSTR(" "), false);
|
||||||
|
|
||||||
|
if (!oled_task_user()) return false;
|
||||||
|
|
||||||
|
render_mods(get_mods());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // OLED_ENABLE
|
||||||
|
|
||||||
|
#ifdef ENCODER_ENABLE
|
||||||
|
|
||||||
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
|
if (!encoder_update_user(index, clockwise)) return false;
|
||||||
|
|
||||||
|
tap_code(clockwise ? KC_VOLU : KC_VOLD);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // ENCODER_ENABLE
|
|
@ -0,0 +1,6 @@
|
||||||
|
// Copyright 2022 zzeneg (@zzeneg)
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "quantum.h"
|
|
@ -0,0 +1 @@
|
||||||
|
OLED_DRIVER = SSD1306
|
|
@ -0,0 +1,19 @@
|
||||||
|
// Copyright 2022 zzeneg (@zzeneg)
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define SERIAL_USART_TX_PIN GP0
|
||||||
|
|
||||||
|
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET
|
||||||
|
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP17
|
||||||
|
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
#ifdef ENCODER_ENABLE
|
||||||
|
# define SPLIT_TRANSACTION_IDS_KB ENCODER_SYNC
|
||||||
|
#endif
|
|
@ -0,0 +1,53 @@
|
||||||
|
{
|
||||||
|
"processor": "RP2040",
|
||||||
|
"bootloader": "rp2040",
|
||||||
|
"diode_direction": "COL2ROW",
|
||||||
|
"matrix_pins": {
|
||||||
|
"cols": ["GP26", "GP27", "GP28", "GP29", "GP6"],
|
||||||
|
"rows": ["GP3", "GP4", "GP2", "GP1"]
|
||||||
|
},
|
||||||
|
"indicators": {
|
||||||
|
"num_lock": "GP17",
|
||||||
|
"caps_lock": "GP16",
|
||||||
|
"scroll_lock": "GP25",
|
||||||
|
"on_state": 0
|
||||||
|
},
|
||||||
|
"features": {
|
||||||
|
"bootmagic": true,
|
||||||
|
"command": false,
|
||||||
|
"console": false,
|
||||||
|
"mousekey": true,
|
||||||
|
"extrakey": true,
|
||||||
|
"encoder": true,
|
||||||
|
"rgblight": true,
|
||||||
|
"nkro": true
|
||||||
|
},
|
||||||
|
"rgblight": {
|
||||||
|
"led_count": 1,
|
||||||
|
"pin": "GP12",
|
||||||
|
"split": true,
|
||||||
|
"layers": {
|
||||||
|
"enabled": true,
|
||||||
|
"max": 3
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"split": {
|
||||||
|
"enabled": true,
|
||||||
|
"encoder": {
|
||||||
|
"right": {
|
||||||
|
"rotary": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"encoder": {
|
||||||
|
"rotary": [{ "pin_a": "GP7", "pin_b": "GP7" }]
|
||||||
|
},
|
||||||
|
"usb": {
|
||||||
|
"device_version": "1.0.0",
|
||||||
|
"pid": "0x0842",
|
||||||
|
"vid": "0xFEED"
|
||||||
|
},
|
||||||
|
"build": {
|
||||||
|
"lto": true
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
# if ENCODER_ENABLE is set, add defines but avoid adding encoder.c as it's replaced by custom code in rev2.c
|
||||||
|
ifeq ($(strip $(ENCODER_ENABLE)), yes)
|
||||||
|
ENCODER_ENABLE := no
|
||||||
|
OPT_DEFS += -DENCODER_ENABLE
|
||||||
|
ifeq ($(strip $(ENCODER_MAP_ENABLE)), yes)
|
||||||
|
OPT_DEFS += -DENCODER_MAP_ENABLE
|
||||||
|
endif
|
||||||
|
endif
|
|
@ -0,0 +1,189 @@
|
||||||
|
// Copyright 2022 zzeneg (@zzeneg)
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "rev2.h"
|
||||||
|
|
||||||
|
#ifdef ENCODER_ENABLE // code based on encoder.c
|
||||||
|
|
||||||
|
static const pin_t encoders_pad_a[] = ENCODERS_PAD_A;
|
||||||
|
static const pin_t encoders_pad_b[] = ENCODERS_PAD_B;
|
||||||
|
|
||||||
|
static int8_t encoder_LUT[] = {0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0};
|
||||||
|
static uint8_t encoder_state = 3;
|
||||||
|
static int8_t encoder_pulses = 0;
|
||||||
|
static uint8_t encoder_value = 0;
|
||||||
|
|
||||||
|
typedef struct encoder_sync_data {
|
||||||
|
int value;
|
||||||
|
} encoder_sync_data;
|
||||||
|
|
||||||
|
// custom handler that returns encoder B pin status from slave side
|
||||||
|
void encoder_sync_slave_handler(uint8_t in_buflen, const void *in_data, uint8_t out_buflen, void *out_data) {
|
||||||
|
encoder_sync_data *data = (encoder_sync_data *)out_data;
|
||||||
|
data->value = readPin(encoders_pad_b[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((weak)) bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
|
if (!encoder_update_user(index, clockwise)) return false;
|
||||||
|
|
||||||
|
tap_code(clockwise ? KC_VOLU : KC_VOLD);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ENCODER_MAP_ENABLE
|
||||||
|
static void encoder_exec_mapping(uint8_t index, bool clockwise) {
|
||||||
|
action_exec(clockwise ? ENCODER_CW_EVENT(index, true) : ENCODER_CCW_EVENT(index, true));
|
||||||
|
wait_ms(ENCODER_MAP_KEY_DELAY);
|
||||||
|
action_exec(clockwise ? ENCODER_CW_EVENT(index, false) : ENCODER_CCW_EVENT(index, false));
|
||||||
|
wait_ms(ENCODER_MAP_KEY_DELAY);
|
||||||
|
}
|
||||||
|
#endif // ENCODER_MAP_ENABLE
|
||||||
|
|
||||||
|
void encoder_init(void) {
|
||||||
|
setPinInputHigh(encoders_pad_a[0]);
|
||||||
|
setPinInputHigh(encoders_pad_b[0]);
|
||||||
|
wait_us(100);
|
||||||
|
transaction_register_rpc(ENCODER_SYNC, encoder_sync_slave_handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool encoder_read(void) {
|
||||||
|
// ignore if running on slave side
|
||||||
|
if (!is_keyboard_master()) return false;
|
||||||
|
|
||||||
|
bool changed = false;
|
||||||
|
encoder_sync_data data = {0};
|
||||||
|
// request pin B status from slave side
|
||||||
|
if (transaction_rpc_recv(ENCODER_SYNC, sizeof(data), &data)) {
|
||||||
|
uint8_t new_status = (readPin(encoders_pad_a[0]) << 0) | (data.value << 1);
|
||||||
|
if ((encoder_state & 0x3) != new_status) {
|
||||||
|
encoder_state <<= 2;
|
||||||
|
encoder_state |= new_status;
|
||||||
|
encoder_pulses += encoder_LUT[encoder_state & 0xF];
|
||||||
|
|
||||||
|
if (encoder_pulses >= ENCODER_RESOLUTION) {
|
||||||
|
encoder_value++;
|
||||||
|
changed = true;
|
||||||
|
#ifdef ENCODER_MAP_ENABLE
|
||||||
|
encoder_exec_mapping(0, false);
|
||||||
|
#else // ENCODER_MAP_ENABLE
|
||||||
|
encoder_update_kb(0, false);
|
||||||
|
#endif // ENCODER_MAP_ENABLE
|
||||||
|
}
|
||||||
|
|
||||||
|
if (encoder_pulses <= -ENCODER_RESOLUTION) {
|
||||||
|
encoder_value--;
|
||||||
|
changed = true;
|
||||||
|
#ifdef ENCODER_MAP_ENABLE
|
||||||
|
encoder_exec_mapping(0, true);
|
||||||
|
#else // ENCODER_MAP_ENABLE
|
||||||
|
encoder_update_kb(0, true);
|
||||||
|
#endif // ENCODER_MAP_ENABLE
|
||||||
|
}
|
||||||
|
|
||||||
|
encoder_pulses %= ENCODER_RESOLUTION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
// do not use standard split encoder transactions
|
||||||
|
void encoder_state_raw(uint8_t *slave_state) {}
|
||||||
|
void encoder_update_raw(uint8_t *slave_state) {}
|
||||||
|
|
||||||
|
#endif // ENCODER_ENABLE
|
||||||
|
|
||||||
|
#ifdef PICA40_RGBLIGHT_TIMEOUT
|
||||||
|
uint16_t check_rgblight_timer = 0;
|
||||||
|
uint16_t idle_timer = 0;
|
||||||
|
int8_t counter = 0;
|
||||||
|
|
||||||
|
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
if (record->event.pressed && timer_elapsed(idle_timer) > 1000) {
|
||||||
|
idle_timer = timer_read();
|
||||||
|
counter = 0;
|
||||||
|
if (!rgblight_is_enabled()) {
|
||||||
|
rgblight_enable_noeeprom();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return process_record_user(keycode, record);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // PICA40_RGBLIGHT_TIMEOUT
|
||||||
|
|
||||||
|
#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS)
|
||||||
|
uint16_t check_layer_timer = 0;
|
||||||
|
bool is_layer_active = false;
|
||||||
|
bool should_set_rgblight = false;
|
||||||
|
#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS)
|
||||||
|
|
||||||
|
void keyboard_post_init_kb(void) {
|
||||||
|
setPinOutput(PICA40_RGB_POWER_PIN);
|
||||||
|
|
||||||
|
#ifdef PICA40_RGBLIGHT_TIMEOUT
|
||||||
|
idle_timer = timer_read();
|
||||||
|
check_rgblight_timer = timer_read();
|
||||||
|
rgblight_enable_noeeprom();
|
||||||
|
#endif // RGBLIGHT_ENABLE
|
||||||
|
|
||||||
|
#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS)
|
||||||
|
check_layer_timer = timer_read();
|
||||||
|
#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS)
|
||||||
|
|
||||||
|
keyboard_post_init_user();
|
||||||
|
}
|
||||||
|
|
||||||
|
void housekeeping_task_kb(void) {
|
||||||
|
#ifdef PICA40_RGBLIGHT_TIMEOUT
|
||||||
|
if (is_keyboard_master()) {
|
||||||
|
if (timer_elapsed(check_rgblight_timer) > 1000) {
|
||||||
|
check_rgblight_timer = timer_read();
|
||||||
|
|
||||||
|
if (rgblight_is_enabled() && timer_elapsed(idle_timer) > 10000) {
|
||||||
|
idle_timer = timer_read();
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rgblight_is_enabled() && counter > PICA40_RGBLIGHT_TIMEOUT * 6) {
|
||||||
|
counter = 0;
|
||||||
|
rgblight_disable_noeeprom();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // PICA40_RGBLIGHT_TIMEOUT
|
||||||
|
|
||||||
|
#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS)
|
||||||
|
if (timer_elapsed(check_layer_timer) > 100) {
|
||||||
|
check_layer_timer = timer_read();
|
||||||
|
|
||||||
|
if (should_set_rgblight) {
|
||||||
|
// set in the next housekeeping cycle after setting pin to avoid issues
|
||||||
|
rgblight_set();
|
||||||
|
should_set_rgblight = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool current_is_layer_active = false;
|
||||||
|
for (uint8_t i = 0; i < RGBLIGHT_MAX_LAYERS; i++) {
|
||||||
|
current_is_layer_active = current_is_layer_active || rgblight_get_layer_state(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_layer_active != current_is_layer_active) {
|
||||||
|
is_layer_active = current_is_layer_active;
|
||||||
|
should_set_rgblight = true;
|
||||||
|
|
||||||
|
if (is_layer_active) {
|
||||||
|
writePinHigh(PICA40_RGB_POWER_PIN);
|
||||||
|
} else {
|
||||||
|
writePinLow(PICA40_RGB_POWER_PIN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS)
|
||||||
|
|
||||||
|
housekeeping_task_user();
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
// Copyright 2022 zzeneg (@zzeneg)
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "quantum.h"
|
||||||
|
#include "gpio.h"
|
||||||
|
|
||||||
|
// RGB LED support for XIAO RP2040
|
||||||
|
#define PICA40_RGB_POWER_PIN GP11
|
||||||
|
|
||||||
|
// enable custom encoder functionality for Pica40
|
||||||
|
#ifdef ENCODER_ENABLE
|
||||||
|
# include "encoder.h"
|
||||||
|
# include "transactions.h"
|
||||||
|
# ifndef ENCODER_MAP_KEY_DELAY
|
||||||
|
# define ENCODER_MAP_KEY_DELAY 2
|
||||||
|
# endif
|
||||||
|
# ifndef ENCODER_RESOLUTION
|
||||||
|
# define ENCODER_RESOLUTION 4
|
||||||
|
# endif
|
||||||
|
#endif
|
|
@ -0,0 +1,2 @@
|
||||||
|
SERIAL_DRIVER = vendor
|
||||||
|
WS2812_DRIVER = vendor
|
|
@ -0,0 +1 @@
|
||||||
|
DEFAULT_FOLDER = pica40/rev2
|
Loading…
Reference in New Issue