[Keymap] Drashna updates for 0.20.0 (#19960)

This commit is contained in:
Drashna Jaelre 2023-02-28 11:14:48 -08:00 committed by GitHub
parent 05631b276d
commit 051401175d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 459 additions and 346 deletions

View file

@ -37,6 +37,9 @@
# undef POINTING_DEVICE_CS_PIN
# define POINTING_DEVICE_CS_PIN A15 // b14
# define PMW33XX_LIFTOFF_DISTANCE 0b1111
# define RGB_MATRIX_LED_FLUSH_LIMIT 33
# define RGB_MATRIX_LED_PROCESS_LIMIT 29
#endif
#undef ROTATIONAL_TRANSFORM_ANGLE

View file

@ -16,6 +16,7 @@
*/
#include "drashna.h"
// clang-format off
#define LAYOUT_charybdis_4x6_wrapper(...) LAYOUT_charybdis_4x6(__VA_ARGS__)
#define LAYOUT_charybdis_4x6_base( \
K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
@ -26,14 +27,13 @@
KC_ESC, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, UC_CLUE, \
SH_TT, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, SH_TT, \
LALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(K1B), \
OS_LSFT,CTL_T(K21), K22, K23, K24, K25, K26,K27,RGUI_T(K28),RALT_T(K29),RCTL_T(K2A), OS_RSFT, \
OS_LSFT,CTL_T(K21),ALT_T(K22),GUI_T(K23),K24,K25, K26,K27,RGUI_T(K28),RALT_T(K29),RCTL_T(K2A), OS_RSFT, \
SFT_T(KC_GRV), OS_LALT, OS_LGUI, TT(_MOUSE), KC_ENT, \
KC_SPC, BK_LWER, DL_RAIS \
)
#define LAYOUT_base_wrapper(...) LAYOUT_charybdis_4x6_base(__VA_ARGS__)
// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_DEFAULT_LAYER_1] = LAYOUT_base_wrapper(
_________________QWERTY_L1_________________, _________________QWERTY_R1_________________,
@ -120,13 +120,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
// clang-format on
void keyboard_post_init_keymap(void) {
#ifdef RGB_MATRIX_ENABLE
g_led_config.flags[53] = g_led_config.flags[54] = g_led_config.flags[55] =
g_led_config.flags[0] = g_led_config.flags[1] = g_led_config.flags[2] = g_led_config.flags[3] =
g_led_config.flags[29] = g_led_config.flags[30] = g_led_config.flags[31] = g_led_config.flags[32] =
LED_FLAG_MODIFIER;
g_led_config.flags[53] = g_led_config.flags[54] = g_led_config.flags[55] = g_led_config.flags[0] = g_led_config.flags[1] = g_led_config.flags[2] = g_led_config.flags[3] = g_led_config.flags[29] = g_led_config.flags[30] = g_led_config.flags[31] = g_led_config.flags[32] = LED_FLAG_MODIFIER;
#endif
}
@ -171,8 +167,8 @@ const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
{{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}},
{{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}, {5, 2}},
{{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}},
{{0, 4}, {3, 4}, {2, 4}, {5, 4}, {4, 4}, {2, 4}},
};
{{0, 4}, {3, 4}, {2, 4}, {5, 4}, {4, 4}, {2, 4}}
};
# ifdef ENCODER_MAP_ENABLE
const uint8_t PROGMEM encoder_hand_swap_config[NUM_ENCODERS] = {1, 0};

View file

@ -37,8 +37,7 @@ ifeq ($(strip $(OVERLOAD_FEATURES)), yes)
NKRO_ENABLE = yes # Enable N-Key Rollover
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
KEYBOARD_SHARED_EP = yes
MOUSE_SHARED_EP = yes
MOUSE_SHARED_EP = no
AUTOCORRECT_ENABLE = yes
CAPS_WORD_ENABLE = yes

View file

@ -133,14 +133,24 @@ bool oled_task_keymap(void) {
// render_rgb_hsv(1, 13);
oled_set_cursor(1, 13);
// oled_write_P(PSTR("Timer:"), false);
// oled_write(get_u8_str((uint8_t)(timer_elapsed32(oled_timer) / 1000), ' '), false);
oled_write_P(PSTR("Status: "), false);
if (is_oled_enabled) {
oled_write_P(PSTR("on "), false);
} else {
oled_write_P(PSTR("off"), false);
}
oled_write_P(PSTR("OS: "), false);
extern os_variant_t os_type;
switch (os_type) {
case OS_LINUX:
oled_write_ln_P(PSTR("Linux"), false);
break;
case OS_WINDOWS:
oled_write_ln_P(PSTR("Windows"), false);
break;
case OS_MACOS:
oled_write_ln_P(PSTR("MacOS"), false);
break;
case OS_IOS:
oled_write_ln_P(PSTR("iOS"), false);
break;
default:
break;
}
render_keylogger_status(1, 14);

View file

@ -130,25 +130,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, KC_NUKE, _______
),
};
// clang-format on
#ifdef ENCODER_ENABLE
#ifdef ENCODER_MAP_ENABLE
# ifdef ENCODER_MAP_ENABLE
// clang-format off
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[_DEFAULT_LAYER_1] = { { KC_VOLD, KC_VOLU }, { KC_WH_D, KC_WH_U } },
[_DEFAULT_LAYER_2] = { { _______, _______ }, { _______, _______ } },
[_DEFAULT_LAYER_3] = { { _______, _______ }, { _______, _______ } },
[_DEFAULT_LAYER_4] = { { _______, _______ }, { _______, _______ } },
[_GAMEPAD] = { { _______, _______ }, { _______, _______ } },
[_DIABLO] = { { _______, _______ }, { _______, _______ } },
[_MOUSE] = { { _______, _______ }, { KC_WH_D, KC_WH_U } },
[_MEDIA] = { { _______, _______ }, { _______, _______ } },
[_RAISE] = { { _______, _______ }, { KC_PGDN, KC_PGUP } },
[_LOWER] = { { RGB_MOD, RGB_RMOD}, { RGB_HUD, RGB_HUI } },
[_ADJUST] = { { CK_DOWN, CK_UP }, { _______, _______ } },
[_DEFAULT_LAYER_1] = { ENCODER_CCW_CW( KC_VOLD, KC_VOLU ), ENCODER_CCW_CW( KC_WH_D, KC_WH_U ) },
[_DEFAULT_LAYER_2] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( _______, _______ ) },
[_DEFAULT_LAYER_3] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( _______, _______ ) },
[_DEFAULT_LAYER_4] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( _______, _______ ) },
[_GAMEPAD] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( _______, _______ ) },
[_DIABLO] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( _______, _______ ) },
[_MOUSE] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( KC_WH_D, KC_WH_U ) },
[_MEDIA] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( _______, _______ ) },
[_RAISE] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( KC_PGDN, KC_PGUP ) },
[_LOWER] = { ENCODER_CCW_CW( RGB_MOD, RGB_RMOD), ENCODER_CCW_CW( RGB_HUD, RGB_HUI ) },
[_ADJUST] = { ENCODER_CCW_CW( CK_DOWN, CK_UP ), ENCODER_CCW_CW( _______, _______ ) },
};
// clang-format on
#else
# else
deferred_token encoder_token = INVALID_DEFERRED_TOKEN;
static int8_t last_direction = -1;
@ -160,11 +161,11 @@ static uint32_t encoder_callback(uint32_t trigger_time, void *cb_arg) {
}
bool encoder_update_user(uint8_t index, bool clockwise) {
# ifdef SWAP_HANDS_ENABLE
# ifdef SWAP_HANDS_ENABLE
if (swap_hands) {
index ^= 1;
}
# endif
# endif
if (index == 0) {
tap_code_delay(clockwise ? KC_VOLD : KC_VOLU, 5);
} else if (index == 1) {
@ -185,7 +186,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
}
return false;
}
#endif
# endif
#endif
#ifdef OLED_ENABLE
@ -214,4 +215,8 @@ void oled_render_large_display(bool side) {
render_unicode_mode(1, 14);
}
}
void render_oled_title(bool side) {
oled_write_P(side ? PSTR(" Tractyl ") : PSTR(" Manuform "), true);
}
#endif

