From 81cac8eec66ab98d5091e5b704215dc96fe830d4 Mon Sep 17 00:00:00 2001 From: Conor Burns Date: Tue, 20 Jul 2021 22:07:53 +0200 Subject: [PATCH] [Keyboard] 0xcb 1337 - Added keymap "conor" and fixed some minor stuff (#12744) Co-authored-by: Drashna Jaelre --- keyboards/0xcb/1337/1337.c | 7 - keyboards/0xcb/1337/1337.h | 2 + keyboards/0xcb/1337/config.h | 22 ++- keyboards/0xcb/1337/gfxfont.c | 3 +- keyboards/0xcb/1337/keymaps/conor/keymap.c | 185 +++++++++++++++++++ keyboards/0xcb/1337/keymaps/conor/rules.mk | 1 + keyboards/0xcb/1337/keymaps/default/keymap.c | 66 ++++--- keyboards/0xcb/1337/keymaps/jakob/keymap.c | 66 ++++--- keyboards/0xcb/1337/keymaps/via/keymap.c | 66 ++++--- keyboards/0xcb/1337/readme.md | 12 +- 10 files changed, 334 insertions(+), 96 deletions(-) create mode 100644 keyboards/0xcb/1337/keymaps/conor/keymap.c create mode 100644 keyboards/0xcb/1337/keymaps/conor/rules.mk diff --git a/keyboards/0xcb/1337/1337.c b/keyboards/0xcb/1337/1337.c index 142c24639a9..85781209b3a 100644 --- a/keyboards/0xcb/1337/1337.c +++ b/keyboards/0xcb/1337/1337.c @@ -20,13 +20,6 @@ void eeconfig_init_kb(void) { #ifdef BACKLIGHT_ENABLE backlight_enable(); backlight_level(5); -#endif -#ifdef RGBLIGHT_ENABLE - rgblight_enable(); - rgblight_sethsv(0, 255, 255); -#ifdef RGBLIGHT_ANIMATIONS - rgblight_mode(RGBLIGHT_MODE_RAINBOW_SWIRL + 2); -#endif #endif eeconfig_update_kb(0); diff --git a/keyboards/0xcb/1337/1337.h b/keyboards/0xcb/1337/1337.h index 7de5365d8b8..e1f238c126c 100644 --- a/keyboards/0xcb/1337/1337.h +++ b/keyboards/0xcb/1337/1337.h @@ -26,6 +26,7 @@ along with this program. If not, see . * The second converts the arguments into a two-dimensional array which * represents the switch matrix. */ +// clang-format off #define LAYOUT( \ KA1, KA2, KA3, \ KB1, KB2, KB3, \ @@ -36,3 +37,4 @@ along with this program. If not, see . { KB1, KB2, KB3 }, \ { KC1, KC2, KC3 } \ } +// clang-format on diff --git a/keyboards/0xcb/1337/config.h b/keyboards/0xcb/1337/config.h index 6d25e49cc9f..21332c5585e 100644 --- a/keyboards/0xcb/1337/config.h +++ b/keyboards/0xcb/1337/config.h @@ -17,6 +17,7 @@ along with this program. If not, see . #pragma once #include "config_common.h" +// clang-format off /* USB Device descriptor parameter */ #define VENDOR_ID 0xCB00 @@ -47,19 +48,26 @@ along with this program. If not, see . #define RGB_DI_PIN D3 #ifdef RGB_DI_PIN - #define RGBLED_NUM 5 + #define RGBLED_NUM 4 #define RGBLIGHT_HUE_STEP 8 #define RGBLIGHT_SAT_STEP 8 #define RGBLIGHT_VAL_STEP 8 #define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */ #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ - // #define RGBLIGHT_ANIMATIONS - #define RGBLIGHT_EFFECT_BREATHING - #define RGBLIGHT_EFFECT_SNAKE - #define RGBLIGHT_EFFECT_STATIC_GRADIENT - #define RGBLIGHT_EFFECT_RAINBOW_SWIRL - #define RGBLIGHT_EFFECT_RAINBOW_MOOD + #define RGBLIGHT_ANIMATIONS /* comment this and uncomment the lines below to save space */ + // #define RGBLIGHT_EFFECT_BREATHING + // #define RGBLIGHT_EFFECT_SNAKE + // #define RGBLIGHT_EFFECT_STATIC_GRADIENT + // #define RGBLIGHT_EFFECT_RAINBOW_SWIRL + // #define RGBLIGHT_EFFECT_RAINBOW_MOOD + /* default setup after eeprom reset */ + #define RGBLIGHT_DEFAULT_MODE RGBLIGHT_EFFECT_BREATHING + 2 + #define RGBLIGHT_DEFAULT_HUE 152 + #define RGBLIGHT_DEFAULT_SAT 232 + #define RGBLIGHT_DEFAULT_VAR 255 + #define RGBLIGHT_DEFAULT_SPD 2 #endif +// clang-format on /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ #define DEBOUNCE 5 diff --git a/keyboards/0xcb/1337/gfxfont.c b/keyboards/0xcb/1337/gfxfont.c index 4e7940b64aa..b78e359c786 100644 --- a/keyboards/0xcb/1337/gfxfont.c +++ b/keyboards/0xcb/1337/gfxfont.c @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "progmem.h" - +// clang-format off static const unsigned char font[] PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, @@ -274,3 +274,4 @@ static const unsigned char font[] PROGMEM = { 0x07, 0x07, 0x0F, 0x0F, 0x1E, 0x3E, 0x3C, 0x7C, 0x70, 0xC0, 0x80, 0x00, }; +// clang-format on diff --git a/keyboards/0xcb/1337/keymaps/conor/keymap.c b/keyboards/0xcb/1337/keymaps/conor/keymap.c new file mode 100644 index 00000000000..e9d8756b111 --- /dev/null +++ b/keyboards/0xcb/1337/keymaps/conor/keymap.c @@ -0,0 +1,185 @@ +/* +Copyright 2021 0xCB - Conor Burns + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#include QMK_KEYBOARD_H +// clang-format off +enum layer_names { + _HOME, + _MISC, + _RGB, + _BLED +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[_HOME] = LAYOUT( + KC_MPRV, KC_MNXT, KC_MPLY, + KC_PGUP, KC_PGDN, TO(3), + KC_HOME, KC_END, TO(1) +), +[_MISC] = LAYOUT( + _______, _______, _______, + _______, _______, TO(0), + _______, _______, TO(2) +), +[_RGB] = LAYOUT( + RGB_HUI, RGB_HUD, RGB_MOD, + RGB_SAI, RGB_SAD, TO(1), + RGB_SPI, RGB_SPD, TO(3) +), +[_BLED] = LAYOUT( + BL_STEP, BL_BRTG, BL_TOGG, + BL_ON, BL_OFF, TO(2), + BL_INC, BL_DEC, TO(0) +) +}; +// clang-format on + +/* rotary encoder (SW3) - add more else if blocks for more granular layer control */ +#ifdef ENCODER_ENABLE +bool encoder_update_user(uint8_t index, bool clockwise) { + if (IS_LAYER_ON(_RGB)) { + #ifdef RGBLIGHT_ENABLE + if (clockwise) { + rgblight_increase_val(); + } else { + rgblight_decrease_val(); + } + #endif + } else if (IS_LAYER_ON(_BLED)) { + if (clockwise) { + backlight_increase(); + } else { + backlight_decrease(); + } + } else { + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + } + return true; +} +#endif + +/* oled stuff :) */ +#ifdef OLED_DRIVER_ENABLE +uint16_t startup_timer; + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + startup_timer = timer_read(); + return rotation; +} + +static void render_logo(void) { + static const char PROGMEM raw_logo[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 64,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 64,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 0, 0, 0, 0, 0, 0, 1, 2, 4, 2, 1, 1, 1, 1, 1, 1,255, 0, 0, 0, 0, 0, 0, 0, 0, 0,255, 1, 1, 1, 1, 1, 1, 2, 4, 2, 1, 0, 0, 0, 0, 0, 0,128, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5,248, 5, 2, 0, 0, 0, 0, 0, 0,128,192,192,224,224,112,120, 56, 63, 28, 14, 14, 14,254, 14, 14, 30, 28, 63, 56,120,112,224,224,192,128, 0, 0, 0, 0, 0, 0, 0, 2, 5,248, 5, 2, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64,160, 19,162, 66, 66, 66, 66, 66, 66, 66,255,255,255, 0, 0, 0,252,254,254,192,192,192,192,255, 0, 0, 0, 62, 62, 60, 60, 0, 0, 1,255,255,255, 66, 66, 66, 66, 66, 66, 66,162, 19,160, 64, 0, + 0, 0, 0,128, 64, 64, 64,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,192, 64, 64,192,128, 0, 0,192, 64, 64,192,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192, 64,192, 0, 0, 0, 0, 0,128,192, 64, 64,192,128, 0, 0,128,192, 64, 64,192,128, 0, 0, 64, 64, 64, 64, 64,192, 0, 0, 0, 0, 0,249, 8, 8, 8, 8, 8, 8, 8, 8,127,255,255,192,128,128, 15, 31, 31, 1, 1, 1, 1,255, 0, 0, 0, 30, 30, 14, 14,128,192,192,255,255,127, 8, 8, 8, 8, 8, 8, 8, 8,249, 0, 0, 0, + 0, 0, 31, 49, 64, 78, 64, 49, 31, 0, 0, 97, 22, 8, 22, 97, 0, 0, 31, 49, 96, 64, 64, 96, 32, 0, 0,127, 68, 68,100, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 64,127, 64, 64, 0, 0, 0, 32,100, 68, 68,110, 59, 0, 0, 32,100, 68, 68,110, 59, 0, 0, 0, 0, 0,126, 3, 1, 0, 0, 0, 8, 20, 35, 20, 8, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 3, 7, 7, 15,254, 30, 28, 28, 28,255, 28, 28, 28, 30,254, 15, 7, 3, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 4, 10, 17, 10, 4, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 40, 68, 40, 16, 16, 16, 16, 16, 16, 31, 0, 0, 16, 40, 71, 40, 16, 0, 0, 31, 16, 16, 16, 16, 16, 16, 40, 68, 40, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }; + oled_write_raw_P(raw_logo, sizeof(raw_logo)); +} +static void render_logo_font(void) { + static const char PROGMEM qmk_logo[] = { + 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xCB, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0xCB, 0xCB, 0xCB, 0x9C, 0x9D, 0xCB, 0xCB, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xCB, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xCB, 0xCB, 0xBB, 0xBC, 0xBD, 0xBE, 0xCB, + 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xCB, 0x88, 0x89, 0x8A, 0x8B, 0x8A, 0x8B, 0x8C, 0x8D, 0xCB, 0xCB, 0xDB, 0xDC, 0xDD, 0xDE, 0xCB, + 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xCB, 0xA8, 0xA9, 0xAA, 0xAB, 0xAA, 0xAB, 0xAC, 0xAD, 0xCB, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, 0x00 + }; + + oled_write_P(qmk_logo, false); +} +/* Shows the name of the current layer and locks for the host (CAPS etc.) */ +static void render_info(void) { + oled_write_P(PSTR("Layer: "), false); + + switch (get_highest_layer(layer_state)) { + case _HOME: + oled_write_ln_P(PSTR("HOME"), false); + break; + case _MISC: + oled_write_ln_P(PSTR("MISC"), false); + break; + case _RGB: + oled_write_ln_P(PSTR("RGB"), false); + break; + case _BLED: + oled_write_ln_P(PSTR("Backlight"), false); + break; + default: + oled_write_ln_P(PSTR("Undefined"), false); + } + led_t led_state = host_keyboard_led_state(); + oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false); + oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false); + oled_write_ln_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); +} +static void render_rgbled_status(bool) { + char string[4]; + if (RGBLIGHT_MODES > 1 && rgblight_is_enabled() && get_highest_layer(layer_state) == _RGB) { + uint16_t m = rgblight_get_mode(); + string[3] = '\0'; + string[2] = '0' + m % 10; + string[1] = ( m /= 10) % 10 ? '0' + (m) % 10 : (m / 10) % 10 ? '0' : ' '; + string[0] = m / 10 ? '0' + m / 10 : ' '; + oled_write_P(PSTR("Conf:"), false); + oled_write(string, false); + uint16_t h = rgblight_get_hue()/RGBLIGHT_HUE_STEP; + string[3] = '\0'; + string[2] = '0' + h % 10; + string[1] = ( h /= 10) % 10 ? '0' + (h) % 10 : (h / 10) % 10 ? '0' : ' '; + string[0] = h / 10 ? '0' + h / 10 : ' '; + oled_write_P(PSTR(","), false); + oled_write(string, false); + uint16_t s = rgblight_get_sat()/RGBLIGHT_SAT_STEP; + string[3] = '\0'; + string[2] = '0' + s % 10; + string[1] = ( s /= 10) % 10 ? '0' + (s) % 10 : (s / 10) % 10 ? '0' : ' '; + string[0] = s / 10 ? '0' + s / 10 : ' '; + oled_write_P(PSTR(","), false); + oled_write(string, false); + uint16_t v = rgblight_get_val()/RGBLIGHT_VAL_STEP; + string[3] = '\0'; + string[2] = '0' + v % 10; + string[1] = ( v /= 10) % 10 ? '0' + (v) % 10 : (v / 10) % 10 ? '0' : ' '; + string[0] = v / 10 ? '0' + v / 10 : ' '; + oled_write_P(PSTR(","), false); + oled_write(string, false); + oled_write_ln_P(PSTR("\n MOD HUE SAT VAR"), false); + } else { + oled_write_ln_P(PSTR("\n"), false); + } +} +void oled_task_user(void) { + static bool finished_timer = false; + if (!finished_timer && (timer_elapsed(startup_timer) < 1000)) { + render_logo(); + } else { + if (!finished_timer) { + oled_clear(); + finished_timer = true; + } + render_info(); + render_rgbled_status(true); + render_logo_font(); + } +} +#endif diff --git a/keyboards/0xcb/1337/keymaps/conor/rules.mk b/keyboards/0xcb/1337/keymaps/conor/rules.mk new file mode 100644 index 00000000000..1e5b99807cb --- /dev/null +++ b/keyboards/0xcb/1337/keymaps/conor/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/0xcb/1337/keymaps/default/keymap.c b/keyboards/0xcb/1337/keymaps/default/keymap.c index 596ffabcc77..5c231298cda 100644 --- a/keyboards/0xcb/1337/keymaps/default/keymap.c +++ b/keyboards/0xcb/1337/keymaps/default/keymap.c @@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include QMK_KEYBOARD_H -#include - +// clang-format off enum layer_names { _HOME, _MISC, @@ -46,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { BL_INC, BL_DEC, TO(0) ) }; - +// clang-format on /* rotary encoder (SW3) - add more else if blocks for more granular layer control */ #ifdef ENCODER_ENABLE @@ -100,10 +99,10 @@ static void render_logo(void) { } static void render_logo_font(void) { static const char PROGMEM qmk_logo[] = { - 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xCB, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0xCB, 0xCB, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, - 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xCB, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xCB, 0xCB, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, - 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xCB, 0x88, 0x89, 0x8A, 0x8B, 0x8A, 0x8B, 0x8C, 0x8D, 0xCB, 0xCB, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, - 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xCB, 0xA8, 0xA9, 0xAA, 0xAB, 0xAA, 0xAB, 0xAC, 0xAD, 0xCB, 0xCB, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0x00 + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, + 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, + 0x88, 0x89, 0x8A, 0x8B, 0x8A, 0x8B, 0x8C, 0x8D, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, + 0xA8, 0xA9, 0xAA, 0xAB, 0xAA, 0xAB, 0xAC, 0xAD, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0x00 }; oled_write_P(qmk_logo, false); @@ -133,24 +132,41 @@ static void render_info(void) { oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false); oled_write_ln_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); } -static void render_rgbled_status(bool full) { -#ifdef RGBLIGHT_ENABLE - char buf[30]; - if (RGBLIGHT_MODES > 1 && rgblight_is_enabled() && get_highest_layer(layer_state) == _RGB) { - if (full) { - snprintf(buf, sizeof(buf), "RGB mode %2d: %d,%d,%d \n", - rgblight_get_mode(), - rgblight_get_hue()/RGBLIGHT_HUE_STEP, - rgblight_get_sat()/RGBLIGHT_SAT_STEP, - rgblight_get_val()/RGBLIGHT_VAL_STEP); - } else { - snprintf(buf, sizeof(buf), "[%2d] ", rgblight_get_mode()); - } - oled_write(buf, false); - } else { - oled_write_ln_P(PSTR("\n"), false); - } -#endif +static void render_rgbled_status(bool) { + char string[4]; + if (RGBLIGHT_MODES > 1 && rgblight_is_enabled() && get_highest_layer(layer_state) == _RGB) { + uint16_t m = rgblight_get_mode(); + string[3] = '\0'; + string[2] = '0' + m % 10; + string[1] = ( m /= 10) % 10 ? '0' + (m) % 10 : (m / 10) % 10 ? '0' : ' '; + string[0] = m / 10 ? '0' + m / 10 : ' '; + oled_write_P(PSTR("Conf:"), false); + oled_write(string, false); + uint16_t h = rgblight_get_hue()/RGBLIGHT_HUE_STEP; + string[3] = '\0'; + string[2] = '0' + h % 10; + string[1] = ( h /= 10) % 10 ? '0' + (h) % 10 : (h / 10) % 10 ? '0' : ' '; + string[0] = h / 10 ? '0' + h / 10 : ' '; + oled_write_P(PSTR(","), false); + oled_write(string, false); + uint16_t s = rgblight_get_sat()/RGBLIGHT_SAT_STEP; + string[3] = '\0'; + string[2] = '0' + s % 10; + string[1] = ( s /= 10) % 10 ? '0' + (s) % 10 : (s / 10) % 10 ? '0' : ' '; + string[0] = s / 10 ? '0' + s / 10 : ' '; + oled_write_P(PSTR(","), false); + oled_write(string, false); + uint16_t v = rgblight_get_val()/RGBLIGHT_VAL_STEP; + string[3] = '\0'; + string[2] = '0' + v % 10; + string[1] = ( v /= 10) % 10 ? '0' + (v) % 10 : (v / 10) % 10 ? '0' : ' '; + string[0] = v / 10 ? '0' + v / 10 : ' '; + oled_write_P(PSTR(","), false); + oled_write(string, false); + oled_write_ln_P(PSTR("\n MOD HUE SAT VAR"), false); + } else { + oled_write_ln_P(PSTR("\n"), false); + } } void oled_task_user(void) { static bool finished_timer = false; diff --git a/keyboards/0xcb/1337/keymaps/jakob/keymap.c b/keyboards/0xcb/1337/keymaps/jakob/keymap.c index 14427ee6d8d..f4a5c3cb49e 100644 --- a/keyboards/0xcb/1337/keymaps/jakob/keymap.c +++ b/keyboards/0xcb/1337/keymaps/jakob/keymap.c @@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include QMK_KEYBOARD_H -#include - +// clang-format off enum layer_names { _HOME, _MISC, @@ -46,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { BL_INC, BL_DEC, TO(0) ) }; - +// clang-format on /* rotary encoder (SW3) - add more else if blocks for more granular layer control */ #ifdef ENCODER_ENABLE @@ -100,10 +99,10 @@ static void render_logo(void) { } static void render_logo_font(void) { static const char PROGMEM qmk_logo[] = { - 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xCB, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0xCB, 0xCB, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, - 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xCB, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xCB, 0xCB, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, - 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xCB, 0x88, 0x89, 0x8A, 0x8B, 0x8A, 0x8B, 0x8C, 0x8D, 0xCB, 0xCB, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, - 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xCB, 0xA8, 0xA9, 0xAA, 0xAB, 0xAA, 0xAB, 0xAC, 0xAD, 0xCB, 0xCB, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0x00 + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, + 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, + 0x88, 0x89, 0x8A, 0x8B, 0x8A, 0x8B, 0x8C, 0x8D, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, + 0xA8, 0xA9, 0xAA, 0xAB, 0xAA, 0xAB, 0xAC, 0xAD, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0x00 }; oled_write_P(qmk_logo, false); @@ -133,24 +132,41 @@ static void render_info(void) { oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false); oled_write_ln_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); } -static void render_rgbled_status(bool full) { -#ifdef RGBLIGHT_ENABLE - char buf[30]; - if (RGBLIGHT_MODES > 1 && rgblight_is_enabled() && get_highest_layer(layer_state) == _RGB) { - if (full) { - snprintf(buf, sizeof(buf), "RGB mode %2d: %d,%d,%d \n", - rgblight_get_mode(), - rgblight_get_hue()/RGBLIGHT_HUE_STEP, - rgblight_get_sat()/RGBLIGHT_SAT_STEP, - rgblight_get_val()/RGBLIGHT_VAL_STEP); - } else { - snprintf(buf, sizeof(buf), "[%2d] ", rgblight_get_mode()); - } - oled_write(buf, false); - } else { - oled_write_ln_P(PSTR("\n"), false); - } -#endif +static void render_rgbled_status(bool) { + char string[4]; + if (RGBLIGHT_MODES > 1 && rgblight_is_enabled() && get_highest_layer(layer_state) == _RGB) { + uint16_t m = rgblight_get_mode(); + string[3] = '\0'; + string[2] = '0' + m % 10; + string[1] = ( m /= 10) % 10 ? '0' + (m) % 10 : (m / 10) % 10 ? '0' : ' '; + string[0] = m / 10 ? '0' + m / 10 : ' '; + oled_write_P(PSTR("Conf:"), false); + oled_write(string, false); + uint16_t h = rgblight_get_hue()/RGBLIGHT_HUE_STEP; + string[3] = '\0'; + string[2] = '0' + h % 10; + string[1] = ( h /= 10) % 10 ? '0' + (h) % 10 : (h / 10) % 10 ? '0' : ' '; + string[0] = h / 10 ? '0' + h / 10 : ' '; + oled_write_P(PSTR(","), false); + oled_write(string, false); + uint16_t s = rgblight_get_sat()/RGBLIGHT_SAT_STEP; + string[3] = '\0'; + string[2] = '0' + s % 10; + string[1] = ( s /= 10) % 10 ? '0' + (s) % 10 : (s / 10) % 10 ? '0' : ' '; + string[0] = s / 10 ? '0' + s / 10 : ' '; + oled_write_P(PSTR(","), false); + oled_write(string, false); + uint16_t v = rgblight_get_val()/RGBLIGHT_VAL_STEP; + string[3] = '\0'; + string[2] = '0' + v % 10; + string[1] = ( v /= 10) % 10 ? '0' + (v) % 10 : (v / 10) % 10 ? '0' : ' '; + string[0] = v / 10 ? '0' + v / 10 : ' '; + oled_write_P(PSTR(","), false); + oled_write(string, false); + oled_write_ln_P(PSTR("\n MOD HUE SAT VAR"), false); + } else { + oled_write_ln_P(PSTR("\n"), false); + } } void oled_task_user(void) { static bool finished_timer = false; diff --git a/keyboards/0xcb/1337/keymaps/via/keymap.c b/keyboards/0xcb/1337/keymaps/via/keymap.c index 596ffabcc77..5c231298cda 100644 --- a/keyboards/0xcb/1337/keymaps/via/keymap.c +++ b/keyboards/0xcb/1337/keymaps/via/keymap.c @@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include QMK_KEYBOARD_H -#include - +// clang-format off enum layer_names { _HOME, _MISC, @@ -46,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { BL_INC, BL_DEC, TO(0) ) }; - +// clang-format on /* rotary encoder (SW3) - add more else if blocks for more granular layer control */ #ifdef ENCODER_ENABLE @@ -100,10 +99,10 @@ static void render_logo(void) { } static void render_logo_font(void) { static const char PROGMEM qmk_logo[] = { - 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xCB, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0xCB, 0xCB, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, - 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xCB, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xCB, 0xCB, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, - 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xCB, 0x88, 0x89, 0x8A, 0x8B, 0x8A, 0x8B, 0x8C, 0x8D, 0xCB, 0xCB, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, - 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xCB, 0xA8, 0xA9, 0xAA, 0xAB, 0xAA, 0xAB, 0xAC, 0xAD, 0xCB, 0xCB, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0x00 + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, + 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, + 0x88, 0x89, 0x8A, 0x8B, 0x8A, 0x8B, 0x8C, 0x8D, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, + 0xA8, 0xA9, 0xAA, 0xAB, 0xAA, 0xAB, 0xAC, 0xAD, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0x00 }; oled_write_P(qmk_logo, false); @@ -133,24 +132,41 @@ static void render_info(void) { oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false); oled_write_ln_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); } -static void render_rgbled_status(bool full) { -#ifdef RGBLIGHT_ENABLE - char buf[30]; - if (RGBLIGHT_MODES > 1 && rgblight_is_enabled() && get_highest_layer(layer_state) == _RGB) { - if (full) { - snprintf(buf, sizeof(buf), "RGB mode %2d: %d,%d,%d \n", - rgblight_get_mode(), - rgblight_get_hue()/RGBLIGHT_HUE_STEP, - rgblight_get_sat()/RGBLIGHT_SAT_STEP, - rgblight_get_val()/RGBLIGHT_VAL_STEP); - } else { - snprintf(buf, sizeof(buf), "[%2d] ", rgblight_get_mode()); - } - oled_write(buf, false); - } else { - oled_write_ln_P(PSTR("\n"), false); - } -#endif +static void render_rgbled_status(bool) { + char string[4]; + if (RGBLIGHT_MODES > 1 && rgblight_is_enabled() && get_highest_layer(layer_state) == _RGB) { + uint16_t m = rgblight_get_mode(); + string[3] = '\0'; + string[2] = '0' + m % 10; + string[1] = ( m /= 10) % 10 ? '0' + (m) % 10 : (m / 10) % 10 ? '0' : ' '; + string[0] = m / 10 ? '0' + m / 10 : ' '; + oled_write_P(PSTR("Conf:"), false); + oled_write(string, false); + uint16_t h = rgblight_get_hue()/RGBLIGHT_HUE_STEP; + string[3] = '\0'; + string[2] = '0' + h % 10; + string[1] = ( h /= 10) % 10 ? '0' + (h) % 10 : (h / 10) % 10 ? '0' : ' '; + string[0] = h / 10 ? '0' + h / 10 : ' '; + oled_write_P(PSTR(","), false); + oled_write(string, false); + uint16_t s = rgblight_get_sat()/RGBLIGHT_SAT_STEP; + string[3] = '\0'; + string[2] = '0' + s % 10; + string[1] = ( s /= 10) % 10 ? '0' + (s) % 10 : (s / 10) % 10 ? '0' : ' '; + string[0] = s / 10 ? '0' + s / 10 : ' '; + oled_write_P(PSTR(","), false); + oled_write(string, false); + uint16_t v = rgblight_get_val()/RGBLIGHT_VAL_STEP; + string[3] = '\0'; + string[2] = '0' + v % 10; + string[1] = ( v /= 10) % 10 ? '0' + (v) % 10 : (v / 10) % 10 ? '0' : ' '; + string[0] = v / 10 ? '0' + v / 10 : ' '; + oled_write_P(PSTR(","), false); + oled_write(string, false); + oled_write_ln_P(PSTR("\n MOD HUE SAT VAR"), false); + } else { + oled_write_ln_P(PSTR("\n"), false); + } } void oled_task_user(void) { static bool finished_timer = false; diff --git a/keyboards/0xcb/1337/readme.md b/keyboards/0xcb/1337/readme.md index da54eb78fc9..8fef5be7b40 100644 --- a/keyboards/0xcb/1337/readme.md +++ b/keyboards/0xcb/1337/readme.md @@ -3,16 +3,16 @@ Macro keypad * Keyboard Maintainer: [Conor Burns](https://github.com/conor-burns) -* Hardware Supported: https://github.com/conor-burns/0xcb-1337 -* Hardware Availability: Soon on tindie or order your own parts - the hardware in the repo is Open Source :D +* Hardware Supported: https://github.com/0xcb-dev/0xcb-1337 +* Hardware Availability: On [tindie](https://www.tindie.com/products/0xcb/0xcb-1337-a-customizable-macro-keyboard-with-qmk/) or order your own parts - the hardware in the repo is Open Source :D * PCB renders :) -![](https://github.com/Conor-Burns/0xcb-1337/blob/main/PCB/top.png) +![](https://github.com/0xCB-dev/0xcb-1337/blob/main/PCB/rev3.0/top.png) -![](https://github.com/Conor-Burns/0xcb-1337/blob/main/PCB/bottom.png) +![](https://github.com/0xCB-dev/0xcb-1337/blob/main/PCB/rev3.0/bottom.png) - -To go to bootloader press row 0 col 0 key (top left) while plugging in the board. +More Pictures [here](https://0xcb.dev/1337/) +To go to bootloader press row 0 col 0 key (top left) while plugging in the board. (Or press the reset button on V2.0 and v3.0) Make example for this keyboard (after setting up your build environment):