mirror of
https://github.com/qmk/qmk_firmware.git
synced 2026-09-24 17:57:03 +08:00
[Keymap] Drashna Keymap updates for 0.21.0 (#21073)
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
// Copyright 2023 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
|
||||
#define TAPPING_TERM 499
|
||||
@@ -0,0 +1,100 @@
|
||||
// Copyright 2023 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "drashna.h"
|
||||
|
||||
// clang-format off
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT(
|
||||
LT(1,KC_MUTE),
|
||||
KC_ENT, KC_0, KC_BSPC,
|
||||
KC_7, KC_8, KC_9,
|
||||
KC_4, KC_5, KC_6,
|
||||
KC_1, KC_2, KC_3
|
||||
),
|
||||
[1] = LAYOUT(
|
||||
_______,
|
||||
CK_TOGG, AU_TOGG, _______,
|
||||
_______, _______, _______,
|
||||
_______, _______, _______,
|
||||
_______, _______, _______
|
||||
),
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
#ifdef ENCODER_MAP_ENABLE
|
||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
||||
[0] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)},
|
||||
[1] = {ENCODER_CCW_CW(RGB_RMOD, RGB_MOD)},
|
||||
};
|
||||
#endif
|
||||
|
||||
void render_oled_title(bool side) {
|
||||
oled_write_P(PSTR(" Macropad "), true);
|
||||
}
|
||||
|
||||
void render_rgb_mode(uint8_t col, uint8_t line);
|
||||
|
||||
void l_render_keylock_status(led_t led_usb_state, uint8_t col, uint8_t line) {
|
||||
oled_set_cursor(col, line);
|
||||
#ifdef CAPS_WORD_ENABLE
|
||||
led_usb_state.caps_lock |= is_caps_word_on();
|
||||
#endif
|
||||
oled_write_P(PSTR(OLED_RENDER_LOCK_NUML), led_usb_state.num_lock);
|
||||
oled_write_P(PSTR(" "), false);
|
||||
oled_write_P(PSTR(OLED_RENDER_LOCK_CAPS), led_usb_state.caps_lock);
|
||||
oled_write_P(PSTR(" "), false);
|
||||
oled_write_P(PSTR(OLED_RENDER_LOCK_SCLK), led_usb_state.scroll_lock);
|
||||
}
|
||||
|
||||
bool oled_task_keymap(void) {
|
||||
oled_write_raw_P(header_image, sizeof(header_image));
|
||||
oled_set_cursor(0, 1);
|
||||
oled_write_raw_P(row_2_image, sizeof(row_2_image));
|
||||
oled_set_cursor(4, 0);
|
||||
render_oled_title(false);
|
||||
|
||||
render_kitty(0, 2);
|
||||
render_matrix_scan_rate(1, 7, 2);
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
oled_set_cursor(7, 4);
|
||||
bool l_is_audio_on = is_audio_on();
|
||||
|
||||
static const char PROGMEM audio_status[2][3] = {{0xE0, 0xE1, 0}, {0xE2, 0xE3, 0}};
|
||||
oled_write_P(audio_status[l_is_audio_on], false);
|
||||
|
||||
# ifdef AUDIO_CLICKY
|
||||
bool l_is_clicky_on = is_clicky_on();
|
||||
static const char PROGMEM audio_clicky_status[2][3] = {{0xF4, 0xF5, 0}, {0xF6, 0xF7, 0}};
|
||||
oled_write_P(audio_clicky_status[l_is_clicky_on && l_is_audio_on], false);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static const char PROGMEM cat_mode[3] = {0xF8, 0xF9, 0};
|
||||
oled_write_P(cat_mode, get_keyboard_lock());
|
||||
|
||||
#ifdef RGB_MATIRX_ENABLE
|
||||
static const char PROGMEM rgb_layer_status[2][3] = {{0xEE, 0xEF, 0}, {0xF0, 0xF1, 0}};
|
||||
oled_write_P(rgb_layer_status[rgb_matrix_is_enabled()], false);
|
||||
#endif
|
||||
|
||||
#ifdef HAPTIC_ENABLE
|
||||
static const char PROGMEM nukem_good[2] = {0xFA, 0};
|
||||
oled_write_P(haptic_get_enable() ? nukem_good : PSTR(" "), false);
|
||||
#endif
|
||||
|
||||
l_render_keylock_status(host_keyboard_led_state(), 7, 5);
|
||||
render_rgb_mode(1, 6);
|
||||
|
||||
for (uint8_t i = 1; i < 7; i++) {
|
||||
oled_set_cursor(0, i);
|
||||
oled_write_raw_P(display_border, sizeof(display_border));
|
||||
oled_set_cursor(21, i);
|
||||
oled_write_raw_P(display_border, sizeof(display_border));
|
||||
}
|
||||
oled_set_cursor(0, 7);
|
||||
oled_write_raw_P(footer_image, sizeof(footer_image));
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
ENCODER_MAP_ENABLE = yes
|
||||
DEBUG_MATRIX_SCAN_RATE_ENABLE = api
|
||||
WPM_ENABLE = yes
|
||||
@@ -82,29 +82,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
EE_CLR, KC_NUKE, _______, _______, QK_BOOT
|
||||
),
|
||||
};
|
||||
|
||||
#if defined(KEYBOARD_bastardkb_charybdis_3x5_blackpill)
|
||||
void keyboard_pre_init_keymap(void) {
|
||||
setPinInputHigh(A0);
|
||||
}
|
||||
|
||||
void housekeeping_task_keymap(void) {
|
||||
if (!readPin(A0)) {
|
||||
reset_keyboard();
|
||||
}
|
||||
}
|
||||
|
||||
# ifdef USB_VBUS_PIN
|
||||
bool usb_vbus_state(void) {
|
||||
setPinInputLow(USB_VBUS_PIN);
|
||||
wait_us(5);
|
||||
return readPin(USB_VBUS_PIN);
|
||||
}
|
||||
# endif
|
||||
|
||||
void matrix_output_unselect_delay(uint8_t line, bool key_pressed) {
|
||||
for (int32_t i = 0; i < 40; i++) {
|
||||
__asm__ volatile("nop" ::: "memory");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -40,6 +40,4 @@ ifeq ($(strip $(OVERLOAD_FEATURES)), yes)
|
||||
CUSTOM_UNICODE_ENABLE = yes
|
||||
CUSTOM_POINTING_DEVICE = yes
|
||||
CUSTOM_SPLIT_TRANSPORT_SYNC = yes
|
||||
|
||||
DEBOUNCE_TYPE = asym_eager_defer_pk
|
||||
endif
|
||||
|
||||
@@ -65,3 +65,5 @@
|
||||
#define BOOTMAGIC_LITE_EEPROM_COLUMN 0
|
||||
#define BOOTMAGIC_LITE_EEPROM_ROW_RIGHT 1
|
||||
#define BOOTMAGIC_LITE_EEPROM_COLUMN_RIGHT 0
|
||||
|
||||
#define DEBOUNCE 15
|
||||
|
||||
@@ -83,7 +83,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
SFT_T(KC_SPACE), ALT_T(KC_Q), _______
|
||||
),
|
||||
[_MOUSE] = LAYOUT_charybdis_4x6(
|
||||
_______, _______, _______, _______, _______, _______, _______, DPI_RMOD,DPI_MOD, S_D_RMOD,S_D_MOD, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, DPI_RMOD,DPI_MOD, S_D_RMOD,S_D_MOD, PD_JIGGLER,
|
||||
_______, _______, _______, _______, _______, _______, KC_WH_U, _______, _______, _______, _______, DRGSCRL,
|
||||
_______, _______, _______, _______, _______, _______, KC_WH_D, KC_BTN1, KC_BTN3, KC_BTN2, KC_BTN6, SNIPING,
|
||||
_______, _______, _______, _______, _______, _______, KC_BTN7, KC_BTN4, KC_BTN5, KC_BTN8, _______, _______,
|
||||
@@ -130,28 +130,6 @@ void keyboard_post_init_keymap(void) {
|
||||
void keyboard_pre_init_keymap(void) {
|
||||
setPinInputHigh(A0);
|
||||
}
|
||||
|
||||
void housekeeping_task_keymap(void) {
|
||||
if (!readPin(A0)) {
|
||||
reset_keyboard();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USB_VBUS_PIN
|
||||
bool usb_vbus_state(void) {
|
||||
setPinInputLow(USB_VBUS_PIN);
|
||||
wait_us(5);
|
||||
return readPin(USB_VBUS_PIN);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(KEYBOARD_bastardkb_charybdis_4x6_blackpill)
|
||||
void matrix_output_unselect_delay(uint8_t line, bool key_pressed) {
|
||||
for (int32_t i = 0; i < 40; i++) {
|
||||
__asm__ volatile("nop" ::: "memory");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SWAP_HANDS_ENABLE
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
CUSTOM_UNICODE_ENABLE = no
|
||||
CUSTOM_POINTING_DEVICE = no
|
||||
CUSTOM_SPLIT_TRANSPORT_SYNC = no
|
||||
PER_KEY_TAPPING = yes
|
||||
|
||||
ifeq ($(strip $(KEYBOARD)), bastardkb/charybdis/4x6/blackpill)
|
||||
# MCU name
|
||||
@@ -16,16 +17,13 @@ ifeq ($(strip $(KEYBOARD)), bastardkb/charybdis/4x6/blackpill)
|
||||
OVERLOAD_FEATURES = yes
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(KEYBOARD)), bastardkb/charybdis/4x6/v2/stemcell)
|
||||
OVERLOAD_FEATURES = yes
|
||||
endif
|
||||
ifeq ($(strip $(KEYBOARD)), bastardkb/charybdis/4x6/v2/splinky)
|
||||
OVERLOAD_FEATURES = yes
|
||||
endif
|
||||
ifeq ($(strip $(MCU)), atmega32u4)
|
||||
LTO_ENABLE = yes
|
||||
BOOTLOADER = qmk-hid
|
||||
BOOTLOADER_SIZE = 512
|
||||
EXTRAKEY_ENABLE = no
|
||||
else
|
||||
OVERLOAD_FEATURES = yes
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(OVERLOAD_FEATURES)), yes)
|
||||
@@ -43,7 +41,6 @@ ifeq ($(strip $(OVERLOAD_FEATURES)), yes)
|
||||
CAPS_WORD_ENABLE = yes
|
||||
SWAP_HANDS_ENABLE = yes
|
||||
TAP_DANCE_ENABLE = yes
|
||||
DEBOUNCE_TYPE = asym_eager_defer_pk
|
||||
WPM_ENABLE = yes
|
||||
LTO_ENABLE = no
|
||||
# OPT = 3
|
||||
|
||||
@@ -6,3 +6,5 @@
|
||||
#define CIRQUE_PINNACLE_TAP_ENABLE
|
||||
#define POINTING_DEVICE_GESTURES_CURSOR_GLIDE_ENABLE
|
||||
#define POINTING_DEVICE_GESTURES_SCROLL_ENABLE
|
||||
|
||||
#define OLED_DISPLAY_128X128
|
||||
|
||||
@@ -84,14 +84,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
),
|
||||
};
|
||||
|
||||
|
||||
void matrix_output_unselect_delay(uint8_t line, bool key_pressed) {
|
||||
for (int32_t i = 0; i < 40; i++) {
|
||||
__asm__ volatile("nop" ::: "memory");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if defined(OLED_ENABLE) && defined(OLED_DISPLAY_128X128)
|
||||
# ifdef UNICODE_COMMON_ENABLE
|
||||
# include "process_unicode_common.h"
|
||||
@@ -100,8 +92,6 @@ void matrix_output_unselect_delay(uint8_t line, bool key_pressed) {
|
||||
|
||||
extern const char PROGMEM display_border[3];
|
||||
|
||||
|
||||
extern uint32_t oled_timer;
|
||||
extern bool is_oled_enabled;
|
||||
|
||||
|
||||
|
||||
@@ -5,4 +5,3 @@ CONSOLE_ENABLE = yes
|
||||
KEYLOGGER_ENABLE = no
|
||||
WPM_ENABLE = yes
|
||||
OLED_ENABLE = yes
|
||||
OLED_DRIVER = custom
|
||||
|
||||
@@ -6,4 +6,3 @@ TAP_DANCE_ENABLE = yes
|
||||
UNICODE_ENABLE = yes
|
||||
OLED_ENABLE = yes
|
||||
WPM_ENABLE = yes
|
||||
# DEBOUNCE_TYPE = sym_eager_pk
|
||||
|
||||
@@ -32,10 +32,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define WS2812_PWM_TARGET_PERIOD 800000
|
||||
|
||||
|
||||
#define RGBLED_NUM 52
|
||||
#define RGBLED_NUM 57
|
||||
#define RGBLIGHT_SPLIT
|
||||
#define RGBLED_SPLIT \
|
||||
{ 26, 26 }
|
||||
{ 26, 31 }
|
||||
|
||||
#define DEBUG_LED_PIN C13
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef RGBLIGHT_LIMIT_VAL
|
||||
# if defined(OLED_ENABLE)
|
||||
# define RGBLIGHT_LIMIT_VAL 100
|
||||
# else
|
||||
# define RGBLIGHT_LIMIT_VAL 150
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef OLED_BRIGHTNESS
|
||||
# ifdef RGBLIGHT_ENABLE
|
||||
# define OLED_BRIGHTNESS 80
|
||||
# else
|
||||
# define OLED_BRIGHTNESS 150
|
||||
# endif
|
||||
#endif
|
||||
@@ -16,21 +16,21 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define DEBOUNCE 45
|
||||
|
||||
#ifdef OLED_DRIVER_SH1107
|
||||
# undef OLED_DISPLAY_128X64
|
||||
#endif
|
||||
#undef OLED_DISPLAY_128X64
|
||||
#define OLED_DISPLAY_128X128
|
||||
#define OLED_BRIGHTNESS 200
|
||||
|
||||
#define CHARYBDIS_MINIMUM_DEFAULT_DPI 1200
|
||||
#define CHARYBDIS_DEFAULT_DPI_CONFIG_STEP 200
|
||||
#define CHARYBDIS_MINIMUM_SNIPING_DPI 400
|
||||
#define CHARYBDIS_SNIPING_DPI_CONFIG_STEP 200
|
||||
|
||||
#define ENCODER_DEFAULT_POS 0x3
|
||||
|
||||
|
||||
#define BOOTMAGIC_LITE_EEPROM_ROW 1
|
||||
#define BOOTMAGIC_LITE_EEPROM_COLUMN 0
|
||||
#define BOOTMAGIC_LITE_EEPROM_ROW_RIGHT 7
|
||||
#define BOOTMAGIC_LITE_EEPROM_COLUMN_RIGHT 5
|
||||
|
||||
|
||||
#define FB_ERM_LRA 0
|
||||
#define DRV_GREETING alert_750ms
|
||||
#define DRV_MODE_DEFAULT buzz
|
||||
|
||||
@@ -90,8 +90,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
KC_LCTL, KC_V, _______, _______
|
||||
),
|
||||
[_MOUSE] = LAYOUT_5x6_right(
|
||||
_______, _______, _______, _______, _______, _______, DRGSCRL, DPI_RMOD,DPI_MOD, S_D_RMOD,S_D_MOD, SNP_TOG,
|
||||
_______, _______, _______, _______, _______, _______, KC_WH_U, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, DPI_RMOD,DPI_MOD, S_D_RMOD,S_D_MOD, PD_JIGGLER,
|
||||
_______, _______, _______, _______, _______, _______, KC_WH_U, _______, _______, _______, _______, DRGSCRL,
|
||||
_______, _______, _______, _______, _______, _______, KC_WH_D, KC_BTN1, KC_BTN3, KC_BTN2, KC_BTN6, SNIPING,
|
||||
_______, _______, _______, _______, _______, _______, KC_BTN7, KC_BTN4, KC_BTN5, KC_BTN8, _______, _______,
|
||||
_______, _______, _______, _______,
|
||||
@@ -115,7 +115,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
_______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS,
|
||||
_______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______,
|
||||
_______, _______, _______, _______,
|
||||
_______, _______, _______,
|
||||
OL_LOCK, _______, _______,
|
||||
_______, _______, _______,
|
||||
_______, _______, _______, _______
|
||||
),
|
||||
@@ -126,96 +126,35 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
UC_NEXT, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, KC_MPLY,
|
||||
TG(_DIABLOII), AUTO_CTN, TG_GAME, TG_DBLO,
|
||||
_______, QK_RBT, KC_NUKE,
|
||||
_______, _______, _______,
|
||||
HF_TOGG, _______, _______,
|
||||
_______, _______, 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][NUM_DIRECTIONS] = {
|
||||
[_DEFAULT_LAYER_1] = { ENCODER_CCW_CW( KC_VOLD, KC_VOLU ), ENCODER_CCW_CW( KC_WH_D, KC_WH_U ) },
|
||||
[_DEFAULT_LAYER_1] = { ENCODER_CCW_CW( KC_VOLU, KC_VOLD ), ENCODER_CCW_CW( KC_WH_U, KC_WH_D ) },
|
||||
[_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 ) },
|
||||
[_MOUSE] = { ENCODER_CCW_CW( _______, _______ ), ENCODER_CCW_CW( _______, _______ ) },
|
||||
[_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( _______, _______ ) },
|
||||
[_RAISE] = { ENCODER_CCW_CW( OL_BINC, OL_BDEC ), ENCODER_CCW_CW( KC_PGDN, KC_PGUP ) },
|
||||
[_LOWER] = { ENCODER_CCW_CW( RGB_MOD, RGB_RMOD), ENCODER_CCW_CW( RGB_HUI, RGB_HUD ) },
|
||||
[_ADJUST] = { ENCODER_CCW_CW( CK_UP, CK_DOWN ), ENCODER_CCW_CW( _______, _______ ) },
|
||||
};
|
||||
// clang-format on
|
||||
# else
|
||||
|
||||
deferred_token encoder_token = INVALID_DEFERRED_TOKEN;
|
||||
static int8_t last_direction = -1;
|
||||
|
||||
static uint32_t encoder_callback(uint32_t trigger_time, void *cb_arg) {
|
||||
unregister_code(last_direction ? KC_WH_D : KC_WH_U);
|
||||
last_direction = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
# ifdef SWAP_HANDS_ENABLE
|
||||
if (swap_hands) {
|
||||
index ^= 1;
|
||||
}
|
||||
# endif
|
||||
if (index == 0) {
|
||||
tap_code_delay(clockwise ? KC_VOLD : KC_VOLU, 5);
|
||||
} else if (index == 1) {
|
||||
if (last_direction != clockwise || encoder_token == INVALID_DEFERRED_TOKEN) {
|
||||
uint8_t keycode = clockwise ? KC_WH_D : KC_WH_U;
|
||||
last_direction = clockwise;
|
||||
if (encoder_token != INVALID_DEFERRED_TOKEN) {
|
||||
if (cancel_deferred_exec(encoder_token)) {
|
||||
encoder_token = INVALID_DEFERRED_TOKEN;
|
||||
}
|
||||
unregister_code(clockwise ? KC_WH_U : KC_WH_D);
|
||||
}
|
||||
register_code(keycode);
|
||||
encoder_token = defer_exec(MOUSEKEY_WHEEL_DELAY + MOUSEKEY_WHEEL_INTERVAL, encoder_callback, NULL);
|
||||
} else {
|
||||
extend_deferred_exec(encoder_token, MOUSEKEY_WHEEL_INTERVAL);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef OLED_ENABLE
|
||||
# include "keyrecords/unicode.h"
|
||||
|
||||
oled_rotation_t oled_init_keymap(oled_rotation_t rotation) {
|
||||
return OLED_ROTATION_180;
|
||||
}
|
||||
|
||||
void oled_render_large_display(bool side) {
|
||||
if (side) {
|
||||
render_wpm_graph(56, 64);
|
||||
} else {
|
||||
oled_advance_page(true);
|
||||
oled_advance_page(true);
|
||||
|
||||
// clang-format off
|
||||
static const char PROGMEM logo[] = {
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94,
|
||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4,
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0x00
|
||||
};
|
||||
// clang-format on
|
||||
oled_write_P(logo, false);
|
||||
|
||||
render_unicode_mode(1, 14);
|
||||
}
|
||||
}
|
||||
|
||||
void render_oled_title(bool side) {
|
||||
oled_write_P(side ? PSTR(" Tractyl ") : PSTR(" Manuform "), true);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ CUSTOM_BOOTMAGIC_ENABLE = no
|
||||
CUSTOM_UNICODE_ENABLE = no
|
||||
HAPTIC_ENABLE = no
|
||||
OLED_ENABLE = no
|
||||
OLED_DRIVER = custom
|
||||
RGBLIGHT_ENABLE = no
|
||||
SWAP_HANDS_ENABLE = no
|
||||
TAP_DANCE_ENABLE = no
|
||||
@@ -16,12 +15,14 @@ ifeq ($(strip $(KEYBOARD)), handwired/tractyl_manuform/5x6_right/elite_c)
|
||||
BOOTLOADER_SIZE = 512
|
||||
CUSTOM_SPLIT_TRANSPORT_SYNC = no
|
||||
LTO_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = no
|
||||
endif
|
||||
ifeq ($(strip $(KEYBOARD)), handwired/tractyl_manuform/5x6_right/arduinomicro)
|
||||
BOOTLOADER = qmk-hid
|
||||
BOOTLOADER_SIZE = 512
|
||||
CUSTOM_SPLIT_TRANSPORT_SYNC = no
|
||||
LTO_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = no
|
||||
endif
|
||||
ifeq ($(strip $(KEYBOARD)), handwired/tractyl_manuform/5x6_right/teensy2pp)
|
||||
AUTOCORRECT_ENABLE = no
|
||||
@@ -33,8 +34,9 @@ ifeq ($(strip $(KEYBOARD)), handwired/tractyl_manuform/5x6_right/f411)
|
||||
AUTOCORRECT_ENABLE = yes
|
||||
LTO_SUPPORTED = no
|
||||
OVERLOAD_FEATURES = yes
|
||||
HAPTIC_ENABLE = yes
|
||||
HAPTIC_DRIVER = DRV2605L
|
||||
endif
|
||||
# DEBOUNCE_TYPE = sym_eager_pk
|
||||
|
||||
ifeq ($(strip $(OVERLOAD_FEATURES)), yes)
|
||||
AUDIO_ENABLE = yes
|
||||
|
||||
@@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define RGBLIGHT_SPLIT
|
||||
#define RGBLED_SPLIT \
|
||||
{ 10, 10 }
|
||||
#define OLED_BRIGHTNESS 50
|
||||
#define RGBLIGHT_LIMIT_VAL 80
|
||||
|
||||
#define DEBUG_LED_PIN D6
|
||||
|
||||
|
||||
@@ -94,3 +94,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#ifndef DEBOUNCE
|
||||
# define DEBOUNCE 5
|
||||
#endif
|
||||
|
||||
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_LIMIT_VAL)
|
||||
# if defined(OLED_ENABLE)
|
||||
# define RGBLIGHT_LIMIT_VAL 100
|
||||
# else
|
||||
# define RGBLIGHT_LIMIT_VAL 150
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(OLED_BRIGHTNESS)
|
||||
# if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
||||
# define OLED_BRIGHTNESS 80
|
||||
# else
|
||||
# define OLED_BRIGHTNESS 150
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "drashna.h"
|
||||
|
||||
/*
|
||||
* The `LAYOUT_base` macro is a template to allow the use of identical
|
||||
* modifiers for the default layouts (eg QWERTY, Colemak, Dvorak, etc), so
|
||||
* that there is no need to set them up for each layout, and modify all of
|
||||
* them if I want to change them. This helps to keep consistency and ease
|
||||
* of use. K## is a placeholder to pass through the individual keycodes
|
||||
*/
|
||||
// clang-format off
|
||||
#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__)
|
||||
#define LAYOUT_base( \
|
||||
K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
|
||||
K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
|
||||
K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \
|
||||
) \
|
||||
LAYOUT_wrapper( \
|
||||
KC_ESC, K01, K02, K03, K04, K05, KC_NO, K06, K07, K08, K09, K0A, KC_DEL, \
|
||||
ALT_T(KC_TAB), K11, K12, K13, K14, K15, KC_BSPC, K16, K17, K18, K19, K1A, RALT_T(K1B), \
|
||||
KC_MLSF, CTL_T(K21), K22, K23, K24, LT(_LOWER,K25), KC_SPC, LT(_RAISE,K26), K27, K28, K29, RCTL_T(K2A), KC_ENT \
|
||||
)
|
||||
#define LAYOUT_base_wrapper(...) LAYOUT_base(__VA_ARGS__)
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
[_DEFAULT_LAYER_1] = LAYOUT_base_wrapper(
|
||||
_________________QWERTY_L1_________________, _________________QWERTY_R1_________________,
|
||||
_________________QWERTY_L2_________________, _________________QWERTY_R2_________________,
|
||||
_________________QWERTY_L3_________________, _________________QWERTY_R3_________________
|
||||
),
|
||||
|
||||
[_DEFAULT_LAYER_2] = LAYOUT_base_wrapper(
|
||||
______________COLEMAK_MOD_DH_L1____________, ______________COLEMAK_MOD_DH_R1____________,
|
||||
______________COLEMAK_MOD_DH_L2____________, ______________COLEMAK_MOD_DH_R2____________,
|
||||
______________COLEMAK_MOD_DH_L3____________, ______________COLEMAK_MOD_DH_R3____________
|
||||
),
|
||||
[_DEFAULT_LAYER_3] = LAYOUT_base_wrapper(
|
||||
_________________COLEMAK_L1________________, _________________COLEMAK_R1________________,
|
||||
_________________COLEMAK_L2________________, _________________COLEMAK_R2________________,
|
||||
_________________COLEMAK_L3________________, _________________COLEMAK_R3________________
|
||||
),
|
||||
|
||||
[_DEFAULT_LAYER_4] = LAYOUT_base_wrapper(
|
||||
_________________DVORAK_L1_________________, _________________DVORAK_R1_________________,
|
||||
_________________DVORAK_L2_________________, _________________DVORAK_R2_________________,
|
||||
_________________DVORAK_L3_________________, _________________DVORAK_R3_________________
|
||||
),
|
||||
|
||||
[_LOWER] = LAYOUT_wrapper(
|
||||
KC_TILD, _________________LOWER_L1__________________, _______, _________________LOWER_R1__________________, KC_BSPC,
|
||||
KC_DEL, _________________LOWER_L2__________________, _______, _________________LOWER_R2__________________, KC_PIPE,
|
||||
_______, _________________LOWER_L3__________________, _______, _________________LOWER_R3__________________, _______
|
||||
),
|
||||
|
||||
[_RAISE] = LAYOUT_wrapper(
|
||||
KC_GRV, _________________RAISE_L1__________________, _______, _________________RAISE_R1__________________, KC_BSPC,
|
||||
KC_DEL, _________________RAISE_L2__________________, _______, _________________RAISE_R2__________________, KC_BSLS,
|
||||
_______, _________________RAISE_L3__________________, _______, _________________RAISE_R3__________________, _______
|
||||
),
|
||||
|
||||
[_ADJUST] = LAYOUT_wrapper(
|
||||
QK_MAKE, _________________ADJUST_L1_________________, KC_NUKE, _________________ADJUST_R1_________________, QK_BOOT,
|
||||
VRSN, _________________ADJUST_L2_________________, MG_NKRO, _________________ADJUST_R2_________________, EE_CLR,
|
||||
TG_MODS, _________________ADJUST_L3_________________, KC_RGB_T,_________________ADJUST_R3_________________, RGB_IDL
|
||||
)
|
||||
};
|
||||
// clang-format on
|
||||
@@ -1,3 +0,0 @@
|
||||
# @drashna's keymap for the C39
|
||||
|
||||
HERE BE DRAGONS
|
||||
@@ -1,19 +0,0 @@
|
||||
# MCU name
|
||||
MCU = STM32F303
|
||||
BOARD = QMK_PROTON_C
|
||||
|
||||
# Bootloader selection
|
||||
BOOTLOADER = stm32-dfu
|
||||
|
||||
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
|
||||
MOUSEKEY_ENABLE = yes
|
||||
EXTRAKEY_ENABLE = yes
|
||||
CONSOLE_ENABLE = yes
|
||||
COMMAND_ENABLE = yes
|
||||
NKRO_ENABLE = yes
|
||||
AUDIO_ENABLE = yes
|
||||
UNICODE_ENABLE = yes
|
||||
HAPTIC_ENABLE = yes
|
||||
HAPTIC_DRIVER = SOLENOID
|
||||
|
||||
RGBLIGHT_STARTUP_ANIMATION = yes
|
||||
@@ -156,7 +156,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||
case KC_SWAP_NUM:
|
||||
if (record->event.pressed) {
|
||||
userspace_config.swapped_numbers ^= 1;
|
||||
eeconfig_update_user(userspace_config.raw);
|
||||
eeconfig_update_user_config(&userspace_config.raw);
|
||||
unregister_code(KC_1);
|
||||
unregister_code(KC_2);
|
||||
}
|
||||
|
||||
@@ -4,3 +4,5 @@ UNICODE_ENABLE = yes
|
||||
UNICODEMAP_ENABLE = no
|
||||
AUTOCORRECT_ENABLE = yes
|
||||
CAPS_WORD_ENABLE = yes
|
||||
|
||||
BOOTLOADER = tinyuf2
|
||||
|
||||
+6
-16
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
/* Copyright 2020 QMK
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -16,19 +16,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
// place overrides here
|
||||
#undef MATRIX_COL_PINS
|
||||
#define MATRIX_COL_PINS \
|
||||
{ A3, A2, A1, A0, B13, B14, B15, B9, B3, B2, B4, A10, A9 }
|
||||
#undef MATRIX_ROW_PINS
|
||||
#define MATRIX_ROW_PINS \
|
||||
{ B7, B1, B0 }
|
||||
#if defined(KEYBOARD_splitkb_kyria_rev3)
|
||||
#define CH_CFG_ST_RESOLUTION 16
|
||||
#define CH_CFG_ST_FREQUENCY 10000
|
||||
#endif
|
||||
|
||||
#define WS2812_DI_PIN B10
|
||||
#define RGBLED_NUM 15
|
||||
|
||||
#define SOLENOID_PIN B11
|
||||
|
||||
#define AUDIO_PIN A5
|
||||
#define AUDIO_PIN_ALT A4
|
||||
#define AUDIO_PIN_ALT_AS_NEGATIVE
|
||||
#include_next <chconf.h>
|
||||
@@ -19,10 +19,10 @@
|
||||
#define EE_HANDS
|
||||
|
||||
#ifdef OLED_ENABLE
|
||||
# ifdef OLED_DRIVER_SH1107
|
||||
# undef OLED_DISPLAY_128X64
|
||||
# define OLED_DISPLAY_128X128
|
||||
# endif
|
||||
# undef OLED_DISPLAY_128X64
|
||||
# define OLED_DISPLAY_128X128
|
||||
# define OLED_PRE_CHARGE_PERIOD 0x22
|
||||
# define OLED_VCOM_DETECT 0x35
|
||||
#endif
|
||||
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
@@ -36,12 +36,41 @@
|
||||
# define RGBLIGHT_LAYERS
|
||||
#endif
|
||||
|
||||
#define KEYLOGGER_LENGTH 10
|
||||
|
||||
#define QMK_ESC_INPUT D4
|
||||
#define QMK_ESC_OUTPUT B2
|
||||
|
||||
#ifndef KEYBOARD_splitkb_kyria_rev3
|
||||
#ifdef KEYBOARD_splitkb_kyria_rev3
|
||||
# define SERIAL_USART_FULL_DUPLEX // Enable full duplex operation mode.
|
||||
# define SERIAL_USART_PIN_SWAP // Swap TX and RX pins if keyboard is master halve.
|
||||
# define SERIAL_USART_DRIVER SD1 // USART driver of TX pin. default: SD1
|
||||
# define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7
|
||||
# undef SOFT_SERIAL_PIN
|
||||
# define SERIAL_USART_TX_PIN D3
|
||||
# define SERIAL_USART_RX_PIN D2
|
||||
|
||||
# undef WS2812_DI_PIN
|
||||
# define WS2812_DI_PIN PAL_LINE(GPIOA, 3)
|
||||
# define WS2812_PWM_DRIVER PWMD2 // default: PWMD2
|
||||
# define WS2812_PWM_CHANNEL 4 // default: 2
|
||||
# define WS2812_PWM_PAL_MODE 1 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 2
|
||||
# define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
|
||||
# define WS2812_DMA_CHANNEL 2 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
|
||||
# define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM2_UP // DMAMUX configuration for TIMx_UP -- only required if your MCU has a DMAMUX peripheral, see the respective reference manual for the appropriate values for your MCU.
|
||||
|
||||
# define BOOTMAGIC_LITE_ROW 0
|
||||
# define BOOTMAGIC_LITE_COLUMN 6
|
||||
# define BOOTMAGIC_LITE_ROW_RIGHT 4
|
||||
# define BOOTMAGIC_LITE_COLUMN_RIGHT 6
|
||||
|
||||
# define BOOTMAGIC_LITE_EEPROM_ROW 1
|
||||
# define BOOTMAGIC_LITE_EEPROM_COLUMN 6
|
||||
# define BOOTMAGIC_LITE_EEPROM_ROW_RIGHT 5
|
||||
# define BOOTMAGIC_LITE_EEPROM_COLUMN_RIGHT 6
|
||||
# define SECURE_UNLOCK_SEQUENCE { {1, 5}, {1, 4}, {1, 3}, {1, 2} }
|
||||
|
||||
# define ENCODER_RESOLUTION 2
|
||||
#else
|
||||
# define BOOTMAGIC_LITE_ROW 0
|
||||
# define BOOTMAGIC_LITE_COLUMN 7
|
||||
# define BOOTMAGIC_LITE_ROW_RIGHT 4
|
||||
@@ -55,7 +84,7 @@
|
||||
|
||||
#define SERIAL_USART_SPEED 921600
|
||||
|
||||
#if defined(KEYBOARD_splitkb_kyria_rev1_proton_c)
|
||||
#if defined(KEYBOARD_splitkb_kyria_rev1_proton_c) || defined(KEYBOARD_splitkb_kyria_rev3)
|
||||
# define WEAR_LEVELING_BACKING_SIZE 16384
|
||||
# define WEAR_LEVELING_LOGICAL_SIZE 8192
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/* Copyright 2020 QMK
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#if defined(KEYBOARD_splitkb_kyria_rev3)
|
||||
# define HAL_USE_I2C TRUE
|
||||
# define HAL_USE_PWM TRUE
|
||||
# define HAL_USE_SERIAL TRUE
|
||||
#endif
|
||||
|
||||
#include_next <halconf.h>
|
||||
@@ -32,7 +32,7 @@
|
||||
K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \
|
||||
) \
|
||||
LAYOUT_wrapper( \
|
||||
KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \
|
||||
SH_T(KC_ESC), K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, SH_T(KC_MINS), \
|
||||
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, TG_GAME, MEH(KC_MINS), TG_DBLO, KC_CAPS, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \
|
||||
KC_MUTE, OS_LALT, KC_GRV, KC_SPC, BK_LWER, DL_RAIS, KC_ENT, OS_RGUI, UC(0x03A8), UC(0x2E2E) \
|
||||
@@ -126,7 +126,7 @@ void render_oled_title(bool side) {
|
||||
}
|
||||
|
||||
oled_rotation_t oled_init_keymap(oled_rotation_t rotation) {
|
||||
# ifdef OLED_DRIVER_SH1107
|
||||
# ifdef OLED_DISPLAY_128X128
|
||||
return OLED_ROTATION_0;
|
||||
# else
|
||||
return OLED_ROTATION_180;
|
||||
@@ -155,7 +155,7 @@ void oled_render_large_display(bool side) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RGBLIGHT_LAYERS
|
||||
#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS)
|
||||
const rgblight_segment_t PROGMEM shift_layers[] = RGBLIGHT_LAYER_SEGMENTS({8, 1, 120, 255, 255}, {18, 1, 120, 255, 255});
|
||||
const rgblight_segment_t PROGMEM control_layers[] = RGBLIGHT_LAYER_SEGMENTS({6, 1, 0, 255, 255}, {16, 1, 0, 255, 255});
|
||||
const rgblight_segment_t PROGMEM alt_layers[] = RGBLIGHT_LAYER_SEGMENTS({2, 1, 240, 255, 255}, {17, 1, 250, 255, 255});
|
||||
@@ -174,12 +174,56 @@ void housekeeping_task_keymap(void) {
|
||||
rgblight_set_layer_state(2, mods & MOD_MASK_ALT);
|
||||
rgblight_set_layer_state(3, mods & MOD_MASK_GUI);
|
||||
}
|
||||
#endif
|
||||
#elif defined(RGB_MATRIX_ENABLE) && defined(KEYBOARD_splitkb_kyria_rev3)
|
||||
void keyboard_post_init_keymap(void) {
|
||||
extern led_config_t g_led_config;
|
||||
g_led_config.flags[30] = g_led_config.flags[24] = g_led_config.flags[18] = g_led_config.flags[12] = g_led_config.flags[11] = g_led_config.flags[10] = g_led_config.flags[9] = g_led_config.flags[8] = g_led_config.flags[7] = g_led_config.flags[6] = g_led_config.flags[37] = g_led_config.flags[38] = g_led_config.flags[39] = g_led_config.flags[40] = g_led_config.flags[41] = g_led_config.flags[42] = g_led_config.flags[43] = g_led_config.flags[49] = g_led_config.flags[55] = g_led_config.flags[61] = LED_FLAG_MODIFIER;
|
||||
}
|
||||
|
||||
#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++) {
|
||||
__asm__ volatile("nop" ::: "memory");
|
||||
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)) {
|
||||
case _QWERTY:
|
||||
rgb_matrix_layer_helper(DEFAULT_LAYER_1_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max);
|
||||
break;
|
||||
case _COLEMAK_DH:
|
||||
rgb_matrix_layer_helper(DEFAULT_LAYER_2_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max);
|
||||
break;
|
||||
case _COLEMAK:
|
||||
rgb_matrix_layer_helper(DEFAULT_LAYER_3_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max);
|
||||
break;
|
||||
case _DVORAK:
|
||||
rgb_matrix_layer_helper(DEFAULT_LAYER_4_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
|
||||
if (userspace_config.rgb_layer_change) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _GAMEPAD:
|
||||
rgb_matrix_layer_helper(HSV_ORANGE, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
|
||||
break;
|
||||
case _DIABLO:
|
||||
rgb_matrix_layer_helper(HSV_RED, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
|
||||
break;
|
||||
case _RAISE:
|
||||
rgb_matrix_layer_helper(HSV_YELLOW, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
|
||||
break;
|
||||
case _LOWER:
|
||||
rgb_matrix_layer_helper(HSV_GREEN, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
|
||||
break;
|
||||
case _ADJUST:
|
||||
rgb_matrix_layer_helper(HSV_RED, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
|
||||
break;
|
||||
case _MOUSE:
|
||||
rgb_matrix_layer_helper(HSV_PURPLE, 1, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
|
||||
break;
|
||||
default:
|
||||
check_default_layer(0, LED_FLAG_UNDERGLOW, led_min, led_max);
|
||||
break;
|
||||
}
|
||||
check_default_layer(0, LED_FLAG_MODIFIER, led_min, led_max);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/* Copyright 2020 Nick Brassel (tzarc)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#if defined(KEYBOARD_splitkb_kyria_rev3)
|
||||
# undef STM32_PWM_USE_ADVANCED
|
||||
# define STM32_PWM_USE_ADVANCED TRUE
|
||||
|
||||
# undef STM32_PWM_USE_TIM2
|
||||
# define STM32_PWM_USE_TIM2 TRUE
|
||||
# undef STM32_PWM_USE_TIM3
|
||||
# define STM32_PWM_USE_TIM3 FALSE
|
||||
|
||||
# undef STM32_SERIAL_USE_USART1
|
||||
# define STM32_SERIAL_USE_USART1 TRUE
|
||||
|
||||
# undef STM32_ST_USE_TIMER
|
||||
# define STM32_ST_USE_TIMER 3
|
||||
#endif
|
||||
@@ -11,6 +11,16 @@ KEY_LOCK_ENABLE = no
|
||||
WPM_ENABLE = yes
|
||||
|
||||
ifeq ($(strip $(KEYBOARD)), splitkb/kyria/rev1/proton_c)
|
||||
OVERLOAD_FEATURES = yes
|
||||
endif
|
||||
ifeq ($(strip $(KEYBOARD)), splitkb/kyria/rev3)
|
||||
OVERLOAD_FEATURES = yes
|
||||
CONVERT_TO = proton_c
|
||||
WS2812_DRIVER = pwm
|
||||
SERIAL_DRIVER = usart
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(OVERLOAD_FEATURES)), yes)
|
||||
RGB_MATRIX_ENABLE = yes
|
||||
CONSOLE_ENABLE = yes # Console for debug
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
@@ -20,7 +30,8 @@ ifeq ($(strip $(KEYBOARD)), splitkb/kyria/rev1/proton_c)
|
||||
ENCODER_MAP_ENABLE = yes
|
||||
AUTOCORRECT_ENABLE = yes
|
||||
CAPS_WORD_ENABLE = yes
|
||||
OLED_DRIVER = custom
|
||||
AUDIO_ENABLE = no
|
||||
DEBUG_MATRIX_SCAN_RATE_ENABLE = api
|
||||
else
|
||||
LTO_ENABLE = yes
|
||||
BOOTLOADER = qmk-hid
|
||||
|
||||
@@ -143,13 +143,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
oled_timer = timer_read32();
|
||||
if (clockwise) {
|
||||
tap_code_delay(KC_VOLU, 10);
|
||||
} else {
|
||||
tap_code_delay(KC_VOLD, 10);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
# The default keymap for zima
|
||||
|
||||
This includes support for the OLED and Encoder. However, the actual code is found in the `zima.c` file. This can be replaced by adding your own `oled_task_user(void)` and `encoder_update_user` functinons. These will replace what is in the keyboard, and allow you to customize these features.
|
||||
|
||||
The reason that this is done this way, is so that this functionality will work on the [QMK Configurator](https://config.qmk.fm/#/splitkb/zima/LAYOUT_ortho_4x3)
|
||||
|
||||
For reference, the code used for the oled and encoder defaults is in [zima.c](https://github.com/qmk/qmk_firmware/tree/master/keyboards/splitkb/zima/zima.c).
|
||||
@@ -91,8 +91,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
};
|
||||
|
||||
#ifdef ENCODER_ENABLE
|
||||
# ifdef ENCODER_MAP_ENABLE
|
||||
#ifdef ENCODER_MAP_ENABLE
|
||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
||||
[_DEFAULT_LAYER_1] = { { KC_DOWN, KC_UP } },
|
||||
[_DEFAULT_LAYER_2] = { { _______, _______ } },
|
||||
@@ -107,23 +106,6 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
||||
[_ADJUST] = { { CK_DOWN, CK_UP } },
|
||||
};
|
||||
// clang-format on
|
||||
# else
|
||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _RAISE:
|
||||
clockwise ? rgblight_step() : rgblight_step_reverse();
|
||||
break;
|
||||
case _LOWER:
|
||||
clockwise ? rgb_matrix_step() : rgb_matrix_step_reverse();
|
||||
break;
|
||||
default:
|
||||
clockwise ? tap_code(KC_VOLU) : tap_code(KC_VOLD);
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
# endif // ENCODER_ENABLE
|
||||
|
||||
#endif
|
||||
|
||||
bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
|
||||
@@ -133,8 +115,7 @@ bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
|
||||
#define THUMB_LED 6
|
||||
#define RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(...) RGB_MATRIX_INDICATOR_SET_COLOR(__VA_ARGS__)
|
||||
|
||||
extern bool host_driver_disabled;
|
||||
if (host_driver_disabled) {
|
||||
if (get_keyboard_lock()) {
|
||||
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(THUMB_LED, RGB_OFF);
|
||||
} else {
|
||||
switch (get_highest_layer(default_layer_state)) {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
|
||||
BOOTMAGIC_ENABLE = yes
|
||||
EXTRAKEY_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = yes
|
||||
TAP_DANCE_ENABLE = no
|
||||
NKRO_ENABLE = yes
|
||||
RGBLIGHT_STARTUP_ANIMATION = yes
|
||||
RGBLIGHT_STARTUP_ANIMATION = no
|
||||
ENCODER_MAP_ENABLE = yes
|
||||
|
||||
AUTOCORRECT_ENABLE = no
|
||||
CUSTOM_UNICODE_ENABLE = no
|
||||
AUTOCORRECT_ENABLE = no
|
||||
CUSTOM_UNICODE_ENABLE = no
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
|
||||
enum more_custom_keycodes {
|
||||
KC_SWAP_NUM = USER_SAFE_RANGE,
|
||||
PM_SCROLL,
|
||||
PM_PRECISION,
|
||||
};
|
||||
|
||||
// define layer change stuff for underglow indicator
|
||||
@@ -44,9 +42,9 @@ bool skip_leds = false;
|
||||
LAYOUT_ergodox_pretty_wrapper( \
|
||||
KC_ESC, ________________NUMBER_LEFT________________, UC_FLIP, UC_TABL, ________________NUMBER_RIGHT_______________, KC_MINS, \
|
||||
LALT_T(KC_TAB), K01, K02, K03, K04, K05, TG_DBLO, TG_DBLO, K06, K07, K08, K09, K0A, KC_BSLS, \
|
||||
KC_C1R3, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(K1B), \
|
||||
KC_MLSF, CTL_T(K21), K22, K23, K24, K25, TG_GAME, TG_GAME, K26, K27, K28, K29, RCTL_T(K2A), KC_MRSF, \
|
||||
KC_GRV, OS_MEH, OS_HYPR, KC_LBRC, KC_RBRC, KC_BTN1, KC_BTN3, KC_BTN2, PM_SCROLL, PM_PRECISION, \
|
||||
KC_C1R3, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(K1B), \
|
||||
KC_MLSF, CTL_T(K21), K22, K23, K24, K25, TG_GAME, TG_GAME, K26, K27, K28, K29, RCTL_T(K2A), KC_MRSF, \
|
||||
KC_GRV, OS_MEH, OS_HYPR, KC_LBRC, KC_RBRC, KC_LEFT, KC_UP, KC_DOWN, KC_RGHT, KC_NO, \
|
||||
OS_LALT, OS_LGUI, OS_RGUI, CTL_T(KC_ESCAPE), \
|
||||
KC_APP, KC_MENU, \
|
||||
KC_SPC, LT(_LOWER, KC_BSPC), OS_LWR, OS_RSE, LT(_RAISE, KC_DEL), KC_ENT \
|
||||
@@ -180,36 +178,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
#ifdef PIMORONI_TRACKBALL_ENABLE
|
||||
void run_trackball_cleanup(void) {
|
||||
// if (trackball_is_scrolling()) {
|
||||
// trackball_set_rgbw(RGB_CYAN, 0x00);
|
||||
// } else if (trackball_get_precision() != 1.0) {
|
||||
// trackball_set_rgbw(RGB_GREEN, 0x00);
|
||||
// } else {
|
||||
// trackball_set_rgbw(RGB_MAGENTA, 0x00);
|
||||
// }
|
||||
}
|
||||
|
||||
void keyboard_post_init_keymap(void) {
|
||||
// trackball_set_precision(1.5);
|
||||
// trackball_set_rgbw(RGB_MAGENTA, 0x00);
|
||||
}
|
||||
// void shutdown_keymap(void) { trackball_set_rgbw(RGB_RED, 0x00); }
|
||||
|
||||
static bool mouse_button_one, trackball_button_one;
|
||||
|
||||
void trackball_register_button(bool pressed, enum mouse_buttons button) {
|
||||
report_mouse_t currentReport = pointing_device_get_report();
|
||||
if (pressed) {
|
||||
currentReport.buttons |= button;
|
||||
} else {
|
||||
currentReport.buttons &= ~button;
|
||||
}
|
||||
pointing_device_set_report(currentReport);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case KC_1:
|
||||
@@ -235,40 +203,15 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||
case KC_SWAP_NUM:
|
||||
if (record->event.pressed) {
|
||||
userspace_config.swapped_numbers ^= 1;
|
||||
eeconfig_update_user(userspace_config.raw);
|
||||
eeconfig_update_user_config(&userspace_config.raw);
|
||||
}
|
||||
break;
|
||||
#ifdef PIMORONI_TRACKBALL_ENABLE
|
||||
case PM_SCROLL:
|
||||
// trackball_set_scrolling(record->event.pressed);
|
||||
run_trackball_cleanup();
|
||||
break;
|
||||
case PM_PRECISION:
|
||||
// if (record->event.pressed) {
|
||||
// trackball_set_precision(1.5);
|
||||
// } else {
|
||||
// trackball_set_precision(1);
|
||||
// }
|
||||
// run_trackball_cleanup();
|
||||
break;
|
||||
# if !defined(MOUSEKEY_ENABLE)
|
||||
case KC_MS_BTN1:
|
||||
mouse_button_one = record->event.pressed;
|
||||
trackball_register_button(mouse_button_one | trackball_button_one, MOUSE_BTN1);
|
||||
break;
|
||||
case KC_MS_BTN2:
|
||||
trackball_register_button(record->event.pressed, MOUSE_BTN2);
|
||||
break;
|
||||
case KC_MS_BTN3:
|
||||
trackball_register_button(record->event.pressed, MOUSE_BTN3);
|
||||
break;
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void housekeeping_task_keymap(void) { // runs frequently to update info
|
||||
#ifdef KEYBOARD_ergodox_ez
|
||||
uint8_t modifiers = get_mods();
|
||||
uint8_t led_usb_state = host_keyboard_leds();
|
||||
uint8_t one_shot = get_oneshot_mods();
|
||||
@@ -295,6 +238,7 @@ void housekeeping_task_keymap(void) { // runs frequently to update info
|
||||
ergodox_right_led_3_set(10);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool indicator_is_this_led_used_keyboard(uint8_t index) {
|
||||
|
||||
@@ -8,10 +8,13 @@ ifeq ($(strip $(KEYBOARD)), ergodox_ez)
|
||||
RGB_MATRIX_ENABLE = yes
|
||||
INDICATOR_LIGHTS = no
|
||||
RGBLIGHT_STARTUP_ANIMATION = yes
|
||||
PIMORONI_TRACKBALL_ENABLE = no
|
||||
MOUSEKEY_ENABLE = no
|
||||
endif
|
||||
|
||||
UNICODE_ENABLE = no
|
||||
UNICDOEMAP_ENABLE = no
|
||||
CUSTOM_UNICODE_ENABLE = no
|
||||
|
||||
ifeq ($(strip $(KEYBOARD)), hotdox76v2)
|
||||
OLED_ENABLE = no
|
||||
RGB_MATRIX_ENABLE = no
|
||||
endif
|
||||
|
||||
@@ -237,34 +237,6 @@ void keyboard_post_init_keymap(void) {
|
||||
}
|
||||
#endif // RGB_MATRIX_INIT
|
||||
|
||||
#ifdef ENCODER_ENABLE
|
||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _RAISE:
|
||||
clockwise ? tap_code(KC_VOLD) : tap_code(KC_VOLU);
|
||||
break;
|
||||
case _LOWER:
|
||||
# ifdef RGB_MATRIX_ENABLE
|
||||
clockwise ? rgb_matrix_step() : rgb_matrix_step_reverse();
|
||||
# else
|
||||
clockwise ? tap_code(KC_PGDN) : tap_code(KC_PGUP);
|
||||
# endif
|
||||
break;
|
||||
case _ADJUST:
|
||||
# ifdef AUDIO_CLICKY
|
||||
clockwise ? clicky_freq_up() : clicky_freq_down();
|
||||
# endif
|
||||
break;
|
||||
default:
|
||||
clockwise ? tap_code(KC_DOWN) : tap_code(KC_UP);
|
||||
}
|
||||
# ifdef AUDIO_CLICKY
|
||||
clicky_play();
|
||||
# endif
|
||||
return true;
|
||||
}
|
||||
#endif // ENCODER_ENABLE
|
||||
|
||||
#ifdef KEYBOARD_planck_rev6
|
||||
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||
switch (index) {
|
||||
|
||||
@@ -28,7 +28,7 @@ void bootmagic_lite(void) {
|
||||
if (!is_keyboard_left()) {
|
||||
row = BOOTMAGIC_LITE_ROW_RIGHT;
|
||||
col = BOOTMAGIC_LITE_COLUMN_RIGHT;
|
||||
#if defined(BOOTMAGIC_LITE_EEPROM_ROW) && defined(BOOTMAGIC_LITE_EEPROM_COLUMN) && defined(BOOTMAGIC_LITE_EEPROM_ROW_RIGHT) && defined(BOOTMAGIC_LITE_EEPROM_COLUMN_RIGHT)
|
||||
# if defined(BOOTMAGIC_LITE_EEPROM_ROW) && defined(BOOTMAGIC_LITE_EEPROM_COLUMN) && defined(BOOTMAGIC_LITE_EEPROM_ROW_RIGHT) && defined(BOOTMAGIC_LITE_EEPROM_COLUMN_RIGHT)
|
||||
row_e = BOOTMAGIC_LITE_EEPROM_ROW_RIGHT;
|
||||
col_e = BOOTMAGIC_LITE_EEPROM_COLUMN_RIGHT;
|
||||
# endif
|
||||
|
||||
+47
-60
@@ -3,6 +3,9 @@
|
||||
|
||||
#include "drashna.h"
|
||||
|
||||
#ifdef CUSTOM_DYNAMIC_MACROS_ENABLE
|
||||
# include "keyrecords/dynamic_macros.h"
|
||||
#endif
|
||||
#ifdef I2C_SCANNER_ENABLE
|
||||
void housekeeping_task_i2c_scanner(void);
|
||||
void keyboard_post_init_i2c(void);
|
||||
@@ -10,7 +13,10 @@ void keyboard_post_init_i2c(void);
|
||||
|
||||
__attribute__((weak)) void keyboard_pre_init_keymap(void) {}
|
||||
void keyboard_pre_init_user(void) {
|
||||
userspace_config.raw = eeconfig_read_user();
|
||||
eeconfig_read_user_config(&userspace_config.raw);
|
||||
if (!userspace_config.check) {
|
||||
eeconfig_init_user();
|
||||
}
|
||||
keyboard_pre_init_keymap();
|
||||
}
|
||||
// Add reconfigurable functions here, for keymap customization
|
||||
@@ -24,58 +30,8 @@ void keyboard_pre_init_user(void) {
|
||||
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;
|
||||
}
|
||||
#if defined(OS_DETECTION_ENABLE) && defined(DEFERRED_EXEC_ENABLE)
|
||||
uint32_t startup_exec(uint32_t trigger_time, void *cb_arg);
|
||||
#endif
|
||||
|
||||
__attribute__((weak)) void keyboard_post_init_keymap(void) {}
|
||||
@@ -103,8 +59,10 @@ void keyboard_post_init_user(void) {
|
||||
DDRB &= ~(1 << 0);
|
||||
PORTB &= ~(1 << 0);
|
||||
#endif
|
||||
|
||||
#ifdef OS_DETECTION_ENABLE
|
||||
#ifdef CUSTOM_DYNAMIC_MACROS_ENABLE
|
||||
dynamic_macro_init();
|
||||
#endif
|
||||
#if defined(OS_DETECTION_ENABLE) && defined(DEFERRED_EXEC_ENABLE)
|
||||
defer_exec(100, startup_exec, NULL);
|
||||
#endif
|
||||
|
||||
@@ -153,9 +111,6 @@ void suspend_power_down_user(void) {
|
||||
|
||||
__attribute__((weak)) void suspend_wakeup_init_keymap(void) {}
|
||||
void suspend_wakeup_init_user(void) {
|
||||
#ifdef OLED_ENABLE
|
||||
oled_timer_reset();
|
||||
#endif
|
||||
suspend_wakeup_init_keymap();
|
||||
}
|
||||
|
||||
@@ -217,6 +172,11 @@ layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
__attribute__((weak)) layer_state_t default_layer_state_set_keymap(layer_state_t state) {
|
||||
return state;
|
||||
}
|
||||
|
||||
#if defined(AUDIO_ENABLE) && defined(DEFAULT_LAYER_SONGS)
|
||||
static float default_layer_songs[][MAX_LAYER][2] = DEFAULT_LAYER_SONGS;
|
||||
#endif
|
||||
|
||||
layer_state_t default_layer_state_set_user(layer_state_t state) {
|
||||
if (!is_keyboard_master()) {
|
||||
return state;
|
||||
@@ -226,6 +186,21 @@ layer_state_t default_layer_state_set_user(layer_state_t state) {
|
||||
#if defined(CUSTOM_RGBLIGHT)
|
||||
state = default_layer_state_set_rgb_light(state);
|
||||
#endif
|
||||
|
||||
static bool has_init_been_ran = false;
|
||||
// We don't want to run this the first time it's called, since it's read from eeeprom and called
|
||||
// as part of the startup process. But after that, it's okay.
|
||||
if (has_init_been_ran) {
|
||||
#if defined(AUDIO_ENABLE) && defined(DEFAULT_LAYER_SONGS)
|
||||
if (get_highest_layer(state) < MAX_LAYER) {
|
||||
PLAY_SONG(default_layer_songs[get_highest_layer(state)]);
|
||||
}
|
||||
#endif
|
||||
eeconfig_update_default_layer(state);
|
||||
} else {
|
||||
has_init_been_ran = true;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -238,11 +213,23 @@ __attribute__((weak)) void eeconfig_init_keymap(void) {}
|
||||
void eeconfig_init_user(void) {
|
||||
userspace_config.raw = 0;
|
||||
userspace_config.rgb_layer_change = true;
|
||||
userspace_config.autocorrection = true;
|
||||
eeconfig_update_user(userspace_config.raw);
|
||||
userspace_config.check = true;
|
||||
#if defined(OLED_ENABLE)
|
||||
userspace_config.oled_brightness = OLED_BRIGHTNESS;
|
||||
#else
|
||||
userspace_config.oled_brightness = 255;
|
||||
#endif
|
||||
eeconfig_update_user_config(&userspace_config.raw);
|
||||
eeconfig_init_keymap();
|
||||
}
|
||||
|
||||
void eeconfig_init_user_datablock(void) {
|
||||
#if (EECONFIG_USER_DATA_SIZE) > 4
|
||||
uint8_t eeconfig_empty_temp[(EECONFIG_USER_DATA_SIZE)-4] = {0};
|
||||
eeconfig_update_user_data(eeconfig_empty_temp);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
__attribute__((weak)) void matrix_slave_scan_keymap(void) {}
|
||||
void matrix_slave_scan_user(void) {
|
||||
|
||||
+16
-5
@@ -3,9 +3,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
// Use custom magic number so that when switching branches, EEPROM always gets reset
|
||||
#define EECONFIG_MAGIC_NUMBER (uint16_t)0x1339
|
||||
|
||||
#ifdef IS_COMMAND
|
||||
# undef IS_COMMAND
|
||||
#endif
|
||||
@@ -43,7 +40,6 @@
|
||||
# define WPM_ESTIMATED_WORD_SIZE 5
|
||||
#endif
|
||||
|
||||
|
||||
#define UNICODE_SELECTED_MODES UNICODE_MODE_WINCOMPOSE, UNICODE_MODE_MACOS
|
||||
|
||||
#ifndef ONESHOT_TAP_TOGGLE
|
||||
@@ -98,7 +94,22 @@
|
||||
# define C15 PAL_LINE(GPIOC, 15)
|
||||
#endif
|
||||
|
||||
|
||||
#define ENABLE_COMPILE_KEYCODE
|
||||
|
||||
#define BOTH_SHIFTS_TURNS_ON_CAPS_WORD
|
||||
|
||||
/* --- PRINTF_BYTE_TO_BINARY macro's --- */
|
||||
#define PRINTF_BINARY_PATTERN_INT8 "%c%c%c%c%c%c%c%c"
|
||||
#define PRINTF_BYTE_TO_BINARY_INT8(i) (((i)&0x80ll) ? '1' : '0'), (((i)&0x40ll) ? '1' : '0'), (((i)&0x20ll) ? '1' : '0'), (((i)&0x10ll) ? '1' : '0'), (((i)&0x08ll) ? '1' : '0'), (((i)&0x04ll) ? '1' : '0'), (((i)&0x02ll) ? '1' : '0'), (((i)&0x01ll) ? '1' : '0')
|
||||
|
||||
#define PRINTF_BINARY_PATTERN_INT16 PRINTF_BINARY_PATTERN_INT8 " " PRINTF_BINARY_PATTERN_INT8
|
||||
#define PRINTF_BYTE_TO_BINARY_INT16(i) PRINTF_BYTE_TO_BINARY_INT8((i) >> 8), PRINTF_BYTE_TO_BINARY_INT8(i)
|
||||
#define PRINTF_BINARY_PATTERN_INT32 PRINTF_BINARY_PATTERN_INT16 " " PRINTF_BINARY_PATTERN_INT16
|
||||
#define PRINTF_BYTE_TO_BINARY_INT32(i) PRINTF_BYTE_TO_BINARY_INT16((i) >> 16), PRINTF_BYTE_TO_BINARY_INT16(i)
|
||||
#define PRINTF_BINARY_PATTERN_INT64 PRINTF_BINARY_PATTERN_INT32 " " PRINTF_BINARY_PATTERN_INT32
|
||||
#define PRINTF_BYTE_TO_BINARY_INT64(i) PRINTF_BYTE_TO_BINARY_INT32((i) >> 32), PRINTF_BYTE_TO_BINARY_INT32(i)
|
||||
/* --- end macros --- */
|
||||
|
||||
#ifndef EECONFIG_USER_DATA_SIZE
|
||||
# define EECONFIG_USER_DATA_SIZE 8
|
||||
#endif
|
||||
|
||||
+112
-2
@@ -2,6 +2,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "drashna.h"
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
userspace_config_t userspace_config;
|
||||
|
||||
@@ -139,7 +141,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;
|
||||
}
|
||||
@@ -188,7 +190,7 @@ void oneshot_locked_mods_changed_user(uint8_t mods) {
|
||||
# endif
|
||||
#endif
|
||||
|
||||
void format_layer_bitmap_string(char* buffer, layer_state_t state, layer_state_t default_state) {
|
||||
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 = ' ';
|
||||
@@ -207,3 +209,111 @@ void format_layer_bitmap_string(char* buffer, layer_state_t state, layer_state_t
|
||||
}
|
||||
*buffer = 0;
|
||||
}
|
||||
|
||||
#if defined(OS_DETECTION_ENABLE) && defined(DEFERRED_EXEC_ENABLE)
|
||||
os_variant_t os_type;
|
||||
|
||||
uint32_t startup_exec(uint32_t trigger_time, void *cb_arg) {
|
||||
if (is_keyboard_master()) {
|
||||
os_type = detected_host_os();
|
||||
if (os_type) {
|
||||
bool is_mac = (os_type == OS_MACOS) || (os_type == OS_IOS);
|
||||
if (keymap_config.swap_lctl_lgui != is_mac) {
|
||||
keymap_config.swap_lctl_lgui = keymap_config.swap_rctl_rgui = is_mac;
|
||||
eeconfig_update_keymap(keymap_config.raw);
|
||||
}
|
||||
# ifdef UNICODE_COMMON_ENABLE
|
||||
set_unicode_input_mode_soft(keymap_config.swap_lctl_lgui ? UNICODE_MODE_MACOS : UNICODE_MODE_WINCOMPOSE);
|
||||
# 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
|
||||
|
||||
static host_driver_t *host_driver = 0;
|
||||
static bool host_driver_disabled = false;
|
||||
|
||||
void set_keyboard_lock(bool status) {
|
||||
if (!status && !host_get_driver()) {
|
||||
host_set_driver(host_driver);
|
||||
} else if (status && host_get_driver()) {
|
||||
host_driver = host_get_driver();
|
||||
clear_keyboard();
|
||||
host_set_driver(0);
|
||||
} else if (status) {
|
||||
clear_keyboard();
|
||||
}
|
||||
|
||||
host_driver_disabled = status;
|
||||
}
|
||||
|
||||
void toggle_keyboard_lock(void) {
|
||||
set_keyboard_lock(!host_driver_disabled);
|
||||
}
|
||||
|
||||
bool get_keyboard_lock(void) {
|
||||
return host_driver_disabled;
|
||||
}
|
||||
|
||||
const char *get_layer_name_string(layer_state_t state, bool alt_name) {
|
||||
switch (get_highest_layer(state)) {
|
||||
case _QWERTY:
|
||||
return alt_name ? "Num Pad" : "QWERTY";
|
||||
case _COLEMAK:
|
||||
return "Colemak";
|
||||
case _COLEMAK_DH:
|
||||
return "Colemak-DH";
|
||||
case _DVORAK:
|
||||
return "Dvorak";
|
||||
case _GAMEPAD:
|
||||
return "Gamepad";
|
||||
case _DIABLO:
|
||||
return "Diablo";
|
||||
case _DIABLOII:
|
||||
return "Diablo II";
|
||||
case _MOUSE:
|
||||
return alt_name ? "Macros" : "Mouse";
|
||||
case _MEDIA:
|
||||
return "Media";
|
||||
case _LOWER:
|
||||
return "Lower";
|
||||
case _RAISE:
|
||||
return "Raise";
|
||||
case _ADJUST:
|
||||
return "Adjust";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
+21
-7
@@ -4,7 +4,7 @@
|
||||
#pragma once
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#include "eeprom.h"
|
||||
#include "eeconfig_users.h"
|
||||
#include "keyrecords/wrappers.h"
|
||||
#include "keyrecords/process_records.h"
|
||||
#include "callbacks.h"
|
||||
@@ -30,6 +30,9 @@
|
||||
#ifdef OS_DETECTION_ENABLE
|
||||
# include "os_detection.h"
|
||||
#endif
|
||||
#ifdef UNICODE_COMMON_ENABLE
|
||||
# include "keyrecords/unicode.h"
|
||||
#endif
|
||||
|
||||
/* Define layer names */
|
||||
enum userspace_layers {
|
||||
@@ -88,14 +91,25 @@ void format_layer_bitmap_string(char* buffer, layer_state_t state, layer_state_t
|
||||
typedef union {
|
||||
uint32_t raw;
|
||||
struct {
|
||||
bool rgb_layer_change :1;
|
||||
bool is_overwatch :1;
|
||||
bool nuke_switch :1;
|
||||
bool swapped_numbers :1;
|
||||
bool rgb_matrix_idle_anim :1;
|
||||
bool autocorrection :1;
|
||||
bool rgb_layer_change :1;
|
||||
bool is_overwatch :1;
|
||||
bool nuke_switch :1;
|
||||
bool swapped_numbers :1;
|
||||
bool rgb_matrix_idle_anim :1;
|
||||
bool mouse_jiggler :1;
|
||||
uint8_t align_reserved :2;
|
||||
uint8_t oled_brightness :8;
|
||||
uint32_t reserved :15;
|
||||
bool check :1;
|
||||
};
|
||||
} userspace_config_t;
|
||||
// clang-format on
|
||||
|
||||
_Static_assert(sizeof(userspace_config_t) == sizeof(uint32_t), "Userspace EECONFIG out of spec.");
|
||||
|
||||
extern userspace_config_t userspace_config;
|
||||
|
||||
void set_keyboard_lock(bool enable);
|
||||
bool get_keyboard_lock(void);
|
||||
void toggle_keyboard_lock(void);
|
||||
const char* get_layer_name_string(layer_state_t state, bool alt_name);
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// Copyright 2023 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "eeconfig_users.h"
|
||||
#include "eeprom.h"
|
||||
#include "eeconfig.h"
|
||||
#include <string.h>
|
||||
|
||||
#if (TOTAL_EEPROM_BYTE_COUNT - 1) < EECONFIG_SIZE && !defined(KEYBOARD_input_club_ergodox_infinity)
|
||||
# error "More eeprom configured than is available."
|
||||
#endif
|
||||
#if (EECONFIG_USER_DATA_SIZE) != 0 && (EECONFIG_USER_DATA_SIZE) < 4
|
||||
# error "Not enough EEPROM configured for user config."
|
||||
#endif
|
||||
|
||||
#if (EECONFIG_USER_DATA_SIZE) == 0
|
||||
# define EECONFIG_USER_TEMP EECONFIG_USER
|
||||
#else
|
||||
# define EECONFIG_USER_TEMP (uint32_t *)(EECONFIG_USER_DATABLOCK)
|
||||
#endif
|
||||
|
||||
void eeconfig_read_user_config(uint32_t *data) {
|
||||
#if (EECONFIG_USER_DATA_SIZE) > 0
|
||||
if (!eeconfig_is_user_datablock_valid()) {
|
||||
memset(data, 0, 4);
|
||||
} else
|
||||
#endif
|
||||
eeprom_read_block(data, EECONFIG_USER_TEMP, 4);
|
||||
}
|
||||
|
||||
void eeconfig_update_user_config(const uint32_t *data) {
|
||||
eeprom_update_block(data, EECONFIG_USER_TEMP, 4);
|
||||
#if (EECONFIG_USER_DATA_SIZE) > 0
|
||||
eeprom_update_dword(EECONFIG_USER, (EECONFIG_USER_DATA_VERSION));
|
||||
#endif
|
||||
}
|
||||
|
||||
void eeconfig_read_user_data(void *data) {
|
||||
#if (EECONFIG_USER_DATA_SIZE) > 4
|
||||
if (eeconfig_is_user_datablock_valid()) {
|
||||
eeprom_read_block(data, EECONFIG_USER_DATABLOCK + 4, (EECONFIG_USER_DATA_SIZE)-4);
|
||||
} else {
|
||||
memset(data, 0, (EECONFIG_USER_DATA_SIZE));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void eeconfig_update_user_data(const void *data) {
|
||||
#if (EECONFIG_USER_DATA_SIZE) > 4
|
||||
eeprom_update_dword(EECONFIG_USER, (EECONFIG_USER_DATA_VERSION));
|
||||
eeprom_update_block(data, EECONFIG_USER_DATABLOCK + 4, (EECONFIG_USER_DATA_SIZE)-4);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// Copyright 2023 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void eeconfig_read_user_config(uint32_t *data);
|
||||
void eeconfig_update_user_config(const uint32_t *data);
|
||||
|
||||
void eeconfig_read_user_data(void *data);
|
||||
void eeconfig_update_user_data(const void *data);
|
||||
@@ -0,0 +1,283 @@
|
||||
// Copyright 2016 Jack Humbert
|
||||
// Copyright 2019 Wojciech Siewierski < wojciech dot siewierski at onet dot pl >
|
||||
// Copyright 2023 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "keyrecords/dynamic_macros.h"
|
||||
#include "keyrecords/process_records.h"
|
||||
#include "wait.h"
|
||||
#include "debug.h"
|
||||
#include "eeprom.h"
|
||||
#include "eeconfig.h"
|
||||
#include <string.h>
|
||||
|
||||
static uint8_t macro_id = 255;
|
||||
static uint8_t recording_state = STATE_NOT_RECORDING;
|
||||
|
||||
#if EECONFIG_USER_DATA_SIZE < 4
|
||||
# error "EECONFIG_USER_DATA_SIZE not set. Don't step on others eeprom."
|
||||
#endif
|
||||
#ifndef DYNAMIC_MACRO_EEPROM_BLOCK0_ADDR
|
||||
# define DYNAMIC_MACRO_EEPROM_BLOCK0_ADDR (uint8_t*)(EECONFIG_USER_DATABLOCK + 4)
|
||||
#endif
|
||||
|
||||
dynamic_macro_t dynamic_macros[DYNAMIC_MACRO_COUNT];
|
||||
_Static_assert((sizeof(dynamic_macros)) <= (EECONFIG_USER_DATA_SIZE - 4), "User Data Size must be large enough to host all macros");
|
||||
|
||||
__attribute__((weak)) void dynamic_macro_record_start_user(void) {}
|
||||
|
||||
__attribute__((weak)) void dynamic_macro_play_user(uint8_t macro_id) {}
|
||||
|
||||
__attribute__((weak)) void dynamic_macro_record_key_user(uint8_t macro_id, keyrecord_t* record) {}
|
||||
|
||||
__attribute__((weak)) void dynamic_macro_record_end_user(uint8_t macro_id) {}
|
||||
|
||||
/**
|
||||
* @brief Gets the current macro ID
|
||||
*
|
||||
* @return uint8_t
|
||||
*/
|
||||
uint8_t dynamic_macro_get_current_id(void) {
|
||||
return macro_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the current recording state
|
||||
*
|
||||
* @return uint8_t
|
||||
*/
|
||||
uint8_t dynamic_macro_get_recording_state(void) {
|
||||
return recording_state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start recording of the dynamic macro.
|
||||
*
|
||||
* @param macro_id[in] The id of macro to be recorded
|
||||
*/
|
||||
bool dynamic_macro_record_start(uint8_t macro_id) {
|
||||
if (macro_id >= (uint8_t)(DYNAMIC_MACRO_COUNT)) {
|
||||
return false;
|
||||
}
|
||||
dprintf("dynamic macro recording: started for slot %d\n", macro_id);
|
||||
|
||||
dynamic_macro_record_start_user();
|
||||
|
||||
clear_keyboard();
|
||||
layer_clear();
|
||||
|
||||
dynamic_macros[macro_id].length = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Play the dynamic macro.
|
||||
*
|
||||
* @param macro_id[in] The id of macro to be played
|
||||
*/
|
||||
void dynamic_macro_play(uint8_t macro_id) {
|
||||
if (macro_id >= (uint8_t)(DYNAMIC_MACRO_COUNT)) {
|
||||
return;
|
||||
}
|
||||
|
||||
dprintf("dynamic macro: slot %d playback, length %d\n", macro_id, dynamic_macros[macro_id].length);
|
||||
|
||||
layer_state_t saved_layer_state = layer_state;
|
||||
|
||||
clear_keyboard();
|
||||
layer_clear();
|
||||
|
||||
for (uint8_t i = 0; i < dynamic_macros[macro_id].length; ++i) {
|
||||
process_record(&dynamic_macros[macro_id].events[i]);
|
||||
}
|
||||
|
||||
clear_keyboard();
|
||||
|
||||
layer_state_set(saved_layer_state);
|
||||
|
||||
dynamic_macro_play_user(macro_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Record a single key in a dynamic macro.
|
||||
*
|
||||
* @param macro_id[in] The start of the used macro buffer.
|
||||
* @param record[in] The current keypress.
|
||||
*/
|
||||
void dynamic_macro_record_key(uint8_t macro_id, keyrecord_t* record) {
|
||||
dynamic_macro_t* macro = &dynamic_macros[macro_id];
|
||||
uint8_t length = macro->length;
|
||||
|
||||
/* If we've just started recording, ignore all the key releases. */
|
||||
if (!record->event.pressed && length == 0) {
|
||||
dprintln("dynamic macro: ignoring a leading key-up event");
|
||||
return;
|
||||
}
|
||||
|
||||
if (length < DYNAMIC_MACRO_SIZE) {
|
||||
macro->events[length] = *record;
|
||||
macro->length = ++length;
|
||||
} else {
|
||||
dynamic_macro_record_key_user(macro_id, record);
|
||||
}
|
||||
|
||||
dprintf("dynamic macro: slot %d length: %d/%d\n", macro_id, length, DYNAMIC_MACRO_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
* End recording of the dynamic macro. Essentially just update the
|
||||
* pointer to the end of the macro.
|
||||
*/
|
||||
void dynamic_macro_record_end(uint8_t macro_id) {
|
||||
if (macro_id >= (uint8_t)(DYNAMIC_MACRO_COUNT)) {
|
||||
return;
|
||||
}
|
||||
dynamic_macro_record_end_user(macro_id);
|
||||
|
||||
dynamic_macro_t* macro = &dynamic_macros[macro_id];
|
||||
uint8_t length = macro->length;
|
||||
|
||||
keyrecord_t* events_begin = &(macro->events[0]);
|
||||
keyrecord_t* events_pointer = &(macro->events[length - 1]);
|
||||
|
||||
dprintf("dynamic_macro: macro length before trimming: %d\n", macro->length);
|
||||
while (events_pointer != events_begin && (events_pointer)->event.pressed) {
|
||||
dprintln("dynamic macro: trimming a trailing key-down event");
|
||||
--(macro->length);
|
||||
--events_pointer;
|
||||
}
|
||||
|
||||
macro->checksum = dynamic_macro_calc_crc(macro);
|
||||
dynamic_macro_save_eeprom(macro_id);
|
||||
|
||||
dprintf("dynamic macro: slot %d saved, length: %d\n", macro_id, length);
|
||||
}
|
||||
|
||||
bool process_record_dynamic_macro(uint16_t keycode, keyrecord_t* record) {
|
||||
if (STATE_NOT_RECORDING == recording_state) {
|
||||
/* Program key pressed to request programming mode */
|
||||
if (keycode == DYN_MACRO_PROG && record->event.pressed) {
|
||||
// dynamic_macro_led_blink();
|
||||
|
||||
recording_state = STATE_RECORD_KEY_PRESSED;
|
||||
dprintf("dynamic macro: programming key pressed, waiting for macro slot selection. %d\n", recording_state);
|
||||
|
||||
return false;
|
||||
}
|
||||
/* Macro key pressed to request macro playback */
|
||||
if (IS_DYN_KEYCODE(keycode) && record->event.pressed) {
|
||||
dynamic_macro_play(keycode - DYN_MACRO_KEY00);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Non-dynamic macro key, process it elsewhere. */
|
||||
return true;
|
||||
} else if (STATE_RECORD_KEY_PRESSED == recording_state) {
|
||||
/* Program key pressed again before a macro selector key, cancel macro recording.
|
||||
Blink leds to indicate cancelation. */
|
||||
if (keycode == DYN_MACRO_PROG && record->event.pressed) {
|
||||
// dynamic_macro_led_blink();
|
||||
|
||||
recording_state = STATE_NOT_RECORDING;
|
||||
dprintf("dynamic macro: programming key pressed, programming mode canceled. %d\n", recording_state);
|
||||
|
||||
return false;
|
||||
} else if (IS_DYN_KEYCODE(keycode) && record->event.pressed) {
|
||||
macro_id = keycode - DYN_MACRO_KEY00;
|
||||
|
||||
if (dynamic_macro_record_start(macro_id)) {
|
||||
/* Macro slot selected, enter recording state. */
|
||||
recording_state = STATE_CURRENTLY_RECORDING;
|
||||
} else {
|
||||
recording_state = STATE_NOT_RECORDING;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
/* Ignore any non-macro key press while in RECORD_KEY_PRESSED state. */
|
||||
return false;
|
||||
} else if (STATE_CURRENTLY_RECORDING == recording_state) {
|
||||
/* Program key pressed to request end of macro recording. */
|
||||
if (keycode == DYN_MACRO_PROG && record->event.pressed) {
|
||||
dynamic_macro_record_end(macro_id);
|
||||
recording_state = STATE_NOT_RECORDING;
|
||||
|
||||
return false;
|
||||
}
|
||||
/* Don't record other macro key presses. */
|
||||
else if (IS_DYN_KEYCODE(keycode) && record->event.pressed) {
|
||||
dprintln("dynamic macro: playback key ignored in programming mode.");
|
||||
return false;
|
||||
}
|
||||
/* Non-macro keypress that should be recorded */
|
||||
else {
|
||||
dynamic_macro_record_key(macro_id, record);
|
||||
|
||||
/* Don't output recorded keypress. */
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline uint16_t crc16_update(uint16_t crc, uint8_t a) {
|
||||
crc ^= a;
|
||||
for (uint8_t i = 0; i < 8; ++i) {
|
||||
if (crc & 1)
|
||||
crc = (crc >> 1) ^ 0xA001;
|
||||
else
|
||||
crc = (crc >> 1);
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
|
||||
uint16_t dynamic_macro_calc_crc(dynamic_macro_t* macro) {
|
||||
uint16_t crc = 0;
|
||||
uint8_t* data = (uint8_t*)macro;
|
||||
|
||||
for (uint16_t i = 0; i < DYNAMIC_MACRO_CRC_LENGTH; ++i) {
|
||||
crc = crc16_update(crc, *(data++));
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
|
||||
inline void* dynamic_macro_eeprom_macro_addr(uint8_t macro_id) {
|
||||
return DYNAMIC_MACRO_EEPROM_BLOCK0_ADDR + sizeof(dynamic_macro_t) * macro_id;
|
||||
}
|
||||
|
||||
void dynamic_macro_load_eeprom_all(void) {
|
||||
for (uint8_t i = 0; i < DYNAMIC_MACRO_COUNT; ++i) {
|
||||
dynamic_macro_load_eeprom(i);
|
||||
}
|
||||
}
|
||||
|
||||
void dynamic_macro_load_eeprom(uint8_t macro_id) {
|
||||
dynamic_macro_t* dst = &dynamic_macros[macro_id];
|
||||
|
||||
eeprom_read_block(dst, dynamic_macro_eeprom_macro_addr(macro_id), sizeof(dynamic_macro_t));
|
||||
|
||||
/* Validate checksum, ifchecksum is NOT valid for macro, set its length to 0 to prevent its use. */
|
||||
if (dynamic_macro_calc_crc(dst) != dst->checksum) {
|
||||
dprintf("dynamic macro: slot %d not loaded, checksum mismatch\n", macro_id);
|
||||
dst->length = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
dprintf("dynamic macro: slot %d loaded from eeprom, checksum okay\n", macro_id);
|
||||
}
|
||||
|
||||
void dynamic_macro_save_eeprom(uint8_t macro_id) {
|
||||
dynamic_macro_t* src = &dynamic_macros[macro_id];
|
||||
|
||||
eeprom_update_block(src, dynamic_macro_eeprom_macro_addr(macro_id), sizeof(dynamic_macro_t));
|
||||
dprintf("dynamic macro: slot %d saved to eeprom\n", macro_id);
|
||||
}
|
||||
|
||||
void dynamic_macro_init(void) {
|
||||
/* zero out macro blocks */
|
||||
memset(&dynamic_macros, 0, DYNAMIC_MACRO_COUNT * sizeof(dynamic_macro_t));
|
||||
dynamic_macro_load_eeprom_all();
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
// Copyright 2016 Jack Humbert
|
||||
// Copyright 2019 Wojciech Siewierski < wojciech dot siewierski at onet dot pl >
|
||||
// Copyright 2023 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "action.h"
|
||||
#include "action_layer.h"
|
||||
|
||||
#ifndef DYNAMIC_MACRO_COUNT
|
||||
# define DYNAMIC_MACRO_COUNT 8
|
||||
#endif
|
||||
|
||||
#ifndef DYNAMIC_MACRO_SIZE
|
||||
# define DYNAMIC_MACRO_SIZE 64
|
||||
#endif
|
||||
|
||||
enum dynamic_macro_recording_state {
|
||||
STATE_NOT_RECORDING,
|
||||
STATE_RECORD_KEY_PRESSED,
|
||||
STATE_CURRENTLY_RECORDING,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
keyrecord_t events[DYNAMIC_MACRO_SIZE];
|
||||
uint8_t length;
|
||||
uint16_t checksum;
|
||||
} dynamic_macro_t;
|
||||
|
||||
void dynamic_macro_init(void);
|
||||
bool dynamic_macro_record_start(uint8_t macro_id);
|
||||
void dynamic_macro_play(uint8_t macro_id);
|
||||
void dynamic_macro_record_key(uint8_t macro_id, keyrecord_t* record);
|
||||
void dynamic_macro_record_end(uint8_t macro_id);
|
||||
bool process_record_dynamic_macro(uint16_t keycode, keyrecord_t* record);
|
||||
|
||||
void dynamic_macro_record_start_user(void);
|
||||
void dynamic_macro_play_user(uint8_t macro_id);
|
||||
void dynamic_macro_record_key_user(uint8_t macro_id, keyrecord_t* record);
|
||||
void dynamic_macro_record_end_user(uint8_t macro_id);
|
||||
|
||||
#define DYNAMIC_MACRO_CRC_LENGTH (sizeof(dynamic_macro_t) - sizeof(uint16_t))
|
||||
#define IS_DYN_KEYCODE(keycode) (keycode >= DYN_MACRO_KEY00 && keycode <= DYN_MACRO_KEY15)
|
||||
|
||||
uint16_t dynamic_macro_calc_crc(dynamic_macro_t* macro);
|
||||
void dynamic_macro_load_eeprom_all(void);
|
||||
void dynamic_macro_load_eeprom(uint8_t macro_id);
|
||||
void dynamic_macro_save_eeprom(uint8_t macro_id);
|
||||
bool dynamic_macro_header_correct(void);
|
||||
@@ -6,9 +6,11 @@
|
||||
#ifdef OS_DETECTION_ENABLE
|
||||
# include "os_detection.h"
|
||||
#endif
|
||||
#ifdef CUSTOM_DYNAMIC_MACROS_ENABLE
|
||||
# include "keyrecords/dynamic_macros.h"
|
||||
#endif
|
||||
|
||||
uint16_t copy_paste_timer;
|
||||
bool host_driver_disabled = false;
|
||||
// Defines actions tor my global custom keycodes. Defined in drashna.h file
|
||||
// Then runs the _keymap's record handier if not processed here
|
||||
|
||||
@@ -55,30 +57,15 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
#endif
|
||||
#if defined(CUSTOM_POINTING_DEVICE)
|
||||
&& process_record_pointing(keycode, record)
|
||||
#endif
|
||||
#ifdef CUSTOM_DYNAMIC_MACROS_ENABLE
|
||||
&& process_record_dynamic_macro(keycode, record)
|
||||
#endif
|
||||
&& true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (keycode) {
|
||||
case FIRST_DEFAULT_LAYER_KEYCODE ... LAST_DEFAULT_LAYER_KEYCODE:
|
||||
if (record->event.pressed) {
|
||||
uint8_t mods = mod_config(get_mods() | get_oneshot_mods());
|
||||
if (!mods) {
|
||||
set_single_persistent_default_layer(keycode - FIRST_DEFAULT_LAYER_KEYCODE);
|
||||
#if LAST_DEFAULT_LAYER_KEYCODE > (FIRST_DEFAULT_LAYER_KEYCODE + 3)
|
||||
} else if (mods & MOD_MASK_SHIFT) {
|
||||
set_single_persistent_default_layer(keycode - FIRST_DEFAULT_LAYER_KEYCODE + 4);
|
||||
# if LAST_DEFAULT_LAYER_KEYCODE > (FIRST_DEFAULT_LAYER_KEYCODE + 7)
|
||||
|
||||
} else if (mods & MOD_MASK_CTRL) {
|
||||
set_single_persistent_default_layer(keycode - FIRST_DEFAULT_LAYER_KEYCODE + 8);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case VRSN: // Prints firmware version
|
||||
if (record->event.pressed) {
|
||||
send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), TAP_CODE_DELAY);
|
||||
@@ -111,7 +98,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
userspace_config.rgb_layer_change ^= 1;
|
||||
dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
|
||||
eeconfig_update_user(userspace_config.raw);
|
||||
eeconfig_update_user_config(&userspace_config.raw);
|
||||
if (userspace_config.rgb_layer_change) {
|
||||
# if defined(CUSTOM_RGB_MATRIX)
|
||||
rgb_matrix_set_flags(LED_FLAG_UNDERGLOW | LED_FLAG_KEYLIGHT | LED_FLAG_INDICATOR);
|
||||
@@ -168,38 +155,16 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
}
|
||||
# endif
|
||||
if (is_eeprom_updated) {
|
||||
eeconfig_update_user(userspace_config.raw);
|
||||
eeconfig_update_user_config(&userspace_config.raw);
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case KEYLOCK: {
|
||||
static host_driver_t *host_driver = 0;
|
||||
|
||||
case KEYLOCK:
|
||||
if (record->event.pressed) {
|
||||
if (host_get_driver()) {
|
||||
host_driver = host_get_driver();
|
||||
clear_keyboard();
|
||||
host_set_driver(0);
|
||||
host_driver_disabled = true;
|
||||
} else {
|
||||
host_set_driver(host_driver);
|
||||
host_driver_disabled = false;
|
||||
}
|
||||
toggle_keyboard_lock();
|
||||
}
|
||||
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) {
|
||||
@@ -218,5 +183,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
__attribute__((weak)) void post_process_record_keymap(uint16_t keycode, keyrecord_t *record) {}
|
||||
void post_process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
#if defined(OS_DETECTION_ENABLE) && defined(UNICODE_COMMON_ENABLE)
|
||||
switch (keycode) {
|
||||
case QK_MAGIC_SWAP_LCTL_LGUI:
|
||||
case QK_MAGIC_SWAP_RCTL_RGUI:
|
||||
case QK_MAGIC_SWAP_CTL_GUI:
|
||||
case QK_MAGIC_UNSWAP_LCTL_LGUI:
|
||||
case QK_MAGIC_UNSWAP_RCTL_RGUI:
|
||||
case QK_MAGIC_UNSWAP_CTL_GUI:
|
||||
case QK_MAGIC_TOGGLE_CTL_GUI:
|
||||
set_unicode_input_mode_soft(keymap_config.swap_lctl_lgui ? UNICODE_MODE_MACOS : UNICODE_MODE_WINCOMPOSE);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
post_process_record_keymap(keycode, record);
|
||||
}
|
||||
|
||||
@@ -5,27 +5,21 @@
|
||||
#include "drashna.h"
|
||||
|
||||
enum userspace_custom_keycodes {
|
||||
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
|
||||
KC_COLEMAK, // Sets default layer to COLEMAK
|
||||
KC_DVORAK, // Sets default layer to DVORAK
|
||||
LAST_DEFAULT_LAYER_KEYCODE = KC_DVORAK, // Sets default layer to WORKMAN
|
||||
KC_DIABLO_CLEAR, // Clears all Diablo Timers
|
||||
KC_RGB_T, // Toggles RGB Layer Indication mode
|
||||
RGB_IDL, // RGB Idling animations
|
||||
KC_SECRET_1, // test1
|
||||
KC_SECRET_2, // test2
|
||||
KC_SECRET_3, // test3
|
||||
KC_SECRET_4, // test4
|
||||
KC_SECRET_5, // test5
|
||||
KC_CCCV, // Hold to copy, tap to paste
|
||||
KC_NUKE, // NUCLEAR LAUNCH DETECTED!!!
|
||||
UC_FLIP, // (ಠ痊ಠ)┻━┻
|
||||
UC_TABL, // ┬─┬ノ( º _ ºノ)
|
||||
UC_SHRG, // ¯\_(ツ)_/¯
|
||||
UC_DISA, // ಠ_ಠ
|
||||
VRSN = QK_USER, // Prints QMK Firmware and board info
|
||||
KC_DIABLO_CLEAR, // Clears all Diablo Timers
|
||||
KC_RGB_T, // Toggles RGB Layer Indication mode
|
||||
RGB_IDL, // RGB Idling animations
|
||||
KC_SECRET_1, // test1
|
||||
KC_SECRET_2, // test2
|
||||
KC_SECRET_3, // test3
|
||||
KC_SECRET_4, // test4
|
||||
KC_SECRET_5, // test5
|
||||
KC_CCCV, // Hold to copy, tap to paste
|
||||
KC_NUKE, // NUCLEAR LAUNCH DETECTED!!!
|
||||
UC_FLIP, // (ಠ痊ಠ)┻━┻
|
||||
UC_TABL, // ┬─┬ノ( º _ ºノ)
|
||||
UC_SHRG, // ¯\_(ツ)_/¯
|
||||
UC_DISA, // ಠ_ಠ
|
||||
UC_IRNY,
|
||||
UC_CLUE,
|
||||
KEYLOCK, // Locks keyboard by unmounting driver
|
||||
@@ -40,11 +34,33 @@ enum userspace_custom_keycodes {
|
||||
KC_COMIC,
|
||||
KC_ACCEL,
|
||||
OLED_LOCK,
|
||||
OLED_BRIGHTNESS_INC,
|
||||
OLED_BRIGHTNESS_DEC,
|
||||
|
||||
STORE_SETUPS,
|
||||
PRINT_SETUPS,
|
||||
|
||||
USER_SAFE_RANGE, // use "NEWPLACEHOLDER for keymap specific codes
|
||||
PD_JIGGLER,
|
||||
|
||||
DYN_MACRO_PROG,
|
||||
DYN_MACRO_KEY00,
|
||||
DYN_MACRO_KEY01,
|
||||
DYN_MACRO_KEY02,
|
||||
DYN_MACRO_KEY03,
|
||||
DYN_MACRO_KEY04,
|
||||
DYN_MACRO_KEY05,
|
||||
DYN_MACRO_KEY06,
|
||||
DYN_MACRO_KEY07,
|
||||
DYN_MACRO_KEY08,
|
||||
DYN_MACRO_KEY09,
|
||||
DYN_MACRO_KEY10,
|
||||
DYN_MACRO_KEY11,
|
||||
DYN_MACRO_KEY12,
|
||||
DYN_MACRO_KEY13,
|
||||
DYN_MACRO_KEY14,
|
||||
DYN_MACRO_KEY15,
|
||||
|
||||
USER_SAFE_RANGE,
|
||||
};
|
||||
|
||||
bool process_record_secrets(uint16_t keycode, keyrecord_t *record);
|
||||
@@ -69,27 +85,15 @@ bool process_record_unicode(uint16_t keycode, keyrecord_t *record);
|
||||
#define KC_SEC4 KC_SECRET_4
|
||||
#define KC_SEC5 KC_SECRET_5
|
||||
|
||||
#define KC_QWERTY DF(_QWERTY)
|
||||
#define KC_COLEMAK_DH DF(_COLEMAK_DH)
|
||||
#define KC_COLEMAK DF(_COLEMAK)
|
||||
#define KC_DVORAK DF(_DVORAK)
|
||||
|
||||
#define QWERTY KC_QWERTY
|
||||
#define DVORAK KC_DVORAK
|
||||
#define COLEMAK KC_COLEMAK
|
||||
#define COLEMAKDH KC_COLEMAK_DH
|
||||
|
||||
#define DEFLYR1 FIRST_DEFAULT_LAYER_KEYCODE
|
||||
#define DEFLYR2 (FIRST_DEFAULT_LAYER_KEYCODE + 1)
|
||||
#define DEFLYR3 (FIRST_DEFAULT_LAYER_KEYCODE + 2)
|
||||
#define DEFLYR4 (FIRST_DEFAULT_LAYER_KEYCODE + 3)
|
||||
#if LAST_DEFAULT_LAYER_KEYCODE > (FIRST_DEFAULT_LAYER_KEYCODE + 3)
|
||||
# define DEFLYR5 (FIRST_DEFAULT_LAYER_KEYCODE + 4)
|
||||
# define DEFLYR6 (FIRST_DEFAULT_LAYER_KEYCODE + 5)
|
||||
# define DEFLYR7 (FIRST_DEFAULT_LAYER_KEYCODE + 6)
|
||||
# define DEFLYR8 (FIRST_DEFAULT_LAYER_KEYCODE + 7)
|
||||
# if LAST_DEFAULT_LAYER_KEYCODE > (FIRST_DEFAULT_LAYER_KEYCODE + 7)
|
||||
# define DEFLYR9 (FIRST_DEFAULT_LAYER_KEYCODE + 8)
|
||||
# define DEFLYR10 (FIRST_DEFAULT_LAYER_KEYCODE + 9)
|
||||
# define DEFLYR11 (FIRST_DEFAULT_LAYER_KEYCODE + 10)
|
||||
# define DEFLYR12 (FIRST_DEFAULT_LAYER_KEYCODE + 11)
|
||||
# endif
|
||||
#endif
|
||||
#define CLMKDH KC_COLEMAK_DH
|
||||
|
||||
#ifdef SWAP_HANDS_ENABLE
|
||||
# define KC_C1R3 SH_T(KC_TAB)
|
||||
@@ -140,3 +144,7 @@ We use custom codes here, so we can substitute the right stuff
|
||||
# define KC_D3_3 KC_3
|
||||
# define KC_D3_4 KC_4
|
||||
#endif // TAP_DANCE_ENABLE
|
||||
|
||||
#define OL_LOCK OLED_LOCK
|
||||
#define OL_BINC OLED_BRIGHTNESS_INC
|
||||
#define OL_BDEC OLED_BRIGHTNESS_DEC
|
||||
|
||||
@@ -5,9 +5,14 @@
|
||||
|
||||
#ifdef TAPPING_TERM_PER_KEY
|
||||
__attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
switch (keycode) {
|
||||
case BK_LWER:
|
||||
return TAPPING_TERM + 25;
|
||||
case QK_MOD_TAP ... QK_MOD_TAP_MAX:
|
||||
if (QK_MOD_TAP_GET_MODS(keycode) & MOD_LGUI) {
|
||||
return 300;
|
||||
}
|
||||
default:
|
||||
return TAPPING_TERM;
|
||||
}
|
||||
|
||||
@@ -434,3 +434,13 @@ bool process_record_unicode(uint16_t keycode, keyrecord_t *record) {
|
||||
void keyboard_post_init_unicode(void) {
|
||||
unicode_input_mode_init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the unicode input mode without extra functionality
|
||||
*
|
||||
* @param input_mode
|
||||
*/
|
||||
void set_unicode_input_mode_soft(uint8_t input_mode) {
|
||||
unicode_config.input_mode = input_mode;
|
||||
unicode_input_mode_set_kb(input_mode);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user