From 68e51d65167ad4db957a296ff131b9243b8e6399 Mon Sep 17 00:00:00 2001 From: sajenim Date: Sat, 27 May 2023 15:46:47 +0800 Subject: [PATCH] remove luna, add corne logo --- keyboards/crkbd/keymaps/sajenim/config.h | 5 - keyboards/crkbd/keymaps/sajenim/oled.c | 250 ++++++----------------- keyboards/crkbd/keymaps/sajenim/oled.h | 25 --- 3 files changed, 62 insertions(+), 218 deletions(-) delete mode 100644 keyboards/crkbd/keymaps/sajenim/oled.h diff --git a/keyboards/crkbd/keymaps/sajenim/config.h b/keyboards/crkbd/keymaps/sajenim/config.h index 034e00a..86c8b02 100644 --- a/keyboards/crkbd/keymaps/sajenim/config.h +++ b/keyboards/crkbd/keymaps/sajenim/config.h @@ -29,11 +29,6 @@ #define COMBO_TERM 50 #define COMBO_ONLY_FROM_LAYER 0 -// Data Sync -#define SPLIT_LAYER_STATE_ENABLE -#define SPLIT_MODS_ENABLE -#define SPLIT_WPM_ENABLE - // RGB #ifdef RGBLIGHT_ENABLE #define RGBLIGHT_SLEEP diff --git a/keyboards/crkbd/keymaps/sajenim/oled.c b/keyboards/crkbd/keymaps/sajenim/oled.c index f3f9d55..a1eb4c7 100644 --- a/keyboards/crkbd/keymaps/sajenim/oled.c +++ b/keyboards/crkbd/keymaps/sajenim/oled.c @@ -1,144 +1,72 @@ #include QMK_KEYBOARD_H #include "features/sentence_case.h" #include "layers.h" -#include "oled.h" #include -/* KEYBOARD PET START */ - -static void render_luna(int LUNA_X, int LUNA_Y) { - /* Sit */ - static const char PROGMEM sit[2][ANIM_SIZE] = {/* 'sit1', 32x22px */ - { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1c, 0x02, 0x05, 0x02, 0x24, 0x04, 0x04, 0x02, 0xa9, 0x1e, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x08, 0x68, 0x10, 0x08, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x82, 0x7c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x0c, 0x10, 0x10, 0x20, 0x20, 0x20, 0x28, 0x3e, 0x1c, 0x20, 0x20, 0x3e, 0x0f, 0x11, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }, - - /* 'sit2', 32x22px */ - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1c, 0x02, 0x05, 0x02, 0x24, 0x04, 0x04, 0x02, 0xa9, 0x1e, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x90, 0x08, 0x18, 0x60, 0x10, 0x08, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0e, 0x82, 0x7c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x0c, 0x10, 0x10, 0x20, 0x20, 0x20, 0x28, 0x3e, 0x1c, 0x20, 0x20, 0x3e, 0x0f, 0x11, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}; - - /* Walk */ - static const char PROGMEM walk[2][ANIM_SIZE] = {/* 'walk1', 32x22px */ - { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x90, 0x90, 0x90, 0xa0, 0xc0, 0x80, 0x80, 0x80, 0x70, 0x08, 0x14, 0x08, 0x90, 0x10, 0x10, 0x08, 0xa4, 0x78, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x18, 0xea, 0x10, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1c, 0x20, 0x20, 0x3c, 0x0f, 0x11, 0x1f, 0x03, 0x06, 0x18, 0x20, 0x20, 0x3c, 0x0c, 0x12, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }, - - /* 'walk2', 32x22px */ - { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x20, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x28, 0x10, 0x20, 0x20, 0x20, 0x10, 0x48, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x20, 0xf8, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x30, 0xd5, 0x20, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x20, 0x30, 0x0c, 0x02, 0x05, 0x09, 0x12, 0x1e, 0x02, 0x1c, 0x14, 0x08, 0x10, 0x20, 0x2c, 0x32, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }}; - - /* Run */ - static const char PROGMEM run[2][ANIM_SIZE] = {/* 'run1', 32x22px */ - { - 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x08, 0x08, 0xc8, 0xb0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x3c, 0x14, 0x04, 0x08, 0x90, 0x18, 0x04, 0x08, 0xb0, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0xc4, 0xa4, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc8, 0x58, 0x28, 0x2a, 0x10, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x09, 0x04, 0x04, 0x04, 0x04, 0x02, 0x03, 0x02, 0x01, 0x01, 0x02, 0x02, 0x04, 0x08, 0x10, 0x26, 0x2b, 0x32, 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, - }, - - /* 'run2', 32x22px */ - { - 0x00, 0x00, 0x00, 0xe0, 0x10, 0x10, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x78, 0x28, 0x08, 0x10, 0x20, 0x30, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x08, 0x10, 0x11, 0xf9, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0xb0, 0x50, 0x55, 0x20, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x0c, 0x10, 0x20, 0x28, 0x37, 0x02, 0x1e, 0x20, 0x20, 0x18, 0x0c, 0x14, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }}; - - /* Bark */ - static const char PROGMEM bark[2][ANIM_SIZE] = {/* 'bark1', 32x22px */ - { - 0x00, 0xc0, 0x20, 0x10, 0xd0, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, 0x3c, 0x14, 0x04, 0x08, 0x90, 0x18, 0x04, 0x08, 0xb0, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x08, 0x10, 0x11, 0xf9, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc8, 0x48, 0x28, 0x2a, 0x10, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x0c, 0x10, 0x20, 0x28, 0x37, 0x02, 0x02, 0x04, 0x08, 0x10, 0x26, 0x2b, 0x32, 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }, - - /* 'bark2', 32x22px */ - { - 0x00, 0xe0, 0x10, 0x10, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, 0x40, 0x2c, 0x14, 0x04, 0x08, 0x90, 0x18, 0x04, 0x08, 0xb0, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x08, 0x10, 0x11, 0xf9, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x48, 0x28, 0x2a, 0x10, 0x0f, 0x20, 0x4a, 0x09, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x0c, 0x10, 0x20, 0x28, 0x37, 0x02, 0x02, 0x04, 0x08, 0x10, 0x26, 0x2b, 0x32, 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }}; - - /* Sneak */ - static const char PROGMEM sneak[2][ANIM_SIZE] = {/* 'sneak1', 32x22px */ - { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x40, 0x80, 0x00, 0x80, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x21, 0xf0, 0x04, 0x02, 0x02, 0x02, 0x02, 0x03, 0x02, 0x02, 0x04, 0x04, 0x04, 0x03, 0x01, 0x00, 0x00, 0x09, 0x01, 0x80, 0x80, 0xab, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1c, 0x20, 0x20, 0x3c, 0x0f, 0x11, 0x1f, 0x02, 0x06, 0x18, 0x20, 0x20, 0x38, 0x08, 0x10, 0x18, 0x04, 0x04, 0x02, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, - }, - - /* 'sneak2', 32x22px */ - { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xa0, 0x20, 0x40, 0x80, 0xc0, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x41, 0xf0, 0x04, 0x02, 0x02, 0x02, 0x03, 0x02, 0x02, 0x02, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x40, 0x40, 0x55, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x20, 0x30, 0x0c, 0x02, 0x05, 0x09, 0x12, 0x1e, 0x04, 0x18, 0x10, 0x08, 0x10, 0x20, 0x28, 0x34, 0x06, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - }}; - - /* animation */ - void animate_luna(void) { - /* jump */ - if (isJumping || !showedJump) { - /* clear */ - oled_set_cursor(LUNA_X, LUNA_Y + 2); - oled_write(" ", false); - - oled_set_cursor(LUNA_X, LUNA_Y - 1); - - showedJump = true; - } else { - /* clear */ - oled_set_cursor(LUNA_X, LUNA_Y - 1); - oled_write(" ", false); - - oled_set_cursor(LUNA_X, LUNA_Y); - } - - /* switch frame */ - current_frame = (current_frame + 1) % 2; - - /* current status */ - if (led_usb_state.caps_lock | is_caps_word_on()) { - oled_write_raw_P(bark[current_frame], ANIM_SIZE); - - } else if (isSneaking) { - oled_write_raw_P(sneak[current_frame], ANIM_SIZE); - - } else if (current_wpm <= MIN_WALK_SPEED) { - oled_write_raw_P(sit[current_frame], ANIM_SIZE); - - } else if (current_wpm <= MIN_RUN_SPEED) { - oled_write_raw_P(walk[current_frame], ANIM_SIZE); - - } else { - oled_write_raw_P(run[current_frame], ANIM_SIZE); - } - } - -# if OLED_TIMEOUT > 0 - /* the animation prevents the normal timeout from occuring */ - if (last_input_activity_elapsed() > OLED_TIMEOUT && last_led_activity_elapsed() > OLED_TIMEOUT) { - oled_off(); - return; - } else { - oled_on(); - } -# endif - - /* animation timer */ - if (timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) { - anim_timer = timer_read32(); - animate_luna(); - } -} - -/* KEYBOARD PET END */ - oled_rotation_t oled_init_user(oled_rotation_t rotation) { if (is_keyboard_master()) { return OLED_ROTATION_270; } else { - return OLED_ROTATION_270; + return OLED_ROTATION_180; } return rotation; } void oled_render_master(void) { - // Default layer - switch (get_highest_layer(default_layer_state)) { + // Layer Status + switch (get_highest_layer(layer_state)) { case L_QWERTY: - oled_write("QWRTY", false); - break; case L_CANARY: - oled_write("CANRY", false); + oled_write(" BAS ", false); + break; + case L_LOWER: + oled_write(" LWR ", false); + break; + case L_RAISE: + oled_write(" RSE ", false); + break; + case L_ADJUST: + oled_write(" ADJ ", false); + break; + case L_EXTEND: + oled_write(" EXT ", false); + break; + case L_GAMING: + case L_GAMEFN: + oled_write(" GME ", false); break; default: - oled_write("UNDEF", false); + oled_write(" UND ", false); + } + + // Mod Status + uint8_t this_mod = get_mods(); + uint8_t this_osm = get_oneshot_mods(); + + oled_write("-----", false); + + if ((this_mod | this_osm) & MOD_MASK_GUI) { + oled_write("gui:*", false); + } else { + oled_write("gui:.", false); + } + + if ((this_mod | this_osm) & MOD_MASK_ALT) { + oled_write("alt:*", false); + } else { + oled_write("alt:.", false); + } + + if ((this_mod | this_osm) & MOD_MASK_SHIFT) { + oled_write("sft:*", false); + } else { + oled_write("sft:.", false); + } + + if ((this_mod | this_osm) & MOD_MASK_CTRL) { + oled_write("ctl:*", false); + } else { + oled_write("ctl:.", false); } // Feature Status @@ -172,67 +100,6 @@ void oled_render_master(void) { oled_write("sc: .", false); } - // Render Pet - render_luna(0, 13); -} - -void oled_render_slave(void) { - // Layer Status - switch (get_highest_layer(layer_state)) { - case L_QWERTY: - case L_CANARY: - oled_write("DEFLT", false); - break; - case L_LOWER: - oled_write("LOWER", false); - break; - case L_RAISE: - oled_write("RAISE", false); - break; - case L_ADJUST: - oled_write("ADJST", false); - break; - case L_EXTEND: - oled_write("EXTND", false); - break; - case L_GAMING: - case L_GAMEFN: - oled_write("GAMES", false); - break; - default: - oled_write("UNDEF", false); - } - - // Mod Status - uint8_t this_mod = get_mods(); - uint8_t this_osm = get_oneshot_mods(); - - oled_write("-----", false); - - if ((this_mod | this_osm) & MOD_MASK_GUI) { - oled_write("gui:*", false); - } else { - oled_write("gui:.", false); - } - - if ((this_mod | this_osm) & MOD_MASK_ALT) { - oled_write("alt:*", false); - } else { - oled_write("alt:.", false); - } - - if ((this_mod | this_osm) & MOD_MASK_SHIFT) { - oled_write("sft:*", false); - } else { - oled_write("sft:.", false); - } - - if ((this_mod | this_osm) & MOD_MASK_CTRL) { - oled_write("ctl:*", false); - } else { - oled_write("ctl:.", false); - } - // WPM Status char wpm_str[4]; sprintf(wpm_str, "%03d", get_current_wpm()); @@ -241,14 +108,21 @@ void oled_render_slave(void) { oled_write(" wpm", false); } -bool oled_task_user(void) { - current_wpm = get_current_wpm(); - led_usb_state = host_keyboard_led_state(); +void oled_render_logo(void) { + 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); +} + +bool oled_task_user(void) { if (is_keyboard_master()) { oled_render_master(); } else { - oled_render_slave(); + oled_render_logo(); } return false; } diff --git a/keyboards/crkbd/keymaps/sajenim/oled.h b/keyboards/crkbd/keymaps/sajenim/oled.h deleted file mode 100644 index c08b75b..0000000 --- a/keyboards/crkbd/keymaps/sajenim/oled.h +++ /dev/null @@ -1,25 +0,0 @@ -/* KEYBOARD PET START */ - -/* settings */ -#define MIN_WALK_SPEED 10 -#define MIN_RUN_SPEED 40 - -/* advanced settings */ -#define ANIM_FRAME_DURATION 200 // how long each frame lasts in ms -#define ANIM_SIZE 96 // number of bytes in array. If you change sprites, minimize for adequate firmware size. max is 1024 - -/* timers */ -uint32_t anim_timer; - -/* current frame */ -uint8_t current_frame; - -/* status variables */ -int current_wpm; -led_t led_usb_state; - -bool isSneaking; -bool isJumping; -bool showedJump; - -/* KEYBOARD PET END */