diff options
Diffstat (limited to 'users')
| -rw-r--r-- | users/bcat/bcat.c | 10 | ||||
| -rw-r--r-- | users/bcat/bcat.h | 36 | ||||
| -rw-r--r-- | users/bcat/bcat_oled.c | 216 | ||||
| -rw-r--r-- | users/bcat/bcat_oled.h | 55 | ||||
| -rw-r--r-- | users/bcat/bcat_oled_pet.h | 73 | ||||
| -rw-r--r-- | users/bcat/bcat_oled_pet_isda.c | 134 | ||||
| -rw-r--r-- | users/bcat/bcat_oled_pet_luna.c | 168 | ||||
| -rw-r--r-- | users/bcat/bcat_rgblight.c | 22 | ||||
| -rwxr-xr-x | users/bcat/compile.sh | 51 | ||||
| -rw-r--r-- | users/bcat/config.h | 79 | ||||
| -rw-r--r-- | users/bcat/readme.md | 2 | ||||
| -rw-r--r-- | users/bcat/rules.mk | 43 |
12 files changed, 874 insertions, 15 deletions
diff --git a/users/bcat/bcat.c b/users/bcat/bcat.c index f21d282e4..3a407cfac 100644 --- a/users/bcat/bcat.c +++ b/users/bcat/bcat.c | |||
| @@ -16,16 +16,15 @@ | |||
| 16 | 16 | ||
| 17 | #include "bcat.h" | 17 | #include "bcat.h" |
| 18 | 18 | ||
| 19 | #if defined(RGBLIGHT_ENABLE) | 19 | #include "quantum.h" |
| 20 | /* Adjust RGB static hue ranges for shorter gradients than default. */ | ||
| 21 | const uint8_t RGBLED_GRADIENT_RANGES[] PROGMEM = {255, 127, 63, 31, 15}; | ||
| 22 | #endif | ||
| 23 | 20 | ||
| 24 | static int8_t alt_tab_layer = -1; | 21 | static int8_t alt_tab_layer = -1; |
| 25 | 22 | ||
| 23 | __attribute__((weak)) void process_record_oled(uint16_t keycode, const keyrecord_t *record) {} | ||
| 26 | __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } | 24 | __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } |
| 27 | 25 | ||
| 28 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 26 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
| 27 | process_record_oled(keycode, record); | ||
| 29 | if (!process_record_keymap(keycode, record)) { | 28 | if (!process_record_keymap(keycode, record)) { |
| 30 | return false; | 29 | return false; |
| 31 | } | 30 | } |
| @@ -51,6 +50,9 @@ __attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) | |||
| 51 | 50 | ||
| 52 | layer_state_t layer_state_set_user(layer_state_t state) { | 51 | layer_state_t layer_state_set_user(layer_state_t state) { |
| 53 | state = layer_state_set_keymap(state); | 52 | state = layer_state_set_keymap(state); |
| 53 | #if defined(BCAT_ORTHO_LAYERS) | ||
| 54 | state = update_tri_layer_state(state, LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST); | ||
| 55 | #endif | ||
| 54 | if (alt_tab_layer >= 0 && !layer_state_cmp(state, alt_tab_layer)) { | 56 | if (alt_tab_layer >= 0 && !layer_state_cmp(state, alt_tab_layer)) { |
| 55 | unregister_code(KC_LALT); | 57 | unregister_code(KC_LALT); |
| 56 | alt_tab_layer = -1; | 58 | alt_tab_layer = -1; |
diff --git a/users/bcat/bcat.h b/users/bcat/bcat.h index 0dae774ec..4a88acba7 100644 --- a/users/bcat/bcat.h +++ b/users/bcat/bcat.h | |||
| @@ -16,9 +16,43 @@ | |||
| 16 | 16 | ||
| 17 | #pragma once | 17 | #pragma once |
| 18 | 18 | ||
| 19 | #include "quantum.h" | 19 | #include <stdbool.h> |
| 20 | 20 | ||
| 21 | #include "keymap.h" | ||
| 22 | |||
| 23 | /* Layer numbers shared across keymaps. */ | ||
| 24 | enum user_layer { | ||
| 25 | /* Base layers: */ | ||
| 26 | LAYER_DEFAULT, | ||
| 27 | |||
| 28 | #if defined(BCAT_ORTHO_LAYERS) | ||
| 29 | /* Function layers for ortho (and ergo) boards: */ | ||
| 30 | LAYER_LOWER, | ||
| 31 | LAYER_RAISE, | ||
| 32 | LAYER_ADJUST, | ||
| 33 | #else | ||
| 34 | /* Function layers for traditional boards: */ | ||
| 35 | LAYER_FUNCTION_1, | ||
| 36 | LAYER_FUNCTION_2, | ||
| 37 | #endif | ||
| 38 | }; | ||
| 39 | |||
| 40 | /* Custom keycodes shared across keymaps. */ | ||
| 21 | enum user_keycode { | 41 | enum user_keycode { |
| 22 | MC_ALTT = SAFE_RANGE, | 42 | MC_ALTT = SAFE_RANGE, |
| 23 | KEYMAP_SAFE_RANGE, | 43 | KEYMAP_SAFE_RANGE, |
| 24 | }; | 44 | }; |
| 45 | |||
| 46 | /* Keycode aliases shared across keymaps. */ | ||
| 47 | #define KY_CSPC LCTL(KC_SPC) | ||
| 48 | #define KY_ZMIN LCTL(KC_EQL) | ||
| 49 | #define KY_ZMOUT LCTL(KC_MINS) | ||
| 50 | #define KY_ZMRST LCTL(KC_0) | ||
| 51 | |||
| 52 | #if defined(BCAT_ORTHO_LAYERS) | ||
| 53 | # define LY_LWR MO(LAYER_LOWER) | ||
| 54 | # define LY_RSE MO(LAYER_RAISE) | ||
| 55 | #else | ||
| 56 | # define LY_FN1 MO(LAYER_FUNCTION_1) | ||
| 57 | # define LY_FN2 MO(LAYER_FUNCTION_2) | ||
| 58 | #endif | ||
diff --git a/users/bcat/bcat_oled.c b/users/bcat/bcat_oled.c new file mode 100644 index 000000000..390c9127b --- /dev/null +++ b/users/bcat/bcat_oled.c | |||
| @@ -0,0 +1,216 @@ | |||
| 1 | /* Copyright 2021 Jonathan Rascher | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "bcat_oled.h" | ||
| 18 | |||
| 19 | #include "quantum.h" | ||
| 20 | #include "bcat.h" | ||
| 21 | |||
| 22 | #if defined(BCAT_OLED_PET) | ||
| 23 | # include "bcat_oled_pet.h" | ||
| 24 | #endif | ||
| 25 | |||
| 26 | #define TRIANGLE_UP 0x1e | ||
| 27 | #define TRIANGLE_DOWN 0x1f | ||
| 28 | |||
| 29 | #if defined(BCAT_OLED_PET) | ||
| 30 | static bool oled_pet_should_jump = false; | ||
| 31 | #endif | ||
| 32 | |||
| 33 | /* Should be overridden by the keymap to render the OLED contents. For split | ||
| 34 | * keyboards, this function is only called on the master side. | ||
| 35 | */ | ||
| 36 | __attribute__((weak)) void oled_task_keymap(const oled_keyboard_state_t *keyboard_state) {} | ||
| 37 | |||
| 38 | bool oled_task_user(void) { | ||
| 39 | #if defined(SPLIT_KEYBOARD) | ||
| 40 | if (is_keyboard_master()) { | ||
| 41 | #endif | ||
| 42 | /* Custom OLED timeout implementation that only considers user activity. | ||
| 43 | * Allows the OLED to turn off in the middle of a continuous animation. | ||
| 44 | */ | ||
| 45 | static const uint16_t TIMEOUT_MILLIS = 60000 /* 1 min */; | ||
| 46 | |||
| 47 | if (last_input_activity_elapsed() < TIMEOUT_MILLIS) { | ||
| 48 | if (!is_oled_on()) { | ||
| 49 | oled_on(); | ||
| 50 | } | ||
| 51 | oled_keyboard_state_t keyboard_state = { | ||
| 52 | .mods = get_mods(), | ||
| 53 | .leds = host_keyboard_led_state(), | ||
| 54 | .wpm = get_current_wpm(), | ||
| 55 | }; | ||
| 56 | oled_task_keymap(&keyboard_state); | ||
| 57 | } else if (is_oled_on()) { | ||
| 58 | oled_off(); | ||
| 59 | } | ||
| 60 | #if defined(SPLIT_KEYBOARD) | ||
| 61 | } else { | ||
| 62 | /* Display logo embedded at standard location in the OLED font on the | ||
| 63 | * slave side. By default, this is a "QMK firmware" logo, but many | ||
| 64 | * keyboards substitute their own logo. Occupies 21x3 character cells. | ||
| 65 | * | ||
| 66 | * Since the slave display buffer never changes, we don't need to worry | ||
| 67 | * about oled_render incorrectly turning the OLED on. Instead, we rely | ||
| 68 | * on SPLIT_OLED_ENABLE to propagate OLED on/off status from master. | ||
| 69 | */ | ||
| 70 | static const char PROGMEM logo[] = { | ||
| 71 | // clang-format off | ||
| 72 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, | ||
| 73 | 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, | ||
| 74 | 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, | ||
| 75 | 0x00, | ||
| 76 | // clang-format on | ||
| 77 | }; | ||
| 78 | |||
| 79 | oled_write_P(logo, /*invert=*/false); | ||
| 80 | } | ||
| 81 | #endif | ||
| 82 | |||
| 83 | return false; | ||
| 84 | } | ||
| 85 | |||
| 86 | void render_oled_layers(void) { | ||
| 87 | oled_advance_char(); | ||
| 88 | oled_advance_char(); | ||
| 89 | #if defined(BCAT_ORTHO_LAYERS) | ||
| 90 | oled_write_char(IS_LAYER_ON(LAYER_LOWER) ? TRIANGLE_DOWN : ' ', /*invert=*/false); | ||
| 91 | oled_advance_char(); | ||
| 92 | oled_write_char(IS_LAYER_ON(LAYER_RAISE) ? TRIANGLE_UP : ' ', /*invert=*/false); | ||
| 93 | #else | ||
| 94 | switch (get_highest_layer(layer_state)) { | ||
| 95 | case LAYER_FUNCTION_1: | ||
| 96 | oled_write_P(PSTR("FN1"), /*invert=*/false); | ||
| 97 | break; | ||
| 98 | case LAYER_FUNCTION_2: | ||
| 99 | oled_write_P(PSTR("FN2"), /*invert=*/false); | ||
| 100 | break; | ||
| 101 | default: | ||
| 102 | oled_write_P(PSTR(" "), /*invert=*/false); | ||
| 103 | break; | ||
| 104 | } | ||
| 105 | #endif | ||
| 106 | } | ||
| 107 | |||
| 108 | void render_oled_indicators(led_t leds) { | ||
| 109 | oled_advance_char(); | ||
| 110 | oled_advance_char(); | ||
| 111 | oled_write_P(leds.num_lock ? PSTR("NUM") : PSTR(" "), /*invert=*/false); | ||
| 112 | oled_advance_char(); | ||
| 113 | oled_advance_char(); | ||
| 114 | oled_write_P(leds.caps_lock ? PSTR("CAP") : PSTR(" "), /*invert=*/false); | ||
| 115 | oled_advance_char(); | ||
| 116 | oled_advance_char(); | ||
| 117 | oled_write_P(leds.scroll_lock ? PSTR("SCR") : PSTR(" "), /*invert=*/false); | ||
| 118 | } | ||
| 119 | |||
| 120 | void render_oled_wpm(uint8_t wpm) { | ||
| 121 | static const uint16_t UPDATE_MILLIS = 100; | ||
| 122 | static uint32_t update_timeout = 0; | ||
| 123 | |||
| 124 | if (timer_expired32(timer_read32(), update_timeout)) { | ||
| 125 | oled_advance_char(); | ||
| 126 | oled_advance_char(); | ||
| 127 | oled_write_P(wpm > 0 ? PSTR("WPM") : PSTR(" "), /*invert=*/false); | ||
| 128 | if (wpm > 0) { | ||
| 129 | oled_advance_char(); | ||
| 130 | oled_advance_char(); | ||
| 131 | oled_write(get_u8_str(wpm, ' '), /*invert=*/false); | ||
| 132 | } else { | ||
| 133 | oled_advance_page(/*clearPageRemainder=*/true); | ||
| 134 | } | ||
| 135 | |||
| 136 | update_timeout = timer_read32() + UPDATE_MILLIS; | ||
| 137 | } | ||
| 138 | } | ||
| 139 | |||
| 140 | #if defined(BCAT_OLED_PET) | ||
| 141 | void process_record_oled(uint16_t keycode, const keyrecord_t *record) { | ||
| 142 | switch (keycode) { | ||
| 143 | case KC_SPACE: | ||
| 144 | if (oled_pet_can_jump()) { | ||
| 145 | oled_pet_should_jump = record->event.pressed; | ||
| 146 | } | ||
| 147 | break; | ||
| 148 | default: | ||
| 149 | break; | ||
| 150 | } | ||
| 151 | } | ||
| 152 | |||
| 153 | static void redraw_oled_pet(uint8_t col, uint8_t line, bool jumping, oled_pet_state_t state) { | ||
| 154 | oled_set_cursor(col, line); | ||
| 155 | if (jumping) { | ||
| 156 | oled_write_raw_P(oled_pet_frame(state), oled_pet_frame_bytes()); | ||
| 157 | oled_set_cursor(col, line + oled_pet_frame_lines()); | ||
| 158 | oled_advance_page(/*clearPageRemainder=*/true); | ||
| 159 | } else { | ||
| 160 | oled_advance_page(/*clearPageRemainder=*/true); | ||
| 161 | oled_write_raw_P(oled_pet_frame(state), oled_pet_frame_bytes()); | ||
| 162 | } | ||
| 163 | } | ||
| 164 | |||
| 165 | void render_oled_pet(uint8_t col, uint8_t line, const oled_keyboard_state_t *keyboard_state) { | ||
| 166 | /* Current animation to draw. We track changes to avoid redrawing the same | ||
| 167 | * frame repeatedly, allowing oled_pet_post_render to draw over the | ||
| 168 | * animation frame. | ||
| 169 | */ | ||
| 170 | static oled_pet_state_t state = 0; | ||
| 171 | static bool state_changed = true; | ||
| 172 | |||
| 173 | /* Minimum time until the pet comes down after jumping. */ | ||
| 174 | static const uint16_t JUMP_MILLIS = 200; | ||
| 175 | static bool jumping = false; | ||
| 176 | |||
| 177 | /* Time until the next animation or jump state change. */ | ||
| 178 | static uint32_t update_timeout = 0; | ||
| 179 | static uint32_t jump_timeout = 0; | ||
| 180 | |||
| 181 | /* If the user pressed the jump key, immediately redraw instead of waiting | ||
| 182 | * for the animation frame to update. That way, the pet appears to respond | ||
| 183 | * to jump commands quickly rather than lagging. If the user released the | ||
| 184 | * jump key, wait for the jump timeout to avoid overly brief jumps. | ||
| 185 | */ | ||
| 186 | bool redraw = state_changed; | ||
| 187 | if (oled_pet_should_jump && !jumping) { | ||
| 188 | redraw = true; | ||
| 189 | jumping = true; | ||
| 190 | jump_timeout = timer_read32() + JUMP_MILLIS; | ||
| 191 | } else if (!oled_pet_should_jump && jumping && timer_expired32(timer_read32(), jump_timeout)) { | ||
| 192 | redraw = true; | ||
| 193 | jumping = false; | ||
| 194 | } | ||
| 195 | |||
| 196 | /* Draw the actual animation, then move the cursor to the end of the | ||
| 197 | * rendered area. (Note that we take up an extra line to account for | ||
| 198 | * jumping, which shifts the animation up or down a line.) | ||
| 199 | */ | ||
| 200 | if (redraw) { | ||
| 201 | redraw_oled_pet(col, line, jumping, state); | ||
| 202 | } | ||
| 203 | oled_pet_post_render(col, line + !jumping, keyboard_state, redraw); | ||
| 204 | oled_set_cursor(col, line + oled_pet_frame_lines() + 1); | ||
| 205 | |||
| 206 | /* If the update timer expired, recompute the pet's animation state. */ | ||
| 207 | if (timer_expired32(timer_read32(), update_timeout)) { | ||
| 208 | oled_pet_state_t new_state = oled_pet_next_state(state, keyboard_state); | ||
| 209 | state_changed = new_state != state; | ||
| 210 | state = new_state; | ||
| 211 | update_timeout = timer_read32() + oled_pet_update_millis(keyboard_state); | ||
| 212 | } else { | ||
| 213 | state_changed = false; | ||
| 214 | } | ||
| 215 | } | ||
| 216 | #endif | ||
diff --git a/users/bcat/bcat_oled.h b/users/bcat/bcat_oled.h new file mode 100644 index 000000000..f617e1f06 --- /dev/null +++ b/users/bcat/bcat_oled.h | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | /* Copyright 2021 Jonathan Rascher | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #include <stdbool.h> | ||
| 20 | #include <stdint.h> | ||
| 21 | |||
| 22 | #include "led.h" | ||
| 23 | |||
| 24 | /* Keyboard status passed to the oled_task_keymap function and used by the | ||
| 25 | * various keyboard pet implementations. | ||
| 26 | */ | ||
| 27 | typedef struct { | ||
| 28 | uint8_t mods; | ||
| 29 | led_t leds; | ||
| 30 | uint8_t wpm; | ||
| 31 | } oled_keyboard_state_t; | ||
| 32 | |||
| 33 | /* Note: Functions below assume a vertical OLED that is 32px (5 chars) wide. */ | ||
| 34 | |||
| 35 | /* Renders layer status at the cursor. Occupies 5x1 character cells. */ | ||
| 36 | void render_oled_layers(void); | ||
| 37 | |||
| 38 | /* Renders LED indicators (Num/Caps/Scroll Lock) at the cursor. Occupies 5x3 | ||
| 39 | * character cells. | ||
| 40 | */ | ||
| 41 | void render_oled_indicators(led_t leds); | ||
| 42 | |||
| 43 | /* Renders calculated WPM count at the cursor. Occupies 5x2 character cells. */ | ||
| 44 | void render_oled_wpm(uint8_t wpm); | ||
| 45 | |||
| 46 | #if defined(BCAT_OLED_PET) | ||
| 47 | /* Renders an animated critter at the cursor that can respond to keystrokes, | ||
| 48 | * typing speed, etc. Should be about 5 character cells wide, but exact height | ||
| 49 | * varies depending on the specific OLED pet implementation linked in. | ||
| 50 | * | ||
| 51 | * The rendered image will be one line taller than the OLED pet's animation | ||
| 52 | * frame height to accommodate pets that "jump" when the spacebar is pressed. | ||
| 53 | */ | ||
| 54 | void render_oled_pet(uint8_t col, uint8_t line, const oled_keyboard_state_t *keyboard_state); | ||
| 55 | #endif | ||
diff --git a/users/bcat/bcat_oled_pet.h b/users/bcat/bcat_oled_pet.h new file mode 100644 index 000000000..ba8227ab6 --- /dev/null +++ b/users/bcat/bcat_oled_pet.h | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | /* Copyright 2021 Jonathan Rascher | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | /* Common interface for an OLED pet (animated critter that reacts to typing). | ||
| 18 | * Please link exactly one accompanying .c file to implement these functions. | ||
| 19 | */ | ||
| 20 | |||
| 21 | #pragma once | ||
| 22 | |||
| 23 | #include <stdbool.h> | ||
| 24 | #include <stdint.h> | ||
| 25 | |||
| 26 | #include "bcat_oled.h" | ||
| 27 | |||
| 28 | /* Opaque token representing a single frame of the OLED pet animation. | ||
| 29 | * Different pet implementations have different valid state values, but the | ||
| 30 | * zero value must always represent the default state of the pet at startup. | ||
| 31 | */ | ||
| 32 | typedef uint16_t oled_pet_state_t; | ||
| 33 | |||
| 34 | /* Returns the number of bytes used to represent the animation frame (in | ||
| 35 | * oled_write_raw_P format). Note that every state the pet supports is expected | ||
| 36 | * to have the same frame size. | ||
| 37 | */ | ||
| 38 | uint16_t oled_pet_frame_bytes(void); | ||
| 39 | |||
| 40 | /* Returns the number of lines of the OLED occupied by the animation. Note that | ||
| 41 | * every state the pet supports is expected to have the same frame size. The | ||
| 42 | * returned value does not include the one line of padding that render_oled_pet | ||
| 43 | * uses to account for "jumping". | ||
| 44 | */ | ||
| 45 | uint8_t oled_pet_frame_lines(void); | ||
| 46 | |||
| 47 | /* Returns whether or not the OLED pet should "jump" when the spacebar is | ||
| 48 | * pressed. (The render_oled_pet implementation shifts the animation frame up | ||
| 49 | * one line when this happens.) | ||
| 50 | */ | ||
| 51 | bool oled_pet_can_jump(void); | ||
| 52 | |||
| 53 | /* Returns the delay before the next animation frame should be displayed. */ | ||
| 54 | uint16_t oled_pet_update_millis(const oled_keyboard_state_t *keyboard_state); | ||
| 55 | |||
| 56 | /* Returns the state of the pet to be animated on the next animation tick. */ | ||
| 57 | oled_pet_state_t oled_pet_next_state(oled_pet_state_t state, const oled_keyboard_state_t *keyboard_state); | ||
| 58 | |||
| 59 | /* Called after the OLED pet is rendered during each OLED task invocation. | ||
| 60 | * Receives the same keyboard state as render_oled_pet. The redraw param | ||
| 61 | * indicates whether or not an OLED frame was just redrawn, allowing a specific | ||
| 62 | * pet implementation to draw custom things atop its animation frames. | ||
| 63 | * | ||
| 64 | * When this function is called, the cursor will be in an unspecified location, | ||
| 65 | * not necessarily the top-left corner of the OLED pet. | ||
| 66 | */ | ||
| 67 | void oled_pet_post_render(uint8_t col, uint8_t line, const oled_keyboard_state_t *keyboard_state, bool redraw); | ||
| 68 | |||
| 69 | /* Returns a PROGMEM pointer to the specified frame buffer for the specified | ||
| 70 | * state. The animation frame has length given by oled_pet_frame_bytes and is | ||
| 71 | * formatted as expected by oled_write_raw_P. | ||
| 72 | */ | ||
| 73 | const char *oled_pet_frame(oled_pet_state_t state); | ||
diff --git a/users/bcat/bcat_oled_pet_isda.c b/users/bcat/bcat_oled_pet_isda.c new file mode 100644 index 000000000..98abddb13 --- /dev/null +++ b/users/bcat/bcat_oled_pet_isda.c | |||
| @@ -0,0 +1,134 @@ | |||
| 1 | /* Copyright 2018 sparrow666 | ||
| 2 | * Copyright 2021 Jonathan Rascher | ||
| 3 | * | ||
| 4 | * This program is free software: you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation, either version 2 of the License, or | ||
| 7 | * (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | /* OLED pet "Isda" (animated unicorn) featuring artwork by OpenGameArt user | ||
| 19 | * sparrow666, licensed under GPL v2.0. | ||
| 20 | * | ||
| 21 | * The animation is 32x72 pixels (9 lines tall). | ||
| 22 | * | ||
| 23 | * Runs faster the quicker you type. Shows LED indicator (Num/Caps/Scroll Lock) | ||
| 24 | * status in the bottom-right corner. | ||
| 25 | * | ||
| 26 | * Named after the goddess Ehlonna's personal unicorn in the first D&D campaign | ||
| 27 | * I ever played. :) | ||
| 28 | * | ||
| 29 | * Artwork source: https://opengameart.org/content/unicorn-2 | ||
| 30 | */ | ||
| 31 | |||
| 32 | #include "bcat_oled_pet.h" | ||
| 33 | |||
| 34 | #include <stdbool.h> | ||
| 35 | #include <stdint.h> | ||
| 36 | |||
| 37 | #include "bcat_oled.h" | ||
| 38 | #include "led.h" | ||
| 39 | #include "oled_driver.h" | ||
| 40 | #include "progmem.h" | ||
| 41 | |||
| 42 | #define NUM_FRAMES 4 | ||
| 43 | #define FRAME_BYTES 288 /* (32 pixel) * (72 pixel) / (8 pixel/byte) */ | ||
| 44 | |||
| 45 | uint16_t oled_pet_frame_bytes(void) { return FRAME_BYTES; } | ||
| 46 | uint8_t oled_pet_frame_lines(void) { return 9 /* (72 pixel) / (8 pixel/line) */; } | ||
| 47 | bool oled_pet_can_jump(void) { return false; } | ||
| 48 | |||
| 49 | uint16_t oled_pet_update_millis(const oled_keyboard_state_t *keyboard_state) { | ||
| 50 | static const uint16_t MIN_MILLIS = 75; | ||
| 51 | static const uint16_t MAX_MILLIS = 300; | ||
| 52 | static const uint8_t MAX_WPM = 150; | ||
| 53 | uint8_t wpm = keyboard_state->wpm; | ||
| 54 | if (wpm > MAX_WPM) { | ||
| 55 | wpm = MAX_WPM; | ||
| 56 | } | ||
| 57 | return MAX_MILLIS - (MAX_MILLIS - MIN_MILLIS) * wpm / MAX_WPM; | ||
| 58 | } | ||
| 59 | |||
| 60 | oled_pet_state_t oled_pet_next_state(oled_pet_state_t state, const oled_keyboard_state_t *keyboard_state) { | ||
| 61 | /* When the user stops typing, cycle the animation to frame 0 and stop. */ | ||
| 62 | return state != 0 || keyboard_state->wpm > 0 ? (state + 1) % NUM_FRAMES : 0; | ||
| 63 | } | ||
| 64 | |||
| 65 | void oled_pet_post_render(uint8_t col, uint8_t line, const oled_keyboard_state_t *keyboard_state, bool redraw) { | ||
| 66 | /* Draws LED indicator status in the bottom-right corner of the OLED pet, | ||
| 67 | * atop the animation frame. Redrawn only when necessary, e.g., when LED | ||
| 68 | * status changes or the animation itself updated (which overwrites any | ||
| 69 | * previously drawn indicators). | ||
| 70 | */ | ||
| 71 | static led_t prev_leds = {.raw = 0}; | ||
| 72 | led_t leds = keyboard_state->leds; | ||
| 73 | if (redraw || leds.raw != prev_leds.raw) { | ||
| 74 | oled_set_cursor(col + 4, line + 4); | ||
| 75 | oled_write_char(leds.num_lock ? 'N' : ' ', /*invert=*/false); | ||
| 76 | oled_set_cursor(col + 4, line + 6); | ||
| 77 | oled_write_char(leds.caps_lock ? 'C' : ' ', /*invert=*/false); | ||
| 78 | oled_set_cursor(col + 4, line + 8); | ||
| 79 | oled_write_char(leds.scroll_lock ? 'S' : ' ', /*invert=*/false); | ||
| 80 | prev_leds = leds; | ||
| 81 | } | ||
| 82 | } | ||
| 83 | |||
| 84 | const char *oled_pet_frame(oled_pet_state_t state) { | ||
| 85 | static const char PROGMEM FRAMES[NUM_FRAMES][FRAME_BYTES] = { | ||
| 86 | // clang-format off | ||
| 87 | { | ||
| 88 | 0x00, 0x00, 0x00, 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, 0x40, 0xa0, 0x60, 0x00, | ||
| 89 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x88, 0xd0, 0x78, 0x04, 0x28, 0x70, 0x60, 0x90, 0x88, 0xc4, 0x22, 0x19, 0x04, 0x03, 0x00, 0x00, 0x00, | ||
| 90 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x84, 0x8c, 0x08, 0x01, 0x01, 0x02, 0x02, 0x04, 0x88, 0xf0, 0x00, | ||
| 91 | 0xc0, 0xe0, 0xe0, 0x10, 0x10, 0x08, 0x04, 0x02, 0x01, 0xff, 0xff, 0xff, 0x7f, 0x0f, 0x1f, 0x00, 0x00, 0x00, 0xf8, 0x07, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, | ||
| 92 | 0x00, 0x0f, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0xe0, 0x18, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 93 | 0xfc, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0x3c, 0x0f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 94 | 0x00, 0x01, 0x03, 0xc6, 0x3c, 0x00, 0x80, 0x70, 0x1c, 0x0f, 0x03, 0x0f, 0x3f, 0xff, 0xff, 0xfc, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 95 | 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x80, 0xe0, 0xf8, 0xfe, 0x7f, 0x1f, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 96 | 0x00, 0x00, 0x00, 0x01, 0x0e, 0x30, 0x40, 0x47, 0x4f, 0x77, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 97 | }, | ||
| 98 | { | ||
| 99 | 0x00, 0x00, 0x00, 0x00, 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, 0x40, 0xc0, 0x00, | ||
| 100 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0xa0, 0xf0, 0x08, 0x50, 0xe0, 0xc0, 0x20, 0x10, 0x88, 0x44, 0x32, 0x09, 0x06, 0x01, 0x00, 0x00, | ||
| 101 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf8, 0xfe, 0xff, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x08, 0x19, 0x11, 0x03, 0x02, 0x04, 0x04, 0x08, 0x10, 0xe0, 0x00, | ||
| 102 | 0xc0, 0xe0, 0xe0, 0x10, 0x10, 0x08, 0x04, 0x02, 0x01, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0x0f, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x00, | ||
| 103 | 0x00, 0x1f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0x03, 0x00, 0x00, 0x80, 0xc0, 0x20, 0x10, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 104 | 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0x3c, 0x0f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 105 | 0x01, 0x03, 0xc6, 0x3c, 0x00, 0x80, 0x70, 0x18, 0x0f, 0x03, 0x0f, 0x3f, 0xff, 0xff, 0xfc, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 106 | 0xc0, 0x38, 0x07, 0xc0, 0x38, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0f, 0x7f, 0xff, 0xff, 0xe0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 107 | 0x21, 0x20, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x0f, 0x0f, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 108 | }, | ||
| 109 | { | ||
| 110 | 0x00, 0x00, 0x00, 0x00, 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, 0x40, 0xc0, 0x00, | ||
| 111 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0xa0, 0xf0, 0x08, 0x50, 0xe0, 0xc0, 0x20, 0x10, 0x88, 0x44, 0x32, 0x09, 0x06, 0x01, 0x00, 0x00, | ||
| 112 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf8, 0xfe, 0xff, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x08, 0x19, 0x11, 0x03, 0x02, 0x04, 0x04, 0x08, 0x10, 0xe0, 0x00, | ||
| 113 | 0xc0, 0xc0, 0xc0, 0x20, 0x20, 0x10, 0x08, 0x04, 0x03, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0x0f, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x00, | ||
| 114 | 0x00, 0x1f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0x03, 0x00, 0x00, 0x80, 0xc0, 0x20, 0x10, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 115 | 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 116 | 0x01, 0x03, 0xc3, 0xfe, 0xfe, 0xfc, 0x7c, 0x1c, 0x0c, 0x0c, 0x08, 0x10, 0x60, 0x83, 0x07, 0x18, 0x60, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 117 | 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x71, 0x0e, 0x80, 0x70, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 118 | 0x00, 0x00, 0x01, 0x0f, 0x3f, 0x7f, 0x7f, 0x78, 0xe0, 0x90, 0x88, 0x66, 0x11, 0x08, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 119 | }, | ||
| 120 | { | ||
| 121 | 0x00, 0x00, 0x00, 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, 0x40, 0xa0, 0x60, 0x00, | ||
| 122 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x88, 0xd0, 0x78, 0x04, 0x28, 0x70, 0x60, 0x90, 0x88, 0xc4, 0x22, 0x19, 0x04, 0x03, 0x00, 0x00, 0x00, | ||
| 123 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x84, 0x8c, 0x08, 0x01, 0x01, 0x02, 0x02, 0x04, 0x88, 0xf0, 0x00, | ||
| 124 | 0xc0, 0xe0, 0xe0, 0x10, 0x10, 0x08, 0x04, 0x02, 0x01, 0xff, 0xff, 0xff, 0x7f, 0x0f, 0x1f, 0x00, 0x00, 0x00, 0xf8, 0x07, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, | ||
| 125 | 0x00, 0x0f, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0xe0, 0x18, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 126 | 0xe0, 0xfc, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 127 | 0x00, 0x00, 0x00, 0x01, 0x03, 0xc6, 0xfc, 0xfc, 0xfc, 0x7c, 0x18, 0x08, 0x08, 0x08, 0x30, 0xc0, 0x03, 0x0c, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 128 | 0x00, 0x00, 0x00, 0xc0, 0xf8, 0xff, 0xff, 0x3f, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0e, 0x70, 0x80, 0x1f, 0x60, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 129 | 0x00, 0x18, 0x3e, 0x3f, 0x3f, 0x1f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x0c, 0x09, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 130 | }, | ||
| 131 | // clang-format on | ||
| 132 | }; | ||
| 133 | return FRAMES[state]; | ||
| 134 | } | ||
diff --git a/users/bcat/bcat_oled_pet_luna.c b/users/bcat/bcat_oled_pet_luna.c new file mode 100644 index 000000000..f0397c9c0 --- /dev/null +++ b/users/bcat/bcat_oled_pet_luna.c | |||
| @@ -0,0 +1,168 @@ | |||
| 1 | /* Copyright 2021 HellSingCoder | ||
| 2 | * Copyright 2021 Jonathan Rascher | ||
| 3 | * | ||
| 4 | * This program is free software: you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation, either version 2 of the License, or | ||
| 7 | * (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | /* OLED pet "Luna" (animated doggo) originally by HellSingCoder | ||
| 19 | * (https://www.simonepellegrino.com/) and licensed under GPL v2.0, adapted to | ||
| 20 | * fit the OLED pet framework in bcat's userspace. | ||
| 21 | * | ||
| 22 | * The animation is 32x24 pixels (3 lines tall). | ||
| 23 | * | ||
| 24 | * Walks or runs in response to typing speed. Sneaks when Ctrl is pressed and | ||
| 25 | * barks when Caps Lock is on. Jumps when space is pressed. | ||
| 26 | * | ||
| 27 | * Original source: | ||
| 28 | * https://github.com/qmk/qmk_firmware/blob/6dfe915e26d7147e6c2bed495d3b01cf5b21e6ec/keyboards/sofle/keymaps/helltm/keymap.c | ||
| 29 | */ | ||
| 30 | |||
| 31 | #include "bcat_oled_pet.h" | ||
| 32 | |||
| 33 | #include <stdbool.h> | ||
| 34 | #include <stdint.h> | ||
| 35 | |||
| 36 | #include "bcat_oled.h" | ||
| 37 | #include "keycode.h" | ||
| 38 | #include "progmem.h" | ||
| 39 | |||
| 40 | enum image { | ||
| 41 | IMAGE_IDLE, | ||
| 42 | IMAGE_WALK, | ||
| 43 | IMAGE_RUN, | ||
| 44 | IMAGE_SNEAK, | ||
| 45 | IMAGE_BARK, | ||
| 46 | }; | ||
| 47 | |||
| 48 | typedef union { | ||
| 49 | oled_pet_state_t raw; | ||
| 50 | struct { | ||
| 51 | uint8_t image; | ||
| 52 | uint8_t frame; | ||
| 53 | }; | ||
| 54 | } luna_state_t; | ||
| 55 | |||
| 56 | #define NUM_FRAMES 2 | ||
| 57 | #define FRAME_BYTES 96 /* (32 pixel) * (24 pixel) / (8 pixel/byte) */ | ||
| 58 | |||
| 59 | uint16_t oled_pet_frame_bytes(void) { return FRAME_BYTES; } | ||
| 60 | uint8_t oled_pet_frame_lines(void) { return 3 /* (24 pixel) / (8 pixel/line) */; } | ||
| 61 | bool oled_pet_can_jump(void) { return true; } | ||
| 62 | |||
| 63 | uint16_t oled_pet_update_millis(const oled_keyboard_state_t *keyboard_state) { return 200; } | ||
| 64 | |||
| 65 | oled_pet_state_t oled_pet_next_state(oled_pet_state_t state, const oled_keyboard_state_t *keyboard_state) { | ||
| 66 | luna_state_t luna_state = {.raw = state}; | ||
| 67 | if (keyboard_state->leds.caps_lock) { | ||
| 68 | luna_state.image = IMAGE_BARK; | ||
| 69 | } else if (keyboard_state->mods & MOD_MASK_CTRL) { | ||
| 70 | luna_state.image = IMAGE_SNEAK; | ||
| 71 | } else if (keyboard_state->wpm >= 100) { | ||
| 72 | luna_state.image = IMAGE_RUN; | ||
| 73 | } else if (keyboard_state->wpm >= 25) { | ||
| 74 | luna_state.image = IMAGE_WALK; | ||
| 75 | } else { | ||
| 76 | luna_state.image = IMAGE_IDLE; | ||
| 77 | } | ||
| 78 | luna_state.frame = (luna_state.frame + 1) % NUM_FRAMES; | ||
| 79 | return luna_state.raw; | ||
| 80 | } | ||
| 81 | |||
| 82 | void oled_pet_post_render(uint8_t col, uint8_t line, const oled_keyboard_state_t *keyboard_state, bool redraw) {} | ||
| 83 | |||
| 84 | const char *oled_pet_frame(oled_pet_state_t state) { | ||
| 85 | static const char PROGMEM IDLE_FRAMES[NUM_FRAMES][FRAME_BYTES] = { | ||
| 86 | // clang-format off | ||
| 87 | { | ||
| 88 | 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, | ||
| 89 | 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, | ||
| 90 | 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, | ||
| 91 | }, | ||
| 92 | { | ||
| 93 | 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, | ||
| 94 | 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, | ||
| 95 | 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, | ||
| 96 | }, | ||
| 97 | // clang-format on | ||
| 98 | }; | ||
| 99 | static const char PROGMEM WALK_FRAMES[NUM_FRAMES][FRAME_BYTES] = { | ||
| 100 | // clang-format off | ||
| 101 | { | ||
| 102 | 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, | ||
| 103 | 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, | ||
| 104 | 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, | ||
| 105 | }, | ||
| 106 | { | ||
| 107 | 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, | ||
| 108 | 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, | ||
| 109 | 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, | ||
| 110 | }, | ||
| 111 | // clang-format on | ||
| 112 | }; | ||
| 113 | static const char PROGMEM RUN_FRAMES[NUM_FRAMES][FRAME_BYTES] = { | ||
| 114 | // clang-format off | ||
| 115 | { | ||
| 116 | 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, | ||
| 117 | 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, | ||
| 118 | 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, | ||
| 119 | }, | ||
| 120 | { | ||
| 121 | 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, | ||
| 122 | 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, | ||
| 123 | 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, | ||
| 124 | }, | ||
| 125 | // clang-format on | ||
| 126 | }; | ||
| 127 | static const char PROGMEM SNEAK_FRAMES[NUM_FRAMES][FRAME_BYTES] = { | ||
| 128 | // clang-format off | ||
| 129 | { | ||
| 130 | 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, | ||
| 131 | 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, | ||
| 132 | 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, | ||
| 133 | }, | ||
| 134 | { | ||
| 135 | 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, | ||
| 136 | 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, | ||
| 137 | 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, | ||
| 138 | }, | ||
| 139 | // clang-format on | ||
| 140 | }; | ||
| 141 | static const char PROGMEM BARK_FRAMES[NUM_FRAMES][FRAME_BYTES] = { | ||
| 142 | // clang-format off | ||
| 143 | { | ||
| 144 | 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, | ||
| 145 | 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, | ||
| 146 | 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, | ||
| 147 | }, | ||
| 148 | { | ||
| 149 | 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, | ||
| 150 | 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, | ||
| 151 | 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, | ||
| 152 | }, | ||
| 153 | // clang-format on | ||
| 154 | }; | ||
| 155 | luna_state_t luna_state = {.raw = state}; | ||
| 156 | switch (luna_state.image) { | ||
| 157 | case IMAGE_WALK: | ||
| 158 | return WALK_FRAMES[luna_state.frame]; | ||
| 159 | case IMAGE_RUN: | ||
| 160 | return RUN_FRAMES[luna_state.frame]; | ||
| 161 | case IMAGE_SNEAK: | ||
| 162 | return SNEAK_FRAMES[luna_state.frame]; | ||
| 163 | case IMAGE_BARK: | ||
| 164 | return BARK_FRAMES[luna_state.frame]; | ||
| 165 | default: | ||
| 166 | return IDLE_FRAMES[luna_state.frame]; | ||
| 167 | } | ||
| 168 | } | ||
diff --git a/users/bcat/bcat_rgblight.c b/users/bcat/bcat_rgblight.c new file mode 100644 index 000000000..cd6222262 --- /dev/null +++ b/users/bcat/bcat_rgblight.c | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | /* Copyright 2021 Jonathan Rascher | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include <stdint.h> | ||
| 18 | |||
| 19 | #include "progmem.h" | ||
| 20 | |||
| 21 | /* Adjust RGB static hue ranges for shorter gradients than default. */ | ||
| 22 | const uint8_t RGBLED_GRADIENT_RANGES[] PROGMEM = {255, 127, 63, 31, 15}; | ||
diff --git a/users/bcat/compile.sh b/users/bcat/compile.sh new file mode 100755 index 000000000..81551f0ec --- /dev/null +++ b/users/bcat/compile.sh | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | set -o errexit -o nounset | ||
| 4 | |||
| 5 | usage () { | ||
| 6 | printf "\ | ||
| 7 | usage: ./users/bcat/compile.sh [-c] [-j N] | ||
| 8 | |||
| 9 | Compiles all keyboards for which bcat maintains keymaps. | ||
| 10 | |||
| 11 | optional arguments: | ||
| 12 | -c performs a clean build | ||
| 13 | -j N runs N make tasks in parallel | ||
| 14 | -v shows verbose output | ||
| 15 | " | ||
| 16 | } | ||
| 17 | |||
| 18 | compile () { | ||
| 19 | local keyboard=$1 layout=${2:-} | ||
| 20 | FORCE_LAYOUT="$layout" SILENT="$opt_silent" make -j "$opt_parallel" "$keyboard":bcat | ||
| 21 | } | ||
| 22 | |||
| 23 | opt_parallel=1 | ||
| 24 | opt_silent=true | ||
| 25 | |||
| 26 | while getopts :chj:v opt; do | ||
| 27 | case $opt in | ||
| 28 | c) opt_clean=1 ;; | ||
| 29 | j) opt_parallel=$OPTARG ;; | ||
| 30 | v) opt_silent=false ;; | ||
| 31 | h) usage; exit 0 ;; | ||
| 32 | \?) usage >&2; exit 2 ;; | ||
| 33 | esac | ||
| 34 | done | ||
| 35 | |||
| 36 | if [[ -n ${opt_clean:-} ]]; then | ||
| 37 | SILENT="$opt_silent" make clean | ||
| 38 | fi | ||
| 39 | |||
| 40 | compile 9key | ||
| 41 | compile ai03/polaris 60_tsangan_hhkb | ||
| 42 | compile cannonkeys/an_c 60_tsangan_hhkb | ||
| 43 | compile cannonkeys/instant60 60_tsangan_hhkb | ||
| 44 | compile crkbd/rev1 split_3x6_3 | ||
| 45 | compile dz60 60_ansi_split_bs_rshift | ||
| 46 | compile dz60 60_tsangan_hhkb | ||
| 47 | compile eco/rev2 | ||
| 48 | compile kbdfans/kbd67/hotswap 65_ansi_blocker_split_bs | ||
| 49 | compile keebio/bdn9/rev1 | ||
| 50 | compile keebio/quefrency/rev1 | ||
| 51 | compile lily58/rev1 | ||
diff --git a/users/bcat/config.h b/users/bcat/config.h index 5bb93f383..7bb5d71ba 100644 --- a/users/bcat/config.h +++ b/users/bcat/config.h | |||
| @@ -14,6 +14,12 @@ | |||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | /* Enable NKRO by default. All my devices support this, and it enables me to | ||
| 18 | * dispense with the NK_TOGG key, thus saving firmware space by not compiling | ||
| 19 | * magic keycode support. | ||
| 20 | */ | ||
| 21 | #define FORCE_NKRO | ||
| 22 | |||
| 17 | /* Wait between tap_code register and unregister to fix flaky media keys. */ | 23 | /* Wait between tap_code register and unregister to fix flaky media keys. */ |
| 18 | #undef TAP_CODE_DELAY | 24 | #undef TAP_CODE_DELAY |
| 19 | 25 | ||
| @@ -31,6 +37,22 @@ | |||
| 31 | */ | 37 | */ |
| 32 | #define TAPPING_FORCE_HOLD | 38 | #define TAPPING_FORCE_HOLD |
| 33 | 39 | ||
| 40 | #if defined(OLED_ENABLE) | ||
| 41 | /* The built-in OLED timeout wakes the OLED screen every time the buffer is | ||
| 42 | * updated, even if no user activity has occurred recently. This prevents the | ||
| 43 | * OLED from ever turning off during a continuously running animation. To avoid | ||
| 44 | * this, we disable the default timeout and implement our own in | ||
| 45 | * oled_task_user. | ||
| 46 | */ | ||
| 47 | # undef OLED_TIMEOUT | ||
| 48 | # define OLED_DISABLE_TIMEOUT | ||
| 49 | |||
| 50 | # if defined(SPLIT_KEYBOARD) | ||
| 51 | /* Sync OLED on/off state between halves of split keyboards. */ | ||
| 52 | # define SPLIT_OLED_ENABLE | ||
| 53 | # endif | ||
| 54 | #endif | ||
| 55 | |||
| 34 | #if defined(RGB_MATRIX_ENABLE) | 56 | #if defined(RGB_MATRIX_ENABLE) |
| 35 | /* Turn off per-key RGB when the host goes to sleep. */ | 57 | /* Turn off per-key RGB when the host goes to sleep. */ |
| 36 | # define RGB_DISABLE_WHEN_USB_SUSPENDED | 58 | # define RGB_DISABLE_WHEN_USB_SUSPENDED |
| @@ -46,9 +68,42 @@ | |||
| 46 | # define RGB_MATRIX_VAL_STEP 17 | 68 | # define RGB_MATRIX_VAL_STEP 17 |
| 47 | # define RGB_MATRIX_SPD_STEP 17 | 69 | # define RGB_MATRIX_SPD_STEP 17 |
| 48 | 70 | ||
| 49 | /* Turn on additional RGB animations. */ | 71 | /* Enable specific per-key animation modes. */ |
| 72 | # define ENABLE_RGB_MATRIX_ALPHAS_MODS | ||
| 73 | # define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT | ||
| 74 | # define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL | ||
| 75 | # define ENABLE_RGB_MATRIX_BAND_SAT | ||
| 76 | # define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT | ||
| 77 | # define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL | ||
| 78 | # define ENABLE_RGB_MATRIX_BAND_VAL | ||
| 79 | # define ENABLE_RGB_MATRIX_BREATHING | ||
| 80 | # define ENABLE_RGB_MATRIX_CYCLE_ALL | ||
| 81 | # define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT | ||
| 82 | # define ENABLE_RGB_MATRIX_CYCLE_OUT_IN | ||
| 83 | # define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL | ||
| 84 | # define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL | ||
| 85 | # define ENABLE_RGB_MATRIX_CYCLE_SPIRAL | ||
| 86 | # define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN | ||
| 87 | # define ENABLE_RGB_MATRIX_DUAL_BEACON | ||
| 88 | # define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT | ||
| 89 | # define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN | ||
| 90 | # define ENABLE_RGB_MATRIX_HUE_BREATHING | ||
| 91 | # define ENABLE_RGB_MATRIX_HUE_PENDULUM | ||
| 92 | # define ENABLE_RGB_MATRIX_HUE_WAVE | ||
| 93 | # define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS | ||
| 94 | # define ENABLE_RGB_MATRIX_PIXEL_FRACTAL | ||
| 95 | # define ENABLE_RGB_MATRIX_PIXEL_RAIN | ||
| 96 | # define ENABLE_RGB_MATRIX_RAINBOW_BEACON | ||
| 97 | # define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON | ||
| 98 | # define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS | ||
| 99 | # define ENABLE_RGB_MATRIX_RAINDROPS | ||
| 100 | |||
| 101 | /* Enable additional per-key animation modes that require a copy of the | ||
| 102 | * framebuffer (with accompanying storage cost). | ||
| 103 | */ | ||
| 50 | # define RGB_MATRIX_FRAMEBUFFER_EFFECTS | 104 | # define RGB_MATRIX_FRAMEBUFFER_EFFECTS |
| 51 | # define RGB_MATRIX_KEYPRESSES | 105 | # define ENABLE_RGB_MATRIX_DIGITAL_RAIN |
| 106 | # define ENABLE_RGB_MATRIX_TYPING_HEATMAP | ||
| 52 | #endif | 107 | #endif |
| 53 | 108 | ||
| 54 | #if defined(RGBLIGHT_ENABLE) | 109 | #if defined(RGBLIGHT_ENABLE) |
| @@ -64,8 +119,18 @@ | |||
| 64 | # define RGBLIGHT_SAT_STEP 17 | 119 | # define RGBLIGHT_SAT_STEP 17 |
| 65 | # define RGBLIGHT_VAL_STEP 17 | 120 | # define RGBLIGHT_VAL_STEP 17 |
| 66 | 121 | ||
| 67 | /* Turn on additional RGB animations. */ | 122 | /* Enable specific underglow animation modes. (Skip TWINKLE because it seems to |
| 68 | # define RGBLIGHT_ANIMATIONS | 123 | * be broken on ARM: https://github.com/qmk/qmk_firmware/issues/15345.) |
| 124 | */ | ||
| 125 | # define RGBLIGHT_EFFECT_ALTERNATING | ||
| 126 | # define RGBLIGHT_EFFECT_BREATHING | ||
| 127 | # define RGBLIGHT_EFFECT_CHRISTMAS | ||
| 128 | # define RGBLIGHT_EFFECT_KNIGHT | ||
| 129 | # define RGBLIGHT_EFFECT_RAINBOW_MOOD | ||
| 130 | # define RGBLIGHT_EFFECT_RAINBOW_SWIRL | ||
| 131 | # define RGBLIGHT_EFFECT_RGB_TEST | ||
| 132 | # define RGBLIGHT_EFFECT_SNAKE | ||
| 133 | # define RGBLIGHT_EFFECT_STATIC_GRADIENT | ||
| 69 | #endif | 134 | #endif |
| 70 | 135 | ||
| 71 | #if defined(BACKLIGHT_ENABLE) | 136 | #if defined(BACKLIGHT_ENABLE) |
| @@ -77,3 +142,9 @@ | |||
| 77 | 142 | ||
| 78 | # define BACKLIGHT_LEVELS 7 | 143 | # define BACKLIGHT_LEVELS 7 |
| 79 | #endif | 144 | #endif |
| 145 | |||
| 146 | /* Turn off unused config options to reduce firmware size. */ | ||
| 147 | #define LAYER_STATE_8BIT | ||
| 148 | #define NO_ACTION_ONESHOT | ||
| 149 | #undef LOCKING_RESYNC_ENABLE | ||
| 150 | #undef LOCKING_SUPPORT_ENABLE | ||
diff --git a/users/bcat/readme.md b/users/bcat/readme.md index 1922f95f4..bb73a53bf 100644 --- a/users/bcat/readme.md +++ b/users/bcat/readme.md | |||
| @@ -6,6 +6,8 @@ keyboard-specific keymaps for boards without standard layout support. I derive | |||
| 6 | my keymaps from two canonical ones (preferred for typing and gaming, | 6 | my keymaps from two canonical ones (preferred for typing and gaming, |
| 7 | respectively). | 7 | respectively). |
| 8 | 8 | ||
| 9 | You can build all keymaps I maintain at once using `./users/bcat/compile.sh`. | ||
| 10 | |||
| 9 | ## Canonical keymaps | 11 | ## Canonical keymaps |
| 10 | 12 | ||
| 11 | * [Split 3x6 + 3 thumb | 13 | * [Split 3x6 + 3 thumb |
diff --git a/users/bcat/rules.mk b/users/bcat/rules.mk index 12c9a89bf..bb4bb11d8 100644 --- a/users/bcat/rules.mk +++ b/users/bcat/rules.mk | |||
| @@ -1,7 +1,10 @@ | |||
| 1 | SRC += bcat.c | 1 | # Enable Bootmagic Lite for keyboards that don't have an easily accessible |
| 2 | 2 | # reset button, but keep it disabled for all others to reduce firmware size. | |
| 3 | # Enable Bootmagic Lite to consistently reset to bootloader and clear EEPROM. | 3 | ifneq ($(filter $(strip $(KEYBOARD)),ai03/polaris dz60 kbdfans/kbd67/hotswap),) |
| 4 | BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite | 4 | BOOTMAGIC_ENABLE = yes |
| 5 | else | ||
| 6 | BOOTMAGIC_ENABLE = no | ||
| 7 | endif | ||
| 5 | 8 | ||
| 6 | # Enable media keys on all keyboards. | 9 | # Enable media keys on all keyboards. |
| 7 | EXTRAKEY_ENABLE = yes | 10 | EXTRAKEY_ENABLE = yes |
| @@ -16,21 +19,49 @@ NKRO_ENABLE = yes | |||
| 16 | # Enable link-time optimization to reduce binary size. | 19 | # Enable link-time optimization to reduce binary size. |
| 17 | LTO_ENABLE = yes | 20 | LTO_ENABLE = yes |
| 18 | 21 | ||
| 19 | # Disable unused build options on all keyboards. | 22 | # Include common utilities shared across all our keymaps. |
| 23 | SRC += bcat.c | ||
| 24 | |||
| 25 | # Include additional utilities that extend optional QMK features only enabled | ||
| 26 | # on some keyboards. | ||
| 27 | ifeq ($(strip $(OLED_ENABLE)), yes) | ||
| 28 | SRC += bcat_oled.c | ||
| 29 | WPM_ENABLE = yes # for WPM and animated "keyboard pet" widgets | ||
| 30 | |||
| 31 | # OLED pets (animated critters that react to typing) take up a lot of | ||
| 32 | # firmware space, so only compile one, and only if requested. | ||
| 33 | BCAT_OLED_PET ?= no | ||
| 34 | ifneq ($(strip $(BCAT_OLED_PET)), no) | ||
| 35 | SRC += bcat_oled_pet_$(strip $(BCAT_OLED_PET)).c | ||
| 36 | OPT_DEFS += -DBCAT_OLED_PET | ||
| 37 | endif | ||
| 38 | endif | ||
| 39 | |||
| 40 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) | ||
| 41 | SRC += bcat_rgblight.c | ||
| 42 | endif | ||
| 43 | |||
| 44 | # Disable unwanted build options on all keyboards. (Mouse keys are turned off | ||
| 45 | # due to https://github.com/qmk/qmk_firmware/issues/8323, and the rest are | ||
| 46 | # turned off to reduce firmware size.) | ||
| 20 | COMMAND_ENABLE = no | 47 | COMMAND_ENABLE = no |
| 21 | CONSOLE_ENABLE = no | 48 | CONSOLE_ENABLE = no |
| 22 | MOUSEKEY_ENABLE = no | 49 | MOUSEKEY_ENABLE = no |
| 23 | TERMINAL_ENABLE = no | 50 | TERMINAL_ENABLE = no |
| 24 | 51 | ||
| 25 | # Disable unused hardware options on all keyboards. | 52 | # Disable unwanted hardware options on all keyboards. (Some keyboards turn |
| 53 | # these features on by default even though they aren't actually required.) | ||
| 26 | MIDI_ENABLE = no | 54 | MIDI_ENABLE = no |
| 27 | SLEEP_LED_ENABLE = no | 55 | SLEEP_LED_ENABLE = no |
| 28 | 56 | ||
| 29 | # Disable other unused options on all keyboards. | 57 | # Disable other unused options on all keyboards. |
| 30 | AUTO_SHIFT_ENABLE = no | 58 | AUTO_SHIFT_ENABLE = no |
| 31 | COMBO_ENABLE = no | 59 | COMBO_ENABLE = no |
| 60 | GRAVE_ESC_ENABLE = no | ||
| 32 | KEY_LOCK_ENABLE = no | 61 | KEY_LOCK_ENABLE = no |
| 33 | LEADER_ENABLE = no | 62 | LEADER_ENABLE = no |
| 63 | MAGIC_ENABLE = no | ||
| 64 | SPACE_CADET_ENABLE = no | ||
| 34 | SWAP_HANDS_ENABLE = no | 65 | SWAP_HANDS_ENABLE = no |
| 35 | TAP_DANCE_ENABLE = no | 66 | TAP_DANCE_ENABLE = no |
| 36 | UCIS_ENABLE = no | 67 | UCIS_ENABLE = no |
