Ver Fonte

[Keymap] Drashna's Improve OLEDs and custom Split code (#14063)

* Fill the oleds with right mods

* Enable double mods on x32 oleds

* Disable forced NKRO

* Make oleds fancy only on good MCUs

* Overhaul oled display

* Further enhance oled, with kitty!

* Final oled form

* Not working transport

* Transport id of woring

* Add acceleration

* fix button placement for accel macro

* Fix accelartion location and behavior

* Remove OLED sync code

* Fix alignment issue

* Remove audio hack

* Fix up zima keymap

* Add matrix slave scan function and cleanup drashna.h

* Clean up user space

* Allow userspace sync to be disable-able

* Fix weird issue with audio

* Fix alignment issue with user split sync

* Disable second rgb matrix task

* Disable additional animations

* Change dynamic keymap settings

* Hacky fix for borked corne

* Add Blackpill (F411) support to tractyl manuform

* remove manual via eeprom reset

* Remove all references to rgblight twinkle

* Fix issues with config processing
Drashna Jaelre há 3 anos atrás
pai
commit
58a5030661
42 ficheiros alterados com 936 adições e 521 exclusões
  1. 5 0
      keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.h
  2. 7 44
      keyboards/handwired/tractyl_manuform/5x6_right/config.h
  3. 38 0
      keyboards/handwired/tractyl_manuform/5x6_right/f411/chconf.h
  4. 98 0
      keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h
  5. 26 0
      keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.c
  6. 19 0
      keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.h
  7. 25 0
      keyboards/handwired/tractyl_manuform/5x6_right/f411/halconf.h
  8. 34 0
      keyboards/handwired/tractyl_manuform/5x6_right/f411/mcuconf.h
  9. 13 0
      keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk
  10. 152 10
      keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c
  11. 2 6
      keyboards/handwired/tractyl_manuform/5x6_right/rules.mk
  12. 50 0
      keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/config.h
  13. 5 0
      keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/rules.mk
  14. 19 0
      keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/teensy2pp.h
  15. 58 71
      keyboards/handwired/tractyl_manuform/tm_sync.c
  16. 30 48
      keyboards/handwired/tractyl_manuform/tractyl_manuform.c
  17. 12 10
      keyboards/handwired/tractyl_manuform/tractyl_manuform.h
  18. 0 1
      keyboards/keebio/iris/keymaps/drashna/rules.mk
  19. 0 1
      keyboards/keebio/viterbi/keymaps/drashna/rules.mk
  20. 0 1
      keyboards/orthodox/keymaps/drashna/rules.mk
  21. 2 0
      keyboards/splitkb/zima/keymaps/drashna/config.h
  22. 28 8
      keyboards/splitkb/zima/keymaps/drashna/keymap.c
  23. 0 1
      layouts/community/ergodox/drashna/rules.mk
  24. 2 0
      layouts/community/numpad_5x6/drashna/config.h
  25. 0 1
      layouts/community/numpad_5x6/drashna/rules.mk
  26. 1 0
      layouts/community/ortho_4x12/drashna/config.h
  27. 0 2
      layouts/community/ortho_4x12/drashna/rules.mk
  28. 0 1
      layouts/community/ortho_5x12/drashna/rules.mk
  29. 7 7
      layouts/community/split_3x6_3/drashna/keymap.c
  30. 33 24
      users/drashna/config.h
  31. 59 36
      users/drashna/drashna.c
  32. 3 4
      users/drashna/drashna.h
  33. 58 43
      users/drashna/oled_stuff.c
  34. 13 0
      users/drashna/oled_stuff.h
  35. 40 0
      users/drashna/post_config.h
  36. 7 5
      users/drashna/process_records.c
  37. 1 0
      users/drashna/process_records.h
  38. 0 5
      users/drashna/rgb_matrix_stuff.c
  39. 20 115
      users/drashna/rgb_stuff.c
  40. 0 13
      users/drashna/rgb_stuff.h
  41. 6 5
      users/drashna/rules.mk
  42. 63 59
      users/drashna/transport_sync.c

+ 5 - 0
keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.h

@@ -17,6 +17,11 @@
 #pragma once
 
 #include "tractyl_manuform.h"
+#if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right_f411)
+#    include "f411.h"
+#elif defined(KEYBOARD_handwired_tractyl_manuform_5x6_right_teensy2pp)
+#    include "teensy2pp.h"
+#endif
 #include "quantum.h"
 
 #define ___ KC_NO

+ 7 - 44
keyboards/handwired/tractyl_manuform/5x6_right/config.h

@@ -20,39 +20,15 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 #include "config_common.h"
 
-#define PRODUCT_ID  0x3536
-#define DEVICE_VER  0x0001
-#define PRODUCT     Tractyl Manuform(5x6)
+#define PRODUCT_ID                  0x3536
+#define DEVICE_VER                  0x0001
 
 /* key matrix size */
 // Rows are doubled-up
-#define MATRIX_ROWS 12
-#define MATRIX_COLS 6
+#define MATRIX_ROWS                 12
+#define MATRIX_COLS                 6
 
-// wiring of each half
-#define MATRIX_COL_PINS \
-    { C0, C1, C2, C3, C4, C5 }
-#define MATRIX_ROW_PINS \
-    { F7, F6, F5, F4, F3, F2 }
-
-#define DIODE_DIRECTION COL2ROW
-
-// WS2812 RGB LED strip input and number of LEDs
-#define RGB_DI_PIN      E7
-#define RGBLED_NUM      20
-#define RGBLIGHT_SPLIT
-#define RGBLED_SPLIT \
-    { 10, 10 }
-#define RGBLIGHT_SLEEP
-// #define RGBW
-#define RGBLIGHT_LIMIT_VAL          100
-/* define if matrix has ghost */
-//#define MATRIX_HAS_GHOST
-
-/* number of backlight levels */
-// #define BACKLIGHT_LEVELS 3
-
-#define DEBUG_LED_PIN               D6
+#define DIODE_DIRECTION             COL2ROW
 
 #define ROTATIONAL_TRANSFORM_ANGLE  -25
 
@@ -62,24 +38,11 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define BOOTMAGIC_LITE_ROW_RIGHT    6
 #define BOOTMAGIC_LITE_COLUMN_RIGHT 5
 
-#define AUDIO_PIN                   C6
-#define AUDIO_PIN_ALT               B7
-
 #define DYNAMIC_KEYMAP_LAYER_COUNT  16
 #define LAYER_STATE_16BIT
 
-/* serial.c configuration for split keyboard */
-#define SOFT_SERIAL_PIN D2
-#define EE_HANDS
-
-#define ENCODERS_PAD_A \
-    { D5 }
-#define ENCODERS_PAD_B \
-    { D4 }
-#define ENCODER_RESOLUTION 4
-
 /* Set 0 if debouncing isn't needed */
-#define DEBOUNCE           5
+#define DEBOUNCE 5
 
 /* disable action features */
 //#define NO_ACTION_LAYER
@@ -89,7 +52,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define NO_ACTION_FUNCTION
 
 #define SERIAL_USE_MULTI_TRANSACTION
-#define SPLIT_TRANSACTION_IDS_KB RPC_ID_STATE_SYNC, RPC_ID_SLAVE_STATE
+#define SPLIT_TRANSACTION_IDS_KB RPC_ID_KB_CONFIG_SYNC, RPC_ID_POINTER_STATE_SYNC
 
 /* PMW3360 Settings */
 #define PMW3360_CS_PIN           B0

+ 38 - 0
keyboards/handwired/tractyl_manuform/5x6_right/f411/chconf.h

@@ -0,0 +1,38 @@
+/* Copyright 2020 QMK
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * This file was auto-generated by:
+ *    `qmk chibios-confmigrate -i keyboards/handwired/onekey/blackpill_f411/chconf.h -r platforms/chibios/common/configs/chconf.h`
+ */
+
+#pragma once
+
+#define CH_CFG_ST_FREQUENCY 10000
+
+#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE
+
+#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
+
+#define CH_CFG_FACTORY_SEMAPHORES TRUE
+
+#define CH_CFG_FACTORY_MAILBOXES TRUE
+
+#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
+
+#define CH_CFG_FACTORY_PIPES TRUE
+
+#include_next <chconf.h>

+ 98 - 0
keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h

@@ -0,0 +1,98 @@
+/*
+Copyright 2012 Jun Wako <wakojun@gmail.com>
+Copyright 2015 Jack Humbert
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#pragma once
+
+#define PRODUCT Tractyl Manuform(5x6) BlackPill
+
+// wiring of each half
+#define MATRIX_COL_PINS \
+    { A15, B3, B4, B5, B6, B7 }
+#define MATRIX_ROW_PINS \
+    { B12, B13, B14, B15, A8, A9 }
+
+#define DIODE_DIRECTION     COL2ROW
+
+#define USB_VBUS_PIN        B10
+#define SPLIT_HAND_PIN      C14  // high = left, low = right
+
+// WS2812 RGB LED strip input and number of LEDs
+#define RGB_DI_PIN          A1
+#define WS2812_PWM_DRIVER   PWMD5  // default: PWMD2
+#define WS2812_PWM_CHANNEL  2      // default: 2
+#define WS2812_PWM_PAL_MODE 2      // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 2
+//#define WS2812_PWM_COMPLEMENTARY_OUTPUT // Define for a complementary timer output (TIMx_CHyN); omit for a normal timer output (TIMx_CHy).
+#define WS2812_DMA_STREAM   STM32_DMA1_STREAM0  // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
+#define WS2812_DMA_CHANNEL  6                   // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
+
+#define RGBLED_NUM          20
+#define RGBLIGHT_SPLIT
+#define RGBLED_SPLIT \
+    { 10, 10 }
+
+#define DEBUG_LED_PIN     C13
+
+#define AUDIO_PIN         A0
+#define AUDIO_PWM_DRIVER  PWMD5
+#define AUDIO_PWM_CHANNEL 1
+#define AUDIO_STATE_TIMER GPTD4
+
+/* serial.c configuration for split keyboard */
+#define SERIAL_USART_FULL_DUPLEX  // Enable full duplex operation mode.
+#define SERIAL_USART_TX_PIN      A2
+#define SERIAL_USART_RX_PIN      A3
+#define SERIAL_USART_DRIVER      SD2
+#define SERIAL_USART_TX_PAL_MODE 7    // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7
+#define SERIAL_USART_RX_PAL_MODE 7    // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7
+#define SERIAL_USART_TIMEOUT     100  // USART driver timeout. default 100
+#undef SOFT_SERIAL_PIN
+
+// #define EE_HANDS
+
+#define I2C_DRIVER        I2CD1
+#define I2C1_SCL_BANK     GPIOB
+#define I2C1_SDA_BANK     GPIOB
+#define I2C1_SCL          8
+#define I2C1_SDA          9
+#define I2C1_SCL_PAL_MODE 4
+#define I2C1_SDA_PAL_MODE 4
+#define I2C1_CLOCK_SPEED  400000
+
+#define ENCODERS_PAD_A \
+    { B1 }
+#define ENCODERS_PAD_B \
+    { B2 }
+
+#define SPI_DRIVER                           SPID1
+#define SPI_SCK_PIN                          A5
+#define SPI_SCK_PAL_MODE                     5
+#define SPI_MOSI_PIN                         A7
+#define SPI_MOSI_PAL_MODE                    5
+#define SPI_MISO_PIN                         A6
+#define SPI_MISO_PAL_MODE                    5
+
+#define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A4
+// #define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR    64
+// #define EXTERNAL_EEPROM_BYTE_COUNT           8196
+// #define EXTERNAL_EEPROM_PAGE_SIZE            32
+// #define EXTERNAL_EEPROM_ADDRESS_SIZE         2
+#define DEBUG_EEPROM_OUTPUT
+
+#define PMW_CS_PIN  B0
+#define SPI_MODE    0
+#define SPI_DIVISOR 64

