Update yampad kb2040 files

This commit is contained in:
Benjamyn Love 2022-05-02 00:19:54 +10:00
parent fc37ac157f
commit 5f567b7a1a
8 changed files with 152 additions and 66 deletions

View File

@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_COLS 4 #define MATRIX_COLS 4
/* define nop_fudge */ /* define nop_fudge */
#define NOP_FUDGE 0.1 #define NOP_FUDGE 0.4
/* /*
* Keyboard Matrix Assignments * Keyboard Matrix Assignments
@ -52,6 +52,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* ENCOOOOOOOOOOOOODER */ /* ENCOOOOOOOOOOOOODER */
#define ENCODERS_PAD_A { GP27 } #define ENCODERS_PAD_A { GP27 }
#define ENCODERS_PAD_B { GP28 } #define ENCODERS_PAD_B { GP28 }
#define ENCODER_RESOLUTION 4
/* Gimme dat double reset boi */ /* Gimme dat double reset boi */
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET #define RP2040_BOOTLOADER_DOUBLE_TAP_RESET
@ -63,6 +64,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGB_DI_PIN GP29 #define RGB_DI_PIN GP29
#define RGBLED_NUM 9 #define RGBLED_NUM 9
#define RGBLIGHT_ANIMATIONS #define RGBLIGHT_ANIMATIONS
#define RGBLIGHT_DEFAULT_HUE 230
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 2 #define DEBOUNCE 2
@ -72,7 +74,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define I2C1_SCL_PIN GP3 #define I2C1_SCL_PIN GP3
#define I2C_DRIVER I2CD2 #define I2C_DRIVER I2CD2
/* Test EEPROM */
//#define TRANSIENT_EEPROM_SIZE 1024
/* define if matrix has ghost (lacks anti-ghosting diodes) */ /* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST //#define MATRIX_HAS_GHOST

View File

@ -118,11 +118,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-------------------' * `-------------------'
*/ */
[_BL] = LAYOUT( [_BL] = LAYOUT(
TG(_NV), KC_PSLS, KC_PAST, LT(_FN, KC_PMNS), LT(_NV, KC_NUM), KC_PSLS, KC_PAST, LT(_FN, KC_PMNS),
KC_P7, KC_P8, KC_P9, KC_P7, KC_P8, KC_P9,
KC_KB_VOLUME_DOWN, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_AUDIO_MUTE, KC_P4, KC_P5, KC_P6, KC_PPLS,
KC_P1, KC_P2, KC_P3, KC_P1, KC_P2, KC_P3,
KC_P0, KC_DBL0, KC_PDOT, KC_PENT KC_NO, KC_P0, KC_PDOT, KC_PENT
), ),
/* Keymap _NV: Navigation layer /* Keymap _NV: Navigation layer
@ -143,7 +143,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_DEL, KC_END, KC_PGDN, KC_DEL, KC_END, KC_PGDN,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, KC_UP, XXXXXXX, XXXXXXX, KC_UP, XXXXXXX,
KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX KC_LEFT, KC_DOWN, KC_RGHT, QK_BOOTLOADER
), ),
/* Keymap _FN: RGB Function Layer /* Keymap _FN: RGB Function Layer
@ -162,7 +162,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_FN] = LAYOUT( [_FN] = LAYOUT(
RGB_MOD, RGB_M_P, RGB_TOG, _______, RGB_MOD, RGB_M_P, RGB_TOG, _______,
RGB_HUD, RGB_HUI, XXXXXXX, RGB_HUD, RGB_HUI, XXXXXXX,
XXXXXXX, RGB_SAD, RGB_SAI, XXXXXXX, XXXXXXX, RGB_TOG, RGB_SAD, RGB_SAI, XXXXXXX, XXXXXXX,
RGB_VAD, RGB_VAI, XXXXXXX, RGB_VAD, RGB_VAI, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
), ),
@ -170,9 +170,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
void keyboard_post_init_user(void) { void keyboard_post_init_user(void) {
// Customise these values to desired behaviour // Customise these values to desired behaviour
rgblight_mode(23); // rgblight_mode(23);
debug_enable=true; // debug_enable=true;
debug_matrix=true; // debug_matrix=true;
//debug_keyboard=true; //debug_keyboard=true;
//debug_mouse=true; //debug_mouse=true;
} }
@ -191,7 +191,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true; return true;
}; };
bool encoder_update_user(uint8_t index, bool clockwise) { bool encoder_update_user(uint8_t index, bool clockwise) {
switch (get_highest_layer(layer_state)) { switch (get_highest_layer(layer_state)) {
case _FN: case _FN:

4
keymaps/via/config.h Normal file
View File

@ -0,0 +1,4 @@
#pragma once
#define TRANSIENT_EEPROM_SIZE 512

View File

@ -1,6 +1,7 @@
/* MIT License /* MIT License
Copyright (c) 2019 Mattia Dal Ben Copyright (c) 2019 Mattia Dal Ben
Copyright (c) 2021 Josh Johnson
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@ -22,7 +23,6 @@ SOFTWARE.
*/ */
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
#include <stdio.h>
// Each layer gets a name for readability, which is then used in the keymap matrix below. // Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name. // The underscores don't mean anything - you can have a layer called STUFF or any other name.
@ -44,9 +44,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | NV | / | * |-/FN| * | NV | / | * |-/FN|
* |----|----|----|----| * |----|----|----|----|
* | 7 | 8 | 9 | | * | 7 | 8 | 9 | |
* |----|----|----| + | *,----|----|----|----| + |
* | 4 | 5 | 6 | | *| PP | 4 | 5 | 6 | |
* |----|----|----|----| *'----|----|----|----|----|
* | 1 | 2 | 3 | | * | 1 | 2 | 3 | |
* |----|----|----| En | * |----|----|----| En |
* | 0 | 00 | . | | * | 0 | 00 | . | |
@ -55,7 +55,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BL] = LAYOUT( [_BL] = LAYOUT(
TG(_NV), KC_PSLS, KC_PAST, LT(_FN, KC_PMNS), TG(_NV), KC_PSLS, KC_PAST, LT(_FN, KC_PMNS),
KC_P7, KC_P8, KC_P9, KC_P7, KC_P8, KC_P9,
KC_P4, KC_P5, KC_P6, KC_PPLS, KC_MPLY, KC_P4, KC_P5, KC_P6, KC_PPLS,
KC_P1, KC_P2, KC_P3, KC_P1, KC_P2, KC_P3,
KC_P0, KC_DBL0, KC_PDOT, KC_PENT KC_P0, KC_DBL0, KC_PDOT, KC_PENT
), ),
@ -65,9 +65,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |INS |HOME|PGUP| | * |INS |HOME|PGUP| |
* |----|----|----|----| * |----|----|----|----|
* |DEL |END |PGDN| | * |DEL |END |PGDN| |
* |----|----|----| | * ,----|----|----|----| |
* | | | | | * | | | | | |
* |----|----|----|----| * '----|----|----|----|----|
* | | UP | | | * | | UP | | |
* |----|----|----| | * |----|----|----| |
* |LEFT|DOWN|RIGH| | * |LEFT|DOWN|RIGH| |
@ -76,7 +76,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_NV] = LAYOUT( [_NV] = LAYOUT(
KC_INS, KC_HOME, KC_PGUP, TG(_NV), KC_INS, KC_HOME, KC_PGUP, TG(_NV),
KC_DEL, KC_END, KC_PGDN, KC_DEL, KC_END, KC_PGDN,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, KC_UP, XXXXXXX, XXXXXXX, KC_UP, XXXXXXX,
KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX
), ),
@ -86,9 +86,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |RMOD|RGBP|RTOG| FN | * |RMOD|RGBP|RTOG| FN |
* |----|----|----|----| * |----|----|----|----|
* |HUD |HUI | | | * |HUD |HUI | | |
* |----|----|----| | * ,---- |----|----|----| |
* |SAD |SAI | | | * | |SAD |SAI | | |
* |----|----|----|----| * '---- |----|----|----|----|
* |VAD |VAS | | | * |VAD |VAS | | |
* |----|----|----| | * |----|----|----| |
* |RST | | | | * |RST | | | |
@ -97,9 +97,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_FN] = LAYOUT( [_FN] = LAYOUT(
RGB_MOD, RGB_M_P, RGB_TOG, _______, RGB_MOD, RGB_M_P, RGB_TOG, _______,
RGB_HUD, RGB_HUI, XXXXXXX, RGB_HUD, RGB_HUI, XXXXXXX,
RGB_SAD, RGB_SAI, XXXXXXX, XXXXXXX, XXXXXXX, RGB_SAD, RGB_SAI, XXXXXXX, XXXXXXX,
RGB_VAD, RGB_VAI, XXXXXXX, RGB_VAD, RGB_VAI, XXXXXXX,
KC_LEFT, XXXXXXX, XXXXXXX, XXXXXXX KC_NO, XXXXXXX, XXXXXXX, XXXXXXX
), ),
}; };
@ -117,6 +117,17 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true; return true;
}; };
bool encoder_update_user(uint8_t index, bool clockwise) {
if (clockwise)
{
tap_code(KC_VOLU);
} else
{
tap_code(KC_VOLD);
}
return true;
}
#ifdef OLED_ENABLE #ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) { oled_rotation_t oled_init_user(oled_rotation_t rotation) {

