1
0
Fork 0

[Keymap] Update to Drashna Code (#14644)

This commit is contained in:
Drashna Jaelre 2021-09-29 11:16:11 -07:00 committed by GitHub
parent 929d959ef9
commit 1e54796f0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 180 additions and 51 deletions

View file

@ -97,6 +97,143 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#ifdef OLED_ENABLE #ifdef OLED_ENABLE
oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { return OLED_ROTATION_270; } oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { return OLED_ROTATION_270; }
# ifdef CONVERT_TO_PROTON_C
// WPM-responsive animation stuff here
# define SLEEP_FRAMES 2
# define SLEEP_SPEED 10 // below this wpm value your animation will idle
# define WAKE_FRAMES 2 // uncomment if >1
# define KAKI_FRAMES 3
# define KAKI_SPEED 40 // above this wpm value typing animation to triggere
# define RTOGI_FRAMES 2
//#define LTOGI_FRAMES 2
//#define ANIM_FRAME_DURATION 500 // how long each frame lasts in ms
// #define SLEEP_TIMER 60000 // should sleep after this period of 0 wpm, needs fixing
# define ANIM_SIZE 512 // number of bytes in array, minimize for adequate firmware size, max is 1024
uint32_t anim_timer = 0;
uint32_t anim_frame_duration = 500;
uint8_t current_sleep_frame = 0;
uint8_t current_wake_frame = 0; // uncomment if WAKE_FRAMES >1
uint8_t current_kaki_frame = 0;
uint8_t current_rtogi_frame = 0;
// uint8_t current_ltogi_frame = 0;
// clang-format off
void render_kitty(void) {
// Images credit j-inc(/James Incandenza) and pixelbenny. Credit to obosob for initial animation approach.
static const char PROGMEM sleep[SLEEP_FRAMES][ANIM_SIZE] = {{
// 'sleep1', 32x32px
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, 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, 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, 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,
},
{// 'sleep2', 32x32px
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x3a, 0x2a, 0x26, 0x22, 0x80, 0xc0, 0x80, 0x00, 0x24, 0x34, 0x2c, 0xe4, 0x60, 0x10, 0x70, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 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
}};
static const char PROGMEM wake[WAKE_FRAMES][ANIM_SIZE] = {{
// 'mati2', 32x32px
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, 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, 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, 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
},
{// 'mati3', 32x32px
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, 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, 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, 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
}};
static const char PROGMEM kaki[KAKI_FRAMES][ANIM_SIZE] = {{
// 'jare2', 32x32px
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, 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, 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, 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
},
{
// 'kaki1', 32x32px
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, 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, 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, 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
},
{// 'kaki2', 32x32px
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, 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, 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, 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,
}};
static const char PROGMEM rtogi[KAKI_FRAMES][ANIM_SIZE] = {{
// 'rtogi1', 32x32px
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, 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,
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, 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
},
{// 'rtogi2', 32x32px
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, 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,
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, 0x01, 0x01, 0x01, 0x06, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 0x04, 0x07, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}};
// assumes 1 frame prep stage
extern bool swap_hands;
void animation_phase(void) {
if (swap_hands) {
anim_frame_duration = 300;
current_rtogi_frame = (current_rtogi_frame + 1) % RTOGI_FRAMES;
oled_write_raw_P(rtogi[abs((RTOGI_FRAMES - 1) - current_rtogi_frame)], ANIM_SIZE);
} else {
if (get_current_wpm() <= SLEEP_SPEED) {
anim_frame_duration = 500;
current_sleep_frame = (current_sleep_frame + 1) % SLEEP_FRAMES;
oled_write_raw_P(sleep[abs((SLEEP_FRAMES - 1) - current_sleep_frame)], ANIM_SIZE);
}
// if(get_current_wpm() >IDLE_SPEED && get_current_wpm() <TAP_SPEED){
if (get_current_wpm() > SLEEP_SPEED) {
anim_frame_duration = 800;
current_wake_frame = (current_wake_frame + 1) % WAKE_FRAMES;
oled_write_raw_P(wake[abs((WAKE_FRAMES - 1) - current_wake_frame)], ANIM_SIZE);
// oled_write_raw_P(wake[0], ANIM_SIZE); // remove if IDLE_FRAMES >1
}
if (get_current_wpm() >= KAKI_SPEED) {
anim_frame_duration = 500;
current_kaki_frame = (current_kaki_frame + 1) % KAKI_FRAMES;
oled_write_raw_P(kaki[abs((KAKI_FRAMES - 1) - current_kaki_frame)], ANIM_SIZE);
}
}
}
if (get_current_wpm() != 000) {
// if(timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) {
if (timer_elapsed32(anim_timer) > anim_frame_duration) {
anim_timer = timer_read32();
animation_phase();
}
} else {
// if(timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) {
if (timer_elapsed32(anim_timer) > anim_frame_duration) {
anim_timer = timer_read32();
animation_phase();
}
}
}
void oled_driver_render_logo_right(void) {
render_kitty();
oled_set_cursor(0, 4);
render_default_layer_state();
}
# endif
#endif #endif
#ifdef TAPPING_TERM_PER_KEY #ifdef TAPPING_TERM_PER_KEY
@ -111,10 +248,6 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
#endif #endif
#ifdef RGB_MATRIX_ENABLE #ifdef RGB_MATRIX_ENABLE
void suspend_power_down_keymap(void) { rgb_matrix_set_suspend_state(true); }
void suspend_wakeup_init_keymap(void) { rgb_matrix_set_suspend_state(false); }
void check_default_layer(uint8_t mode, uint8_t type, uint8_t led_min, uint8_t led_max) { void check_default_layer(uint8_t mode, uint8_t type, uint8_t led_min, uint8_t led_max) {
switch (get_highest_layer(default_layer_state)) { switch (get_highest_layer(default_layer_state)) {
case _QWERTY: case _QWERTY:

View file

@ -73,11 +73,6 @@ void matrix_init_user(void) {
matrix_init_secret(); matrix_init_secret();
matrix_init_keymap(); matrix_init_keymap();
#if defined(AUDIO_ENABLE) && defined(SPLIT_KEYBOARD)
if (!is_keyboard_master()) {
stop_all_notes();
}
#endif
} }
__attribute__((weak)) void keyboard_post_init_keymap(void) {} __attribute__((weak)) void keyboard_post_init_keymap(void) {}
@ -227,16 +222,15 @@ bool hasAllBitsInMask(uint8_t value, uint8_t mask) {
} }
#ifdef SPLIT_KEYBOARD #ifdef SPLIT_KEYBOARD
# if defined(AUDIO_ENABLE)
bool delayed_tasks_run = false;
# endif
__attribute__((weak)) void matrix_slave_scan_keymap(void) {} __attribute__((weak)) void matrix_slave_scan_keymap(void) {}
void matrix_slave_scan_user(void) { void matrix_slave_scan_user(void) {
# if defined(AUDIO_ENABLE) # if defined(AUDIO_ENABLE)
# if !defined(NO_MUSIC_MODE) # if !defined(NO_MUSIC_MODE)
music_task(); music_task();
# endif # endif
# ifdef AUDIO_INIT_DELAY
if (!is_keyboard_master()) { if (!is_keyboard_master()) {
static bool delayed_tasks_run = false;
static uint16_t delayed_task_timer = 0; static uint16_t delayed_task_timer = 0;
if (!delayed_tasks_run) { if (!delayed_tasks_run) {
if (!delayed_task_timer) { if (!delayed_task_timer) {
@ -247,6 +241,7 @@ void matrix_slave_scan_user(void) {
} }
} }
} }
# endif
# endif # endif
# ifdef SEQUENCER_ENABLE # ifdef SEQUENCER_ENABLE
sequencer_task(); sequencer_task();

View file

@ -62,6 +62,9 @@ void add_keylog(uint16_t keycode, keyrecord_t *record) {
return; return;
} }
} }
if (keycode > 0xFF) {
return;
}
for (uint8_t i = 1; i < KEYLOGGER_LENGTH; i++) { for (uint8_t i = 1; i < KEYLOGGER_LENGTH; i++) {
keylog_str[i - 1] = keylog_str[i]; keylog_str[i - 1] = keylog_str[i];
@ -250,6 +253,17 @@ extern bool tap_toggling;
#endif #endif
void render_user_status(void) { void render_user_status(void) {
#ifdef AUDIO_ENABLE
bool is_audio_on = false, is_clicky_on = false;
# ifdef SPLIT_KEYBOARD
is_audio_on = user_state.audio_enable;
is_clicky_on = user_state.audio_clicky_enable;
# else
is_audio_on = is_audio_on();
is_clicky_on = is_clicky_on();
# endif
#endif
oled_write_P(PSTR(OLED_RENDER_USER_NAME), false); oled_write_P(PSTR(OLED_RENDER_USER_NAME), false);
#if !defined(OLED_DISPLAY_128X64) #if !defined(OLED_DISPLAY_128X64)
oled_write_P(PSTR(" "), false); oled_write_P(PSTR(" "), false);
@ -265,11 +279,11 @@ void render_user_status(void) {
#endif #endif
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
static const char PROGMEM audio_status[2][3] = {{0xE0, 0xE1, 0}, {0xE2, 0xE3, 0}}; static const char PROGMEM audio_status[2][3] = {{0xE0, 0xE1, 0}, {0xE2, 0xE3, 0}};
oled_write_P(audio_status[is_audio_on()], false); oled_write_P(audio_status[is_audio_on], false);
# ifdef AUDIO_CLICKY # ifdef AUDIO_CLICKY
static const char PROGMEM audio_clicky_status[2][3] = {{0xF4, 0xF5, 0}, {0xF6, 0xF7, 0}}; static const char PROGMEM audio_clicky_status[2][3] = {{0xF4, 0xF5, 0}, {0xF6, 0xF7, 0}};
oled_write_P(audio_clicky_status[is_clicky_on() && is_audio_on()], false); oled_write_P(audio_clicky_status[is_clicky_on && is_audio_on], false);
# if !defined(OLED_DISPLAY_128X64) # if !defined(OLED_DISPLAY_128X64)
oled_write_P(PSTR(" "), false); oled_write_P(PSTR(" "), false);
# endif # endif
@ -370,7 +384,7 @@ void render_status_secondary(void) {
/* Show Keyboard Layout */ /* Show Keyboard Layout */
render_layer_state(); render_layer_state();
render_mod_status(get_mods() | get_oneshot_mods()); render_mod_status(get_mods() | get_oneshot_mods());
#if !defined(OLED_DISPLAY_128X64) && defined(WPM_ENABLE) #if !defined(OLED_DISPLAY_128X64) && defined(WPM_ENABLE) && !defined(CONVERT_TO_PROTON_C)
render_wpm(2); render_wpm(2);
#endif #endif
// render_keylock_status(host_keyboard_leds()); // render_keylock_status(host_keyboard_leds());

View file

@ -1,5 +1,5 @@
SRC += drashna.c \ SRC += $(USER_PATH)/drashna.c \
process_records.c $(USER_PATH)/process_records.c
ifneq ($(PLATFORM),CHIBIOS) ifneq ($(PLATFORM),CHIBIOS)
ifneq ($(strip $(LTO_SUPPORTED)), no) ifneq ($(strip $(LTO_SUPPORTED)), no)
@ -11,7 +11,7 @@ GRAVE_ESC_ENABLE = no
ifneq ($(strip $(NO_SECRETS)), yes) ifneq ($(strip $(NO_SECRETS)), yes)
ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") ifneq ("$(wildcard $(USER_PATH)/secrets.c)","")
SRC += secrets.c SRC += $(USER_PATH)/secrets.c
endif endif
ifeq ($(strip $(NO_SECRETS)), lite) ifeq ($(strip $(NO_SECRETS)), lite)
OPT_DEFS += -DNO_SECRETS OPT_DEFS += -DNO_SECRETS
@ -21,14 +21,14 @@ endif
CUSTOM_TAP_DANCE ?= yes CUSTOM_TAP_DANCE ?= yes
ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
SRC += tap_dances.c SRC += $(USER_PATH)/tap_dances.c
endif endif
endif endif
CUSTOM_RGBLIGHT ?= yes CUSTOM_RGBLIGHT ?= yes
ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
ifeq ($(strip $(CUSTOM_RGBLIGHT)), yes) ifeq ($(strip $(CUSTOM_RGBLIGHT)), yes)
SRC += rgb_stuff.c SRC += $(USER_PATH)/rgb_stuff.c
ifeq ($(strip $(RGBLIGHT_NOEEPROM)), yes) ifeq ($(strip $(RGBLIGHT_NOEEPROM)), yes)
OPT_DEFS += -DRGBLIGHT_NOEEPROM OPT_DEFS += -DRGBLIGHT_NOEEPROM
endif endif
@ -41,7 +41,7 @@ endif
CUSTOM_RGB_MATRIX ?= yes CUSTOM_RGB_MATRIX ?= yes
ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
ifeq ($(strip $(CUSTOM_RGB_MATRIX)), yes) ifeq ($(strip $(CUSTOM_RGB_MATRIX)), yes)
SRC += rgb_matrix_stuff.c SRC += $(USER_PATH)/rgb_matrix_stuff.c
endif endif
endif endif
@ -66,7 +66,7 @@ endif
CUSTOM_OLED_DRIVER ?= yes CUSTOM_OLED_DRIVER ?= yes
ifeq ($(strip $(OLED_ENABLE)), yes) ifeq ($(strip $(OLED_ENABLE)), yes)
ifeq ($(strip $(CUSTOM_OLED_DRIVER)), yes) ifeq ($(strip $(CUSTOM_OLED_DRIVER)), yes)
SRC += oled_stuff.c SRC += $(USER_PATH)/oled_stuff.c
OPT_DEFS += -DCUSTOM_OLED_DRIVER_CODE OPT_DEFS += -DCUSTOM_OLED_DRIVER_CODE
endif endif
endif endif
@ -81,7 +81,7 @@ endif
CUSTOM_SPLIT_TRANSPORT_SYNC ?= yes CUSTOM_SPLIT_TRANSPORT_SYNC ?= yes
ifeq ($(strip $(CUSTOM_SPLIT_TRANSPORT_SYNC)), yes) ifeq ($(strip $(CUSTOM_SPLIT_TRANSPORT_SYNC)), yes)
ifeq ($(strip $(SPLIT_KEYBOARD)), yes) ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
QUANTUM_LIB_SRC += transport_sync.c QUANTUM_LIB_SRC += $(USER_PATH)/transport_sync.c
OPT_DEFS += -DCUSTOM_SPLIT_TRANSPORT_SYNC OPT_DEFS += -DCUSTOM_SPLIT_TRANSPORT_SYNC
endif endif
endif endif

View file

@ -23,7 +23,8 @@ extern unicode_config_t unicode_config;
#endif #endif
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
# include "audio.h" # include "audio.h"
extern bool delayed_tasks_run; extern audio_config_t audio_config;
extern bool delayed_tasks_run;
#endif #endif
#if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform) #if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
extern bool tap_toggling; extern bool tap_toggling;
@ -33,14 +34,6 @@ extern bool swap_hands;
#endif #endif
extern userspace_config_t userspace_config; extern userspace_config_t userspace_config;
__attribute__((aligned(8))) typedef struct {
bool audio_enable;
bool audio_clicky_enable;
bool tap_toggling;
bool unicode_mode;
bool swap_hands;
} user_runtime_config_t;
uint16_t transport_keymap_config = 0; uint16_t transport_keymap_config = 0;
uint32_t transport_userspace_config = 0; uint32_t transport_userspace_config = 0;
@ -80,34 +73,18 @@ void user_transport_update(void) {
#if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform) #if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
user_state.tap_toggling = tap_toggling; user_state.tap_toggling = tap_toggling;
#endif #endif
#ifdef UNICODE_ENABLE
user_state.unicode_mode = unicode_config.input_mode;
#endif
#ifdef SWAP_HANDS_ENABLE #ifdef SWAP_HANDS_ENABLE
user_state.swap_hands = swap_hands; user_state.swap_hands = swap_hands;
#endif #endif
} else { } else {
keymap_config.raw = transport_keymap_config; keymap_config.raw = transport_keymap_config;
userspace_config.raw = transport_userspace_config; userspace_config.raw = transport_userspace_config;
#ifdef UNICODE_ENABLE #ifdef UNICODE_ENABLE
unicode_config.input_mode = user_state.unicode_mode; unicode_config.input_mode = user_state.unicode_mode;
#endif #endif
#ifdef AUDIO_ENABLE
if (delayed_tasks_run) {
if (user_state.audio_enable != is_audio_on()) {
if (user_state.audio_enable) {
audio_on();
} else {
audio_off();
}
}
if (user_state.audio_clicky_enable != is_clicky_on()) {
if (user_state.audio_clicky_enable) {
clicky_on();
} else {
clicky_off();
}
}
}
#endif
#if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform) #if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
tap_toggling = user_state.tap_toggling; tap_toggling = user_state.tap_toggling;
#endif #endif

View file

@ -19,4 +19,14 @@
#include "drashna.h" #include "drashna.h"
__attribute__((aligned(8))) typedef struct {
bool audio_enable;
bool audio_clicky_enable;
bool tap_toggling;
bool unicode_mode;
bool swap_hands;
} user_runtime_config_t;
extern user_runtime_config_t user_state;
void keyboard_post_init_transport_sync(void); void keyboard_post_init_transport_sync(void);