+ 26 - 0
keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.c

@@ -0,0 +1,26 @@
+/* Copyright 2020 Christopher Courtney, aka Drashna Jael're  (@drashna) <drashna@live.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "f411.h"
+
+void matrix_init_sub_kb(void) { setPinInputHigh(A0); }
+
+void matrix_scan_sub_kb(void) {
+    if (!readPin(A0)) {
+        reset_keyboard();
+    }
+    matrix_scan_user();
+}

+ 19 - 0
keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.h

@@ -0,0 +1,19 @@
+/* Copyright 2020 Christopher Courtney, aka Drashna Jael're  (@drashna) <drashna@live.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include "5x6_right.h"

+ 25 - 0
keyboards/handwired/tractyl_manuform/5x6_right/f411/halconf.h

@@ -0,0 +1,25 @@
+/* Copyright 2020 Nick Brassel (tzarc)
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+#pragma once
+
+// #define HAL_USE_DAC TRUE
+#define HAL_USE_PWM    TRUE
+#define HAL_USE_SERIAL TRUE
+#define HAL_USE_I2C    TRUE
+#define HAL_USE_SPI    TRUE
+#define HAL_USE_GPT    TRUE
+
+#include_next <halconf.h>

+ 34 - 0
keyboards/handwired/tractyl_manuform/5x6_right/f411/mcuconf.h

@@ -0,0 +1,34 @@
+/* Copyright 2020 Nick Brassel (tzarc)
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include_next "mcuconf.h"
+
+#undef STM32_I2C_USE_I2C1
+#define STM32_I2C_USE_I2C1 TRUE
+
+#undef STM32_PWM_USE_TIM5
+#define STM32_PWM_USE_TIM5 TRUE
+
+#undef STM32_GPT_USE_TIM4
+#define STM32_GPT_USE_TIM4 TRUE
+
+#undef STM32_SPI_USE_SPI1
+#define STM32_SPI_USE_SPI1 TRUE
+
+#undef STM32_SERIAL_USE_USART2
+#define STM32_SERIAL_USE_USART2 TRUE

+ 13 - 0
keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk

@@ -0,0 +1,13 @@
+# MCU name
+MCU = STM32F411
+
+# Bootloader selection
+BOOTLOADER = stm32-dfu
+
+KEYBOARD_SHARED_EP = yes
+CONSOLE_ENABLE     = yes
+
+EEPROM_DRIVER = spi
+WS2812_DRIVER = pwm
+SERIAL_DRIVER = usart
+AUDIO_DRIVER  = pwm_hardware

+ 152 - 10
keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c

@@ -16,6 +16,11 @@
 
 #include "drashna.h"
 
+enum tractyl_keycodes {
+    KC_ACCEL = NEW_SAFE_RANGE,
+};
+
+bool enable_acceleration = false;
 // clang-format off
 #define LAYOUT_5x6_right_wrapper(...) LAYOUT_5x6_right(__VA_ARGS__)
 #define LAYOUT_5x6_right_base( \
@@ -66,7 +71,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
         _______, _______, _______, _______, _______, _______,                        KC_BTN7, KC_BTN4, KC_BTN5, KC_BTN8, _______, _______,
                           _______, _______,                                                            _______, _______,
                                             _______, _______,                                 KC_BTN3,
-                                                     _______, _______,               _______,
+                                                     KC_ACCEL, _______,               _______,
                                                      _______, _______,      _______, _______
     ),
     [_GAMEPAD] = LAYOUT_5x6_right(
@@ -164,13 +169,17 @@ bool            tap_toggling          = false;
 #        define TAP_CHECK TAPPING_TERM
 #    endif
 
-void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) {
+void process_mouse_user(report_mouse_t* mouse_report, int8_t x, int8_t y) {
     if (x != 0 && y != 0) {
         mouse_timer = timer_read();
 #    ifdef OLED_DRIVER_ENABLE
         oled_timer = timer_read32();
 #    endif
         if (timer_elapsed(mouse_debounce_timer) > TAP_CHECK) {
+            if (enable_acceleration) {
+                x = (x > 0 ? x * x / 16 + x : -x * x / 16 + x);
+                y = (y > 0 ? y * y / 16 + y : -y * y / 16 + y);
+            }
             mouse_report->x = x;
             mouse_report->y = y;
             if (!layer_state_is(_MOUSE)) {
@@ -222,6 +231,8 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t* record) {
         case KC_MS_UP ... KC_MS_WH_RIGHT:
             record->event.pressed ? mouse_keycode_tracker++ : mouse_keycode_tracker--;
             mouse_timer = timer_read();
+        case KC_ACCEL:
+            enable_acceleration = record->event.pressed;
             break;
         default:
             if (IS_NOEVENT(record->event)) break;
@@ -248,15 +259,146 @@ layer_state_t layer_state_set_keymap(layer_state_t state) {
 }
 #endif
 
-void matrix_init_keymap(void) {
-#ifdef AUDIO_ENABLE
-    extern audio_config_t audio_config;
+#ifdef OLED_DRIVER_ENABLE
+// WPM-responsive animation stuff here
+#    define SLEEP_FRAMES 2
+#    define SLEEP_SPEED  10  // below this wpm value your animation will idle
+
+#    define WAKE_FRAMES  2  // uncomment if >1
+
+#    define KAKI_FRAMES  3
+#    define KAKI_SPEED   40  // above this wpm value typing animation to triggere
+
+#    define RTOGI_FRAMES 2
+//#define LTOGI_FRAMES 2
 
-    if (!is_keyboard_master()) {
-        audio_stop_all();
-        audio_config.enable = false;
+//#define ANIM_FRAME_DURATION 500 // how long each frame lasts in ms
+// #define SLEEP_TIMER 60000 // should sleep after this period of 0 wpm, needs fixing
+#    define ANIM_SIZE    512  // number of bytes in array, minimize for adequate firmware size, max is 1024
+
+uint32_t anim_timer          = 0;
+uint32_t anim_frame_duration = 500;
+uint8_t  current_sleep_frame = 0;
+uint8_t  current_wake_frame  = 0;  // uncomment if WAKE_FRAMES >1
+uint8_t  current_kaki_frame  = 0;
+uint8_t  current_rtogi_frame = 0;
+// uint8_t current_ltogi_frame = 0;
+
+void render_kitty(void) {
+    // Images credit j-inc(/James Incandenza) and pixelbenny. Credit to obosob for initial animation approach.
+    static const char PROGMEM sleep[SLEEP_FRAMES][ANIM_SIZE] = {{
+                                                                    // 'sleep1', 128x32px
+                                                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xa8, 0x48, 0xa8, 0x18, 0x08, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x80, 0x44, 0x84, 0x06, 0x05, 0x04, 0x80, 0x40, 0x20, 0x10, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x18, 0x04, 0x04, 0x02, 0x7a, 0x86, 0x01, 0x80, 0x80, 0x01, 0x03, 0x05, 0x07, 0x01, 0x00, 0x00, 0x80, 0x83, 0x45, 0xfa, 0x3c, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x33, 0x24, 0x28, 0x28, 0x29, 0x29, 0x29, 0x3a, 0x18, 0x1c, 0x39, 0x24, 0x24, 0x3a, 0x2d, 0x26, 0x31, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                                },
+                                                                {// 'sleep2', 128x32px
+                                                                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x3a, 0x2a, 0x26, 0x22, 0x80, 0xc0, 0x80, 0x00, 0x24, 0x34, 0x2c, 0xe4, 0x60, 0x10, 0x70, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x38, 0x04, 0x02, 0x02, 0x01, 0x79, 0x87, 0x01, 0x80, 0x81, 0x83, 0x05, 0x05, 0x03, 0x01, 0x00, 0x00, 0x80, 0x43, 0x05, 0xfa, 0x3c, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x33, 0x24, 0x28, 0x28, 0x28, 0x29, 0x29, 0x3a, 0x18, 0x1c, 0x39, 0x24, 0x24, 0x3a, 0x2d, 0x26, 0x31, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
+    static const char PROGMEM wake[WAKE_FRAMES][ANIM_SIZE]   = {{
+                                                                  // 'mati2', 128x32px
+                                                                  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x30, 0x08, 0x10, 0x60, 0x80, 0x00, 0x80, 0x60, 0x10, 0x08, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                                  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0x40, 0x40, 0x5c, 0x00, 0x01, 0x41, 0x01, 0x00, 0x5c, 0x40, 0x40, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x40, 0x80, 0xe1, 0x12, 0x0a, 0x06, 0x00, 0x80, 0x00, 0x06, 0x0a, 0x12, 0xe1, 0x80, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                                  0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x11, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1c, 0x14, 0x14, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                              },
+                                                              {// 'mati3', 128x32px
+                                                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x30, 0x08, 0x10, 0x60, 0x80, 0x00, 0x80, 0x60, 0x10, 0x08, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x90, 0x12, 0x0a, 0x02, 0xf4, 0x09, 0x0d, 0xf1, 0x04, 0x02, 0x0a, 0x12, 0x90, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x40, 0x80, 0xe1, 0x12, 0x0a, 0x06, 0x01, 0x81, 0x00, 0x06, 0x0a, 0x12, 0xe1, 0x80, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                               0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x11, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1c, 0x14, 0x14, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
+    static const char PROGMEM kaki[KAKI_FRAMES][ANIM_SIZE]   = {{
+                                                                  // 'jare2', 128x32px
+                                                                  0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x40, 0x80, 0x80, 0x80, 0x00, 0xfc, 0x84, 0x08, 0x08, 0x10, 0x20, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                                  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1e, 0x60, 0x80, 0x00, 0x00, 0x91, 0xa1, 0x80, 0x00, 0x00, 0x22, 0x84, 0x40, 0x50, 0x48, 0xc1, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x41, 0x82, 0xe2, 0x12, 0x0a, 0x06, 0x00, 0x80, 0x88, 0x4f, 0x02, 0x22, 0xe2, 0x9f, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                                  0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x14, 0x10, 0x10, 0x10, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1a, 0x0a, 0x0a, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                              },
+                                                              {
+                                                                  // 'kaki1', 128x32px
+                                                                  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                                  0x00, 0x00, 0x06, 0x1a, 0x22, 0xc2, 0x04, 0x04, 0x04, 0x07, 0x00, 0xc0, 0x20, 0x10, 0x80, 0x80, 0x01, 0x01, 0x02, 0xfc, 0xfe, 0x02, 0x3c, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                                  0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0d, 0x8d, 0x55, 0x50, 0x94, 0xf0, 0x10, 0x09, 0x08, 0x00, 0x80, 0x00, 0x06, 0x09, 0x1b, 0xee, 0x00, 0x00, 0x00, 0x00, 0x81, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                                  0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x19, 0x18, 0x1c, 0x14, 0x16, 0x15, 0x14, 0x14, 0x14, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                              },
+                                                              {// 'kaki2', 128x32px
+                                                               0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                               0x00, 0x00, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x01, 0x02, 0x04, 0x04, 0x03, 0x80, 0x40, 0x40, 0x20, 0x00, 0x01, 0x02, 0x8c, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                               0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0d, 0x8d, 0x55, 0x50, 0x94, 0xf0, 0x10, 0x0a, 0x0e, 0x1d, 0x95, 0x24, 0x24, 0x27, 0x13, 0xe1, 0x01, 0x01, 0x01, 0x01, 0x02, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                               0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x19, 0x18, 0x1c, 0x14, 0x14, 0x17, 0x14, 0x14, 0x14, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
+    static const char PROGMEM rtogi[KAKI_FRAMES][ANIM_SIZE]  = {{
+                                                                   // 'rtogi1', 128x32px
+                                                                   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x10, 0x10, 0x08, 0x04, 0x02, 0x01, 0x0f, 0x90, 0x10, 0x20, 0xf0, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                                   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x48, 0x47, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x88, 0xc7, 0xc4, 0x62, 0x23, 0x11, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x20, 0x10, 0x88, 0xcc, 0x43, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xc0, 0x80, 0x80, 0xc0, 0xe1, 0xfe, 0xb8, 0x88, 0x0c, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                                   0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x06, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 0x04, 0x07, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                               },
+                                                               {// 'rtogi2', 128x32px
+                                                                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x10, 0x10, 0x08, 0x04, 0x02, 0x01, 0x1f, 0xa0, 0x20, 0x40, 0x80, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x48, 0x47, 0x88, 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x28, 0x6b, 0x40, 0xa0, 0x99, 0x86, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                                0x0f, 0x11, 0x22, 0x44, 0x48, 0x4c, 0x43, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xc0, 0x80, 0x80, 0xc0, 0xe1, 0xfe, 0xb8, 0x88, 0x0c, 0x04, 0x06, 0x06, 0x06, 0x0e, 0x0e, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                                                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x06, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 0x04, 0x07, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
+
+    // assumes 1 frame prep stage
+    extern bool swap_hands;
+    void        animation_phase(void) {
+        if (swap_hands) {
+            anim_frame_duration = 300;
+            current_rtogi_frame = (current_rtogi_frame + 1) % RTOGI_FRAMES;
+            oled_write_raw_P(rtogi[abs((RTOGI_FRAMES - 1) - current_rtogi_frame)], ANIM_SIZE);
+        } else {
+            if (get_current_wpm() <= SLEEP_SPEED) {
+                anim_frame_duration = 500;
+                current_sleep_frame = (current_sleep_frame + 1) % SLEEP_FRAMES;
+                oled_write_raw_P(sleep[abs((SLEEP_FRAMES - 1) - current_sleep_frame)], ANIM_SIZE);
+            }
+            // if(get_current_wpm() >IDLE_SPEED && get_current_wpm() <TAP_SPEED){
+            if (get_current_wpm() > SLEEP_SPEED) {
+                anim_frame_duration = 800;
+                current_wake_frame  = (current_wake_frame + 1) % WAKE_FRAMES;
+                oled_write_raw_P(wake[abs((WAKE_FRAMES - 1) - current_wake_frame)], ANIM_SIZE);
+                // oled_write_raw_P(wake[0], ANIM_SIZE);  // remove if IDLE_FRAMES >1
+            }
+            if (get_current_wpm() >= KAKI_SPEED) {
+                anim_frame_duration = 500;
+                current_kaki_frame  = (current_kaki_frame + 1) % KAKI_FRAMES;
+                oled_write_raw_P(kaki[abs((KAKI_FRAMES - 1) - current_kaki_frame)], ANIM_SIZE);
+            }
+        }
+    }
+    if (get_current_wpm() != 000) {
+        // if(timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) {
+        if (timer_elapsed32(anim_timer) > anim_frame_duration) {
+            anim_timer = timer_read32();
+            animation_phase();
+        }
+    } else {
+        // if(timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) {
+        if (timer_elapsed32(anim_timer) > anim_frame_duration) {
+            anim_timer = timer_read32();
+            animation_phase();
+        }
     }
-#endif
 }
 
-void keyboard_post_init_keymap(void) { matrix_init_keymap(); }
+void oled_driver_render_logo_left(void) {
+    render_kitty();
+
+    oled_set_cursor(6, 0);
+    oled_write_P(PSTR("  Tractyl      "), true);
+    oled_set_cursor(6, 1);
+    oled_write_P(PSTR("     Manuform  "), true);
+    oled_set_cursor(6, 2);
+#    if defined(WPM_ENABLE)
+    render_wpm(1);
+#    endif
+    oled_set_cursor(6, 3);
+#    if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right)
+    render_pointing_dpi_status(0);
+#    endif
+    oled_set_cursor(0, 4);
+}
+#endif

+ 2 - 6
keyboards/handwired/tractyl_manuform/5x6_right/rules.mk

@@ -1,9 +1,3 @@
-# MCU name
-MCU = at90usb1286
-
-# Bootloader selection
-BOOTLOADER = halfkay
-
 # Build Options
 #   change yes to no to disable
 #
@@ -29,3 +23,5 @@ SPLIT_KEYBOARD = yes
 
 SRC += drivers/sensors/pmw3360.c
 QUANTUM_LIB_SRC += spi_master.c tm_sync.c
+
+DEFAULT_FOLDER = handwired/tractyl_manuform/5x6_right/teensy2pp

+ 50 - 0
keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/config.h

@@ -0,0 +1,50 @@
+/*
+Copyright 2012 Jun Wako <wakojun@gmail.com>
+Copyright 2015 Jack Humbert
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#pragma once
+
+#define PRODUCT Tractyl Manuform(5x6) Teensy 2.0 ++
+
+// wiring of each half
+#define MATRIX_COL_PINS \
+    { C0, C1, C2, C3, C4, C5 }
+#define MATRIX_ROW_PINS \
+    { F7, F6, F5, F4, F3, F2 }
+
+#define DIODE_DIRECTION COL2ROW
+
+// WS2812 RGB LED strip input and number of LEDs
+#define RGB_DI_PIN      E7
+#define RGBLED_NUM      20
+#define RGBLIGHT_SPLIT
+#define RGBLED_SPLIT \
+    { 10, 10 }
+
+#define DEBUG_LED_PIN   D6
+
+#define AUDIO_PIN       C6
+#define AUDIO_PIN_ALT   B7
+
+/* serial.c configuration for split keyboard */
+#define SOFT_SERIAL_PIN D2
+#define EE_HANDS
+
+#define ENCODERS_PAD_A \
+    { D5 }
+#define ENCODERS_PAD_B \
+    { D4 }

