diff --git a/keyboards/crkbd/keymaps/thunderbird2086/config.h b/keyboards/crkbd/keymaps/thunderbird2086/config.h new file mode 100644 index 0000000000..735caadaee --- /dev/null +++ b/keyboards/crkbd/keymaps/thunderbird2086/config.h @@ -0,0 +1,97 @@ +// Copyright 2021 Allen Choi (@thunderbird2086) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define EE_HANDS +#define SPLIT_USB_DETECT + +// #define RGB_LAYER_ENABLE +#undef USE_I2C +#undef SSD1306OLED + +#define IGNORE_MOD_TAP_INTERRUPT +#define PERMISSIVE_HOLD + +#if defined(TAPPING_TERM) +# undef TAPPING_TERM +#endif +#define TAPPING_TERM 200 + +#define NO_ACTION_ONESHOT + +#if defined(OLED_ENABLE) +# define SPLIT_LAYER_STATE_ENABLE +# define SPLIT_LED_STATE_ENABLE +# define SPLIT_MODS_ENABLE +# define SPLIT_OLED_ENABLE +# define OLED_FONT_H "keyboards/crkbd/keymaps/thunderbird2086/glcdfont.c" +# undef OLED_TIMEOUT + // due to timer_read() for render_prompt(), we have own implementation of oled time out +# define OLED_KEY_TIMEOUT 30000 +# define KEY_LOG_ENABLE +#endif + +#define RGBLIGHT_SLEEP + +#if defined(RGBLIGHT_ENABLE) +# 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 + +#if defined(RGB_MATRIX_ENABLE) +# define RGB_MATRIX_KEYPRESSES // reacts to keypresses +# define RGB_DISABLE_WHEN_USB_SUSPENDED // 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. */ +# undef ENABLE_RGB_MATRIX_ALPHAS_MODS +# undef ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN +# define ENABLE_RGB_MATRIX_BREATHING +# undef ENABLE_RGB_MATRIX_BAND_SAT +# undef ENABLE_RGB_MATRIX_BAND_VAL +# undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +# undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +# undef ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT +# undef ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL +# define ENABLE_RGB_MATRIX_CYCLE_ALL +# undef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# undef ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +# undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN +# undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +# undef ENABLE_RGB_MATRIX_DUAL_BEACON +# undef ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +# undef ENABLE_RGB_MATRIX_CYCLE_SPIRAL +# undef ENABLE_RGB_MATRIX_RAINBOW_BEACON +# undef ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS +# undef ENABLE_RGB_MATRIX_RAINDROPS +# undef ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +# undef ENABLE_RGB_MATRIX_TYPING_HEATMAP +# undef ENABLE_RGB_MATRIX_DIGITAL_RAIN +# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE +# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE +# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS +# define ENABLE_RGB_MATRIX_SPLASH +# undef ENABLE_RGB_MATRIX_MULTISPLASH +# undef ENABLE_RGB_MATRIX_SOLID_SPLASH +# undef ENABLE_RGB_MATRIX_SOLID_MULTISPLASH +#endif diff --git a/keyboards/crkbd/keymaps/thunderbird2086/glcdfont.c b/keyboards/crkbd/keymaps/thunderbird2086/glcdfont.c new file mode 100644 index 0000000000..97dc8fdaa3 --- /dev/null +++ b/keyboards/crkbd/keymaps/thunderbird2086/glcdfont.c @@ -0,0 +1,238 @@ +// Copyright 2021 Allen Choi (@thunderbird2086) +// SPDX-License-Identifier: GPL-2.0-or-later + +// 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" + +// clang-format off +// Standard ASCII 5x7 font +static const unsigned char PROGMEM font[] = { + 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, 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, + 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, + 0x10, 0x10, 0x08, 0x08, 0x10, 0x10, + 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, + 0x80, 0x80, 0xC0, 0xC0, 0xE0, 0xE0, + 0xF0, 0xF0, 0xF8, 0xF8, 0xF0, 0xF0, + 0xE0, 0xE0, 0xC0, 0xC0, 0x80, 0x80, + 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, + 0x10, 0x10, 0x08, 0x08, 0x10, 0x10, + 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, + 0x80, 0x80, 0x40, 0xC0, 0x60, 0xA0, + 0x50, 0xB0, 0x58, 0xA8, 0x50, 0xB0, + 0x60, 0xA0, 0x40, 0xC0, 0x80, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, + 0x18, 0x0C, 0x06, 0x0C, 0x18, 0x30, + 0x00, 0x77, 0x55, 0x7F, 0x14, 0x7F, + 0x55, 0x77, 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, 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, + 0x08, 0x0C, 0x5E, 0x5F, 0x5E, 0x0C, + 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, + 0x88, 0x88, 0x5D, 0x5D, 0x3E, 0x3E, + 0x7C, 0x7C, 0xF8, 0xF8, 0x7C, 0x7C, + 0x3E, 0x3E, 0x5D, 0x5D, 0x88, 0x88, + 0x88, 0x88, 0x55, 0x55, 0x23, 0x23, + 0x47, 0x47, 0x8F, 0x8F, 0x47, 0x47, + 0x23, 0x23, 0x55, 0x55, 0x88, 0x88, + 0x88, 0x88, 0xD5, 0xD5, 0xE2, 0xE2, + 0xC4, 0xC4, 0x88, 0x88, 0xC4, 0xC4, + 0xE2, 0xE2, 0xD5, 0xD5, 0x88, 0x88, + 0x88, 0x88, 0x5D, 0xD5, 0x6B, 0xB6, + 0x6D, 0xD6, 0xAD, 0xDA, 0x6D, 0xD6, + 0x6B, 0xB6, 0x5D, 0xD5, 0x88, 0x88, + 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, + 0x0C, 0x18, 0x30, 0x66, 0x66, 0x66, + 0x08, 0x0C, 0x7E, 0x7F, 0x7E, 0x0C, + 0x08, 0x00, 0x00, 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, 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, + 0x08, 0x00, 0x00, 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, 0x01, 0x01, 0x02, 0x02, + 0x04, 0x04, 0x08, 0x08, 0x04, 0x04, + 0x02, 0x02, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, + 0x04, 0x04, 0x08, 0x08, 0x04, 0x04, + 0x02, 0x02, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x01, 0x03, 0x03, + 0x07, 0x07, 0x0F, 0x0F, 0x07, 0x07, + 0x03, 0x03, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x01, 0x03, 0x02, + 0x05, 0x06, 0x0D, 0x0A, 0x05, 0x06, + 0x03, 0x02, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x1C, 0x22, 0xC9, 0xD1, + 0xC9, 0x22, 0x1C, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x02, 0x39, 0xFC, 0xED, + 0xFC, 0x38, 0x02, 0x10, 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, 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, 0x00, 0x00, 0x00, +}; +// clang-format on diff --git a/keyboards/crkbd/keymaps/thunderbird2086/keycodes.h b/keyboards/crkbd/keymaps/thunderbird2086/keycodes.h new file mode 100644 index 0000000000..cb10a3ac07 --- /dev/null +++ b/keyboards/crkbd/keymaps/thunderbird2086/keycodes.h @@ -0,0 +1,69 @@ +// Copyright 2021 Allen Choi (@thunderbird2086) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +enum custom_keycodes { + // Layer Macros + COLEMAK = SAFE_RANGE, + QWERTY, + FUNCTION, + CODE, + ADJUST, + RGBRST, + // Secret Macros + M_XXX1, + M_XXX2, + M_XXX3, + M_XXX4, + M_XXX5, +}; + + +enum layers { + _COLEMAK, + _QWERTY, + _FUNCTION, + _CODE, + _ADJUST, + _SECRET, +}; + +// Shortcut Keys +#define K_BACK LGUI(KC_LBRC) // browser back +#define K_FWRD LGUI(KC_RBRC) // browser forward +#define K_LOCK LGUI(LCTL(KC_Q)) // Lock screen +#define K_CSCN LGUI(LCTL(LSFT(KC_4))) // Copy a portion of the screen to the clipboard +#define K_MDSH LSFT(LALT(KC_MINS)) + +// Layer Keys +#define FCT_BSP LT(_FUNCTION, KC_BSPC) +#define FCT_DEL LT(_FUNCTION, KC_DEL) + +#define FCT_ENT LT(_FUNCTION, KC_ENT) +#define RAI_ENT LT(_CODE , KC_ENT) + +#define FCT_EQL LT(_FUNCTION, KC_EQL) +#define RAI_EQL LT(_CODE , KC_EQL) + +#define FCT_SPC LT(_FUNCTION, KC_SPC) +#define RAI_SPC LT(_CODE , KC_SPC) + +#define FCT_TAB LT(_FUNCTION, KC_TAB) + +#define ADJ_EQL LT(_ADJUST, KC_EQL) +#define ADJ_GRV LT(_ADJUST, KC_GRV) + +// Mod-Tap Keys +#define SFT_SLSH MT(MOD_RSFT, KC_SLSH) +#define SFT_Z MT(MOD_LSFT, KC_Z) + +#define CTL_QUOT MT(MOD_RCTL, KC_QUOT) +#define CTL_SCLN MT(MOD_RCTL, KC_SCLN) +#define CTL_A MT(MOD_LCTL, KC_A) +#define CTL_O MT(MOD_LCTL, KC_O) + +#define M_LOPT_F MT(MOD_LALT, KC_F) +#define M_LOPT_T MT(MOD_LALT, KC_T) +#define RCMD_J MT(MOD_LGUI, KC_J) +#define RCMD_N MT(MOD_RGUI, KC_N) diff --git a/keyboards/crkbd/keymaps/thunderbird2086/keymap.c b/keyboards/crkbd/keymaps/thunderbird2086/keymap.c new file mode 100644 index 0000000000..7bc23db8aa --- /dev/null +++ b/keyboards/crkbd/keymaps/thunderbird2086/keymap.c @@ -0,0 +1,85 @@ +// Copyright 2021 Allen Choi (@thunderbird2086) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H +#include "layers_block.h" + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_COLEMAK] = LAYOUT_wrapper( + // +---------+---------+---------+---------+---------+---------+ +---------+---------+---------+---------+---------+---------+ + T_TAB , ___________________COLEMAK_DH_L1_______________ , ___________________COLEMAK_DH_R1_______________ , KC_MINS , + // |---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------| + KC_LCTL , ___________________COLEMAK_DH_L2_______________ , ___________________COLEMAK_DH_R2_______________ , CTL_QUOT, + // |---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------| + KC_LSFT , ___________________COLEMAK_DH_L3_______________ , ___________________COLEMAK_DH_R3_______________ , ADJ_EQL , + // +---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+ + _________MOD_LEFT__________ , _________MOD_RIGHT_________ + // \----------------------------/ \-----------------------------/ + ), + + [_QWERTY] = LAYOUT_wrapper( + // +---------+---------+---------+---------+---------+---------+ +---------+---------+---------+---------+---------+---------+ + T_TAB , ___________________QWERTY_L1___________________ , ___________________QWERTY_R1___________________ , KC_MINS , + // |---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------| + KC_LCTL , ___________________QWERTY_L2___________________ , ___________________QWERTY_R2___________________ , CTL_QUOT, + // |---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------| + KC_LSFT , ___________________QWERTY_L3___________________ , ___________________QWERTY_R3___________________ , ADJ_EQL , + // +---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+ + _________MOD_LEFT__________ , _________MOD_RIGHT_________ + // \----------------------------/ \-----------------------------/ + ), + + [_FUNCTION] = LAYOUT_wrapper( + // +---------+---------+---------+---------+---------+---------+ +---------+---------+---------+---------+---------+---------+ + KC_ESC , ___________________FUNC_LEFT___________________ , ___________________FUNC_RIGHT__________________ , KC_F11 , + // |---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------| + K_CSCN , ____________________MEDIA_1____________________ , KC_DEL , _______________NAV_1_________________ , KC_F12 , + // |---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------| + _______ , ____________________MEDIA_2____________________ , KC_INS , _______________NAV_2_________________ , K_LOCK , + // +---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+ + _______MOD_TRNS_LEFT_______ , _______MOD_TRNS_RIGHT______ + // \----------------------------/ \-----------------------------/ + ), + + [_CODE] = LAYOUT_wrapper( + // +---------+---------+---------+---------+---------+---------+ +---------+---------+---------+---------+---------+---------+ + T_GRV , ___________________NUM_LEFT____________________ , ___________________NUM_RIGHT___________________ , KC_BSLS , + // |---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------| + ________________________SYMBOL_L1________________________ , ________________________SYMBOL_R1________________________ , + // |---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------| + ________________________SYMBOL_L2________________________ , ________________________SYMBOL_R2________________________ , + // +---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+ + _______MOD_TRNS_LEFT_______ , _______MOD_TRNS_RIGHT______ + // \----------------------------/ \-----------------------------/ + ), + + [_ADJUST] = LAYOUT_wrapper( + // +---------+---------+---------+---------+---------+---------+ +---------+---------+---------+---------+---------+---------+ + ________________________ADJUST_L1________________________ , ________________________ADJUST_R1________________________ , + // |---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------| + ________________________ADJUST_L2________________________ , ________________________ADJUST_R2________________________ , + // |---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------| + ________________________ADJUST_L3________________________ , ________________________ADJUST_R3________________________ , + // +---------+---------+---------+---------+---------+---------+ +---------+---------+---------+---------+---------+---------+ + _______ , _______ , _______ , _______ , _______ , _______ + // \----------------------------/ \-----------------------------/ + ), + + [_SECRET] = LAYOUT_wrapper( + // +---------+---------+---------+---------+---------+---------+ +---------+---------+---------+---------+---------+---------+ + ________________________SECRET_L1________________________ , ________________________SECRET_R1________________________ , + // |---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------| + ________________________SECRET_L2________________________ , ________________________SECRET_R2________________________ , + // |---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------| + ________________________SECRET_L3________________________ , ________________________SECRET_R3________________________ , + // +---------+---------+---------+---------+---------+---------+ +---------+---------+---------+---------+---------+---------+ + XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX + // \----------------------------/ \-----------------------------/ + ) +}; +// clang-format off + +layer_state_t layer_state_set_user(layer_state_t state) { + return update_tri_layer_state(state, _FUNCTION, _ADJUST, _SECRET); +} diff --git a/keyboards/crkbd/keymaps/thunderbird2086/layers_block.h b/keyboards/crkbd/keymaps/thunderbird2086/layers_block.h new file mode 100644 index 0000000000..03d438306e --- /dev/null +++ b/keyboards/crkbd/keymaps/thunderbird2086/layers_block.h @@ -0,0 +1,89 @@ +// Copyright 2021 Allen Choi (@thunderbird2086) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "keycodes.h" +#include "tap_dances.h" + +// Layout blocks +#define ___________________COLEMAK_DH_L1_______________ KC_Q , KC_W , KC_F , KC_P , KC_B +#define ___________________COLEMAK_DH_L2_______________ CTL_A , KC_R , KC_S , M_LOPT_T, KC_G +#define ___________________COLEMAK_DH_L3_______________ SFT_Z , KC_X , KC_C , KC_D , KC_V + +#define ___________________COLEMAK_DH_R1_______________ KC_J , KC_L , KC_U , KC_Y , KC_SCLN +#define ___________________COLEMAK_DH_R2_______________ KC_M , RCMD_N , KC_E , KC_I , CTL_O +#define ___________________COLEMAK_DH_R3_______________ KC_K , KC_H , KC_COMM , KC_DOT , SFT_SLSH + +#define ___________________QWERTY_L1___________________ KC_Q , KC_W , KC_E , KC_R , KC_T +#define ___________________QWERTY_L2___________________ CTL_A , KC_S , KC_D , M_LOPT_F, KC_G +#define ___________________QWERTY_L3___________________ SFT_Z , KC_X , KC_C , KC_V , KC_B + +#define ___________________QWERTY_R1___________________ KC_Y , KC_U , KC_I , KC_O , KC_P +#define ___________________QWERTY_R2___________________ KC_H , RCMD_J , KC_K , KC_L , CTL_SCLN +#define ___________________QWERTY_R3___________________ KC_N , KC_M , KC_COMM , KC_DOT , SFT_SLSH + +#define ___________________COLEMAK_L1__________________ KC_Q , KC_W , KC_F , KC_P , KC_G +#define ___________________COLEMAK_L2__________________ CTL_A , KC_R , KC_S , M_LOPT_T, KC_D +#define ___________________COLEMAK_L3__________________ SFT_Z , KC_X , KC_C , KC_V , KC_B + +#define ___________________COLEMAK_R1__________________ KC_J , KC_L , KC_U , KC_Y , KC_SCLN +#define ___________________COLEMAK_R2__________________ KC_H , RCMD_N , KC_E , KC_I , CTL_O +#define ___________________COLEMAK_R3__________________ KC_K , KC_M , KC_COMM , KC_DOT , SFT_SLSH + +#define ___________________NUM_LEFT____________________ KC_1 , KC_2 , KC_3 , KC_4 , KC_5 +#define ___________________NUM_RIGHT___________________ KC_6 , KC_7 , KC_8 , KC_9 , KC_0 + +#define ___________________FUNC_LEFT___________________ KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 +#define ___________________FUNC_RIGHT__________________ KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 + +#define ________________________SYMBOL_L1________________________ KC_TILD , KC_EXLM , KC_AT , KC_HASH , KC_DLR , KC_PERC +#define ________________________SYMBOL_L2________________________ XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX + +#define ________________________SYMBOL_R1________________________ KC_CIRC , KC_AMPR , KC_ASTR , KC_LPRN , KC_RPRN , KC_PIPE +#define ________________________SYMBOL_R2________________________ XXXXXXX , KC_LCBR , KC_RCBR , KC_LBRC , KC_RBRC , KC_PLUS + + +#define ________________________ADJUST_L1________________________ RESET , XXXXXXX , KC_PWR , KC_WAKE , KC_SLEP , XXXXXXX + +#if defined(RGB_MATRIX_ENABLE) || defined(RGBLIGHT_ENABLE) +# define ________________________ADJUST_L2________________________ RGBRST , XXXXXXX , RGB_SPI , RGB_SAI , RGB_HUI , RGB_VAI +# define ________________________ADJUST_L3________________________ EEP_RST , XXXXXXX , RGB_SPD , RGB_SAD , RGB_HUD , RGB_VAD +#else +# define ________________________ADJUST_L2________________________ XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX +# define ________________________ADJUST_L3________________________ EEP_RST , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX +#endif + +#if defined(RGB_MATRIX_ENABLE) || defined(RGBLIGHT_ENABLE) +# define ________________________ADJUST_R1________________________ RGB_TOG , XXXXXXX , XXXXXXX , XXXXXXX , COLEMAK , QWERTY +# define ________________________ADJUST_R3________________________ RGB_MOD , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX +#else +# define ________________________ADJUST_R1________________________ XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , COLEMAK , QWERTY +# define ________________________ADJUST_R3________________________ XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX +#endif +#define ________________________ADJUST_R2________________________ XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX + +#define ________________________SECRET_L1________________________ M_XXX1 , XXXXXXX , M_XXX3 , XXXXXXX , M_XXX5 , XXXXXXX +#define ________________________SECRET_L2________________________ XXXXXXX , M_XXX2 , XXXXXXX , M_XXX4 , XXXXXXX , XXXXXXX +#define ________________________SECRET_L3________________________ XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX + +#define ________________________SECRET_R1________________________ XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX +#define ________________________SECRET_R2________________________ XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX +#define ________________________SECRET_R3________________________ XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX + +#define _______________NAV_1_________________ KC_LEFT , KC_UP , KC_RGHT , KC_PGUP +#define _______________NAV_2_________________ KC_HOME , KC_DOWN , KC_END , KC_PGDN + +#define _______________MOUSE_1_______________ KC_BTN1 , KC_MS_U , KC_BTN2 , KC_WH_D +#define _______________MOUSE_2_______________ KC_MS_L , KC_MS_D , KC_MS_R , KC_WH_U + +#define ____________________MEDIA_1____________________ KC_BRMU , KC_MFFD , KC_MPLY , KC_VOLU , K_BACK +#define ____________________MEDIA_2____________________ KC_BRMD , KC_MRWD , KC_MUTE , KC_VOLD , K_FWRD + +#define _________MOD_LEFT__________ T_GUI , FCT_DEL , RAI_SPC +#define _________MOD_RIGHT_________ RAI_ENT , FCT_BSP , KC_ROPT +#define _______MOD_TRNS_LEFT_______ KC_TRNS , T_ESC , XXXXXXX +#define _______MOD_TRNS_RIGHT______ XXXXXXX , T_ESC , KC_TRNS + +// Layout wrappers +#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__) diff --git a/keyboards/crkbd/keymaps/thunderbird2086/oled.c b/keyboards/crkbd/keymaps/thunderbird2086/oled.c new file mode 100644 index 0000000000..bee9bc26de --- /dev/null +++ b/keyboards/crkbd/keymaps/thunderbird2086/oled.c @@ -0,0 +1,298 @@ +// Copyright 2021 Allen Choi (@thunderbird2086) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H +#include "keycodes.h" + + +// 5x3 Logos +void render_qmk_logo(void) { + static const char PROGMEM font_qmk_logo[16] = { + 0x80, 0x81, 0x82, 0x83, 0x84, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, + 0 + }; + oled_write_P(font_qmk_logo, false); +}; + +// 5x2 Keyboard, Controller logos +void render_kb_split(void) { + static const char PROGMEM font_kb_split[11] = { + 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, + 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, + 0 + }; + oled_write_P(font_kb_split, false); +}; + +// 5x1 Layer indicator + +void render_layer(void) { + static const char PROGMEM font_layer[4][6] = { + {0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0}, + {0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0}, + {0xda, 0xdb, 0xdc, 0xdd, 0xde, 0}, + {0x95, 0x96, 0x97, 0x98, 0x99, 0}, + }; + + uint8_t layer = 0; + if (layer_state_is(_FUNCTION)) { + layer = 1; + } else if (layer_state_is(_CODE)) { + layer = 2; + } else if (layer_state_is(_ADJUST)) { + layer = 3; + } + oled_write_P(font_layer[layer], false); +}; + + +void render_layers(void) { + static const char PROGMEM font_layers[4][16] = { + {0x20, 0x85, 0x86, 0x87, 0x20, + 0x20, 0xa5, 0xa6, 0xa7, 0x20, + 0x20, 0xc5, 0xc6, 0xc7, 0x20, + 0}, + {0x20, 0x88, 0x89, 0x8a, 0x20, + 0x20, 0xa8, 0xa9, 0xaa, 0x20, + 0x20, 0xc8, 0xc9, 0xca, 0x20, + 0}, + {0x20, 0x8b, 0x8c, 0x8d, 0x20, + 0x20, 0xab, 0xac, 0xad, 0x20, + 0x20, 0xcb, 0xcc, 0xcd, 0x20, + 0}, + {0x20, 0x8e, 0x8f, 0x90, 0x20, + 0x20, 0xae, 0xaf, 0xb0, 0x20, + 0x20, 0xce, 0xcf, 0xd0, 0x20, + 0}, + }; + + uint8_t layer = 0; + if (layer_state_is(_FUNCTION)) { + layer = 1; + } else if (layer_state_is(_CODE)) { + layer = 2; + } else if (layer_state_is(_ADJUST)) { + layer = 3; + } + oled_write_P(font_layers[layer], false); +}; + +#if defined(RGB_MATRIX_ENABLE) || defined(RGBLIGHT_ENABLE) + +void render_rgb_status(void) { + static const char PROGMEM font_rgb_off[3] = {0xd1, 0xd2, 0}; + static const char PROGMEM font_rgb_on[3] = {0xd3, 0xd4, 0}; + bool rgb_enabled = +# if defined(RGBLIGHT_ENABLE) + rgblight_is_enabled(); +# elif defined(RGB_MATRIX_ENABLE) + rgb_matrix_is_enabled(); +# endif + + oled_write_P(rgb_enabled ? font_rgb_on : font_rgb_off, false); +}; +#endif + +// 2x1 Ctrl, Alt, Shift, GUI, Caps + +void render_mod_ctrl(void) { + static const char PROGMEM font_ctrl[3] = {0x91, 0x92, 0}; + oled_write_P(font_ctrl, false); +}; + +void render_mod_alt(void) { + static const char PROGMEM font_alt[3] = {0xb1, 0xb2, 0}; + oled_write_P(font_alt, false); +}; + +void render_mod_shift(void) { + static const char PROGMEM font_shift[3] = {0xb3, 0xb4, 0}; + oled_write_P(font_shift, false); +}; + +void render_mod_gui(void) { + static const char PROGMEM font_gui[3] = {0x93, 0x94, 0}; + oled_write_P(font_gui, false); +}; + +void render_caps_lock(void) { + static const char PROGMEM font_caps[3] = {0x9f, 0xbf, 0}; + oled_write_P(font_caps, false); +}; + + +// 5x2 Mod and feature indicator clusters + +void render_mod_status(void) { +#if defined(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); + + led_t led_state = host_keyboard_led_state(); + (led_state.caps_lock) ? render_caps_lock() : oled_write_P(PSTR(" "), false); +} + +void render_feature_status(void) { +#if defined(RGB_MATRIX_ENABLE) || defined(RGBLIGHT_ENABLE) + render_rgb_status(); +#endif +}; + +// Keylogger +#define KEYLOGGER_LENGTH 5 +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 +}; + + +#if defined(KEY_LOG_ENABLE) +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]); + } +} +#endif + +static uint16_t key_timer = 0; +static bool is_key_processed = true; +bool process_record_oled(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + key_timer = timer_read(); + is_key_processed = true; + +# if defined(KEY_LOG_ENABLE) + add_keylog(keycode); +#endif + } + + return true; +} + + +void render_keylogger_status(void) { + oled_write(keylog_str, false); +} + + +void render_prompt(void) { + bool blink = (timer_read() % 1000) < 500; + + if (layer_state_is(_FUNCTION)) { + oled_write_ln_P(blink ? PSTR("> ft_") : PSTR("> ft "), false); + } else if (layer_state_is(_CODE)) { + oled_write_ln_P(blink ? PSTR("> sy_") : PSTR("> sy "), 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) + 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_qmk_logo(); + + oled_write_ln("", false); + oled_write_ln("", false); + + render_layers(); + + oled_write_ln("", false); + oled_write_ln("", false); + + render_prompt(); + + oled_write_ln("", false); + + render_keylogger_status(); +} + + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + return OLED_ROTATION_270; +} + + +bool oled_task_user(void) { + if (is_keyboard_master()) { + if (is_key_processed && (timer_elapsed(key_timer) < OLED_KEY_TIMEOUT)) { + render_status_main(); + } else if (is_key_processed) { + is_key_processed = false; + oled_off(); + } + } else { + render_status_secondary(); + } + + return false; +} diff --git a/keyboards/crkbd/keymaps/thunderbird2086/process_records.c b/keyboards/crkbd/keymaps/thunderbird2086/process_records.c new file mode 100644 index 0000000000..381cf281e5 --- /dev/null +++ b/keyboards/crkbd/keymaps/thunderbird2086/process_records.c @@ -0,0 +1,45 @@ +// Copyright 2021 Allen Choi (@thunderbird2086) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +#include "keycodes.h" + +__attribute__((weak)) +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + return true; +} + +__attribute__((weak)) +bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { + return true; +} + +#if defined(OLED_ENABLE) +__attribute__((weak)) +bool process_record_oled(uint16_t keycode, keyrecord_t *record) { + return true; +} +#endif + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + break; + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY); + } + break; + } + + return process_record_keymap(keycode, record) && process_record_secrets(keycode, record) +# if defined(OLED_ENABLE) + && process_record_oled(keycode, record) +# endif + ; +} diff --git a/keyboards/crkbd/keymaps/thunderbird2086/readme.md b/keyboards/crkbd/keymaps/thunderbird2086/readme.md new file mode 100644 index 0000000000..6400309fe8 --- /dev/null +++ b/keyboards/crkbd/keymaps/thunderbird2086/readme.md @@ -0,0 +1,65 @@ +# Thunderbird2086's custom CRKBD Layout + +The concept is Mac and **baby finger** friendly keymap. + +## Layers +- Colemak-DH: base layer. The option(⌥) and command(⌘) keys are assigned to thumb blocks as well as home position keys on each side. Also, far end two columns are assigned to shift(⇧) and control(⌃) keys. + ![colemak-dh](https://i.imgur.com/R7EzTTt.png) + - Thumb keys + | Tap | Double tap | Long tap | + | --- | --- | --- | + | Command(⌘) | Command(⌘) + Space(␣) | | + | Delete(⌦) | | Function layer | + | Backspace(⌫)| | Function layer | + | Space(␣) | | Code layer | + | Enter(⏎) | | Code layer | + - Staggered keys + | Tap | Double tap | Long tap | + | --- | --- | --- | + | TAB | Control(⌃) + TAB | | + | a | | Control(⌃) | + | z | | Shift(⇧) | + | t | | Option(⌥) | + | n | | Command(⌘) | + | o | | Control(⌃) | + | ' | | Control(⌃) | + | / | | Shift(⇧) | + | = | | Adjust layer | + +- QWERTY: same as Colemak-DH layer + ![qwery](https://i.imgur.com/v9JBwQu.png) + - Thumb keys : same as Colemak-DH + - Staggered keys : almost same as Colemak-DH except + | Tap | Double tap | Long tap | + | --- | --- | --- | + | f | | Option(⌥) | + | j | | Command(⌘) | + | ; | | Control(⌃) | + +- CODE: numbers and symbols. + ![symbol](https://i.imgur.com/BPgPlYX.png) + - Thumb keys + | Tap | Double tap | Long tap | + | --- | --- | --- | + | ESC | Caps lock | | + - Staggered keys + | Tap | Double tap | Long tap | + | --- | --- | --- | + | ` | Command(⌘) + ` | | + +- FUNCTION: function, meadia and navigation keys + ![function](https://i.imgur.com/cs5haUP.png) + - Thumb keys + | Tap | Double tap | Long tap | + | --- | --- | --- | + | ESC | Caps lock | | + +- ADJUST: RGB control, Power control, default layer setting and reset + ![adjust](https://i.imgur.com/uDIhigd.png) +- SECRET: hold `ADJUST` and `FUNCTION` to activate + +## Custom OLED +This keymap includes custom OLED font and code. The font contains some logos and status indidcators from [gotham](../gotham) and [soundmonster](../soundmonster) including my own CAPS LOCK icon. Enable OLED in rukes.mk to check it out. Feel free to reuse the font or parts of it. + +## Flashing +Flash using `make crkbd:thunderbird2086:avrdude` for Pro Micro and `make crkbd:thunderbird2086:dfu` for Elite-C. diff --git a/keyboards/crkbd/keymaps/thunderbird2086/rules.mk b/keyboards/crkbd/keymaps/thunderbird2086/rules.mk new file mode 100644 index 0000000000..4da48db08e --- /dev/null +++ b/keyboards/crkbd/keymaps/thunderbird2086/rules.mk @@ -0,0 +1,18 @@ +MOUSEKEY_ENABLE = no +EXTRAKEY_ENABLE = yes +AUDIO_ENABLE = no +RGBLIGHT_ENABLE = no +RGB_MATRIX_ENABLE = yes +OLED_ENABLE = yes +OLED_DRIVER = SSD1306 +LTO_ENABLE = yes + +TAP_DANCE_ENABLE = yes + +SRC += oled.c +SRC += process_records.c +SRC += tap_dances.c + +ifneq ("$(wildcard keyboards/crkbd/keymaps/thunderbird2086/secrets.c)","") + SRC += secrets.c +endif diff --git a/keyboards/crkbd/keymaps/thunderbird2086/tap_dances.c b/keyboards/crkbd/keymaps/thunderbird2086/tap_dances.c new file mode 100644 index 0000000000..1cf6fdf092 --- /dev/null +++ b/keyboards/crkbd/keymaps/thunderbird2086/tap_dances.c @@ -0,0 +1,12 @@ +// Copyright 2021 Allen Choi (@thunderbird2086) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H +#include "tap_dances.h" + +qk_tap_dance_action_t tap_dance_actions[] = { + [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS), + [TD_TAB_CTRLTAB] = ACTION_TAP_DANCE_DOUBLE(KC_TAB, LCTL(KC_TAB)), + [TD_GRV_CTRLGRV] = ACTION_TAP_DANCE_DOUBLE(KC_GRV, LGUI(KC_GRV)), + [TD_GUI_GUISPC] = ACTION_TAP_DANCE_DOUBLE(KC_LGUI, LGUI(KC_SPC)), +}; diff --git a/keyboards/crkbd/keymaps/thunderbird2086/tap_dances.h b/keyboards/crkbd/keymaps/thunderbird2086/tap_dances.h new file mode 100644 index 0000000000..34d3c4e32c --- /dev/null +++ b/keyboards/crkbd/keymaps/thunderbird2086/tap_dances.h @@ -0,0 +1,16 @@ +// Copyright 2021 Allen Choi (@thunderbird2086) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +enum custom_tapdances { + TD_ESC_CAPS = 0, + TD_TAB_CTRLTAB, + TD_GRV_CTRLGRV, + TD_GUI_GUISPC, +}; + +#define T_ESC TD(TD_ESC_CAPS) // Tap for ESC, double tap for CAPSLOCK +#define T_TAB TD(TD_TAB_CTRLTAB) // Tap for TAB, double tap for CTRL + TAB +#define T_GRV TD(TD_GRV_CTRLGRV) // Tap for GRV, double tap for Cmd + GRV +#define T_GUI TD(TD_GUI_GUISPC) // Tap for Cmd, double tap for Cmd + Space