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

View File

@ -118,11 +118,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-------------------'
*/
[_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_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_P0, KC_DBL0, KC_PDOT, KC_PENT
KC_NO, KC_P0, KC_PDOT, KC_PENT
),
/* Keymap _NV: Navigation layer
@ -143,7 +143,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_DEL, KC_END, KC_PGDN,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, 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
@ -162,7 +162,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_FN] = LAYOUT(
RGB_MOD, RGB_M_P, RGB_TOG, _______,
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,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
),
@ -170,9 +170,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
void keyboard_post_init_user(void) {
// Customise these values to desired behaviour
rgblight_mode(23);
debug_enable=true;
debug_matrix=true;
// rgblight_mode(23);
// debug_enable=true;
// debug_matrix=true;
//debug_keyboard=true;
//debug_mouse=true;
}
@ -191,7 +191,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
};
bool encoder_update_user(uint8_t index, bool clockwise) {
switch (get_highest_layer(layer_state)) {
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
Copyright (c) 2019 Mattia Dal Ben
Copyright (c) 2021 Josh Johnson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -22,7 +23,6 @@ SOFTWARE.
*/
#include QMK_KEYBOARD_H
#include <stdio.h>
// 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.
@ -40,66 +40,66 @@ enum custom_keycodes {
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap _BL: (Base Layer) Default Layer
* ,-------------------.
* | NV | / | * |-/FN|
* |----|----|----|----|
* | 7 | 8 | 9 | |
* |----|----|----| + |
* | 4 | 5 | 6 | |
* |----|----|----|----|
* | 1 | 2 | 3 | |
* |----|----|----| En |
* | 0 | 00 | . | |
* `-------------------'
* ,-------------------.
* | NV | / | * |-/FN|
* |----|----|----|----|
* | 7 | 8 | 9 | |
*,----|----|----|----| + |
*| PP | 4 | 5 | 6 | |
*'----|----|----|----|----|
* | 1 | 2 | 3 | |
* |----|----|----| En |
* | 0 | 00 | . | |
* `-------------------'
*/
[_BL] = LAYOUT(
TG(_NV), KC_PSLS, KC_PAST, LT(_FN, 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_DBL0, KC_PDOT, KC_PENT
TG(_NV), KC_PSLS, KC_PAST, LT(_FN, KC_PMNS),
KC_P7, KC_P8, KC_P9,
KC_MPLY, KC_P4, KC_P5, KC_P6, KC_PPLS,
KC_P1, KC_P2, KC_P3,
KC_P0, KC_DBL0, KC_PDOT, KC_PENT
),
/* Keymap _NV: Navigation layer
* ,-------------------.
* |INS |HOME|PGUP| |
* |----|----|----|----|
* |DEL |END |PGDN| |
* |----|----|----| |
* | | | | |
* |----|----|----|----|
* | | UP | | |
* |----|----|----| |
* |LEFT|DOWN|RIGH| |
* `-------------------'
* ,-------------------.
* |INS |HOME|PGUP| |
* |----|----|----|----|
* |DEL |END |PGDN| |
* ,----|----|----|----| |
* | | | | | |
* '----|----|----|----|----|
* | | UP | | |
* |----|----|----| |
* |LEFT|DOWN|RIGH| |
* `-------------------'
*/
[_NV] = LAYOUT(
KC_INS, KC_HOME, KC_PGUP, TG(_NV),
KC_DEL, KC_END, KC_PGDN,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, KC_UP, XXXXXXX,
KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX
KC_INS, KC_HOME, KC_PGUP, TG(_NV),
KC_DEL, KC_END, KC_PGDN,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, KC_UP, XXXXXXX,
KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX
),
/* Keymap _FN: RGB Function Layer
* ,-------------------.
* |RMOD|RGBP|RTOG| FN |
* |----|----|----|----|
* |HUD |HUI | | |
* |----|----|----| |
* |SAD |SAI | | |
* |----|----|----|----|
* |VAD |VAS | | |
* |----|----|----| |
* |RST | | | |
* `-------------------'
* ,-------------------.
* |RMOD|RGBP|RTOG| FN |
* |----|----|----|----|
* |HUD |HUI | | |
* ,---- |----|----|----| |
* | |SAD |SAI | | |
* '---- |----|----|----|----|
* |VAD |VAS | | |
* |----|----|----| |
* |RST | | | |
* `-------------------'
*/
[_FN] = LAYOUT(
RGB_MOD, RGB_M_P, RGB_TOG, _______,
RGB_HUD, RGB_HUI, XXXXXXX,
RGB_SAD, RGB_SAI, XXXXXXX, XXXXXXX,
RGB_VAD, RGB_VAI, XXXXXXX,
KC_LEFT, XXXXXXX, XXXXXXX, XXXXXXX
RGB_MOD, RGB_M_P, RGB_TOG, _______,
RGB_HUD, RGB_HUI, XXXXXXX,
XXXXXXX, RGB_SAD, RGB_SAI, XXXXXXX, XXXXXXX,
RGB_VAD, RGB_VAI, XXXXXXX,
KC_NO, XXXXXXX, XXXXXXX, XXXXXXX
),
};
@ -117,6 +117,17 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
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
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
@ -161,6 +172,6 @@ bool oled_task_user(void) {
(uint8_t)(rgblight_get_val() / RGBLIGHT_VAL_STEP));
oled_write(led_buf, false);
return false;
return false;
}
#endif

View File

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

View File

@ -3,15 +3,14 @@
![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.
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)
* Hardware Supported: kb2040, (RP2040)
* Keyboard Maintainer: [mattdibi](https://github.com/mattdibi)
* Hardware Supported: Pro Micro, (ATmega32u4)
* Hardware Availability: https://github.com/mattdibi/yampad
Make example for this keyboard (after setting up your build environment):
make 01_yam:default
make yampad:default
Flashing example for this keyboard:

View File

@ -22,4 +22,5 @@ RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
ALLOW_WARNINGS = yes
PICO_INTRINSICS_ENABLED = no # ATM Unsupported by ChibiOS!
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"
]
]
}
}