From 8f4603dd734f5d70e9a89a5150821acd0dc77f7c Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 14 May 2021 04:33:36 +0200 Subject: [PATCH] [Keyboard] Add Plaid-Pad Rev3 and oled keymap (#12464) Co-authored-by: Erovia --- keyboards/keycapsss/plaid_pad/config.h | 7 +- .../plaid_pad/keymaps/default/keymap.c | 20 +- .../keycapsss/plaid_pad/keymaps/oled/config.h | 22 ++ .../plaid_pad/keymaps/oled/glcdfont.c | 250 ++++++++++++++++++ .../keycapsss/plaid_pad/keymaps/oled/keymap.c | 228 ++++++++++++++++ .../plaid_pad/keymaps/oled/readme.md | 29 ++ .../keycapsss/plaid_pad/keymaps/oled/rules.mk | 2 + .../keycapsss/plaid_pad/keymaps/via/keymap.c | 18 +- keyboards/keycapsss/plaid_pad/plaid_pad.h | 3 - keyboards/keycapsss/plaid_pad/readme.md | 19 +- keyboards/keycapsss/plaid_pad/rev1/config.h | 3 + keyboards/keycapsss/plaid_pad/rev2/config.h | 3 + keyboards/keycapsss/plaid_pad/rev3/config.h | 25 ++ keyboards/keycapsss/plaid_pad/rev3/rev3.c | 17 ++ keyboards/keycapsss/plaid_pad/rev3/rev3.h | 20 ++ keyboards/keycapsss/plaid_pad/rev3/rules.mk | 2 + 16 files changed, 654 insertions(+), 14 deletions(-) create mode 100644 keyboards/keycapsss/plaid_pad/keymaps/oled/config.h create mode 100644 keyboards/keycapsss/plaid_pad/keymaps/oled/glcdfont.c create mode 100644 keyboards/keycapsss/plaid_pad/keymaps/oled/keymap.c create mode 100644 keyboards/keycapsss/plaid_pad/keymaps/oled/readme.md create mode 100644 keyboards/keycapsss/plaid_pad/keymaps/oled/rules.mk create mode 100644 keyboards/keycapsss/plaid_pad/rev3/config.h create mode 100644 keyboards/keycapsss/plaid_pad/rev3/rev3.c create mode 100644 keyboards/keycapsss/plaid_pad/rev3/rev3.h create mode 100644 keyboards/keycapsss/plaid_pad/rev3/rules.mk diff --git a/keyboards/keycapsss/plaid_pad/config.h b/keyboards/keycapsss/plaid_pad/config.h index d52a51ccdc7..373d3de14f7 100644 --- a/keyboards/keycapsss/plaid_pad/config.h +++ b/keyboards/keycapsss/plaid_pad/config.h @@ -40,8 +40,5 @@ /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ #define DEBOUNCE 5 -/* 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 +// Fix for volume controll with encoder (steadily in/decrease) +#define TAP_CODE_DELAY 60 diff --git a/keyboards/keycapsss/plaid_pad/keymaps/default/keymap.c b/keyboards/keycapsss/plaid_pad/keymaps/default/keymap.c index 59031c91d26..18f0ac49a02 100644 --- a/keyboards/keycapsss/plaid_pad/keymaps/default/keymap.c +++ b/keyboards/keycapsss/plaid_pad/keymaps/default/keymap.c @@ -22,10 +22,26 @@ LAYOUT_ortho_4x4( }; -// Set led state during powerup + +// Set led state during power-up +// There is also a LED_GREEN +// Only for Rev1 & Rev2 +#ifdef LED_RED void keyboard_post_init_user(void) { writePinHigh(LED_RED); } +#endif + + +// Rev3 and above only +#ifdef OLED_DRIVER_ENABLE +void oled_task_user(void) { + oled_write_ln_P(PSTR("Plaid-Pad ///////////"), false); +} +#endif + + +#ifdef ENCODER_ENABLE void encoder_update_user(uint8_t index, bool clockwise) { /* @@ -71,3 +87,5 @@ Rev1.1 Rev1 } } } + +#endif diff --git a/keyboards/keycapsss/plaid_pad/keymaps/oled/config.h b/keyboards/keycapsss/plaid_pad/keymaps/oled/config.h new file mode 100644 index 00000000000..902e9052b72 --- /dev/null +++ b/keyboards/keycapsss/plaid_pad/keymaps/oled/config.h @@ -0,0 +1,22 @@ +/* Copyright 2021 Ben Roesner (keycapsss.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 . + */ + +#pragma once + +// place overrides here +#define OLED_FONT_H "keyboards/keycapsss/plaid_pad/keymaps/oled/glcdfont.c" + +#define COMBO_COUNT 3 diff --git a/keyboards/keycapsss/plaid_pad/keymaps/oled/glcdfont.c b/keyboards/keycapsss/plaid_pad/keymaps/oled/glcdfont.c new file mode 100644 index 00000000000..9fef5067f4e --- /dev/null +++ b/keyboards/keycapsss/plaid_pad/keymaps/oled/glcdfont.c @@ -0,0 +1,250 @@ +/* Copyright 2019 Leo Batyuk (soundmonster) + * Copyright 2021 Ben Roesner (keycapsss.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 . + */ + +#include "progmem.h" + +// Corne 8x6 font +// Online editor: https://helixfonteditor.netlify.com +// or https://joric.github.io/qle/ +// See also: https://github.com/soundmonster/glcdfont_converter + +const unsigned char font[] PROGMEM = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, + 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, + 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00, + 0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00, + 0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00, + 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, + 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, + 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, + 0x00, 0x18, 0x24, 0x18, 0x00, 0x00, + 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00, + 0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00, + 0x26, 0x29, 0x79, 0x29, 0x26, 0x00, + 0x40, 0x7F, 0x05, 0x05, 0x07, 0x00, + 0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00, + 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00, + 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00, + 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00, + 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, + 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00, + 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00, + 0x00, 0x66, 0x89, 0x95, 0x6A, 0x00, + 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, + 0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00, + 0x08, 0x04, 0x7E, 0x04, 0x08, 0x00, + 0x10, 0x20, 0x7E, 0x20, 0x10, 0x00, + 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00, + 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00, + 0x1E, 0x10, 0x10, 0x10, 0x10, 0x00, + 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00, + 0x30, 0x38, 0x3E, 0x38, 0x30, 0x00, + 0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, + 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, + 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00, + 0x23, 0x13, 0x08, 0x64, 0x62, 0x00, + 0x36, 0x49, 0x56, 0x20, 0x50, 0x00, + 0x00, 0x08, 0x07, 0x03, 0x00, 0x00, + 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, + 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, + 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00, + 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, + 0x00, 0x80, 0x70, 0x30, 0x00, 0x00, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, + 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, + 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, + 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, + 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, + 0x72, 0x49, 0x49, 0x49, 0x46, 0x00, + 0x21, 0x41, 0x49, 0x4D, 0x33, 0x00, + 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, + 0x27, 0x45, 0x45, 0x45, 0x39, 0x00, + 0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00, + 0x41, 0x21, 0x11, 0x09, 0x07, 0x00, + 0x36, 0x49, 0x49, 0x49, 0x36, 0x00, + 0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, + 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x00, 0x40, 0x34, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, + 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, + 0x00, 0x41, 0x22, 0x14, 0x08, 0x00, + 0x02, 0x01, 0x59, 0x09, 0x06, 0x00, + 0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00, + 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, + 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, + 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, + 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, + 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, + 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, + 0x3E, 0x41, 0x41, 0x51, 0x73, 0x00, + 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, + 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, + 0x20, 0x40, 0x41, 0x3F, 0x01, 0x00, + 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, + 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, + 0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00, + 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, + 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, + 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, + 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, + 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, + 0x26, 0x49, 0x49, 0x49, 0x32, 0x00, + 0x03, 0x01, 0x7F, 0x01, 0x03, 0x00, + 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, + 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, + 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00, + 0x63, 0x14, 0x08, 0x14, 0x63, 0x00, + 0x03, 0x04, 0x78, 0x04, 0x03, 0x00, + 0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, + 0x00, 0x7F, 0x41, 0x41, 0x41, 0x00, + 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, + 0x00, 0x41, 0x41, 0x41, 0x7F, 0x00, + 0x04, 0x02, 0x01, 0x02, 0x04, 0x00, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, + 0x00, 0x13, 0x07, 0x08, 0x00, 0x00, + 0x20, 0x54, 0x54, 0x78, 0x40, 0x00, + 0x7F, 0x28, 0x44, 0x44, 0x38, 0x00, + 0x38, 0x44, 0x44, 0x44, 0x28, 0x00, + 0x38, 0x44, 0x44, 0x28, 0x7F, 0x00, + 0x38, 0x54, 0x54, 0x54, 0x18, 0x00, + 0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, + 0x18, 0x24, 0x24, 0x1C, 0x78, 0x00, + 0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, + 0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, + 0x20, 0x40, 0x40, 0x3D, 0x00, 0x00, + 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, + 0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, + 0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, + 0x7C, 0x08, 0x04, 0x04, 0x78, 0x00, + 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, + 0x7C, 0x18, 0x24, 0x24, 0x18, 0x00, + 0x18, 0x24, 0x24, 0x18, 0x7C, 0x00, + 0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, + 0x48, 0x54, 0x54, 0x54, 0x24, 0x00, + 0x04, 0x04, 0x3F, 0x44, 0x24, 0x00, + 0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00, + 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, + 0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00, + 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, + 0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00, + 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, + 0x00, 0x08, 0x36, 0x41, 0x00, 0x00, + 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, + 0x00, 0x41, 0x36, 0x08, 0x00, 0x00, + 0x02, 0x01, 0x02, 0x04, 0x02, 0x00, + 0x3C, 0x26, 0x23, 0x26, 0x3C, 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, 0xF8, 0x04, 0x22, 0x52, 0xE2, + 0x42, 0x42, 0x42, 0xE2, 0x52, 0x22, + 0x22, 0x22, 0x42, 0x82, 0x02, 0x02, + 0x22, 0x22, 0x02, 0x04, 0xF8, 0x00, + 0x00, 0xF8, 0x04, 0x02, 0x02, 0x82, + 0x42, 0x22, 0x42, 0x82, 0x02, 0x02, + 0x02, 0x82, 0x42, 0x22, 0x12, 0x22, + 0x42, 0x82, 0x02, 0x04, 0xF8, 0x00, + 0x00, 0xF8, 0xFC, 0xDE, 0xAE, 0x1E, + 0xBE, 0xBE, 0xBE, 0x1E, 0xAE, 0xDE, + 0xDE, 0xDE, 0xBE, 0x7E, 0xFE, 0xFE, + 0xDE, 0xDE, 0xFE, 0xFC, 0xF8, 0x00, + 0x00, 0xF8, 0xFC, 0xFE, 0xFE, 0x7E, + 0xBE, 0xDE, 0xBE, 0x7E, 0xFE, 0xFE, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, + 0x10, 0x10, 0x08, 0x08, 0x10, 0x10, + 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, + 0x80, 0x80, 0xC0, 0xC0, 0xE0, 0xE0, + 0xF0, 0xF0, 0xF8, 0xF8, 0xF0, 0xF0, + 0xE0, 0xE0, 0xC0, 0xC0, 0x80, 0x80, + 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, + 0x10, 0x10, 0x08, 0x08, 0x10, 0x10, + 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, + 0x80, 0x80, 0x40, 0xC0, 0x60, 0xA0, + 0x50, 0xB0, 0x58, 0xA8, 0x50, 0xB0, + 0x60, 0xA0, 0x40, 0xC0, 0x80, 0x80, + 0x1F, 0x1F, 0x0E, 0x1B, 0x11, 0xC0, + 0x1F, 0x1F, 0x00, 0x1F, 0x1F, 0x06, + 0x0C, 0xC6, 0x1F, 0x1F, 0x80, 0x5F, + 0x1F, 0x00, 0x1F, 0x1F, 0x8E, 0x9B, + 0x91, 0x80, 0x9F, 0x9F, 0x91, 0x1F, + 0x00, 0x1F, 0x20, 0x44, 0x4A, 0x47, + 0x42, 0x42, 0x42, 0x47, 0x4A, 0x44, + 0x40, 0x40, 0x40, 0x40, 0x41, 0x42, + 0x44, 0x44, 0x40, 0x20, 0x1F, 0x00, + 0x00, 0x1F, 0x20, 0x40, 0x41, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x41, 0x40, + 0x41, 0x41, 0x4F, 0x48, 0x48, 0x48, + 0x4F, 0x41, 0x41, 0x20, 0x1F, 0x00, + 0x00, 0x1F, 0x3F, 0x7B, 0x75, 0x78, + 0x7D, 0x7D, 0x7D, 0x78, 0x75, 0x7B, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7E, 0x7D, + 0x7B, 0x7B, 0x7F, 0x3F, 0x1F, 0x00, + 0x00, 0x1F, 0x3F, 0x7F, 0x7E, 0x7F, + 0x7F, 0x7F, 0x7F, 0x7F, 0x7E, 0x7F, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x88, 0x88, 0x5D, 0x5D, 0x3E, 0x3E, + 0x7C, 0x7C, 0xF8, 0xF8, 0x7C, 0x7C, + 0x3E, 0x3E, 0x5D, 0x5D, 0x88, 0x88, + 0x88, 0x88, 0x55, 0x55, 0x23, 0x23, + 0x47, 0x47, 0x8F, 0x8F, 0x47, 0x47, + 0x23, 0x23, 0x55, 0x55, 0x88, 0x88, + 0x88, 0x88, 0xD5, 0xD5, 0xE2, 0xE2, + 0xC4, 0xC4, 0x88, 0x88, 0xC4, 0xC4, + 0xE2, 0xE2, 0xD5, 0xD5, 0x88, 0x88, + 0x88, 0x88, 0x5D, 0xD5, 0x6B, 0xB6, + 0x6D, 0xD6, 0xAD, 0xDA, 0x6D, 0xD6, + 0x6B, 0xB6, 0x5D, 0xD5, 0x88, 0x88, + 0x00, 0x84, 0x87, 0x7D, 0x55, 0x57, + 0x55, 0x7D, 0x87, 0x84, 0x00, 0x91, + 0x95, 0x55, 0x55, 0x3F, 0x55, 0x55, + 0x95, 0x91, 0x00, 0x08, 0x08, 0x08, + 0x88, 0xFC, 0x0A, 0x09, 0x08, 0x08, + 0x04, 0xF8, 0x00, 0x00, 0xF8, 0x04, + 0x20, 0x1F, 0x00, 0x00, 0x1F, 0x20, + 0xFC, 0xF8, 0x00, 0x00, 0xF8, 0x04, + 0x3F, 0x1F, 0x00, 0x00, 0x1F, 0x20, + 0x04, 0xF8, 0x00, 0x00, 0xF8, 0xFC, + 0x20, 0x1F, 0x00, 0x00, 0x1F, 0x3F, + 0xFC, 0xF8, 0x00, 0x00, 0xF8, 0xFC, + 0x3F, 0x1F, 0x00, 0x00, 0x1F, 0x3F, + 0xFE, 0x7E, 0xBE, 0xDE, 0xEE, 0xDE, + 0xBE, 0x7E, 0xFE, 0xFC, 0xF8, 0x00, + 0x7E, 0x7E, 0x70, 0x77, 0x77, 0x77, + 0x70, 0x7E, 0x7E, 0x3F, 0x1F, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, + 0x04, 0x04, 0x08, 0x08, 0x04, 0x04, + 0x02, 0x02, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, + 0x04, 0x04, 0x08, 0x08, 0x04, 0x04, + 0x02, 0x02, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x01, 0x03, 0x03, + 0x07, 0x07, 0x0F, 0x0F, 0x07, 0x07, + 0x03, 0x03, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x01, 0x03, 0x02, + 0x05, 0x06, 0x0D, 0x0A, 0x05, 0x06, + 0x03, 0x02, 0x01, 0x01, 0x00, 0x00, +}; diff --git a/keyboards/keycapsss/plaid_pad/keymaps/oled/keymap.c b/keyboards/keycapsss/plaid_pad/keymaps/oled/keymap.c new file mode 100644 index 00000000000..e665138f6ac --- /dev/null +++ b/keyboards/keycapsss/plaid_pad/keymaps/oled/keymap.c @@ -0,0 +1,228 @@ +/* Copyright 2021 Ben Roesner (keycapsss.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 . + */ + +#include QMK_KEYBOARD_H +#include + +enum layers { + _NUMPAD, + _NAVIGATION, + _MEDIA +}; + +enum combos { + COMBO1, + COMBO2, + COMBO3 +}; + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* NUMPAD layer + * ,-----------------------, + * | 7 | 8 | 9 | / | + * |-----+-----+-----+-----| + * | 4 | 5 | 6 | * | + * |-----+-----+-----+-----| + * | 1 | 2 | 3 | - | + * |-----+-----+-----+-----| + * | 0 | . | = | + | + * `-----------------------' + */ + [_NUMPAD] = LAYOUT_ortho_4x4( + KC_P7, KC_P8, KC_P9, KC_PSLS, + KC_P4, KC_P5, KC_P6, KC_PAST, + KC_P1, KC_P2, KC_P3, KC_PMNS, + KC_P0, KC_PDOT, KC_PEQL, KC_PPLS + ), + /* Navigation layer + */ + [_NAVIGATION] = LAYOUT_ortho_4x4( + KC_BTN1, KC_MS_U, KC_BTN2, XXXXXXX, + KC_MS_L, KC_MS_D, KC_MS_R, XXXXXXX, + XXXXXXX, KC_UP, XXXXXXX, XXXXXXX, + KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX + ), + /* MEDIA layer + */ + [_MEDIA] = LAYOUT_ortho_4x4( + KC_SYSTEM_SLEEP, XXXXXXX, XXXXXXX, KC_AUDIO_MUTE, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + KC_AUDIO_VOL_DOWN, KC_AUDIO_MUTE, KC_AUDIO_VOL_UP, XXXXXXX, + KC_MEDIA_PREV_TRACK, KC_MEDIA_PLAY_PAUSE, KC_MEDIA_NEXT_TRACK, XXXXXXX + ), + +}; + +// Combos for switching layers +const uint16_t PROGMEM zeroDot_combo[] = {KC_P0, KC_PDOT, COMBO_END}; +const uint16_t PROGMEM leftDown_combo[] = {KC_LEFT, KC_DOWN, COMBO_END}; +const uint16_t PROGMEM prevPlay_combo[] = {KC_MEDIA_PREV_TRACK, KC_MEDIA_PLAY_PAUSE, COMBO_END}; + +combo_t key_combos[COMBO_COUNT] = { + [COMBO1] = COMBO_ACTION(zeroDot_combo), + [COMBO2] = COMBO_ACTION(leftDown_combo), + [COMBO3] = COMBO_ACTION(prevPlay_combo), +}; + +void process_combo_event(uint16_t combo_index, bool pressed) { + switch(combo_index) { + case COMBO1: + if (pressed) { + layer_move(_NAVIGATION); + } + break; + case COMBO2: + if (pressed) { + layer_move(_MEDIA); + } + break; + case COMBO3: + if (pressed) { + layer_move(_NUMPAD); + } + break; + } +} + +#ifdef OLED_DRIVER_ENABLE + +void render_space(void) { + oled_write_P(PSTR(" "), false); +} + + +void oled_render_layer_state(void) { + oled_write_P(PSTR("Layer: "), false); + if(layer_state_is(_MEDIA)) { + oled_write_ln_P(PSTR("MEDIA"), false); + } else if(layer_state_is(_NAVIGATION)) { + oled_write_ln_P(PSTR("NAVIGATION"), false); + } else { + oled_write_ln_P(PSTR("NUMPAD"), false); + } +} + + +void oled_task_user(void) { + oled_write_ln_P(PSTR("Plaid-Pad ///////////"), false); + oled_render_layer_state(); +} + +#endif + +#ifdef ENCODER_ENABLE +void encoder_update_user(uint8_t index, bool clockwise) { +/* + ,-----------------------, + | E1 | E2 | E3 | E4 | + |-----+-----+-----+-----| + | | | | E3 | + |-----+-----+-----+-----| + | | | | E2 | + |-----+-----+-----+-----| + | | | | E1 | + `-----------------------' + */ + + // First encoder (E1) + if (index == 0) { + switch (get_highest_layer(layer_state)) { + case _NAVIGATION: + // Browser tab switching + if (clockwise) { + tap_code16(LCTL(KC_TAB)); + } else { + tap_code16(LCTL(LSFT(KC_TAB))); + } + break; + default: + if (clockwise) { + tap_code(KC_F17); + } else { + tap_code(KC_F18); + } + break; + } + // Second encoder (E2) + } else if (index == 1) { + switch (get_highest_layer(layer_state)) { + case _NAVIGATION: + // Page Down/Up + if (clockwise) { + tap_code16(KC_PGDOWN); + } else { + tap_code16(KC_PGUP); + } + break; + default: + if (clockwise) { + tap_code(KC_F19); + } else { + tap_code(KC_F20); + } + break; + } + // Third encoder (E3) + } else if (index == 2) { + switch (get_highest_layer(layer_state)) { + case _NAVIGATION: + // Mouse wheel up/down + if (clockwise) { + tap_code(KC_MS_WH_DOWN); + } else { + tap_code(KC_MS_WH_UP); + } + break; + case _MEDIA: + // BRIGHTNESS Up/Down + if (clockwise) { + tap_code16(KC_BRIGHTNESS_UP); + } else { + tap_code16(KC_BRIGHTNESS_DOWN); + } + break; + default: + if (clockwise) { + tap_code(KC_F21); + } else { + tap_code(KC_F22); + } + break; + } + // Forth encoder (E4) + } else if (index == 3) { + switch (get_highest_layer(layer_state)) { + case _NAVIGATION: + case _MEDIA: + // Volume Up/Down + if (clockwise) { + tap_code16(KC_AUDIO_VOL_UP); + } else { + tap_code16(KC_AUDIO_VOL_DOWN); + } + break; + default: + if (clockwise) { + tap_code(KC_F23); + } else { + tap_code(KC_F24); + } + break; + } + } +} +#endif diff --git a/keyboards/keycapsss/plaid_pad/keymaps/oled/readme.md b/keyboards/keycapsss/plaid_pad/keymaps/oled/readme.md new file mode 100644 index 00000000000..0e2493266d7 --- /dev/null +++ b/keyboards/keycapsss/plaid_pad/keymaps/oled/readme.md @@ -0,0 +1,29 @@ + +# Oled keymap for Rev3 and higher + +- 3 layers Numpad/Navigation/Media +- Switch layer with the combo 0+. (bottom row, first plus second key) + +Plaid-Pad Oled Keymap + +Below you can see the possible positions for the 4 rotary encoder (Rev1 only 2). +*If you place a encoder in the top left corner (E1), you can't use another encoder in the lower right corner.* +``` +Rev1.1 and higher Rev1 +,-----------------------, ,-----------------------, +| E1 | E2 | E3 | E4 | | E1 | | | E2 | +|-----+-----+-----+-----| |-----+-----+-----+-----| +| | | | E3 | | | | | | +|-----+-----+-----+-----| |-----+-----+-----+-----| +| | | | E2 | | | | | | +|-----+-----+-----+-----| |-----+-----+-----+-----| +| | | | E1 | | | | | | +`-----------------------' `-----------------------' +``` + +- Encoder E1 performs a tap on `KC_F17` and `KC_F18`. +- Encoder E2 performs a tap on `KC_F19` and `KC_F20`. +- Encoder E3 performs a tap on `KC_F21` and `KC_F22`. +- Encoder E4 performs a tap on `KC_F23` and `KC_F24`. + +*The F17-F24 keys are intended to be customized via [Karabiner-Elements (OSX)](https://github.com/pqrs-org/Karabiner-Elements), or [AutoHotkey](https://github.com/Lexikos/AutoHotkey_L) (WIN)* diff --git a/keyboards/keycapsss/plaid_pad/keymaps/oled/rules.mk b/keyboards/keycapsss/plaid_pad/keymaps/oled/rules.mk new file mode 100644 index 00000000000..a95ca8d778f --- /dev/null +++ b/keyboards/keycapsss/plaid_pad/keymaps/oled/rules.mk @@ -0,0 +1,2 @@ +OLED_DRIVER_ENABLE = yes # Enables the use of OLED displays +COMBO_ENABLE = yes diff --git a/keyboards/keycapsss/plaid_pad/keymaps/via/keymap.c b/keyboards/keycapsss/plaid_pad/keymaps/via/keymap.c index 1b1d59e3e99..0593d419b51 100644 --- a/keyboards/keycapsss/plaid_pad/keymaps/via/keymap.c +++ b/keyboards/keycapsss/plaid_pad/keymaps/via/keymap.c @@ -49,11 +49,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), }; -// Set LED1 state during powerup + +// Set led state during power-up +// There is also a LED_GREEN +// Only for Rev1 & Rev2 +#ifdef LED_RED void keyboard_post_init_user(void) { writePinHigh(LED_RED); } +#endif + +// Rev3 and above only +#ifdef OLED_DRIVER_ENABLE +void oled_task_user(void) { + oled_write_ln_P(PSTR("Plaid-Pad ///////////"), false); +} +#endif + + +#ifdef ENCODER_ENABLE void encoder_update_user(uint8_t index, bool clockwise) { /* Rev1.1 Rev1 @@ -98,3 +113,4 @@ Rev1.1 Rev1 } } } +#endif diff --git a/keyboards/keycapsss/plaid_pad/plaid_pad.h b/keyboards/keycapsss/plaid_pad/plaid_pad.h index 4ac26bf45ca..31153921639 100644 --- a/keyboards/keycapsss/plaid_pad/plaid_pad.h +++ b/keyboards/keycapsss/plaid_pad/plaid_pad.h @@ -29,6 +29,3 @@ { K20, K21, K22, K23 }, \ { K30, K31, K32, K33 } \ } - -#define LED_RED C5 // LED1 -#define LED_GREEN C4 // LED2 diff --git a/keyboards/keycapsss/plaid_pad/readme.md b/keyboards/keycapsss/plaid_pad/readme.md index e8a8044a2a2..7afebba5aad 100644 --- a/keyboards/keycapsss/plaid_pad/readme.md +++ b/keyboards/keycapsss/plaid_pad/readme.md @@ -1,5 +1,10 @@ # Plaid-Pad - +Rev1.1 +Plaid-Pad Rev1.1 +Rev3 +Plaid-Pad Rev3 with Oled + +Default Keymap A 4x4 numpad/macro pad with only through hole components. It supports up to 4 rotary encoder. The positions for the encoder are interchangeable with keyboard switches. @@ -7,7 +12,7 @@ A 4x4 numpad/macro pad with only through hole components. It supports up to 4 ro Below you can see the possible positions for the 4 rotary encoder (Rev1 only 2). *If you place a encoder in the top left corner (E1), you can't use another encoder in the lower right corner.* ``` -Rev1.1 Rev1 +Rev1.1 and higher Rev1 ,-----------------------, ,-----------------------, | E1 | E2 | E3 | E4 | | E1 | | | E2 | |-----+-----+-----+-----| |-----+-----+-----+-----| @@ -58,10 +63,16 @@ See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_to - Release RESET switch - Release BOOT switch -or an alternative method: +alternative method: - Unplug the USB cable - Hold down the BOOT switch - Plug in the USB cable - Release the BOOT switch -If you succeed to enter bootloader mode, you can see usbasp in device manager, or `*** USBAsp device connected` in [QMK Toolbox](https://github.com/qmk/qmk_toolbox). +alternative method ([Bootmagic Lite](https://docs.qmk.fm/#/feature_bootmagic?id=bootmagic-lite)): +- Unplug the USB cable +- Hold down the most top left key +- Plug in the USB cable +- Release the most top left key + +If you succeed to enter bootloader mode, you can see usbasp in device manager, or `*** USBAsp device connected ...` in [QMK Toolbox](https://github.com/qmk/qmk_toolbox). diff --git a/keyboards/keycapsss/plaid_pad/rev1/config.h b/keyboards/keycapsss/plaid_pad/rev1/config.h index eeb56503af5..fee25316dd6 100644 --- a/keyboards/keycapsss/plaid_pad/rev1/config.h +++ b/keyboards/keycapsss/plaid_pad/rev1/config.h @@ -23,3 +23,6 @@ #define ENCODERS_PAD_A { D1, B2 } #define ENCODERS_PAD_B { D0, B1 } + +#define LED_RED C5 // LED1 +#define LED_GREEN C4 // LED2 diff --git a/keyboards/keycapsss/plaid_pad/rev2/config.h b/keyboards/keycapsss/plaid_pad/rev2/config.h index 1f127771193..f3646dd575f 100644 --- a/keyboards/keycapsss/plaid_pad/rev2/config.h +++ b/keyboards/keycapsss/plaid_pad/rev2/config.h @@ -23,3 +23,6 @@ #define ENCODERS_PAD_A { D1, B2, B4, D4 } #define ENCODERS_PAD_B { D0, B1, B3, B5 } + +#define LED_RED C5 // LED1 +#define LED_GREEN C4 // LED2 diff --git a/keyboards/keycapsss/plaid_pad/rev3/config.h b/keyboards/keycapsss/plaid_pad/rev3/config.h new file mode 100644 index 00000000000..40f96cd5c80 --- /dev/null +++ b/keyboards/keycapsss/plaid_pad/rev3/config.h @@ -0,0 +1,25 @@ +/* Copyright 2020 Ben Roesner (keycapsss.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 . + */ + +#pragma once + +#define PRODUCT Plaid-Pad Rev3 +#define DEVICE_VER 0x0003 + +#define UNUSED_PINS { } + +#define ENCODERS_PAD_A { D1, B2, B4, D4 } +#define ENCODERS_PAD_B { D0, B1, B3, B5 } diff --git a/keyboards/keycapsss/plaid_pad/rev3/rev3.c b/keyboards/keycapsss/plaid_pad/rev3/rev3.c new file mode 100644 index 00000000000..bfe1934b3f9 --- /dev/null +++ b/keyboards/keycapsss/plaid_pad/rev3/rev3.c @@ -0,0 +1,17 @@ +/* Copyright 2021 Ben Roesner (keycapsss.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 . + */ + +#include "rev3.h" diff --git a/keyboards/keycapsss/plaid_pad/rev3/rev3.h b/keyboards/keycapsss/plaid_pad/rev3/rev3.h new file mode 100644 index 00000000000..d38fe6a5bb4 --- /dev/null +++ b/keyboards/keycapsss/plaid_pad/rev3/rev3.h @@ -0,0 +1,20 @@ +/* Copyright 2021 Ben Roesner (keycapsss.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 . + */ + +#pragma once + +#include "plaid_pad.h" + diff --git a/keyboards/keycapsss/plaid_pad/rev3/rules.mk b/keyboards/keycapsss/plaid_pad/rev3/rules.mk new file mode 100644 index 00000000000..9cc93aab4a5 --- /dev/null +++ b/keyboards/keycapsss/plaid_pad/rev3/rules.mk @@ -0,0 +1,2 @@ +ENCODER_ENABLE = yes +OLED_DRIVER_ENABLE = yes # Enables the use of OLED displays