View File

@ -2,3 +2,5 @@ EXTRAKEY_ENABLE = no
LTO_ENABLE = yes LTO_ENABLE = yes
MOUSEKEY_ENABLE = no MOUSEKEY_ENABLE = no
VIA_ENABLE = yes VIA_ENABLE = yes
EEPROM_DRIVER = transient

View File

@ -3,15 +3,14 @@
![yampad](https://github.com/mattdibi/yampad/blob/master/img/yampad.jpg) ![yampad](https://github.com/mattdibi/yampad/blob/master/img/yampad.jpg)
The Yampad project is an open-source, QMK (Quantum Mechanical Keyboard Firmware) powered, hot-swappable, RGB-backlighted, OLED featured, mechanical numpad. This repository will be used to share information about the project and instruction on how to use and assemble the Yampad. The Yampad project is an open-source, QMK (Quantum Mechanical Keyboard Firmware) powered, hot-swappable, RGB-backlighted, OLED featured, mechanical numpad. This repository will be used to share information about the project and instruction on how to use and assemble the Yampad.
It has been modified to add an encoder and run using the KB2040 instead of a Pro Micro (Special thanks to KarlK90 for their work on the RP2040 support in QMK https://github.com/qmk/qmk_firmware/pull/14877)
* Keyboard fork Maintainer: [ben&jamyn](https://git.lovelynet.net/benjamyn) * Keyboard Maintainer: [mattdibi](https://github.com/mattdibi)
* Hardware Supported: kb2040, (RP2040) * Hardware Supported: Pro Micro, (ATmega32u4)
* Hardware Availability: https://github.com/mattdibi/yampad * Hardware Availability: https://github.com/mattdibi/yampad
Make example for this keyboard (after setting up your build environment): Make example for this keyboard (after setting up your build environment):
make 01_yam:default make yampad:default
Flashing example for this keyboard: Flashing example for this keyboard:

View File

@ -23,3 +23,4 @@ ALLOW_WARNINGS = yes
PICO_INTRINSICS_ENABLED = no # ATM Unsupported by ChibiOS! PICO_INTRINSICS_ENABLED = no # ATM Unsupported by ChibiOS!
ENCODER_ENABLE = yes ENCODER_ENABLE = yes
WS2812_DRIVER = pio WS2812_DRIVER = pio

67
yampad.json Normal file
View File

@ -0,0 +1,67 @@
{
"name": "Yampad",
"vendorId": "0xCAFE",
"productId": "0xBEEF",
"lighting": "qmk_rgblight",
"matrix": { "rows": 5, "cols": 4 },
"layouts": {
"labels": ["2U '0'"],
"keymap": [
[
{
"x": 1
},
"0,0",
"0,1",
"0,2",
"0,3"
],
[
{
"x": 1
},
"1,0",
"1,1",
"1,2",
{
"h": 2
},
"1,3"
],
[
"3,3",
"2,0",
"2,1",
"2,2"
],
[
{
"x": 1
},
"3,0",
"3,1",
"3,2",
{
"h": 2
},
"4,3"
],
[
{
"x": 1
},
"4,0\n\n\n0,0",
"4,1\n\n\n0,0",
"4,2"
],
[
{
"y": 0.25,
"x": 1,
"w": 2
},
"4,1\n\n\n0,1"
]
]
}
}