+ 5 - 0
keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/rules.mk

@@ -0,0 +1,5 @@
+# MCU name
+MCU = at90usb1286
+
+# Bootloader selection
+BOOTLOADER = halfkay

+ 19 - 0
keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/teensy2pp.h

@@ -0,0 +1,19 @@
+/* Copyright 2020 Christopher Courtney, aka Drashna Jael're  (@drashna) <drashna@live.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include "5x6_right.h"

+ 58 - 71
keyboards/handwired/tractyl_manuform/tm_sync.c

@@ -14,86 +14,59 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifdef SPLIT_TRANSACTION_IDS_KB
-
-#    include "tractyl_manuform.h"
-#    include "transactions.h"
-#    include <string.h>
-#    include "drivers/sensors/pmw3360.h"
-
-kb_runtime_config_t kb_state;
-kb_slave_data_t     kb_slave;
-
-void slave_state_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
-    if (target2initiator_buffer_size == sizeof(kb_slave)) {
-        memcpy(target2initiator_buffer, &kb_slave, sizeof(kb_slave));
-        if (kb_slave.mouse_x > 127) {
-            kb_slave.mouse_x -= 127;
-        } else if (kb_slave.mouse_x < -127) {
-            kb_slave.mouse_x += 127;
-        } else {
-            kb_slave.mouse_x = 0;
-        }
+#include "tractyl_manuform.h"
+#include "transactions.h"
+#include <string.h>
+#include "drivers/sensors/pmw3360.h"
 
-        if (kb_slave.mouse_y > 127) {
-            kb_slave.mouse_y -= 127;
-        } else if (kb_slave.mouse_y < -127) {
-            kb_slave.mouse_y += 127;
-        } else {
-            kb_slave.mouse_y = 0;
-        }
+kb_config_data_t  kb_config;
+kb_pointer_data_t kb_pointer;
+
+void kb_config_sync_handler(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
+    if (initiator2target_buffer_size == sizeof(kb_config)) {
+        memcpy(&kb_config, initiator2target_buffer, sizeof(kb_config));
     }
 }
-
-void pointer_state_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
-    if (initiator2target_buffer_size == sizeof(kb_state)) {
-        memcpy(&kb_state, initiator2target_buffer, sizeof(kb_state));
+void kb_pointer_sync_handler(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
+    if (target2initiator_buffer_size == sizeof(kb_pointer)) {
+        memcpy(target2initiator_buffer, &kb_pointer, sizeof(kb_pointer));
     }
 }
 
+void keyboard_pre_init_sync(void) {
+    memset(&kb_config, 0, sizeof(kb_config));
+    memset(&kb_pointer, 0, sizeof(kb_pointer));
+}
+
 void keyboard_post_init_kb(void) {
     // Register keyboard state sync split transaction
-    transaction_register_rpc(RPC_ID_STATE_SYNC, pointer_state_sync);
-    transaction_register_rpc(RPC_ID_SLAVE_STATE, slave_state_sync);
+    transaction_register_rpc(RPC_ID_KB_CONFIG_SYNC, kb_config_sync_handler);
+    transaction_register_rpc(RPC_ID_POINTER_STATE_SYNC, kb_pointer_sync_handler);
 
     keyboard_post_init_user();
 }
 
-void kb_state_update(void) {
-#    ifdef POINTING_DEVICE_ENABLE
+void kb_config_update(void) {
     if (is_keyboard_master()) {
         static uint16_t cpi = 0;
-        if (cpi != kb_state.device_cpi) {
-            cpi = kb_state.device_cpi;
+        if (cpi != kb_config.device_cpi) {
+            cpi = kb_config.device_cpi;
             pmw_set_cpi(cpi);
         }
     }
-#    endif
 }
 
-void kb_post_state_update(void) {
-#    ifdef POINTING_DEVICE_ENABLE
-    if (is_keyboard_master() && is_keyboard_left()) {
-        report_mouse_t temp_report = pointing_device_get_report();
-        temp_report.x              = kb_slave.mouse_x;
-        temp_report.y              = kb_slave.mouse_y;
-        pointing_device_set_report(temp_report);
-    }
-#    endif
-}
-
-void kb_state_sync(void) {
+void kb_config_sync(void) {
     if (is_keyboard_master()) {
         // Keep track of the last state, so that we can tell if we need to propagate to slave
-        static kb_runtime_config_t last_kb_state;
-        static uint32_t            last_sync        = 0;
-        static uint32_t            mouse_sync       = 0;
-        bool                       needs_sync       = false;
+        static kb_config_data_t last_kb_config;
+        static uint32_t         last_sync  = 0;
+        bool                    needs_sync = false;
 
         // Check if the state values are different
-        if (memcmp(&kb_state, &last_kb_state, sizeof(kb_runtime_config_t))) {
+        if (memcmp(&kb_config, &last_kb_config, sizeof(kb_config))) {
             needs_sync = true;
-            memcpy(&last_kb_state, &kb_state, sizeof(kb_runtime_config_t));
+            memcpy(&last_kb_config, &kb_config, sizeof(kb_config));
         }
         // Send to slave every 500ms regardless of state change
         if (timer_elapsed32(last_sync) > 500) {
@@ -102,31 +75,45 @@ void kb_state_sync(void) {
 
         // Perform the sync if requested
         if (needs_sync) {
-            if (transaction_rpc_send(RPC_ID_STATE_SYNC, sizeof(kb_runtime_config_t), &kb_state)) {
+            if (transaction_rpc_send(RPC_ID_KB_CONFIG_SYNC, sizeof(kb_config), &kb_config)) {
                 last_sync = timer_read32();
             }
         }
+    }
+}
 
-        if (is_keyboard_left()) {
-            if (timer_elapsed32(mouse_sync) >= 5) {
-                // always sync slave data, since it may contain device reports.
-                if (transaction_rpc_recv(RPC_ID_SLAVE_STATE, sizeof(kb_slave_data_t), &kb_slave)) {
-                    if (kb_slave.mouse_x >= -127 && kb_slave.mouse_x <= 127 && kb_slave.mouse_y >= -127 && kb_slave.mouse_y <= 127) {
-                        mouse_sync = timer_read32();
-                    }
-                }
+void kb_pointer_sync(void) {
+    if (is_keyboard_master() && is_keyboard_left()) {
+        // Keep track of the last state, so that we can tell if we need to propagate to slave
+        static uint32_t last_sync = 0;
+
+        // Perform the sync if requested
+        if (timer_elapsed32(last_sync) >= 5) {
+            if (transaction_rpc_recv(RPC_ID_POINTER_STATE_SYNC, sizeof(kb_pointer), &kb_pointer)) {
+                last_sync = timer_read32();
             }
         }
     }
 }
 
 void housekeeping_task_kb(void) {
-    // Update kb_state so we can send to slave
-    kb_state_update();
-
+    // Update kb_config so we can send to slave
+    kb_config_update();
     // Data sync from master to slave
-    kb_state_sync();
+    kb_config_sync();
+    kb_pointer_sync();
+}
+
+void kb_pointer_sync_send(int8_t x, int8_t y) {
+    kb_pointer.mouse_x = x;
+    kb_pointer.mouse_y = y;
+}
 
-    kb_post_state_update();
+kb_pointer_data_t kb_pointer_sync_get(void) { return (kb_pointer_data_t){.mouse_x = kb_pointer.mouse_x, .mouse_y = kb_pointer.mouse_y}; }
+
+void trackball_set_cpi(uint16_t cpi) {
+    kb_config.device_cpi = cpi;
+    if (!is_keyboard_left()) {
+        pmw_set_cpi(cpi);
+    }
 }
-#endif

+ 30 - 48
keyboards/handwired/tractyl_manuform/tractyl_manuform.c

@@ -30,9 +30,6 @@
 #    define TRACKBALL_DPI_DEFAULT 0
 #endif
 
-extern kb_runtime_config_t kb_state;
-extern kb_slave_data_t     kb_slave;
-
 keyboard_config_t keyboard_config;
 uint16_t          dpi_array[] = TRACKBALL_DPI_OPTIONS;
 #define DPI_OPTION_SIZE (sizeof(dpi_array) / sizeof(uint16_t))
@@ -40,18 +37,20 @@ uint16_t          dpi_array[] = TRACKBALL_DPI_OPTIONS;
 bool     BurstState  = false; // init burst state for Trackball module
 uint16_t MotionStart = 0;     // Timer for accel, 0 is resting state
 
-__attribute__((weak)) void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) {
+__attribute__((weak)) void process_mouse_user(report_mouse_t* mouse_report, int8_t x, int8_t y) {
     mouse_report->x = x;
     mouse_report->y = y;
 }
 
-__attribute__((weak)) void process_mouse(report_mouse_t* mouse_report) {
+__attribute__((weak)) kb_pointer_data_t process_mouse(void) {
+    kb_pointer_data_t temp_data = {.mouse_x = 0, .mouse_y = 0};
+
     report_pmw_t data = pmw_read_burst();
     if (data.isOnSurface && data.isMotion) {
         // Reset timer if stopped moving
         if (!data.isMotion) {
             if (MotionStart != 0) MotionStart = 0;
-            return;
+            return temp_data;
         }
 
         // Set timer if new motion
@@ -78,9 +77,10 @@ __attribute__((weak)) void process_mouse(report_mouse_t* mouse_report) {
         if (debug_mouse) dprintf("Cons] X: %d, Y: %d\n", data.dx, data.dy);
         // dprintf("Elapsed:%u, X: %f Y: %\n", i, pgm_read_byte(firmware_data+i));
 
-        mouse_report->x = -data.dx;
-        mouse_report->y = data.dy;
+        temp_data.mouse_x = -data.dx;
+        temp_data.mouse_y = data.dy;
     }
+    return temp_data;
 }
 
 bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
@@ -118,6 +118,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
 
     return true;
 }
+__attribute__((weak)) void keyboard_pre_init_sync(void) {}
 
 // Hardware Setup
 void keyboard_pre_init_kb(void) {
@@ -137,6 +138,7 @@ void keyboard_pre_init_kb(void) {
     writePin(DEBUG_LED_PIN, debug_enable);
 #endif
 
+    keyboard_pre_init_sync();
     keyboard_pre_init_user();
 }
 
@@ -149,11 +151,22 @@ void pointing_device_init(void) {
     trackball_set_cpi(dpi_array[keyboard_config.dpi_config]);
 }
 
-static bool has_report_changed(report_mouse_t new, report_mouse_t old) { return (new.buttons != old.buttons) || (new.x&& new.x != old.x) || (new.y&& new.y != old.y) || (new.h&& new.h != old.h) || (new.v&& new.v != old.v); }
-
 void pointing_device_task(void) {
     report_mouse_t mouse_report = pointing_device_get_report();
-    if (!is_keyboard_left()) { process_mouse(&mouse_report); }
+    kb_pointer_data_t data         = {.mouse_x = mouse_report.x, .mouse_y = mouse_report.y};
+    if (is_keyboard_left()) {
+        if (is_keyboard_master()) {
+            data = kb_pointer_sync_get();
+            process_mouse_user(&mouse_report, data.mouse_x, data.mouse_y);
+        }
+    } else {
+        data = process_mouse();
+        if (!is_keyboard_master()) {
+            kb_pointer_sync_send(data.mouse_x, data.mouse_y);
+        } else {
+            process_mouse_user(&mouse_report, data.mouse_x, data.mouse_y);
+        }
+    }
 
     pointing_device_set_report(mouse_report);
     pointing_device_send();
@@ -169,49 +182,18 @@ void eeconfig_init_kb(void) {
     eeconfig_init_user();
 }
 
+__attribute__((weak)) void matrix_init_sub_kb(void) {}
 void matrix_init_kb(void) {
     // is safe to just read DPI setting since matrix init
     // comes before pointing device init.
     keyboard_config.raw = eeconfig_read_kb();
     if (keyboard_config.dpi_config > DPI_OPTION_SIZE) { eeconfig_init_kb(); }
+    matrix_init_sub_kb();
     matrix_init_user();
 }
 
-#ifdef POINTING_DEVICE_ENABLE
-void pointing_device_send(void) {
-    static report_mouse_t old_report  = {};
-    report_mouse_t        mouseReport = pointing_device_get_report();
-    if (is_keyboard_master()) {
-        int8_t x = mouseReport.x, y = mouseReport.y;
-        mouseReport.x = 0;
-        mouseReport.y = 0;
-        process_mouse_user(&mouseReport, x, y);
-        if (has_report_changed(mouseReport, old_report)) { host_mouse_send(&mouseReport); }
-    } else {
-        master_mouse_send(mouseReport.x, mouseReport.y);
-    }
-    mouseReport.x = 0;
-    mouseReport.y = 0;
-    mouseReport.v = 0;
-    mouseReport.h = 0;
-    old_report    = mouseReport;
-    pointing_device_set_report(mouseReport);
+__attribute__((weak)) void matrix_scan_sub_kb(void) {}
+void                       matrix_scan_kb(void) {
+    matrix_scan_sub_kb();
+    matrix_scan_user();
 }
-#endif
-
-#ifdef POINTING_DEVICE_ENABLE
-void master_mouse_send(int8_t x, int8_t y) {
-#ifdef SPLIT_TRANSACTION_IDS_KB
-    kb_slave.mouse_x += x;
-    kb_slave.mouse_y += y;
-#endif
-}
-void trackball_set_cpi(uint16_t cpi) {
-#ifdef SPLIT_TRANSACTION_IDS_KB
-        kb_state.device_cpi = cpi;
-#endif
-    if (!is_keyboard_left()) {
-        pmw_set_cpi(cpi);
-    }
-}
-#endif

+ 12 - 10
keyboards/handwired/tractyl_manuform/tractyl_manuform.h

@@ -25,9 +25,6 @@
 #    include "4x6_right.h"
 #endif
 
-void process_mouse(report_mouse_t* mouse_report);
-void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y);
-
 typedef union {
     uint32_t raw;
     struct {
@@ -42,14 +39,19 @@ enum ploopy_keycodes {
     KEYMAP_SAFE_RANGE,
 };
 
-void master_mouse_send(int8_t x, int8_t y);
-void trackball_set_cpi(uint16_t cpi);
-
 typedef struct {
     uint16_t        device_cpi;
-} kb_runtime_config_t;
+} kb_config_data_t;
 
 typedef struct  {
-    int16_t mouse_x;
-    int16_t mouse_y;
-} kb_slave_data_t;
+    int8_t mouse_x;
+    int8_t mouse_y;
+} kb_pointer_data_t;
+
+kb_pointer_data_t process_mouse(void);
+void              process_mouse_user(report_mouse_t* mouse_report, int8_t x, int8_t y);
+void              kb_pointer_sync_send(int8_t x, int8_t y);
+kb_pointer_data_t kb_pointer_sync_get(void);
+void              trackball_set_cpi(uint16_t cpi);
+void              matrix_init_sub_kb(void);
+void              matrix_scan_sub_kb(void);

+ 0 - 1
keyboards/keebio/iris/keymaps/drashna/rules.mk

@@ -12,7 +12,6 @@ SWAP_HANDS_ENABLE = no
 SPACE_CADET_ENABLE = no
 
 INDICATOR_LIGHTS  = no
-RGBLIGHT_TWINKLE  = no
 RGBLIGHT_STARTUP_ANIMATION = no
 
 BOOTLOADER        = qmk-dfu

+ 0 - 1
keyboards/keebio/viterbi/keymaps/drashna/rules.mk

@@ -12,7 +12,6 @@ SPACE_CADET_ENABLE = no
 
 NO_SECRETS        = yes
 INDICATOR_LIGHTS  = no
-RGBLIGHT_TWINKLE  = no
 LAYOUTS = ortho_5x7
 
 # SRC := $(filter-out serial.c matrix.c i2c.c split_util.c,$(SRC))

+ 0 - 1
keyboards/orthodox/keymaps/drashna/rules.mk

@@ -10,7 +10,6 @@ NKRO_ENABLE       = yes
 SPACE_CADET_ENABLE = no
 
 INDICATOR_LIGHTS  = yes
-RGBLIGHT_TWINKLE  = no
 RGBLIGHT_STARTUP_ANIMATION = yes
 
 

+ 2 - 0
keyboards/splitkb/zima/keymaps/drashna/config.h

@@ -30,3 +30,5 @@
 // #    define OLED_LOGO_CORNE
 // #    define OLED_LOGO_GOTHAM
 #define OLED_LOGO_SCIFI
+
+#define ENCODER_RESOLUTION 2

+ 28 - 8
keyboards/splitkb/zima/keymaps/drashna/keymap.c

@@ -15,7 +15,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 #include QMK_KEYBOARD_H
-#include <stdio.h>
 
 #ifdef HAPTIC_ENABLE
 #    include "haptic.h"
@@ -90,15 +89,35 @@ void oled_task_user(void) {
         oled_scroll_off();
         oled_write_P(PSTR("SplitKB's Zima"), false);
         char layer[2] = {0};
-        snprintf(layer, sizeof(layer), "%d", get_highest_layer(layer_state));
+        uint8_t n        = get_highest_layer(layer_state);
+        layer[1]         = '\0';
+        layer[0]         = '0' + n % 10;
         oled_write_P(PSTR("   L:"), false);
         oled_write_ln(layer, false);
         oled_write_ln_P(PSTR("--------------"), false);
         if (rgblight_is_enabled()) {
             oled_write_P(PSTR("HSV: "), false);
-            char rgbs[14];
-            snprintf(rgbs, sizeof(rgbs), "%3d, %3d, %3d", rgblight_get_hue(), rgblight_get_sat(), rgblight_get_val());
-            oled_write_ln(rgbs, false);
+            char hsv_char[4];
+            n           = rgblight_get_hue();
+            hsv_char[3] = '\0';
+            hsv_char[2] = '0' + n % 10;
+            hsv_char[1] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
+            hsv_char[0] = n / 10 ? '0' + n / 10 : ' ';
+            oled_write(hsv_char, false);
+            oled_write_P(PSTR(", "), false);
+            n           = rgblight_get_sat();
+            hsv_char[3] = '\0';
+            hsv_char[2] = '0' + n % 10;
+            hsv_char[1] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
+            hsv_char[0] = n / 10 ? '0' + n / 10 : ' ';
+            oled_write(hsv_char, false);
+            oled_write_P(PSTR(", "), false);
+            n           = rgblight_get_val();
+            hsv_char[3] = '\0';
+            hsv_char[2] = '0' + n % 10;
+            hsv_char[1] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
+            hsv_char[0] = n / 10 ? '0' + n / 10 : ' ';
+            oled_write_ln(hsv_char, false);
         } else {
             oled_write_ln_P(PSTR("RGB LIGHT DISABLED"), false);
         }
@@ -125,10 +144,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) {
 }
 
 bool encoder_update_user(uint8_t index, bool clockwise) {
+    oled_timer = timer_read32();
     if (clockwise) {
-        tap_code16(KC_VOLU);
+        tap_code_delay(KC_VOLU, 10);
     } else {
-        tap_code16(KC_VOLD);
+        tap_code_delay(KC_VOLD, 10);
     }
-    return true;
+    return false;
 }

+ 0 - 1
layouts/community/ergodox/drashna/rules.mk

@@ -7,7 +7,6 @@ SPACE_CADET_ENABLE = no
 ifeq ($(strip $(KEYBOARD)), ergodox_ez)
     RGBLIGHT_ENABLE            = yes
     RGB_MATRIX_ENABLE          = yes
-    RGBLIGHT_TWINKLE           = no
     INDICATOR_LIGHTS           = no
     RGBLIGHT_STARTUP_ANIMATION = yes
     PIMORONI_TRACKBALL_ENABLE  = yes

+ 2 - 0
layouts/community/numpad_5x6/drashna/config.h

@@ -28,6 +28,8 @@
 #    define RGBLIGHT_EFFECT_SNAKE_LENGTH 2
 #endif  // RGBLIGHT_ENABLE
 
+#define RGBLIGHT_ALL_ANIMATIONS
+
 #if defined(KEYBOARD_primekb_prime_m)
 #    undef PRODUCT
 #    define PRODUCT Drashna Hacked Prime_M Macro Pad

+ 0 - 1
layouts/community/numpad_5x6/drashna/rules.mk

@@ -4,6 +4,5 @@ BACKLIGHT_ENABLE  = no
 NO_SECRETS        = yes
 BOOTMAGIC_ENABLE = lite     # Enable Bootmagic Lite
 INDICATOR_LIGHTS  = no
-RGBLIGHT_TWINKLE  = yes
 MAKE_BOOTLOADER   = yes
 RGBLIGHT_STARTUP_ANIMATION = yes

+ 1 - 0
layouts/community/ortho_4x12/drashna/config.h

@@ -75,6 +75,7 @@
 #        define PRODUCT Drashna Hacked Planck Rev6
 #    elif defined(KEYBOARD_planck_ez)
 #        define PRODUCT Drashna Hacked Planck EZ
+#        define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 4095
 #    endif
 #endif
 #undef NO_USB_STARTUP_CHECK

+ 0 - 2
layouts/community/ortho_4x12/drashna/rules.mk

@@ -11,7 +11,6 @@ ifneq ($(strip $(KEYBOARD)), planck/rev6)
     ifeq ($(strip $(LAYOUT_HAS_RGB)), yes)
         RGBLIGHT_ENABLE         = yes
         INDICATOR_LIGHTS            = yes
-        RGBLIGHT_TWINKLE            = yes
         RGBLIGHT_STARTUP_ANIMATION  = yes
     endif
 else
@@ -37,7 +36,6 @@ ifeq ($(strip $(KEYBOARD)), planck/ez)
     ENCODER_MAP_ENABLE          = yes
     RGB_MATRIX_ENABLE           = yes
     INDICATOR_LIGHTS            = yes
-    RGBLIGHT_TWINKLE            = yes
     RGBLIGHT_STARTUP_ANIMATION  = yes
     CONSOLE_ENABLE              = yes
     COMMAND_ENABLE              = yes

+ 0 - 1
layouts/community/ortho_5x12/drashna/rules.mk

@@ -12,7 +12,6 @@ ifeq ($(strip $(KEYBOARD)), fractal)
     AUDIO_SUPPORTED             = yes
     RGBLIGHT_SUPPORTED          = yes
     RGBLIGHT_ENABLE             = yes
-    RGBLIGHT_TWINKLE            = yes
     RGBLIGHT_STARTUP_ANIMATION  = yes
     BOOTLOADER                  = qmk-dfu
 endif

+ 7 - 7
layouts/community/split_3x6_3/drashna/keymap.c

@@ -26,6 +26,12 @@ enum crkbd_keycodes { RGBRST = NEW_SAFE_RANGE };
  * of use. K## is a placeholder to pass through the individual keycodes
  */
 