View file

@ -20,7 +20,7 @@
#define TT_MDIA TT(_MEDIA)
// enum more_custom_keycodes {
// KC_P00 = NEW_SAFE_RANGE
// KC_P00 = USER_SAFE_RANGE
//};
// clang-format off

View file

@ -16,7 +16,9 @@
#include "drashna.h"
enum more_custom_keycodes { KC_SWAP_NUM = NEW_SAFE_RANGE };
enum more_custom_keycodes {
KC_SWAP_NUM = USER_SAFE_RANGE,
};
// clang-format off
#define LAYOUT_moonlander_wrapper(...) LAYOUT_moonlander(__VA_ARGS__)

View file

@ -17,6 +17,8 @@
*/
#include QMK_KEYBOARD_H
// safe range starts at `USER_SAFE_RANGE` instead.
// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
@ -26,6 +28,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
// clang-format on
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW( KC_WH_D, KC_WH_U ) },
[1] = { ENCODER_CCW_CW( RGB_HUD, RGB_HUI ) },
};
#endif
#ifdef RGBLIGHT_ENABLE
void eeconkfig_init_user(void) {
rgblight_enable();

View file

@ -41,14 +41,21 @@
#define QMK_ESC_INPUT D4
#define QMK_ESC_OUTPUT B2
#define BOOTMAGIC_LITE_ROW 0
#define BOOTMAGIC_LITE_COLUMN 7
#define BOOTMAGIC_LITE_ROW_RIGHT 4
#define BOOTMAGIC_LITE_COLUMN_RIGHT 7
#ifndef KEYBOARD_splitkb_kyria_rev3
# define BOOTMAGIC_LITE_ROW 0
# define BOOTMAGIC_LITE_COLUMN 7
# define BOOTMAGIC_LITE_ROW_RIGHT 4
# define BOOTMAGIC_LITE_COLUMN_RIGHT 7
#define BOOTMAGIC_LITE_EEPROM_ROW 1
#define BOOTMAGIC_LITE_EEPROM_COLUMN 7
#define BOOTMAGIC_LITE_EEPROM_ROW_RIGHT 5
#define BOOTMAGIC_LITE_EEPROM_COLUMN_RIGHT 7
# define BOOTMAGIC_LITE_EEPROM_ROW 1
# define BOOTMAGIC_LITE_EEPROM_COLUMN 7
# define BOOTMAGIC_LITE_EEPROM_ROW_RIGHT 5
# define BOOTMAGIC_LITE_EEPROM_COLUMN_RIGHT 7
#endif
#define SERIAL_USART_SPEED 921600
#if defined(KEYBOARD_splitkb_kyria_rev1_proton_c)
# define WEAR_LEVELING_BACKING_SIZE 16384
# define WEAR_LEVELING_LOGICAL_SIZE 8192
#endif

View file

@ -105,34 +105,39 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[_DEFAULT_LAYER_1] = { { KC_VOLD, KC_VOLU }, { KC_WH_D, KC_WH_U } },
[_DEFAULT_LAYER_2] = { { _______, _______ }, { _______, _______ } },
[_DEFAULT_LAYER_3] = { { _______, _______ }, { _______, _______ } },
[_DEFAULT_LAYER_4] = { { _______, _______ }, { _______, _______ } },
[_GAMEPAD] = { { _______, _______ }, { _______, _______ } },
[_DIABLO] = { { _______, _______ }, { _______, _______ } },
[_MOUSE] = { { _______, _______ }, { KC_WH_D, KC_WH_U } },
[_MEDIA] = { { _______, _______ }, { _______, _______ } },
[_RAISE] = { { _______, _______ }, { KC_PGDN, KC_PGUP } },
[_LOWER] = { { RGB_MOD, RGB_RMOD}, { RGB_HUD, RGB_HUI } },
[_ADJUST] = { { CK_DOWN, CK_UP }, { _______, _______ } },
[_DEFAULT_LAYER_1] = { ENCODER_CCW_CW( KC_VOLD, KC_VOLU ), ENCODER_CCW_CW( KC_WH_D, KC_WH_U ) },
[_DEFAULT_LAYER_2] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( _______, _______ ) },
[_DEFAULT_LAYER_2] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( _______, _______ ) },
[_DEFAULT_LAYER_2] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( _______, _______ ) },
[_GAMEPAD] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( _______, _______ ) },
[_DIABLO] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( _______, _______ ) },
[_MOUSE] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( KC_WH_D, KC_WH_U ) },
[_MEDIA] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( _______, _______ ) },
[_RAISE] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( KC_PGDN, KC_PGUP ) },
[_LOWER] = { ENCODER_CCW_CW( RGB_MOD, RGB_RMOD), ENCODER_CCW_CW( RGB_HUD, RGB_HUI ) },
[_ADJUST] = { ENCODER_CCW_CW( CK_DOWN, CK_UP ), ENCODER_CCW_CW( _______, _______ ) },
};
#endif
// clang-format on
#ifdef OLED_ENABLE
void render_oled_title(bool side) {
oled_write_P(side ? PSTR(" Splitkb ") : PSTR(" Kyria "), true);
}
oled_rotation_t oled_init_keymap(oled_rotation_t rotation) {
#ifdef OLED_DRIVER_SH1107
# ifdef OLED_DRIVER_SH1107
return OLED_ROTATION_0;
#else
# else
return OLED_ROTATION_180;
#endif
# endif
}
void oled_render_large_display(bool side) {
if (side) {
render_wpm_graph(56, 64);
} else {
// clang-format off
static const char PROGMEM kyria_logo[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,128,192,224,240,112,120, 56, 60, 28, 30, 14, 14, 14, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 14, 14, 14, 30, 28, 60, 56,120,112,240,224,192,128,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,192,224,240,124, 62, 31, 15, 7, 3, 1,128,192,224,240,120, 56, 60, 28, 30, 14, 14, 7, 7,135,231,127, 31,255,255, 31,127,231,135, 7, 7, 14, 14, 30, 28, 60, 56,120,240,224,192,128, 1, 3, 7, 15, 31, 62,124,240,224,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -144,7 +149,7 @@ void oled_render_large_display(bool side) {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 3, 7, 15, 14, 30, 28, 60, 56,120,112,112,112,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,112,112,112,120, 56, 60, 28, 30, 14, 15, 7, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
// clang-format on
oled_set_cursor(0,7);
oled_set_cursor(0, 7);
oled_write_raw_P(kyria_logo, sizeof(kyria_logo));
}
}
@ -171,7 +176,6 @@ void housekeeping_task_keymap(void) {
}
#endif
#ifdef KEYBOARD_splitkb_kyria_rev1_proton_c
void matrix_output_unselect_delay(uint8_t line, bool key_pressed) {
for (int32_t i = 0; i < 40; i++) {

View file

@ -17,7 +17,7 @@
#include "drashna.h"
enum more_custom_keycodes {
KC_SWAP_NUM = NEW_SAFE_RANGE,
KC_SWAP_NUM = USER_SAFE_RANGE,
PM_SCROLL,
PM_PRECISION,
};

View file

@ -16,19 +16,11 @@
#include "drashna.h"
#ifdef BACKLIGHT_ENABLE
#define BACKLIT OSM(MOD_LSFT)
enum planck_keycodes {
BACKLIT = NEW_SAFE_RANGE,
TH_LVL,
TH_LVL = USER_SAFE_RANGE,
};
#else
# define BACKLIT OSM(MOD_LSFT)
enum planck_keycodes {
TH_LVL = NEW_SAFE_RANGE,
};
#endif
#ifdef KEYBOARD_planck_ez
# define PLNK_1 BK_LWER
# define PLNK_2 SP_LWER
@ -56,10 +48,10 @@ enum planck_keycodes {
K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \
) \
LAYOUT_ortho_4x12_wrapper( \
KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_DEL, \
KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, PRINT_SETUPS, \
LALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(K1B), \
KC_MLSF, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), KC_ENT, \
BACKLIT, OS_LCTL, OS_LALT, OS_LGUI, PLNK_1, PLNK_2, PLNK_3, PLNK_4, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
STORE_SETUPS, OS_LCTL, OS_LALT, OS_LGUI, PLNK_1, PLNK_2, PLNK_3, PLNK_4, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
)
#define LAYOUT_base_wrapper(...) LAYOUT_ortho_4x12_base(__VA_ARGS__)
@ -130,18 +122,6 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
#ifdef BACKLIGHT_ENABLE
case BACKLIT:
if (record->event.pressed) {
register_code(KC_RSFT);
# ifdef BACKLIGHT_ENABLE
backlight_step();
# endif
} else {
unregister_code(KC_RSFT);
}
break;
#endif
#ifdef KEYBOARD_planck_ez
case TH_LVL:
if (record->event.pressed) {

View file

@ -16,7 +16,9 @@
#include "drashna.h"
enum crkbd_keycodes { RGBRST = NEW_SAFE_RANGE };
enum crkbd_keycodes {
RGBRST = USER_SAFE_RANGE,
};
/*
* The `LAYOUT_crkbd_base` macro is a template to allow the use of identical
@ -96,33 +98,35 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// clang-format on
#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 SLEEP_SPEED 10 // below this wpm value your animation will idle
# define WAKE_FRAMES 2 // uncomment if >1
# define WAKE_FRAMES 2 // uncomment if >1
# define KAKI_FRAMES 3
# define KAKI_SPEED 40 // above this wpm value typing animation to triggere
# 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 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
// #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_wake_frame = 0; // uncomment if WAKE_FRAMES >1
uint8_t current_kaki_frame = 0;
#ifdef SWAP_HANDS_ENABLE
uint8_t current_rtogi_frame = 0;
#endif
# ifdef SWAP_HANDS_ENABLE
uint8_t current_rtogi_frame = 0;
# endif
// uint8_t current_ltogi_frame = 0;
// clang-format off
void render_small_kitty(void) {

View file

@ -0,0 +1,33 @@
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#define AUDIO_CLICKY
#define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f
#if __has_include("user_song_list.h")
# include "user_song_list.h"
#endif
#ifdef USER_SONG_LIST
# define STARTUP_SONG SONG(RICK_ROLL)
# define GOODBYE_SONG SONG(SONIC_RING)
# define DEFAULT_LAYER_SONGS \
{ SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND), SONG(OVERWATCH_THEME) }
# define UNICODE_SONG_MAC SONG(MARIO_THEME)
# define UNICODE_SONG_LNX SONG(MARIO_POWERUP)
# define UNICODE_SONG_WIN SONG(MARIO_ONEUP)
# define UNICODE_SONG_BSD SONG(RICK_ROLL)
# define UNICODE_SONG_WINC SONG(RICK_ROLL)
#else
# define STARTUP_SONG SONG(STARTUP_SOUND)
# define GOODBYE_SONG SONG(GOODBYE_SOUND)
# define DEFAULT_LAYER_SONGS \
{ SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND), SONG(WORKMAN_SOUND) }
# define UNICODE_SONG_MAC SONG(QWERTY_SOUND)
# define UNICODE_SONG_LNX SONG(COLEMAK_SOUND)
# define UNICODE_SONG_WIN SONG(DVORAK_SOUND)
# define UNICODE_SONG_BSD SONG(WORKMAN_SOUND)
# define UNICODE_SONG_WINC SONG(PLOVER_GOODBYE_SOUND)
#endif

View file

@ -3,9 +3,8 @@
#include "drashna.h"
#ifdef I2C_SCANNER_ENABLE
void matrix_scan_i2c(void);
void housekeeping_task_i2c_scanner(void);
void keyboard_post_init_i2c(void);
#endif
@ -21,6 +20,64 @@ void keyboard_pre_init_user(void) {
// Call user matrix init, set default RGB colors and then
// call the keymap's init function
#ifdef CUSTOM_QUANTUM_PAINTER_ENABLE
void keyboard_post_init_qp(void);
#endif
#ifdef OS_DETECTION_ENABLE
os_variant_t os_type;
uint32_t startup_exec(uint32_t trigger_time, void *cb_arg) {
/* do something */
if (is_keyboard_master()) {
os_type = detected_host_os();
if (os_type) {
bool is_mac = (os_type == OS_MACOS) || (os_type == OS_IOS);
keymap_config.swap_lctl_lgui = keymap_config.swap_rctl_rgui = is_mac;
# ifdef UNICODE_COMMON_ENABLE
uint8_t mode = is_mac ? UNICODE_MODE_MACOS : UNICODE_MODE_WINCOMPOSE;
if (mode != get_unicode_input_mode()) {
set_unicode_input_mode(mode);
}
# endif
switch (os_type) {
case OS_UNSURE:
xprintf("unknown OS Detected\n");
break;
case OS_LINUX:
xprintf("Linux Detected\n");
break;
case OS_WINDOWS:
xprintf("Windows Detected\n");
break;
# if 0
case OS_WINDOWS_UNSURE:
xprintf("Windows? Detected\n");
break;
# endif
case OS_MACOS:
xprintf("MacOS Detected\n");
break;
case OS_IOS:
xprintf("iOS Detected\n");
break;
# if 0
case OS_PS5:
xprintf("PlayStation 5 Detected\n");
break;
case OS_HANDHELD:
xprintf("Nintend Switch/Quest 2 Detected\n");
break;
# endif
}
}
}
return os_type ? 0 : 500;
}
#endif
__attribute__((weak)) void keyboard_post_init_keymap(void) {}
void keyboard_post_init_user(void) {
#if defined(CUSTOM_RGBLIGHT)
@ -47,6 +104,10 @@ void keyboard_post_init_user(void) {
PORTB &= ~(1 << 0);
#endif
#ifdef OS_DETECTION_ENABLE
defer_exec(100, startup_exec, NULL);
#endif
keyboard_post_init_keymap();
}
@ -102,25 +163,6 @@ void suspend_wakeup_init_user(void) {
// scan function
__attribute__((weak)) void matrix_scan_keymap(void) {}
void matrix_scan_user(void) {
static bool has_ran_yet;
if (!has_ran_yet) {
has_ran_yet = true;
startup_user();
}
#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
run_diablo_macro_check();
#endif // TAP_DANCE_ENABLE
#if defined(CUSTOM_RGB_MATRIX)
matrix_scan_rgb_matrix();
#endif
#ifdef I2C_SCANNER_ENABLE
matrix_scan_i2c();
#endif
#ifdef CUSTOM_OLED_DRIVER
matrix_scan_oled();
#endif
matrix_scan_keymap();
}
@ -134,10 +176,6 @@ __attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state)
return state;
}
layer_state_t layer_state_set_user(layer_state_t state) {
if (!is_keyboard_master()) {
return state;
}
state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
#if defined(CUSTOM_POINTING_DEVICE)
state = layer_state_set_pointing(state);
@ -145,18 +183,33 @@ layer_state_t layer_state_set_user(layer_state_t state) {
#if defined(CUSTOM_RGBLIGHT)
state = layer_state_set_rgb_light(state);
#endif // CUSTOM_RGBLIGHT
#if defined(AUDIO_ENABLE) && !defined(__arm__)
#if defined(AUDIO_ENABLE)
static bool is_gamepad_on = false;
if (layer_state_cmp(state, _GAMEPAD) != is_gamepad_on) {
is_gamepad_on = layer_state_cmp(state, _GAMEPAD);
static bool is_click_on = false;
is_gamepad_on = layer_state_cmp(state, _GAMEPAD);
if (is_gamepad_on) {
is_click_on = is_clicky_on();
if (is_click_on) {
clicky_off();
}
PLAY_LOOP(doom_song);
} else {
if (is_click_on) {
clicky_on();
}
stop_all_notes();
}
}
#endif
state = layer_state_set_keymap(state);
#ifdef CONSOLE_ENABLE
char layer_buffer[16 + 5];
format_layer_bitmap_string(layer_buffer, state, default_layer_state);
dprintf("layer state: %s\n", layer_buffer);
#endif
return state;
}
@ -227,9 +280,27 @@ void matrix_slave_scan_user(void) {
#endif
__attribute__((weak)) void housekeeping_task_keymap(void) {}
void housekeeping_task_user(void) {
void housekeeping_task_user(void) {
static bool has_ran_yet;
if (!has_ran_yet) {
has_ran_yet = true;
startup_user();
}
#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
run_diablo_macro_check();
#endif // TAP_DANCE_ENABLE
#if defined(CUSTOM_RGB_MATRIX)
housekeeping_task_rgb_matrix();
#endif
#ifdef I2C_SCANNER_ENABLE
housekeeping_task_i2c_scanner();
#endif
#ifdef CUSTOM_OLED_DRIVER
housekeeping_task_oled();
#endif
#if defined(SPLIT_KEYBOARD) && defined(SPLIT_TRANSACTION_IDS_USER)
housekeeping_task_transport_sync();
#endif
housekeeping_task_keymap();
}

View file

@ -11,7 +11,6 @@
#endif
#define IS_COMMAND() (((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) == MOD_MASK_SHIFT)
#if defined(SPLIT_KEYBOARD)
# include "split/split_config.h"
#endif
@ -27,51 +26,26 @@
# include "oled/oled_config.h"
#endif
#ifdef POINTING_DEVICE_ENABLE
# include "pointing/pointing_config.h"
#endif // POINTING_DEVICE_ENABLE
#ifdef AUDIO_ENABLE
# include "audio_config.h"
#endif // AUDIO_ENABLE
#if defined(WPM_ENABLE)
// # define WPM_LAUNCH_CONTROL
// # define WPM_ALLOW_COUNT_REGRESSOIN
// # define WPM_UNFILTERED
# define WPM_ALLOW_COUNT_REGRESSION
# define WPM_SAMPLE_SECONDS 10
# define WPM_SAMPLE_PERIODS 50
# define WPM_ESTIMATED_WORD_SIZE 5
#endif
#ifdef AUDIO_ENABLE
# define AUDIO_CLICKY
# define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f
# ifdef USER_SONG_LIST
# define STARTUP_SONG SONG(RICK_ROLL)
# define GOODBYE_SONG SONG(SONIC_RING)
# define DEFAULT_LAYER_SONGS \
{ SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND), SONG(OVERWATCH_THEME) }
# define UNICODE_SONG_MAC SONG(MARIO_THEME)
# define UNICODE_SONG_LNX SONG(MARIO_POWERUP)
# define UNICODE_SONG_WIN SONG(MARIO_ONEUP)
# define UNICODE_SONG_BSD SONG(RICK_ROLL)
# define UNICODE_SONG_WINC SONG(RICK_ROLL)
# else
# define STARTUP_SONG SONG(STARTUP_SOUND)
# define GOODBYE_SONG SONG(GOODBYE_SOUND)
# define DEFAULT_LAYER_SONGS \
{ SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND), SONG(WORKMAN_SOUND) }
# define UNICODE_SONG_MAC SONG(QWERTY_SOUND)
# define UNICODE_SONG_LNX SONG(COLEMAK_SOUND)
# define UNICODE_SONG_WIN SONG(DVORAK_SOUND)
# define UNICODE_SONG_BSD SONG(WORKMAN_SOUND)
# define UNICODE_SONG_WINC SONG(PLOVER_GOODBYE_SOUND)
# endif
#endif // !AUDIO_ENABLE
#define UNICODE_SELECTED_MODES UNICODE_MODE_WINCOMPOSE, UNICODE_MODE_MACOS
// #define WPM_ESTIMATED_WORD_SIZE 5
#define WPM_ALLOW_COUNT_REGRESSION
// #define WPM_UNFILTERED
// #define WPM_SAMPLE_SECONDS 5
// #define WPM_SAMPLE_PERIODS 50
// #define WPM_LAUNCH_CONTROL
#ifndef ONESHOT_TAP_TOGGLE
# define ONESHOT_TAP_TOGGLE 2
#endif // !ONESHOT_TAP_TOGGLE

View file

@ -117,7 +117,7 @@ void do_scan(void) {
uint16_t scan_timer = 0;
void matrix_scan_i2c(void) {
void housekeeping_task_i2c_scanner(void) {
if (timer_elapsed(scan_timer) > 5000) {
do_scan();
scan_timer = timer_read();
@ -139,7 +139,7 @@ float autocorrect_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
# endif
# endif
bool apply_autocorrect(uint8_t backspaces, const char *str) {
bool apply_autocorrect(uint8_t backspaces, const char* str) {
if (layer_state_is(_GAMEPAD)) {
return false;
}
@ -153,7 +153,31 @@ bool apply_autocorrect(uint8_t backspaces, const char *str) {
}
#endif
#if defined(CAPS_WORD_ENABLE) && !defined(NO_ACTION_ONESHOT)
#if defined(CAPS_WORD_ENABLE)
bool caps_word_press_user(uint16_t keycode) {
switch (keycode) {
// Keycodes that continue Caps Word, with shift applied.
case KC_MINS:
if (!keymap_config.swap_lctl_lgui) {
return true;
}
case KC_A ... KC_Z:
add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to next key.
return true;
// Keycodes that continue Caps Word, without shifting.
case KC_1 ... KC_0:
case KC_BSPC:
case KC_DEL:
case KC_UNDS:
return true;
default:
return false; // Deactivate Caps Word.
}
}
# if !defined(NO_ACTION_ONESHOT)
void oneshot_locked_mods_changed_user(uint8_t mods) {
if (mods & MOD_MASK_SHIFT) {
del_mods(MOD_MASK_SHIFT);
@ -161,4 +185,25 @@ void oneshot_locked_mods_changed_user(uint8_t mods) {
caps_word_on();
}
}
# endif
#endif
void format_layer_bitmap_string(char* buffer, layer_state_t state, layer_state_t default_state) {
for (int i = 0; i < 16; i++) {
if (i == 0 || i == 4 || i == 8 || i == 12) {
*buffer = ' ';
++buffer;
}
uint8_t layer = i;
if ((default_state & ((layer_state_t)1 << layer)) != 0) {
*buffer = 'D';
} else if ((state & ((layer_state_t)1 << layer)) != 0) {
*buffer = '1';
} else {
*buffer = '_';
}
++buffer;
}
*buffer = 0;
}

View file

@ -11,7 +11,7 @@
#ifdef TAP_DANCE_ENABLE
# include "keyrecords/tap_dances.h"
#endif // TAP_DANCE_ENABLE
#endif // TAP_DANCE_ENABLE
#if defined(RGBLIGHT_ENABLE)
# include "rgb/rgb_stuff.h"
#endif
@ -27,6 +27,9 @@
#ifdef POINTING_DEVICE_ENABLE
# include "pointing/pointing.h"
#endif
#ifdef OS_DETECTION_ENABLE
# include "os_detection.h"
#endif
/* Define layer names */
enum userspace_layers {
@ -79,6 +82,7 @@ bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed);
bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer);
bool hasAllBitsInMask(uint8_t value, uint8_t mask);
void tap_code16_nomods(uint16_t kc);
void format_layer_bitmap_string(char* buffer, layer_state_t state, layer_state_t default_state);
// clang-format off
typedef union {

View file

@ -1,36 +0,0 @@
# Cap Words
This is taken from [Pascal Getreuer's implemenation](https://getreuer.info/posts/keyboards/caps-word/index.html), with a number of modifications.
To enable Caps Word, add `CAPS_WORD_ENABLE = yes` to your `rules.mk`.
This is mostly a reproduction of Pascal's docs:
## Overview
All-caps identifiers like “MOD_MASK_ALT” are awkward to type.
Caps Lock would be the standard solution to this problem, but it is awkward: it needs a dedicated key to toggle it (an imposition on smaller keyboards), and we need to remember to toggle it off after typing the word. Or with normal shifting, we either perform finger gymnastics or need to stop typing in the middle of the word to release shift with one hand to switch to holding shift with the other hand. In my experience, this is a nuisance especially if your shift keys are mod-taps, as in home row mods.
Caps Word, implemented here, is a modern alternative to Caps Lock:
* Caps Word is activated by pressing the left and right shift keys at the same time. This way you dont need a dedicated key for using Caps Word.
* Caps Word automatically disables itself at the end of the word.
**Compatibility**: Ive tested that this implementation works with one-shot mods and Space Cadet Shift, and it predictably handles key repeating.
Unlike some other QMK Caps Word implementations, this library does not use the Caps Lock (KC_CAPS) keycode. It works even if the OS remaps Caps Lock to Ctrl or something else, as Emacs and Vim users often do.
## Using Caps Word
With the above flashed to your keyboard:
1. **Activating**: Press and release both left and right shift keys at the same time. If your shift keys are mod-taps, activate Caps Word by holding both shift mod-tap keys until the tapping term, then release them.
2. Then begin typing to get capitalized letters.
3. **Disabling**: Caps Word disables itself when the next word breaking key is typed.
If you want to explicitly stop Caps Word, press and release Ctrl or another non-shift modifier or layer key. This also disables Caps Word.
## Explanation
The code checks the mod bits on each key event, enabling Caps Word when both left and right shifts are active.
While enabled, Caps Word automatically presses and releases left shift (KC_LSFT) as needed so that letters are shifted and other keys are not. The word continues while typing az, 09, -, _, and backspace. Any other key is considered “word breaking” and disables Caps Word. You can edit the switch statement at the end of the process_caps_word() function to adjust which keys count as word breaking.

View file

@ -3,6 +3,9 @@
#include "drashna.h"
#include "version.h"
#ifdef OS_DETECTION_ENABLE
# include "os_detection.h"
#endif
uint16_t copy_paste_timer;
bool host_driver_disabled = false;
@ -32,15 +35,6 @@ __attribute__((weak)) bool process_record_secrets(uint16_t keycode, keyrecord_t
* @return false Stop process keycode and do not send to host
*/
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef ENCODER_ENABLE // some debouncing for weird issues
if (IS_ENCODEREVENT(record->event)) {
static bool ignore_first = true;
if (ignore_first) {
ignore_first = false;
return false;
}
}
#endif
// If console is enabled, it will print the matrix position and status of each key pressed
#ifdef KEYLOGGER_ENABLE
uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %1d, time: %5u, int: %1d, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count);
@ -195,6 +189,29 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
break;
}
case OLED_LOCK: {
#if defined(OLED_ENABLE) && defined(CUSTOM_OLED_DRIVER)
extern bool is_oled_locked;
if (record->event.pressed) {
is_oled_locked = !is_oled_locked;
if (is_oled_locked) {
oled_on();
}
}
#endif
} break;
#if defined(OS_DETECTION_ENABLE) && defined(OS_DETECTION_DEBUG_ENABLE)
case STORE_SETUPS:
if (record->event.pressed) {
store_setups_in_eeprom();
}
return false;
case PRINT_SETUPS:
if (record->event.pressed) {
print_stored_setups();
}
return false;
#endif
}
return true;
}

View file

@ -5,7 +5,7 @@
#include "drashna.h"
enum userspace_custom_keycodes {
VRSN = SAFE_RANGE, // Prints QMK Firmware and board info
VRSN = QK_USER, // Prints QMK Firmware and board info
KC_QWERTY, // Sets default layer to QWERTY
FIRST_DEFAULT_LAYER_KEYCODE = KC_QWERTY, // Sets default layer to QWERTY
KC_COLEMAK_DH, // Sets default layer to COLEMAK
@ -39,7 +39,12 @@ enum userspace_custom_keycodes {
KC_SUPER,
KC_COMIC,
KC_ACCEL,
NEW_SAFE_RANGE // use "NEWPLACEHOLDER for keymap specific codes
OLED_LOCK,
STORE_SETUPS,
PRINT_SETUPS,
USER_SAFE_RANGE, // use "NEWPLACEHOLDER for keymap specific codes
};
bool process_record_secrets(uint16_t keycode, keyrecord_t *record);

View file

@ -1,7 +1,5 @@
# Keycode handling and interception
* [Autocorrection](autocorrection/readme.md)
* [Cap Words](capwords.md)
* [Diablo Tap Dancing](tap_dance.md)
* [Keymap Wrappers](wrappers.md)
* [Secret Macros](secrets.md)

View file

@ -25,7 +25,7 @@
#endif
#include <string.h>
bool is_oled_enabled = true;
bool is_oled_enabled = true, is_oled_locked = false;
extern bool host_driver_disabled;
@ -75,9 +75,9 @@ void add_keylog(uint16_t keycode, keyrecord_t *record) {
keycode = QK_MODS_GET_BASIC_KEYCODE(keycode);
}
if ((keycode == KC_BSPC) && mod_config(get_mods() | get_oneshot_mods()) & MOD_MASK_CTRL) {
memset(keylog_str, ' ', OLED_KEYLOGGER_LENGTH);
keylog_str[OLED_KEYLOGGER_LENGTH-1] = 0x00;
return;
}
if (record->tap.count) {
@ -86,10 +86,10 @@ void add_keylog(uint16_t keycode, keyrecord_t *record) {
return;
}
memmove(keylog_str, keylog_str + 1, OLED_KEYLOGGER_LENGTH - 1);
memmove(keylog_str, keylog_str + 1, OLED_KEYLOGGER_LENGTH - 2);
if (keycode < ARRAY_SIZE(code_to_name)) {
keylog_str[(OLED_KEYLOGGER_LENGTH - 1)] = pgm_read_byte(&code_to_name[keycode]);
keylog_str[(OLED_KEYLOGGER_LENGTH - 2)] = pgm_read_byte(&code_to_name[keycode]);
}
log_timer = timer_read();
@ -638,10 +638,10 @@ void render_pointing_dpi_status(uint16_t cpi, uint8_t padding, uint8_t col, uint
#define OLED_KAKI_SPEED 40 // above this wpm value typing animation to triggere
#define OLED_RTOGI_FRAMES 2
//#define OLED_LTOGI_FRAMES 2
// #define OLED_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_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 OLED_ANIM_SIZE 36
#define OLED_ANIM_ROWS 4
#define OLED_ANIM_MAX_FRAMES 3
@ -735,7 +735,7 @@ void render_kitty(uint8_t col, uint8_t line) {
}
void render_unicode_mode(uint8_t col, uint8_t line) {
#ifdef CUSTOM_UNICODE_ENABLE
#if defined(CUSTOM_UNICODE_ENABLE) && defined(UNICODE_COMMON_ENABLE)
oled_set_cursor(col, line);
oled_write_P(PSTR("Unicode:"), false);
oled_write_P(unicode_mode_str[unicode_typing_mode], false);
@ -802,19 +802,6 @@ void render_mouse_mode(uint8_t col, uint8_t line) {
}
void render_status_right(void) {
#if defined(KEYBOARD_handwired_tractyl_manuform)
oled_set_cursor(7, 0);
oled_write_P(PSTR("Manuform"), true);
#elif defined(KEYBOARD_bastardkb_charybdis)
oled_set_cursor(6, 0);
oled_write_P(PSTR("Charybdis"), true);
#elif defined(KEYBOARD_splitkb_kyria)
oled_set_cursor(8, 0);
oled_write_P(PSTR("Kyria"), true);
#else
oled_set_cursor(8, 0);
oled_write_P(PSTR("Right"), true);
#endif
#if defined(OLED_DISPLAY_VERBOSE)
render_default_layer_state(1, 1);
#else
@ -834,23 +821,6 @@ void render_status_left(void) {
#if defined(OLED_DISPLAY_VERBOSE)
render_kitty(0, 1);
# if defined(KEYBOARD_handwired_tractyl_manuform)
oled_set_cursor(7, 0);
oled_write_P(PSTR("Tractyl"), true);
# elif defined(KEYBOARD_bastardkb_charybdis)
oled_set_cursor(6, 0);
oled_write_P(PSTR("Charybdis"), true);
# elif defined(KEYBOARD_splitkb_kyria)
oled_set_cursor(7, 0);
oled_write_P(PSTR("SplitKB"), true);
# elif defined(KEYBOARD_handwired_fingerpunch_rockon)
oled_set_cursor(7, 0);
oled_write_P(PSTR("Rock On"), true);
# else
oled_set_cursor(8, 0);
oled_write_P(PSTR("Left"), true);
# endif
# if defined(WPM_ENABLE)
render_wpm(1, 7, 1);
# elif defined(DEBUG_MATRIX_SCAN_RATE)
@ -883,6 +853,11 @@ __attribute__((weak)) void oled_render_large_display(bool side) {
}
}
__attribute__((weak)) void render_oled_title(bool side) {
oled_write_P(side ? PSTR(" Left ") : PSTR(" Right "), true);
// oled_write_P(PSTR( "1234567890123" "1234567890123"), true);
}
__attribute__((weak)) oled_rotation_t oled_init_keymap(oled_rotation_t rotation) {
return rotation;
}
@ -924,6 +899,9 @@ bool oled_task_user(void) {
// 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 7, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 7, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255, 0
};
oled_write_raw_P(header_image, sizeof(header_image));
oled_set_cursor(4, 0);
render_oled_title(is_keyboard_left());
#endif
#ifndef OLED_DISPLAY_TEST
@ -966,6 +944,6 @@ bool oled_task_user(void) {
extern bool oled_initialized;
__attribute__((weak)) void matrix_scan_oled(void) {
is_oled_enabled = !(timer_elapsed32(oled_timer) > 60000);
__attribute__((weak)) void housekeeping_task_oled(void) {
is_oled_enabled = is_oled_locked ? true : !(timer_elapsed32(oled_timer) > 60000);
}

View file

@ -45,7 +45,8 @@ void render_kitty(uint8_t col, uint8_t line);
void render_unicode_mode(uint8_t col, uint8_t line);
void render_rgb_hsv(uint8_t col, uint8_t line);
void render_mouse_mode(uint8_t col, uint8_t line);
void matrix_scan_oled(void);
void housekeeping_task_oled(void);
void render_oled_title(bool side);
void oled_pan_section(bool left, uint16_t y_start, uint16_t y_end, uint16_t x_start, uint16_t x_end);
@ -54,7 +55,7 @@ void oled_pan_section(bool left, uint16_t y_start, uint16_t y_end, uint16_t x_st
# define OLED_RENDER_KEYLOGGER "Keylogger: "
# ifndef OLED_KEYLOGGER_LENGTH
# define OLED_KEYLOGGER_LENGTH 9
# define OLED_KEYLOGGER_LENGTH 10
# endif
# define OLED_RENDER_LAYOUT_NAME "Layout: "
# define OLED_RENDER_LAYOUT_QWERTY "Qwerty"
@ -101,7 +102,7 @@ void oled_pan_section(bool left, uint16_t y_start, uint16_t y_end, uint16_t x_st
#else
# define OLED_RENDER_KEYLOGGER "KLogr"
# ifndef OLED_KEYLOGGER_LENGTH
# define OLED_KEYLOGGER_LENGTH 5
# define OLED_KEYLOGGER_LENGTH 6
# endif
# define OLED_RENDER_LAYOUT_NAME "Lyout"
@ -148,7 +149,7 @@ void oled_pan_section(bool left, uint16_t y_start, uint16_t y_end, uint16_t x_st
# define OLED_RENDER_WPM_COUNTER "WPM: "
#endif
extern char keylog_str[OLED_KEYLOGGER_LENGTH];
extern char keylog_str[];
#ifndef OLED_WPM_GRAPH_MAX_WPM
# define OLED_WPM_GRAPH_MAX_WPM 120

View file

@ -324,78 +324,77 @@ static void rotate_90(const uint8_t *src, uint8_t *dest) {
}
void oled_render(void) {
if (!oled_initialized) {
return;
}
// Do we have work to do?
oled_dirty &= OLED_ALL_BLOCKS_MASK;
if (!oled_dirty || oled_scrolling) {
if (!oled_dirty || !oled_initialized || oled_scrolling) {
return;
}
// Find first dirty block
uint8_t update_start = 0;
while (!(oled_dirty & ((OLED_BLOCK_TYPE)1 << update_start))) {
++update_start;
}
// Set column & page position
static uint8_t display_start[] = {I2C_CMD, PAM_PAGE_ADDR, PAM_SETCOLUMN_LSB, PAM_SETCOLUMN_MSB};
if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) {
calc_bounds(update_start, &display_start[1]); // Offset from I2C_CMD byte at the start
} else {
calc_bounds_90(update_start, &display_start[1]); // Offset from I2C_CMD byte at the start
}
// Send column & page position
if (I2C_TRANSMIT(display_start) != I2C_STATUS_SUCCESS) {
print("oled_render offset command failed\n");
return;
}
if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) {
// Send render data chunk as is
if (I2C_WRITE_REG(I2C_DATA, &oled_buffer[OLED_BLOCK_SIZE * update_start], OLED_BLOCK_SIZE) != I2C_STATUS_SUCCESS) {
print("oled_render data failed\n");
return;
}
} else {
// Rotate the render chunks
const static uint8_t source_map[] = OLED_SOURCE_MAP;
const static uint8_t target_map[] = OLED_TARGET_MAP;
static uint8_t temp_buffer[OLED_BLOCK_SIZE];
memset(temp_buffer, 0, sizeof(temp_buffer));
for (uint8_t i = 0; i < sizeof(source_map); ++i) {
rotate_90(&oled_buffer[OLED_BLOCK_SIZE * update_start + source_map[i]], &temp_buffer[target_map[i]]);
}
// For SH1106 or SH1107 the data chunk must be split into separate pieces for each page
const uint8_t columns_in_block = (OLED_BLOCK_SIZE + OLED_DISPLAY_HEIGHT - 1) / OLED_DISPLAY_HEIGHT * 8;
const uint8_t num_pages = OLED_BLOCK_SIZE / columns_in_block;
for (uint8_t i = 0; i < num_pages; ++i) {
// Send column & page position for all pages except the first one
if (i > 0) {
display_start[1]++;
if (I2C_TRANSMIT(display_start) != I2C_STATUS_SUCCESS) {
print("oled_render offset command failed\n");
return;
}
}
// Send data for the page
if (I2C_WRITE_REG(I2C_DATA, &temp_buffer[columns_in_block * i], columns_in_block) != I2C_STATUS_SUCCESS) {
print("oled_render90 data failed\n");
return;
}
}
}
// Turn on display if it is off
oled_on();
// Clear dirty flag
oled_dirty &= ~((OLED_BLOCK_TYPE)1 << update_start);
uint8_t update_start = 0;
uint8_t num_processed = 0;
while (oled_dirty && num_processed++ < OLED_UPDATE_PROCESS_LIMIT) { // render all dirty blocks (up to the configured limit)
// Find next dirty block
while (!(oled_dirty & ((OLED_BLOCK_TYPE)1 << update_start))) {
++update_start;
}
// Set column & page position
static uint8_t display_start[] = {I2C_CMD, PAM_PAGE_ADDR, PAM_SETCOLUMN_LSB, PAM_SETCOLUMN_MSB};
if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) {
calc_bounds(update_start, &display_start[1]); // Offset from I2C_CMD byte at the start
} else {
calc_bounds_90(update_start, &display_start[1]); // Offset from I2C_CMD byte at the start
}
// Send column & page position
if (I2C_TRANSMIT(display_start) != I2C_STATUS_SUCCESS) {
print("oled_render offset command failed\n");
return;
}
if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) {
// Send render data chunk as is
if (I2C_WRITE_REG(I2C_DATA, &oled_buffer[OLED_BLOCK_SIZE * update_start], OLED_BLOCK_SIZE) != I2C_STATUS_SUCCESS) {
print("oled_render data failed\n");
return;
}
} else {
// Rotate the render chunks
const static uint8_t source_map[] = OLED_SOURCE_MAP;
const static uint8_t target_map[] = OLED_TARGET_MAP;
static uint8_t temp_buffer[OLED_BLOCK_SIZE];
memset(temp_buffer, 0, sizeof(temp_buffer));
for (uint8_t i = 0; i < sizeof(source_map); ++i) {
rotate_90(&oled_buffer[OLED_BLOCK_SIZE * update_start + source_map[i]], &temp_buffer[target_map[i]]);
}
// For SH1106 or SH1107 the data chunk must be split into separate pieces for each page
const uint8_t columns_in_block = (OLED_BLOCK_SIZE + OLED_DISPLAY_HEIGHT - 1) / OLED_DISPLAY_HEIGHT * 8;
const uint8_t num_pages = OLED_BLOCK_SIZE / columns_in_block;
for (uint8_t i = 0; i < num_pages; ++i) {
// Send column & page position for all pages except the first one
if (i > 0) {
display_start[1]++;
if (I2C_TRANSMIT(display_start) != I2C_STATUS_SUCCESS) {
print("oled_render offset command failed\n");
return;
}
}
// Send data for the page
if (I2C_WRITE_REG(I2C_DATA, &temp_buffer[columns_in_block * i], columns_in_block) != I2C_STATUS_SUCCESS) {
print("oled_render90 data failed\n");
return;
}
}
}
// Clear dirty flag
oled_dirty &= ~((OLED_BLOCK_TYPE)1 << update_start);
}
}
void oled_set_cursor(uint8_t col, uint8_t line) {

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "pointing.h"
#include "math.h"
static uint16_t mouse_debounce_timer = 0;
bool enable_acceleration = false;
@ -38,8 +39,10 @@ report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) {
oled_timer_reset();
#endif
if (enable_acceleration) {
x = (mouse_xy_report_t)(x > 0 ? x * x / 16 + x : -x * x / 16 + x);
y = (mouse_xy_report_t)(y > 0 ? y * y / 16 + y : -y * y / 16 + y);
x = (mouse_xy_report_t)(x > 0 ? pow(4, x) / 2 + x : -pow(4, abs(x)) / 2 + x);
y = (mouse_xy_report_t)(y > 0 ? pow(5, y) / 2 + y : -pow(5, abs(y)) / 2 + y);
// x = (mouse_xy_report_t)(x > 0 ? x * x / 16 + x : -x * x / 16 + x);
// y = (mouse_xy_report_t)(y > 0 ? y * y / 16 + y : -y * y / 16 + y);
}
mouse_report.x = x;
mouse_report.y = y;
@ -81,9 +84,7 @@ bool is_mouse_record_user(uint16_t keycode, keyrecord_t* record) {
switch (keycode) {
# if defined(KEYBOARD_ploopy)
case DPI_CONFIG:
# elif (defined(KEYBOARD_bastardkb_charybdis) || defined(KEYBOARD_handwired_tractyl_manuform)) && !defined(NO_CHARYBDIS_KEYCODES)
case QK_KB ... QK_KB_MAX:
# elif (defined(KEYBOARD_bastardkb_dilemma) && !defined(NO_DILEMMA_KEYCODES))
# elif (defined(KEYBOARD_bastardkb_charybdis) || defined(KEYBOARD_handwired_tractyl_manuform)) && !defined(NO_CHARYBDIS_KEYCODES) || (defined(KEYBOARD_bastardkb_dilemma) && !defined(NO_DILEMMA_KEYCODES))
case QK_KB ... QK_KB_MAX:
# endif
case KC_ACCEL:

View file

@ -0,0 +1,6 @@
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#define POINTING_DEVICE_MODES_ENABLE

View file

@ -137,7 +137,7 @@
# define USB_SUSPEND_WAKEUP_DELAY 200
#endif
#ifdef XAP_ENABLE
#if defined(XAP_ENABLE) && !defined(__AVR__)
# undef DYNAMIC_KEYMAP_LAYER_COUNT
# define DYNAMIC_KEYMAP_LAYER_COUNT 12
#endif

View file

@ -40,15 +40,12 @@ void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode
}
}
__attribute__((weak)) void rgb_matrix_indicator_keymap(void) {}
void matrix_scan_rgb_matrix(void) {
void housekeeping_task_rgb_matrix(void) {
#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
if (userspace_config.rgb_matrix_idle_anim && rgb_matrix_get_mode() == RGB_MATRIX_TYPING_HEATMAP && sync_timer_elapsed32(hypno_timer) > 15000) {
rgb_matrix_mode_noeeprom(RGB_MATRIX_REST_MODE);
}
#endif
rgb_matrix_indicator_keymap();
}
void keyboard_post_init_rgb_matrix(void) {

View file

@ -6,7 +6,7 @@
bool process_record_user_rgb_matrix(uint16_t keycode, keyrecord_t *record);
void keyboard_post_init_rgb_matrix(void);
void matrix_scan_rgb_matrix(void);
void housekeeping_task_rgb_matrix(void);
void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type, uint8_t led_min, uint8_t led_max);

View file

@ -138,3 +138,8 @@ ifeq ($(strip $(CUSTOM_BOOTMAGIC_ENABLE)), yes)
SRC += bootmagic_better.c
endif
endif
OS_DETECTION_ENABLE ?= yes
ifeq ($(strip $(OS_DETECTION_ENABLE)), yes)
DEFERRED_EXEC_ENABLE = yes
endif

View file

@ -3,17 +3,13 @@
#pragma once
// # define SPLIT_TRANSPORT_MIRROR
#define SPLIT_TRANSPORT_MIRROR
#define SPLIT_LAYER_STATE_ENABLE
#define SPLIT_LED_STATE_ENABLE
#define SPLIT_MODS_ENABLE
#ifndef POINTING_DEVICE_ENABLE
# define SPLIT_WATCHDOG_ENABLE
#endif
#ifdef WPM_ENABLE
# define SPLIT_WPM_ENABLE
#endif
#ifdef OLED_ENABLE
#define SPLIT_WATCHDOG_ENABLE
#define SPLIT_WPM_ENABLE
#ifdef SPLIT_OLED_ENABLE
# undef SPLIT_OLED_ENABLE
#endif
#if defined(__AVR__) && !defined(SELECT_SOFT_SERIAL_SPEED)

View file

@ -52,7 +52,7 @@ void user_config_sync(uint8_t initiator2target_buffer_size, const void* initiato
#ifdef CUSTOM_OLED_DRIVER
# include "oled/oled_stuff.h"
void keylogger_string_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer) {
if (initiator2target_buffer_size == OLED_KEYLOGGER_LENGTH) {
if (initiator2target_buffer_size == (OLED_KEYLOGGER_LENGTH)) {
memcpy(&keylog_str, initiator2target_buffer, initiator2target_buffer_size);
}
}

View file

@ -6,7 +6,7 @@
#include "drashna.h"
#ifdef OLED_ENABLE
# include "oled/oled_stuff.h"
extern char keylog_str[OLED_KEYLOGGER_LENGTH];
extern char keylog_str[];
#endif
typedef union {