This commit is contained in:
Benjamyn Love 2022-04-29 15:04:33 +10:00
commit fc37ac157f
13 changed files with 942 additions and 0 deletions

68
01_yam.c Normal file
View File

@ -0,0 +1,68 @@
/* Copyright 2019
*
* 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 "01_yam.h"
#include <stdio.h>
#if defined(OLED_ENABLE)
oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
return OLED_ROTATION_270;
}
bool oled_task_kb(void) {
if (!oled_task_user()) {
return false;
}
// Host Keyboard Layer Status
oled_write_P(PSTR("Layer"), false);
switch (get_highest_layer(layer_state)) {
case 0:
oled_write_ln_P(PSTR(" BAS"), false);
break;
case 1:
oled_write_ln_P(PSTR(" NAV"), false);
break;
case 2:
oled_write_ln_P(PSTR(" RGB"), false);
break;
default:
// Or use the write_ln shortcut over adding '\n' to the end of your string
oled_write_ln_P(PSTR(" UND"), false);
}
// Host Keyboard LED Status
led_t led_state = host_keyboard_led_state();
oled_write_P(PSTR("-----"), false);
oled_write_P(PSTR("Stats"), false);
oled_write_P(led_state.num_lock ? PSTR("num:*") : PSTR("num:."), false);
oled_write_P(led_state.caps_lock ? PSTR("cap:*") : PSTR("cap:."), false);
oled_write_P(led_state.scroll_lock ? PSTR("scr:*") : PSTR("scr:."), false);
// Host Keyboard RGB backlight status
oled_write_P(PSTR("-----"), false);
oled_write_P(PSTR("Light"), false);
static char led_buf[30];
snprintf(led_buf, sizeof(led_buf) - 1, "RGB:%cM: %2d\nh: %2ds: %2dv: %2d\n",
rgblight_is_enabled() ? '*' : '.', (uint8_t)rgblight_get_mode(),
(uint8_t)(rgblight_get_hue() / RGBLIGHT_HUE_STEP),
(uint8_t)(rgblight_get_sat() / RGBLIGHT_SAT_STEP),
(uint8_t)(rgblight_get_val() / RGBLIGHT_VAL_STEP));
oled_write(led_buf, false);
return false;
}
#endif

72
01_yam.h Normal file
View File

@ -0,0 +1,72 @@
/* Copyright 2019
*
* 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/>.
*/
#pragma once
#include "quantum.h"
#define ___ KC_NO
/* This a shortcut to help you visually see your layout.
*
* The first section contains all of the arguments representing the physical
* layout of the board and position of the keys.
*
* The second converts the arguments into a two-dimensional array which
* represents the switch matrix.
*/
/* COSPAD numpad matrix layout
* ,-------------------.
* | 00 | 01 | 02 | 03 |
* |----|----|----|----|
* | 10 | 11 | 12 | |
* |----|----|----| 13 |
* | 20 | 21 | 22 | |
* |----|----|----|----|
* | 30 | 31 | 32 | |
* |----|----|----| 43 |
* | 40 | 41 | 42 | |
* `-------------------'
*/
// #define LAYOUT( \
// k00, k01, k02, k03, \
// k10, k11, k12, \
// k20, k21, k22, k13, \
// k30, k31, k32, \
// k40, k41, k42, k43 \
// ) \
// { \
// {k00, k01, k02, k03}, \
// {k10, k11, k12, k13}, \
// {k20, k21, k22, ___}, \
// {k30, k31, k32, ___}, \
// {k40, k41, k42, k43} \
// }
#define LAYOUT( \
k00, k01, k02, k03, \
k10, k11, k12, \
k33, k20, k21, k22, k13, \
k30, k31, k32, \
k40, k41, k42, k43 \
) \
{ \
{k00, k01, k02, k03}, \
{k10, k11, k12, k13}, \
{k20, k21, k22, ___}, \
{k30, k31, k32, k33}, \
{k40, k41, k42, k43} \
}

102
config.h Normal file
View File