+#ifdef CONVERT_TO_PROTON_C
+#    define MID_TMB ET_RAIS
+#else
+#    define MID_TMB KC_ENT
+#endif
+
 // clang-format off
 #define LAYOUT_split_3x6_3_wrapper(...)      LAYOUT_split_3x6_3(__VA_ARGS__)
 #define LAYOUT_split_3x6_3_base( \
@@ -37,7 +43,7 @@ enum crkbd_keycodes { RGBRST = NEW_SAFE_RANGE };
     KC_ESC,  K01,    K02,     K03,      K04,     K05,                        K06,     K07,     K08,     K09,     K0A,     KC_MINS, \
     ALT_T(KC_TAB), K11,  K12, K13,      K14,     K15,                        K16,     K17,     K18,     K19,     K1A, RALT_T(K1B), \
     OS_LSFT, CTL_T(K21), K22, K23,      K24,     K25,                        K26,     K27,     K28,     K29, RCTL_T(K2A), OS_RSFT, \
-                                        OS_LGUI, KC_SPC,  BK_LWER, DL_RAIS,  KC_ENT,  OS_RGUI                                      \
+                                        OS_LGUI, KC_SPC,  BK_LWER, DL_RAIS,  MID_TMB,  OS_RGUI                                      \
   )
 #define LAYOUT_base_wrapper(...)       LAYOUT_split_3x6_3_base(__VA_ARGS__)
 
