diff options
author | QMK Bot <hello@qmk.fm> | 2022-10-07 19:31:00 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2022-10-07 19:31:00 +0000 |
commit | c1e05b14d5a1c73c328e791db2aea5834ffa67c0 (patch) | |
tree | 7c23049b9d1ccee11974d88ede7fe656bc4cb2ee | |
parent | 150572da447ea4ec54df0621c2cb47c26818b621 (diff) | |
parent | 5d7e19209eac263f24d90e079749f646a86e50cc (diff) |
Merge remote-tracking branch 'origin/master' into develop
18 files changed, 1979 insertions, 424 deletions
diff --git a/keyboards/crkbd/keymaps/jpe230/config.h b/keyboards/crkbd/keymaps/jpe230/config.h index d8185d4253..57a0271e27 100644 --- a/keyboards/crkbd/keymaps/jpe230/config.h +++ b/keyboards/crkbd/keymaps/jpe230/config.h @@ -1,40 +1,47 @@ -/* -This is the c configuration file for the keymap +// Copyright 2022 Jose Pablo Ramirez (@jpe230) +// SPDX-License-Identifier: GPL-2.0-or-later -Copyright 2012 Jun Wako <wakojun@gmail.com> -Copyright 2015 Jack Humbert -Copyright 2022 Jose Pablo Ramirez <jp.ramangulo@gmail.com> +#pragma once -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. +/* --------------------------- + * Common Spit Configuration + * --------------------------- + */ +#define SPLIT_OLED_ENABLE -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. +/* --------------------------- + * Common OLED Configuration + * --------------------------- + */ +#define OLED_TIMEOUT 0 +#define CUSTOM_OLED_TIMEOUT 10000 -You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* --------------------------- + * Common Bootmagic Lite + * --------------------------- + */ +#define BOOTMAGIC_LITE_ROW 0 +#define BOOTMAGIC_LITE_COLUMN 0 -#pragma once +/* --------------------------- + * Common RGB Configuration + * --------------------------- + */ +#define RGB_DISABLE_WHEN_USB_SUSPENDED +#define RGB_DISABLE_TIMEOUT CUSTOM_OLED_TIMEOUT +#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 128 +#define RGB_MATRIX_STARTUP_HUE 215 +#define RGB_MATRIX_STARTUP_SAT 255 +#define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS -#ifndef RGB_MATRIX_ENABLE -# define SPLIT_WPM_ENABLE -#endif +/* --------------------------- + * Common other Configuration + * --------------------------- + */ +#define ENABLE_COMPILE_KEYCODE -#ifdef RGB_MATRIX_ENABLE -# define RGB_DISABLE_WHEN_USB_SUSPENDED -# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 128 -# define RGB_MATRIX_STARTUP_HUE 215 -# define RGB_MATRIX_STARTUP_SAT 255 -# define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS -# define ENABLE_RGB_MATRIX_ALPHAS_MODS -# define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT -# define ENABLE_RGB_MATRIX_BAND_VAL -# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON -# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL -# define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS +#if defined CONVERT_TO_KB2040 || defined CONVERT_TO_PROMICRO_RP2040 +# include "config_rp2040.h" +#else +# include "config_avr.h" #endif diff --git a/keyboards/crkbd/keymaps/jpe230/config_avr.h b/keyboards/crkbd/keymaps/jpe230/config_avr.h new file mode 100644 index 0000000000..67226d88f7 --- /dev/null +++ b/keyboards/crkbd/keymaps/jpe230/config_avr.h @@ -0,0 +1,15 @@ +// Copyright 2022 Jose Pablo Ramirez (@jpe230) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +/* --------------------------- + * AVR RGB Configuration + * --------------------------- + */ +#define ENABLE_RGB_MATRIX_ALPHAS_MODS +#define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT +#define ENABLE_RGB_MATRIX_BAND_VAL +#define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +#define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +#define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS diff --git a/keyboards/crkbd/keymaps/jpe230/config_rp2040.h b/keyboards/crkbd/keymaps/jpe230/config_rp2040.h new file mode 100644 index 0000000000..b26c14986a --- /dev/null +++ b/keyboards/crkbd/keymaps/jpe230/config_rp2040.h @@ -0,0 +1,73 @@ +// Copyright 2022 Jose Pablo Ramirez (@jpe230) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +/* --------------------------- + * RP2040 OLED Configuration + * --------------------------- + */ +#define I2C1_CLOCK_SPEED 400000 +#define OLED_UPDATE_INTERVAL 1 +#define OLED_I2C_TIMEOUT 1 + +/* --------------------------- + * RP2040 Split Configuration + * --------------------------- + */ +#define SPLIT_WPM_ENABLE + +/* --------------------------- + * RP2040 Debounce + * --------------------------- + */ +#undef DEBOUNCE +#define DEBOUNCE 1 + +/* --------------------------- + * RP2040 RGB Configuration + * --------------------------- + */ +#define ENABLE_RGB_MATRIX_ALPHAS_MODS +#define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN +#define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT +#define ENABLE_RGB_MATRIX_BREATHING +#define ENABLE_RGB_MATRIX_BAND_SAT +#define ENABLE_RGB_MATRIX_BAND_VAL +#define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +#define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +#define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT +#define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL +#define ENABLE_RGB_MATRIX_CYCLE_ALL +#define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +#define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +#define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +#define ENABLE_RGB_MATRIX_CYCLE_OUT_IN +#define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +#define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +#define ENABLE_RGB_MATRIX_CYCLE_SPIRAL +#define ENABLE_RGB_MATRIX_DUAL_BEACON +#define ENABLE_RGB_MATRIX_RAINBOW_BEACON +#define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS +#define ENABLE_RGB_MATRIX_RAINDROPS +#define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +#define ENABLE_RGB_MATRIX_HUE_BREATHING +#define ENABLE_RGB_MATRIX_HUE_PENDULUM +#define ENABLE_RGB_MATRIX_HUE_WAVE +#define ENABLE_RGB_MATRIX_PIXEL_RAIN +#define ENABLE_RGB_MATRIX_PIXEL_FLOW +#define ENABLE_RGB_MATRIX_PIXEL_FRACTAL +#define ENABLE_RGB_MATRIX_TYPING_HEATMAP +#define ENABLE_RGB_MATRIX_DIGITAL_RAIN +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS +#define ENABLE_RGB_MATRIX_SPLASH +#define ENABLE_RGB_MATRIX_MULTISPLASH +#define ENABLE_RGB_MATRIX_SOLID_SPLASH +#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH diff --git a/keyboards/crkbd/keymaps/jpe230/jpe230.h b/keyboards/crkbd/keymaps/jpe230/jpe230.h new file mode 100644 index 0000000000..f5f098f5c5 --- /dev/null +++ b/keyboards/crkbd/keymaps/jpe230/jpe230.h @@ -0,0 +1,15 @@ +// Copyright 2022 Jose Pablo Ramirez (@jpe230) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include QMK_KEYBOARD_H + +/* --------------------------- + * Custom OLED Fncs Prototypes + * --------------------------- + */ +void render_slave_oled(void); +void render_master_oled(void); +void oled_timer_reset(void); +void set_keylog(uint16_t keycode, keyrecord_t *record); diff --git a/keyboards/crkbd/keymaps/jpe230/keymap.c b/keyboards/crkbd/keymaps/jpe230/keymap.c index 28bb6c1fe1..530c418be5 100644 --- a/keyboards/crkbd/keymaps/jpe230/keymap.c +++ b/keyboards/crkbd/keymaps/jpe230/keymap.c @@ -1,35 +1,9 @@ -/* -Copyright 2019 @foostan -Copyright 2020 Drashna Jaelre <@drashna> -Copyright 2022 Jose Pablo Ramirez <jp.ramangulo@gmail.com> - -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 <http://www.gnu.org/licenses/>. -*/ +// Copyright 2022 Jose Pablo Ramirez (@jpe230) +// SPDX-License-Identifier: GPL-2.0-or-later #include QMK_KEYBOARD_H -#ifdef VIA_ENABLE - #define USER_START USER00 -#else - #define USER_START SAFE_RANGE -#endif - -// Keycode to toggle Sarcasm Mode -enum custom_keycodes { - KC_SCASM = USER_START -}; - +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT_split_3x6_3( //,-----------------------------------------------------. ,-----------------------------------------------------. @@ -72,361 +46,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //,-----------------------------------------------------. ,-----------------------------------------------------. KC_MUTE, KC_WBAK, KC_WFWD, KC_F7, KC_F8, KC_F9, _______, KC_7, KC_8, KC_9, _______, QK_BOOT, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - KC_VOLU, _______, KC_MNXT, KC_F6, KC_F5, KC_F6, _______, KC_6, KC_5, KC_4, _______, _______, + KC_VOLU, _______, KC_MNXT, KC_F6, KC_F5, KC_F6, _______, KC_6, KC_5, KC_4, _______, QK_MAKE, //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| - KC_VOLD, KC_MPRV, KC_MNXT, KC_F1, KC_F2, KC_F3, _______, KC_1, KC_2, KC_3, _______, _______, + KC_VOLD, KC_MPRV, KC_MNXT, KC_F1, KC_F2, KC_F3, _______, KC_1, KC_2, KC_3, _______, DB_TOGG, //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| - KC_LGUI, _______,KC_SCASM, TG(3), _______, KC_RALT + KC_LGUI, _______, _______, TG(3), _______, KC_RALT //`--------------------------' `--------------------------' ) }; - -#ifdef OLED_ENABLE -oled_rotation_t oled_init_user(oled_rotation_t rotation) { -#ifdef RGB_MATRIX_ENABLE - if (!is_keyboard_master()) { - return OLED_ROTATION_180; // flips the display 180 degrees if offhand - } -#endif - return rotation; -} - -#define L_BASE 0 -#define L_LOWER 2 -#define L_RAISE 4 -#define L_ADJUST 8 - -void oled_render_layer_state(void) { - oled_write_P(PSTR("Layer: "), false); - switch (layer_state) { - case L_BASE: - oled_write_ln_P(PSTR("Default"), false); - break; - case L_LOWER: - oled_write_ln_P(PSTR("Lower"), false); - break; - case L_RAISE: - oled_write_ln_P(PSTR("Raise"), false); - break; - case L_ADJUST: - case L_ADJUST|L_LOWER: - case L_ADJUST|L_RAISE: - case L_ADJUST|L_LOWER|L_RAISE: - oled_write_ln_P(PSTR("Adjust"), false); - break; - } -} - - -static char logged_char = ' '; -static uint8_t logged_row = 0, logged_col = 0; -static uint16_t logged_keycode = 0; - -const char code_to_name[60] = { - ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', - 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', - 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', - '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', - 'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\', - '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '}; - -void set_keylog(uint16_t keycode, keyrecord_t *record) { - if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || - (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { keycode = keycode & 0xFF; } - if (keycode < 60) { - logged_char = code_to_name[keycode]; - } - - // update keylog - logged_row = record->event.key.row; - logged_col = record->event.key.col; - logged_keycode = keycode; -} - -void oled_render_keylog(void) { - oled_write(get_u8_str(logged_row, '0'), false); - oled_write_P(PSTR(":"), false); - oled_write(get_u8_str(logged_col, '0'), false); - oled_write_P(PSTR(", "), false); - oled_write(get_u16_str(logged_keycode, ' '), false); - oled_write_P(PSTR(" : "), false); - oled_write((const char *)&logged_char, false); -} - -void render_bootmagic_status(bool status) { - /* Show Ctrl-Gui Swap options */ - static const char PROGMEM logo[][2][3] = { - {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}}, - {{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, - }; - if (status) { - oled_write_ln_P(logo[0][0], false); - oled_write_ln_P(logo[0][1], false); - } else { - oled_write_ln_P(logo[1][0], false); - oled_write_ln_P(logo[1][1], false); - } -} - -#ifndef RGB_MATRIX_ENABLE -// frame 0, 128x32px -const char PROGMEM cat_frame_0 [] PROGMEM = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0xc0, 0xc0, - 0x60, 0x60, 0x60, 0x60, 0x40, 0x40, 0xc0, 0xc0, 0xc0, 0x70, 0x38, 0x18, 0xec, 0x3c, 0x02, 0x02, - 0x7a, 0x7a, 0xf2, 0xf2, 0x06, 0x04, 0x04, 0x0c, 0x0e, 0x0a, 0x1f, 0xfd, 0xf9, 0x39, 0x0f, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0xff, 0xff, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xfc, 0xff, 0x01, 0x08, 0x3c, 0x00, - 0x00, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x7e, 0x00, 0x00, - 0x00, 0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xf0, 0xff, 0xff, 0x80, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x87, 0x83, 0xc0, 0x80, 0x88, - 0x1e, 0x1e, 0x0f, 0x00, 0x80, 0x80, 0x80, 0x40, 0x40, 0xc0, 0xe0, 0xfe, 0x87, 0xbe, 0xf0, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x0f, - 0x12, 0x34, 0x34, 0x34, 0x34, 0x1e, 0x0e, 0x06, 0x03, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; -// frame 1, 128x32px -const char PROGMEM cat_frame_1 [] PROGMEM = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xc0, 0xc0, 0x60, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x60, 0x60, 0xe0, 0xf0, 0x90, - 0x18, 0x08, 0x08, 0x88, 0x88, 0x98, 0x10, 0x10, 0x30, 0x30, 0x70, 0xf8, 0x08, 0x88, 0xf8, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0xff, 0xff, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe0, 0x04, 0x06, 0x07, 0x03, 0x01, - 0xc0, 0x00, 0x00, 0x87, 0x87, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1f, 0xf0, 0x00, - 0x00, 0x00, 0xc0, 0xe0, 0xf0, 0xf0, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xf8, 0xff, 0xff, 0xc0, 0x80, - 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x10, 0x30, 0xf0, 0xe0, 0x00, - 0x01, 0x00, 0x60, 0xf0, 0xf0, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xe0, 0xfc, 0xc7, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x02, 0x06, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x06, 0x02, 0x02, 0x07, 0x07, 0x07, 0x04, 0x07, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; -// frame 2, 128x32px -const char PROGMEM cat_frame_2 [] PROGMEM = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xc0, 0x60, 0x30, - 0x38, 0x18, 0x18, 0x18, 0x18, 0x30, 0x30, 0x30, 0x78, 0x48, 0x78, 0xc0, 0x80, 0xc0, 0x40, 0x40, - 0x40, 0x40, 0xc0, 0xc0, 0x80, 0x80, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x20, 0xf0, 0x80, 0x80, 0x60, 0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x3c, - 0x7c, 0x38, 0x00, 0x00, 0x00, 0x01, 0x01, 0x07, 0x06, 0x3c, 0xff, 0xc3, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xe0, 0xe0, 0xf0, 0xf0, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xff, 0xff, 0xf0, 0x80, 0x00, - 0x00, 0x80, 0x80, 0x80, 0x00, 0x01, 0x00, 0x1e, 0x7f, 0xc0, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x0c, - 0x8c, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, - 0x01, 0x01, 0x00, 0x01, 0x01, 0x0f, 0x18, 0x10, 0x18, 0x0f, 0x0e, 0x18, 0x10, 0x30, 0x27, 0x2f, - 0x2f, 0x27, 0x20, 0x30, 0x10, 0x10, 0x10, 0x30, 0x3c, 0x2d, 0x27, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -const char* cat_frames[3] = { - cat_frame_0, - cat_frame_1, - cat_frame_2 -}; - -#define FRAME_SIZE 528 - -static int current_frame = 0; -static uint32_t frame_timer = 0; -static uint32_t anim_sleep = 0; -static uint8_t anim_speed = 120; - -#endif - -void oled_render_logo(void) { -#ifdef RGB_MATRIX_ENABLE - static const char PROGMEM crkbd_logo[] = { - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, - 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, - 0}; - oled_write_P(crkbd_logo, false); -#endif -#ifndef RGB_MATRIX_ENABLE - if(get_current_wpm() != 000) { - oled_on(); - int8_t wpm_speed = (int8_t)(get_current_wpm() / 2); - if(wpm_speed < 100) - { - anim_speed = 120 - wpm_speed; - } - if(timer_elapsed32(frame_timer) > anim_speed) { - frame_timer = timer_read32(); // resets timer - current_frame = (current_frame + 1) % 3; - } - oled_write_raw_P(cat_frames[current_frame], FRAME_SIZE); - anim_sleep = timer_read32(); - } else { - anim_speed = 150; - if(timer_elapsed32(anim_sleep) > OLED_TIMEOUT) { - oled_off(); - } else { - if(timer_elapsed32(frame_timer) > anim_speed) { - frame_timer = timer_read32(); // resets timer - current_frame = (current_frame + 1) % 3; - } - oled_write_raw_P(cat_frames[current_frame], FRAME_SIZE); - } - } -#endif -} - -bool oled_task_user(void) { - if (is_keyboard_master()) { - oled_render_layer_state(); - oled_render_keylog(); - } else { - oled_render_logo(); - } - return false; -} - -#endif // OLED_ENABLE - -// saRcASm MOde -bool tog_sarcasm = false; -bool uppercase = false; -uint8_t prev_upper = 0; -uint8_t prev_lower = 0; -uint8_t prev_mode = 0; -HSV prev_hsv; - - -bool process_record_sarcasm(uint16_t keycode, keyrecord_t *record) { - if (keycode == KC_ENTER && record->event.pressed) { - uppercase = false; - return true; - } - - if (uppercase == false && record->event.pressed) { // Dont start with an uppercase letter on new line - uppercase = true; - return true; - } - - if((KC_A <= keycode) && (keycode <= KC_Z)) { - if ( record->event.pressed ) { - bool press = rand() % 2; - - if (prev_upper > 2) { // if more than 3 lower's in a row print upper - prev_upper = 0; - press = false; - } else if (prev_lower > 2) { // if more than 3 upper's in a row print lower - prev_lower = 0; - press = true; - } - if (press) { - prev_upper++; - tap_code16(S(keycode)); - clear_mods(); - } else { - prev_lower++; - tap_code16(keycode); - } - } - return false; - } - - return true; -} - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - -#ifdef OLED_ENABLE - if (record->event.pressed) { - set_keylog(keycode, record); - } -#endif - - switch (keycode) { - case KC_SCASM: - if (record->event.pressed) { - tog_sarcasm = !tog_sarcasm; - - if (tog_sarcasm) { - dprint("Enabling saRCaSm ModE\n"); - - #ifdef RGB_MATRIX_ENABLE - prev_hsv = rgb_matrix_get_hsv(); - prev_mode = rgb_matrix_get_mode(); - rgb_matrix_mode_noeeprom(RGB_MATRIX_ALPHAS_MODS); - rgb_matrix_sethsv_noeeprom(HSV_YELLOW); - #endif - } - else { - dprint("Disabling saRCaSm ModE\n"); - #ifdef RGB_MATRIX_ENABLE - rgb_matrix_mode_noeeprom(prev_mode); - rgb_matrix_sethsv_noeeprom(prev_hsv.h, prev_hsv.s, prev_hsv.v); - #endif - } - - uppercase = false; - prev_upper = 0; - prev_lower = 0; - } - return false; - } - - if (tog_sarcasm) { - return process_record_sarcasm(keycode, record); - } - - return true; -} +// clang-format off diff --git a/keyboards/crkbd/keymaps/jpe230/oled/avr/master/oled_master_handler.c b/keyboards/crkbd/keymaps/jpe230/oled/avr/master/oled_master_handler.c new file mode 100644 index 0000000000..9a75e9fa9a --- /dev/null +++ b/keyboards/crkbd/keymaps/jpe230/oled/avr/master/oled_master_handler.c @@ -0,0 +1,75 @@ +// Copyright 2022 Jose Pablo Ramirez (@jpe230) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "jpe230.h" + +extern uint8_t logged_row; +extern uint8_t logged_col; +extern uint32_t oled_timer; +static char logged_char = ' '; +static uint16_t logged_keycode = 0; + +#define L_BASE 0 +#define L_LOWER 2 +#define L_RAISE 4 +#define L_ADJUST 8 + +void oled_render_layer_state(void) { + oled_write_P(PSTR("Layer: "), false); + switch (layer_state) { + case L_BASE: + oled_write_ln_P(PSTR("Default"), false); + break; + case L_LOWER: + oled_write_ln_P(PSTR("Lower"), false); + break; + case L_RAISE: + oled_write_ln_P(PSTR("Raise"), false); + break; + case L_ADJUST: + case L_ADJUST|L_LOWER: + case L_ADJUST|L_RAISE: + case L_ADJUST|L_LOWER|L_RAISE: + oled_write_ln_P(PSTR("Adjust"), false); + break; + } +} + +const char code_to_name[60] = { + ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', + 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', + 'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\', + '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '}; + +void handle_oled_keypress(uint16_t keycode, keyrecord_t *record) { + if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || + (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { keycode = keycode & 0xFF; } + if (keycode < 60) { + logged_char = code_to_name[keycode]; + } + + logged_keycode = keycode; +} + +void oled_render_keylog(void) { + oled_write(get_u8_str(logged_row, '0'), false); + oled_write_P(PSTR(":"), false); + oled_write(get_u8_str(logged_col, '0'), false); + oled_write_P(PSTR(", "), false); + oled_write(get_u16_str(logged_keycode, ' '), false); + oled_write_P(PSTR(" : "), false); + oled_write((const char *)&logged_char, false); +} + +void render_master_oled() { + if (timer_elapsed32(oled_timer) > CUSTOM_OLED_TIMEOUT) { + oled_off(); + return; + } + + oled_on(); + oled_render_layer_state(); + oled_render_keylog(); +} diff --git a/keyboards/crkbd/keymaps/jpe230/oled/avr/slave/oled_slave_handler.c b/keyboards/crkbd/keymaps/jpe230/oled/avr/slave/oled_slave_handler.c new file mode 100644 index 0000000000..159413d083 --- /dev/null +++ b/keyboards/crkbd/keymaps/jpe230/oled/avr/slave/oled_slave_handler.c @@ -0,0 +1,14 @@ +// Copyright 2022 Jose Pablo Ramirez (@jpe230) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "jpe230.h" + +void render_slave_oled() { + static const char PROGMEM crkbd_logo[] = { + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, + 0}; + oled_write_P(crkbd_logo, false); +} + diff --git a/keyboards/crkbd/keymaps/jpe230/oled/oled_handler.c b/keyboards/crkbd/keymaps/jpe230/oled/oled_handler.c new file mode 100644 index 0000000000..67861e5b27 --- /dev/null +++ b/keyboards/crkbd/keymaps/jpe230/oled/oled_handler.c @@ -0,0 +1,41 @@ +// Copyright 2022 Jose Pablo Ramirez (@jpe230) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "jpe230.h" + +uint8_t logged_row; +uint8_t logged_col; +uint32_t oled_timer = 0; + +__attribute__ ((weak)) void handle_oled_keypress(uint16_t keycode, keyrecord_t *record) {} + +__attribute__ ((weak)) oled_rotation_t rotate_master(oled_rotation_t rotation) {return rotation;} +__attribute__ ((weak)) oled_rotation_t rotate_slave(oled_rotation_t rotation) {return rotation;} + +void oled_timer_reset() { oled_timer = timer_read32(); } + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + + if (!is_keyboard_master()) { + return rotate_slave(rotation); + } + + return rotate_master(rotation); +} + + +void set_keylog(uint16_t keycode, keyrecord_t *record) { + logged_row = record->event.key.row; + logged_col = record->event.key.col; + + handle_oled_keypress(keycode, record); +} + +bool oled_task_user(void) { + if (is_keyboard_master()) { + render_master_oled(); + } else { + render_slave_oled(); + } + return false; +} diff --git a/keyboards/crkbd/keymaps/jpe230/oled/rp2040/master/indicators.h b/keyboards/crkbd/keymaps/jpe230/oled/rp2040/master/indicators.h new file mode 100644 index 0000000000..038d9eff2c --- /dev/null +++ b/keyboards/crkbd/keymaps/jpe230/oled/rp2040/master/indicators.h @@ -0,0 +1,13 @@ +// Copyright 2022 Jose Pablo Ramirez (@jpe230) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "jpe230.h" +#include <stdio.h> + +#define ANIM_SIZE 352 // number of bytes in array, max is 1024 (minimize where possible) +#define IDLE_FRAMES 67 //number of total frames + +void change_frame_up(uint8_t frame_number); +void change_frame_down(uint8_t frame_number); +const char first_frame[ANIM_SIZE]; +const uint8_t key_frame[4]; diff --git a/keyboards/crkbd/keymaps/jpe230/oled/rp2040/master/indicators_down.c b/keyboards/crkbd/keymaps/jpe230/oled/rp2040/master/indicators_down.c new file mode 100644 index 0000000000..c5d70f2063 --- /dev/null +++ b/keyboards/crkbd/keymaps/jpe230/oled/rp2040/master/indicators_down.c @@ -0,0 +1,463 @@ +// Copyright 2022 Jose Pablo Ramirez (@jpe230) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "indicators.h" |