FFKeebs Púca Refactor (#15208)

This commit is contained in:
James Young 2021-11-19 06:12:49 +00:00 committed by GitHub
parent 26ae432190
commit 9cdbc040cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 276 additions and 68 deletions

View file

@ -2,35 +2,105 @@
"keyboard_name": "Puca",
"url": "https://ffkeebs.com/collections/puca/",
"maintainer": "Sleepdealr",
"layout_aliases": {
"LAYOUT": "LAYOUT_all"
},
"layouts": {
"LAYOUT": {
"LAYOUT_all": {
"layout": [
{ "label": "Rotary", "x": 0.5, "y": 0 },
{ "label": "Pg Up", "x": 2, "y": 0 },
{ "label": "Pg Dn", "x": 3, "y": 0 },
{ "label": "Layer Toggle", "x": 0, "y": 1.25 },
{ "label": "/", "x": 1, "y": 1.25 },
{ "label": "*", "x": 2, "y": 1.25 },
{ "label": "-", "x": 3, "y": 1.25 },
{ "label": "7", "x": 0, "y": 2.25 },
{ "label": "8", "x": 1, "y": 2.25 },
{ "label": "9", "x": 2, "y": 2.25 },
{ "label": "+", "x": 3, "y": 2.25, "h": 2 },
{ "label": "+", "x": 4, "y": 2.25 },
{ "label": "+", "x": 3, "y": 2.25 },
{ "label": "+", "x": 4, "y": 2.25, "h": 2 },
{ "label": "4", "x": 0, "y": 3.25 },
{ "label": "5", "x": 1, "y": 3.25 },
{ "label": "6", "x": 2, "y": 3.25 },
{ "label": "|", "x": 4, "y": 3.25 },
{ "label": "|", "x": 3, "y": 3.25 },
{ "label": "1", "x": 0, "y": 4.25 },
{ "label": "2", "x": 1, "y": 4.25 },
{ "label": "3", "x": 2, "y": 4.25 },
{ "label": "Enter", "x": 3, "y": 4.25, "h": 2 },
{ "label": "Enter", "x": 4, "y": 4.25 },
{ "label": "Enter", "x": 3, "y": 4.25 },
{ "label": "Enter", "x": 4, "y": 4.25, "h": 2 },
{ "label": "0", "x": 0, "y": 5.25 },
{ "label": "00", "x": 1, "y": 5.25 },
{ "label": ".", "x": 2, "y": 5.25 },
{ "label": ".", "x": 3, "y": 5.25 },
{ "label": "0", "x": 0, "y": 6.25, "w": 2 }
]
},
"LAYOUT_numpad": {
"layout": [
{ "label": "Rotary", "x": 0.5, "y": 0 },
{ "label": "Pg Up", "x": 2, "y": 0 },
{ "label": "Pg Dn", "x": 3, "y": 0 },
{ "label": "Layer Toggle", "x": 0, "y": 1.25 },
{ "label": "/", "x": 1, "y": 1.25 },
{ "label": "*", "x": 2, "y": 1.25 },
{ "label": "-", "x": 3, "y": 1.25 },
{ "label": "7", "x": 0, "y": 2.25 },
{ "label": "8", "x": 1, "y": 2.25 },
{ "label": "9", "x": 2, "y": 2.25 },
{ "label": "4", "x": 0, "y": 3.25 },
{ "label": "5", "x": 1, "y": 3.25 },
{ "label": "6", "x": 2, "y": 3.25 },
{ "label": "+", "x": 3, "y": 2.25, "h": 2 },
{ "label": "1", "x": 0, "y": 4.25 },
{ "label": "2", "x": 1, "y": 4.25 },
{ "label": "3", "x": 2, "y": 4.25 },
{ "label": "0", "x": 0, "y": 5.25, "w": 2 },
{ "label": ".", "x": 2, "y": 5.25 },
{ "label": ".", "x": 4, "y": 5.25 },
{ "label": "0", "x": 0, "y": 6.25 },
{ "label": "00", "x": 1, "y": 6.25 }
{ "label": "Enter", "x": 3, "y": 4.25, "h": 2 }
]
},
"LAYOUT_ortho": {
"layout": [
{ "label": "Rotary", "x": 0.5, "y": 0 },
{ "label": "Pg Up", "x": 2, "y": 0 },
{ "label": "Pg Dn", "x": 3, "y": 0 },
{ "label": "Layer Toggle", "x": 0, "y": 1.25 },
{ "label": "/", "x": 1, "y": 1.25 },
{ "label": "*", "x": 2, "y": 1.25 },
{ "label": "-", "x": 3, "y": 1.25 },
{ "label": "7", "x": 0, "y": 2.25 },
{ "label": "8", "x": 1, "y": 2.25 },
{ "label": "9", "x": 2, "y": 2.25 },
{ "label": "+", "x": 3, "y": 2.25 },
{ "label": "4", "x": 0, "y": 3.25 },
{ "label": "5", "x": 1, "y": 3.25 },
{ "label": "6", "x": 2, "y": 3.25 },
{ "label": "|", "x": 3, "y": 3.25 },
{ "label": "1", "x": 0, "y": 4.25 },
{ "label": "2", "x": 1, "y": 4.25 },
{ "label": "3", "x": 2, "y": 4.25 },
{ "label": "Enter", "x": 3, "y": 4.25 },
{ "label": "0", "x": 0, "y": 5.25 },
{ "label": "00", "x": 1, "y": 5.25 },
{ "label": ".", "x": 2, "y": 5.25 },
{ "label": "Enter", "x": 3, "y": 5.25 }
]
}
}

View file

@ -1,4 +1,4 @@
/* Copyright 2021 Sleepdealer
/* Copyright 2021 Sleepdealer, James Young for QMK (@noroadsleft)
*
* 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
@ -15,38 +15,26 @@
*/
#include QMK_KEYBOARD_H
// 00 Functionality
enum custom_keycodes {
MC_00 = SAFE_RANGE,
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case MC_00:
if (record->event.pressed) {
SEND_STRING("00");
}
break;
}
return true;
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LAYOUT(
KC_MUTE, KC_PGUP, KC_PGDN,
TG(1), KC_PSLS, KC_PAST, KC_PMNS,
KC_P7, KC_P8, KC_P9, KC_PPLS, KC_PPLS,
KC_P4, KC_P5, KC_P6, KC_PIPE,
KC_P1, KC_P2, KC_P3, KC_ENTER, KC_ENTER,
KC_P0, MC_00, KC_PDOT, KC_PDOT,
KC_P0),
LAYOUT(
[0] = LAYOUT_all(
KC_MUTE, KC_PGUP, KC_PGDN,
TG(1), KC_PSLS, KC_PAST, KC_PMNS,
KC_P7, KC_P8, KC_P9, KC_PPLS, KC_PPLS,
KC_P4, KC_P5, KC_P6, KC_PIPE,
KC_P1, KC_P2, KC_P3, KC_ENTER, KC_ENTER,
KC_P0, MC_00, KC_PDOT, KC_PDOT,
KC_P0
),
[1] = LAYOUT_all(
KC_TRNS, RGB_HUI, RGB_VAI,
TG(1), RGB_TOG, RGB_HUD, RGB_VAD,
KC_PGUP, KC_UP, KC_PGDN, RGB_MOD, RGB_MOD,
KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS,
KC_INS, KC_HOME, KC_END, RGB_RMOD, RGB_RMOD,
KC_ESC, KC_TRNS, KC_DEL, KC_TRNS,
KC_ESC)
TG(1), RGB_TOG, RGB_HUD, RGB_VAD,
KC_PGUP, KC_UP, KC_PGDN, RGB_MOD, RGB_MOD,
KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS,
KC_INS, KC_HOME, KC_END, RGB_RMOD, RGB_RMOD,
KC_ESC, KC_TRNS, KC_DEL, KC_TRNS,
KC_ESC
),
};

View file

@ -0,0 +1,38 @@
/* Copyright 2021 Sleepdealer, James Young for QMK (@noroadsleft)
*
* 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
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_numpad(
KC_MUTE, KC_PGUP, KC_PGDN,
TG(1), KC_PSLS, KC_PAST, KC_PMNS,
KC_P7, KC_P8, KC_P9,
KC_P4, KC_P5, KC_P6, KC_PPLS,
KC_P1, KC_P2, KC_P3,
KC_P0, KC_PDOT, KC_ENTER
),
[1] = LAYOUT_numpad(
_______, RGB_HUI, RGB_VAI,
TG(1), RGB_TOG, RGB_HUD, RGB_VAD,
KC_PGUP, KC_UP, KC_PGDN,
KC_LEFT, KC_DOWN, KC_RGHT, RGB_MOD,
KC_INS, KC_HOME, KC_END,
KC_ESC, KC_DEL, RGB_RMOD
),
};

View file

@ -0,0 +1,38 @@
/* Copyright 2021 Sleepdealer, James Young for QMK (@noroadsleft)
*
* 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
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_ortho(
KC_MUTE, KC_PGUP, KC_PGDN,
TG(1), KC_PSLS, KC_PAST, KC_PMNS,
KC_P7, KC_P8, KC_P9, KC_PPLS,
KC_P4, KC_P5, KC_P6, KC_PIPE,
KC_P1, KC_P2, KC_P3, KC_ENTER,
KC_P0, MC_00, KC_PDOT, KC_ENTER
),
[1] = LAYOUT_ortho(
_______, RGB_HUI, RGB_VAI,
TG(1), RGB_TOG, RGB_HUD, RGB_VAD,
KC_PGUP, KC_UP, KC_PGDN, RGB_MOD,
KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX,
KC_INS, KC_HOME, KC_END, RGB_RMOD,
KC_ESC, XXXXXXX, KC_DEL, XXXXXXX
)
};

View file

@ -15,6 +15,20 @@
*/
#include "puca.h"
bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
if (!process_record_user(keycode, record)) {
return false;
}
switch (keycode) {
case MC_00:
if (record->event.pressed) {
SEND_STRING("00");
}
break;
}
return true;
}
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (clockwise) {
@ -105,7 +119,7 @@ __attribute__((weak)) void oled_task_user(void) {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}};
void animation_phase(void) {
current_idle_frame = (current_idle_frame + 1) % IDLE_FRAMES;
oled_write_raw_P(idle[abs((IDLE_FRAMES - 1) - current_idle_frame)], ANIM_SIZE);
@ -114,7 +128,7 @@ __attribute__((weak)) void oled_task_user(void) {
anim_timer = timer_read32();
animation_phase();
}
oled_set_cursor(0, 6);
oled_write_P(PSTR("PUCA\nPAD\n"), false);
oled_write_P(PSTR("-----\n"), false);
@ -130,4 +144,4 @@ __attribute__((weak)) void oled_task_user(void) {
break;
}
}
#endif
#endif