@ -0,0 +1,102 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
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/>.
*/
#pragma once
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xCAFE // YP
#define PRODUCT_ID 0xBEEF
#define DEVICE_VER 0x0001
#define MANUFACTURER Mattia Dal Ben
#define PRODUCT Yampad
/* key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 4
/* define nop_fudge */
#define NOP_FUDGE 0.1
/*
* Keyboard Matrix Assignments
*
* Change this to how you wired your keyboard
* COLS: AVR pins used for columns, left to right
* ROWS: AVR pins used for rows, top to bottom
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
*
*/
#define MATRIX_ROW_PINS { GP5, GP6, GP7, GP8, GP9 }
#define MATRIX_COL_PINS { GP18, GP20, GP19, GP10 }
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* ENCOOOOOOOOOOOOODER */
#define ENCODERS_PAD_A { GP27 }
#define ENCODERS_PAD_B { GP28 }
/* Gimme dat double reset boi */
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP25
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U
/* Underlight configuration */
#define RGB_DI_PIN GP29
#define RGBLED_NUM 9
#define RGBLIGHT_ANIMATIONS
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 2
/* OLED pins */
#define I2C1_SDA_PIN GP2
#define I2C1_SCL_PIN GP3
#define I2C_DRIVER I2CD2
/* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
//#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
//#define LOCKING_RESYNC_ENABLE
/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/
/* disable debug print */
//#define NO_DEBUG
/* disable print */
//#define NO_PRINT
/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT
/* Bootmagic Lite key configuration */
// #define BOOTMAGIC_LITE_ROW 0
// #define BOOTMAGIC_LITE_COLUMN 0

5
halconf.h Normal file
View File

@ -0,0 +1,5 @@
#pragma once
#define HAL_USE_I2C TRUE
#include_next <halconf.h>

34
info.json Normal file
View File

@ -0,0 +1,34 @@
{
"keyboard_name": "Yampad",
"url": "",
"maintainer": "mattdibi",
"layouts": {
"LAYOUT": {
"layout": [
{"label":"k00", "x":1, "y":1},
{"label":"k01", "x":2, "y":1},
{"label":"k02", "x":3, "y":1},
{"label":"k03", "x":4, "y":1},
{"label":"k10", "x":1, "y":2},
{"label":"k11", "x":2, "y":2},
{"label":"k12", "x":3, "y":2},
{"label":"k20", "x":1, "y":3},
{"label":"k21", "x":2, "y":3},
{"label":"k22", "x":3, "y":3},
{"label":"k14", "x":4, "y":2, "h":3},
{"label":"k33", "x":0, "y":3},
{"label":"k30", "x":1, "y":4},
{"label":"k31", "x":2, "y":4},
{"label":"k32", "x":3, "y":4},
{"label":"k40", "x":1, "y":4},
{"label":"k41", "x":2, "y":4},
{"label":"k42", "x":3, "y":4},
{"label":"k43", "x":4, "y":4, "h":3}
]
}
}
}

266
keymaps/default/keymap.c Normal file
View File

@ -0,0 +1,266 @@
/* MIT License
Copyright (c) 2019 Mattia Dal Ben
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
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.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
enum layers {
_BL,
_NV,
_FN
};
enum custom_keycodes {
KC_DBL0 = SAFE_RANGE,
};
// 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 | . | |
// * `-------------------'
// */
// [_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_P0, KC_PDOT, KC_PENT
// ),
// /* Keymap _NV: Navigation layer
// * ,-------------------.
// * |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, TG(_FN),
// 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 | | | |
// * `-------------------'
// */
// [_FN] = LAYOUT(
// RGB_MOD, RGB_M_P, RGB_TOG, _______,
// RGB_HUD, RGB_HUI, XXXXXXX,
// RGB_SAD, RGB_SAI, XXXXXXX, TG(_FN),
// RGB_VAD, RGB_VAI, XXXXXXX,
// RGB_TOG, XXXXXXX, XXXXXXX, XXXXXXX
// ),
// };
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap _BL: (Base Layer) Default Layer
* ,-------------------.
* | 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_KB_VOLUME_DOWN, 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| |
* `-------------------'
*/
[_NV] = LAYOUT(
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 | | | |
* `-------------------'
*/
[_FN] = LAYOUT(
RGB_MOD, RGB_M_P, RGB_TOG, _______,
RGB_HUD, RGB_HUI, XXXXXXX,
XXXXXXX, RGB_SAD, RGB_SAI, XXXXXXX, XXXXXXX,
RGB_VAD, RGB_VAI, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
),
};
void keyboard_post_init_user(void) {
// Customise these values to desired behaviour
rgblight_mode(23);
debug_enable=true;
debug_matrix=true;
//debug_keyboard=true;
//debug_mouse=true;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_DBL0:
if (record->event.pressed) {
SEND_STRING("00");
} else {
// when keycode KC_DBL0 is released
}
break;
}
return true;
};
bool encoder_update_user(uint8_t index, bool clockwise) {
switch (get_highest_layer(layer_state)) {
case _FN:
if (clockwise)
{
rgblight_increase_hue_noeeprom();
} else
{
rgblight_decrease_hue_noeeprom();
}
break;
default:
if (clockwise)
{
tap_code(KC_KB_VOLUME_UP);
} else
{
tap_code(KC_KB_VOLUME_DOWN);
}
break;
}
return true;
}
#ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_270; // flips the display 270 degrees
}
bool oled_task_user(void) {
// Host Keyboard Layer Status
oled_write_P(PSTR("Layer"), false);
switch (get_highest_layer(layer_state)) {
case _BL:
oled_write_P(PSTR(" BAS\n"), false);
break;
case _NV:
oled_write_P(PSTR(" NAV\n"), false);
break;
case _FN:
oled_write_P(PSTR(" RGB\n"), false);
break;
default:
// Or use the write_ln shortcut over adding '\n' to the end of your string
oled_write_P(PSTR(" UND\n"), false);
}
// Host Keyboard LED Status
led_t led_state = host_keyboard_led_state();
oled_write_P(PSTR("-----"), false);
oled_write_P(PSTR("Stats"), false);
oled_write_P(led_state.num_lock ? PSTR("num:*") : PSTR("num:."), false);
oled_write_P(led_state.caps_lock ? PSTR("cap:*") : PSTR("cap:."), false);
oled_write_P(led_state.scroll_lock ? PSTR("scr:*") : PSTR("scr:."), false);
// Host Keyboard RGB backlight status
oled_write_P(PSTR("-----"), false);
oled_write_P(PSTR("Light"), false);
static char led_buf[30];
snprintf(led_buf, sizeof(led_buf) - 1, "RGB:%cM: %2d\nh: %2ds: %2dv: %2d\n",
rgblight_is_enabled() ? '*' : '.', (uint8_t)rgblight_get_mode(),
(uint8_t)(rgblight_get_hue() / RGBLIGHT_HUE_STEP),
(uint8_t)(rgblight_get_sat() / RGBLIGHT_SAT_STEP),
(uint8_t)(rgblight_get_val() / RGBLIGHT_VAL_STEP));
oled_write(led_buf, false);
return false;
}
#endif