@@ -104,12 +110,6 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
 }
 #endif
 
-void matrix_slave_scan_user(void) {
-#ifdef RGB_MATRIX_ENABLE
-    rgb_matrix_task();
-#endif
-}
-
 #ifdef RGB_MATRIX_ENABLE
 void suspend_power_down_keymap(void) { rgb_matrix_set_suspend_state(true); }
 

+ 33 - 24
users/drashna/config.h

@@ -30,8 +30,15 @@
 #    ifdef WPM_ENABLE
 #        define SPLIT_WPM_ENABLE
 #    endif
-#    define SELECT_SOFT_SERIAL_SPEED   1
-#    define SPLIT_TRANSACTION_IDS_USER RPC_ID_USER_STATE_SYNC, RPC_ID_USER_KEYMAP_SYNC, RPC_ID_USER_CONFIG_SYNC
+#    ifdef OLED_DRIVER_ENABLE
+#        define SPLIT_OLED_ENABLE
+#    endif
+#    if defined(__AVR__) && !defined(SELECT_SOFT_SERIAL_SPEED)
+#        define SELECT_SOFT_SERIAL_SPEED 1
+#    endif
+#    ifdef CUSTOM_SPLIT_TRANSPORT_SYNC
+#        define SPLIT_TRANSACTION_IDS_USER RPC_ID_USER_STATE_SYNC, RPC_ID_USER_KEYMAP_SYNC, RPC_ID_USER_CONFIG_SYNC
+#    endif
 #endif
 
 #ifdef AUDIO_ENABLE
@@ -65,23 +72,6 @@
 
 #ifdef RGBLIGHT_ENABLE
 #    define RGBLIGHT_SLEEP
-#    undef RGBLIGHT_ANIMATIONS
-#    if defined(__AVR__) && !defined(__AVR_AT90USB1286__)
-#        define RGBLIGHT_EFFECT_BREATHING
-#        define RGBLIGHT_EFFECT_SNAKE
-#        define RGBLIGHT_EFFECT_KNIGHT
-#    else
-#        define RGBLIGHT_EFFECT_BREATHING
-#        define RGBLIGHT_EFFECT_RAINBOW_MOOD
-#        define RGBLIGHT_EFFECT_RAINBOW_SWIRL
-#        define RGBLIGHT_EFFECT_SNAKE
-#        define RGBLIGHT_EFFECT_KNIGHT
-// #        define RGBLIGHT_EFFECT_CHRISTMAS
-// #        define RGBLIGHT_EFFECT_STATIC_GRADIENT
-// #        define RGBLIGHT_EFFECT_RGB_TEST
-// #        define RGBLIGHT_EFFECT_ALTERNATING
-#        define RGBLIGHT_EFFECT_TWINKLE
-#    endif
 #    define RGBLIGHT_EFFECT_TWINKLE_LIFE        250
 #    define RGBLIGHT_EFFECT_TWINKLE_PROBABILITY 1 / 24
 #endif  // RGBLIGHT_ENABLE
@@ -107,8 +97,10 @@
 #        define DISABLE_RGB_MATRIX_CYCLE_ALL
 #        define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
 #        define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
-// #        define DISABLE_RGB_MATRIX_CYCLE_OUT_IN
+#        if defined(SPLIT_KEYBOARD) || defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_moonlander)
+#            define DISABLE_RGB_MATRIX_CYCLE_OUT_IN
 // #       define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
+#        endif
 #        define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
 #        define DISABLE_RGB_MATRIX_DUAL_BEACON
 #        define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL
@@ -117,6 +109,12 @@
 #        define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
 #        define DISABLE_RGB_MATRIX_RAINDROPS
 #        define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
+#        define DISABLE_RGB_MATRIX_HUE_BREATHING
+#        define DISABLE_RGB_MATRIX_HUE_PENDULUM
+#        define DISABLE_RGB_MATRIX_HUE_WAVE
+#        define DISABLE_RGB_MATRIX_PIXEL_RAIN
+#        define DISABLE_RGB_MATRIX_PIXEL_FLOW
+#        define DISABLE_RGB_MATRIX_PIXEL_FRACTAL
 // #       define DISABLE_RGB_MATRIX_TYPING_HEATMAP
 #        define DISABLE_RGB_MATRIX_DIGITAL_RAIN
 #        define DISABLE_RGB_MATRIX_SOLID_REACTIVE
