aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/9key/keymaps/bcat/keymap.c19
-rw-r--r--keyboards/9key/keymaps/bcat/readme.md6
-rw-r--r--keyboards/eco/keymaps/bcat/config.h2
-rw-r--r--keyboards/eco/keymaps/bcat/keymap.c19
-rw-r--r--keyboards/eco/keymaps/bcat/readme.md2
-rw-r--r--keyboards/keebio/bdn9/keymaps/bcat/keymap.c13
-rw-r--r--keyboards/keebio/quefrency/keymaps/bcat/keymap.c13
-rw-r--r--keyboards/keebio/quefrency/keymaps/bcat/readme.md2
-rw-r--r--keyboards/lily58/keymaps/bcat/config.h2
-rw-r--r--keyboards/lily58/keymaps/bcat/keymap.c33
-rw-r--r--keyboards/lily58/keymaps/bcat/readme.md2
-rw-r--r--keyboards/lily58/keymaps/bcat/rules.mk2
-rw-r--r--layouts/community/60_ansi_split_bs_rshift/bcat/keymap.c11
-rw-r--r--layouts/community/60_ansi_split_bs_rshift/bcat/readme.md2
-rw-r--r--layouts/community/60_tsangan_hhkb/bcat/keymap.c11
-rw-r--r--layouts/community/60_tsangan_hhkb/bcat/readme.md2
-rw-r--r--layouts/community/65_ansi_blocker_split_bs/bcat/keymap.c13
-rw-r--r--layouts/community/65_ansi_blocker_split_bs/bcat/readme.md2
-rw-r--r--layouts/community/split_3x6_3/bcat/config.h9
-rw-r--r--layouts/community/split_3x6_3/bcat/keymap.c33
-rw-r--r--layouts/community/split_3x6_3/bcat/readme.md2
-rw-r--r--layouts/community/split_3x6_3/bcat/rules.mk4
-rw-r--r--users/bcat/bcat.c10
-rw-r--r--users/bcat/bcat.h36
-rw-r--r--users/bcat/bcat_oled.c216
-rw-r--r--users/bcat/bcat_oled.h55
-rw-r--r--users/bcat/bcat_oled_pet.h73
-rw-r--r--users/bcat/bcat_oled_pet_isda.c134
-rw-r--r--users/bcat/bcat_oled_pet_luna.c168
-rw-r--r--users/bcat/bcat_rgblight.c22
-rwxr-xr-xusers/bcat/compile.sh51
-rw-r--r--users/bcat/config.h79
-rw-r--r--users/bcat/readme.md2
-rw-r--r--users/bcat/rules.mk43
34 files changed, 959 insertions, 134 deletions
diff --git a/keyboards/9key/keymaps/bcat/keymap.c b/keyboards/9key/keymaps/bcat/keymap.c
index 5c08a42a5..944a48c0d 100644
--- a/keyboards/9key/keymaps/bcat/keymap.c
+++ b/keyboards/9key/keymaps/bcat/keymap.c
@@ -16,22 +16,21 @@
16 16
17#include QMK_KEYBOARD_H 17#include QMK_KEYBOARD_H
18 18
19enum layer { 19#include "bcat.h"
20 LAYER_DEFAULT,
21 LAYER_FUNCTION,
22};
23 20
24#define LY_FUNC MO(LAYER_FUNCTION) 21#define KY_LOCK LGUI(KC_L) /* Chrome OS: Lock screen */
25#define KY_LOCK LCA(KC_L) /* Cinnamon lock screen */ 22#define KY_MICM LSG(KC_1) /* Meet Shortcuts: Mute mic */
23#define KY_MICU LSG(KC_2) /* Meet Shortcuts: Unmute mic */
24#define KY_RHAND LSG(KC_3) /* Meet Shortcuts: Raise/lower hand */
26 25
27const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 26const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
28 // clang-format off 27 // clang-format off
29 [LAYER_DEFAULT] = LAYOUT( 28 [LAYER_DEFAULT] = LAYOUT(
30 KC_MPLY, KC_VOLU, KC_MSTP, 29 KC_MPLY, KC_VOLU, KY_RHAND,
31 KC_MPRV, KC_VOLD, KC_MNXT, 30 KY_LOCK, KC_VOLD, KY_MICU,
32 KY_LOCK, KC_MUTE, LY_FUNC 31 LY_FN1, KC_MUTE, KY_MICM
33 ), 32 ),
34 [LAYER_FUNCTION] = LAYOUT( 33 [LAYER_FUNCTION_1] = LAYOUT(
35 EEP_RST, _______, RESET, 34 EEP_RST, _______, RESET,
36 _______, _______, _______, 35 _______, _______, _______,
37 _______, _______, _______ 36 _______, _______, _______
diff --git a/keyboards/9key/keymaps/bcat/readme.md b/keyboards/9key/keymaps/bcat/readme.md
index 2dee51de8..d38ae5463 100644
--- a/keyboards/9key/keymaps/bcat/readme.md
+++ b/keyboards/9key/keymaps/bcat/readme.md
@@ -1,5 +1,5 @@
1# bcat's 9-Key layout 1# bcat's 9-Key layout
2 2
3This is a super simple PCB-mount macropad with nine keys, used at work for 3This is a super simple PCB-mount macropad with nine keys, used on my
4media keys and quick access to screen lock on Linux (Cinnamon desktop 4work-from-home Chromebox for media/volume control and to activate some global
5environment). 5shortcuts for Google Meet.
diff --git a/keyboards/eco/keymaps/bcat/config.h b/keyboards/eco/keymaps/bcat/config.h
index dffdc7b40..f2d51c324 100644
--- a/keyboards/eco/keymaps/bcat/config.h
+++ b/keyboards/eco/keymaps/bcat/config.h
@@ -16,6 +16,8 @@
16 16
17#pragma once 17#pragma once
18 18
19#define BCAT_ORTHO_LAYERS
20
19/* WS2812B RGB LED strip hand wired to Elite-C. */ 21/* WS2812B RGB LED strip hand wired to Elite-C. */
20#define RGB_DI_PIN B7 22#define RGB_DI_PIN B7
21#define RGBLED_NUM 15 23#define RGBLED_NUM 15
diff --git a/keyboards/eco/keymaps/bcat/keymap.c b/keyboards/eco/keymaps/bcat/keymap.c
index d46a7d416..8c50a9ed5 100644
--- a/keyboards/eco/keymaps/bcat/keymap.c
+++ b/keyboards/eco/keymaps/bcat/keymap.c
@@ -18,21 +18,6 @@
18 18
19#include "bcat.h" 19#include "bcat.h"
20 20
21enum layer {
22 LAYER_DEFAULT,
23 LAYER_LOWER,
24 LAYER_RAISE,
25 LAYER_ADJUST,
26};
27
28#define LY_LWR MO(LAYER_LOWER)
29#define LY_RSE MO(LAYER_RAISE)
30
31#define KY_CSPC LCTL(KC_SPC)
32#define KY_ZMIN LCTL(KC_EQL)
33#define KY_ZMOUT LCTL(KC_MINS)
34#define KY_ZMRST LCTL(KC_0)
35
36const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 21const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
37 // clang-format off 22 // clang-format off
38 /* Default layer: http://www.keyboard-layout-editor.com/#/gists/2c11371c7a5f7cd08a0132631d3d3281 */ 23 /* Default layer: http://www.keyboard-layout-editor.com/#/gists/2c11371c7a5f7cd08a0132631d3d3281 */
@@ -58,12 +43,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
58 ), 43 ),
59 /* Adjust layer: http://www.keyboard-layout-editor.com/#/gists/b18aafa0327d7e83eaf485546c067a21 */ 44 /* Adjust layer: http://www.keyboard-layout-editor.com/#/gists/b18aafa0327d7e83eaf485546c067a21 */
60 [LAYER_ADJUST] = LAYOUT( 45 [LAYER_ADJUST] = LAYOUT(
61 _______, NK_TOGG, KC_MPLY, KC_VOLU, KC_MSTP, _______, _______, _______, EEP_RST, RESET, _______, _______, _______, _______, 46 _______, _______, KC_MPLY, KC_VOLU, KC_MSTP, _______, _______, _______, EEP_RST, RESET, _______, _______, _______, _______,
62 _______, _______, KC_MPRV, KC_VOLD, KC_MNXT, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_VAI, RGB_MOD, RGB_SPI, _______, 47 _______, _______, KC_MPRV, KC_VOLD, KC_MNXT, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_VAI, RGB_MOD, RGB_SPI, _______,
63 _______, _______, _______, KC_MUTE, _______, _______, _______, _______, RGB_HUI, RGB_SAD, RGB_SAI, RGB_HUD, RGB_SPD, _______, 48 _______, _______, _______, KC_MUTE, _______, _______, _______, _______, RGB_HUI, RGB_SAD, RGB_SAI, RGB_HUD, RGB_SPD, _______,
64 _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, _______, _______, _______, _______, _______ 49 _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, _______, _______, _______, _______, _______
65 ), 50 ),
66 // clang-format on 51 // clang-format on
67}; 52};
68
69layer_state_t layer_state_set_keymap(layer_state_t state) { return update_tri_layer_state(state, LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST); }
diff --git a/keyboards/eco/keymaps/bcat/readme.md b/keyboards/eco/keymaps/bcat/readme.md
index 85e261551..fd9e1bea7 100644
--- a/keyboards/eco/keymaps/bcat/readme.md
+++ b/keyboards/eco/keymaps/bcat/readme.md
@@ -39,6 +39,6 @@ nothing really useful to bind them to anyway.
39 39
40## Adjust layer 40## Adjust layer
41 41
42![Adjust layer layout](https://i.imgur.com/J2rOshm.png) 42![Adjust layer layout](https://i.imgur.com/63vm0ke.png)
43 43
44([KLE](http://www.keyboard-layout-editor.com/#/gists/b18aafa0327d7e83eaf485546c067a21)) 44([KLE](http://www.keyboard-layout-editor.com/#/gists/b18aafa0327d7e83eaf485546c067a21))
diff --git a/keyboards/keebio/bdn9/keymaps/bcat/keymap.c b/keyboards/keebio/bdn9/keymaps/bcat/keymap.c
index c64f702b2..2028deb4f 100644
--- a/keyboards/keebio/bdn9/keymaps/bcat/keymap.c
+++ b/keyboards/keebio/bdn9/keymaps/bcat/keymap.c
@@ -16,21 +16,16 @@
16 16
17#include QMK_KEYBOARD_H 17#include QMK_KEYBOARD_H
18 18
19enum layer { 19#include "bcat.h"
20 LAYER_FIRST,
21 LAYER_SECOND,
22};
23
24#define LY_SECND MO(LAYER_SECOND)
25 20
26const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 21const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
27 // clang-format off 22 // clang-format off
28 [LAYER_FIRST] = LAYOUT( 23 [LAYER_DEFAULT] = LAYOUT(
29 KC_MUTE, LY_SECND, BL_BRTG, 24 KC_MUTE, LY_FN1, BL_BRTG,
30 KC_F4, KC_F5, KC_F6, 25 KC_F4, KC_F5, KC_F6,
31 KC_F1, KC_F2, KC_F3 26 KC_F1, KC_F2, KC_F3
32 ), 27 ),
33 [LAYER_SECOND] = LAYOUT( 28 [LAYER_FUNCTION_1] = LAYOUT(
34 EEP_RST, _______, RESET, 29 EEP_RST, _______, RESET,
35 KC_F10, KC_F11, KC_F12, 30 KC_F10, KC_F11, KC_F12,
36 KC_F7, KC_F8, KC_F9 31 KC_F7, KC_F8, KC_F9
diff --git a/keyboards/keebio/quefrency/keymaps/bcat/keymap.c b/keyboards/keebio/quefrency/keymaps/bcat/keymap.c
index d28a5083a..3dd48623f 100644
--- a/keyboards/keebio/quefrency/keymaps/bcat/keymap.c
+++ b/keyboards/keebio/quefrency/keymaps/bcat/keymap.c
@@ -16,12 +16,7 @@
16 16
17#include QMK_KEYBOARD_H 17#include QMK_KEYBOARD_H
18 18
19enum layer { 19#include "bcat.h"
20 LAYER_DEFAULT,
21 LAYER_FUNCTION,
22};
23
24#define LY_FN MO(LAYER_FUNCTION)
25 20
26const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 21const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
27 // clang-format off 22 // clang-format off
@@ -31,12 +26,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
31 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, KC_PGUP, 26 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, KC_PGUP,
32 KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, 27 KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN,
33 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, 28 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END,
34 KC_LCTL, KC_LGUI, KC_LALT, LY_FN, KC_SPC, KC_SPC, XXXXXXX, KC_RALT, LY_FN, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT 29 KC_LCTL, KC_LGUI, KC_LALT, LY_FN1, KC_SPC, KC_SPC, XXXXXXX, KC_RALT, LY_FN1, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
35 ), 30 ),
36 /* Function layer: http://www.keyboard-layout-editor.com/#/gists/59636898946da51f91fb290f8e078b4d */ 31 /* Function layer: http://www.keyboard-layout-editor.com/#/gists/59636898946da51f91fb290f8e078b4d */
37 [LAYER_FUNCTION] = LAYOUT_65( 32 [LAYER_FUNCTION_1] = LAYOUT_65(
38 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, RGB_HUI, 33 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, RGB_HUI,
39 KC_CAPS, NK_TOGG, KC_MPLY, KC_VOLU, KC_MSTP, _______, EEP_RST, RESET, KC_PSCR, KC_SLCK, KC_PAUS, _______, _______, _______, RGB_SAI, 34 KC_CAPS, _______, KC_MPLY, KC_VOLU, KC_MSTP, _______, EEP_RST, RESET, KC_PSCR, KC_SLCK, KC_PAUS, _______, _______, _______, RGB_SAI,
40 _______, _______, KC_MPRV, KC_VOLD, KC_MNXT, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_SAD, 35 _______, _______, KC_MPRV, KC_VOLD, KC_MNXT, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_SAD,
41 _______, KC_APP, _______, KC_MUTE, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, RGB_HUD, 36 _______, KC_APP, _______, KC_MUTE, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, RGB_HUD,
42 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_MOD 37 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_MOD
diff --git a/keyboards/keebio/quefrency/keymaps/bcat/readme.md b/keyboards/keebio/quefrency/keymaps/bcat/readme.md
index 914aa84b6..59a691654 100644
--- a/keyboards/keebio/quefrency/keymaps/bcat/readme.md
+++ b/keyboards/keebio/quefrency/keymaps/bcat/readme.md
@@ -12,6 +12,6 @@ ESDF cluster), and RGB controls in the function layer (on the arrow/nav keys).
12 12
13## Function layer 13## Function layer
14 14
15![Function layer layout](https://i.imgur.com/Fzshl0F.png) 15![Function layer layout](https://i.imgur.com/7oCdN86.png)
16 16
17([KLE](http://www.keyboard-layout-editor.com/#/gists/59636898946da51f91fb290f8e078b4d)) 17([KLE](http://www.keyboard-layout-editor.com/#/gists/59636898946da51f91fb290f8e078b4d))
diff --git a/keyboards/lily58/keymaps/bcat/config.h b/keyboards/lily58/keymaps/bcat/config.h
index dbe724d56..2ee0071bd 100644
--- a/keyboards/lily58/keymaps/bcat/config.h
+++ b/keyboards/lily58/keymaps/bcat/config.h
@@ -16,4 +16,6 @@
16 16
17#pragma once 17#pragma once
18 18
19#define BCAT_ORTHO_LAYERS
20
19#define EE_HANDS 21#define EE_HANDS
diff --git a/keyboards/lily58/keymaps/bcat/keymap.c b/keyboards/lily58/keymaps/bcat/keymap.c
index 69af2ca00..a0856d0fd 100644
--- a/keyboards/lily58/keymaps/bcat/keymap.c
+++ b/keyboards/lily58/keymaps/bcat/keymap.c
@@ -18,20 +18,9 @@
18 18
19#include "bcat.h" 19#include "bcat.h"
20 20
21enum layer { 21#if defined(OLED_ENABLE)
22 LAYER_DEFAULT, 22# include "bcat_oled.h"
23 LAYER_LOWER, 23#endif
24 LAYER_RAISE,
25 LAYER_ADJUST,
26};
27
28#define LY_LWR MO(LAYER_LOWER)
29#define LY_RSE MO(LAYER_RAISE)
30
31#define KY_CSPC LCTL(KC_SPC)
32#define KY_ZMIN LCTL(KC_EQL)
33#define KY_ZMOUT LCTL(KC_MINS)
34#define KY_ZMRST LCTL(KC_0)
35 24
36const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 25const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
37 // clang-format off 26 // clang-format off
@@ -62,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
62 /* Adjust layer: http://www.keyboard-layout-editor.com/#/gists/8f6a3f08350a9bbe1d414b22bca4e6c7 */ 51 /* Adjust layer: http://www.keyboard-layout-editor.com/#/gists/8f6a3f08350a9bbe1d414b22bca4e6c7 */
63 [LAYER_ADJUST] = LAYOUT( 52 [LAYER_ADJUST] = LAYOUT(
64 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 53 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
65 _______, NK_TOGG, KC_MPLY, KC_VOLU, KC_MSTP, _______, EEP_RST, RESET, _______, _______, _______, _______, 54 _______, _______, KC_MPLY, KC_VOLU, KC_MSTP, _______, EEP_RST, RESET, _______, _______, _______, _______,
66 _______, _______, KC_MPRV, KC_VOLD, KC_MNXT, _______, _______, _______, _______, _______, _______, _______, 55 _______, _______, KC_MPRV, KC_VOLD, KC_MNXT, _______, _______, _______, _______, _______, _______, _______,
67 _______, _______, _______, KC_MUTE, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 56 _______, _______, _______, KC_MUTE, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
68 _______, _______, _______, _______, _______, _______, _______, _______ 57 _______, _______, _______, _______, _______, _______, _______, _______
@@ -70,4 +59,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
70 // clang-format on 59 // clang-format on
71}; 60};
72 61
73layer_state_t layer_state_set_keymap(layer_state_t state) { return update_tri_layer_state(state, LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST); } 62#if defined(OLED_ENABLE)
63oled_rotation_t oled_init_user(oled_rotation_t rotation) { return is_keyboard_master() ? OLED_ROTATION_270 : OLED_ROTATION_180; }
64
65void oled_task_keymap(const oled_keyboard_state_t *keyboard_state) {
66 render_oled_layers();
67 oled_advance_page(/*clearPageRemainder=*/false);
68 render_oled_indicators(keyboard_state->leds);
69 oled_advance_page(/*clearPageRemainder=*/false);
70 oled_advance_page(/*clearPageRemainder=*/false);
71 render_oled_wpm(keyboard_state->wpm);
72 render_oled_pet(/*col=*/0, /*line=*/12, keyboard_state);
73}
74#endif
diff --git a/keyboards/lily58/keymaps/bcat/readme.md b/keyboards/lily58/keymaps/bcat/readme.md
index de03526a8..8b0e77e1b 100644
--- a/keyboards/lily58/keymaps/bcat/readme.md
+++ b/keyboards/lily58/keymaps/bcat/readme.md
@@ -37,6 +37,6 @@ back/forward navigation keys.
37 37
38## Adjust layer 38## Adjust layer
39 39
40![Adjust layer layout](https://i.imgur.com/Q3PGsiK.png) 40![Adjust layer layout](https://i.imgur.com/XC2eR2M.png)
41 41
42([KLE](http://www.keyboard-layout-editor.com/#/gists/8f6a3f08350a9bbe1d414b22bca4e6c7)) 42([KLE](http://www.keyboard-layout-editor.com/#/gists/8f6a3f08350a9bbe1d414b22bca4e6c7))
diff --git a/keyboards/lily58/keymaps/bcat/rules.mk b/keyboards/lily58/keymaps/bcat/rules.mk
index c87b447c1..62d1007a5 100644
--- a/keyboards/lily58/keymaps/bcat/rules.mk
+++ b/keyboards/lily58/keymaps/bcat/rules.mk
@@ -1 +1,3 @@
1BCAT_OLED_PET = luna
2
1BOOTLOADER = atmel-dfu # Elite-C 3BOOTLOADER = atmel-dfu # Elite-C
diff --git a/layouts/community/60_ansi_split_bs_rshift/bcat/keymap.c b/layouts/community/60_ansi_split_bs_rshift/bcat/keymap.c
index 6bfafc332..b40148e99 100644
--- a/layouts/community/60_ansi_split_bs_rshift/bcat/keymap.c
+++ b/layouts/community/60_ansi_split_bs_rshift/bcat/keymap.c
@@ -16,14 +16,7 @@
16 16
17#include QMK_KEYBOARD_H 17#include QMK_KEYBOARD_H
18 18
19enum layer { 19#include "bcat.h"
20 LAYER_DEFAULT,
21 LAYER_FUNCTION_1,
22 LAYER_FUNCTION_2,
23};
24
25#define LY_FN1 MO(LAYER_FUNCTION_1)
26#define LY_FN2 MO(LAYER_FUNCTION_2)
27 20
28const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 21const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
29 // clang-format off 22 // clang-format off
@@ -48,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
48 /* Function 2 layer: http://www.keyboard-layout-editor.com/#/gists/6e1068e4f91bbacccaf5ac0acbeec79c */ 41 /* Function 2 layer: http://www.keyboard-layout-editor.com/#/gists/6e1068e4f91bbacccaf5ac0acbeec79c */
49 [LAYER_FUNCTION_2] = LAYOUT_60_ansi_split_bs_rshift( 42 [LAYER_FUNCTION_2] = LAYOUT_60_ansi_split_bs_rshift(
50 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, 43 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL,
51 _______, NK_TOGG, KC_MPLY, KC_VOLU, KC_MSTP, BL_BRTG, EEP_RST, RESET, _______, _______, _______, RGB_VAI, _______, _______, 44 _______, _______, KC_MPLY, KC_VOLU, KC_MSTP, BL_BRTG, EEP_RST, RESET, _______, _______, _______, RGB_VAI, _______, _______,
52 _______, _______, KC_MPRV, KC_VOLD, KC_MNXT, BL_INC, _______, RGB_SPI, RGB_HUI, RGB_SAI, RGB_RMOD, RGB_MOD, RGB_TOG, 45 _______, _______, KC_MPRV, KC_VOLD, KC_MNXT, BL_INC, _______, RGB_SPI, RGB_HUI, RGB_SAI, RGB_RMOD, RGB_MOD, RGB_TOG,
53 _______, _______, _______, KC_MUTE, _______, BL_DEC, _______, RGB_SPD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, 46 _______, _______, _______, KC_MUTE, _______, BL_DEC, _______, RGB_SPD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______,
54 _______, _______, _______, _______, _______, _______, _______, _______ 47 _______, _______, _______, _______, _______, _______, _______, _______
diff --git a/layouts/community/60_ansi_split_bs_rshift/bcat/readme.md b/layouts/community/60_ansi_split_bs_rshift/bcat/readme.md
index 2d578aa3d..f6bcda919 100644
--- a/layouts/community/60_ansi_split_bs_rshift/bcat/readme.md
+++ b/layouts/community/60_ansi_split_bs_rshift/bcat/readme.md
@@ -19,6 +19,6 @@ layout](https://github.com/qmk/qmk_firmware/tree/master/layouts/community/60_tsa
19 19
20## Function 2 layer 20## Function 2 layer
21 21
22![Function 2 layer layout](https://i.imgur.com/vJaCzVo.png) 22![Function 2 layer layout](https://i.imgur.com/DW03vvJ.png)
23 23
24([KLE](http://www.keyboard-layout-editor.com/#/gists/6e1068e4f91bbacccaf5ac0acbeec79c)) 24([KLE](http://www.keyboard-layout-editor.com/#/gists/6e1068e4f91bbacccaf5ac0acbeec79c))
diff --git a/layouts/community/60_tsangan_hhkb/bcat/keymap.c b/layouts/community/60_tsangan_hhkb/bcat/keymap.c
index 05e6462d9..9ec75f3c4 100644
--- a/layouts/community/60_tsangan_hhkb/bcat/keymap.c
+++ b/layouts/community/60_tsangan_hhkb/bcat/keymap.c
@@ -16,14 +16,7 @@
16 16
17#include QMK_KEYBOARD_H 17#include QMK_KEYBOARD_H
18 18
19enum layer { 19#include "bcat.h"
20 LAYER_DEFAULT,
21 LAYER_FUNCTION_1,
22 LAYER_FUNCTION_2,
23};
24
25#define LY_FN1 MO(LAYER_FUNCTION_1)
26#define LY_FN2 MO(LAYER_FUNCTION_2)
27 20
28const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 21const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
29 // clang-format off 22 // clang-format off
@@ -46,7 +39,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
46 /* Function 2 layer: http://www.keyboard-layout-editor.com/#/gists/65ac939caec878401603bc36290852d4 */ 39 /* Function 2 layer: http://www.keyboard-layout-editor.com/#/gists/65ac939caec878401603bc36290852d4 */
47 [LAYER_FUNCTION_2] = LAYOUT_60_tsangan_hhkb( 40 [LAYER_FUNCTION_2] = LAYOUT_60_tsangan_hhkb(
48 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, 41 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL,
49 _______, NK_TOGG, KC_MPLY, KC_VOLU, KC_MSTP, BL_BRTG, EEP_RST, RESET, _______, _______, _______, RGB_VAI, _______, _______, 42 _______, _______, KC_MPLY, KC_VOLU, KC_MSTP, BL_BRTG, EEP_RST, RESET, _______, _______, _______, RGB_VAI, _______, _______,
50 _______, _______, KC_MPRV, KC_VOLD, KC_MNXT, BL_INC, _______, RGB_SPI, RGB_HUI, RGB_SAI, RGB_RMOD, RGB_MOD, RGB_TOG, 43 _______, _______, KC_MPRV, KC_VOLD, KC_MNXT, BL_INC, _______, RGB_SPI, RGB_HUI, RGB_SAI, RGB_RMOD, RGB_MOD, RGB_TOG,
51 _______, _______, _______, KC_MUTE, _______, BL_DEC, _______, RGB_SPD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, 44 _______, _______, _______, KC_MUTE, _______, BL_DEC, _______, RGB_SPD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______,
52 _______, _______, _______, _______, _______, _______, _______ 45 _______, _______, _______, _______, _______, _______, _______
diff --git a/layouts/community/60_tsangan_hhkb/bcat/readme.md b/layouts/community/60_tsangan_hhkb/bcat/readme.md
index b7a3cde5d..c8d0d72dd 100644
--- a/layouts/community/60_tsangan_hhkb/bcat/readme.md
+++ b/layouts/community/60_tsangan_hhkb/bcat/readme.md
@@ -39,6 +39,6 @@ and/or blockers, so there aren't switches installed in those positions.
39 39
40## Function 2 layer 40## Function 2 layer
41 41
42![Function 2 layer layout](https://i.imgur.com/vdNpFae.png) 42![Function 2 layer layout](https://i.imgur.com/4Jdw9eL.png)
43 43
44([KLE](http://www.keyboard-layout-editor.com/#/gists/65ac939caec878401603bc36290852d4)) 44([KLE](http://www.keyboard-layout-editor.com/#/gists/65ac939caec878401603bc36290852d4))
diff --git a/layouts/community/65_ansi_blocker_split_bs/bcat/keymap.c b/layouts/community/65_ansi_blocker_split_bs/bcat/keymap.c
index c91a1b0ea..c099d36e2 100644
--- a/layouts/community/65_ansi_blocker_split_bs/bcat/keymap.c
+++ b/layouts/community/65_ansi_blocker_split_bs/bcat/keymap.c
@@ -16,12 +16,7 @@
16 16
17#include QMK_KEYBOARD_H 17#include QMK_KEYBOARD_H
18 18
19enum layer { 19#include "bcat.h"
20 LAYER_DEFAULT,
21 LAYER_FUNCTION,
22};
23
24#define LY_FN MO(LAYER_FUNCTION)
25 20
26const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 21const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
27 // clang-format off 22 // clang-format off
@@ -31,13 +26,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
31 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, KC_PGUP, 26 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, KC_PGUP,
32 KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, 27 KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN,
33 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, 28 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END,
34 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, LY_FN, KC_LEFT, KC_DOWN, KC_RGHT 29 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, LY_FN1, KC_LEFT, KC_DOWN, KC_RGHT
35 ), 30 ),
36 31
37 /* Function layer: http://www.keyboard-layout-editor.com/#/gists/f29128427f674c43777f045e363d1b44 */ 32 /* Function layer: http://www.keyboard-layout-editor.com/#/gists/f29128427f674c43777f045e363d1b44 */
38 [LAYER_FUNCTION] = LAYOUT_65_ansi_blocker_split_bs( 33 [LAYER_FUNCTION_1] = LAYOUT_65_ansi_blocker_split_bs(
39 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, _______, 34 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, _______,
40 KC_CAPS, NK_TOGG, KC_MPLY, KC_VOLU, KC_MSTP, _______, EEP_RST, RESET, KC_PSCR, KC_SLCK, KC_PAUS, _______, _______, _______, _______, 35 KC_CAPS, _______, KC_MPLY, KC_VOLU, KC_MSTP, _______, EEP_RST, RESET, KC_PSCR, KC_SLCK, KC_PAUS, _______, _______, _______, _______,
41 _______, _______, KC_MPRV, KC_VOLD, KC_MNXT, _______, _______, _______, _______, _______, _______, _______, _______, _______, 36 _______, _______, KC_MPRV, KC_VOLD, KC_MNXT, _______, _______, _______, _______, _______, _______, _______, _______, _______,
42 _______, KC_APP, _______, KC_MUTE, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 37 _______, KC_APP, _______, KC_MUTE, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
43 _______, _______, _______, _______, _______, _______, _______, _______, _______ 38 _______, _______, _______, _______, _______, _______, _______, _______, _______
diff --git a/layouts/community/65_ansi_blocker_split_bs/bcat/readme.md b/layouts/community/65_ansi_blocker_split_bs/bcat/readme.md
index 0726cbece..5777c7c38 100644
--- a/layouts/community/65_ansi_blocker_split_bs/bcat/readme.md
+++ b/layouts/community/65_ansi_blocker_split_bs/bcat/readme.md
@@ -12,6 +12,6 @@ keys, an HHKB-style (split) backspace, and media controls in the function layer
12 12
13## Function layer 13## Function layer
14 14
15![Function layer layout](https://i.imgur.com/CsxfVfd.png) 15![Function layer layout](https://i.imgur.com/s4hS9ZK.png)
16 16
17([KLE](http://www.keyboard-layout-editor.com/#/gists/f29128427f674c43777f045e363d1b44)) 17([KLE](http://www.keyboard-layout-editor.com/#/gists/f29128427f674c43777f045e363d1b44))
diff --git a/layouts/community/split_3x6_3/bcat/config.h b/layouts/community/split_3x6_3/bcat/config.h
index b8743429c..556fb90d5 100644
--- a/layouts/community/split_3x6_3/bcat/config.h
+++ b/layouts/community/split_3x6_3/bcat/config.h
@@ -16,12 +16,13 @@
16 16
17#pragma once 17#pragma once
18 18
19#define BCAT_ORTHO_LAYERS
20
19#if defined(KEYBOARD_crkbd_rev1) 21#if defined(KEYBOARD_crkbd_rev1)
20# define EE_HANDS 22# define EE_HANDS
21 23
22# if defined(RGB_MATRIX_ENABLE) 24# if defined(OLED_ENABLE)
23/* Limit max RGB LED current to avoid tripping controller fuse. */ 25# undef OLED_FONT_H
24# undef RGB_MATRIX_MAXIMUM_BRIGHTNESS 26# define OLED_FONT_H "lib/glcdfont.c"
25# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150
26# endif 27# endif
27#endif 28#endif
diff --git a/layouts/community/split_3x6_3/bcat/keymap.c b/layouts/community/split_3x6_3/bcat/keymap.c
index 4f68c8f84..cfac93d1e 100644
--- a/layouts/community/split_3x6_3/bcat/keymap.c
+++ b/layouts/community/split_3x6_3/bcat/keymap.c
@@ -18,20 +18,9 @@
18 18
19#include "bcat.h" 19#include "bcat.h"
20 20
21enum layer { 21#if defined(OLED_ENABLE)
22 LAYER_DEFAULT, 22# include "bcat_oled.h"
23 LAYER_LOWER, 23#endif
24 LAYER_RAISE,
25 LAYER_ADJUST,
26};
27
28#define LY_LWR MO(LAYER_LOWER)
29#define LY_RSE MO(LAYER_RAISE)
30
31#define KY_CSPC LCTL(KC_SPC)
32#define KY_ZMIN LCTL(KC_EQL)
33#define KY_ZMOUT LCTL(KC_MINS)
34#define KY_ZMRST LCTL(KC_0)
35 24
36const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 25const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
37 // clang-format off 26 // clang-format off
@@ -58,7 +47,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
58 ), 47 ),
59 /* Adjust layer: http://www.keyboard-layout-editor.com/#/gists/77e7572e077b36a23eb2086017e16fee */ 48 /* Adjust layer: http://www.keyboard-layout-editor.com/#/gists/77e7572e077b36a23eb2086017e16fee */
60 [LAYER_ADJUST] = LAYOUT_split_3x6_3( 49 [LAYER_ADJUST] = LAYOUT_split_3x6_3(
61 _______, NK_TOGG, KC_MPLY, KC_VOLU, KC_MSTP, _______, EEP_RST, RESET, _______, _______, _______, _______, 50 _______, _______, KC_MPLY, KC_VOLU, KC_MSTP, _______, EEP_RST, RESET, _______, _______, _______, _______,
62 _______, _______, KC_MPRV, KC_VOLD, KC_MNXT, _______, RGB_RMOD, RGB_VAD, RGB_VAI, RGB_MOD, RGB_SPI, _______, 51 _______, _______, KC_MPRV, KC_VOLD, KC_MNXT, _______, RGB_RMOD, RGB_VAD, RGB_VAI, RGB_MOD, RGB_SPI, _______,
63 _______, _______, _______, KC_MUTE, _______, _______, RGB_HUI, RGB_SAD, RGB_SAI, RGB_HUD, RGB_SPD, _______, 52 _______, _______, _______, KC_MUTE, _______, _______, RGB_HUI, RGB_SAD, RGB_SAI, RGB_HUD, RGB_SPD, _______,
64 _______, _______, _______, RGB_TOG, _______, _______ 53 _______, _______, _______, RGB_TOG, _______, _______
@@ -66,4 +55,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
66 // clang-format on 55 // clang-format on
67}; 56};
68 57
69layer_state_t layer_state_set_keymap(layer_state_t state) { return update_tri_layer_state(state, LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST); } 58#if defined(OLED_ENABLE)
59oled_rotation_t oled_init_user(oled_rotation_t rotation) { return is_keyboard_master() ? OLED_ROTATION_270 : OLED_ROTATION_180; }
60
61void oled_task_keymap(const oled_keyboard_state_t *keyboard_state) {
62 render_oled_layers();
63 oled_advance_page(/*clearPageRemainder=*/false);
64 render_oled_indicators(keyboard_state->leds);
65 oled_advance_page(/*clearPageRemainder=*/false);
66 oled_advance_page(/*clearPageRemainder=*/false);
67 render_oled_wpm(keyboard_state->wpm);
68 render_oled_pet(/*col=*/0, /*line=*/12, keyboard_state);
69}
70#endif
diff --git a/layouts/community/split_3x6_3/bcat/readme.md b/layouts/community/split_3x6_3/bcat/readme.md
index c4bf891c4..b7b5d3de7 100644
--- a/layouts/community/split_3x6_3/bcat/readme.md
+++ b/layouts/community/split_3x6_3/bcat/readme.md
@@ -117,7 +117,7 @@ better location.
117 117
118## Adjust layer 118## Adjust layer
119 119
120![Adjust layer layout](https://i.imgur.com/fZouko5.png) 120![Adjust layer layout](https://i.imgur.com/Q4rN6cQ.png)
121 121
122([KLE](http://www.keyboard-layout-editor.com/#/gists/77e7572e077b36a23eb2086017e16fee)) 122([KLE](http://www.keyboard-layout-editor.com/#/gists/77e7572e077b36a23eb2086017e16fee))
123 123
diff --git a/layouts/community/split_3x6_3/bcat/rules.mk b/layouts/community/split_3x6_3/bcat/rules.mk
index 5ee614b19..29e52b92d 100644
--- a/layouts/community/split_3x6_3/bcat/rules.mk
+++ b/layouts/community/split_3x6_3/bcat/rules.mk
@@ -1,5 +1,9 @@
1BCAT_OLED_PET = luna
2
1ifeq ($(strip $(KEYBOARD)), crkbd/rev1) 3ifeq ($(strip $(KEYBOARD)), crkbd/rev1)
2 BOOTLOADER = atmel-dfu # Elite-C 4 BOOTLOADER = atmel-dfu # Elite-C
3 5
6 OLED_ENABLE = yes # dual 128x32 OLED screens
7 OLED_DRIVER = SSD1306
4 RGB_MATRIX_ENABLE = yes # per-key RGB and underglow 8 RGB_MATRIX_ENABLE = yes # per-key RGB and underglow
5endif 9endif
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. */
21const uint8_t RGBLED_GRADIENT_RANGES[] PROGMEM = {255, 127, 63, 31, 15};
22#endif
23 20
24static int8_t alt_tab_layer = -1; 21static 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
28bool process_record_user(uint16_t keycode, keyrecord_t *record) { 26bool 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
52layer_state_t layer_state_set_user(layer_state_t state) { 51layer_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. */
24enum 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. */
21enum user_keycode { 41enum 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)
30static 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
38bool 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
86void 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
108void 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
120void 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)
141void 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
153static 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
165void 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 */
27typedef 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. */
36void render_oled_layers(void);
37
38/* Renders LED indicators (Num/Caps/Scroll Lock) at the cursor. Occupies 5x3
39 * character cells.
40 */
41void render_oled_indicators(led_t leds);
42
43/* Renders calculated WPM count at the cursor. Occupies 5x2 character cells. */
44void 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 */
54void 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 */
32typedef 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 */
38uint16_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 */
45uint8_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 */
51bool oled_pet_can_jump(void);
52
53/* Returns the delay before the next animation frame should be displayed. */
54uint16_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. */
57oled_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 */
67void 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 */
73const 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
45uint16_t oled_pet_frame_bytes(void) { return FRAME_BYTES; }
46uint8_t oled_pet_frame_lines(void) { return 9 /* (72 pixel) / (8 pixel/line) */; }
47bool oled_pet_can_jump(void) { return false; }
48
49uint16_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
60oled_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
65void 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
84const 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
40enum image {
41 IMAGE_IDLE,
42 IMAGE_WALK,
43 IMAGE_RUN,
44 IMAGE_SNEAK,
45 IMAGE_BARK,
46};
47
48typedef 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
59uint16_t oled_pet_frame_bytes(void) { return FRAME_BYTES; }
60uint8_t oled_pet_frame_lines(void) { return 3 /* (24 pixel) / (8 pixel/line) */; }
61bool oled_pet_can_jump(void) { return true; }
62
63uint16_t oled_pet_update_millis(const oled_keyboard_state_t *keyboard_state) { return 200; }
64
65oled_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
82void oled_pet_post_render(uint8_t col, uint8_t line, const oled_keyboard_state_t *keyboard_state, bool redraw) {}
83
84const 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. */
22const 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
3set -o errexit -o nounset
4
5usage () {
6 printf "\
7usage: ./users/bcat/compile.sh [-c] [-j N]
8
9Compiles all keyboards for which bcat maintains keymaps.
10
11optional arguments:
12 -c performs a clean build
13 -j N runs N make tasks in parallel
14 -v shows verbose output
15"
16}
17
18compile () {
19 local keyboard=$1 layout=${2:-}
20 FORCE_LAYOUT="$layout" SILENT="$opt_silent" make -j "$opt_parallel" "$keyboard":bcat
21}
22
23opt_parallel=1
24opt_silent=true
25
26while 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
34done
35
36if [[ -n ${opt_clean:-} ]]; then
37 SILENT="$opt_silent" make clean
38fi
39
40compile 9key
41compile ai03/polaris 60_tsangan_hhkb
42compile cannonkeys/an_c 60_tsangan_hhkb
43compile cannonkeys/instant60 60_tsangan_hhkb
44compile crkbd/rev1 split_3x6_3
45compile dz60 60_ansi_split_bs_rshift
46compile dz60 60_tsangan_hhkb
47compile eco/rev2
48compile kbdfans/kbd67/hotswap 65_ansi_blocker_split_bs
49compile keebio/bdn9/rev1
50compile keebio/quefrency/rev1
51compile 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
6my keymaps from two canonical ones (preferred for typing and gaming, 6my keymaps from two canonical ones (preferred for typing and gaming,
7respectively). 7respectively).
8 8
9You 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 @@
1SRC += 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. 3ifneq ($(filter $(strip $(KEYBOARD)),ai03/polaris dz60 kbdfans/kbd67/hotswap),)
4BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite 4 BOOTMAGIC_ENABLE = yes
5else
6 BOOTMAGIC_ENABLE = no
7endif
5 8
6# Enable media keys on all keyboards. 9# Enable media keys on all keyboards.
7EXTRAKEY_ENABLE = yes 10EXTRAKEY_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.
17LTO_ENABLE = yes 20LTO_ENABLE = yes
18 21
19# Disable unused build options on all keyboards. 22# Include common utilities shared across all our keymaps.
23SRC += bcat.c
24
25# Include additional utilities that extend optional QMK features only enabled
26# on some keyboards.
27ifeq ($(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
38endif
39
40ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
41 SRC += bcat_rgblight.c
42endif
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.)
20COMMAND_ENABLE = no 47COMMAND_ENABLE = no
21CONSOLE_ENABLE = no 48CONSOLE_ENABLE = no
22MOUSEKEY_ENABLE = no 49MOUSEKEY_ENABLE = no
23TERMINAL_ENABLE = no 50TERMINAL_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.)
26MIDI_ENABLE = no 54MIDI_ENABLE = no
27SLEEP_LED_ENABLE = no 55SLEEP_LED_ENABLE = no
28 56
29# Disable other unused options on all keyboards. 57# Disable other unused options on all keyboards.
30AUTO_SHIFT_ENABLE = no 58AUTO_SHIFT_ENABLE = no
31COMBO_ENABLE = no 59COMBO_ENABLE = no
60GRAVE_ESC_ENABLE = no
32KEY_LOCK_ENABLE = no 61KEY_LOCK_ENABLE = no
33LEADER_ENABLE = no 62LEADER_ENABLE = no
63MAGIC_ENABLE = no
64SPACE_CADET_ENABLE = no
34SWAP_HANDS_ENABLE = no 65SWAP_HANDS_ENABLE = no
35TAP_DANCE_ENABLE = no 66TAP_DANCE_ENABLE = no
36UCIS_ENABLE = no 67UCIS_ENABLE = no