View File

@ -0,0 +1,165 @@
/* MIT License
Copyright (c) 2020 Richard Davey (Daveyr)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include QMK_KEYBOARD_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.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
enum layers {
_BL = 0,
_NV,
_FN
};
enum custom_keycodes {
KC_DBL0 = SAFE_RANGE,
};
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 | . | |
* `-------------------'
*/
[_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
),
/* Keymap _NV: Navigation layer
* ,-------------------.
* |INS |BSPC| | |
* |----|----|----|----|
* |HOME| UP |PGUP| |
* |----|----|----| |
* |LEFT|DEL |RGHT| |
* |----|----|----|----|
* |END |DOWN|PGDN| |
* |----|----|----| |
* | | | | |
* `-------------------'
*/
[_NV] = LAYOUT(
KC_INS, KC_BSPACE, XXXXXXX, TG(_NV),
KC_HOME, KC_UP, KC_PGUP,
KC_LEFT, KC_DEL, KC_RGHT, XXXXXXX,
KC_END, KC_DOWN, KC_PGDN,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
),
/* Keymap _FN: RGB Function Layer
* ,-------------------.
* |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,
RESET, XXXXXXX, XXXXXXX, XXXXXXX
),
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_DBL0:
if (record->event.pressed) {
SEND_STRING("00");
} else {
// when keycode KC_DBL0 is released
}
break;
}
return true;
};
#ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_270; // flips the display 270 degrees
}
bool oled_task_user(void) {
// Host Keyboard Layer Status
oled_write_P(PSTR("Layer"), false);
switch (get_highest_layer(layer_state)) {
case _BL:
oled_write_ln_P(PSTR(" BAS"), false);
break;
case _NV:
oled_write_ln_P(PSTR(" NAV"), false);
break;
case _FN:
oled_write_ln_P(PSTR(" RGB"), false);
break;
default:
// Or use the write_ln shortcut over adding '\n' to the end of your string
oled_write_ln_P(PSTR(" UND"), false);
}
// Host Keyboard LED Status
led_t led_state = host_keyboard_led_state();
oled_write_P(PSTR("-----"), false);
oled_write_P(PSTR("Stats"), false);
oled_write_P(led_state.num_lock ? PSTR("num:*") : PSTR("num:."), false);
oled_write_P(led_state.caps_lock ? PSTR("cap:*") : PSTR("cap:."), false);
oled_write_P(led_state.scroll_lock ? PSTR("scr:*") : PSTR("scr:."), false);
// Host Keyboard RGB backlight status
oled_write_P(PSTR("-----"), false);
oled_write_P(PSTR("Light"), false);
static char led_buf[30];
snprintf(led_buf, sizeof(led_buf) - 1, "RGB:%cM: %2d\nh: %2ds: %2dv: %2d\n",
rgblight_is_enabled() ? '*' : '.', (uint8_t)rgblight_get_mode(),
(uint8_t)(rgblight_get_hue() / RGBLIGHT_HUE_STEP),
(uint8_t)(rgblight_get_sat() / RGBLIGHT_SAT_STEP),
(uint8_t)(rgblight_get_val() / RGBLIGHT_VAL_STEP));
oled_write(led_buf, false);
return false;
}
#endif

166
keymaps/via/keymap.c Normal file
View File

@ -0,0 +1,166 @@
/* MIT License
Copyright (c) 2019 Mattia Dal Ben
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
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.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
enum layers {
_BL,
_NV,
_FN
};
enum custom_keycodes {
KC_DBL0 = SAFE_RANGE,
};
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 | . | |
* `-------------------'
*/
[_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
),
/* Keymap _NV: Navigation layer
* ,-------------------.
* |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
),
/* Keymap _FN: RGB Function Layer
* ,-------------------.
* |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
),
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_DBL0:
if (record->event.pressed) {
SEND_STRING("00");
} else {
// when keycode KC_DBL0 is released
}
break;
}
return true;
};
#ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_270; // flips the display 270 degrees
}
bool oled_task_user(void) {
// Host Keyboard Layer Status
oled_write_P(PSTR("Layer"), false);
switch (get_highest_layer(layer_state)) {
case _BL:
oled_write_ln_P(PSTR(" BAS"), false);
break;
case _NV:
oled_write_ln_P(PSTR(" NAV"), false);
break;
case _FN:
oled_write_ln_P(PSTR(" RGB"), false);
break;
default:
// Or use the write_ln shortcut over adding '\n' to the end of your string
oled_write_ln_P(PSTR(" UND"), false);
}
// Host Keyboard LED Status
led_t led_state = host_keyboard_led_state();
oled_write_P(PSTR("-----"), false);
oled_write_P(PSTR("Stats"), false);
oled_write_P(led_state.num_lock ? PSTR("num:*") : PSTR("num:."), false);
oled_write_P(led_state.caps_lock ? PSTR("cap:*") : PSTR("cap:."), false);
oled_write_P(led_state.scroll_lock ? PSTR("scr:*") : PSTR("scr:."), false);
// Host Keyboard RGB backlight status
oled_write_P(PSTR("-----"), false);
oled_write_P(PSTR("Light"), false);
static char led_buf[30];
snprintf(led_buf, sizeof(led_buf) - 1, "RGB:%cM: %2d\nh: %2ds: %2dv: %2d\n",
rgblight_is_enabled() ? '*' : '.', (uint8_t)rgblight_get_mode(),
(uint8_t)(rgblight_get_hue() / RGBLIGHT_HUE_STEP),
(uint8_t)(rgblight_get_sat() / RGBLIGHT_SAT_STEP),
(uint8_t)(rgblight_get_val() / RGBLIGHT_VAL_STEP));
oled_write(led_buf, false);
return false;
}
#endif

9
keymaps/via/readme.md Normal file
View File

@ -0,0 +1,9 @@
![Yampad Layout Image](https://i.imgur.com/QwrufEt.png)
# VIA Yampad Layout
This is the layout in the VIA enabled firmware.
Optional 2U zero key to suit your Yampad build.
Compile: `make yampad:via`
Flash: `make yampad:via:flash`

4
keymaps/via/rules.mk Normal file
View File

@ -0,0 +1,4 @@
EXTRAKEY_ENABLE = no
LTO_ENABLE = yes
MOUSEKEY_ENABLE = no
VIA_ENABLE = yes

6
mcuconf.h Normal file
View File

@ -0,0 +1,6 @@
#pragma once
#include_next <mcuconf.h>
#undef RP_I2C_USE_I2C1
#define RP_I2C_USE_I2C1 TRUE

20
readme.md Normal file
View File

@ -0,0 +1,20 @@
# Yampad
![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)
* Hardware Availability: https://github.com/mattdibi/yampad
Make example for this keyboard (after setting up your build environment):
make 01_yam:default
Flashing example for this keyboard:
make yampad: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).

25
rules.mk Normal file
View File

@ -0,0 +1,25 @@
# MCU name
MCU = RP2040
BOOTLOADER = rp2040
# Build Options
# change yes to no to disable
#
AUDIO_ENABLE = no # Audio output
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
COMMAND_ENABLE = yes # Commands for debug and configuration
CONSOLE_ENABLE = yes # Console for debug
DEBOUNCE_TYPE = sym_eager_pk
EXTRAKEY_ENABLE = yes # Audio control and System control
LTO_ENABLE = yes # Link time optimise, reduce firmware size
MOUSEKEY_ENABLE = no # Mouse keys
NKRO_ENABLE = yes # Enable N-Key Rollover
OLED_DRIVER = SSD1306
OLED_ENABLE = yes
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
ALLOW_WARNINGS = yes
PICO_INTRINSICS_ENABLED = no # ATM Unsupported by ChibiOS!
ENCODER_ENABLE = yes
WS2812_DRIVER = pio