View file

@ -16,26 +16,86 @@
#pragma once
// K24 is 2U Plus
// K44 is 2u Enter
// K54 is 2u 0
#include "quantum.h"
#define LAYOUT( \
K00, K02, K03, \
K10, K11, K12, K13, \
K20, K21, K22, K23, K24,\
K30, K31, K32, K33, \
K40, K41, K42, K43, K44,\
K50, K51, K52, K53, \
K54 \
/* Keycodes defined here can be used by any keymap. If you wish to
* define additional keycodes for your personal keymap only, assign
* your first custom keycode to `= NEW_SAFE_RANGE`.
*
* See `process_record_kb()` in `puca.c`.
*/
enum keyboard_keycodes {
MC_00 = SAFE_RANGE,
NEW_SAFE_RANGE,
};
#define XXX KC_NO
/*
*
* 00 02 03
*
*
* 10 11 12 13
*
* 20 21 22 23
* 24 2u Plus
* 30 31 32 33
*
* 40 41 42 43
* 44 2u Enter
* 50 51 52 53
*
*
* 54 2u 0
*
*/
#define LAYOUT_all( \
K00, K02, K03, \
K10, K11, K12, K13, \
K20, K21, K22, K23, K24,\
K30, K31, K32, K33, \
K40, K41, K42, K43, K44,\
K50, K51, K52, K53, \
K54 \
) { \
{ K00, KC_NO, K02, K03, KC_NO }, \
{ K10, K11, K12, K13, KC_NO }, \
{ K20, K21, K22, K23, K24 }, \
{ K30, K31, K32, K33, KC_NO }, \
{ K40, K41, K42, K43, K44 }, \
{ K50, K51, K52, K53, K54 }, \
{ K00, XXX, K02, K03, XXX }, \
{ K10, K11, K12, K13, XXX }, \
{ K20, K21, K22, K23, K24 }, \
{ K30, K31, K32, K33, XXX }, \
{ K40, K41, K42, K43, K44 }, \
{ K50, K51, K52, K53, K54 }, \
}
#define LAYOUT_numpad( \
K00, K02, K03, \
K10, K11, K12, K13, \
K20, K21, K22, \
K30, K31, K32, K24, \
K40, K41, K42, \
K54, K52, K44 \
) { \
{ K00, XXX, K02, K03, XXX }, \
{ K10, K11, K12, K13, XXX }, \
{ K20, K21, K22, XXX, K24 }, \
{ K30, K31, K32, XXX, XXX }, \
{ K40, K41, K42, XXX, K44 }, \
{ XXX, XXX, K52, XXX, K54 }, \
}
#define LAYOUT_ortho( \
K00, K02, K03, \
K10, K11, K12, K13, \
K20, K21, K22, K23, \
K30, K31, K32, K33, \
K40, K41, K42, K43, \
K50, K51, K52, K53 \
) { \
{ K00, XXX, K02, K03, XXX }, \
{ K10, K11, K12, K13, XXX }, \
{ K20, K21, K22, K23, XXX }, \
{ K30, K31, K32, K33, XXX }, \
{ K40, K41, K42, K43, XXX }, \
{ K50, K51, K52, K53, XXX }, \
}

View file

@ -2,7 +2,7 @@
* Keyboard Maintainer: [Sleepdealer](https://github.com/Sleepdealr)
* Hardware Supported: Puca Pad
* Hardware Availability: Puca GB
* Hardware Availability: [Puca GB](https://ffkeebs.com/collections/puca)
## Bootloader

View file

@ -19,7 +19,7 @@ NKRO_ENABLE = no # USB Nkey Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
ENCODER_ENABLE = yes #Rotary encoder
ENCODER_ENABLE = yes # Enable rotary encoder support
OLED_ENABLE = yes # Enable OLED support
OLED_ENABLE = yes #OLED
LTO_ENABLE = yes # Enable Link Time Optimization to reduce firmware size
LTO_ENABLE = yes # Enable Link Time Optimization to reduce firmware size