From c32264d9b7382e86c7df75edfe3bc4154d714e25 Mon Sep 17 00:00:00 2001 From: MarioCorona Date: Sat, 17 Apr 2021 10:46:46 -0500 Subject: [PATCH] mcrown crkbd new keymap (#12092) Co-authored-by: Erovia --- keyboards/crkbd/keymaps/mcrown/config.h | 86 ++++++ keyboards/crkbd/keymaps/mcrown/glcdfont.c | 35 +++ keyboards/crkbd/keymaps/mcrown/keymap.c | 141 +++++++++ keyboards/crkbd/keymaps/mcrown/mcrown.h | 109 +++++++ keyboards/crkbd/keymaps/mcrown/oled.c | 354 ++++++++++++++++++++++ keyboards/crkbd/keymaps/mcrown/oled.h | 34 +++ keyboards/crkbd/keymaps/mcrown/readme.md | 13 + keyboards/crkbd/keymaps/mcrown/rules.mk | 18 ++ 8 files changed, 790 insertions(+) create mode 100644 keyboards/crkbd/keymaps/mcrown/config.h create mode 100644 keyboards/crkbd/keymaps/mcrown/glcdfont.c create mode 100644 keyboards/crkbd/keymaps/mcrown/keymap.c create mode 100644 keyboards/crkbd/keymaps/mcrown/mcrown.h create mode 100644 keyboards/crkbd/keymaps/mcrown/oled.c create mode 100644 keyboards/crkbd/keymaps/mcrown/oled.h create mode 100644 keyboards/crkbd/keymaps/mcrown/readme.md create mode 100644 keyboards/crkbd/keymaps/mcrown/rules.mk diff --git a/keyboards/crkbd/keymaps/mcrown/config.h b/keyboards/crkbd/keymaps/mcrown/config.h new file mode 100644 index 0000000000..e40bd639f3 --- /dev/null +++ b/keyboards/crkbd/keymaps/mcrown/config.h @@ -0,0 +1,86 @@ +/** @file config.h + * @brief config header that includes function prototypes and external variables. + * + * 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 . + * + * @author Mario Corona (mariocc@comunidad.unam.mx) 2021 + * + */ + +#pragma once + +/* Select hand configuration */ +#define MASTER_LEFT + +/* Comment this definition out if you want the main display to be output in horizontal mode */ +#define OLED_VERTICAL + +#ifdef RGB_MATRIX_ENABLE + #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 120 + #define RGB_MATRIX_HUE_STEP 10 + #define RGB_MATRIX_SAT_STEP 10 + #define RGB_MATRIX_VAL_STEP 10 + #define RGB_MATRIX_SPD_STEP 10 +// #define RGB_MATRIX_KEYPRESSES + #define RGB_MATRIX_FRAMEBUFFER_EFFECTS + + /* BEGIN: Disable RGB Effects */ +// #define DISABLE_RGB_MATRIX_SOLID_COLOR +// #define DISABLE_RGB_MATRIX_ALPHAS_MODS +// #define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN +// #define DISABLE_RGB_MATRIX_BREATHING +// #define DISABLE_RGB_MATRIX_BAND_SAT +// #define DISABLE_RGB_MATRIX_BAND_VAL +// #define DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +// #define DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +// #define DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT +// #define DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL +// #define DISABLE_RGB_MATRIX_CYCLE_ALL +// #define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +// #define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN +// #define DISABLE_RGB_MATRIX_CYCLE_OUT_IN +// #define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL + #define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON + #define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL + #define DISABLE_RGB_MATRIX_CYCLE_SPIRAL +// #define DISABLE_RGB_MATRIX_DUAL_BEACON + #define DISABLE_RGB_MATRIX_RAINBOW_BEACON + #define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS + #define DISABLE_RGB_MATRIX_RAINDROPS +// #define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS + + /* BEGIN: RGB_MATRIX_FRAMEBUFFER_EFFECTS */ +// #define DISABLE_RGB_MATRIX_TYPING_HEATMAP +// #define DISABLE_RGB_MATRIX_DIGITAL_RAIN + /* END: RGB_MATRIX_FRAMEBUFFER_EFFECTS */ + + /* BEGIN: RGB_MATRIX_KEYPRESSES */ +// #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +// #define DISABLE_RGB_MATRIX_SOLID_REACTIVE +// #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +// #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE +// #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +// #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS +// #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +// #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS +// #define DISABLE_RGB_MATRIX_SPLASH +// #define DISABLE_RGB_MATRIX_MULTISPLASH +// #define DISABLE_RGB_MATRIX_SOLID_SPLASH +// #define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH + /* END: RGB_MATRIX_KEYPRESSES */ + /* END: Disable RGB Effects */ +#endif + +/* To tell the compiler to use custom font */ +#define OLED_FONT_H "keyboards/crkbd/keymaps/mcrown/glcdfont.c" diff --git a/keyboards/crkbd/keymaps/mcrown/glcdfont.c b/keyboards/crkbd/keymaps/mcrown/glcdfont.c new file mode 100644 index 0000000000..17aa1dde39 --- /dev/null +++ b/keyboards/crkbd/keymaps/mcrown/glcdfont.c @@ -0,0 +1,35 @@ +/** @file glcfont.c + * @brief mcrown glcfont module. This module includes the font for mcrown keymap. + * + * 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 . + * + * @author Mario Corona (mariocc@comunidad.unam.mx) 2021 + * + */ + +#include "progmem.h" + +/* Standard ASCII 5x7 font */ +static 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, 0x03, 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, 0xA4, 0xA4, 0x9C, 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, 0xFC, 0x18, 0x24, 0x24, 0x18, 0x00, 0x18, 0x24, 0x24, 0x18, 0xFC, 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, 0x40, 0x40, 0x40, 0xF0, 0xF8, 0xF8, 0xFF, 0x38, 0xFF, 0xF8, 0xF8, 0x3F, 0xF8, 0xF8, 0xFF, 0x38, 0xFF, 0xF8, 0xF8, 0xF0, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xC0, 0xC0, 0x80, 0x00, 0x00, 0xC0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xC0, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x80, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0xC0, 0xC0, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF0, 0xF8, 0xFC, 0x3E, + 0x1E, 0x06, 0x01, 0x00, 0x00, 0x00, 0x7F, 0x41, 0x41, 0x41, 0x7F, 0x00, 0x7F, 0x41, 0x41, 0x41, 0x7F, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B, 0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00, 0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE, 0xDE, 0xD7, 0xDC, 0x00, 0xC0, 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, 0x49, 0x49, 0x49, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0xDF, 0xBF, 0xBF, 0x00, 0xBF, 0xBF, 0xDF, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0x49, 0x49, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x3F, 0x60, 0x60, 0xE0, 0xBF, 0x1F, 0x00, 0x7F, 0x7F, 0x07, 0x1E, 0x38, 0x1E, 0x07, 0x7F, 0x7F, 0x00, 0x7F, 0x7F, 0x0E, 0x1F, 0x3B, 0x71, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x0C, 0x0C, 0x0C, 0x00, 0x7E, 0x7E, 0x00, 0x7F, 0x7E, 0x03, 0x03, 0x00, 0x7F, 0x7E, 0x03, 0x03, 0x7E, 0x7E, 0x03, 0x03, 0x7F, 0x7E, 0x00, 0x0F, + 0x3E, 0x70, 0x3C, 0x06, 0x3C, 0x70, 0x3E, 0x0F, 0x00, 0x32, 0x7B, 0x49, 0x49, 0x3F, 0x7E, 0x00, 0x7F, 0x7E, 0x03, 0x03, 0x00, 0x1E, 0x3F, 0x69, 0x69, 0x6F, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0F, 0x1F, 0x3F, 0x3C, 0x78, 0x70, 0x60, 0x00, 0x00, 0x00, 0x7F, 0x41, 0x41, 0x41, 0x7F, 0x00, 0x7F, 0x41, 0x41, 0x41, 0x7F, 0x00, 0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20, 0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00, 0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F, 0x0F, 0x7F, 0x0F, 0x00, 0x03, 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, 0x01, 0x01, 0x01, 0x07, 0x0F, 0x0F, 0x7F, 0x0F, 0x7F, 0x0F, 0x0F, 0x7E, 0x0F, 0x0F, 0x7F, 0x0F, 0x7F, 0x0F, 0x0F, 0x07, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 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, 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, 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, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; diff --git a/keyboards/crkbd/keymaps/mcrown/keymap.c b/keyboards/crkbd/keymaps/mcrown/keymap.c new file mode 100644 index 0000000000..907e1347bb --- /dev/null +++ b/keyboards/crkbd/keymaps/mcrown/keymap.c @@ -0,0 +1,141 @@ +/** @file keymap.c + * @brief keymao.c that includes key layout and keylogs functions + * + * 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 . + * + * @author Mario Corona (mariocc@comunidad.unam.mx) 2021 + * + */ + +#include "mcrown.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT_wrapper( + /*,-------------------------------------------------|-----|--------------------------------------------------------|.*/ + _____________________QWERTY_L1______________________, _____________________QWERTY_R1______________________, + /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/ + _____________________QWERTY_L2______________________, _____________________QWERTY_R2______________________, + /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/ + _____________________QWERTY_L3______________________, _____________________QWERTY_R3______________________, + /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/ + _____________MOD_LEFT_____________, _____________MOD_RIGHT____________ + /*|-----------------------------------| |----------------------------------|*/ + ), + + [_LOWER] = LAYOUT_wrapper( + /*,-------------------------------------------------|-----|--------------------------------------------------------|.*/ + _____________________LOWER_L1_______________________, _____________________LOWER_R1_______________________, + /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/ + _____________________LOWER_L2_______________________, _____________________LOWER_R2_______________________, + /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/ + _____________________LOWER_L3_______________________, _____________________LOWER_R3_______________________, + /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/ + _____________MOD_LEFT_____________, _____________MOD_RIGHT____________ + /*|-----------------------------------| |----------------------------------|*/ + ), + + [_RAISE] = LAYOUT_wrapper( + /*,-------------------------------------------------|-----|--------------------------------------------------------|.*/ + _____________________RAISE_L1_______________________, _____________________RAISE_R1_______________________, + /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/ + _____________________RAISE_L2_______________________, _____________________RAISE_R2_______________________, + /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/ + _____________________RAISE_L3_______________________, _____________________RAISE_R3_______________________, + /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/ + _____________MOD_LEFT_____________, _____________MOD_RIGHT____________ + /*|-----------------------------------| |----------------------------------|*/ + ), + + [_ADJUST] = LAYOUT_wrapper( + /*,-------------------------------------------------|-----|--------------------------------------------------------|.*/ + _____________________ADJUST_L1______________________, _____________________ADJUST_R1______________________, + /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/ + _____________________ADJUST_L2______________________, _____________________ADJUST_R2______________________, + /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/ + _____________________ADJUST_L3______________________, _____________________ADJUST_R3______________________, + /*|--------+--------+--------+--------+--------+----| |--------+--------+--------+--------+--------+-----------|*/ + _____________MOD_LEFT_____________, _____________MOD_RIGHT____________ + /*|-----------------------------------| |----------------------------------|*/ + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record){ + bool user_records_press=true; + + if (record->event.pressed){ + add_keylog(keycode); + } + + switch (keycode){ + case QWERTY: + if (record->event.pressed){ + set_single_persistent_default_layer(_QWERTY); + } + break; + + case LOWER: + if(record->event.pressed){ + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + }else{ + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + break; + + case RAISE: + if (record->event.pressed){ + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + }else{ + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + break; + + case ADJUST: + if (record->event.pressed){ + layer_on(_ADJUST); + }else{ + layer_off(_ADJUST); + } + break; + + case RGB_MOD: + #ifdef RGBLIGHT_ENABLE + if(record->event.pressed){ + rgblight_mode(RGB_current_mode); + rgblight_step(); + RGB_current_mode = rgblight_get_mode(); + } + #endif + break; + + case RGBRST: + #ifdef RGBLIGHT_ENABLE + if(record->event.pressed){ + eeconfig_update_rgblight_default(); + rgblight_enable(); + RGB_current_mode = rgblight_get_mode(); + } + #endif + break; + + default: + user_records_press=false; + break; + } + + return false==user_records_press; +} diff --git a/keyboards/crkbd/keymaps/mcrown/mcrown.h b/keyboards/crkbd/keymaps/mcrown/mcrown.h new file mode 100644 index 0000000000..c3ed36eece --- /dev/null +++ b/keyboards/crkbd/keymaps/mcrown/mcrown.h @@ -0,0 +1,109 @@ +/** @file mcrown.h + * @brief mcrown header thant incluedes key layout and some definintions. + * + * 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 . + * + * @author Mario Corona (mariocc@comunidad.unam.mx) 2021 + * + */ + +#pragma once + +#include QMK_KEYBOARD_H +#include "oled.h" + +#define KC_XXXXX KC_NO +#define KC_LOWER LOWER +#define KC_RAISE RAISE +#define KC_CTLTB CTL_T(KC_TAB) +#define KC_GUIEI GUI_T(KC_LANG2) +#define KC_ALTKN ALT_T(KC_LANG1) + +#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__) + +/* For values greater than 0x200, substract that value and add 0x20 so the characters can be mapped */ +#define RM_LSFT(kc) ((uint8_t)(0x20)+(kc-0x200)) + +/* ######################################################################### LAYOUT BLOCKS ##################################################### */ +/* -----------------------------------------BUTTON1---BUTTON2- BUTTON3------- */ +#define _____________MOD_LEFT_____________ KC_GUIEI, KC_LOWER, KC_SPC +#define _____________MOD_RIGHT____________ KC_ENT, KC_RAISE, KC_ALTKN + + +/* ------------------------------------------------------------COL1------COL2-----COL3-----COL4-----COL5-----COL6--------- */ +#define _____________________RAISE_L1_______________________ KC_ESC, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC +#define _____________________RAISE_L2_______________________ KC_LSFT, KC_MPLY, KC_VOLU, KC_MNXT, XXXXXXX, XXXXXXX +#define _____________________RAISE_L3_______________________ KC_CTLTB, KC_CALC, KC_VOLD, KC_MPRV, KC_BRIU, KC_BRID + +#define _____________________RAISE_R1_______________________ KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL +#define _____________________RAISE_R2_______________________ KC_MINS, KC_EQL, KC_LCBR, KC_RCBR, KC_PIPE, KC_GRV +#define _____________________RAISE_R3_______________________ KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_BSLS, KC_TILD + +/* ------------------------------------------------------------COL1------COL2-----COL3-----COL4-----COL5-----COL6--------- */ +#define _____________________QWERTY_L1______________________ KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T +#define _____________________QWERTY_L2______________________ KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G +#define _____________________QWERTY_L3______________________ KC_CTLTB, KC_Z, KC_X, KC_C, KC_V, KC_B + +#define _____________________QWERTY_R1______________________ KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC +#define _____________________QWERTY_R2______________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT +#define _____________________QWERTY_R3______________________ KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT + +/* ------------------------------------------------------------COL1------COL2-----COL3-----COL4-----COL5-----COL6--------- */ +#define _____________________LOWER_L1_______________________ KC_CAPS, KC_1, KC_2, KC_3, KC_4, KC_5 +#define _____________________LOWER_L2_______________________ KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, KC_PGUP, KC_PGDN +#define _____________________LOWER_L3_______________________ KC_CTLTB, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5 + +#define _____________________LOWER_R1_______________________ KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC +#define _____________________LOWER_R2_______________________ KC_LEFT, KC_UP, KC_DOWN, KC_RIGHT, KC_HOME, KC_END +#define _____________________LOWER_R3_______________________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11 + +/* ------------------------------------------------------------COL1------COL2-----COL3-----COL4-----COL5-----COL6--------- */ +#define _____________________ADJUST_L1______________________ XXXXXXX, EEP_RST, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX +#if defined(RGB_MATRIX_ENABLE) || defined(RGBLIGHT_ENABLE) + #define _____________________ADJUST_L2______________________ XXXXXXX, XXXXXXX, RGB_SPI, RGB_SAI, RGB_HUI, RGB_VAI + #define _____________________ADJUST_L3______________________ XXXXXXX, XXXXXXX, RGB_SPD, RGB_SAD, RGB_HUD, RGB_VAD +#else/* ---------------------------------------------------------------|---------|--------|--------|--------|------------- */ + #define _____________________ADJUST_L2______________________ M_VRSN, M_MALL, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + #define _____________________ADJUST_L3______________________ M_FLSH, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX +#endif/* --------------------------------------------------------------|---------|--------|--------|--------|------------- */ +#if defined(RGB_MATRIX_ENABLE) || defined(RGBLIGHT_ENABLE) + #define _____________________ADJUST_R1______________________ RGB_TOG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + #define _____________________ADJUST_R3______________________ RGB_MOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX +#else/* ---------------------------------------------------------------|---------|--------|--------|--------|------------- */ + #define _____________________ADJUST_R1______________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + #define _____________________ADJUST_R3______________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX +#endif/* --------------------------------------------------------------|---------|--------|--------|--------|------------- */ +#define _____________________ADJUST_R2______________________ RGB_RMOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + +/* Each layer gets a name for readability */ +typedef enum custom_layers { + _QWERTY, + _DVORAK, + _COLEMAK, + _LOWER, + _RAISE, + _ADJUST, + _NUMPAD, + _MAX_LAYERS +}CUSTOM_LAYERS_T; + +/* To be used to identify the current working layer */ +typedef enum custom_keycodes{ + QWERTY = SAFE_RANGE, + LOWER, + RAISE, + ADJUST, + BACKLIT, + RGBRST +}CUSTOM_KEYCODES_T; diff --git a/keyboards/crkbd/keymaps/mcrown/oled.c b/keyboards/crkbd/keymaps/mcrown/oled.c new file mode 100644 index 0000000000..0e245e9004 --- /dev/null +++ b/keyboards/crkbd/keymaps/mcrown/oled.c @@ -0,0 +1,354 @@ +/** @file oled.h + * @brief mcrown oled service implementation. + * + * 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 . + * + * @author Mario Corona (mariocc@comunidad.unam.mx) 2021 + * + */ + +#include QMK_KEYBOARD_H +#include +#include +#include "mcrown.h" +#include "oled.h" + +#define ASCII_TABLE_LENGTH (0x80) +#define KEYLOG_STRING_STARTUP (KEYLOG_EOL_LEN+1) +#define ALT_CODE (0x7E) +#define SPECIAL_KEYS_SHIFT(kc) (0x18+(kc)) + +static void render_keylogger_status(void); + +static char keylog_str[KEYLOG_EOL_LEN] = {' '}; +static uint16_t log_timer = 0; +static uint8_t current_cursor_pos=0; +static uint32_t cursor_oled_timer = 0; +static uint32_t standby_oled_timer = 0; +static char last_c=' '; + +/* Provides the ASCII value or the address of the character selected of the OLED font specified in glcfont.c */ +static const char ascii_t[ASCII_TABLE_LENGTH] = { + /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ + /* | | | | | | | | | | | | | | | | */ + 0x0F, 0x1A, 0x1B, 0x19, 0x18, 0x0E, ' ', ' ', 0x11, 0x1C, 0x97, ' ', ' ', ' ', ' ', ' ', /* 0 */ + /* | | | | | | | | | | | | | | | | */ + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 0x1D, ' ', ' ', ' ', ' ', /* 1 */ + /* | | | | | | | | | | | | | | | | */ + 0x16, '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', /* 2 */ + /* | | | | | | | | | | | | | | | | */ + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', /* 3 */ + /* | | | | | | | | | | | | | | | | */ + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', /* 4 */ + /* | | | | | | | | | | | | | | | | */ + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', /* 5 */ + /* | | | | | | | | | | | | | | | | */ + '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', /* 6 */ + /* | | | | | | | | | | | | | | | | */ + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 0x7F, /* 7 */ +}; + +/* This table is to remap and get the corresponding ASCII value based on the KEYCODE (taken as the index of the array) of quatum_keycodes.h module */ +static const unsigned char code_to_ascii[ASCII_TABLE_LENGTH] = { + /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ + /* | | | | | | | | | | | | | | | | */ + 0x00, 0x00, 0x00, 0x00, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', /* 0 */ + /* | | | | | | | | | | | | | | | | */ + 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', /* 1 */ + /* | | | | | | | | | | | | | | | | */ + '3', '4', '5', '6', '7', '8', '9', '0', 0x0A, 0x1B, 0x08, 0x09, ' ', '-', '=', '[', /* 2 */ + /* | | | | | | | | | | | | | | | | */ + ']', '\\', 0x00, ';', '\'', '`', ',', '.', '/', 0x00, 0x00, 0x00, 0x00, 0x00, '!', '@', /* 3 */ + /* | | | | | | | | | | | | | | | | */ + '#', '$', '%', '^', '&', '*', '(', ')', 0x00, 0x00, 0x00, 0x00, 0x00, '_', '+', '{', /* 4 */ + /* | | | | | | | | | | | | | | | | */ + '}', '|', 0x00, 0x00, 0x00, '~', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 5 */ + /* | | | | | | | | | | | | | | | | */ + 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, /* 6 */ + /* | | | | | | | | | | | | | | | | */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, /* 7 */ +}; + +/** @brief maps the keycode to get the ascii value. + * + * If any argument is invalid, the function has no effect. + * + * @param keycode value of the pressed key. + * @return ascii value of the pressed key or a special value for non-ascii keys. + */ +inline static char get_ascii(int16_t keycode){ + uint8_t ascii_idx=0x00; + + if(keycode 300){ + cursor_oled_timer = timer_read32(); + cursor_f=!cursor_f; + } + oled_write_P(PSTR("\n>:"), false); + if(current_cursor_pos>(KEYLOG_LEN-1)){ + current_cursor_pos=0; + memset(keylog_str, ' ', sizeof(char)*KEYLOG_EOL_LEN); + /* Here the EOL is to clear with white spaces all the keylog area */ + keylog_str[KEYLOG_EOL_LEN-1] = '\0'; + oled_write(keylog_str, false); + /* Reset EOL to the begining of the keylog string */ + keylog_str[0] = '\0'; + } + oled_write(keylog_str, false); + oled_write_char(last_c, cursor_f); + +} + +/** @brief displays the current active layout. + * + * If any argument is invalid, the function has no effect. + * + * @param void. + * @return void. + */ +void render_layout_state(void){ + CUSTOM_LAYERS_T current_layer; + current_layer=(CUSTOM_LAYERS_T)get_highest_layer(layer_state); + +#ifdef OLED_VERTICAL + oled_write_P(PSTR("Lyt:\n"), false); +#else + oled_write_P(PSTR("Layout: "), false); +#endif + + switch (current_layer){ +#ifdef OLED_VERTICAL + case _COLEMAK: + oled_write_P(PSTR("Clmak\n"), false); + break; + + case _DVORAK: + oled_write_P(PSTR("Dvak\n"), false); + break; + + case _QWERTY: + oled_write_P(PSTR("Qwty\n"), false); + break; + + default: + oled_write_P(PSTR("Undf\n"), false); + break; + +#else + case _COLEMAK: + oled_write_P(PSTR("Colemak\n"), false); + break; + + case _DVORAK: + oled_write_P(PSTR("Dvorak\n"), false); + break; + + case _QWERTY: + oled_write_P(PSTR("Qwerty\n"), false); + break; + + default: + oled_write_P(PSTR("Undefined\n"), false); + break; +#endif + } +} + +/** @brief displays the current active layer. + * + * If any argument is invalid, the function has no effect. + * + * @param void. + * @return void. + */ +void render_layer_state(void){ + CUSTOM_LAYERS_T current_layer; + current_layer=(CUSTOM_LAYERS_T)get_highest_layer(layer_state); + +#ifdef OLED_VERTICAL + oled_write_P(PSTR("Lyr:\n"), false); +#else + oled_write_P(PSTR("Layer:"), false); +#endif + + switch(current_layer){ +#ifdef OLED_VERTICAL + case _LOWER: + oled_write_P(PSTR("Lwr\n"), true); + break; + + case _RAISE: + oled_write_P(PSTR("Ris\n"), true); + break; + + case _ADJUST: + oled_write_P(PSTR("Adj\n"), true); + break; + + case _NUMPAD: + oled_write_P(PSTR("Num\n"), true); + break; + + default: + oled_write_P(PSTR("Def\n"), false); + break; + +#else + case _LOWER: + oled_write_P(PSTR(" Lower "), true); + break; + + case _RAISE: + oled_write_P(PSTR(" Raise "), true); + break; + + case _ADJUST: + oled_write_P(PSTR(" Adjust "), true); + break; + + case _NUMPAD: + oled_write_P(PSTR(" Numpad "), true); + break; + + default: + oled_write_P(PSTR(" Default "), false); + break; +#endif + } +} + +/** @brief displays the current status of the main display/ + * + * If any argument is invalid, the function has no effect. + * + * @param void. + * @return void. + */ +void render_status(void){ + render_layout_state(); + oled_write_P(PSTR("\n"), false); + render_layer_state(); + render_keylogger_status(); +} + +/** @brief renders the logo to be displayed. + * + * If any argument is invalid, the function has no effect. + * + * @param void. + * @return void. + */ +static void render_logo(void){ + static const char PROGMEM qmk_logo[] = { + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, + 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, + 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, + 0x00}; + + oled_write_P(qmk_logo, false); +} + +/** @brief executes the actions for both displays. + * + * If any argument is invalid, the function has no effect. + * + * @param void. + * @return void. + */ +void oled_task_user(void){ + if (timer_elapsed32(standby_oled_timer) > 15000){ + oled_off(); + }else{ + oled_on(); + if(true==is_master){ + render_status(); + }else{ + render_logo(); + oled_write_P(PSTR("\n"), false); + oled_scroll_left(); + } + } +} + +/** @brief process the current key and add it to the keylog string. + * + * If any argument is invalid, the function has no effect. + * + * @param keycode pressed key. + * @return void. + */ +extern void add_keylog(uint16_t keycode){ + if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)){ + keycode&=0x00FF; + } + + if(current_cursor_pos>(KEYLOG_LEN-1)||(current_cursor_pos>KEYLOG_STRING_STARTUP)){ + current_cursor_pos=0; + last_c=get_ascii(keycode); + current_cursor_pos++; + }else{ + if(keycode <= KC_TILD){ + keylog_str[current_cursor_pos]=last_c; + last_c=get_ascii(keycode); + current_cursor_pos++; + } + keylog_str[current_cursor_pos] = '\0'; + } + + log_timer = timer_read(); + + standby_oled_timer = timer_read32(); +} diff --git a/keyboards/crkbd/keymaps/mcrown/oled.h b/keyboards/crkbd/keymaps/mcrown/oled.h new file mode 100644 index 0000000000..7e7c746b99 --- /dev/null +++ b/keyboards/crkbd/keymaps/mcrown/oled.h @@ -0,0 +1,34 @@ +/** @file oled.h + * @brief oled header that includes function prototypes and external variables. + * + * 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 . + * + * @author Mario Corona (mariocc@comunidad.unam.mx) 2021 + * + */ +#pragma once + +#include +#include "mcrown.h" + +#ifdef OLED_VERTICAL +#define KEYLOG_LEN (48) +#else +#define KEYLOG_LEN (19) +#endif + +#define KEYLOG_EOL_LEN (KEYLOG_LEN+1) + +extern void add_keylog(uint16_t keycode); +extern void update_log(void); diff --git a/keyboards/crkbd/keymaps/mcrown/readme.md b/keyboards/crkbd/keymaps/mcrown/readme.md new file mode 100644 index 0000000000..e6034b1234 --- /dev/null +++ b/keyboards/crkbd/keymaps/mcrown/readme.md @@ -0,0 +1,13 @@ +![the-frey-layout](https://raw.githubusercontent.com/MarioCorona/mcrown_pics/main/mcrown_layout.png) + +# Keyboard layout by MCrown + +This is all four layers: + +- The top indicates the RAISE layer +- The middle indicates the DEFAULT layer +- The bottom indicates the LOWER layer +- Green indicated ADJUST layer + +All the keys respond as you'd expect to the 'shift' key - i.e. on a UK/GB keyboard, `/` becomes `?` and so on. + diff --git a/keyboards/crkbd/keymaps/mcrown/rules.mk b/keyboards/crkbd/keymaps/mcrown/rules.mk new file mode 100644 index 0000000000..df09acc6c0 --- /dev/null +++ b/keyboards/crkbd/keymaps/mcrown/rules.mk @@ -0,0 +1,18 @@ + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = no # Audio control and System control(+450) +RGB_MATRIX_ENABLE = yes # Enable RGB Matrix. +OLED_DRIVER_ENABLE = yes + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend + +# If you want to change the display of OLED, you need to change here +SRC += ./lib/rgb_state_reader.c \ + ./lib/layer_state_reader.c \ + ./lib/logo_reader.c \ + ./oled.c\