@@ -132,7 +130,15 @@
 #        define DISABLE_RGB_MATRIX_SOLID_SPLASH
 #        define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
 #    endif  // AVR
-#endif      // RGB_MATRIX_ENABLE
+#    ifndef RGB_MATRIX_REST_MODE
+#        if defined(SPLIT_KEYBOARD) || defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_moonlander)
+#            define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN_DUAL
+#        else
+#            define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN
+#        endif
+#    endif
+#    define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_REST_MODE
+#endif  // RGB_MATRIX_ENABLE
 
 #ifdef OLED_DRIVER_ENABLE
 #    ifdef SPLIT_KEYBOARD
@@ -182,8 +188,6 @@
 #    define TAPPING_TERM_PER_KEY
 #endif
 
-#define FORCE_NKRO
-
 #ifndef TAPPING_TOGGLE
 #    define TAPPING_TOGGLE 1
 #endif
@@ -209,7 +213,12 @@
 #    undef LOCKING_RESYNC_ENABLE
 #endif
 
-#define LAYER_STATE_16BIT
+#if !defined(LAYER_STATE_16BIT) && !defined(LAYER_STATE_8BIT) && !defined(LAYER_STATE_32BIT)
+#    define LAYER_STATE_16BIT
+#endif
+#ifndef DYNAMIC_KEYMAP_LAYER_COUNT
+#    define DYNAMIC_KEYMAP_LAYER_COUNT 11
+#endif
 
 #ifdef CONVERT_TO_PROTON_C
 // pins that are available but not present on Pro Micro

+ 59 - 36
users/drashna/drashna.c

@@ -50,8 +50,7 @@ bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this
 }
 
 __attribute__((weak)) void keyboard_pre_init_keymap(void) {}
