From 2bfcb6bfc5766ede2b63041af3a163408caa6ad9 Mon Sep 17 00:00:00 2001 From: Gautham Yerroju Date: Sat, 13 Jun 2020 01:18:33 -0700 Subject: [Keymap] Add custom corne keymap (#9283) * Add custom corne keymap * Clean up rules.mk * Clean up base layer on keymap.c * Clean up lower layer on keymap.c * Clean up raise layer on keymap.c * Clean up adjust layer in keymap.c --- keyboards/crkbd/keymaps/gotham/README.md | 16 ++ keyboards/crkbd/keymaps/gotham/config.h | 88 ++++++++++ keyboards/crkbd/keymaps/gotham/glcdfont.c | 18 ++ keyboards/crkbd/keymaps/gotham/keycodes.h | 28 ++++ keyboards/crkbd/keymaps/gotham/keymap.c | 143 ++++++++++++++++ keyboards/crkbd/keymaps/gotham/oled.c | 265 ++++++++++++++++++++++++++++++ keyboards/crkbd/keymaps/gotham/rgb.c | 79 +++++++++ keyboards/crkbd/keymaps/gotham/rules.mk | 6 + 8 files changed, 643 insertions(+) create mode 100644 keyboards/crkbd/keymaps/gotham/README.md create mode 100644 keyboards/crkbd/keymaps/gotham/config.h create mode 100644 keyboards/crkbd/keymaps/gotham/glcdfont.c create mode 100644 keyboards/crkbd/keymaps/gotham/keycodes.h create mode 100644 keyboards/crkbd/keymaps/gotham/keymap.c create mode 100644 keyboards/crkbd/keymaps/gotham/oled.c create mode 100644 keyboards/crkbd/keymaps/gotham/rgb.c create mode 100644 keyboards/crkbd/keymaps/gotham/rules.mk (limited to 'keyboards') diff --git a/keyboards/crkbd/keymaps/gotham/README.md b/keyboards/crkbd/keymaps/gotham/README.md new file mode 100644 index 0000000000..23c1d4fdd8 --- /dev/null +++ b/keyboards/crkbd/keymaps/gotham/README.md @@ -0,0 +1,16 @@ +# Gotham's custom CRKBD Layout + +My take on the 40% layout with programming in mind. Do read about the layers, it helps with forming a mental model to remember the keymap better than just memorization. + +## Layers +- QWERTY: Base layer. The idea is to reduce thumb movement by placing commonly used keys and layers on resting thumb positions (center thumb keys). You might need to play around with TAPPING_TERM to find your perfect setting. Also, both Lower and Raise buttons appear on both halves for easy access (think of it as: middle thumb key is Lower, outer thumb key is Raise). +- LOWER: Numbers, common symbols and navigation. Easiest layer to reach (middle thumb button on both halves). The nav is shaped as a T instead of an inverted T for a few reasons. First, Left and Right needed to be on the home row (since I use them a lot to navigate through code). But the Up key can't be on the top row because numbers occupy that space. So I moved the Up and Down keys one key down. It takes some getting used to, but I find this a great balance without separating the nav and number rows. The nav cluster also contains Home and End keys below Left and Right, making it a breeze to navigate through code. +- RAISE: All symbols are here, arranged in a way that can be (kind of) deduced more by logic and less by memory. On the left hand, the first 2 cols contain the symbols for shifted numbers 1-6, with ! and @ in the home row instead of the top row. Think of the 3 rows as symbols for 3 and 4, 1 and 2, 5 and 6). The next 2 cols contain common brackets. On the right hand is everything else. Note that -, _ and = are close to the home row because of how common they are in code. Operators (&, | and !) are on the top row for convinience. Just try and remember where +, *, < and > located. Admitedlly, the locations for these symbols could use improvement. +- ADJUST: Contains settings and Function keys. This is placed on the bottom-right corner (triggerred by the pinky), since the thumb keys already have multiple uses. + +## Custom OLED +This keymap includes custom OLED font and code. The font contains some logos and status indidcators for some of the features I use (RGB and Audio). Enable OLED in rukes.mk to check it out. Feel free to reuse the font or parts of it. +__KNOWN BUG:__ When the computer sleeps, one of the OLEDs is always on (they don't turn off on their own, and the timeout doesn't work). I haven't been able to figure out what's going on there and am open to suggestions/PRs. + +## Flashing +Flash using `make crkbd:gotham:avrdude` for Pro Micro and `make crkbd:gotham:dfu` for Elite-C. diff --git a/keyboards/crkbd/keymaps/gotham/config.h b/keyboards/crkbd/keymaps/gotham/config.h new file mode 100644 index 0000000000..ed08203aa1 --- /dev/null +++ b/keyboards/crkbd/keymaps/gotham/config.h @@ -0,0 +1,88 @@ +#pragma once + +#define EE_HANDS +#define SPLIT_USB_DETECT + +#undef USE_I2C +#undef SSD1306OLED + +#define USE_SERIAL_PD2 + +#define IGNORE_MOD_TAP_INTERRUPT +#define PERMISSIVE_HOLD +#define TAPPING_TERM 250 + +#define NO_ACTION_ONESHOT + +#ifdef AUDIO_ENABLE +# define B5_AUDIO +# define NO_MUSIC_MODE +# define AUDIO_CLICKY +#endif + +#define OLED_FONT_H "keyboards/crkbd/keymaps/gotham/glcdfont.c" + +#define RGBLIGHT_SLEEP + +#ifdef RGBLIGHT_ENABLE +# undef RGBLED_NUM +# define RGBLED_NUM 6 +# define RGBLIGHT_LIMIT_VAL 150 +# define RGBLIGHT_HUE_STEP 16 +# define RGBLIGHT_SAT_STEP 32 +# define RGBLIGHT_VAL_STEP 32 + +# define RGBLIGHT_EFFECT_RAINBOW_MOOD +# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +# define RGBLIGHT_EFFECT_KNIGHT +#endif + +#ifdef RGB_MATRIX_ENABLE +# define RGB_MATRIX_KEYPRESSES // reacts to keypresses +# define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended +# 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 32 +# define RGB_MATRIX_SAT_STEP 64 +# define RGB_MATRIX_VAL_STEP 64 +# define RGB_MATRIX_SPD_STEP 20 +# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_SOLID_COLOR + +/* 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_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_DUAL_BEACON +# define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL +# define DISABLE_RGB_MATRIX_CYCLE_SPIRAL +# 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 diff --git a/keyboards/crkbd/keymaps/gotham/glcdfont.c b/keyboards/crkbd/keymaps/gotham/glcdfont.c new file mode 100644 index 0000000000..656b13974a --- /dev/null +++ b/keyboards/crkbd/keymaps/gotham/glcdfont.c @@ -0,0 +1,18 @@ +// This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0. +// See gfxfont.h for newer custom bitmap font info. +// https://helixfonteditor.netlify.com/ + +#include "progmem.h" + +// 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, 0x60, 0x30, 0x18, 0xF8, 0x18, 0x00, 0xC0, 0x70, 0x1C, 0x06, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0xC3, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x08, 0x00, 0x1C, 0x22, 0x41, 0x41, 0x41, 0x22, 0x1C, 0x00, 0x08, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0xF8, 0x0C, 0x04, 0xE7, 0xE4, 0xE4, 0x07, 0x04, 0xE4, 0xE7, 0xE4, 0x04, 0x07, 0xE4, 0xE4, 0xE7, 0x04, 0x0C, 0xF8, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x1C, 0x3E, 0x7F, 0x7F, 0x00, 0x14, 0x08, 0x14, 0x00, 0x00, 0x00, 0x1C, 0x1C, 0x3E, 0x7F, 0x7F, 0x00, 0x22, 0x1C, 0x41, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x0C, 0x06, 0x0C, 0x18, 0x30, 0x77, 0x77, 0x77, 0x00, 0x77, 0x77, + 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x4A, 0x4F, 0x4A, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x60, 0x70, 0x3E, 0x1F, 0x19, 0x18, 0x0C, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x0C, 0x06, 0x07, 0xFC, 0x00, 0xFF, 0x01, 0x00, 0x00, 0x00, 0xFF, 0x80, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x1C, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, 0x1C, 0x22, 0x00, 0x00, 0x1C, 0x3E, 0x7F, 0x63, 0x41, 0x22, 0x1C, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x49, 0xFF, 0x00, 0x00, 0x0F, 0x1F, 0x3F, 0x38, 0x30, 0xFF, 0xFF, 0xFF, 0x30, 0x38, 0x3F, 0x1F, 0x0F, 0x00, 0x00, 0xFF, 0x49, 0x49, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x40, 0x60, 0x6A, 0x64, 0x6A, 0x60, 0x40, 0x00, 0x00, 0x00, 0x00, 0x04, 0x42, 0x69, 0x65, 0x65, 0x65, 0x69, 0x42, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x30, 0x66, 0x66, 0x66, 0x00, 0x00, 0xFC, 0x24, 0x24, 0xFC, 0x24, 0x24, 0xFC, 0x24, 0x24, 0xFC, 0x24, 0x24, 0xFC, 0x24, 0x24, 0xFC, 0x24, 0x24, 0xFC, 0x24, 0x24, 0xFC, 0x24, 0x24, 0xFC, 0x00, 0x00, 0x00, 0xF0, 0x90, 0x90, 0xF0, 0x90, 0x90, 0xF0, 0x98, 0x9C, 0xF2, 0x22, 0x21, 0xE1, 0x01, 0x01, 0x01, 0xF1, 0x91, 0x91, 0xFA, 0x4C, 0x4C, 0xF8, 0x48, 0x48, 0xF8, 0x48, 0x48, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0E, 0x18, 0x30, 0x21, 0x21, 0x31, 0x18, 0x10, 0x30, 0x20, 0x60, 0x41, 0x60, 0x20, 0x30, 0x18, 0x30, 0x60, 0x40, 0x40, 0x47, 0x4C, 0x48, 0x68, 0x38, 0x1C, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x1C, 0x22, 0x41, 0x63, 0x7F, 0x3E, 0x1C, + 0x00, 0x00, 0x22, 0x1C, 0x00, 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x0F, 0x18, 0x10, 0x70, 0x10, 0x10, 0x70, 0x10, 0x13, 0x73, 0x13, 0x10, 0x70, 0x10, 0x10, 0x70, 0x10, 0x18, 0x0F, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x22, 0xC9, 0xD1, 0xC9, 0x22, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x10, 0x02, 0x38, 0xFC, 0xED, 0xFC, 0x38, 0x02, 0x10, 0x00, 0x00, 0x08, 0x0C, 0x7E, 0x7F, 0x7E, 0x0C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x09, 0x09, 0x09, 0x0F, 0x09, 0x09, 0x0F, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0F, 0x09, 0x09, 0x0F, 0x09, 0x09, 0x09, 0x0F, 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x07, 0x04, 0x04, 0x07, 0x04, 0x04, 0x0F, 0x09, 0x09, 0x0F, 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x07, 0x02, 0x02, 0x03, 0x02, 0x02, 0x03, 0x02, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; diff --git a/keyboards/crkbd/keymaps/gotham/keycodes.h b/keyboards/crkbd/keymaps/gotham/keycodes.h new file mode 100644 index 0000000000..9ba44c54a7 --- /dev/null +++ b/keyboards/crkbd/keymaps/gotham/keycodes.h @@ -0,0 +1,28 @@ +#pragma once + +enum layers { + _QWERTY, + _LOWER, + _RAISE, + _ADJUST, +}; + +enum custom_keycodes { QWERTY = SAFE_RANGE, LOWER, RAISE, ADJUST, RGBRST }; + +#define SFT_EQ MT(MOD_LSFT, KC_EQL) +#define SFT_QT MT(MOD_RSFT, KC_QUOT) + +#define SFT_A MT(MOD_LSFT, KC_A) +#define CTL_Z MT(MOD_LCTL, KC_Z) + +#define SFT_SCLN MT(MOD_RSFT, KC_SCLN) +#define CTL_SLSH MT(MOD_RCTL, KC_SLSH) + +#define LOW_SPC LT(_LOWER, KC_SPC) +#define RAI_EQ LT(_RAISE, KC_EQL) +#define RAI_ENT LT(_RAISE, KC_ENT) +#define LOW_BSP LT(_LOWER, KC_BSPC) +#define LOW_DEL LT(_LOWER, KC_DEL) +#define ADJ_GRV LT(_ADJUST, KC_GRV) +#define KC_ANGL LSFT(KC_COMM) +#define KC_ANGR LSFT(KC_DOT) diff --git a/keyboards/crkbd/keymaps/gotham/keymap.c b/keyboards/crkbd/keymaps/gotham/keymap.c new file mode 100644 index 0000000000..6657f21ee9 --- /dev/null +++ b/keyboards/crkbd/keymaps/gotham/keymap.c @@ -0,0 +1,143 @@ +#include QMK_KEYBOARD_H +#include "keycodes.h" + +#ifdef OLED_DRIVER_ENABLE +# include "oled.c" +#endif + +#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) +# include "rgb.c" +#endif + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT( + //|-----------------------------------------------------| |-----------------------------------------------------| + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + SFT_EQ, SFT_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, SFT_SCLN,SFT_QT, + //---------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + KC_LCTL, CTL_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, CTL_SLSH,ADJ_GRV, + //---------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + KC_LALT, LOW_SPC, RAI_EQ, RAI_ENT, LOW_BSP, KC_LGUI + //|--------------------------| |--------------------------| + + + ), + + [_LOWER] = LAYOUT( + //|-----------------------------------------------------| |-----------------------------------------------------| + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + _______, KC_ANGL, KC_ANGR, KC_LPRN, KC_RPRN, KC_PGUP, KC_MINS, KC_LEFT, KC_UP, KC_RIGHT,KC_PLUS, _______, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + _______, XXXXXXX, XXXXXXX, KC_LBRC, KC_RBRC, KC_PGDOWN, KC_UNDS, KC_HOME, KC_DOWN, KC_END, XXXXXXX, _______, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + _______, _______, _______, _______, LOW_DEL, _______ + //|--------------------------| |--------------------------| + ), + + [_RAISE] = LAYOUT( + //|-----------------------------------------------------| |-----------------------------------------------------| + KC_ESC, KC_HASH, KC_DLR, KC_LCBR, KC_RCBR, XXXXXXX, XXXXXXX, KC_AMPR, KC_PIPE, KC_EXLM, KC_ASTR, XXXXXXX, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + _______, KC_EXLM, KC_AT, KC_LPRN, KC_RPRN, XXXXXXX, XXXXXXX, KC_UNDS, KC_EQL, KC_ANGL, KC_ANGR, XXXXXXX, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + _______, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, XXXXXXX, XXXXXXX, KC_MINS, KC_PLUS, XXXXXXX, KC_BSLS, _______, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + _______, _______, _______, _______, _______, _______ + //|--------------------------| |--------------------------| + ), + + [_ADJUST] = LAYOUT( + //|-----------------------------------------------------| |-----------------------------------------------------| + XXXXXXX, CK_RST, CK_DOWN, CK_UP, CK_TOGG, RGB_TOG, MU_TOG, KC_F12, KC_F7, KC_F8, KC_F9, XXXXXXX,\ + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + XXXXXXX, RGB_HUI, RGB_SAI, RGB_VAI, RGB_SPI, RGB_MOD, MU_MOD, KC_F11, KC_F4, KC_F5, KC_F6, RESET, \ + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + XXXXXXX, RGB_HUD, RGB_SAD, RGB_VAD, RGB_SPD, RGBRST, AU_TOG, KC_F10, KC_F1, KC_F2, KC_F3, _______,\ + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + _______, _______, _______, _______, KC_VOLD, KC_VOLU \ + //|--------------------------| |--------------------------| + ) +}; +// clang-format off + +#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) +layer_state_t layer_state_set_user(layer_state_t state) { + /* For any layer other than default, save current RGB state and switch to layer-based RGB */ + if (layer_state_cmp(state, 0)) { + restore_rgb_config(); + } else { + uint8_t layer = get_highest_layer(state); + if (layer_state_cmp(layer_state, 0)) save_rgb_config(); + rgb_by_layer(layer); + } + return state; +} +#endif + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { +#ifdef OLED_DRIVER_ENABLE + if (record->event.pressed) { + oled_timer = timer_read(); + add_keylog(keycode); + } +#endif + + switch (keycode) { + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + } else { + layer_off(_LOWER); + } + return false; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + } else { + layer_off(_RAISE); + } + return false; + case ADJUST: + if (record->event.pressed) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + return false; +#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) + case RGB_MOD: + case RGB_TOG: + case RGB_HUI: + case RGB_HUD: + case RGB_SAI: + case RGB_SAD: + case RGB_VAI: + case RGB_VAD: + case RGB_SPI: + case RGB_SPD: + /* Override layer-based RGB and resume RGB effect to be able to preview changes */ + if (record->event.pressed) { + restore_rgb_config(); + process_rgb(keycode, record); + save_rgb_config(); + } + return false; + case RGBRST: + if (record->event.pressed) { +# ifdef RGBLIGHT_ENABLE + eeconfig_update_rgblight_default(); + rgblight_enable(); +# elif RGB_MATRIX_ENABLE + eeconfig_update_rgb_matrix_default(); + rgb_matrix_enable(); +# endif + save_rgb_config(); + } + return false; +#endif + } + return true; +} diff --git a/keyboards/crkbd/keymaps/gotham/oled.c b/keyboards/crkbd/keymaps/gotham/oled.c new file mode 100644 index 0000000000..ac6f236fc6 --- /dev/null +++ b/keyboards/crkbd/keymaps/gotham/oled.c @@ -0,0 +1,265 @@ +#pragma once + +extern uint8_t is_master; + +#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) +# include "rgb.c" +#endif + +#ifdef AUDIO_ENABLE +extern audio_config_t audio_config; +#endif + +// 5x3 Logos + +void render_corne_logo(void) { + static const char PROGMEM font_logo[16] = {0x80, 0x81, 0x82, 0x83, 0x84, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0}; + oled_write_P(font_logo, false); +}; + +void render_qmk_logo(void) { + static const char PROGMEM font_qmk_logo[16] = {0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0}; + oled_write_P(font_qmk_logo, false); +}; + +// 5x2 Keyboard, Controller logos + +void render_keyboard(void) { + static const char PROGMEM font_keyboard[11] = {0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0}; + oled_write_P(font_keyboard, false); +}; + +void render_kb_split(void) { + static const char PROGMEM font_kb_split[11] = {0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0}; + oled_write_P(font_kb_split, false); +}; + +// 5x1 Layer indicator + +void render_layer(void) { + static const char PROGMEM font_layer[4][6] = { + {0x85, 0x86, 0x87, 0x88, 0x89, 0}, + {0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0}, + {0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0}, + {0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0}, + }; + uint8_t layer = 0; + if (layer_state_is(_LOWER)) { + layer = 1; + } else if (layer_state_is(_RAISE)) { + layer = 2; + } else if (layer_state_is(_ADJUST)) { + layer = 3; + } + oled_write_P(font_layer[layer], false); +}; + + // 2x1 Audio, clicky and RGB status indicators + +#ifdef AUDIO_ENABLE +void render_audio_status(void) { + static const char PROGMEM font_audio_off[3] = {0x8f, 0x90, 0}; + static const char PROGMEM font_audio_on[3] = {0x91, 0x92, 0}; + oled_write_P(audio_config.enable ? font_audio_on : font_audio_off, false); +}; + +void render_clicky_status(void) { + static const char PROGMEM font_clicky_off[3] = {0xaf, 0xb0, 0}; + static const char PROGMEM font_clicky_on[3] = {0xb1, 0xb2, 0}; + oled_write_P(audio_config.clicky_enable ? font_clicky_on : font_clicky_off, false); +}; +#endif + +#if defined(RGB_MATRIX_ENABLE) || defined(RGBLIGHT_ENABLE) +void render_rgb_status(void) { + static const char PROGMEM font_rgb_off[3] = {0xcf, 0xd0, 0}; + static const char PROGMEM font_rgb_on[3] = {0xd1, 0xd2, 0}; +# ifdef RGBLIGHT_ENABLE + bool rgb_enabled = rgblight_config.enable; +# elif RGB_MATRIX_ENABLE + bool rgb_enabled = rgb_matrix_config.enable; +# endif + oled_write_P(rgb_enabled ? font_rgb_on : font_rgb_off, false); +}; +#endif + +// 2x1 Ctrl, Alt, Shift, GUI, Mouse + +void render_mod_ctrl(void) { + static const char PROGMEM font_ctrl[3] = {0x93, 0x94, 0}; + oled_write_P(font_ctrl, false); +}; + +void render_mod_alt(void) { + static const char PROGMEM font_alt[3] = {0xb3, 0xb4, 0}; + oled_write_P(font_alt, false); +}; + +void render_mod_shift(void) { + static const char PROGMEM font_shift[3] = {0xd3, 0xd4, 0}; + oled_write_P(font_shift, false); +}; + +void render_mod_gui(void) { + static const char PROGMEM font_gui[3] = {0x95, 0x96, 0}; + oled_write_P(font_gui, false); +}; + +#ifdef MOUSEKEY_ENABLE +void render_mod_mouse(void) { + static const char PROGMEM font_mouse[3] = {0x97, 0x98, 0}; + oled_write_P(font_mouse, false); +}; +#endif + +// 5x2 Mod and feature indicator clusters + +void render_mod_status(void) { +#ifdef NO_ACTION_ONESHOT + uint8_t modifiers = get_mods(); +#else + uint8_t modifiers = get_mods() | get_oneshot_mods(); +#endif + + (modifiers & MOD_MASK_CTRL) ? render_mod_ctrl() : oled_write_P(PSTR(" "), false); + oled_write_P(PSTR(" "), false); + (modifiers & MOD_MASK_SHIFT) ? render_mod_shift() : oled_write_P(PSTR(" "), false); + + (modifiers & MOD_MASK_ALT) ? render_mod_alt() : oled_write_P(PSTR(" "), false); + oled_write_P(PSTR(" "), false); + (modifiers & MOD_MASK_GUI) ? render_mod_gui() : oled_write_P(PSTR(" "), false); +} + +void render_feature_status(void) { +#if defined(RGB_MATRIX_ENABLE) || defined(RGBLIGHT_ENABLE) + render_rgb_status(); +#endif + +#ifdef AUDIO_ENABLE + oled_write_P(PSTR(" "), false); + render_audio_status(); +#endif +}; + +// Keylogger +#define KEYLOGGER_LENGTH 5 +static uint16_t oled_timer = 0; +static char keylog_str[KEYLOGGER_LENGTH + 1] = {"\n"}; +// clang-format off +static const char PROGMEM code_to_name[0xFF] = { +// 0 1 2 3 4 5 6 7 8 9 A B C D E F + ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', // 0x + 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', // 1x + '3', '4', '5', '6', '7', '8', '9', '0', 20, 19, 27, 26, 22, '-', '=', '[', // 2x + ']','\\', '#', ';','\'', '`', ',', '.', '/', 128, ' ', ' ', ' ', ' ', ' ', ' ', // 3x + ' ', ' ', ' ', ' ', ' ', ' ', 'P', 'S', ' ', ' ', ' ', ' ', 16, ' ', ' ', ' ', // 4x + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 5x + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 6x + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 7x + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 8x + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 9x + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Ax + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Bx + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Cx + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Dx + 'C', 'S', 'A', 'C', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Ex + ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' // Fx +}; + +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 >= QK_MODS && keycode <= QK_MODS_MAX)) { + keycode = keycode & 0xFF; + } else if (keycode > 0xFF) { + keycode = 0; + } + + for (uint8_t i = (KEYLOGGER_LENGTH - 1); i > 0; --i) { + keylog_str[i] = keylog_str[i - 1]; + } + + if (keycode < (sizeof(code_to_name) / sizeof(char))) { + keylog_str[0] = pgm_read_byte(&code_to_name[keycode]); + } +} + +void render_keylogger_status(void) { + oled_write(keylog_str, false); +} + +void render_prompt(void) { + bool blink = (timer_read() % 1000) < 500; + + if (layer_state_is(_LOWER)) { + oled_write_ln_P(blink ? PSTR("> lo_") : PSTR("> lo "), false); + } else if (layer_state_is(_RAISE)) { + oled_write_ln_P(blink ? PSTR("> hi_") : PSTR("> hi "), false); + } else if (layer_state_is(_ADJUST)) { + oled_write_ln_P(blink ? PSTR("> aj_") : PSTR("> aj "), false); + } else { + oled_write_ln_P(blink ? PSTR("> _ ") : PSTR("> "), false); + } +}; + +void render_status_secondary(void) { + oled_write_ln("", false); + oled_write_ln("", false); + + render_kb_split(); + + oled_write_ln("", false); + oled_write_ln("", false); + oled_write_ln("", false); + + render_layer(); + + oled_write_ln("", false); + oled_write_ln("", false); + oled_write_ln("", false); + + #if defined(RGB_MATRIX_ENABLE) || defined(RGBLIGHT_ENABLE) || defined(AUDIO_ENABLE) + layer_state_is(_ADJUST) ? render_feature_status() : render_mod_status(); + #else + render_mod_status(); + #endif +}; + +void render_status_main(void) { + oled_write_ln("", false); + oled_write_ln("", false); + + render_corne_logo(); + + oled_write_ln("", false); + oled_write_ln("", false); + oled_write_ln("", false); + + render_qmk_logo(); + + oled_write_ln("", false); + oled_write_ln("", false); + oled_write_ln("", false); + + render_prompt(); +} + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + return OLED_ROTATION_270; +} + +void oled_task_user(void) { + if (timer_elapsed(oled_timer) > 10000) { + oled_off(); + return; + } + #ifndef SPLIT_KEYBOARD + else { + oled_on(); + } + #endif + + if (is_master) { + render_status_main(); + } else { + render_status_secondary(); + } +} diff --git a/keyboards/crkbd/keymaps/gotham/rgb.c b/keyboards/crkbd/keymaps/gotham/rgb.c new file mode 100644 index 0000000000..9f66428836 --- /dev/null +++ b/keyboards/crkbd/keymaps/gotham/rgb.c @@ -0,0 +1,79 @@ +#pragma once + +#ifdef RGBLIGHT_ENABLE +extern rgblight_config_t rgblight_config; +rgblight_config_t RGB_current_config; +#endif + +#ifdef RGB_MATRIX_ENABLE +extern rgb_config_t rgb_matrix_config; +rgb_config_t RGB_current_config; +#endif + +void save_rgb_config(void) { +#ifdef RGBLIGHT_ENABLE + RGB_current_config.enable = rgblight_config.enable; + RGB_current_config.mode = rgblight_get_mode(); + RGB_current_config.speed = rgblight_get_speed(); + RGB_current_config.hue = rgblight_get_hue(); + RGB_current_config.sat = rgblight_get_sat(); + RGB_current_config.val = rgblight_get_val(); +#elif RGB_MATRIX_ENABLE + RGB_current_config.enable = rgb_matrix_config.enable; + RGB_current_config.mode = rgb_matrix_get_mode(); + RGB_current_config.speed = rgb_matrix_config.speed; + RGB_current_config.hsv = rgb_matrix_config.hsv; +#endif +} + +void restore_rgb_config(void) { +#ifdef RGBLIGHT_ENABLE + rgblight_set_speed_noeeprom(RGB_current_config.speed); + if (rgblight_config.mode != RGB_current_config.mode) { + rgblight_mode_noeeprom(RGB_current_config.mode); + } + if ((RGB_current_config.hue != rgblight_config.hue) || (RGB_current_config.sat != rgblight_config.sat) || (RGB_current_config.val != rgblight_config.val)) { + rgblight_sethsv_noeeprom(RGB_current_config.hue, RGB_current_config.sat, RGB_current_config.val); + } + if (rgblight_config.enable) { + rgblight_enable_noeeprom(); + } else { + rgblight_disable_noeeprom(); + } +#elif RGB_MATRIX_ENABLE + rgb_matrix_config.speed = RGB_current_config.speed; + if (rgb_matrix_config.mode != RGB_current_config.mode) { + rgb_matrix_mode_noeeprom(RGB_current_config.mode); + } + if ((RGB_current_config.hsv.h != rgb_matrix_config.hsv.h) || (RGB_current_config.hsv.s != rgb_matrix_config.hsv.s) || (RGB_current_config.hsv.v != rgb_matrix_config.hsv.v)) { + rgb_matrix_sethsv_noeeprom(RGB_current_config.hsv.h, RGB_current_config.hsv.s, RGB_current_config.hsv.v); + } + if (rgb_matrix_config.enable) { + rgb_matrix_enable_noeeprom(); + } else { + rgb_matrix_disable_noeeprom(); + } +#endif +} + +void rgb_by_layer(int layer) { +#ifdef RGBLIGHT_ENABLE + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); +#elif RGB_MATRIX_ENABLE + rgb_matrix_mode_noeeprom(RGB_MATRIX_SOLID_COLOR); +#endif + + switch (layer) { + case _ADJUST: + rgblight_sethsv_noeeprom(9, 255, 255); + break; + case _RAISE: + rgblight_sethsv_noeeprom(HSV_CYAN); + break; + case _LOWER: + rgblight_sethsv_noeeprom(HSV_MAGENTA); + break; + default: + rgblight_sethsv_noeeprom(HSV_RED); + } +} diff --git a/keyboards/crkbd/keymaps/gotham/rules.mk b/keyboards/crkbd/keymaps/gotham/rules.mk new file mode 100644 index 0000000000..eaf8f89fd1 --- /dev/null +++ b/keyboards/crkbd/keymaps/gotham/rules.mk @@ -0,0 +1,6 @@ +MOUSEKEY_ENABLE = no +EXTRAKEY_ENABLE = yes +AUDIO_ENABLE = yes +RGBLIGHT_ENABLE = yes +OLED_DRIVER_ENABLE = yes +LTO_ENABLE = yes -- cgit v1.2.3