aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2021-08-21 13:34:44 -0700
committerGitHub <noreply@github.com>2021-08-21 13:34:44 -0700
commit58a5030661b57f1dd05693053df2eddadc285f64 (patch)
tree025a7a2d0dc6643ce806b72798c92139eafb4ca6
parentda1c011afc67dab0049b30a4c021dc38a36cb9aa (diff)
downloadqmk_firmware-58a5030661b57f1dd05693053df2eddadc285f64.tar.gz
qmk_firmware-58a5030661b57f1dd05693053df2eddadc285f64.zip
[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
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.h5
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/config.h51
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/f411/chconf.h38
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h98
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.c26
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.h19
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/f411/halconf.h25
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/f411/mcuconf.h34
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk13
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c162
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/rules.mk8
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/config.h50
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/rules.mk5
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/teensy2pp.h19
-rw-r--r--keyboards/handwired/tractyl_manuform/tm_sync.c129
-rw-r--r--keyboards/handwired/tractyl_manuform/tractyl_manuform.c78
-rw-r--r--keyboards/handwired/tractyl_manuform/tractyl_manuform.h22
-rw-r--r--keyboards/keebio/iris/keymaps/drashna/rules.mk1
-rw-r--r--keyboards/keebio/viterbi/keymaps/drashna/rules.mk1
-rw-r--r--keyboards/orthodox/keymaps/drashna/rules.mk1
-rw-r--r--keyboards/splitkb/zima/keymaps/drashna/config.h2
-rw-r--r--keyboards/splitkb/zima/keymaps/drashna/keymap.c36
-rw-r--r--layouts/community/ergodox/drashna/rules.mk1
-rw-r--r--layouts/community/numpad_5x6/drashna/config.h2
-rw-r--r--layouts/community/numpad_5x6/drashna/rules.mk1
-rw-r--r--layouts/community/ortho_4x12/drashna/config.h1
-rw-r--r--layouts/community/ortho_4x12/drashna/rules.mk2
-rw-r--r--layouts/community/ortho_5x12/drashna/rules.mk1
-rw-r--r--layouts/community/split_3x6_3/drashna/keymap.c14
-rw-r--r--users/drashna/config.h57
-rw-r--r--users/drashna/drashna.c95
-rw-r--r--users/drashna/drashna.h7
-rw-r--r--users/drashna/oled_stuff.c101
-rw-r--r--users/drashna/oled_stuff.h13
-rw-r--r--users/drashna/post_config.h40
-rw-r--r--users/drashna/process_records.c12
-rw-r--r--users/drashna/process_records.h1
-rw-r--r--users/drashna/rgb_matrix_stuff.c5
-rw-r--r--users/drashna/rgb_stuff.c135
-rw-r--r--users/drashna/rgb_stuff.h13
-rw-r--r--users/drashna/rules.mk11
-rw-r--r--users/drashna/transport_sync.c122
42 files changed, 936 insertions, 521 deletions
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.h b/keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.h
index 90dc46d7e..24aac66ae 100644
--- a/keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.h
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/5x6_right.h
@@ -17,6 +17,11 @@
17#pragma once 17#pragma once
18 18
19#include "tractyl_manuform.h" 19#include "tractyl_manuform.h"
20#if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right_f411)
21# include "f411.h"
22#elif defined(KEYBOARD_handwired_tractyl_manuform_5x6_right_teensy2pp)
23# include "teensy2pp.h"
24#endif
20#include "quantum.h" 25#include "quantum.h"
21 26
22#define ___ KC_NO 27#define ___ KC_NO
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/config.h
index f8722c97f..6b357f133 100644
--- a/keyboards/handwired/tractyl_manuform/5x6_right/config.h
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/config.h
@@ -20,39 +20,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
20 20
21#include "config_common.h" 21#include "config_common.h"
22 22
23#define PRODUCT_ID 0x3536 23#define PRODUCT_ID 0x3536
24#define DEVICE_VER 0x0001 24#define DEVICE_VER 0x0001
25#define PRODUCT Tractyl Manuform(5x6)
26 25
27/* key matrix size */ 26/* key matrix size */
28// Rows are doubled-up 27// Rows are doubled-up
29#define MATRIX_ROWS 12 28#define MATRIX_ROWS 12
30#define MATRIX_COLS 6 29#define MATRIX_COLS 6
31 30
32// wiring of each half 31#define DIODE_DIRECTION COL2ROW
33#define MATRIX_COL_PINS \
34 { C0, C1, C2, C3, C4, C5 }
35#define MATRIX_ROW_PINS \
36 { F7, F6, F5, F4, F3, F2 }
37
38#define DIODE_DIRECTION COL2ROW
39
40// WS2812 RGB LED strip input and number of LEDs
41#define RGB_DI_PIN E7
42#define RGBLED_NUM 20
43#define RGBLIGHT_SPLIT
44#define RGBLED_SPLIT \
45 { 10, 10 }
46#define RGBLIGHT_SLEEP
47// #define RGBW
48#define RGBLIGHT_LIMIT_VAL 100
49/* define if matrix has ghost */
50//#define MATRIX_HAS_GHOST
51
52/* number of backlight levels */
53// #define BACKLIGHT_LEVELS 3
54
55#define DEBUG_LED_PIN D6
56 32
57#define ROTATIONAL_TRANSFORM_ANGLE -25 33#define ROTATIONAL_TRANSFORM_ANGLE -25
58 34
@@ -62,24 +38,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
62#define BOOTMAGIC_LITE_ROW_RIGHT 6 38#define BOOTMAGIC_LITE_ROW_RIGHT 6
63#define BOOTMAGIC_LITE_COLUMN_RIGHT 5 39#define BOOTMAGIC_LITE_COLUMN_RIGHT 5
64 40
65#define AUDIO_PIN C6
66#define AUDIO_PIN_ALT B7
67
68#define DYNAMIC_KEYMAP_LAYER_COUNT 16 41#define DYNAMIC_KEYMAP_LAYER_COUNT 16
69#define LAYER_STATE_16BIT 42#define LAYER_STATE_16BIT
70 43
71/* serial.c configuration for split keyboard */
72#define SOFT_SERIAL_PIN D2
73#define EE_HANDS
74
75#define ENCODERS_PAD_A \
76 { D5 }
77#define ENCODERS_PAD_B \
78 { D4 }
79#define ENCODER_RESOLUTION 4
80
81/* Set 0 if debouncing isn't needed */ 44/* Set 0 if debouncing isn't needed */
82#define DEBOUNCE 5 45#define DEBOUNCE 5
83 46
84/* disable action features */ 47/* disable action features */
85//#define NO_ACTION_LAYER 48//#define NO_ACTION_LAYER
@@ -89,7 +52,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
89#define NO_ACTION_FUNCTION 52#define NO_ACTION_FUNCTION
90 53
91#define SERIAL_USE_MULTI_TRANSACTION 54#define SERIAL_USE_MULTI_TRANSACTION
92#define SPLIT_TRANSACTION_IDS_KB RPC_ID_STATE_SYNC, RPC_ID_SLAVE_STATE 55#define SPLIT_TRANSACTION_IDS_KB RPC_ID_KB_CONFIG_SYNC, RPC_ID_POINTER_STATE_SYNC
93 56
94/* PMW3360 Settings */ 57/* PMW3360 Settings */
95#define PMW3360_CS_PIN B0 58#define PMW3360_CS_PIN B0
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/chconf.h b/keyboards/handwired/tractyl_manuform/5x6_right/f411/chconf.h
new file mode 100644
index 000000000..8b55eaeef
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/f411/chconf.h
@@ -0,0 +1,38 @@
1/* Copyright 2020 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17/*
18 * This file was auto-generated by:
19 * `qmk chibios-confmigrate -i keyboards/handwired/onekey/blackpill_f411/chconf.h -r platforms/chibios/common/configs/chconf.h`
20 */
21
22#pragma once
23
24#define CH_CFG_ST_FREQUENCY 10000
25
26#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE
27
28#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
29
30#define CH_CFG_FACTORY_SEMAPHORES TRUE
31
32#define CH_CFG_FACTORY_MAILBOXES TRUE
33
34#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
35
36#define CH_CFG_FACTORY_PIPES TRUE
37
38#include_next <chconf.h>
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h
new file mode 100644
index 000000000..d3e0598cd
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h
@@ -0,0 +1,98 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3Copyright 2015 Jack Humbert
4
5This program is free software: you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation, either version 2 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#pragma once
20
21#define PRODUCT Tractyl Manuform(5x6) BlackPill
22
23// wiring of each half
24#define MATRIX_COL_PINS \
25 { A15, B3, B4, B5, B6, B7 }
26#define MATRIX_ROW_PINS \
27 { B12, B13, B14, B15, A8, A9 }
28
29#define DIODE_DIRECTION COL2ROW
30
31#define USB_VBUS_PIN B10
32#define SPLIT_HAND_PIN C14 // high = left, low = right
33
34// WS2812 RGB LED strip input and number of LEDs
35#define RGB_DI_PIN A1
36#define WS2812_PWM_DRIVER PWMD5 // default: PWMD2
37#define WS2812_PWM_CHANNEL 2 // default: 2
38#define WS2812_PWM_PAL_MODE 2 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 2
39//#define WS2812_PWM_COMPLEMENTARY_OUTPUT // Define for a complementary timer output (TIMx_CHyN); omit for a normal timer output (TIMx_CHy).
40#define WS2812_DMA_STREAM STM32_DMA1_STREAM0 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
41#define WS2812_DMA_CHANNEL 6 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
42
43#define RGBLED_NUM 20
44#define RGBLIGHT_SPLIT
45#define RGBLED_SPLIT \
46 { 10, 10 }
47
48#define DEBUG_LED_PIN C13
49
50#define AUDIO_PIN A0
51#define AUDIO_PWM_DRIVER PWMD5
52#define AUDIO_PWM_CHANNEL 1
53#define AUDIO_STATE_TIMER GPTD4
54
55/* serial.c configuration for split keyboard */
56#define SERIAL_USART_FULL_DUPLEX // Enable full duplex operation mode.
57#define SERIAL_USART_TX_PIN A2
58#define SERIAL_USART_RX_PIN A3
59#define SERIAL_USART_DRIVER SD2
60#define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7
61#define SERIAL_USART_RX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7
62#define SERIAL_USART_TIMEOUT 100 // USART driver timeout. default 100
63#undef SOFT_SERIAL_PIN
64
65// #define EE_HANDS
66
67#define I2C_DRIVER I2CD1
68#define I2C1_SCL_BANK GPIOB
69#define I2C1_SDA_BANK GPIOB
70#define I2C1_SCL 8
71#define I2C1_SDA 9
72#define I2C1_SCL_PAL_MODE 4
73#define I2C1_SDA_PAL_MODE 4
74#define I2C1_CLOCK_SPEED 400000
75
76#define ENCODERS_PAD_A \
77 { B1 }
78#define ENCODERS_PAD_B \
79 { B2 }
80
81#define SPI_DRIVER SPID1
82#define SPI_SCK_PIN A5
83#define SPI_SCK_PAL_MODE 5
84#define SPI_MOSI_PIN A7
85#define SPI_MOSI_PAL_MODE 5
86#define SPI_MISO_PIN A6
87#define SPI_MISO_PAL_MODE 5
88
89#define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A4
90// #define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 64
91// #define EXTERNAL_EEPROM_BYTE_COUNT 8196
92// #define EXTERNAL_EEPROM_PAGE_SIZE 32
93// #define EXTERNAL_EEPROM_ADDRESS_SIZE 2
94#define DEBUG_EEPROM_OUTPUT
95
96#define PMW_CS_PIN B0
97#define SPI_MODE 0
98#define SPI_DIVISOR 64
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.c b/keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.c
new file mode 100644
index 000000000..1f6028c72
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.c
@@ -0,0 +1,26 @@
1/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "f411.h"
18
19void matrix_init_sub_kb(void) { setPinInputHigh(A0); }
20
21void matrix_scan_sub_kb(void) {
22 if (!readPin(A0)) {
23 reset_keyboard();
24 }
25 matrix_scan_user();
26}
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.h b/keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.h
new file mode 100644
index 000000000..525b0378b
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.h
@@ -0,0 +1,19 @@
1/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#include "5x6_right.h"
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/halconf.h b/keyboards/handwired/tractyl_manuform/5x6_right/f411/halconf.h
new file mode 100644
index 000000000..94f4aff83
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/f411/halconf.h
@@ -0,0 +1,25 @@
1/* Copyright 2020 Nick Brassel (tzarc)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <https://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18// #define HAL_USE_DAC TRUE
19#define HAL_USE_PWM TRUE
20#define HAL_USE_SERIAL TRUE
21#define HAL_USE_I2C TRUE
22#define HAL_USE_SPI TRUE
23#define HAL_USE_GPT TRUE
24
25#include_next <halconf.h>
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/mcuconf.h b/keyboards/handwired/tractyl_manuform/5x6_right/f411/mcuconf.h
new file mode 100644
index 000000000..0f58208cc
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/f411/mcuconf.h
@@ -0,0 +1,34 @@
1/* Copyright 2020 Nick Brassel (tzarc)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <https://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#include_next "mcuconf.h"
20
21#undef STM32_I2C_USE_I2C1
22#define STM32_I2C_USE_I2C1 TRUE
23
24#undef STM32_PWM_USE_TIM5
25#define STM32_PWM_USE_TIM5 TRUE
26
27#undef STM32_GPT_USE_TIM4
28#define STM32_GPT_USE_TIM4 TRUE
29
30#undef STM32_SPI_USE_SPI1
31#define STM32_SPI_USE_SPI1 TRUE
32
33#undef STM32_SERIAL_USE_USART2
34#define STM32_SERIAL_USE_USART2 TRUE
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk
new file mode 100644
index 000000000..ede1a6baf
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/f411/rules.mk
@@ -0,0 +1,13 @@
1# MCU name
2MCU = STM32F411
3
4# Bootloader selection
5BOOTLOADER = stm32-dfu
6
7KEYBOARD_SHARED_EP = yes
8CONSOLE_ENABLE = yes
9
10EEPROM_DRIVER = spi
11WS2812_DRIVER = pwm
12SERIAL_DRIVER = usart
13AUDIO_DRIVER = pwm_hardware
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c
index 61f302f16..ab75d81dc 100644
--- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/keymap.c
@@ -16,6 +16,11 @@
16 16
17#include "drashna.h" 17#include "drashna.h"
18 18
19enum tractyl_keycodes {
20 KC_ACCEL = NEW_SAFE_RANGE,
21};
22
23bool enable_acceleration = false;
19// clang-format off 24// clang-format off
20#define LAYOUT_5x6_right_wrapper(...) LAYOUT_5x6_right(__VA_ARGS__) 25#define LAYOUT_5x6_right_wrapper(...) LAYOUT_5x6_right(__VA_ARGS__)
21#define LAYOUT_5x6_right_base( \ 26#define LAYOUT_5x6_right_base( \
@@ -66,7 +71,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
66 _______, _______, _______, _______, _______, _______, KC_BTN7, KC_BTN4, KC_BTN5, KC_BTN8, _______, _______, 71 _______, _______, _______, _______, _______, _______, KC_BTN7, KC_BTN4, KC_BTN5, KC_BTN8, _______, _______,
67 _______, _______, _______, _______, 72 _______, _______, _______, _______,
68 _______, _______, KC_BTN3, 73 _______, _______, KC_BTN3,
69 _______, _______, _______, 74 KC_ACCEL, _______, _______,
70 _______, _______, _______, _______ 75 _______, _______, _______, _______
71 ), 76 ),
72 [_GAMEPAD] = LAYOUT_5x6_right( 77 [_GAMEPAD] = LAYOUT_5x6_right(
@@ -164,13 +169,17 @@ bool tap_toggling = false;
164# define TAP_CHECK TAPPING_TERM 169# define TAP_CHECK TAPPING_TERM
165# endif 170# endif
166 171
167void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) { 172void process_mouse_user(report_mouse_t* mouse_report, int8_t x, int8_t y) {
168 if (x != 0 && y != 0) { 173 if (x != 0 && y != 0) {
169 mouse_timer = timer_read(); 174 mouse_timer = timer_read();
170# ifdef OLED_DRIVER_ENABLE 175# ifdef OLED_DRIVER_ENABLE
171 oled_timer = timer_read32(); 176 oled_timer = timer_read32();
172# endif 177# endif
173 if (timer_elapsed(mouse_debounce_timer) > TAP_CHECK) { 178 if (timer_elapsed(mouse_debounce_timer) > TAP_CHECK) {
179 if (enable_acceleration) {
180 x = (x > 0 ? x * x / 16 + x : -x * x / 16 + x);
181 y = (y > 0 ? y * y / 16 + y : -y * y / 16 + y);
182 }
174 mouse_report->x = x; 183 mouse_report->x = x;
175 mouse_report->y = y; 184 mouse_report->y = y;
176 if (!layer_state_is(_MOUSE)) { 185 if (!layer_state_is(_MOUSE)) {
@@ -222,6 +231,8 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t* record) {
222 case KC_MS_UP ... KC_MS_WH_RIGHT: 231 case KC_MS_UP ... KC_MS_WH_RIGHT:
223 record->event.pressed ? mouse_keycode_tracker++ : mouse_keycode_tracker--; 232 record->event.pressed ? mouse_keycode_tracker++ : mouse_keycode_tracker--;
224 mouse_timer = timer_read(); 233 mouse_timer = timer_read();
234 case KC_ACCEL:
235 enable_acceleration = record->event.pressed;
225 break; 236 break;
226 default: 237 default:
227 if (IS_NOEVENT(record->event)) break; 238 if (IS_NOEVENT(record->event)) break;
@@ -248,15 +259,146 @@ layer_state_t layer_state_set_keymap(layer_state_t state) {
248} 259}
249#endif 260#endif
250 261
251void matrix_init_keymap(void) { 262#ifdef OLED_DRIVER_ENABLE
252#ifdef AUDIO_ENABLE 263// WPM-responsive animation stuff here
253 extern audio_config_t audio_config; 264# define SLEEP_FRAMES 2
265# define SLEEP_SPEED 10 // below this wpm value your animation will idle
266
267# define WAKE_FRAMES 2 // uncomment if >1
268
269# define KAKI_FRAMES 3
270# define KAKI_SPEED 40 // above this wpm value typing animation to triggere
271
272# define RTOGI_FRAMES 2
273//#define LTOGI_FRAMES 2
254 274
255 if (!is_keyboard_master()) { 275//#define ANIM_FRAME_DURATION 500 // how long each frame lasts in ms
256 audio_stop_all(); 276// #define SLEEP_TIMER 60000 // should sleep after this period of 0 wpm, needs fixing
257 audio_config.enable = false; 277# define ANIM_SIZE 512 // number of bytes in array, minimize for adequate firmware size, max is 1024
278
279uint32_t anim_timer = 0;
280uint32_t anim_frame_duration = 500;
281uint8_t current_sleep_frame = 0;
282uint8_t current_wake_frame = 0; // uncomment if WAKE_FRAMES >1
283uint8_t current_kaki_frame = 0;
284uint8_t current_rtogi_frame = 0;
285// uint8_t current_ltogi_frame = 0;
286
287void render_kitty(void) {
288 // Images credit j-inc(/James Incandenza) and pixelbenny. Credit to obosob for initial animation approach.
289 static const char PROGMEM sleep[SLEEP_FRAMES][ANIM_SIZE] = {{
290 // 'sleep1', 128x32px
291 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,
292 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,
293 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,
294 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,
295 },
296 {// 'sleep2', 128x32px
297 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
298 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,
299 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,
300 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}};
301 static const char PROGMEM wake[WAKE_FRAMES][ANIM_SIZE] = {{
302 // 'mati2', 128x32px
303 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,
304 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,
305 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,
306 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,
307 },
308 {// 'mati3', 128x32px
309 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,
310 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,
311 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,
312 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}};
313 static const char PROGMEM kaki[KAKI_FRAMES][ANIM_SIZE] = {{
314 // 'jare2', 128x32px
315 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,
316 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,
317 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,
318 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,
319 },
320 {
321 // 'kaki1', 128x32px
322 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,
323 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,
324 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,
325 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,
326 },
327 {// 'kaki2', 128x32px
328 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,
329 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,
330 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,
331 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}};
332 static const char PROGMEM rtogi[KAKI_FRAMES][ANIM_SIZE] = {{
333 // 'rtogi1', 128x32px
334 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,
335 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,
336 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,
337 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,
338 },
339 {// 'rtogi2', 128x32px
340 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,
341 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,
342 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,
343 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}};
344
345 // assumes 1 frame prep stage
346 extern bool swap_hands;
347 void animation_phase(void) {
348 if (swap_hands) {
349 anim_frame_duration = 300;
350 current_rtogi_frame = (current_rtogi_frame + 1) % RTOGI_FRAMES;
351 oled_write_raw_P(rtogi[abs((RTOGI_FRAMES - 1) - current_rtogi_frame)], ANIM_SIZE);
352 } else {
353 if (get_current_wpm() <= SLEEP_SPEED) {
354 anim_frame_duration = 500;
355 current_sleep_frame = (current_sleep_frame + 1) % SLEEP_FRAMES;
356 oled_write_raw_P(sleep[abs((SLEEP_FRAMES - 1) - current_sleep_frame)], ANIM_SIZE);
357 }
358 // if(get_current_wpm() >IDLE_SPEED && get_current_wpm() <TAP_SPEED){
359 if (get_current_wpm() > SLEEP_SPEED) {
360 anim_frame_duration = 800;
361 current_wake_frame = (current_wake_frame + 1) % WAKE_FRAMES;
362 oled_write_raw_P(wake[abs((WAKE_FRAMES - 1) - current_wake_frame)], ANIM_SIZE);
363 // oled_write_raw_P(wake[0], ANIM_SIZE); // remove if IDLE_FRAMES >1
364 }
365 if (get_current_wpm() >= KAKI_SPEED) {
366 anim_frame_duration = 500;
367 current_kaki_frame = (current_kaki_frame + 1) % KAKI_FRAMES;
368 oled_write_raw_P(kaki[abs((KAKI_FRAMES - 1) - current_kaki_frame)], ANIM_SIZE);
369 }
370 }
371 }
372 if (get_current_wpm() != 000) {
373 // if(timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) {
374 if (timer_elapsed32(anim_timer) > anim_frame_duration) {
375 anim_timer = timer_read32();
376 animation_phase();
377 }
378 } else {
379 // if(timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) {
380 if (timer_elapsed32(anim_timer) > anim_frame_duration) {
381 anim_timer = timer_read32();
382 animation_phase();
383 }
258 } 384 }
259#endif
260} 385}
261 386
262void keyboard_post_init_keymap(void) { matrix_init_keymap(); } 387void oled_driver_render_logo_left(void) {
388 render_kitty();
389
390 oled_set_cursor(6, 0);
391 oled_write_P(PSTR(" Tractyl "), true);
392 oled_set_cursor(6, 1);
393 oled_write_P(PSTR(" Manuform "), true);
394 oled_set_cursor(6, 2);
395# if defined(WPM_ENABLE)
396 render_wpm(1);
397# endif
398 oled_set_cursor(6, 3);
399# if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right)
400 render_pointing_dpi_status(0);
401# endif
402 oled_set_cursor(0, 4);
403}
404#endif
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/rules.mk
index efd136857..8a69f2b28 100644
--- a/keyboards/handwired/tractyl_manuform/5x6_right/rules.mk
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/rules.mk
@@ -1,9 +1,3 @@
1# MCU name
2MCU = at90usb1286
3
4# Bootloader selection
5BOOTLOADER = halfkay
6
7# Build Options 1# Build Options
8# change yes to no to disable 2# change yes to no to disable
9# 3#
@@ -29,3 +23,5 @@ SPLIT_KEYBOARD = yes
29 23
30SRC += drivers/sensors/pmw3360.c 24SRC += drivers/sensors/pmw3360.c
31QUANTUM_LIB_SRC += spi_master.c tm_sync.c 25QUANTUM_LIB_SRC += spi_master.c tm_sync.c
26
27DEFAULT_FOLDER = handwired/tractyl_manuform/5x6_right/teensy2pp
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/config.h
new file mode 100644
index 000000000..44a66750b
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/config.h
@@ -0,0 +1,50 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3Copyright 2015 Jack Humbert
4
5This program is free software: you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation, either version 2 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#pragma once
20
21#define PRODUCT Tractyl Manuform(5x6) Teensy 2.0 ++
22
23// wiring of each half
24#define MATRIX_COL_PINS \
25 { C0, C1, C2, C3, C4, C5 }
26#define MATRIX_ROW_PINS \
27 { F7, F6, F5, F4, F3, F2 }
28
29#define DIODE_DIRECTION COL2ROW
30
31// WS2812 RGB LED strip input and number of LEDs
32#define RGB_DI_PIN E7
33#define RGBLED_NUM 20
34#define RGBLIGHT_SPLIT
35#define RGBLED_SPLIT \
36 { 10, 10 }
37
38#define DEBUG_LED_PIN D6
39
40#define AUDIO_PIN C6
41#define AUDIO_PIN_ALT B7
42
43/* serial.c configuration for split keyboard */
44#define SOFT_SERIAL_PIN D2
45#define EE_HANDS
46
47#define ENCODERS_PAD_A \
48 { D5 }
49#define ENCODERS_PAD_B \
50 { D4 }
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/rules.mk
new file mode 100644
index 000000000..149471682
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/rules.mk
@@ -0,0 +1,5 @@
1# MCU name
2MCU = at90usb1286
3
4# Bootloader selection
5BOOTLOADER = halfkay
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/teensy2pp.h b/keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/teensy2pp.h
new file mode 100644
index 000000000..525b0378b
--- /dev/null
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/teensy2pp/teensy2pp.h
@@ -0,0 +1,19 @@
1/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#include "5x6_right.h"
diff --git a/keyboards/handwired/tractyl_manuform/tm_sync.c b/keyboards/handwired/tractyl_manuform/tm_sync.c
index 0088fcc4f..2a8847b3e 100644
--- a/keyboards/handwired/tractyl_manuform/tm_sync.c
+++ b/keyboards/handwired/tractyl_manuform/tm_sync.c
@@ -14,86 +14,59 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16 16
17#ifdef SPLIT_TRANSACTION_IDS_KB 17#include "tractyl_manuform.h"
18 18#include "transactions.h"
19# include "tractyl_manuform.h" 19#include <string.h>
20# include "transactions.h" 20#include "drivers/sensors/pmw3360.h"
21# include <string.h>
22# include "drivers/sensors/pmw3360.h"
23
24kb_runtime_config_t kb_state;
25kb_slave_data_t kb_slave;
26
27void slave_state_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
28 if (target2initiator_buffer_size == sizeof(kb_slave)) {
29 memcpy(target2initiator_buffer, &kb_slave, sizeof(kb_slave));
30 if (kb_slave.mouse_x > 127) {
31 kb_slave.mouse_x -= 127;
32 } else if (kb_slave.mouse_x < -127) {
33 kb_slave.mouse_x += 127;
34 } else {
35 kb_slave.mouse_x = 0;
36 }
37 21
38 if (kb_slave.mouse_y > 127) { 22kb_config_data_t kb_config;
39 kb_slave.mouse_y -= 127; 23kb_pointer_data_t kb_pointer;
40 } else if (kb_slave.mouse_y < -127) { 24
41 kb_slave.mouse_y += 127; 25void kb_config_sync_handler(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
42 } else { 26 if (initiator2target_buffer_size == sizeof(kb_config)) {
43 kb_slave.mouse_y = 0; 27 memcpy(&kb_config, initiator2target_buffer, sizeof(kb_config));
44 }
45 } 28 }
46} 29}
47 30void kb_pointer_sync_handler(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
48void pointer_state_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) { 31 if (target2initiator_buffer_size == sizeof(kb_pointer)) {
49 if (initiator2target_buffer_size == sizeof(kb_state)) { 32 memcpy(target2initiator_buffer, &kb_pointer, sizeof(kb_pointer));
50 memcpy(&kb_state, initiator2target_buffer, sizeof(kb_state));
51 } 33 }
52} 34}
53 35
36void keyboard_pre_init_sync(void) {
37 memset(&kb_config, 0, sizeof(kb_config));
38 memset(&kb_pointer, 0, sizeof(kb_pointer));
39}
40
54void keyboard_post_init_kb(void) { 41void keyboard_post_init_kb(void) {
55 // Register keyboard state sync split transaction 42 // Register keyboard state sync split transaction
56 transaction_register_rpc(RPC_ID_STATE_SYNC, pointer_state_sync); 43 transaction_register_rpc(RPC_ID_KB_CONFIG_SYNC, kb_config_sync_handler);
57 transaction_register_rpc(RPC_ID_SLAVE_STATE, slave_state_sync); 44 transaction_register_rpc(RPC_ID_POINTER_STATE_SYNC, kb_pointer_sync_handler);
58 45
59 keyboard_post_init_user(); 46 keyboard_post_init_user();
60} 47}
61 48
62void kb_state_update(void) { 49void kb_config_update(void) {
63# ifdef POINTING_DEVICE_ENABLE
64 if (is_keyboard_master()) { 50 if (is_keyboard_master()) {
65 static uint16_t cpi = 0; 51 static uint16_t cpi = 0;
66 if (cpi != kb_state.device_cpi) { 52 if (cpi != kb_config.device_cpi) {
67 cpi = kb_state.device_cpi; 53 cpi = kb_config.device_cpi;
68 pmw_set_cpi(cpi); 54 pmw_set_cpi(cpi);
69 } 55 }
70 } 56 }
71# endif
72} 57}
73 58
74void kb_post_state_update(void) { 59void kb_config_sync(void) {
75# ifdef POINTING_DEVICE_ENABLE
76 if (is_keyboard_master() && is_keyboard_left()) {
77 report_mouse_t temp_report = pointing_device_get_report();
78 temp_report.x = kb_slave.mouse_x;
79 temp_report.y = kb_slave.mouse_y;
80 pointing_device_set_report(temp_report);
81 }
82# endif
83}
84
85void kb_state_sync(void) {
86 if (is_keyboard_master()) { 60 if (is_keyboard_master()) {
87 // Keep track of the last state, so that we can tell if we need to propagate to slave 61 // Keep track of the last state, so that we can tell if we need to propagate to slave
88 static kb_runtime_config_t last_kb_state; 62 static kb_config_data_t last_kb_config;
89 static uint32_t last_sync = 0; 63 static uint32_t last_sync = 0;
90 static uint32_t mouse_sync = 0; 64 bool needs_sync = false;
91 bool needs_sync = false;
92 65
93 // Check if the state values are different 66 // Check if the state values are different
94 if (memcmp(&kb_state, &last_kb_state, sizeof(kb_runtime_config_t))) { 67 if (memcmp(&kb_config, &last_kb_config, sizeof(kb_config))) {
95 needs_sync = true; 68 needs_sync = true;
96 memcpy(&last_kb_state, &kb_state, sizeof(kb_runtime_config_t)); 69 memcpy(&last_kb_config, &kb_config, sizeof(kb_config));
97 } 70 }
98 // Send to slave every 500ms regardless of state change 71 // Send to slave every 500ms regardless of state change
99 if (timer_elapsed32(last_sync) > 500) { 72 if (timer_elapsed32(last_sync) > 500) {
@@ -102,31 +75,45 @@ void kb_state_sync(void) {
102 75
103 // Perform the sync if requested 76 // Perform the sync if requested
104 if (needs_sync) { 77 if (needs_sync) {
105 if (transaction_rpc_send(RPC_ID_STATE_SYNC, sizeof(kb_runtime_config_t), &kb_state)) { 78 if (transaction_rpc_send(RPC_ID_KB_CONFIG_SYNC, sizeof(kb_config), &kb_config)) {
106 last_sync = timer_read32(); 79 last_sync = timer_read32();
107 } 80 }
108 } 81 }
82 }
83}
109 84
110 if (is_keyboard_left()) { 85void kb_pointer_sync(void) {
111 if (timer_elapsed32(mouse_sync) >= 5) { 86 if (is_keyboard_master() && is_keyboard_left()) {
112 // always sync slave data, since it may contain device reports. 87 // Keep track of the last state, so that we can tell if we need to propagate to slave
113 if (transaction_rpc_recv(RPC_ID_SLAVE_STATE, sizeof(kb_slave_data_t), &kb_slave)) { 88 static uint32_t last_sync = 0;
114 if (kb_slave.mouse_x >= -127 && kb_slave.mouse_x <= 127 && kb_slave.mouse_y >= -127 && kb_slave.mouse_y <= 127) { 89
115 mouse_sync = timer_read32(); 90 // Perform the sync if requested
116 } 91 if (timer_elapsed32(last_sync) >= 5) {
117 } 92 if (transaction_rpc_recv(RPC_ID_POINTER_STATE_SYNC, sizeof(kb_pointer), &kb_pointer)) {
93 last_sync = timer_read32();
118 } 94 }
119 } 95 }
120 } 96 }
121} 97}
122 98
123void housekeeping_task_kb(void) { 99void housekeeping_task_kb(void) {
124 // Update kb_state so we can send to slave 100 // Update kb_config so we can send to slave
125 kb_state_update(); 101 kb_config_update();
126
127 // Data sync from master to slave 102 // Data sync from master to slave
128 kb_state_sync(); 103 kb_config_sync();
104 kb_pointer_sync();
105}
106
107void kb_pointer_sync_send(int8_t x, int8_t y) {
108 kb_pointer.mouse_x = x;
109 kb_pointer.mouse_y = y;
110}
129 111
130 kb_post_state_update(); 112kb_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}; }
113
114void trackball_set_cpi(uint16_t cpi) {
115 kb_config.device_cpi = cpi;
116 if (!is_keyboard_left()) {
117 pmw_set_cpi(cpi);
118 }
131} 119}
132#endif
diff --git a/keyboards/handwired/tractyl_manuform/tractyl_manuform.c b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c
index e992c446c..61a6740a2 100644
--- a/keyboards/handwired/tractyl_manuform/tractyl_manuform.c
+++ b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c
@@ -30,9 +30,6 @@
30# define TRACKBALL_DPI_DEFAULT 0 30# define TRACKBALL_DPI_DEFAULT 0
31#endif 31#endif
32 32
33extern kb_runtime_config_t kb_state;
34extern kb_slave_data_t kb_slave;
35
36keyboard_config_t keyboard_config; 33keyboard_config_t keyboard_config;
37uint16_t dpi_array[] = TRACKBALL_DPI_OPTIONS; 34uint16_t dpi_array[] = TRACKBALL_DPI_OPTIONS;
38#define DPI_OPTION_SIZE (sizeof(dpi_array) / sizeof(uint16_t)) 35#define DPI_OPTION_SIZE (sizeof(dpi_array) / sizeof(uint16_t))
@@ -40,18 +37,20 @@ uint16_t dpi_array[] = TRACKBALL_DPI_OPTIONS;
40bool BurstState = false; // init burst state for Trackball module 37bool BurstState = false; // init burst state for Trackball module
41uint16_t MotionStart = 0; // Timer for accel, 0 is resting state 38uint16_t MotionStart = 0; // Timer for accel, 0 is resting state
42 39
43__attribute__((weak)) void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y) { 40__attribute__((weak)) void process_mouse_user(report_mouse_t* mouse_report, int8_t x, int8_t y) {
44 mouse_report->x = x; 41 mouse_report->x = x;
45 mouse_report->y = y; 42 mouse_report->y = y;
46} 43}
47 44
48__attribute__((weak)) void process_mouse(report_mouse_t* mouse_report) { 45__attribute__((weak)) kb_pointer_data_t process_mouse(void) {
46 kb_pointer_data_t temp_data = {.mouse_x = 0, .mouse_y = 0};
47
49 report_pmw_t data = pmw_read_burst(); 48 report_pmw_t data = pmw_read_burst();
50 if (data.isOnSurface && data.isMotion) { 49 if (data.isOnSurface && data.isMotion) {
51 // Reset timer if stopped moving 50 // Reset timer if stopped moving
52 if (!data.isMotion) { 51 if (!data.isMotion) {
53 if (MotionStart != 0) MotionStart = 0; 52 if (MotionStart != 0) MotionStart = 0;
54 return; 53 return temp_data;
55 } 54 }
56 55
57 // Set timer if new motion 56 // Set timer if new motion
@@ -78,9 +77,10 @@ __attribute__((weak)) void process_mouse(report_mouse_t* mouse_report) {
78 if (debug_mouse) dprintf("Cons] X: %d, Y: %d\n", data.dx, data.dy); 77 if (debug_mouse) dprintf("Cons] X: %d, Y: %d\n", data.dx, data.dy);
79 // dprintf("Elapsed:%u, X: %f Y: %\n", i, pgm_read_byte(firmware_data+i)); 78 // dprintf("Elapsed:%u, X: %f Y: %\n", i, pgm_read_byte(firmware_data+i));
80 79
81 mouse_report->x = -data.dx; 80 temp_data.mouse_x = -data.dx;
82 mouse_report->y = data.dy; 81 temp_data.mouse_y = data.dy;
83 } 82 }
83 return temp_data;
84} 84}
85 85
86bool process_record_kb(uint16_t keycode, keyrecord_t* record) { 86bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
@@ -118,6 +118,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
118 118
119 return true; 119 return true;
120} 120}
121__attribute__((weak)) void keyboard_pre_init_sync(void) {}
121 122
122// Hardware Setup 123// Hardware Setup
123void keyboard_pre_init_kb(void) { 124void keyboard_pre_init_kb(void) {
@@ -137,6 +138,7 @@ void keyboard_pre_init_kb(void) {
137 writePin(DEBUG_LED_PIN, debug_enable); 138 writePin(DEBUG_LED_PIN, debug_enable);
138#endif 139#endif
139 140
141 keyboard_pre_init_sync();
140 keyboard_pre_init_user(); 142 keyboard_pre_init_user();
141} 143}
142 144
@@ -149,11 +151,22 @@ void pointing_device_init(void) {
149 trackball_set_cpi(dpi_array[keyboard_config.dpi_config]); 151 trackball_set_cpi(dpi_array[keyboard_config.dpi_config]);
150} 152}
151 153
152static 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); }
153
154void pointing_device_task(void) { 154void pointing_device_task(void) {
155 report_mouse_t mouse_report = pointing_device_get_report(); 155 report_mouse_t mouse_report = pointing_device_get_report();
156 if (!is_keyboard_left()) { process_mouse(&mouse_report); } 156 kb_pointer_data_t data = {.mouse_x = mouse_report.x, .mouse_y = mouse_report.y};
157 if (is_keyboard_left()) {
158 if (is_keyboard_master()) {
159 data = kb_pointer_sync_get();
160 process_mouse_user(&mouse_report, data.mouse_x, data.mouse_y);
161 }
162 } else {
163 data = process_mouse();
164 if (!is_keyboard_master()) {
165 kb_pointer_sync_send(data.mouse_x, data.mouse_y);
166 } else {
167 process_mouse_user(&mouse_report, data.mouse_x, data.mouse_y);
168 }
169 }
157 170
158 pointing_device_set_report(mouse_report); 171 pointing_device_set_report(mouse_report);
159 pointing_device_send(); 172 pointing_device_send();
@@ -169,49 +182,18 @@ void eeconfig_init_kb(void) {
169 eeconfig_init_user(); 182 eeconfig_init_user();
170} 183}
171 184
185__attribute__((weak)) void matrix_init_sub_kb(void) {}
172void matrix_init_kb(void) { 186void matrix_init_kb(void) {
173 // is safe to just read DPI setting since matrix init 187 // is safe to just read DPI setting since matrix init
174 // comes before pointing device init. 188 // comes before pointing device init.
175 keyboard_config.raw = eeconfig_read_kb(); 189 keyboard_config.raw = eeconfig_read_kb();
176 if (keyboard_config.dpi_config > DPI_OPTION_SIZE) { eeconfig_init_kb(); } 190 if (keyboard_config.dpi_config > DPI_OPTION_SIZE) { eeconfig_init_kb(); }
191 matrix_init_sub_kb();
177 matrix_init_user(); 192 matrix_init_user();
178} 193}
179 194
180#ifdef POINTING_DEVICE_ENABLE 195__attribute__((weak)) void matrix_scan_sub_kb(void) {}
181void pointing_device_send(void) { 196void matrix_scan_kb(void) {
182 static report_mouse_t old_report = {}; 197 matrix_scan_sub_kb();
183 report_mouse_t mouseReport = pointing_device_get_report(); 198 matrix_scan_user();
184 if (is_keyboard_master()) {
185 int8_t x = mouseReport.x, y = mouseReport.y;
186 mouseReport.x = 0;
187 mouseReport.y = 0;
188 process_mouse_user(&mouseReport, x, y);
189 if (has_report_changed(mouseReport, old_report)) { host_mouse_send(&mouseReport); }
190 } else {
191 master_mouse_send(mouseReport.x, mouseReport.y);
192 }
193 mouseReport.x = 0;
194 mouseReport.y = 0;
195 mouseReport.v = 0;
196 mouseReport.h = 0;
197 old_report = mouseReport;
198 pointing_device_set_report(mouseReport);
199} 199}
200#endif
201
202#ifdef POINTING_DEVICE_ENABLE
203void master_mouse_send(int8_t x, int8_t y) {
204#ifdef SPLIT_TRANSACTION_IDS_KB
205 kb_slave.mouse_x += x;
206 kb_slave.mouse_y += y;
207#endif
208}
209void trackball_set_cpi(uint16_t cpi) {
210#ifdef SPLIT_TRANSACTION_IDS_KB
211 kb_state.device_cpi = cpi;
212#endif
213 if (!is_keyboard_left()) {
214 pmw_set_cpi(cpi);
215 }
216}
217#endif
diff --git a/keyboards/handwired/tractyl_manuform/tractyl_manuform.h b/keyboards/handwired/tractyl_manuform/tractyl_manuform.h
index 151e496fc..f49569310 100644
--- a/keyboards/handwired/tractyl_manuform/tractyl_manuform.h
+++ b/keyboards/handwired/tractyl_manuform/tractyl_manuform.h
@@ -25,9 +25,6 @@
25# include "4x6_right.h" 25# include "4x6_right.h"
26#endif 26#endif
27 27
28void process_mouse(report_mouse_t* mouse_report);
29void process_mouse_user(report_mouse_t* mouse_report, int16_t x, int16_t y);
30
31typedef union { 28typedef union {
32 uint32_t raw; 29 uint32_t raw;
33 struct { 30 struct {
@@ -42,14 +39,19 @@ enum ploopy_keycodes {
42 KEYMAP_SAFE_RANGE, 39 KEYMAP_SAFE_RANGE,
43}; 40};
44 41
45void master_mouse_send(int8_t x, int8_t y);
46void trackball_set_cpi(uint16_t cpi);
47
48typedef struct { 42typedef struct {
49 uint16_t device_cpi; 43 uint16_t device_cpi;
50} kb_runtime_config_t; 44} kb_config_data_t;
51 45
52typedef struct { 46typedef struct {
53 int16_t mouse_x; 47 int8_t mouse_x;
54 int16_t mouse_y; 48 int8_t mouse_y;
55} kb_slave_data_t; 49} kb_pointer_data_t;
50
51kb_pointer_data_t process_mouse(void);
52void process_mouse_user(report_mouse_t* mouse_report, int8_t x, int8_t y);
53void kb_pointer_sync_send(int8_t x, int8_t y);
54kb_pointer_data_t kb_pointer_sync_get(void);
55void trackball_set_cpi(uint16_t cpi);
56void matrix_init_sub_kb(void);
57void matrix_scan_sub_kb(void);
diff --git a/keyboards/keebio/iris/keymaps/drashna/rules.mk b/keyboards/keebio/iris/keymaps/drashna/rules.mk
index 68159e75f..41c67b573 100644
--- a/keyboards/keebio/iris/keymaps/drashna/rules.mk
+++ b/keyboards/keebio/iris/keymaps/drashna/rules.mk
@@ -12,7 +12,6 @@ SWAP_HANDS_ENABLE = no
12SPACE_CADET_ENABLE = no 12SPACE_CADET_ENABLE = no
13 13
14INDICATOR_LIGHTS = no 14INDICATOR_LIGHTS = no
15RGBLIGHT_TWINKLE = no
16RGBLIGHT_STARTUP_ANIMATION = no 15RGBLIGHT_STARTUP_ANIMATION = no
17 16
18BOOTLOADER = qmk-dfu 17BOOTLOADER = qmk-dfu
diff --git a/keyboards/keebio/viterbi/keymaps/drashna/rules.mk b/keyboards/keebio/viterbi/keymaps/drashna/rules.mk
index cf22e0f22..487031b36 100644
--- a/keyboards/keebio/viterbi/keymaps/drashna/rules.mk
+++ b/keyboards/keebio/viterbi/keymaps/drashna/rules.mk
@@ -12,7 +12,6 @@ SPACE_CADET_ENABLE = no
12 12
13NO_SECRETS = yes 13NO_SECRETS = yes
14INDICATOR_LIGHTS = no 14INDICATOR_LIGHTS = no
15RGBLIGHT_TWINKLE = no
16LAYOUTS = ortho_5x7 15LAYOUTS = ortho_5x7
17 16
18# SRC := $(filter-out serial.c matrix.c i2c.c split_util.c,$(SRC)) 17# SRC := $(filter-out serial.c matrix.c i2c.c split_util.c,$(SRC))
diff --git a/keyboards/orthodox/keymaps/drashna/rules.mk b/keyboards/orthodox/keymaps/drashna/rules.mk
index df40eb7ec..6f72712d8 100644
--- a/keyboards/orthodox/keymaps/drashna/rules.mk
+++ b/keyboards/orthodox/keymaps/drashna/rules.mk
@@ -10,7 +10,6 @@ NKRO_ENABLE = yes
10SPACE_CADET_ENABLE = no 10SPACE_CADET_ENABLE = no
11 11
12INDICATOR_LIGHTS = yes 12INDICATOR_LIGHTS = yes
13RGBLIGHT_TWINKLE = no
14RGBLIGHT_STARTUP_ANIMATION = yes 13RGBLIGHT_STARTUP_ANIMATION = yes
15 14
16 15
diff --git a/keyboards/splitkb/zima/keymaps/drashna/config.h b/keyboards/splitkb/zima/keymaps/drashna/config.h
index 91d657eda..133ab6a91 100644
--- a/keyboards/splitkb/zima/keymaps/drashna/config.h
+++ b/keyboards/splitkb/zima/keymaps/drashna/config.h
@@ -30,3 +30,5 @@
30// # define OLED_LOGO_CORNE 30// # define OLED_LOGO_CORNE
31// # define OLED_LOGO_GOTHAM 31// # define OLED_LOGO_GOTHAM
32#define OLED_LOGO_SCIFI 32#define OLED_LOGO_SCIFI
33
34#define ENCODER_RESOLUTION 2
diff --git a/keyboards/splitkb/zima/keymaps/drashna/keymap.c b/keyboards/splitkb/zima/keymaps/drashna/keymap.c
index 6e198e3dd..29d03ec91 100644
--- a/keyboards/splitkb/zima/keymaps/drashna/keymap.c
+++ b/keyboards/splitkb/zima/keymaps/drashna/keymap.c
@@ -15,7 +15,6 @@
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17#include QMK_KEYBOARD_H 17#include QMK_KEYBOARD_H
18#include <stdio.h>
19 18
20#ifdef HAPTIC_ENABLE 19#ifdef HAPTIC_ENABLE
21# include "haptic.h" 20# include "haptic.h"
@@ -90,15 +89,35 @@ void oled_task_user(void) {
90 oled_scroll_off(); 89 oled_scroll_off();
91 oled_write_P(PSTR("SplitKB's Zima"), false); 90 oled_write_P(PSTR("SplitKB's Zima"), false);
92 char layer[2] = {0}; 91 char layer[2] = {0};
93 snprintf(layer, sizeof(layer), "%d", get_highest_layer(layer_state)); 92 uint8_t n = get_highest_layer(layer_state);
93 layer[1] = '\0';
94 layer[0] = '0' + n % 10;
94 oled_write_P(PSTR(" L:"), false); 95 oled_write_P(PSTR(" L:"), false);
95 oled_write_ln(layer, false); 96 oled_write_ln(layer, false);
96 oled_write_ln_P(PSTR("--------------"), false); 97 oled_write_ln_P(PSTR("--------------"), false);
97 if (rgblight_is_enabled()) { 98 if (rgblight_is_enabled()) {
98 oled_write_P(PSTR("HSV: "), false); 99 oled_write_P(PSTR("HSV: "), false);
99 char rgbs[14]; 100 char hsv_char[4];
100 snprintf(rgbs, sizeof(rgbs), "%3d, %3d, %3d", rgblight_get_hue(), rgblight_get_sat(), rgblight_get_val()); 101 n = rgblight_get_hue();
101 oled_write_ln(rgbs, false); 102 hsv_char[3] = '\0';
103 hsv_char[2] = '0' + n % 10;
104 hsv_char[1] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
105 hsv_char[0] = n / 10 ? '0' + n / 10 : ' ';
106 oled_write(hsv_char, false);
107 oled_write_P(PSTR(", "), false);
108 n = rgblight_get_sat();
109 hsv_char[3] = '\0';
110 hsv_char[2] = '0' + n % 10;
111 hsv_char[1] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
112 hsv_char[0] = n / 10 ? '0' + n / 10 : ' ';
113 oled_write(hsv_char, false);
114 oled_write_P(PSTR(", "), false);
115 n = rgblight_get_val();
116 hsv_char[3] = '\0';
117 hsv_char[2] = '0' + n % 10;
118 hsv_char[1] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
119 hsv_char[0] = n / 10 ? '0' + n / 10 : ' ';
120 oled_write_ln(hsv_char, false);
102 } else { 121 } else {
103 oled_write_ln_P(PSTR("RGB LIGHT DISABLED"), false); 122 oled_write_ln_P(PSTR("RGB LIGHT DISABLED"), false);
104 } 123 }
@@ -125,10 +144,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) {
125} 144}
126 145
127bool encoder_update_user(uint8_t index, bool clockwise) { 146bool encoder_update_user(uint8_t index, bool clockwise) {
147 oled_timer = timer_read32();
128 if (clockwise) { 148 if (clockwise) {
129 tap_code16(KC_VOLU); 149 tap_code_delay(KC_VOLU, 10);
130 } else { 150 } else {
131 tap_code16(KC_VOLD); 151 tap_code_delay(KC_VOLD, 10);
132 } 152 }
133 return true; 153 return false;
134} 154}
diff --git a/layouts/community/ergodox/drashna/rules.mk b/layouts/community/ergodox/drashna/rules.mk
index 96a102700..4c47e0713 100644
--- a/layouts/community/ergodox/drashna/rules.mk
+++ b/layouts/community/ergodox/drashna/rules.mk
@@ -7,7 +7,6 @@ SPACE_CADET_ENABLE = no
7ifeq ($(strip $(KEYBOARD)), ergodox_ez) 7ifeq ($(strip $(KEYBOARD)), ergodox_ez)
8 RGBLIGHT_ENABLE = yes 8 RGBLIGHT_ENABLE = yes
9 RGB_MATRIX_ENABLE = yes 9 RGB_MATRIX_ENABLE = yes
10 RGBLIGHT_TWINKLE = no
11 INDICATOR_LIGHTS = no 10 INDICATOR_LIGHTS = no
12 RGBLIGHT_STARTUP_ANIMATION = yes 11 RGBLIGHT_STARTUP_ANIMATION = yes
13 PIMORONI_TRACKBALL_ENABLE = yes 12 PIMORONI_TRACKBALL_ENABLE = yes
diff --git a/layouts/community/numpad_5x6/drashna/config.h b/layouts/community/numpad_5x6/drashna/config.h
index 1f485e193..aa0c20123 100644
--- a/layouts/community/numpad_5x6/drashna/config.h
+++ b/layouts/community/numpad_5x6/drashna/config.h
@@ -28,6 +28,8 @@
28# define RGBLIGHT_EFFECT_SNAKE_LENGTH 2 28# define RGBLIGHT_EFFECT_SNAKE_LENGTH 2
29#endif // RGBLIGHT_ENABLE 29#endif // RGBLIGHT_ENABLE
30 30
31#define RGBLIGHT_ALL_ANIMATIONS
32
31#if defined(KEYBOARD_primekb_prime_m) 33#if defined(KEYBOARD_primekb_prime_m)
32# undef PRODUCT 34# undef PRODUCT
33# define PRODUCT Drashna Hacked Prime_M Macro Pad 35# define PRODUCT Drashna Hacked Prime_M Macro Pad
diff --git a/layouts/community/numpad_5x6/drashna/rules.mk b/layouts/community/numpad_5x6/drashna/rules.mk
index 6de3056dd..f4854716b 100644
--- a/layouts/community/numpad_5x6/drashna/rules.mk
+++ b/layouts/community/numpad_5x6/drashna/rules.mk
@@ -4,6 +4,5 @@ BACKLIGHT_ENABLE = no
4NO_SECRETS = yes 4NO_SECRETS = yes
5BOOTMAGIC_ENABLE = lite # Enable Bootmagic Lite 5BOOTMAGIC_ENABLE = lite # Enable Bootmagic Lite
6INDICATOR_LIGHTS = no 6INDICATOR_LIGHTS = no
7RGBLIGHT_TWINKLE = yes
8MAKE_BOOTLOADER = yes 7MAKE_BOOTLOADER = yes
9RGBLIGHT_STARTUP_ANIMATION = yes 8RGBLIGHT_STARTUP_ANIMATION = yes
diff --git a/layouts/community/ortho_4x12/drashna/config.h b/layouts/community/ortho_4x12/drashna/config.h
index 43143c3a3..d6197ece2 100644
--- a/layouts/community/ortho_4x12/drashna/config.h
+++ b/layouts/community/ortho_4x12/drashna/config.h
@@ -75,6 +75,7 @@
75# define PRODUCT Drashna Hacked Planck Rev6 75# define PRODUCT Drashna Hacked Planck Rev6
76# elif defined(KEYBOARD_planck_ez) 76# elif defined(KEYBOARD_planck_ez)
77# define PRODUCT Drashna Hacked Planck EZ 77# define PRODUCT Drashna Hacked Planck EZ
78# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 4095
78# endif 79# endif
79#endif 80#endif
80#undef NO_USB_STARTUP_CHECK 81#undef NO_USB_STARTUP_CHECK
diff --git a/layouts/community/ortho_4x12/drashna/rules.mk b/layouts/community/ortho_4x12/drashna/rules.mk
index dc64fe63b..775ad8e6e 100644
--- a/layouts/community/ortho_4x12/drashna/rules.mk
+++ b/layouts/community/ortho_4x12/drashna/rules.mk
@@ -11,7 +11,6 @@ ifneq ($(strip $(KEYBOARD)), planck/rev6)
11 ifeq ($(strip $(LAYOUT_HAS_RGB)), yes) 11 ifeq ($(strip $(LAYOUT_HAS_RGB)), yes)
12 RGBLIGHT_ENABLE = yes 12 RGBLIGHT_ENABLE = yes
13 INDICATOR_LIGHTS = yes 13 INDICATOR_LIGHTS = yes
14 RGBLIGHT_TWINKLE = yes
15 RGBLIGHT_STARTUP_ANIMATION = yes 14 RGBLIGHT_STARTUP_ANIMATION = yes
16 endif 15 endif
17else 16else
@@ -37,7 +36,6 @@ ifeq ($(strip $(KEYBOARD)), planck/ez)
37 ENCODER_MAP_ENABLE = yes 36 ENCODER_MAP_ENABLE = yes
38 RGB_MATRIX_ENABLE = yes 37 RGB_MATRIX_ENABLE = yes
39 INDICATOR_LIGHTS = yes 38 INDICATOR_LIGHTS = yes
40 RGBLIGHT_TWINKLE = yes
41 RGBLIGHT_STARTUP_ANIMATION = yes 39 RGBLIGHT_STARTUP_ANIMATION = yes
42 CONSOLE_ENABLE = yes 40 CONSOLE_ENABLE = yes
43 COMMAND_ENABLE = yes 41 COMMAND_ENABLE = yes
diff --git a/layouts/community/ortho_5x12/drashna/rules.mk b/layouts/community/ortho_5x12/drashna/rules.mk
index 0c2858e5e..69a025cc0 100644
--- a/layouts/community/ortho_5x12/drashna/rules.mk
+++ b/layouts/community/ortho_5x12/drashna/rules.mk
@@ -12,7 +12,6 @@ ifeq ($(strip $(KEYBOARD)), fractal)
12 AUDIO_SUPPORTED = yes 12 AUDIO_SUPPORTED = yes
13 RGBLIGHT_SUPPORTED = yes 13 RGBLIGHT_SUPPORTED = yes
14 RGBLIGHT_ENABLE = yes 14 RGBLIGHT_ENABLE = yes
15 RGBLIGHT_TWINKLE = yes
16 RGBLIGHT_STARTUP_ANIMATION = yes 15 RGBLIGHT_STARTUP_ANIMATION = yes
17 BOOTLOADER = qmk-dfu 16 BOOTLOADER = qmk-dfu
18endif 17endif
diff --git a/layouts/community/split_3x6_3/drashna/keymap.c b/layouts/community/split_3x6_3/drashna/keymap.c
index 6e71527a4..29e41e242 100644
--- a/layouts/community/split_3x6_3/drashna/keymap.c
+++ b/layouts/community/split_3x6_3/drashna/keymap.c
@@ -26,6 +26,12 @@ enum crkbd_keycodes { RGBRST = NEW_SAFE_RANGE };
26 * of use. K## is a placeholder to pass through the individual keycodes 26 * of use. K## is a placeholder to pass through the individual keycodes
27 */ 27 */
28 28
29#ifdef CONVERT_TO_PROTON_C
30# define MID_TMB ET_RAIS
31#else
32# define MID_TMB KC_ENT
33#endif
34
29// clang-format off 35// clang-format off
30#define LAYOUT_split_3x6_3_wrapper(...) LAYOUT_split_3x6_3(__VA_ARGS__) 36#define LAYOUT_split_3x6_3_wrapper(...) LAYOUT_split_3x6_3(__VA_ARGS__)
31#define LAYOUT_split_3x6_3_base( \ 37#define LAYOUT_split_3x6_3_base( \
@@ -37,7 +43,7 @@ enum crkbd_keycodes { RGBRST = NEW_SAFE_RANGE };
37 KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \ 43 KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \
38 ALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(K1B), \ 44 ALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(K1B), \
39 OS_LSFT, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \ 45 OS_LSFT, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \
40 OS_LGUI, KC_SPC, BK_LWER, DL_RAIS, KC_ENT, OS_RGUI \ 46 OS_LGUI, KC_SPC, BK_LWER, DL_RAIS, MID_TMB, OS_RGUI \
41 ) 47 )
42#define LAYOUT_base_wrapper(...) LAYOUT_split_3x6_3_base(__VA_ARGS__) 48#define LAYOUT_base_wrapper(...) LAYOUT_split_3x6_3_base(__VA_ARGS__)
43 49
@@ -104,12 +110,6 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
104} 110}
105#endif 111#endif
106 112
107void matrix_slave_scan_user(void) {
108#ifdef RGB_MATRIX_ENABLE
109 rgb_matrix_task();
110#endif
111}
112
113#ifdef RGB_MATRIX_ENABLE 113#ifdef RGB_MATRIX_ENABLE
114void suspend_power_down_keymap(void) { rgb_matrix_set_suspend_state(true); } 114void suspend_power_down_keymap(void) { rgb_matrix_set_suspend_state(true); }
115 115
diff --git a/users/drashna/config.h b/users/drashna/config.h
index ab0080234..c8007a61b 100644
--- a/users/drashna/config.h
+++ b/users/drashna/config.h
@@ -30,8 +30,15 @@
30# ifdef WPM_ENABLE 30# ifdef WPM_ENABLE
31# define SPLIT_WPM_ENABLE 31# define SPLIT_WPM_ENABLE
32# endif 32# endif
33# define SELECT_SOFT_SERIAL_SPEED 1 33# ifdef OLED_DRIVER_ENABLE
34# define SPLIT_TRANSACTION_IDS_USER RPC_ID_USER_STATE_SYNC, RPC_ID_USER_KEYMAP_SYNC, RPC_ID_USER_CONFIG_SYNC 34# define SPLIT_OLED_ENABLE
35# endif
36# if defined(__AVR__) && !defined(SELECT_SOFT_SERIAL_SPEED)
37# define SELECT_SOFT_SERIAL_SPEED 1
38# endif
39# ifdef CUSTOM_SPLIT_TRANSPORT_SYNC
40# define SPLIT_TRANSACTION_IDS_USER RPC_ID_USER_STATE_SYNC, RPC_ID_USER_KEYMAP_SYNC, RPC_ID_USER_CONFIG_SYNC
41# endif
35#endif 42#endif
36 43
37#ifdef AUDIO_ENABLE 44#ifdef AUDIO_ENABLE
@@ -65,23 +72,6 @@
65 72
66#ifdef RGBLIGHT_ENABLE 73#ifdef RGBLIGHT_ENABLE
67# define RGBLIGHT_SLEEP 74# define RGBLIGHT_SLEEP
68# undef RGBLIGHT_ANIMATIONS
69# if defined(__AVR__) && !defined(__AVR_AT90USB1286__)
70# define RGBLIGHT_EFFECT_BREATHING
71# define RGBLIGHT_EFFECT_SNAKE
72# define RGBLIGHT_EFFECT_KNIGHT
73# else
74# define RGBLIGHT_EFFECT_BREATHING
75# define RGBLIGHT_EFFECT_RAINBOW_MOOD
76# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
77# define RGBLIGHT_EFFECT_SNAKE
78# define RGBLIGHT_EFFECT_KNIGHT
79// # define RGBLIGHT_EFFECT_CHRISTMAS
80// # define RGBLIGHT_EFFECT_STATIC_GRADIENT
81// # define RGBLIGHT_EFFECT_RGB_TEST
82// # define RGBLIGHT_EFFECT_ALTERNATING
83# define RGBLIGHT_EFFECT_TWINKLE
84# endif
85# define RGBLIGHT_EFFECT_TWINKLE_LIFE 250 75# define RGBLIGHT_EFFECT_TWINKLE_LIFE 250
86# define RGBLIGHT_EFFECT_TWINKLE_PROBABILITY 1 / 24 76# define RGBLIGHT_EFFECT_TWINKLE_PROBABILITY 1 / 24
87#endif // RGBLIGHT_ENABLE 77#endif // RGBLIGHT_ENABLE
@@ -107,8 +97,10 @@
107# define DISABLE_RGB_MATRIX_CYCLE_ALL 97# define DISABLE_RGB_MATRIX_CYCLE_ALL
108# define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT 98# define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
109# define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN 99# define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
110// # define DISABLE_RGB_MATRIX_CYCLE_OUT_IN 100# if defined(SPLIT_KEYBOARD) || defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_moonlander)
101# define DISABLE_RGB_MATRIX_CYCLE_OUT_IN
111// # define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL 102// # define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
103# endif
112# define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON 104# define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
113# define DISABLE_RGB_MATRIX_DUAL_BEACON 105# define DISABLE_RGB_MATRIX_DUAL_BEACON
114# define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL 106# define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL
@@ -117,6 +109,12 @@
117# define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS 109# define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
118# define DISABLE_RGB_MATRIX_RAINDROPS 110# define DISABLE_RGB_MATRIX_RAINDROPS
119# define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS 111# define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
112# define DISABLE_RGB_MATRIX_HUE_BREATHING
113# define DISABLE_RGB_MATRIX_HUE_PENDULUM
114# define DISABLE_RGB_MATRIX_HUE_WAVE
115# define DISABLE_RGB_MATRIX_PIXEL_RAIN
116# define DISABLE_RGB_MATRIX_PIXEL_FLOW
117# define DISABLE_RGB_MATRIX_PIXEL_FRACTAL
120// # define DISABLE_RGB_MATRIX_TYPING_HEATMAP 118// # define DISABLE_RGB_MATRIX_TYPING_HEATMAP
121# define DISABLE_RGB_MATRIX_DIGITAL_RAIN 119# define DISABLE_RGB_MATRIX_DIGITAL_RAIN
122# define DISABLE_RGB_MATRIX_SOLID_REACTIVE 120# define DISABLE_RGB_MATRIX_SOLID_REACTIVE
@@ -132,7 +130,15 @@
132# define DISABLE_RGB_MATRIX_SOLID_SPLASH 130# define DISABLE_RGB_MATRIX_SOLID_SPLASH
133# define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH 131# define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
134# endif // AVR 132# endif // AVR
135#endif // RGB_MATRIX_ENABLE 133# ifndef RGB_MATRIX_REST_MODE
134# if defined(SPLIT_KEYBOARD) || defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_moonlander)
135# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN_DUAL
136# else
137# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN
138# endif
139# endif
140# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_REST_MODE
141#endif // RGB_MATRIX_ENABLE
136 142
137#ifdef OLED_DRIVER_ENABLE 143#ifdef OLED_DRIVER_ENABLE
138# ifdef SPLIT_KEYBOARD 144# ifdef SPLIT_KEYBOARD
@@ -182,8 +188,6 @@
182# define TAPPING_TERM_PER_KEY 188# define TAPPING_TERM_PER_KEY
183#endif 189#endif
184 190
185#define FORCE_NKRO
186
187#ifndef TAPPING_TOGGLE 191#ifndef TAPPING_TOGGLE
188# define TAPPING_TOGGLE 1 192# define TAPPING_TOGGLE 1
189#endif 193#endif
@@ -209,7 +213,12 @@
209# undef LOCKING_RESYNC_ENABLE 213# undef LOCKING_RESYNC_ENABLE
210#endif 214#endif
211 215
212#define LAYER_STATE_16BIT 216#if !defined(LAYER_STATE_16BIT) && !defined(LAYER_STATE_8BIT) && !defined(LAYER_STATE_32BIT)
217# define LAYER_STATE_16BIT
218#endif
219#ifndef DYNAMIC_KEYMAP_LAYER_COUNT
220# define DYNAMIC_KEYMAP_LAYER_COUNT 11
221#endif
213 222
214#ifdef CONVERT_TO_PROTON_C 223#ifdef CONVERT_TO_PROTON_C
215// pins that are available but not present on Pro Micro 224// pins that are available but not present on Pro Micro
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index 4cef5433d..27b9b5bc9 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -50,8 +50,7 @@ bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this
50} 50}
51 51
52__attribute__((weak)) void keyboard_pre_init_keymap(void) {} 52__attribute__((weak)) void keyboard_pre_init_keymap(void) {}
53 53void keyboard_pre_init_user(void) {
54void keyboard_pre_init_user(void) {
55 userspace_config.raw = eeconfig_read_user(); 54 userspace_config.raw = eeconfig_read_user();
56 keyboard_pre_init_keymap(); 55 keyboard_pre_init_keymap();
57} 56}
@@ -59,12 +58,11 @@ void keyboard_pre_init_user(void) {
59// This allows for a global, userspace functions, and continued 58// This allows for a global, userspace functions, and continued
60// customization of the keymap. Use _keymap instead of _user 59// customization of the keymap. Use _keymap instead of _user
61// functions in the keymaps 60// functions in the keymaps
62__attribute__((weak)) void matrix_init_keymap(void) {}
63__attribute__((weak)) void matrix_init_secret(void) {}
64
65// Call user matrix init, set default RGB colors and then 61// Call user matrix init, set default RGB colors and then
66// call the keymap's init function 62// call the keymap's init function
67void matrix_init_user(void) { 63__attribute__((weak)) void matrix_init_keymap(void) {}
64__attribute__((weak)) void matrix_init_secret(void) {}
65void matrix_init_user(void) {
68#if defined(BOOTLOADER_CATERINA) && defined(__AVR__) 66#if defined(BOOTLOADER_CATERINA) && defined(__AVR__)
69 DDRD &= ~(1 << 5); 67 DDRD &= ~(1 << 5);
70 PORTD &= ~(1 << 5); 68 PORTD &= ~(1 << 5);
@@ -75,11 +73,15 @@ void matrix_init_user(void) {
75 73
76 matrix_init_secret(); 74 matrix_init_secret();
77 matrix_init_keymap(); 75 matrix_init_keymap();
76#if defined(AUDIO_ENABLE) && defined(SPLIT_KEYBOARD)
77 if (!is_keyboard_master()) {
78 stop_all_notes();
79 }
80#endif
78} 81}
79 82
80__attribute__((weak)) void keyboard_post_init_keymap(void) {} 83__attribute__((weak)) void keyboard_post_init_keymap(void) {}
81 84void keyboard_post_init_user(void) {
82void keyboard_post_init_user(void) {
83#if defined(RGBLIGHT_ENABLE) 85#if defined(RGBLIGHT_ENABLE)
84 keyboard_post_init_rgb_light(); 86 keyboard_post_init_rgb_light();
85#endif 87#endif
@@ -92,13 +94,12 @@ void keyboard_post_init_user(void) {
92 keyboard_post_init_keymap(); 94 keyboard_post_init_keymap();
93} 95}
94 96
95__attribute__((weak)) void shutdown_keymap(void) {}
96
97#ifdef RGB_MATRIX_ENABLE 97#ifdef RGB_MATRIX_ENABLE
98void rgb_matrix_update_pwm_buffers(void); 98void rgb_matrix_update_pwm_buffers(void);
99#endif 99#endif
100 100
101void shutdown_user(void) { 101__attribute__((weak)) void shutdown_keymap(void) {}
102void shutdown_user(void) {
102#ifdef RGBLIGHT_ENABLE 103#ifdef RGBLIGHT_ENABLE
103 rgblight_enable_noeeprom(); 104 rgblight_enable_noeeprom();
104 rgblight_mode_noeeprom(1); 105 rgblight_mode_noeeprom(1);
@@ -113,8 +114,7 @@ void shutdown_user(void) {
113} 114}
114 115
115__attribute__((weak)) void suspend_power_down_keymap(void) {} 116__attribute__((weak)) void suspend_power_down_keymap(void) {}
116 117void suspend_power_down_user(void) {
117void suspend_power_down_user(void) {
118#ifdef OLED_DRIVER_ENABLE 118#ifdef OLED_DRIVER_ENABLE
119 oled_off(); 119 oled_off();
120#endif 120#endif
@@ -122,8 +122,7 @@ void suspend_power_down_user(void) {
122} 122}
123 123
124__attribute__((weak)) void suspend_wakeup_init_keymap(void) {} 124__attribute__((weak)) void suspend_wakeup_init_keymap(void) {}
125 125void suspend_wakeup_init_user(void) {
126void suspend_wakeup_init_user(void) {
127 if (layer_state_is(_GAMEPAD)) { 126 if (layer_state_is(_GAMEPAD)) {
128 layer_off(_GAMEPAD); 127 layer_off(_GAMEPAD);
129 } 128 }
@@ -133,13 +132,11 @@ void suspend_wakeup_init_user(void) {
133 suspend_wakeup_init_keymap(); 132 suspend_wakeup_init_keymap();
134} 133}
135 134
136__attribute__((weak)) void matrix_scan_keymap(void) {}
137
138__attribute__((weak)) void matrix_scan_secret(void) {}
139
140// No global matrix scan code, so just run keymap's matrix 135// No global matrix scan code, so just run keymap's matrix
141// scan function 136// scan function
142void matrix_scan_user(void) { 137__attribute__((weak)) void matrix_scan_keymap(void) {}
138__attribute__((weak)) void matrix_scan_secret(void) {}
139void matrix_scan_user(void) {
143 static bool has_ran_yet; 140 static bool has_ran_yet;
144 if (!has_ran_yet) { 141 if (!has_ran_yet) {
145 has_ran_yet = true; 142 has_ran_yet = true;
@@ -166,11 +163,10 @@ void matrix_scan_user(void) {
166float doom_song[][2] = SONG(E1M1_DOOM); 163float doom_song[][2] = SONG(E1M1_DOOM);
167#endif 164#endif
168 165
169__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; }
170
171// on layer change, no matter where the change was initiated 166// on layer change, no matter where the change was initiated
172// Then runs keymap's layer change check 167// Then runs keymap's layer change check
173layer_state_t layer_state_set_user(layer_state_t state) { 168__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; }
169layer_state_t layer_state_set_user(layer_state_t state) {
174 if (!is_keyboard_master()) { 170 if (!is_keyboard_master()) {
175 return state; 171 return state;
176 } 172 }
@@ -194,10 +190,9 @@ layer_state_t layer_state_set_user(layer_state_t state) {
194 return state; 190 return state;
195} 191}
196 192
197__attribute__((weak)) layer_state_t default_layer_state_set_keymap(layer_state_t state) { return state; }
198
199// Runs state check and changes underglow color and animation 193// Runs state check and changes underglow color and animation
200layer_state_t default_layer_state_set_user(layer_state_t state) { 194__attribute__((weak)) layer_state_t default_layer_state_set_keymap(layer_state_t state) { return state; }
195layer_state_t default_layer_state_set_user(layer_state_t state) {
201 if (!is_keyboard_master()) { 196 if (!is_keyboard_master()) {
202 return state; 197 return state;
203 } 198 }
@@ -212,22 +207,14 @@ layer_state_t default_layer_state_set_user(layer_state_t state) {
212} 207}
213 208
214__attribute__((weak)) void led_set_keymap(uint8_t usb_led) {} 209__attribute__((weak)) void led_set_keymap(uint8_t usb_led) {}
215 210void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); }
216// Any custom LED code goes here.
217// So far, I only have keyboard specific code,
218// So nothing goes here.
219void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); }
220 211
221__attribute__((weak)) void eeconfig_init_keymap(void) {} 212__attribute__((weak)) void eeconfig_init_keymap(void) {}
222 213void eeconfig_init_user(void) {
223void eeconfig_init_user(void) {
224 userspace_config.raw = 0; 214 userspace_config.raw = 0;
225 userspace_config.rgb_layer_change = true; 215 userspace_config.rgb_layer_change = true;
226 eeconfig_update_user(userspace_config.raw); 216 eeconfig_update_user(userspace_config.raw);
227 eeconfig_init_keymap(); 217 eeconfig_init_keymap();
228#ifdef VIA_ENABLE
229 via_eeprom_reset();
230#endif
231 keyboard_init(); 218 keyboard_init();
232} 219}
233 220
@@ -237,3 +224,39 @@ bool hasAllBitsInMask(uint8_t value, uint8_t mask) {
237 224
238 return (value & mask) == mask; 225 return (value & mask) == mask;
239} 226}
227
228#ifdef SPLIT_KEYBOARD
229# if defined(AUDIO_ENABLE)
230bool delayed_tasks_run = false;
231# endif
232__attribute__((weak)) void matrix_slave_scan_keymap(void) {}
233void matrix_slave_scan_user(void) {
234# if defined(AUDIO_ENABLE)
235# if !defined(NO_MUSIC_MODE)
236 music_task();
237# endif
238 if (!is_keyboard_master()) {
239 static uint16_t delayed_task_timer = 0;
240 if (!delayed_tasks_run) {
241 if (!delayed_task_timer) {
242 delayed_task_timer = timer_read();
243 } else if (timer_elapsed(delayed_task_timer) > 300) {
244 audio_startup();
245 delayed_tasks_run = true;
246 }
247 }
248 }
249# endif
250# ifdef SEQUENCER_ENABLE
251 sequencer_task();
252# endif
253# ifdef LED_MATRIX_ENABLE
254 led_matrix_task();
255# endif
256# ifdef HAPTIC_ENABLE
257 haptic_task();
258# endif
259
260 matrix_slave_scan_keymap();
261}
262#endif
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h
index ca849b050..0ae5f779a 100644
--- a/users/drashna/drashna.h
+++ b/users/drashna/drashna.h
@@ -94,6 +94,9 @@ layer_state_t default_layer_state_set_keymap(layer_state_t state);
94void led_set_keymap(uint8_t usb_led); 94void led_set_keymap(uint8_t usb_led);
95void eeconfig_init_keymap(void); 95void eeconfig_init_keymap(void);
96bool hasAllBitsInMask(uint8_t value, uint8_t mask); 96bool hasAllBitsInMask(uint8_t value, uint8_t mask);
97#ifdef SPLIT_KEYBOARD
98void matrix_slave_scan_keymap(void);
99#endif
97 100
98// clang-format off 101// clang-format off
99typedef union { 102typedef union {
@@ -126,7 +129,3 @@ We use custom codes here, so we can substitute the right stuff
126# define KC_D3_3 KC_3 129# define KC_D3_3 KC_3
127# define KC_D3_4 KC_4 130# define KC_D3_4 KC_4
128#endif // TAP_DANCE_ENABLE 131#endif // TAP_DANCE_ENABLE
129
130#if defined(DRASHNA_CUSTOM_TRANSPORT) && defined(POINTING_DEVICE_ENABLE)
131void master_mouse_send(int8_t x, int8_t y);
132#endif
diff --git a/users/drashna/oled_stuff.c b/users/drashna/oled_stuff.c
index 103b1fc7a..0d63c38fa 100644
--- a/users/drashna/oled_stuff.c
+++ b/users/drashna/oled_stuff.c
@@ -18,7 +18,7 @@
18 18
19#ifndef KEYLOGGER_LENGTH 19#ifndef KEYLOGGER_LENGTH
20// # ifdef OLED_DISPLAY_128X64 20// # ifdef OLED_DISPLAY_128X64
21# define KEYLOGGER_LENGTH ((int)(OLED_DISPLAY_HEIGHT / OLED_FONT_WIDTH)) 21# define KEYLOGGER_LENGTH ((uint8_t)(OLED_DISPLAY_HEIGHT / OLED_FONT_WIDTH))
22// # else 22// # else
23// # define KEYLOGGER_LENGTH (uint8_t *(OLED_DISPLAY_WIDTH / OLED_FONT_HEIGHT)) 23// # define KEYLOGGER_LENGTH (uint8_t *(OLED_DISPLAY_WIDTH / OLED_FONT_HEIGHT))
24// # endif 24// # endif
@@ -160,17 +160,21 @@ void render_matrix_scan_rate(void) {
160void render_mod_status(uint8_t modifiers) { 160void render_mod_status(uint8_t modifiers) {
161 static const char PROGMEM mod_status[5][3] = {{0xE8, 0xE9, 0}, {0xE4, 0xE5, 0}, {0xE6, 0xE7, 0}, {0xEA, 0xEB, 0}, {0xEC, 0xED, 0}}; 161 static const char PROGMEM mod_status[5][3] = {{0xE8, 0xE9, 0}, {0xE4, 0xE5, 0}, {0xE6, 0xE7, 0}, {0xEA, 0xEB, 0}, {0xEC, 0xED, 0}};
162 oled_write_P(PSTR(OLED_RENDER_MODS_NAME), false); 162 oled_write_P(PSTR(OLED_RENDER_MODS_NAME), false);
163#if defined(OLED_DISPLAY_128X64)
164 oled_write_P(mod_status[0], (modifiers & MOD_BIT(KC_LSHIFT)));
165 oled_write_P(mod_status[!keymap_config.swap_lctl_lgui ? 3 : 4], (modifiers & MOD_BIT(KC_LGUI)));
166 oled_write_P(mod_status[2], (modifiers & MOD_BIT(KC_LALT)));
167 oled_write_P(mod_status[1], (modifiers & MOD_BIT(KC_LCTL)));
168 oled_write_P(mod_status[1], (modifiers & MOD_BIT(KC_RCTL)));
169 oled_write_P(mod_status[2], (modifiers & MOD_BIT(KC_RALT)));
170 oled_write_P(mod_status[!keymap_config.swap_lctl_lgui ? 3 : 4], (modifiers & MOD_BIT(KC_RGUI)));
171 oled_write_P(mod_status[0], (modifiers & MOD_BIT(KC_RSHIFT)));
172#else
163 oled_write_P(mod_status[0], (modifiers & MOD_MASK_SHIFT)); 173 oled_write_P(mod_status[0], (modifiers & MOD_MASK_SHIFT));
164 oled_write_P(mod_status[!keymap_config.swap_lctl_lgui ? 3 : 4], (modifiers & MOD_MASK_GUI)); 174 oled_write_P(mod_status[!keymap_config.swap_lctl_lgui ? 3 : 4], (modifiers & MOD_MASK_GUI));
165#if !defined(OLED_DISPLAY_128X64)
166 oled_write_P(PSTR(" "), false); 175 oled_write_P(PSTR(" "), false);
167#endif
168 oled_write_P(mod_status[2], (modifiers & MOD_MASK_ALT)); 176 oled_write_P(mod_status[2], (modifiers & MOD_MASK_ALT));
169 oled_write_P(mod_status[1], (modifiers & MOD_MASK_CTRL)); 177 oled_write_P(mod_status[1], (modifiers & MOD_MASK_CTRL));
170
171 render_matrix_scan_rate();
172#if defined(OLED_DISPLAY_128X64)
173 oled_advance_page(true);
174#endif 178#endif
175} 179}
176 180
@@ -279,7 +283,7 @@ void render_user_status(void) {
279#endif 283#endif
280} 284}
281 285
282__attribute__((weak)) void oled_driver_render_logo(void) { 286void oled_driver_render_logo(void) {
283 // clang-format off 287 // clang-format off
284 static const char PROGMEM qmk_logo[] = { 288 static const char PROGMEM qmk_logo[] = {
285 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, 289 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) {
289 oled_write_P(qmk_logo, false); 293 oled_write_P(qmk_logo, false);
290} 294}
291 295
292void render_wpm(void) { 296void render_wpm(uint8_t padding) {
293#ifdef WPM_ENABLE 297#ifdef WPM_ENABLE
294 uint8_t n = get_current_wpm(); 298 uint8_t n = get_current_wpm();
295# ifdef OLED_DISPLAY_128X64 299 char wpm_counter[4];
296 char wpm_counter[4];
297 wpm_counter[3] = '\0'; 300 wpm_counter[3] = '\0';
298 wpm_counter[2] = '0' + n % 10; 301 wpm_counter[2] = '0' + n % 10;
299 wpm_counter[1] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' '; 302 wpm_counter[1] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
300 wpm_counter[0] = n / 10 ? '0' + n / 10 : ' '; 303 wpm_counter[0] = n / 10 ? '0' + n / 10 : ' ';
301# else
302 char wpm_counter[6];
303 wpm_counter[5] = '\0';
304 wpm_counter[4] = '0' + n % 10;
305 wpm_counter[3] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
306 wpm_counter[2] = n / 10 ? '0' + n / 10 : ' ';
307 wpm_counter[1] = ' ';
308 wpm_counter[0] = ' ';
309# endif
310 oled_write_P(PSTR(OLED_RENDER_WPM_COUNTER), false); 304 oled_write_P(PSTR(OLED_RENDER_WPM_COUNTER), false);
305 if (padding) {
306 for (uint8_t n = padding; n > 0; n--) {
307 oled_write_P(PSTR(" "), false);
308 }
309 }
311 oled_write(wpm_counter, false); 310 oled_write(wpm_counter, false);
312#endif 311#endif
313} 312}
314 313
315#if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right) 314#if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right)
316 315extern kb_config_data_t kb_config;
317extern kb_runtime_config_t kb_state; 316void render_pointing_dpi_status(uint8_t padding) {
318void render_pointing_dpi_status(void) { 317 char dpi_status[5];
319 char dpi_status[6]; 318 uint16_t n = kb_config.device_cpi;
320 uint16_t n = kb_state.device_cpi; 319 dpi_status[4] = '\0';
321 dpi_status[5] = '\0'; 320 dpi_status[3] = '0' + n % 10;
322 dpi_status[4] = '0' + n % 10;
323 dpi_status[3] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
324 dpi_status[2] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' '; 321 dpi_status[2] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
325 dpi_status[1] = n / 10 ? '0' + n / 10 : ' '; 322 dpi_status[1] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
326 dpi_status[0] = ' '; 323 dpi_status[0] = n / 10 ? '0' + n / 10 : ' ';
327 oled_write_P(PSTR(" DPI: "), false); 324 oled_write_P(PSTR("DPI: "), false);
325 if (padding) {
326 for (uint8_t n = padding; n > 0; n--) {
327 oled_write_P(PSTR(" "), false);
328 }
329 }
328 oled_write(dpi_status, false); 330 oled_write(dpi_status, false);
329} 331}
330#endif 332#endif
331 333
332void render_status_secondary(void) { 334__attribute__((weak)) void oled_driver_render_logo_right(void) {
333#if defined(OLED_DISPLAY_128X64) 335#if defined(OLED_DISPLAY_128X64)
334 oled_driver_render_logo(); 336 oled_driver_render_logo();
335#endif
336 /* Show Keyboard Layout */
337 render_default_layer_state(); 337 render_default_layer_state();
338 render_layer_state(); 338 oled_set_cursor(0, 4);
339 render_mod_status(get_mods() | get_oneshot_mods()); 339#else
340#if !defined(OLED_DISPLAY_128X64) && defined(WPM_ENABLE) 340 render_default_layer_state();
341 render_wpm();
342#endif 341#endif
343 // render_keylock_status(host_keyboard_leds());
344} 342}
345 343
346void render_status_main(void) { 344__attribute__((weak)) void oled_driver_render_logo_left(void) {
347#if defined(OLED_DISPLAY_128X64) 345#if defined(OLED_DISPLAY_128X64)
348 oled_driver_render_logo(); 346 oled_driver_render_logo();
349# ifdef DEBUG_MATRIX_SCAN_RATE 347# ifdef DEBUG_MATRIX_SCAN_RATE
350 render_matrix_scan_rate(); 348 render_matrix_scan_rate();
351# elif defined(WPM_ENABLE) 349# elif defined(WPM_ENABLE)
352 render_wpm(); 350 render_wpm(0);
353# endif 351# endif
352 oled_write_P(PSTR(" "), false);
354# if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right) 353# if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right)
355 render_pointing_dpi_status(); 354 render_pointing_dpi_status(1);
356# endif 355# endif
357 oled_write_P(PSTR("\n"), false); 356 oled_set_cursor(0, 4);
358#else 357#else
359 render_default_layer_state(); 358 render_default_layer_state();
360#endif 359#endif
360}
361
362void render_status_secondary(void) {
363 oled_driver_render_logo_right();
364 /* Show Keyboard Layout */
365 render_layer_state();
366 render_mod_status(get_mods() | get_oneshot_mods());
367#if !defined(OLED_DISPLAY_128X64) && defined(WPM_ENABLE)
368 render_wpm(2);
369#endif
370 // render_keylock_status(host_keyboard_leds());
371}
372
373void render_status_main(void) {
374 oled_driver_render_logo_left();
375
361 /* Show Keyboard Layout */ 376 /* Show Keyboard Layout */
362 // render_keylock_status(host_keyboard_leds()); 377 // render_keylock_status(host_keyboard_leds());
363 render_bootmagic_status(); 378 render_bootmagic_status();
diff --git a/users/drashna/oled_stuff.h b/users/drashna/oled_stuff.h
index bba3f39cb..8795684d6 100644
--- a/users/drashna/oled_stuff.h
+++ b/users/drashna/oled_stuff.h
@@ -23,6 +23,19 @@ void oled_driver_render_logo(void);
23bool process_record_user_oled(uint16_t keycode, keyrecord_t *record); 23bool process_record_user_oled(uint16_t keycode, keyrecord_t *record);
24oled_rotation_t oled_init_keymap(oled_rotation_t rotation); 24oled_rotation_t oled_init_keymap(oled_rotation_t rotation);
25extern uint32_t oled_timer; 25extern uint32_t oled_timer;
26void render_keylogger_status(void);
27void render_default_layer_state(void);
28void render_layer_state(void);
29void render_keylock_status(uint8_t led_usb_state);
30void render_matrix_scan_rate(void);
31void render_mod_status(uint8_t modifiers);
32void render_bootmagic_status(void);
33void render_user_status(void);
34void oled_driver_render_logo(void);
35void render_wpm(uint8_t padding);
36void render_pointing_dpi_status(uint8_t padding);
37void oled_driver_render_logo_left(void);
38void oled_driver_render_logo_right(void);
26 39
27#ifdef OLED_DISPLAY_128X64 40#ifdef OLED_DISPLAY_128X64
28# define OLED_RENDER_KEYLOGGER "Keylogger: " 41# define OLED_RENDER_KEYLOGGER "Keylogger: "
diff --git a/users/drashna/post_config.h b/users/drashna/post_config.h
new file mode 100644
index 000000000..7c214b66d
--- /dev/null
+++ b/users/drashna/post_config.h
@@ -0,0 +1,40 @@
1/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19// because layouts seem to not be respecting config.h order atm
20#ifdef RGBLIGHT_ENABLE
21# undef RGBLIGHT_ANIMATIONS
22# if defined(__AVR__) && (!defined(__AVR_AT90USB1286__) && !defined(RGBLIGHT_ALL_ANIMATIONS))
23# define RGBLIGHT_EFFECT_BREATHING
24# define RGBLIGHT_EFFECT_SNAKE
25# define RGBLIGHT_EFFECT_KNIGHT
26# else
27# define RGBLIGHT_EFFECT_BREATHING
28# define RGBLIGHT_EFFECT_RAINBOW_MOOD
29# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
30# define RGBLIGHT_EFFECT_SNAKE
31# define RGBLIGHT_EFFECT_KNIGHT
32# if defined(RGBLIGHT_ALL_ANIMATIONS)
33# define RGBLIGHT_EFFECT_CHRISTMAS
34# define RGBLIGHT_EFFECT_STATIC_GRADIENT
35# define RGBLIGHT_EFFECT_RGB_TEST
36# define RGBLIGHT_EFFECT_ALTERNATING
37# endif
38# define RGBLIGHT_EFFECT_TWINKLE
39# endif
40#endif
diff --git a/users/drashna/process_records.c b/users/drashna/process_records.c
index 1e6ecc1d6..f5e6a867a 100644
--- a/users/drashna/process_records.c
+++ b/users/drashna/process_records.c
@@ -19,13 +19,12 @@
19 19
20uint16_t copy_paste_timer; 20uint16_t copy_paste_timer;
21 21
22__attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
23
24__attribute__((weak)) bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; }
25
26// Defines actions tor my global custom keycodes. Defined in drashna.h file 22// Defines actions tor my global custom keycodes. Defined in drashna.h file
27// Then runs the _keymap's record handier if not processed here 23// Then runs the _keymap's record handier if not processed here
28bool process_record_user(uint16_t keycode, keyrecord_t *record) { 24
25__attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
26__attribute__((weak)) bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; }
27bool process_record_user(uint16_t keycode, keyrecord_t *record) {
29 // If console is enabled, it will print the matrix position and status of each key pressed 28 // If console is enabled, it will print the matrix position and status of each key pressed
30#ifdef KEYLOGGER_ENABLE 29#ifdef KEYLOGGER_ENABLE
31 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); 30 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) {
203 } 202 }
204 return true; 203 return true;
205} 204}
205
206__attribute__((weak)) void post_process_record_keymap(uint16_t keycode, keyrecord_t *record) {}
207void post_process_record_user(uint16_t keycode, keyrecord_t *record) { post_process_record_keymap(keycode, record); }
diff --git a/users/drashna/process_records.h b/users/drashna/process_records.h
index 460d41d4d..231480ac5 100644
--- a/users/drashna/process_records.h
+++ b/users/drashna/process_records.h
@@ -51,6 +51,7 @@ enum userspace_custom_keycodes {
51 51
52bool process_record_secrets(uint16_t keycode, keyrecord_t *record); 52bool process_record_secrets(uint16_t keycode, keyrecord_t *record);
53bool process_record_keymap(uint16_t keycode, keyrecord_t *record); 53bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
54void post_process_record_keymap(uint16_t keycode, keyrecord_t *record);
54 55
55#define LOWER MO(_LOWER) 56#define LOWER MO(_LOWER)
56#define RAISE MO(_RAISE) 57#define RAISE MO(_RAISE)
diff --git a/users/drashna/rgb_matrix_stuff.c b/users/drashna/rgb_matrix_stuff.c
index 5adbd8ab1..97811092c 100644
--- a/users/drashna/rgb_matrix_stuff.c
+++ b/users/drashna/rgb_matrix_stuff.c
@@ -20,11 +20,6 @@
20extern led_config_t g_led_config; 20extern led_config_t g_led_config;
21 21
22static uint32_t hypno_timer; 22static uint32_t hypno_timer;
23#if defined(SPLIT_KEYBOARD) || defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_crkbd)
24# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN_DUAL
25#else
26# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN
27#endif
28 23
29void 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) { 24void 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) {
30 HSV hsv = {hue, sat, val}; 25 HSV hsv = {hue, sat, val};
diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c
index 8a0866539..15108bde0 100644
--- a/users/drashna/rgb_stuff.c
+++ b/users/drashna/rgb_stuff.c
@@ -23,106 +23,19 @@
23bool has_initialized; 23bool has_initialized;
24 24
25void rgblight_sethsv_default_helper(uint8_t index) { rgblight_sethsv_at(rgblight_get_hue(), rgblight_get_sat(), rgblight_get_val(), index); } 25void rgblight_sethsv_default_helper(uint8_t index) { rgblight_sethsv_at(rgblight_get_hue(), rgblight_get_sat(), rgblight_get_val(), index); }
26 26void rgblight_set_hsv_and_mode(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode) {
27# ifdef RGBLIGHT_TWINKLE 27 rgblight_sethsv_noeeprom(hue, sat, val);
28static rgblight_fadeout lights[RGBLED_NUM]; 28 // wait_us(175); // Add a slight delay between color and mode to ensure it's processed correctly
29 29 rgblight_mode_noeeprom(mode);
30/* Handler for fading/twinkling effect */
31void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgblight_sethsv is supppppper intensive
32 bool litup = false;
33
34 for (uint8_t light_index = 0; light_index < RGBLED_NUM; ++light_index) {
35 if (lights[light_index].enabled && sync_timer_elapsed(lights[light_index].timer) > 10) {
36 rgblight_fadeout *light = &lights[light_index];
37 litup = true;
38
39 if (light->life) {
40 light->life -= 1;
41 if (get_highest_layer(layer_state) == 0) {
42 sethsv(light->hue + rand() % 0xF, 255, light->life, (LED_TYPE *)&led[light_index]);
43 }
44 light->timer = sync_timer_read();
45 } else {
46 if (light->enabled && get_highest_layer(layer_state) == 0) {
47 rgblight_sethsv_default_helper(light_index);
48 }
49 litup = light->enabled = false;
50 }
51 }
52 }
53 if (litup && get_highest_layer(layer_state) == 0) {
54 rgblight_set();
55 }
56}
57
58/* Triggers a LED to fade/twinkle.
59 * This function handles the selection of the LED and prepres for it to be used.
60 */
61void start_rgb_light(void) {
62 uint8_t indices[RGBLED_NUM];
63 uint8_t indices_count = 0;
64 uint8_t min_life = 0xFF;
65 uint8_t min_life_index = -1;
66
67 for (uint8_t index = 0; index < RGBLED_NUM; ++index) {
68 if (lights[index].enabled) {
69 if (min_life_index == -1 || lights[index].life < min_life) {
70 min_life = lights[index].life;
71 min_life_index = index;
72 }
73 continue;
74 }
75
76 indices[indices_count] = index;
77 ++indices_count;
78 }
79
80 uint8_t light_index;
81 if (!indices_count) {
82 light_index = min_life_index;
83 } else {
84 light_index = indices[rand() % indices_count];
85 }
86
87 rgblight_fadeout *light = &lights[light_index];
88 light->enabled = true;
89 light->timer = sync_timer_read();
90 light->life = 0xC0 + rand() % 0x40;
91
92 light->hue = rgblight_get_hue() + (rand() % 0xB4) - 0x54;
93
94 rgblight_sethsv_at(light->hue, 255, light->life, light_index);
95} 30}
96# endif
97
98bool process_record_user_rgb_light(uint16_t keycode, keyrecord_t *record) {
99 uint16_t temp_keycode = keycode;
100 // Filter out the actual keycode from MT and LT keys.
101 if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) {
102 temp_keycode &= 0xFF;
103 }
104 31
105 switch (temp_keycode) { 32bool process_record_user_rgb_light(uint16_t keycode, keyrecord_t *record) { return true; }
106# ifdef RGBLIGHT_TWINKLE
107 case KC_A ... KC_SLASH:
108 case KC_F1 ... KC_F12:
109 case KC_INSERT ... KC_UP:
110 case KC_KP_SLASH ... KC_KP_DOT:
111 case KC_F13 ... KC_F24:
112 case KC_AUDIO_MUTE ... KC_MEDIA_REWIND:
113 if (record->event.pressed) {
114 start_rgb_light();
115 }
116 break;
117# endif // RGBLIGHT_TWINKLE
118 }
119 return true;
120}
121 33
122# if defined(RGBLIGHT_STARTUP_ANIMATION) 34# if defined(RGBLIGHT_STARTUP_ANIMATION)
123static bool is_enabled; 35static bool is_enabled;
124static bool is_rgblight_startup; 36static bool is_rgblight_startup;
125static uint8_t old_hue; 37static HSV old_hsv;
38static uint8_t old_mode;
126static uint16_t rgblight_startup_loop_timer; 39static uint16_t rgblight_startup_loop_timer;
127# endif 40# endif
128 41
@@ -130,37 +43,35 @@ void keyboard_post_init_rgb_light(void) {
130# if defined(RGBLIGHT_STARTUP_ANIMATION) 43# if defined(RGBLIGHT_STARTUP_ANIMATION)
131 is_enabled = rgblight_is_enabled(); 44 is_enabled = rgblight_is_enabled();
132 if (userspace_config.rgb_layer_change) { 45 if (userspace_config.rgb_layer_change) {
133 rgblight_enable_noeeprom();
134 }
135 if (rgblight_is_enabled()) {
136 layer_state_set_rgb_light(layer_state); 46 layer_state_set_rgb_light(layer_state);
137 old_hue = rgblight_get_hue();
138 rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
139 is_rgblight_startup = true;
140 } 47 }
48 old_hsv = rgblight_get_hsv();
49 old_mode = rgblight_get_mode();
50 rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
51 is_rgblight_startup = true;
141# endif 52# endif
142 layer_state_set_rgb_light(layer_state); 53 if (userspace_config.rgb_layer_change) {
54 layer_state_set_rgb_light(layer_state);
55 }
143} 56}
144 57
145void matrix_scan_rgb_light(void) { 58void matrix_scan_rgb_light(void) {
146# ifdef RGBLIGHT_TWINKLE
147 scan_rgblight_fadeout();
148# endif // RGBLIGHT_ENABLE
149
150# if defined(RGBLIGHT_STARTUP_ANIMATION) 59# if defined(RGBLIGHT_STARTUP_ANIMATION)
151 if (is_rgblight_startup && is_keyboard_master()) { 60 if (is_rgblight_startup && is_keyboard_master()) {
152 if (sync_timer_elapsed(rgblight_startup_loop_timer) > 10) { 61 if (sync_timer_elapsed(rgblight_startup_loop_timer) > 10) {
153 static uint8_t counter; 62 static uint8_t counter;
154 counter++; 63 counter++;
155 rgblight_sethsv_noeeprom((counter + old_hue) % 255, 255, 255); 64 rgblight_sethsv_noeeprom((counter + old_hsv.h) % 255, 255, 255);
156 rgblight_startup_loop_timer = sync_timer_read(); 65 rgblight_startup_loop_timer = sync_timer_read();
157 if (counter == 255) { 66 if (counter == 255) {
158 is_rgblight_startup = false; 67 is_rgblight_startup = false;
159 if (!is_enabled) {
160 rgblight_disable_noeeprom();
161 }
162 if (userspace_config.rgb_layer_change) { 68 if (userspace_config.rgb_layer_change) {
163 layer_state_set_rgb_light(layer_state); 69 layer_state_set_rgb_light(layer_state);
70 } else {
71 rgblight_set_hsv_and_mode(old_hsv.h, old_hsv.s, old_hsv.v, old_mode);
72 }
73 if (!is_enabled) {
74 rgblight_disable_noeeprom();
164 } 75 }
165 } 76 }
166 } 77 }
@@ -168,12 +79,6 @@ void matrix_scan_rgb_light(void) {
168# endif 79# endif
169} 80}
170 81
171void rgblight_set_hsv_and_mode(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode) {
172 rgblight_sethsv_noeeprom(hue, sat, val);
173 // wait_us(175); // Add a slight delay between color and mode to ensure it's processed correctly
174 rgblight_mode_noeeprom(mode);
175}
176
177layer_state_t layer_state_set_rgb_light(layer_state_t state) { 82layer_state_t layer_state_set_rgb_light(layer_state_t state) {
178# ifdef RGBLIGHT_ENABLE 83# ifdef RGBLIGHT_ENABLE
179 if (userspace_config.rgb_layer_change) { 84 if (userspace_config.rgb_layer_change) {
diff --git a/users/drashna/rgb_stuff.h b/users/drashna/rgb_stuff.h
index 0153adb54..af1acdde7 100644
--- a/users/drashna/rgb_stuff.h
+++ b/users/drashna/rgb_stuff.h
@@ -17,22 +17,9 @@
17#pragma once 17#pragma once
18#include "quantum.h" 18#include "quantum.h"
19 19
20#if defined(RGBLIGHT_TWINKLE)
21typedef struct {
22 bool enabled;
23 uint8_t hue;
24 uint16_t timer;
25 uint8_t life;
26} rgblight_fadeout;
27#endif
28
29bool process_record_user_rgb_light(uint16_t keycode, keyrecord_t *record); 20bool process_record_user_rgb_light(uint16_t keycode, keyrecord_t *record);
30void keyboard_post_init_rgb_light(void); 21void keyboard_post_init_rgb_light(void);
31void matrix_scan_rgb_light(void); 22void matrix_scan_rgb_light(void);
32layer_state_t layer_state_set_rgb_light(layer_state_t state); 23layer_state_t layer_state_set_rgb_light(layer_state_t state);
33layer_state_t default_layer_state_set_rgb_light(layer_state_t state); 24layer_state_t default_layer_state_set_rgb_light(layer_state_t state);
34void rgblight_sethsv_default_helper(uint8_t index); 25void rgblight_sethsv_default_helper(uint8_t index);
35
36#if defined(RGBLIGHT_TWINKLE)
37void scan_rgblight_fadeout(void);
38#endif
diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk
index b93ab1ee6..02a75a7b7 100644
--- a/users/drashna/rules.mk
+++ b/users/drashna/rules.mk
@@ -29,9 +29,6 @@ CUSTOM_RGBLIGHT ?= yes
29ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) 29ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
30 ifeq ($(strip $(CUSTOM_RGBLIGHT)), yes) 30 ifeq ($(strip $(CUSTOM_RGBLIGHT)), yes)
31 SRC += rgb_stuff.c 31 SRC += rgb_stuff.c
32 ifeq ($(strip $(RGBLIGHT_TWINKLE)), yes)
33 OPT_DEFS += -DRGBLIGHT_TWINKLE
34 endif
35 ifeq ($(strip $(RGBLIGHT_NOEEPROM)), yes) 32 ifeq ($(strip $(RGBLIGHT_NOEEPROM)), yes)
36 OPT_DEFS += -DRGBLIGHT_NOEEPROM 33 OPT_DEFS += -DRGBLIGHT_NOEEPROM
37 endif 34 endif
@@ -81,8 +78,12 @@ ifeq ($(strip $(PIMORONI_TRACKBALL_ENABLE)), yes)
81 QUANTUM_LIB_SRC += i2c_master.c 78 QUANTUM_LIB_SRC += i2c_master.c
82endif 79endif
83 80
84ifeq ($(strip $(SPLIT_KEYBOARD)), yes) 81CUSTOM_SPLIT_TRANSPORT_SYNC ?= yes
85 QUANTUM_LIB_SRC += transport_sync.c 82ifeq ($(strip $(CUSTOM_SPLIT_TRANSPORT_SYNC)), yes)
83 ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
84 QUANTUM_LIB_SRC += transport_sync.c
85 OPT_DEFS += -DCUSTOM_SPLIT_TRANSPORT_SYNC
86 endif
86endif 87endif
87 88
88# DEBUG_MATRIX_SCAN_RATE_ENABLE = api 89# DEBUG_MATRIX_SCAN_RATE_ENABLE = api
diff --git a/users/drashna/transport_sync.c b/users/drashna/transport_sync.c
index c3ef2eff5..fdd596c04 100644
--- a/users/drashna/transport_sync.c
+++ b/users/drashna/transport_sync.c
@@ -1,30 +1,44 @@
1#ifdef SPLIT_TRANSACTION_IDS_USER 1/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
2# include "transport_sync.h" 2 *
3# include "transactions.h" 3 * This program is free software: you can redistribute it and/or modify
4# include <string.h> 4 * it under the terms of the GNU General Public License as published by
5 5 * the Free Software Foundation, either version 2 of the License, or
6# ifdef UNICODE_ENABLE 6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "transport_sync.h"
18#include "transactions.h"
19#include <string.h>
20
21#ifdef UNICODE_ENABLE
7extern unicode_config_t unicode_config; 22extern unicode_config_t unicode_config;
8# endif 23#endif
9# ifdef AUDIO_ENABLE 24#ifdef AUDIO_ENABLE
10# include "audio.h" 25# include "audio.h"
11# endif 26extern bool delayed_tasks_run;
12# if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform) 27#endif
28#if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
13extern bool tap_toggling; 29extern bool tap_toggling;
14# endif 30#endif
15# ifdef SWAP_HANDS_ENABLE 31#ifdef SWAP_HANDS_ENABLE
16extern bool swap_hands; 32extern bool swap_hands;
17# endif 33#endif
18extern userspace_config_t userspace_config; 34extern userspace_config_t userspace_config;
19 35
20typedef struct { 36__attribute__((aligned(8))) typedef struct {
21 bool oled_on; 37 bool audio_enable;
22 bool audio_enable; 38 bool audio_clicky_enable;
23 bool audio_clicky_enable; 39 bool tap_toggling;
24 bool tap_toggling; 40 bool unicode_mode;
25 bool unicode_mode; 41 bool swap_hands;
26 bool swap_hands;
27 uint8_t reserved :2;
28} user_runtime_config_t; 42} user_runtime_config_t;
29 43
30uint16_t transport_keymap_config = 0; 44uint16_t transport_keymap_config = 0;
@@ -57,58 +71,49 @@ void keyboard_post_init_transport_sync(void) {
57 71
58void user_transport_update(void) { 72void user_transport_update(void) {
59 if (is_keyboard_master()) { 73 if (is_keyboard_master()) {
60# ifdef OLED_DRIVER_ENABLE
61 user_state.oled_on = is_oled_on();
62# endif
63
64 transport_keymap_config = keymap_config.raw; 74 transport_keymap_config = keymap_config.raw;
65 transport_userspace_config = userspace_config.raw; 75 transport_userspace_config = userspace_config.raw;
66# ifdef AUDIO_ENABLE 76#ifdef AUDIO_ENABLE
67 user_state.audio_enable = is_audio_on(); 77 user_state.audio_enable = is_audio_on();
68 user_state.audio_clicky_enable = is_clicky_on(); 78 user_state.audio_clicky_enable = is_clicky_on();
69# endif 79#endif
70# if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform) 80#if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
71 user_state.tap_toggling = tap_toggling; 81 user_state.tap_toggling = tap_toggling;
72# endif 82#endif
73# ifdef SWAP_HANDS_ENABLE 83#ifdef SWAP_HANDS_ENABLE
74 user_state.swap_hands = swap_hands; 84 user_state.swap_hands = swap_hands;
75# endif 85#endif
76 86
77 } else { 87 } else {
78# ifdef OLED_DRIVER_ENABLE
79 if (user_state.oled_on) {
80 oled_on();
81 } else {
82 oled_off();
83 }
84# endif
85 keymap_config.raw = transport_keymap_config; 88 keymap_config.raw = transport_keymap_config;
86 userspace_config.raw = transport_userspace_config; 89 userspace_config.raw = transport_userspace_config;
87# ifdef UNICODE_ENABLE 90#ifdef UNICODE_ENABLE
88 unicode_config.input_mode = user_state.unicode_mode; 91 unicode_config.input_mode = user_state.unicode_mode;
89# endif 92#endif
90# ifdef AUDIO_ENABLE 93#ifdef AUDIO_ENABLE
91 if (user_state.audio_enable != is_audio_on()) { 94 if (delayed_tasks_run) {
92 if (user_state.audio_enable) { 95 if (user_state.audio_enable != is_audio_on()) {
93 audio_on(); 96 if (user_state.audio_enable) {
94 } else { 97 audio_on();
95 audio_off(); 98 } else {
99 audio_off();
100 }
96 } 101 }
97 } 102 if (user_state.audio_clicky_enable != is_clicky_on()) {
98 if (user_state.audio_clicky_enable != is_clicky_on()) { 103 if (user_state.audio_clicky_enable) {
99 if (user_state.audio_clicky_enable) { 104 clicky_on();
100 clicky_on(); 105 } else {
101 } else { 106 clicky_off();
102 clicky_off(); 107 }
103 } 108 }
104 } 109 }
105# endif 110#endif
106# if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform) 111#if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
107 tap_toggling = user_state.tap_toggling; 112 tap_toggling = user_state.tap_toggling;
108# endif 113#endif
109# ifdef SWAP_HANDS_ENABLE 114#ifdef SWAP_HANDS_ENABLE
110 swap_hands = user_state.swap_hands; 115 swap_hands = user_state.swap_hands;
111# endif 116#endif
112 } 117 }
113} 118}
114 119
@@ -185,4 +190,3 @@ void housekeeping_task_user(void) {
185 // Data sync from master to slave 190 // Data sync from master to slave
186 user_transport_sync(); 191 user_transport_sync();
187} 192}
188#endif