-
-void keyboard_pre_init_user(void) {
+void                       keyboard_pre_init_user(void) {
     userspace_config.raw = eeconfig_read_user();
     keyboard_pre_init_keymap();
 }
@@ -59,12 +58,11 @@ void keyboard_pre_init_user(void) {
 // This allows for a global, userspace functions, and continued
 // customization of the keymap.  Use _keymap instead of _user
 // functions in the keymaps
-__attribute__((weak)) void matrix_init_keymap(void) {}
-__attribute__((weak)) void matrix_init_secret(void) {}
-
 // Call user matrix init, set default RGB colors and then
 // call the keymap's init function
-void matrix_init_user(void) {
+__attribute__((weak)) void matrix_init_keymap(void) {}
+__attribute__((weak)) void matrix_init_secret(void) {}
+void                       matrix_init_user(void) {
 #if defined(BOOTLOADER_CATERINA) && defined(__AVR__)
     DDRD &= ~(1 << 5);
     PORTD &= ~(1 << 5);
@@ -75,11 +73,15 @@ void matrix_init_user(void) {
 
     matrix_init_secret();
     matrix_init_keymap();
+#if defined(AUDIO_ENABLE) && defined(SPLIT_KEYBOARD)
+    if (!is_keyboard_master()) {
+        stop_all_notes();
+    }
+#endif
 }
 
 __attribute__((weak)) void keyboard_post_init_keymap(void) {}
-
-void keyboard_post_init_user(void) {
+void                       keyboard_post_init_user(void) {
 #if defined(RGBLIGHT_ENABLE)
     keyboard_post_init_rgb_light();
 #endif
@@ -92,13 +94,12 @@ void keyboard_post_init_user(void) {
     keyboard_post_init_keymap();
 }
 
-__attribute__((weak)) void shutdown_keymap(void) {}
-
 #ifdef RGB_MATRIX_ENABLE
 void rgb_matrix_update_pwm_buffers(void);
 #endif
 
-void shutdown_user(void) {
+__attribute__((weak)) void shutdown_keymap(void) {}
+void                       shutdown_user(void) {
 #ifdef RGBLIGHT_ENABLE
     rgblight_enable_noeeprom();
     rgblight_mode_noeeprom(1);
@@ -113,8 +114,7 @@ void shutdown_user(void) {
 }
 
 __attribute__((weak)) void suspend_power_down_keymap(void) {}
-
-void suspend_power_down_user(void) {
+void                       suspend_power_down_user(void) {
 #ifdef OLED_DRIVER_ENABLE
     oled_off();
 #endif
@@ -122,8 +122,7 @@ void suspend_power_down_user(void) {
 }
 
 __attribute__((weak)) void suspend_wakeup_init_keymap(void) {}
-
-void suspend_wakeup_init_user(void) {
+void                       suspend_wakeup_init_user(void) {
     if (layer_state_is(_GAMEPAD)) {
         layer_off(_GAMEPAD);
     }
@@ -133,13 +132,11 @@ void suspend_wakeup_init_user(void) {
     suspend_wakeup_init_keymap();
 }
 
-__attribute__((weak)) void matrix_scan_keymap(void) {}
-
-__attribute__((weak)) void matrix_scan_secret(void) {}
-
 // No global matrix scan code, so just run keymap's matrix
 // scan function
-void matrix_scan_user(void) {
+__attribute__((weak)) void matrix_scan_keymap(void) {}
+__attribute__((weak)) void matrix_scan_secret(void) {}
+void                       matrix_scan_user(void) {
     static bool has_ran_yet;
     if (!has_ran_yet) {
         has_ran_yet = true;
@@ -166,11 +163,10 @@ void matrix_scan_user(void) {
 float doom_song[][2] = SONG(E1M1_DOOM);
 #endif
 
-__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; }
-
 // on layer change, no matter where the change was initiated
 // Then runs keymap's layer change check
-layer_state_t layer_state_set_user(layer_state_t state) {
+__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; }
+layer_state_t                       layer_state_set_user(layer_state_t state) {
     if (!is_keyboard_master()) {
         return state;
     }
@@ -194,10 +190,9 @@ layer_state_t layer_state_set_user(layer_state_t state) {
     return state;
 }
 
-__attribute__((weak)) layer_state_t default_layer_state_set_keymap(layer_state_t state) { return state; }
-
 // Runs state check and changes underglow color and animation
-layer_state_t default_layer_state_set_user(layer_state_t state) {
+__attribute__((weak)) layer_state_t default_layer_state_set_keymap(layer_state_t state) { return state; }
+layer_state_t                       default_layer_state_set_user(layer_state_t state) {
     if (!is_keyboard_master()) {
         return state;
     }
@@ -212,22 +207,14 @@ layer_state_t default_layer_state_set_user(layer_state_t state) {
 }
 
 __attribute__((weak)) void led_set_keymap(uint8_t usb_led) {}
-
-// Any custom LED code goes here.
-// So far, I only have keyboard specific code,
-// So nothing goes here.
-void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); }
+void                       led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); }
 
 __attribute__((weak)) void eeconfig_init_keymap(void) {}
-
-void eeconfig_init_user(void) {
+void                       eeconfig_init_user(void) {
     userspace_config.raw              = 0;
     userspace_config.rgb_layer_change = true;
     eeconfig_update_user(userspace_config.raw);
     eeconfig_init_keymap();
-#ifdef VIA_ENABLE
-    via_eeprom_reset();
-#endif
     keyboard_init();
 }
 
@@ -237,3 +224,39 @@ bool hasAllBitsInMask(uint8_t value, uint8_t mask) {
 
     return (value & mask) == mask;
 }
+
+#ifdef SPLIT_KEYBOARD
+#    if defined(AUDIO_ENABLE)
+bool delayed_tasks_run = false;
+#    endif
+__attribute__((weak)) void matrix_slave_scan_keymap(void) {}
+void                       matrix_slave_scan_user(void) {
+#    if defined(AUDIO_ENABLE)
+#        if !defined(NO_MUSIC_MODE)
+    music_task();
+#        endif
+    if (!is_keyboard_master()) {
+        static uint16_t delayed_task_timer = 0;
+        if (!delayed_tasks_run) {
+            if (!delayed_task_timer) {
+                delayed_task_timer = timer_read();
+            } else if (timer_elapsed(delayed_task_timer) > 300) {
+                audio_startup();
+                delayed_tasks_run = true;
+            }
+        }
+    }
+#    endif
+#    ifdef SEQUENCER_ENABLE
+    sequencer_task();
+#    endif
+#    ifdef LED_MATRIX_ENABLE
+    led_matrix_task();
+#    endif
+#    ifdef HAPTIC_ENABLE
+    haptic_task();
+#    endif
+
+    matrix_slave_scan_keymap();
+}
+#endif

+ 3 - 4
users/drashna/drashna.h

@@ -94,6 +94,9 @@ layer_state_t default_layer_state_set_keymap(layer_state_t state);
 void          led_set_keymap(uint8_t usb_led);
 void          eeconfig_init_keymap(void);
 bool          hasAllBitsInMask(uint8_t value, uint8_t mask);
+#ifdef SPLIT_KEYBOARD
+void matrix_slave_scan_keymap(void);
+#endif
 
 // clang-format off
 typedef union {
@@ -126,7 +129,3 @@ We use custom codes here, so we can substitute the right stuff
 #    define KC_D3_3 KC_3
 #    define KC_D3_4 KC_4
 #endif  // TAP_DANCE_ENABLE
-
-#if defined(DRASHNA_CUSTOM_TRANSPORT) && defined(POINTING_DEVICE_ENABLE)
-void master_mouse_send(int8_t x, int8_t y);
-#endif

+ 58 - 43
users/drashna/oled_stuff.c

@@ -18,7 +18,7 @@
 
 #ifndef KEYLOGGER_LENGTH
 // #    ifdef OLED_DISPLAY_128X64
-#    define KEYLOGGER_LENGTH ((int)(OLED_DISPLAY_HEIGHT / OLED_FONT_WIDTH))
+#    define KEYLOGGER_LENGTH ((uint8_t)(OLED_DISPLAY_HEIGHT / OLED_FONT_WIDTH))
 // #    else
 // #        define KEYLOGGER_LENGTH (uint8_t *(OLED_DISPLAY_WIDTH / OLED_FONT_HEIGHT))
 // #    endif
@@ -160,17 +160,21 @@ void render_matrix_scan_rate(void) {
 void render_mod_status(uint8_t modifiers) {
     static const char PROGMEM mod_status[5][3] = {{0xE8, 0xE9, 0}, {0xE4, 0xE5, 0}, {0xE6, 0xE7, 0}, {0xEA, 0xEB, 0}, {0xEC, 0xED, 0}};
     oled_write_P(PSTR(OLED_RENDER_MODS_NAME), false);
+#if defined(OLED_DISPLAY_128X64)
+    oled_write_P(mod_status[0], (modifiers & MOD_BIT(KC_LSHIFT)));
+    oled_write_P(mod_status[!keymap_config.swap_lctl_lgui ? 3 : 4], (modifiers & MOD_BIT(KC_LGUI)));
+    oled_write_P(mod_status[2], (modifiers & MOD_BIT(KC_LALT)));
+    oled_write_P(mod_status[1], (modifiers & MOD_BIT(KC_LCTL)));
+    oled_write_P(mod_status[1], (modifiers & MOD_BIT(KC_RCTL)));
+    oled_write_P(mod_status[2], (modifiers & MOD_BIT(KC_RALT)));
+    oled_write_P(mod_status[!keymap_config.swap_lctl_lgui ? 3 : 4], (modifiers & MOD_BIT(KC_RGUI)));
+    oled_write_P(mod_status[0], (modifiers & MOD_BIT(KC_RSHIFT)));
+#else
     oled_write_P(mod_status[0], (modifiers & MOD_MASK_SHIFT));
     oled_write_P(mod_status[!keymap_config.swap_lctl_lgui ? 3 : 4], (modifiers & MOD_MASK_GUI));
-#if !defined(OLED_DISPLAY_128X64)
     oled_write_P(PSTR(" "), false);
-#endif
     oled_write_P(mod_status[2], (modifiers & MOD_MASK_ALT));
     oled_write_P(mod_status[1], (modifiers & MOD_MASK_CTRL));
-
-    render_matrix_scan_rate();
-#if defined(OLED_DISPLAY_128X64)
-    oled_advance_page(true);
 #endif
 }
 
@@ -279,7 +283,7 @@ void render_user_status(void) {
 #endif
 }
 
-__attribute__((weak)) void oled_driver_render_logo(void) {
+void oled_driver_render_logo(void) {
     // clang-format off
     static const char PROGMEM qmk_logo[] = {
         0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
@@ -289,75 +293,86 @@ __attribute__((weak)) void oled_driver_render_logo(void) {
     oled_write_P(qmk_logo, false);
 }
 
-void render_wpm(void) {
+void render_wpm(uint8_t padding) {
 #ifdef WPM_ENABLE
     uint8_t n = get_current_wpm();
-#    ifdef OLED_DISPLAY_128X64
-    char wpm_counter[4];
+    char    wpm_counter[4];
     wpm_counter[3] = '\0';
     wpm_counter[2] = '0' + n % 10;
     wpm_counter[1] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
     wpm_counter[0] = n / 10 ? '0' + n / 10 : ' ';
-#    else
-    char wpm_counter[6];
-    wpm_counter[5] = '\0';
-    wpm_counter[4] = '0' + n % 10;
-    wpm_counter[3] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
-    wpm_counter[2] = n / 10 ? '0' + n / 10 : ' ';
-    wpm_counter[1] = ' ';
-    wpm_counter[0] = ' ';
-#    endif
     oled_write_P(PSTR(OLED_RENDER_WPM_COUNTER), false);
+    if (padding) {
+        for (uint8_t n = padding; n > 0; n--) {
+            oled_write_P(PSTR(" "), false);
+        }
+    }
     oled_write(wpm_counter, false);
 #endif
 }
 
 #if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right)
-
-extern kb_runtime_config_t kb_state;
-void render_pointing_dpi_status(void) {
-    char     dpi_status[6];
-    uint16_t n    = kb_state.device_cpi;
-    dpi_status[5] = '\0';
-    dpi_status[4] = '0' + n % 10;
-    dpi_status[3] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
+extern kb_config_data_t kb_config;
+void                    render_pointing_dpi_status(uint8_t padding) {
+    char     dpi_status[5];
+    uint16_t n    = kb_config.device_cpi;
+    dpi_status[4] = '\0';
+    dpi_status[3] = '0' + n % 10;
     dpi_status[2] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
-    dpi_status[1] = n / 10 ? '0' + n / 10 : ' ';
-    dpi_status[0] = ' ';
-    oled_write_P(PSTR("  DPI: "), false);
+    dpi_status[1] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
+    dpi_status[0] = n / 10 ? '0' + n / 10 : ' ';
+    oled_write_P(PSTR("DPI: "), false);
+    if (padding) {
+        for (uint8_t n = padding; n > 0; n--) {
+            oled_write_P(PSTR(" "), false);
+        }
+    }
     oled_write(dpi_status, false);
 }
 #endif
 
-void render_status_secondary(void) {
+__attribute__((weak)) void oled_driver_render_logo_right(void) {
 #if defined(OLED_DISPLAY_128X64)
     oled_driver_render_logo();
-#endif
-    /* Show Keyboard Layout  */
     render_default_layer_state();
-    render_layer_state();
-    render_mod_status(get_mods() | get_oneshot_mods());
-#if !defined(OLED_DISPLAY_128X64) && defined(WPM_ENABLE)
-    render_wpm();
+    oled_set_cursor(0, 4);
+#else
+    render_default_layer_state();
 #endif
-    // render_keylock_status(host_keyboard_leds());
 }
 
-void render_status_main(void) {
+__attribute__((weak)) void oled_driver_render_logo_left(void) {
 #if defined(OLED_DISPLAY_128X64)
     oled_driver_render_logo();
 #    ifdef DEBUG_MATRIX_SCAN_RATE
     render_matrix_scan_rate();
 #    elif defined(WPM_ENABLE)
-    render_wpm();
+    render_wpm(0);
 #    endif
+    oled_write_P(PSTR("  "), false);
 #    if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right)
-    render_pointing_dpi_status();
+    render_pointing_dpi_status(1);
 #    endif
-    oled_write_P(PSTR("\n"), false);
+    oled_set_cursor(0, 4);
 #else
     render_default_layer_state();
 #endif
+}
+
+void render_status_secondary(void) {
+    oled_driver_render_logo_right();
+    /* Show Keyboard Layout  */
+    render_layer_state();
+    render_mod_status(get_mods() | get_oneshot_mods());
+#if !defined(OLED_DISPLAY_128X64) && defined(WPM_ENABLE)
+    render_wpm(2);
+#endif
+    // render_keylock_status(host_keyboard_leds());
+}
+
+void render_status_main(void) {
+    oled_driver_render_logo_left();
+
     /* Show Keyboard Layout  */
     // render_keylock_status(host_keyboard_leds());
     render_bootmagic_status();

+ 13 - 0
users/drashna/oled_stuff.h

@@ -23,6 +23,19 @@ void            oled_driver_render_logo(void);
 bool            process_record_user_oled(uint16_t keycode, keyrecord_t *record);
 oled_rotation_t oled_init_keymap(oled_rotation_t rotation);
 extern uint32_t oled_timer;
+void            render_keylogger_status(void);
+void            render_default_layer_state(void);
+void            render_layer_state(void);
+void            render_keylock_status(uint8_t led_usb_state);
+void            render_matrix_scan_rate(void);
+void            render_mod_status(uint8_t modifiers);
+void            render_bootmagic_status(void);
+void            render_user_status(void);
+void            oled_driver_render_logo(void);
+void            render_wpm(uint8_t padding);
+void            render_pointing_dpi_status(uint8_t padding);
+void            oled_driver_render_logo_left(void);
+void            oled_driver_render_logo_right(void);
 
 #ifdef OLED_DISPLAY_128X64
 #    define OLED_RENDER_KEYLOGGER         "Keylogger: "

+ 40 - 0
users/drashna/post_config.h

@@ -0,0 +1,40 @@
+/* Copyright 2020 Christopher Courtney, aka Drashna Jael're  (@drashna) <drashna@live.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+// because layouts seem to not be respecting config.h order atm
+#ifdef RGBLIGHT_ENABLE
+#    undef RGBLIGHT_ANIMATIONS
+#    if defined(__AVR__) && (!defined(__AVR_AT90USB1286__) && !defined(RGBLIGHT_ALL_ANIMATIONS))
+#        define RGBLIGHT_EFFECT_BREATHING
+#        define RGBLIGHT_EFFECT_SNAKE
+#        define RGBLIGHT_EFFECT_KNIGHT
+#    else
+#        define RGBLIGHT_EFFECT_BREATHING
+#        define RGBLIGHT_EFFECT_RAINBOW_MOOD
+#        define RGBLIGHT_EFFECT_RAINBOW_SWIRL
+#        define RGBLIGHT_EFFECT_SNAKE
+#        define RGBLIGHT_EFFECT_KNIGHT
+#        if defined(RGBLIGHT_ALL_ANIMATIONS)
+#            define RGBLIGHT_EFFECT_CHRISTMAS
+#            define RGBLIGHT_EFFECT_STATIC_GRADIENT
+#            define RGBLIGHT_EFFECT_RGB_TEST
+#            define RGBLIGHT_EFFECT_ALTERNATING
+#        endif
+#        define RGBLIGHT_EFFECT_TWINKLE
+#    endif
+#endif

+ 7 - 5
users/drashna/process_records.c

@@ -19,13 +19,12 @@
 
 uint16_t copy_paste_timer;
 
-__attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
-
-__attribute__((weak)) bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; }
-
 // Defines actions tor my global custom keycodes. Defined in drashna.h file
 // Then runs the _keymap's record handier if not processed here
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+
+__attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
+__attribute__((weak)) bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; }
+bool                       process_record_user(uint16_t keycode, keyrecord_t *record) {
     // If console is enabled, it will print the matrix position and status of each key pressed
 #ifdef KEYLOGGER_ENABLE
     uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %b, time: %5u, int: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count);
@@ -203,3 +202,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
     }
     return true;
 }
+
+__attribute__((weak)) void post_process_record_keymap(uint16_t keycode, keyrecord_t *record) {}
+void                       post_process_record_user(uint16_t keycode, keyrecord_t *record) { post_process_record_keymap(keycode, record); }

+ 1 - 0
users/drashna/process_records.h

@@ -51,6 +51,7 @@ enum userspace_custom_keycodes {
 
 bool process_record_secrets(uint16_t keycode, keyrecord_t *record);
 bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
+void post_process_record_keymap(uint16_t keycode, keyrecord_t *record);
 
 #define LOWER     MO(_LOWER)
 #define RAISE     MO(_RAISE)

+ 0 - 5
users/drashna/rgb_matrix_stuff.c

@@ -20,11 +20,6 @@
 extern led_config_t g_led_config;
 
 static uint32_t hypno_timer;
-#if defined(SPLIT_KEYBOARD) || defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_crkbd)
-#    define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN_DUAL
-#else
-#    define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN
-#endif
 
 void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type, uint8_t led_min, uint8_t led_max) {
     HSV hsv = {hue, sat, val};

+ 20 - 115
users/drashna/rgb_stuff.c

@@ -23,106 +23,19 @@
 bool has_initialized;
 
 void rgblight_sethsv_default_helper(uint8_t index) { rgblight_sethsv_at(rgblight_get_hue(), rgblight_get_sat(), rgblight_get_val(), index); }
-
-#    ifdef RGBLIGHT_TWINKLE
-static rgblight_fadeout lights[RGBLED_NUM];
-
-/* Handler for fading/twinkling effect */
-void scan_rgblight_fadeout(void) {  // Don't effing change this function .... rgblight_sethsv is supppppper intensive
-    bool litup = false;
-
-    for (uint8_t light_index = 0; light_index < RGBLED_NUM; ++light_index) {
-        if (lights[light_index].enabled && sync_timer_elapsed(lights[light_index].timer) > 10) {
-            rgblight_fadeout *light = &lights[light_index];
-            litup                   = true;
-
-            if (light->life) {
-                light->life -= 1;
-                if (get_highest_layer(layer_state) == 0) {
-                    sethsv(light->hue + rand() % 0xF, 255, light->life, (LED_TYPE *)&led[light_index]);
-                }
-                light->timer = sync_timer_read();
-            } else {
-                if (light->enabled && get_highest_layer(layer_state) == 0) {
-                    rgblight_sethsv_default_helper(light_index);
-                }
-                litup = light->enabled = false;
-            }
-        }
-    }
-    if (litup && get_highest_layer(layer_state) == 0) {
-        rgblight_set();
-    }
-}
-
-/* Triggers a LED to fade/twinkle.
- * This function handles the selection of the LED and prepres for it to be used.
- */
-void start_rgb_light(void) {
-    uint8_t indices[RGBLED_NUM];
-    uint8_t indices_count  = 0;
-    uint8_t min_life       = 0xFF;
-    uint8_t min_life_index = -1;
-
-    for (uint8_t index = 0; index < RGBLED_NUM; ++index) {
-        if (lights[index].enabled) {
-            if (min_life_index == -1 || lights[index].life < min_life) {
-                min_life       = lights[index].life;
-                min_life_index = index;
-            }
-            continue;
-        }
-
-        indices[indices_count] = index;
-        ++indices_count;
-    }
-
-    uint8_t light_index;
-    if (!indices_count) {
-        light_index = min_life_index;
-    } else {
-        light_index = indices[rand() % indices_count];
-    }
-
-    rgblight_fadeout *light = &lights[light_index];
-    light->enabled          = true;
-    light->timer            = sync_timer_read();
-    light->life             = 0xC0 + rand() % 0x40;
-
-    light->hue = rgblight_get_hue() + (rand() % 0xB4) - 0x54;
-
-    rgblight_sethsv_at(light->hue, 255, light->life, light_index);
+void rgblight_set_hsv_and_mode(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode) {
+    rgblight_sethsv_noeeprom(hue, sat, val);
+    // wait_us(175);  // Add a slight delay between color and mode to ensure it's processed correctly
+    rgblight_mode_noeeprom(mode);
 }
-#    endif
-
-bool process_record_user_rgb_light(uint16_t keycode, keyrecord_t *record) {
-    uint16_t temp_keycode = keycode;
-    // Filter out the actual keycode from MT and LT keys.
-    if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) {
-        temp_keycode &= 0xFF;
-    }
 
-    switch (temp_keycode) {
-#    ifdef RGBLIGHT_TWINKLE
-        case KC_A ... KC_SLASH:
-        case KC_F1 ... KC_F12:
-        case KC_INSERT ... KC_UP:
-        case KC_KP_SLASH ... KC_KP_DOT:
-        case KC_F13 ... KC_F24:
-        case KC_AUDIO_MUTE ... KC_MEDIA_REWIND:
-            if (record->event.pressed) {
-                start_rgb_light();
-            }
-            break;
-#    endif  // RGBLIGHT_TWINKLE
-    }
-    return true;
-}
+bool process_record_user_rgb_light(uint16_t keycode, keyrecord_t *record) { return true; }
 
 #    if defined(RGBLIGHT_STARTUP_ANIMATION)
 static bool     is_enabled;
 static bool     is_rgblight_startup;
-static uint8_t  old_hue;
+static HSV      old_hsv;
+static uint8_t  old_mode;
 static uint16_t rgblight_startup_loop_timer;
 #    endif
 
@@ -130,37 +43,35 @@ void keyboard_post_init_rgb_light(void) {
 #    if defined(RGBLIGHT_STARTUP_ANIMATION)
     is_enabled = rgblight_is_enabled();
     if (userspace_config.rgb_layer_change) {
-        rgblight_enable_noeeprom();
-    }
-    if (rgblight_is_enabled()) {
         layer_state_set_rgb_light(layer_state);
-        old_hue = rgblight_get_hue();
-        rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
-        is_rgblight_startup = true;
     }
+    old_hsv  = rgblight_get_hsv();
+    old_mode = rgblight_get_mode();
+    rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
+    is_rgblight_startup = true;
 #    endif
-    layer_state_set_rgb_light(layer_state);
+    if (userspace_config.rgb_layer_change) {
+        layer_state_set_rgb_light(layer_state);
+    }
 }
 
 void matrix_scan_rgb_light(void) {
-#    ifdef RGBLIGHT_TWINKLE
-    scan_rgblight_fadeout();
-#    endif  // RGBLIGHT_ENABLE
-
 #    if defined(RGBLIGHT_STARTUP_ANIMATION)
     if (is_rgblight_startup && is_keyboard_master()) {
         if (sync_timer_elapsed(rgblight_startup_loop_timer) > 10) {
             static uint8_t counter;
             counter++;
-            rgblight_sethsv_noeeprom((counter + old_hue) % 255, 255, 255);
+            rgblight_sethsv_noeeprom((counter + old_hsv.h) % 255, 255, 255);
             rgblight_startup_loop_timer = sync_timer_read();
             if (counter == 255) {
                 is_rgblight_startup = false;
-                if (!is_enabled) {
-                    rgblight_disable_noeeprom();
-                }
                 if (userspace_config.rgb_layer_change) {
                     layer_state_set_rgb_light(layer_state);
+                } else {
+                    rgblight_set_hsv_and_mode(old_hsv.h, old_hsv.s, old_hsv.v, old_mode);
+                }
+                if (!is_enabled) {
+                    rgblight_disable_noeeprom();
                 }
             }
         }
@@ -168,12 +79,6 @@ void matrix_scan_rgb_light(void) {
 #    endif
 }
 
-void rgblight_set_hsv_and_mode(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode) {
-    rgblight_sethsv_noeeprom(hue, sat, val);
-    // wait_us(175);  // Add a slight delay between color and mode to ensure it's processed correctly
-    rgblight_mode_noeeprom(mode);
-}
-
 layer_state_t layer_state_set_rgb_light(layer_state_t state) {
 #    ifdef RGBLIGHT_ENABLE
     if (userspace_config.rgb_layer_change) {

+ 0 - 13
users/drashna/rgb_stuff.h

@@ -17,22 +17,9 @@
 #pragma once
 #include "quantum.h"
 
-#if defined(RGBLIGHT_TWINKLE)
-typedef struct {
-    bool     enabled;
-    uint8_t  hue;
-    uint16_t timer;
-    uint8_t  life;
-} rgblight_fadeout;
-#endif
-
 bool          process_record_user_rgb_light(uint16_t keycode, keyrecord_t *record);
 void          keyboard_post_init_rgb_light(void);
 void          matrix_scan_rgb_light(void);
 layer_state_t layer_state_set_rgb_light(layer_state_t state);
 layer_state_t default_layer_state_set_rgb_light(layer_state_t state);
 void          rgblight_sethsv_default_helper(uint8_t index);
-
-#if defined(RGBLIGHT_TWINKLE)
-void scan_rgblight_fadeout(void);
-#endif

+ 6 - 5
users/drashna/rules.mk

@@ -29,9 +29,6 @@ CUSTOM_RGBLIGHT ?= yes
 ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
     ifeq ($(strip $(CUSTOM_RGBLIGHT)), yes)
         SRC += rgb_stuff.c
-        ifeq ($(strip $(RGBLIGHT_TWINKLE)), yes)
-            OPT_DEFS += -DRGBLIGHT_TWINKLE
-        endif
         ifeq ($(strip $(RGBLIGHT_NOEEPROM)), yes)
             OPT_DEFS += -DRGBLIGHT_NOEEPROM
         endif
@@ -81,8 +78,12 @@ ifeq ($(strip $(PIMORONI_TRACKBALL_ENABLE)), yes)
     QUANTUM_LIB_SRC += i2c_master.c
 endif
 
-ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
-    QUANTUM_LIB_SRC += transport_sync.c
+CUSTOM_SPLIT_TRANSPORT_SYNC ?= yes
+ifeq ($(strip $(CUSTOM_SPLIT_TRANSPORT_SYNC)), yes)
+    ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
+        QUANTUM_LIB_SRC += transport_sync.c
+        OPT_DEFS += -DCUSTOM_SPLIT_TRANSPORT_SYNC
+    endif
 endif
 
 # DEBUG_MATRIX_SCAN_RATE_ENABLE = api

+ 63 - 59
users/drashna/transport_sync.c

@@ -1,30 +1,44 @@
-#ifdef SPLIT_TRANSACTION_IDS_USER
-#    include "transport_sync.h"
-#    include "transactions.h"
-#    include <string.h>
-
-#    ifdef UNICODE_ENABLE
+/* Copyright 2020 Christopher Courtney, aka Drashna Jael're  (@drashna) <drashna@live.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "transport_sync.h"
+#include "transactions.h"
+#include <string.h>
+
+#ifdef UNICODE_ENABLE
 extern unicode_config_t unicode_config;
-#    endif
-#    ifdef AUDIO_ENABLE
-#        include "audio.h"
-#    endif
-#    if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
+#endif
+#ifdef AUDIO_ENABLE
+#    include "audio.h"
+extern bool delayed_tasks_run;
+#endif
+#if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
 extern bool tap_toggling;
-#    endif
-#    ifdef SWAP_HANDS_ENABLE
+#endif
+#ifdef SWAP_HANDS_ENABLE
 extern bool swap_hands;
-#    endif
+#endif
 extern userspace_config_t userspace_config;
 
-typedef struct {
-    bool     oled_on;
-    bool     audio_enable;
-    bool     audio_clicky_enable;
-    bool     tap_toggling;
-    bool     unicode_mode;
-    bool     swap_hands;
-    uint8_t  reserved :2;
+__attribute__((aligned(8))) typedef struct {
+    bool audio_enable;
+    bool audio_clicky_enable;
+    bool tap_toggling;
+    bool unicode_mode;
+    bool swap_hands;
 } user_runtime_config_t;
 
 uint16_t transport_keymap_config    = 0;
@@ -57,58 +71,49 @@ void keyboard_post_init_transport_sync(void) {
 
 void user_transport_update(void) {
     if (is_keyboard_master()) {
-#    ifdef OLED_DRIVER_ENABLE
-        user_state.oled_on = is_oled_on();
-#    endif
-
         transport_keymap_config    = keymap_config.raw;
         transport_userspace_config = userspace_config.raw;
-#    ifdef AUDIO_ENABLE
+#ifdef AUDIO_ENABLE
         user_state.audio_enable        = is_audio_on();
         user_state.audio_clicky_enable = is_clicky_on();
-#    endif
-#    if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
+#endif
+#if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
         user_state.tap_toggling = tap_toggling;
-#    endif
-#    ifdef SWAP_HANDS_ENABLE
+#endif
+#ifdef SWAP_HANDS_ENABLE
         user_state.swap_hands = swap_hands;
-#    endif
+#endif
 
     } else {
-#    ifdef OLED_DRIVER_ENABLE
-        if (user_state.oled_on) {
-            oled_on();
-        } else {
-            oled_off();
-        }
-#    endif
         keymap_config.raw    = transport_keymap_config;
         userspace_config.raw = transport_userspace_config;
-#    ifdef UNICODE_ENABLE
+#ifdef UNICODE_ENABLE
         unicode_config.input_mode = user_state.unicode_mode;
-#    endif
-#    ifdef AUDIO_ENABLE
-        if (user_state.audio_enable != is_audio_on()) {
-            if (user_state.audio_enable) {
-                audio_on();
-            } else {
-                audio_off();
+#endif
+#ifdef AUDIO_ENABLE
+        if (delayed_tasks_run) {
+            if (user_state.audio_enable != is_audio_on()) {
+                if (user_state.audio_enable) {
+                    audio_on();
+                } else {
+                    audio_off();
+                }
             }
-        }
-        if (user_state.audio_clicky_enable != is_clicky_on()) {
-            if (user_state.audio_clicky_enable) {
-                clicky_on();
-            } else {
-                clicky_off();
+            if (user_state.audio_clicky_enable != is_clicky_on()) {
+                if (user_state.audio_clicky_enable) {
+                    clicky_on();
+                } else {
+                    clicky_off();
+                }
             }
         }
-#    endif
-#    if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
+#endif
+#if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
         tap_toggling = user_state.tap_toggling;
-#    endif
-#    ifdef SWAP_HANDS_ENABLE
+#endif
+#ifdef SWAP_HANDS_ENABLE
         swap_hands = user_state.swap_hands;
-#    endif
+#endif
     }
 }
 
@@ -185,4 +190,3 @@ void housekeeping_task_user(void) {
     // Data sync from master to slave
     user_transport_sync();
 }
-#endif