From 4904a3c9ecb504270aa45fa48000f36c54a1172b Mon Sep 17 00:00:00 2001 From: Lucas Date: Fri, 13 Dec 2019 15:35:55 -0500 Subject: [PATCH 1/6] Added KidBrazil custom keymap for CRKBD -Custom Font -Custom OLED output --- keyboards/crkbd/keymaps/kidbrazil/config.h | 99 +++++++ keyboards/crkbd/keymaps/kidbrazil/glcdfont.c | 243 ++++++++++++++++++ keyboards/crkbd/keymaps/kidbrazil/keymap.c | 203 +++++++++++++++ .../crkbd/keymaps/kidbrazil/kidbrazil.json | 1 + .../keymaps/kidbrazil/layer_state_reader.c | 36 +++ .../crkbd/keymaps/kidbrazil/logo_reader.c | 11 + keyboards/crkbd/keymaps/kidbrazil/rules.mk | 18 ++ 7 files changed, 611 insertions(+) create mode 100644 keyboards/crkbd/keymaps/kidbrazil/config.h create mode 100644 keyboards/crkbd/keymaps/kidbrazil/glcdfont.c create mode 100644 keyboards/crkbd/keymaps/kidbrazil/keymap.c create mode 100644 keyboards/crkbd/keymaps/kidbrazil/kidbrazil.json create mode 100644 keyboards/crkbd/keymaps/kidbrazil/layer_state_reader.c create mode 100644 keyboards/crkbd/keymaps/kidbrazil/logo_reader.c create mode 100644 keyboards/crkbd/keymaps/kidbrazil/rules.mk diff --git a/keyboards/crkbd/keymaps/kidbrazil/config.h b/keyboards/crkbd/keymaps/kidbrazil/config.h new file mode 100644 index 000000000000..fe7951b18057 --- /dev/null +++ b/keyboards/crkbd/keymaps/kidbrazil/config.h @@ -0,0 +1,99 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako +Copyright 2015 Jack Humbert + +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 USE_MATRIX_I2C + +/* Select hand configuration */ + +#define MASTER_LEFT +// #define MASTER_RIGHT +// #define EE_HANDS + +//#define SSD1306OLED + +#define USE_SERIAL_PD2 + +#define TAPPING_FORCE_HOLD +#define TAPPING_TERM 150 +#undef PRODUCT +#define PRODUCT CRKBD Loose Transistor Ed. + +#ifdef RGBLIGHT_ENABLE + //#undef RGBLED_NUM + //#define RGBLIGHT_ANIMATIONS + #define RGBLIGHT_EFFECT_BREATHING + #define RGBLIGHT_EFFECT_RAINBOW_MOOD + #define RGBLIGHT_EFFECT_KNIGHT + //#define RGBLED_NUM 27 + #define RGBLIGHT_LIMIT_VAL 120 + #define RGBLIGHT_HUE_STEP 10 + #define RGBLIGHT_SAT_STEP 17 + #define RGBLIGHT_VAL_STEP 17 +#endif + +#ifdef RGB_MATRIX_ENABLE +//# define RGB_MATRIX_KEYPRESSES // reacts to keypresses +// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses) +// # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects +# define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended +# define RGB_MATRIX_FRAMEBUFFER_EFFECTS +// # define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness) +// # define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness) +# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 // limits maximum brightness of LEDs to 150 out of 255. Higher may cause the controller to crash. +# define RGB_MATRIX_HUE_STEP 8 +# define RGB_MATRIX_SAT_STEP 8 +# define RGB_MATRIX_VAL_STEP 8 +# define RGB_MATRIX_SPD_STEP 10 + +/* Disable the animations you don't want/need. You will need to disable a good number of these * + * because they take up a lot of space. Disable until you can successfully compile your firmware. */ +# define DISABLE_RGB_MATRIX_ALPHAS_MODS +# define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN +// # define DISABLE_RGB_MATRIX_BREATHING +# 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_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 +# define DISABLE_RGB_MATRIX_TYPING_HEATMAP +# define DISABLE_RGB_MATRIX_DIGITAL_RAIN +# define DISABLE_RGB_MATRIX_SOLID_REACTIVE +# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +# 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 +#endif +#define OLED_FONT_H "keyboards/crkbd/keymaps/kidbrazil/glcdfont.c" +#define OLED_DISABLE_TIMEOUT diff --git a/keyboards/crkbd/keymaps/kidbrazil/glcdfont.c b/keyboards/crkbd/keymaps/kidbrazil/glcdfont.c new file mode 100644 index 000000000000..a67c329242ed --- /dev/null +++ b/keyboards/crkbd/keymaps/kidbrazil/glcdfont.c @@ -0,0 +1,243 @@ +// This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0. +// See gfxfont.h for newer custom bitmap font info. + +#ifndef FONT5X7_H +#define FONT5X7_H + +#ifdef __AVR__ + #include + #include +#elif defined(ESP8266) + #include +#else + #define PROGMEM +#endif + +// Standard ASCII 5x7 font +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, 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, 0xC0, 0xE0, 0xF0, 0xF8, + 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0x00, + 0xFC, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0x02, 0xF9, 0x01, 0x01, 0x05, 0x09, + 0x11, 0x22, 0x06, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0x46, 0x46, + 0x44, 0x44, 0x45, 0x44, 0x29, 0x28, + 0x2A, 0x28, 0x11, 0x13, 0x05, 0x07, + 0x05, 0x07, 0x05, 0x07, 0x05, 0x07, + 0xE5, 0xE7, 0xE5, 0x07, 0x05, 0x07, + 0x05, 0x07, 0x05, 0x07, 0x05, 0x07, + 0x85, 0xC7, 0xE5, 0xE7, 0xE5, 0xE7, + 0xE5, 0xE7, 0xE5, 0xC7, 0x85, 0x07, + 0x85, 0xC7, 0xE5, 0xE7, 0xE5, 0xE7, + 0xE5, 0xE7, 0xE5, 0xC7, 0x85, 0x07, + 0x85, 0xC7, 0xE5, 0xE7, 0xE5, 0xE7, + 0xE5, 0xE7, 0xE5, 0xE7, 0xE5, 0x07, + 0xE5, 0xE7, 0xE5, 0xE7, 0xE5, 0xE7, + 0xE5, 0xE7, 0xE5, 0xE7, 0xE5, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC, + 0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00, + 0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E, + 0x7E, 0x7E, 0x7F, 0x7F, 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, + 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xE3, 0xC1, 0xC1, 0x00, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0xFF, 0x00, 0x00, 0x80, 0x00, + 0x1C, 0x3E, 0x7F, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x14, 0x14, 0x14, + 0x14, 0x14, 0x08, 0x08, 0x00, 0x00, + 0xFF, 0xFF, 0xFF, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, + 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0xBE, + 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, + 0xFF, 0xFF, 0xFF, 0xFF, 0x81, 0xBD, + 0x81, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, + 0x8F, 0x9F, 0x9C, 0x9C, 0x9C, 0x9C, + 0x9C, 0x9C, 0x9C, 0xFC, 0xF8, 0x00, + 0xFF, 0xFF, 0xFF, 0x9C, 0x9C, 0x9C, + 0x9C, 0x9C, 0x9C, 0x80, 0x80, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, + 0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00, + 0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F, + 0x3F, 0x3F, 0x7F, 0x7F, 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, + 0x00, 0x00, 0x01, 0x03, 0x07, 0x0F, + 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, + 0x1F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, + 0x20, 0x47, 0x48, 0x50, 0x40, 0x41, + 0x42, 0x24, 0x30, 0x3F, 0x3F, 0x3F, + 0x3F, 0x3F, 0x3F, 0x3F, 0x31, 0x31, + 0x11, 0x51, 0x11, 0x11, 0x4A, 0x0A, + 0x2A, 0x0A, 0x44, 0x64, 0x50, 0x70, + 0x50, 0x70, 0x50, 0x70, 0x50, 0x70, + 0x53, 0x73, 0x53, 0x73, 0x53, 0x73, + 0x53, 0x73, 0x53, 0x73, 0x53, 0x70, + 0x50, 0x71, 0x53, 0x73, 0x53, 0x73, + 0x53, 0x73, 0x53, 0x71, 0x50, 0x70, + 0x50, 0x71, 0x53, 0x73, 0x53, 0x73, + 0x53, 0x73, 0x53, 0x71, 0x50, 0x70, + 0x53, 0x73, 0x53, 0x73, 0x53, 0x73, + 0x53, 0x73, 0x53, 0x73, 0x51, 0x70, + 0x53, 0x73, 0x53, 0x73, 0x53, 0x73, + 0x53, 0x73, 0x53, 0x73, 0x53, 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, +}; +#endif // FONT5X7_H diff --git a/keyboards/crkbd/keymaps/kidbrazil/keymap.c b/keyboards/crkbd/keymaps/kidbrazil/keymap.c new file mode 100644 index 000000000000..bc65a86cec36 --- /dev/null +++ b/keyboards/crkbd/keymaps/kidbrazil/keymap.c @@ -0,0 +1,203 @@ +#include QMK_KEYBOARD_H + +#ifdef RGBLIGHT_ENABLE +//Following line allows macro to read current RGB settings +extern rgblight_config_t rgblight_config; +#endif + +extern uint8_t is_master; + +enum crkbd_layers { + _QWERTY, + _NUM, + _SYM, + _GAME, + _WEAPON +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT(\ + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,\ + LSFT_T(KC_TAB), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,\ + KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,\ + LGUI_T(KC_PGUP), MO(_NUM), KC_SPC, KC_ENT, MO(_SYM), LALT_T(KC_PGDN)\ + ), + + [_NUM] = LAYOUT(\ + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL,\ + LSFT_T(KC_TAB), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_F12, KC_NO,\ + KC_LCTL, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_PGUP, KC_PGDN, KC_HOME, KC_END, KC_F11, KC_NO,\ + LGUI_T(KC_PGUP), KC_TRNS, KC_SPC, KC_ENT, KC_TRNS, LALT_T(KC_PGDN)\ + ), + + [_SYM] = LAYOUT(\ + KC_ESC, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,\ + LSFT_T(KC_TAB), RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, KC_MINS, KC_EQL, KC_LCBR, KC_RCBR, KC_PIPE, KC_GRV,\ + KC_LCTL, RGB_VAD, RGB_RMOD, RGB_HUD, RGB_SAD, TG(_GAME), KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_BSLS, KC_TILD,\ + LGUI_T(KC_PGUP), KC_TRNS, KC_SPC, KC_ENT, KC_TRNS, LALT_T(KC_PGDN)\ + ), + + [_GAME] = LAYOUT(\ + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6,\ + KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_F7, KC_F8, KC_F9, KC_F10, KC_NO, KC_NO,\ + KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_TRNS, KC_PGUP, KC_PGDN, KC_NO, KC_NO, KC_NO, KC_NO,\ + KC_TAB, MO(_WEAPON), KC_SPC, KC_ENT, KC_TRNS, KC_NO\ + ), + + [_WEAPON] = LAYOUT(\ + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ + KC_TRNS, KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_6, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ + KC_TRNS, KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_7, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ + KC_TRNS, KC_TAB, KC_TRNS, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS\ + ) +}; + +int RGB_current_mode; + +void persistent_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +#ifdef OLED_DRIVER_ENABLE + +// Set LED Rotation +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + if (!has_usb()) + return OLED_ROTATION_180; // flips the display 180 to see it from my side + return rotation; +} + +// Load logo from font +const char *read_logo(void); + +// Render Blank Space +void render_space(void) { + oled_write_ln_P(PSTR(" "), false); +} + +void render_separator(void) { + // Switch display based on Layer + switch (biton32(layer_state)){ + case _GAME: + case _WEAPON: + oled_write_ln_P(PSTR("===================="), false); + break; + default: + oled_write_ln_P(PSTR("++++++++++++++++++++"), false); + } +} + +// Render Current Layer +void render_layer_state(void){ + // If you want to change the display of OLED, you need to change here + switch (biton32(layer_state)){ + case _QWERTY: + oled_write_ln_P(PSTR("| MODE | QWRTY ]"), false); + break; + case _NUM: + oled_write_ln_P(PSTR("| MODE | NUMBERS ]"), false); + break; + case _SYM: + oled_write_ln_P(PSTR("| MODE | SYMBOLS ]"), false); + break; + case _GAME: + oled_write_ln_P(PSTR("| G A M E ]"), false); + break; + case _WEAPON: + oled_write_ln_P(PSTR("| W E A P O N ]"), false); + break; + default: + oled_write_ln_P(PSTR("| MODE | UNDEF ]"), false); + } +} + +// Render USB State +void render_usb_state(void) { + switch (USB_DeviceState) { + case DEVICE_STATE_Unattached: + oled_write_ln_P(PSTR("| USB | FREE ]"), false); + break; + case DEVICE_STATE_Suspended: + oled_write_ln_P(PSTR("| USB | SLEEP ]"), false); + break; + case DEVICE_STATE_Configured: + oled_write_ln_P(PSTR("| USB | READY ]"), false); + break; + case DEVICE_STATE_Powered: + oled_write_ln_P(PSTR("| USB | PWRD ]"), false); + break; + case DEVICE_STATE_Default: + oled_write_ln_P(PSTR("| USB | DFLT ]"), false); + break; + case DEVICE_STATE_Addressed: + oled_write_ln_P(PSTR("| USB | ADDRS ]"), false); + break; + default: + oled_write_ln_P(PSTR("| USB | INVALID ]"), false); + } +} + +// Render Logo +void render_logo(void) { + oled_write(read_logo(), false); +} + +// Master OLED Screen (Left Hand ) +void render_master_oled(void) { + // Switch display based on Layer + switch (biton32(layer_state)){ + case _GAME: + render_separator(); + render_layer_state(); + render_separator(); + render_separator(); + break; + case _WEAPON: + render_separator(); + render_separator(); + render_layer_state(); + render_separator(); + break; + default: + render_separator(); + render_layer_state(); + render_separator(); + render_usb_state(); + } +} + +void render_slave_oled(void) { + //now print logo + render_logo(); +} + +// OLED Task +void oled_task_user(void){ + + switch (USB_DeviceState) { + case DEVICE_STATE_Unattached: + case DEVICE_STATE_Powered: + case DEVICE_STATE_Suspended: + render_logo(); + break; + default: + if (is_master) { + render_master_oled(); + } else { + render_slave_oled(); + } + } +} +#endif + +// Suspend / Wake ----------------- +void suspend_power_down_kb(void) { + rgb_matrix_set_suspend_state(true); + oled_off(); +} + +void suspend_wakeup_init_user(void) { + rgb_matrix_set_suspend_state(false); + oled_on(); +} diff --git a/keyboards/crkbd/keymaps/kidbrazil/kidbrazil.json b/keyboards/crkbd/keymaps/kidbrazil/kidbrazil.json new file mode 100644 index 000000000000..dd9895cce97c --- /dev/null +++ b/keyboards/crkbd/keymaps/kidbrazil/kidbrazil.json @@ -0,0 +1 @@ +{"keyboard":"crkbd/rev1","keymap":"kidbrazil","layout":"LAYOUT","layers":[["KC_ESC","KC_Q","KC_W","KC_E","KC_R","KC_T","KC_Y","KC_U","KC_I","KC_O","KC_P","KC_BSPC","LCTL_T(KC_TAB)","KC_A","KC_S","KC_D","KC_F","KC_G","KC_H","KC_J","KC_K","KC_L","KC_SCLN","KC_QUOT","KC_LSFT","KC_Z","KC_X","KC_C","KC_V","KC_B","KC_N","KC_M","KC_COMM","KC_DOT","KC_SLSH","KC_RSFT","LGUI_T(KC_PGUP)","MO(1)","KC_SPC","KC_ENT","MO(2)","LALT_T(KC_PGDN)"],["KC_ESC","KC_1","KC_2","KC_3","KC_4","KC_5","KC_6","KC_7","KC_8","KC_9","KC_0","KC_DEL","LCTL_T(KC_TAB)","KC_F1","KC_F2","KC_F3","KC_F4","KC_F5","KC_LEFT","KC_UP","KC_DOWN","KC_RGHT","KC_F12","KC_NO","KC_LSFT","KC_F6","KC_F7","KC_F8","KC_F9","KC_F10","KC_PGUP","KC_PGDN","KC_HOME","KC_END","KC_F11","KC_NO","LGUI_T(KC_PGUP)","KC_TRNS","KC_SPC","KC_ENT","KC_TRNS","LALT_T(KC_PGDN)"],["KC_ESC","KC_EXLM","KC_AT","KC_HASH","KC_DLR","KC_PERC","KC_CIRC","KC_AMPR","KC_ASTR","KC_LPRN","KC_RPRN","KC_BSPC","LCTL_T(KC_TAB)","RGB_TOG","RGB_MOD","RGB_HUI","RGB_SAI","RGB_VAI","KC_MINS","KC_EQL","KC_LCBR","KC_RCBR","KC_PIPE","KC_GRV","KC_LSFT","RGB_VAD","RGB_RMOD","RGB_HUD","RGB_SAD","TG(3)","KC_UNDS","KC_PLUS","KC_LBRC","KC_RBRC","KC_BSLS","KC_TILD","LGUI_T(KC_PGUP)","KC_TRNS","KC_SPC","KC_ENT","KC_TRNS","LALT_T(KC_PGDN)"],["KC_ESC","KC_Q","KC_W","KC_E","KC_R","KC_T","KC_F1","KC_F2","KC_F3","KC_F4","KC_F5","KC_F6","KC_LSFT","KC_A","KC_S","KC_D","KC_F","KC_G","KC_F7","KC_F8","KC_F9","KC_F10","KC_NO","KC_NO","KC_LCTL","KC_Z","KC_X","KC_C","KC_V","KC_TRNS","KC_PGUP","KC_PGDN","KC_NO","KC_NO","KC_NO","KC_NO","KC_TAB","MO(4)","KC_SPC","KC_ENT","KC_TRNS","KC_NO"],["KC_ESC","KC_1","KC_2","KC_3","KC_4","KC_5","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_LSFT","KC_A","KC_S","KC_D","KC_F","KC_6","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_LCTL","KC_Z","KC_X","KC_C","KC_V","KC_7","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TAB","KC_TRNS","KC_SPC","KC_TRNS","KC_TRNS","KC_TRNS"]],"author":"","notes":""} \ No newline at end of file diff --git a/keyboards/crkbd/keymaps/kidbrazil/layer_state_reader.c b/keyboards/crkbd/keymaps/kidbrazil/layer_state_reader.c new file mode 100644 index 000000000000..f2d59fd54af5 --- /dev/null +++ b/keyboards/crkbd/keymaps/kidbrazil/layer_state_reader.c @@ -0,0 +1,36 @@ + +#include QMK_KEYBOARD_H +#include +#include "crkbd.h" + +// in the future, should use (1U<<_LAYER_NAME) instead, but needs to be moved to keymap,c +char layer_state_str[24]; + +const char *read_layer_state(void) { + switch (layer_state) + { + case 0: + snprintf(layer_state_str, sizeof(layer_state_str), "Layer | [ QWRTY ]"); + break; + case 2: + snprintf(layer_state_str, sizeof(layer_state_str), "Layer | [ NUMBERS ]"); + break; + case 4: + snprintf(layer_state_str, sizeof(layer_state_str), "Layer | [ SYMBOLS ]"); + break; + case 6: + snprintf(layer_state_str, sizeof(layer_state_str), "Layer | [ DOUBLETROUBLES ]"); + break; + case 8: + snprintf(layer_state_str, sizeof(layer_state_str), "Layer | [ GAMING ]"); + break; + case 24: + case 12: + snprintf(layer_state_str, sizeof(layer_state_str), "Layer | [ WEAPONS ]"); + break; + default: + snprintf(layer_state_str, sizeof(layer_state_str), "Layer | Undef-%ld", layer_state); + } + + return layer_state_str; +} diff --git a/keyboards/crkbd/keymaps/kidbrazil/logo_reader.c b/keyboards/crkbd/keymaps/kidbrazil/logo_reader.c new file mode 100644 index 000000000000..1bc1503a6042 --- /dev/null +++ b/keyboards/crkbd/keymaps/kidbrazil/logo_reader.c @@ -0,0 +1,11 @@ +#include "crkbd.h" + +const char *read_logo(void) { + static char 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, + 0}; + + return logo; +} diff --git a/keyboards/crkbd/keymaps/kidbrazil/rules.mk b/keyboards/crkbd/keymaps/kidbrazil/rules.mk new file mode 100644 index 000000000000..c5b159b30cfa --- /dev/null +++ b/keyboards/crkbd/keymaps/kidbrazil/rules.mk @@ -0,0 +1,18 @@ +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +MOUSEKEY_ENABLE = no +RGBLIGHT_ENABLE = no +RGB_MATRIX_ENABLE = WS2812 +OLED_DRIVER_ENABLE = yes + +# If you want to change the display of OLED, you need to change here +SRC += ./keyboards/crkbd/keymaps/kidbrazil/layer_state_reader.c \ + ./keyboards/crkbd/keymaps/kidbrazil/logo_reader.c \ + #./lib/rgb_state_reader.c \ + #./lib/logo_reader.c \ + #./lib/keylogger.c \ + # ./lib/mode_icon_reader.c \ + # ./lib/host_led_state_reader.c \ + # ./lib/timelogger.c \ From eed0be88ba244e80b269bef77943b9d5252ed260 Mon Sep 17 00:00:00 2001 From: Lucas Date: Fri, 13 Dec 2019 15:48:15 -0500 Subject: [PATCH 2/6] Added missing readme --- keyboards/crkbd/keymaps/kidbrazil/README.md | 52 +++++++++++++++++++++ keyboards/crkbd/keymaps/kidbrazil/config.h | 1 + keyboards/crkbd/keymaps/kidbrazil/keymap.c | 27 ++++++----- 3 files changed, 66 insertions(+), 14 deletions(-) create mode 100644 keyboards/crkbd/keymaps/kidbrazil/README.md diff --git a/keyboards/crkbd/keymaps/kidbrazil/README.md b/keyboards/crkbd/keymaps/kidbrazil/README.md new file mode 100644 index 000000000000..ebc56be52cc2 --- /dev/null +++ b/keyboards/crkbd/keymaps/kidbrazil/README.md @@ -0,0 +1,52 @@ +#KidBrazil's custom CRKBD Layout + +![Crkbd](https://user-images.githubusercontent.com/736191/40575636-6fba63a4-6123-11e8-9ca0-3f990f1f9f4c.jpg) + +This is a simple layout that I use for both programming and gaming. It is very +closely based on the original CRKBD layout with some modifications to the +position of CTRL and SHIFT. + +## Layers +This keymap includes a total of 4 Layers: +- QWERTY +- NUMBERS +- SYMBOLS +- GAMING +- WEAPONS + +The first three layers are pretty self explanatory and follow closely the +default keymap for this keyboard. The magic really starts to happen with the +gaming layer. + +### Gaming Layer +The gaming layer can be toggled on/off from the SYMBOLS layer. Once on the +gaming layer it will stay there until you toggle it off again. The gaming layer +includes normal WASD and most of the keys FPS games use on the left hand. On the +right hand we have F1-F12 and a few other special keys for games that require +it. + +### Weapon +The weapon layer is a momentary layer that can only be reached from the gaming +layer. This layer preserves the left hand almost unchanged, except for when the +layer is activated the top row becomes NUM 1 - 6 for wepon selection. The right +hand is KC_TRNS the whole way so basically it is still the gaming layer. + +## Custom Font +This keymap includes a custom font for my LooseTransistor logo. It is fine if +you want to use it I certainly don't mind but if you want your own, just replace +the glcdfont file here and you should be fine. + +Alternatively you could remove the font config line from the config.h file so it +will use the default QMK one. + +##OLED +This Keymap is setup to use the newer OLED API. Some work has been done to +customize this with showing layer and USB information. I also tried my best to +get a dormant / sleep state going but it is hit or miss and often only works on +the master hand. + +### TODO +- Fix OLED and Backlight so they turn off when the computer sleeps, currently + only the left hand does that and the LEDs still stay on. +- Wait for Spit_common to be implemented in CRKBD and revisit the special color + layers and animations diff --git a/keyboards/crkbd/keymaps/kidbrazil/config.h b/keyboards/crkbd/keymaps/kidbrazil/config.h index fe7951b18057..dd3f1a0307c4 100644 --- a/keyboards/crkbd/keymaps/kidbrazil/config.h +++ b/keyboards/crkbd/keymaps/kidbrazil/config.h @@ -3,6 +3,7 @@ This is the c configuration file for the keymap Copyright 2012 Jun Wako Copyright 2015 Jack Humbert +Copyright 2019 Lucas Moreira 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 diff --git a/keyboards/crkbd/keymaps/kidbrazil/keymap.c b/keyboards/crkbd/keymaps/kidbrazil/keymap.c index bc65a86cec36..16b77f04b449 100644 --- a/keyboards/crkbd/keymaps/kidbrazil/keymap.c +++ b/keyboards/crkbd/keymaps/kidbrazil/keymap.c @@ -12,7 +12,7 @@ enum crkbd_layers { _NUM, _SYM, _GAME, - _WEAPON + _WEAPON }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -174,20 +174,19 @@ void render_slave_oled(void) { // OLED Task void oled_task_user(void){ - - switch (USB_DeviceState) { - case DEVICE_STATE_Unattached: - case DEVICE_STATE_Powered: - case DEVICE_STATE_Suspended: - render_logo(); - break; - default: - if (is_master) { - render_master_oled(); - } else { - render_slave_oled(); + switch (USB_DeviceState) { + case DEVICE_STATE_Unattached: + case DEVICE_STATE_Powered: + case DEVICE_STATE_Suspended: + render_logo(); + break; + default: + if (is_master) { + render_master_oled(); + } else { + render_slave_oled(); + } } - } } #endif From 6de75b54295150619f75062a9a01a76f4e5f8f8b Mon Sep 17 00:00:00 2001 From: Lucas Moreira Date: Sun, 15 Dec 2019 13:32:39 -0500 Subject: [PATCH 3/6] Oled Timeout Update for KidBrazil Keymap (#1) * Setup Oled timeout based on simple timer * Cleaned up comments and added timeout for LEDs * Fixed some small errors * Updated oled timout with matrix scan * Updated oled timout with matrix scan * Update withou eeprom * Update timer code * Use process user instead of keymap * Added ifdef to protect oledtimer * Updated with half timeout state for logo * Removed middle tier timer --- keyboards/crkbd/keymaps/kidbrazil/keymap.c | 99 ++++++++++++++-------- keyboards/crkbd/keymaps/kidbrazil/rules.mk | 3 +- 2 files changed, 63 insertions(+), 39 deletions(-) diff --git a/keyboards/crkbd/keymaps/kidbrazil/keymap.c b/keyboards/crkbd/keymaps/kidbrazil/keymap.c index 16b77f04b449..a395f41b1ef5 100644 --- a/keyboards/crkbd/keymaps/kidbrazil/keymap.c +++ b/keyboards/crkbd/keymaps/kidbrazil/keymap.c @@ -1,12 +1,13 @@ #include QMK_KEYBOARD_H -#ifdef RGBLIGHT_ENABLE -//Following line allows macro to read current RGB settings -extern rgblight_config_t rgblight_config; -#endif - +// [Init Variables] ----------------------------------------------------------// extern uint8_t is_master; +// Oled timer similar to Drashna's +static uint32_t oled_timer = 0; +// Boolean to store +bool eeprom_oled_enabled = false; +// [CRKBD layers Init] -------------------------------------------------------// enum crkbd_layers { _QWERTY, _NUM, @@ -15,6 +16,7 @@ enum crkbd_layers { _WEAPON }; +// [Keymaps] -----------------------------------------------------------------// const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_QWERTY] = LAYOUT(\ KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,\ @@ -52,32 +54,56 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ) }; -int RGB_current_mode; +//int RGB_current_mode; +// [Persistent Default Layer] ------------------------------------------------// void persistent_default_layer_set(uint16_t default_layer) { eeconfig_update_default_layer(default_layer); default_layer_set(default_layer); } +// void matrix_scan_user(void) { +// rgblight_config_t rgblight_config; +// rgblight_config.raw = eeconfig_read_rgblight(); +// // Save LED State +// eeprom_oled_enabled = rgblight_config.enable; +// } + +// [Process User Input] ------------------------------------------------------// +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + // Use process_record_keymap to reset timer on keypress + if (record->event.pressed) { + #ifdef OLED_DRIVER_ENABLE + oled_timer = timer_read32(); + #endif + // Restore LEDs if they are enabled in eeprom + rgb_matrix_enable_noeeprom(); + } + return true; +} + +// [OLED Configuration] ------------------------------------------------------// #ifdef OLED_DRIVER_ENABLE -// Set LED Rotation +// Init Oled and Rotate.... oled_rotation_t oled_init_user(oled_rotation_t rotation) { if (!has_usb()) return OLED_ROTATION_180; // flips the display 180 to see it from my side return rotation; } -// Load logo from font +// Read logo from font file const char *read_logo(void); +// {OLED helpers} -----------------------------------------------// + // Render Blank Space void render_space(void) { oled_write_ln_P(PSTR(" "), false); } +// Render separator lines for oled display void render_separator(void) { - // Switch display based on Layer switch (biton32(layer_state)){ case _GAME: case _WEAPON: @@ -88,7 +114,7 @@ void render_separator(void) { } } -// Render Current Layer +// Render current layer state void render_layer_state(void){ // If you want to change the display of OLED, you need to change here switch (biton32(layer_state)){ @@ -167,36 +193,35 @@ void render_master_oled(void) { } } +// lave OLED scren (Right Hand) void render_slave_oled(void) { - //now print logo render_logo(); } -// OLED Task -void oled_task_user(void){ - switch (USB_DeviceState) { - case DEVICE_STATE_Unattached: - case DEVICE_STATE_Powered: - case DEVICE_STATE_Suspended: - render_logo(); - break; - default: - if (is_master) { - render_master_oled(); - } else { - render_slave_oled(); - } - } +// {OLED Task} -----------------------------------------------// +void oled_task_user(void) { + // Drashna style timeout for LED and OLED + if (timer_elapsed32(oled_timer) > 30000) { + oled_off(); + rgb_matrix_disable_noeeprom(); + return; + } + else { + oled_on(); + } + // Show logo when USB dormant + switch (USB_DeviceState) { + case DEVICE_STATE_Unattached: + case DEVICE_STATE_Powered: + case DEVICE_STATE_Suspended: + render_logo(); + break; + default: + if (is_master) { + render_master_oled(); + } else { + render_slave_oled(); + } + } } #endif - -// Suspend / Wake ----------------- -void suspend_power_down_kb(void) { - rgb_matrix_set_suspend_state(true); - oled_off(); -} - -void suspend_wakeup_init_user(void) { - rgb_matrix_set_suspend_state(false); - oled_on(); -} diff --git a/keyboards/crkbd/keymaps/kidbrazil/rules.mk b/keyboards/crkbd/keymaps/kidbrazil/rules.mk index c5b159b30cfa..9896a8f69f32 100644 --- a/keyboards/crkbd/keymaps/kidbrazil/rules.mk +++ b/keyboards/crkbd/keymaps/kidbrazil/rules.mk @@ -8,8 +8,7 @@ RGB_MATRIX_ENABLE = WS2812 OLED_DRIVER_ENABLE = yes # If you want to change the display of OLED, you need to change here -SRC += ./keyboards/crkbd/keymaps/kidbrazil/layer_state_reader.c \ - ./keyboards/crkbd/keymaps/kidbrazil/logo_reader.c \ +SRC += ./keyboards/crkbd/keymaps/kidbrazil/logo_reader.c \ #./lib/rgb_state_reader.c \ #./lib/logo_reader.c \ #./lib/keylogger.c \ From f1e3382432e13b4e76669a7acff693e8c45dc12f Mon Sep 17 00:00:00 2001 From: Lucas Moreira Date: Sun, 15 Dec 2019 13:35:40 -0500 Subject: [PATCH 4/6] Final cleanup of unused files --- keyboards/crkbd/keymaps/kidbrazil/keymap.c | 4 +-- .../keymaps/kidbrazil/layer_state_reader.c | 36 ------------------- 2 files changed, 2 insertions(+), 38 deletions(-) delete mode 100644 keyboards/crkbd/keymaps/kidbrazil/layer_state_reader.c diff --git a/keyboards/crkbd/keymaps/kidbrazil/keymap.c b/keyboards/crkbd/keymaps/kidbrazil/keymap.c index a395f41b1ef5..93eaa60e6c49 100644 --- a/keyboards/crkbd/keymaps/kidbrazil/keymap.c +++ b/keyboards/crkbd/keymaps/kidbrazil/keymap.c @@ -200,8 +200,8 @@ void render_slave_oled(void) { // {OLED Task} -----------------------------------------------// void oled_task_user(void) { - // Drashna style timeout for LED and OLED - if (timer_elapsed32(oled_timer) > 30000) { + // Drashna style timeout for LED and OLED Roughly 8mins + if (timer_elapsed32(oled_timer) > 480000) { oled_off(); rgb_matrix_disable_noeeprom(); return; diff --git a/keyboards/crkbd/keymaps/kidbrazil/layer_state_reader.c b/keyboards/crkbd/keymaps/kidbrazil/layer_state_reader.c deleted file mode 100644 index f2d59fd54af5..000000000000 --- a/keyboards/crkbd/keymaps/kidbrazil/layer_state_reader.c +++ /dev/null @@ -1,36 +0,0 @@ - -#include QMK_KEYBOARD_H -#include -#include "crkbd.h" - -// in the future, should use (1U<<_LAYER_NAME) instead, but needs to be moved to keymap,c -char layer_state_str[24]; - -const char *read_layer_state(void) { - switch (layer_state) - { - case 0: - snprintf(layer_state_str, sizeof(layer_state_str), "Layer | [ QWRTY ]"); - break; - case 2: - snprintf(layer_state_str, sizeof(layer_state_str), "Layer | [ NUMBERS ]"); - break; - case 4: - snprintf(layer_state_str, sizeof(layer_state_str), "Layer | [ SYMBOLS ]"); - break; - case 6: - snprintf(layer_state_str, sizeof(layer_state_str), "Layer | [ DOUBLETROUBLES ]"); - break; - case 8: - snprintf(layer_state_str, sizeof(layer_state_str), "Layer | [ GAMING ]"); - break; - case 24: - case 12: - snprintf(layer_state_str, sizeof(layer_state_str), "Layer | [ WEAPONS ]"); - break; - default: - snprintf(layer_state_str, sizeof(layer_state_str), "Layer | Undef-%ld", layer_state); - } - - return layer_state_str; -} From 285ccd94012489b0c285e162705fcdd6bb37d780 Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 17 Dec 2019 18:14:10 -0500 Subject: [PATCH 5/6] Updated code as per suggestions & requests --- keyboards/crkbd/keymaps/kidbrazil/README.md | 4 +- keyboards/crkbd/keymaps/kidbrazil/keymap.c | 55 ++++++++------------- keyboards/crkbd/keymaps/kidbrazil/rules.mk | 2 +- 3 files changed, 24 insertions(+), 37 deletions(-) diff --git a/keyboards/crkbd/keymaps/kidbrazil/README.md b/keyboards/crkbd/keymaps/kidbrazil/README.md index ebc56be52cc2..28414860c3b8 100644 --- a/keyboards/crkbd/keymaps/kidbrazil/README.md +++ b/keyboards/crkbd/keymaps/kidbrazil/README.md @@ -1,4 +1,4 @@ -#KidBrazil's custom CRKBD Layout +# KidBrazil's custom CRKBD Layout ![Crkbd](https://user-images.githubusercontent.com/736191/40575636-6fba63a4-6123-11e8-9ca0-3f990f1f9f4c.jpg) @@ -39,7 +39,7 @@ the glcdfont file here and you should be fine. Alternatively you could remove the font config line from the config.h file so it will use the default QMK one. -##OLED +## OLED This Keymap is setup to use the newer OLED API. Some work has been done to customize this with showing layer and USB information. I also tried my best to get a dormant / sleep state going but it is hit or miss and often only works on diff --git a/keyboards/crkbd/keymaps/kidbrazil/keymap.c b/keyboards/crkbd/keymaps/kidbrazil/keymap.c index 93eaa60e6c49..ef2fbac04679 100644 --- a/keyboards/crkbd/keymaps/kidbrazil/keymap.c +++ b/keyboards/crkbd/keymaps/kidbrazil/keymap.c @@ -19,56 +19,43 @@ enum crkbd_layers { // [Keymaps] -----------------------------------------------------------------// const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_QWERTY] = LAYOUT(\ - KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,\ - LSFT_T(KC_TAB), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,\ - KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,\ - LGUI_T(KC_PGUP), MO(_NUM), KC_SPC, KC_ENT, MO(_SYM), LALT_T(KC_PGDN)\ + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + LSFT_T(KC_TAB), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + LGUI_T(KC_PGUP), MO(_NUM), KC_SPC, KC_ENT, MO(_SYM), LALT_T(KC_PGDN) ), [_NUM] = LAYOUT(\ - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL,\ - LSFT_T(KC_TAB), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_F12, KC_NO,\ - KC_LCTL, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_PGUP, KC_PGDN, KC_HOME, KC_END, KC_F11, KC_NO,\ - LGUI_T(KC_PGUP), KC_TRNS, KC_SPC, KC_ENT, KC_TRNS, LALT_T(KC_PGDN)\ + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, + LSFT_T(KC_TAB), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_F12, KC_NO, + KC_LCTL, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_PGUP, KC_PGDN, KC_HOME, KC_END, KC_F11, KC_NO, + LGUI_T(KC_PGUP), KC_TRNS, KC_SPC, KC_ENT, KC_TRNS, LALT_T(KC_PGDN) ), [_SYM] = LAYOUT(\ - KC_ESC, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,\ - LSFT_T(KC_TAB), RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, KC_MINS, KC_EQL, KC_LCBR, KC_RCBR, KC_PIPE, KC_GRV,\ - KC_LCTL, RGB_VAD, RGB_RMOD, RGB_HUD, RGB_SAD, TG(_GAME), KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_BSLS, KC_TILD,\ - LGUI_T(KC_PGUP), KC_TRNS, KC_SPC, KC_ENT, KC_TRNS, LALT_T(KC_PGDN)\ + KC_ESC, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, + LSFT_T(KC_TAB), RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, KC_MINS, KC_EQL, KC_LCBR, KC_RCBR, KC_PIPE, KC_GRV, + KC_LCTL, RGB_VAD, RGB_RMOD, RGB_HUD, RGB_SAD, TG(_GAME), KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_BSLS, KC_TILD, + LGUI_T(KC_PGUP), KC_TRNS, KC_SPC, KC_ENT, KC_TRNS, LALT_T(KC_PGDN) ), [_GAME] = LAYOUT(\ - KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6,\ - KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_F7, KC_F8, KC_F9, KC_F10, KC_NO, KC_NO,\ - KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_TRNS, KC_PGUP, KC_PGDN, KC_NO, KC_NO, KC_NO, KC_NO,\ - KC_TAB, MO(_WEAPON), KC_SPC, KC_ENT, KC_TRNS, KC_NO\ + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, + KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_F7, KC_F8, KC_F9, KC_F10, KC_NO, KC_NO, + KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_TRNS, KC_PGUP, KC_PGDN, KC_NO, KC_NO, KC_NO, KC_NO, + KC_TAB, MO(_WEAPON), KC_SPC, KC_ENT, KC_TRNS, KC_NO ), [_WEAPON] = LAYOUT(\ - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ - KC_TRNS, KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_6, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ - KC_TRNS, KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_7, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ - KC_TRNS, KC_TAB, KC_TRNS, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS\ + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_6, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_7, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TAB, KC_TRNS, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS ) }; //int RGB_current_mode; -// [Persistent Default Layer] ------------------------------------------------// -void persistent_default_layer_set(uint16_t default_layer) { - eeconfig_update_default_layer(default_layer); - default_layer_set(default_layer); -} - -// void matrix_scan_user(void) { -// rgblight_config_t rgblight_config; -// rgblight_config.raw = eeconfig_read_rgblight(); -// // Save LED State -// eeprom_oled_enabled = rgblight_config.enable; -// } - // [Process User Input] ------------------------------------------------------// bool process_record_user(uint16_t keycode, keyrecord_t *record) { // Use process_record_keymap to reset timer on keypress @@ -172,7 +159,7 @@ void render_logo(void) { // Master OLED Screen (Left Hand ) void render_master_oled(void) { // Switch display based on Layer - switch (biton32(layer_state)){ + switch (get_highest_layer(layer_state)){ case _GAME: render_separator(); render_layer_state(); diff --git a/keyboards/crkbd/keymaps/kidbrazil/rules.mk b/keyboards/crkbd/keymaps/kidbrazil/rules.mk index 9896a8f69f32..ad03b86bfcfa 100644 --- a/keyboards/crkbd/keymaps/kidbrazil/rules.mk +++ b/keyboards/crkbd/keymaps/kidbrazil/rules.mk @@ -1,4 +1,4 @@ -CONSOLE_ENABLE = no # Console for debug(+400) +CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = no # Commands for debug and configuration MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = no # Audio output on port C6 From b85491c0fa22afb80adc32b0e36bfc76353b1a76 Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 17 Dec 2019 21:25:18 -0500 Subject: [PATCH 6/6] Second round of revisions --- keyboards/crkbd/keymaps/kidbrazil/keymap.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/keyboards/crkbd/keymaps/kidbrazil/keymap.c b/keyboards/crkbd/keymaps/kidbrazil/keymap.c index ef2fbac04679..1086cce3acc6 100644 --- a/keyboards/crkbd/keymaps/kidbrazil/keymap.c +++ b/keyboards/crkbd/keymaps/kidbrazil/keymap.c @@ -18,35 +18,35 @@ enum crkbd_layers { // [Keymaps] -----------------------------------------------------------------// const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [_QWERTY] = LAYOUT(\ + [_QWERTY] = LAYOUT( KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, LSFT_T(KC_TAB), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, LGUI_T(KC_PGUP), MO(_NUM), KC_SPC, KC_ENT, MO(_SYM), LALT_T(KC_PGDN) ), - [_NUM] = LAYOUT(\ + [_NUM] = LAYOUT( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, LSFT_T(KC_TAB), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_F12, KC_NO, KC_LCTL, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_PGUP, KC_PGDN, KC_HOME, KC_END, KC_F11, KC_NO, LGUI_T(KC_PGUP), KC_TRNS, KC_SPC, KC_ENT, KC_TRNS, LALT_T(KC_PGDN) ), - [_SYM] = LAYOUT(\ + [_SYM] = LAYOUT( KC_ESC, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, LSFT_T(KC_TAB), RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, KC_MINS, KC_EQL, KC_LCBR, KC_RCBR, KC_PIPE, KC_GRV, KC_LCTL, RGB_VAD, RGB_RMOD, RGB_HUD, RGB_SAD, TG(_GAME), KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_BSLS, KC_TILD, LGUI_T(KC_PGUP), KC_TRNS, KC_SPC, KC_ENT, KC_TRNS, LALT_T(KC_PGDN) ), - [_GAME] = LAYOUT(\ + [_GAME] = LAYOUT( KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_F7, KC_F8, KC_F9, KC_F10, KC_NO, KC_NO, KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_TRNS, KC_PGUP, KC_PGDN, KC_NO, KC_NO, KC_NO, KC_NO, KC_TAB, MO(_WEAPON), KC_SPC, KC_ENT, KC_TRNS, KC_NO ), - [_WEAPON] = LAYOUT(\ + [_WEAPON] = LAYOUT( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_6, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_7, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, @@ -91,7 +91,7 @@ void render_space(void) { // Render separator lines for oled display void render_separator(void) { - switch (biton32(layer_state)){ + switch (get_highest_layer(layer_state)){ case _GAME: case _WEAPON: oled_write_ln_P(PSTR("===================="), false); @@ -104,7 +104,7 @@ void render_separator(void) { // Render current layer state void render_layer_state(void){ // If you want to change the display of OLED, you need to change here - switch (biton32(layer_state)){ + switch (get_highest_layer(layer_state)){ case _QWERTY: oled_write_ln_P(PSTR("| MODE | QWRTY ]"), false); break;