Merge remote-tracking branch 'qmk/master' into merge-2022-03-06
This commit is contained in:
@ -50,10 +50,17 @@ bool process_audio(uint16_t keycode, keyrecord_t *record) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void process_audio_noteon(uint8_t note) { play_note(compute_freq_for_midi_note(note), 0xF); }
|
||||
void process_audio_noteon(uint8_t note) {
|
||||
play_note(compute_freq_for_midi_note(note), 0xF);
|
||||
}
|
||||
|
||||
void process_audio_noteoff(uint8_t note) { stop_note(compute_freq_for_midi_note(note)); }
|
||||
void process_audio_noteoff(uint8_t note) {
|
||||
stop_note(compute_freq_for_midi_note(note));
|
||||
}
|
||||
|
||||
void process_audio_all_notes_off(void) { stop_all_notes(); }
|
||||
void process_audio_all_notes_off(void) {
|
||||
stop_all_notes();
|
||||
}
|
||||
|
||||
__attribute__((weak)) void audio_on_user() {}
|
||||
__attribute__((weak)) void audio_off_user() {}
|
||||
|
@ -8,3 +8,4 @@ void process_audio_noteoff(uint8_t note);
|
||||
void process_audio_all_notes_off(void);
|
||||
|
||||
void audio_on_user(void);
|
||||
void audio_off_user(void);
|
||||
|
@ -63,7 +63,9 @@ static struct {
|
||||
// clang-format on
|
||||
|
||||
/** \brief Called on physical press, returns whether key should be added to Auto Shift */
|
||||
__attribute__((weak)) bool get_custom_auto_shifted_key(uint16_t keycode, keyrecord_t *record) { return false; }
|
||||
__attribute__((weak)) bool get_custom_auto_shifted_key(uint16_t keycode, keyrecord_t *record) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** \brief Called on physical press, returns whether is Auto Shift key */
|
||||
__attribute__((weak)) bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *record) {
|
||||
@ -83,8 +85,12 @@ __attribute__((weak)) bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *r
|
||||
}
|
||||
|
||||
/** \brief Called to check whether defines should apply if PER_KEY is set for it */
|
||||
__attribute__((weak)) bool get_auto_shift_repeat(uint16_t keycode, keyrecord_t *record) { return true; }
|
||||
__attribute__((weak)) bool get_auto_shift_no_auto_repeat(uint16_t keycode, keyrecord_t *record) { return true; }
|
||||
__attribute__((weak)) bool get_auto_shift_repeat(uint16_t keycode, keyrecord_t *record) {
|
||||
return true;
|
||||
}
|
||||
__attribute__((weak)) bool get_auto_shift_no_auto_repeat(uint16_t keycode, keyrecord_t *record) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \brief Called when an Auto Shift key needs to be pressed */
|
||||
__attribute__((weak)) void autoshift_press_user(uint16_t keycode, bool shifted, keyrecord_t *record) {
|
||||
@ -95,7 +101,9 @@ __attribute__((weak)) void autoshift_press_user(uint16_t keycode, bool shifted,
|
||||
}
|
||||
|
||||
/** \brief Called when an Auto Shift key needs to be released */
|
||||
__attribute__((weak)) void autoshift_release_user(uint16_t keycode, bool shifted, keyrecord_t *record) { unregister_code16((IS_RETRO(keycode)) ? keycode & 0xFF : keycode); }
|
||||
__attribute__((weak)) void autoshift_release_user(uint16_t keycode, bool shifted, keyrecord_t *record) {
|
||||
unregister_code16((IS_RETRO(keycode)) ? keycode & 0xFF : keycode);
|
||||
}
|
||||
|
||||
/** \brief Sets the shift state to use when keyrepeating, required by custom shifts */
|
||||
void set_autoshift_shift_state(uint16_t keycode, bool shifted) {
|
||||
@ -312,7 +320,9 @@ void autoshift_toggle(void) {
|
||||
autoshift_flush_shift();
|
||||
}
|
||||
|
||||
void autoshift_enable(void) { autoshift_flags.enabled = true; }
|
||||
void autoshift_enable(void) {
|
||||
autoshift_flags.enabled = true;
|
||||
}
|
||||
|
||||
void autoshift_disable(void) {
|
||||
autoshift_flags.enabled = false;
|
||||
@ -329,12 +339,20 @@ void autoshift_timer_report(void) {
|
||||
}
|
||||
# endif
|
||||
|
||||
bool get_autoshift_state(void) { return autoshift_flags.enabled; }
|
||||
bool get_autoshift_state(void) {
|
||||
return autoshift_flags.enabled;
|
||||
}
|
||||
|
||||
uint16_t get_generic_autoshift_timeout() { return autoshift_timeout; }
|
||||
__attribute__((weak)) uint16_t get_autoshift_timeout(uint16_t keycode, keyrecord_t *record) { return autoshift_timeout; }
|
||||
uint16_t get_generic_autoshift_timeout() {
|
||||
return autoshift_timeout;
|
||||
}
|
||||
__attribute__((weak)) uint16_t get_autoshift_timeout(uint16_t keycode, keyrecord_t *record) {
|
||||
return autoshift_timeout;
|
||||
}
|
||||
|
||||
void set_autoshift_timeout(uint16_t timeout) { autoshift_timeout = timeout; }
|
||||
void set_autoshift_timeout(uint16_t timeout) {
|
||||
autoshift_timeout = timeout;
|
||||
}
|
||||
|
||||
bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
|
||||
if (!QS_auto_shift_enable) return true;
|
||||
|
@ -5,40 +5,40 @@
|
||||
|
||||
# ifndef AUDIO_CLICKY_DELAY_DURATION
|
||||
# define AUDIO_CLICKY_DELAY_DURATION 1
|
||||
# endif // !AUDIO_CLICKY_DELAY_DURATION
|
||||
# endif // !AUDIO_CLICKY_DELAY_DURATION
|
||||
# ifndef AUDIO_CLICKY_FREQ_DEFAULT
|
||||
# define AUDIO_CLICKY_FREQ_DEFAULT 440.0f
|
||||
# endif // !AUDIO_CLICKY_FREQ_DEFAULT
|
||||
# endif // !AUDIO_CLICKY_FREQ_DEFAULT
|
||||
# ifndef AUDIO_CLICKY_FREQ_MIN
|
||||
# define AUDIO_CLICKY_FREQ_MIN 65.0f
|
||||
# endif // !AUDIO_CLICKY_FREQ_MIN
|
||||
# endif // !AUDIO_CLICKY_FREQ_MIN
|
||||
# ifndef AUDIO_CLICKY_FREQ_MAX
|
||||
# define AUDIO_CLICKY_FREQ_MAX 1500.0f
|
||||
# endif // !AUDIO_CLICKY_FREQ_MAX
|
||||
# endif // !AUDIO_CLICKY_FREQ_MAX
|
||||
# ifndef AUDIO_CLICKY_FREQ_FACTOR
|
||||
# define AUDIO_CLICKY_FREQ_FACTOR 1.18921f
|
||||
# endif // !AUDIO_CLICKY_FREQ_FACTOR
|
||||
# endif // !AUDIO_CLICKY_FREQ_FACTOR
|
||||
# ifndef AUDIO_CLICKY_FREQ_RANDOMNESS
|
||||
# define AUDIO_CLICKY_FREQ_RANDOMNESS 0.05f
|
||||
# endif // !AUDIO_CLICKY_FREQ_RANDOMNESS
|
||||
# endif // !AUDIO_CLICKY_FREQ_RANDOMNESS
|
||||
|
||||
float clicky_freq = AUDIO_CLICKY_FREQ_DEFAULT;
|
||||
float clicky_rand = AUDIO_CLICKY_FREQ_RANDOMNESS;
|
||||
|
||||
// the first "note" is an intentional delay; the 2nd and 3rd notes are the "clicky"
|
||||
float clicky_song[][2] = {{AUDIO_CLICKY_FREQ_MIN, AUDIO_CLICKY_DELAY_DURATION}, {AUDIO_CLICKY_FREQ_DEFAULT, 3}, {AUDIO_CLICKY_FREQ_DEFAULT, 1}}; // 3 and 1 --> durations
|
||||
float clicky_song[][2] = {{AUDIO_CLICKY_FREQ_MIN, AUDIO_CLICKY_DELAY_DURATION}, {AUDIO_CLICKY_FREQ_DEFAULT, 3}, {AUDIO_CLICKY_FREQ_DEFAULT, 1}}; // 3 and 1 --> durations
|
||||
|
||||
extern audio_config_t audio_config;
|
||||
|
||||
# ifndef NO_MUSIC_MODE
|
||||
extern bool music_activated;
|
||||
extern bool midi_activated;
|
||||
# endif // !NO_MUSIC_MODE
|
||||
# endif // !NO_MUSIC_MODE
|
||||
|
||||
void clicky_play(void) {
|
||||
# ifndef NO_MUSIC_MODE
|
||||
if (music_activated || midi_activated || !audio_config.enable) return;
|
||||
# endif // !NO_MUSIC_MODE
|
||||
# endif // !NO_MUSIC_MODE
|
||||
clicky_song[1][0] = 2.0f * clicky_freq * (1.0f + clicky_rand * (((float)rand()) / ((float)(RAND_MAX))));
|
||||
clicky_song[2][0] = clicky_freq * (1.0f + clicky_rand * (((float)rand()) / ((float)(RAND_MAX))));
|
||||
PLAY_SONG(clicky_song);
|
||||
@ -58,7 +58,9 @@ void clicky_freq_down(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void clicky_freq_reset(void) { clicky_freq = AUDIO_CLICKY_FREQ_DEFAULT; }
|
||||
void clicky_freq_reset(void) {
|
||||
clicky_freq = AUDIO_CLICKY_FREQ_DEFAULT;
|
||||
}
|
||||
|
||||
void clicky_toggle(void) {
|
||||
audio_config.clicky_enable ^= 1;
|
||||
@ -75,7 +77,9 @@ void clicky_off(void) {
|
||||
eeconfig_update_audio(audio_config.raw);
|
||||
}
|
||||
|
||||
bool is_clicky_on(void) { return (audio_config.clicky_enable != 0); }
|
||||
bool is_clicky_on(void) {
|
||||
return (audio_config.clicky_enable != 0);
|
||||
}
|
||||
|
||||
bool process_clicky(uint16_t keycode, keyrecord_t *record) {
|
||||
if (keycode == CLICKY_TOGGLE && record->event.pressed) {
|
||||
@ -101,8 +105,8 @@ bool process_clicky(uint16_t keycode, keyrecord_t *record) {
|
||||
}
|
||||
|
||||
if (audio_config.enable && audio_config.clicky_enable) {
|
||||
if (record->event.pressed) { // Leave this separate so it's easier to add upstroke sound
|
||||
if (keycode != AU_OFF && keycode != AU_TOG) { // DO NOT PLAY if audio will be disabled, and causes issuse on ARM
|
||||
if (record->event.pressed) { // Leave this separate so it's easier to add upstroke sound
|
||||
if (keycode != AU_OFF && keycode != AU_TOG) { // DO NOT PLAY if audio will be disabled, and causes issuse on ARM
|
||||
clicky_play();
|
||||
}
|
||||
}
|
||||
@ -110,4 +114,4 @@ bool process_clicky(uint16_t keycode, keyrecord_t *record) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // AUDIO_CLICKY
|
||||
#endif // AUDIO_CLICKY
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "print.h"
|
||||
#include "process_combo.h"
|
||||
#include "action_tapping.h"
|
||||
#include "action.h"
|
||||
|
||||
#ifdef VIAL_COMBO_ENABLE
|
||||
#include "dynamic_keymap.h"
|
||||
@ -36,25 +37,45 @@ extern uint16_t COMBO_LEN;
|
||||
__attribute__((weak)) void process_combo_event(uint16_t combo_index, bool pressed) {}
|
||||
|
||||
#ifdef COMBO_MUST_HOLD_PER_COMBO
|
||||
__attribute__((weak)) bool get_combo_must_hold(uint16_t index, combo_t *combo) { return false; }
|
||||
__attribute__((weak)) bool get_combo_must_hold(uint16_t index, combo_t *combo) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef COMBO_MUST_TAP_PER_COMBO
|
||||
__attribute__((weak)) bool get_combo_must_tap(uint16_t index, combo_t *combo) { return false; }
|
||||
__attribute__((weak)) bool get_combo_must_tap(uint16_t index, combo_t *combo) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef COMBO_TERM_PER_COMBO
|
||||
__attribute__((weak)) uint16_t get_combo_term(uint16_t index, combo_t *combo) { return COMBO_TERM; }
|
||||
__attribute__((weak)) uint16_t get_combo_term(uint16_t index, combo_t *combo) {
|
||||
return COMBO_TERM;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef COMBO_MUST_PRESS_IN_ORDER_PER_COMBO
|
||||
__attribute__((weak)) bool get_combo_must_press_in_order(uint16_t combo_index, combo_t *combo) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef COMBO_PROCESS_KEY_RELEASE
|
||||
__attribute__((weak)) bool process_combo_key_release(uint16_t combo_index, combo_t *combo, uint8_t key_index, uint16_t keycode) { return false; }
|
||||
__attribute__((weak)) bool process_combo_key_release(uint16_t combo_index, combo_t *combo, uint8_t key_index, uint16_t keycode) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef COMBO_SHOULD_TRIGGER
|
||||
__attribute__((weak)) bool combo_should_trigger(uint16_t combo_index, combo_t *combo, uint16_t keycode, keyrecord_t *record) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef COMBO_NO_TIMER
|
||||
static uint16_t timer = 0;
|
||||
#endif
|
||||
static bool b_combo_enable = true; // defaults to enabled
|
||||
static bool b_combo_enable = true; // defaults to enabled
|
||||
static uint16_t longest_term = 0;
|
||||
|
||||
typedef struct {
|
||||
@ -192,6 +213,9 @@ void clear_combos(void) {
|
||||
static inline void dump_key_buffer(void) {
|
||||
/* First call start from 0 index; recursive calls need to start from i+1 index */
|
||||
static uint8_t key_buffer_next = 0;
|
||||
#if TAP_CODE_DELAY > 0
|
||||
bool delay_done = false;
|
||||
#endif
|
||||
|
||||
if (key_buffer_size == 0) {
|
||||
return;
|
||||
@ -217,6 +241,15 @@ static inline void dump_key_buffer(void) {
|
||||
#endif
|
||||
}
|
||||
record->event.time = 0;
|
||||
clear_weak_mods();
|
||||
|
||||
#if TAP_CODE_DELAY > 0
|
||||
// only delay once and for a non-tapping key
|
||||
if (!delay_done && !is_tap_record(record)) {
|
||||
delay_done = true;
|
||||
wait_ms(TAP_CODE_DELAY);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
key_buffer_next = key_buffer_size = 0;
|
||||
@ -357,6 +390,28 @@ combo_t *overlaps(combo_t *combo1, combo_t *combo2) {
|
||||
return combo1;
|
||||
}
|
||||
|
||||
#if defined(COMBO_MUST_PRESS_IN_ORDER) || defined(COMBO_MUST_PRESS_IN_ORDER_PER_COMBO)
|
||||
static bool keys_pressed_in_order(uint16_t combo_index, combo_t *combo, uint16_t key_index, uint16_t keycode, keyrecord_t *record) {
|
||||
# ifdef COMBO_MUST_PRESS_IN_ORDER_PER_COMBO
|
||||
if (!get_combo_must_press_in_order(combo_index, combo)) {
|
||||
return true;
|
||||
}
|
||||
# endif
|
||||
if (
|
||||
// The `state` bit for the key being pressed.
|
||||
(1 << key_index) ==
|
||||
// The *next* combo key's bit.
|
||||
(COMBO_STATE(combo) + 1)
|
||||
// E.g. two keys already pressed: `state == 11`.
|
||||
// Next possible `state` is `111`.
|
||||
// So the needed bit is `100` which we get with `11 + 1`.
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *record, uint16_t combo_index) {
|
||||
uint8_t key_count = 0;
|
||||
uint16_t key_index = -1;
|
||||
@ -367,7 +422,14 @@ static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *
|
||||
return false;
|
||||
}
|
||||
|
||||
bool key_is_part_of_combo = !COMBO_DISABLED(combo) && is_combo_enabled();
|
||||
bool key_is_part_of_combo = (!COMBO_DISABLED(combo) && is_combo_enabled()
|
||||
#if defined(COMBO_MUST_PRESS_IN_ORDER) || defined(COMBO_MUST_PRESS_IN_ORDER_PER_COMBO)
|
||||
&& keys_pressed_in_order(combo_index, combo, key_index, keycode, record)
|
||||
#endif
|
||||
#ifdef COMBO_SHOULD_TRIGGER
|
||||
&& combo_should_trigger(combo_index, combo, keycode, record)
|
||||
#endif
|
||||
);
|
||||
|
||||
if (record->event.pressed && key_is_part_of_combo) {
|
||||
uint16_t time = _get_combo_term(combo_index, combo);
|
||||
@ -419,7 +481,7 @@ static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *
|
||||
// get possible longer waiting time for tap-/hold-only combos.
|
||||
longest_term = _get_wait_time(combo_index, combo);
|
||||
}
|
||||
} // if timer elapsed end
|
||||
} // if timer elapsed end
|
||||
}
|
||||
} else {
|
||||
// chord releases
|
||||
@ -434,7 +496,7 @@ static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *
|
||||
else if (get_combo_must_tap(combo_index, combo)) {
|
||||
// immediately apply tap-only combo
|
||||
apply_combo(combo_index, combo);
|
||||
apply_combos(); // also apply other prepared combos and dump key buffer
|
||||
apply_combos(); // also apply other prepared combos and dump key buffer
|
||||
# ifdef COMBO_PROCESS_KEY_RELEASE
|
||||
if (process_combo_key_release(combo_index, combo, key_index, keycode)) {
|
||||
release_combo(combo_index, combo);
|
||||
@ -516,7 +578,7 @@ bool process_combo(uint16_t keycode, keyrecord_t *record) {
|
||||
key_buffer[key_buffer_size++] = (queued_record_t){
|
||||
.record = *record,
|
||||
.keycode = keycode,
|
||||
.combo_index = -1, // this will be set when applying combos
|
||||
.combo_index = -1, // this will be set when applying combos
|
||||
};
|
||||
}
|
||||
} else {
|
||||
@ -555,7 +617,9 @@ void combo_task(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void combo_enable(void) { b_combo_enable = true; }
|
||||
void combo_enable(void) {
|
||||
b_combo_enable = true;
|
||||
}
|
||||
|
||||
void combo_disable(void) {
|
||||
#ifndef COMBO_NO_TIMER
|
||||
@ -575,4 +639,6 @@ void combo_toggle(void) {
|
||||
}
|
||||
}
|
||||
|
||||
bool is_combo_enabled(void) { return b_combo_enable; }
|
||||
bool is_combo_enabled(void) {
|
||||
return b_combo_enable;
|
||||
}
|
||||
|
@ -29,13 +29,21 @@ void dynamic_macro_led_blink(void) {
|
||||
|
||||
/* User hooks for Dynamic Macros */
|
||||
|
||||
__attribute__((weak)) void dynamic_macro_record_start_user(void) { dynamic_macro_led_blink(); }
|
||||
__attribute__((weak)) void dynamic_macro_record_start_user(void) {
|
||||
dynamic_macro_led_blink();
|
||||
}
|
||||
|
||||
__attribute__((weak)) void dynamic_macro_play_user(int8_t direction) { dynamic_macro_led_blink(); }
|
||||
__attribute__((weak)) void dynamic_macro_play_user(int8_t direction) {
|
||||
dynamic_macro_led_blink();
|
||||
}
|
||||
|
||||
__attribute__((weak)) void dynamic_macro_record_key_user(int8_t direction, keyrecord_t *record) { dynamic_macro_led_blink(); }
|
||||
__attribute__((weak)) void dynamic_macro_record_key_user(int8_t direction, keyrecord_t *record) {
|
||||
dynamic_macro_led_blink();
|
||||
}
|
||||
|
||||
__attribute__((weak)) void dynamic_macro_record_end_user(int8_t direction) { dynamic_macro_led_blink(); }
|
||||
__attribute__((weak)) void dynamic_macro_record_end_user(int8_t direction) {
|
||||
dynamic_macro_led_blink();
|
||||
}
|
||||
|
||||
/* Convenience macros used for retrieving the debug info. All of them
|
||||
* need a `direction` variable accessible at the call site.
|
||||
@ -82,7 +90,7 @@ void dynamic_macro_play(keyrecord_t *macro_buffer, keyrecord_t *macro_end, int8_
|
||||
|
||||
clear_keyboard();
|
||||
|
||||
layer_state = saved_layer_state;
|
||||
layer_state_set(saved_layer_state);
|
||||
|
||||
dynamic_macro_play_user(direction);
|
||||
}
|
||||
|
@ -16,13 +16,13 @@
|
||||
#include "process_grave_esc.h"
|
||||
#include "qmk_settings.h"
|
||||
|
||||
/* true if the last press of GRAVE_ESC was shifted (i.e. GUI or SHIFT were pressed), false otherwise.
|
||||
/* true if the last press of QK_GRAVE_ESCAPE was shifted (i.e. GUI or SHIFT were pressed), false otherwise.
|
||||
* Used to ensure that the correct keycode is released if the key is released.
|
||||
*/
|
||||
static bool grave_esc_was_shifted = false;
|
||||
|
||||
bool process_grave_esc(uint16_t keycode, keyrecord_t *record) {
|
||||
if (keycode == GRAVE_ESC) {
|
||||
if (keycode == QK_GRAVE_ESCAPE) {
|
||||
const uint8_t mods = get_mods();
|
||||
uint8_t shifted = mods & MOD_MASK_SG;
|
||||
|
||||
|
@ -35,9 +35,6 @@ __attribute__((weak)) bool get_haptic_enabled_key(uint16_t keycode, keyrecord_t
|
||||
case QK_MOMENTARY ... QK_MOMENTARY_MAX:
|
||||
case QK_LAYER_MOD ... QK_LAYER_MOD_MAX:
|
||||
#endif
|
||||
#ifdef NO_HAPTIC_FN
|
||||
case KC_FN0 ... KC_FN31:
|
||||
#endif
|
||||
#ifdef NO_HAPTIC_ALPHA
|
||||
case KC_A ... KC_Z:
|
||||
#endif
|
||||
|
@ -28,10 +28,11 @@ bool process_joystick_buttons(uint16_t keycode, keyrecord_t *record) {
|
||||
if (keycode < JS_BUTTON0 || keycode > JS_BUTTON_MAX) {
|
||||
return true;
|
||||
} else {
|
||||
uint8_t button_idx = (keycode - JS_BUTTON0);
|
||||
if (record->event.pressed) {
|
||||
joystick_status.buttons[(keycode - JS_BUTTON0) / 8] |= 1 << (keycode % 8);
|
||||
joystick_status.buttons[button_idx / 8] |= 1 << (button_idx % 8);
|
||||
} else {
|
||||
joystick_status.buttons[(keycode - JS_BUTTON0) / 8] &= ~(1 << (keycode % 8));
|
||||
joystick_status.buttons[button_idx / 8] &= ~(1 << (button_idx % 8));
|
||||
}
|
||||
|
||||
joystick_status.status |= JS_UPDATED;
|
||||
@ -73,7 +74,9 @@ void restorePinState(pin_t pin, uint16_t restoreState) {
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool process_joystick_analogread() { return process_joystick_analogread_quantum(); }
|
||||
__attribute__((weak)) bool process_joystick_analogread() {
|
||||
return process_joystick_analogread_quantum();
|
||||
}
|
||||
|
||||
bool process_joystick_analogread_quantum() {
|
||||
#if JOYSTICK_AXES_COUNT > 0
|
||||
|
@ -56,6 +56,11 @@ static inline uint16_t translate_keycode(uint16_t keycode) {
|
||||
}
|
||||
}
|
||||
|
||||
void cancel_key_lock(void) {
|
||||
watching = false;
|
||||
UNSET_KEY_STATE(0x0);
|
||||
}
|
||||
|
||||
bool process_key_lock(uint16_t *keycode, keyrecord_t *record) {
|
||||
// We start by categorizing the keypress event. In the event of a down
|
||||
// event, there are several possibilities:
|
||||
|
@ -18,4 +18,5 @@
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
void cancel_key_lock(void);
|
||||
bool process_key_lock(uint16_t *keycode, keyrecord_t *record);
|
||||
|
@ -106,7 +106,9 @@ void key_override_toggle(void) {
|
||||
}
|
||||
}
|
||||
|
||||
bool key_override_is_enabled(void) { return enabled; }
|
||||
bool key_override_is_enabled(void) {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
// Returns whether the modifiers that are pressed are such that the override should activate
|
||||
static bool key_override_matches_active_modifiers(const key_override_t *override, const uint8_t mods) {
|
||||
@ -150,7 +152,7 @@ static void schedule_deferred_register(const uint16_t keycode) {
|
||||
} else {
|
||||
// Wait a very short time when a modifier event triggers the override to avoid false activations when e.g. a modifier is pressed just before a key is released (with the intention of pairing the modifier with a different key), or a modifier is lifted shortly before the trigger key is lifted. Operating systems by default reject modifier-events that happen very close to a non-modifier event.
|
||||
defer_reference_time = timer_read32();
|
||||
defer_delay = 50; // 50ms
|
||||
defer_delay = 50; // 50ms
|
||||
}
|
||||
deferred_register = keycode;
|
||||
}
|
||||
@ -174,8 +176,8 @@ const key_override_t *clear_active_override(const bool allow_reregister) {
|
||||
|
||||
const uint8_t mod_free_replacement = clear_mods_from(active_override->replacement);
|
||||
|
||||
bool unregister_replacement = mod_free_replacement != KC_NO && // KC_NO is never registered
|
||||
mod_free_replacement < SAFE_RANGE; // Custom keycodes are never registered
|
||||
bool unregister_replacement = mod_free_replacement != KC_NO && // KC_NO is never registered
|
||||
mod_free_replacement < SAFE_RANGE; // Custom keycodes are never registered
|
||||
|
||||
// Try firing the custom handler
|
||||
if (active_override->custom_action != NULL) {
|
||||
@ -195,11 +197,11 @@ const key_override_t *clear_active_override(const bool allow_reregister) {
|
||||
|
||||
const uint16_t trigger = active_override->trigger;
|
||||
|
||||
const bool reregister_trigger = allow_reregister && // Check if allowed from caller
|
||||
(active_override->options & ko_option_no_reregister_trigger) == 0 && // Check if override allows
|
||||
active_override_trigger_is_down && // Check if trigger is even down
|
||||
trigger != KC_NO && // KC_NO is never registered
|
||||
trigger < SAFE_RANGE; // A custom keycode should not be registered
|
||||
const bool reregister_trigger = allow_reregister && // Check if allowed from caller
|
||||
(active_override->options & ko_option_no_reregister_trigger) == 0 && // Check if override allows
|
||||
active_override_trigger_is_down && // Check if trigger is even down
|
||||
trigger != KC_NO && // KC_NO is never registered
|
||||
trigger < SAFE_RANGE; // A custom keycode should not be registered
|
||||
|
||||
// Optionally re-register the trigger if it is still down
|
||||
if (reregister_trigger) {
|
||||
@ -336,8 +338,8 @@ static bool try_activating_override(const uint16_t keycode, const uint8_t layer,
|
||||
|
||||
const uint16_t mod_free_replacement = clear_mods_from(override->replacement);
|
||||
|
||||
bool register_replacement = mod_free_replacement != KC_NO && // KC_NO is never registered
|
||||
mod_free_replacement < SAFE_RANGE; // Custom keycodes are never registered
|
||||
bool register_replacement = mod_free_replacement != KC_NO && // KC_NO is never registered
|
||||
mod_free_replacement < SAFE_RANGE; // Custom keycodes are never registered
|
||||
|
||||
// Try firing the custom handler
|
||||
if (override->custom_action != NULL) {
|
||||
|
@ -51,13 +51,13 @@ bool process_leader(uint16_t keycode, keyrecord_t *record) {
|
||||
if (leading) {
|
||||
# ifndef LEADER_NO_TIMEOUT
|
||||
if (timer_elapsed(leader_time) < LEADER_TIMEOUT)
|
||||
# endif // LEADER_NO_TIMEOUT
|
||||
# endif // LEADER_NO_TIMEOUT
|
||||
{
|
||||
# ifndef LEADER_KEY_STRICT_KEY_PROCESSING
|
||||
if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) {
|
||||
keycode = keycode & 0xFF;
|
||||
}
|
||||
# endif // LEADER_KEY_STRICT_KEY_PROCESSING
|
||||
# endif // LEADER_KEY_STRICT_KEY_PROCESSING
|
||||
if (leader_sequence_size < (sizeof(leader_sequence) / sizeof(leader_sequence[0]))) {
|
||||
leader_sequence[leader_sequence_size] = keycode;
|
||||
leader_sequence_size++;
|
||||
|
@ -44,6 +44,7 @@ bool process_magic(uint16_t keycode, keyrecord_t *record) {
|
||||
case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_ALT_GUI:
|
||||
case MAGIC_SWAP_LCTL_LGUI ... MAGIC_EE_HANDS_RIGHT:
|
||||
case MAGIC_TOGGLE_GUI:
|
||||
case MAGIC_TOGGLE_CONTROL_CAPSLOCK:
|
||||
/* keymap config */
|
||||
keymap_config.raw = eeconfig_read_keymap();
|
||||
switch (keycode) {
|
||||
@ -75,7 +76,7 @@ bool process_magic(uint16_t keycode, keyrecord_t *record) {
|
||||
keymap_config.swap_backslash_backspace = true;
|
||||
break;
|
||||
case MAGIC_HOST_NKRO:
|
||||
clear_keyboard(); // clear first buffer to prevent stuck keys
|
||||
clear_keyboard(); // clear first buffer to prevent stuck keys
|
||||
keymap_config.nkro = true;
|
||||
break;
|
||||
case MAGIC_SWAP_ALT_GUI:
|
||||
@ -118,7 +119,7 @@ bool process_magic(uint16_t keycode, keyrecord_t *record) {
|
||||
keymap_config.swap_backslash_backspace = false;
|
||||
break;
|
||||
case MAGIC_UNHOST_NKRO:
|
||||
clear_keyboard(); // clear first buffer to prevent stuck keys
|
||||
clear_keyboard(); // clear first buffer to prevent stuck keys
|
||||
keymap_config.nkro = false;
|
||||
break;
|
||||
case MAGIC_UNSWAP_ALT_GUI:
|
||||
@ -156,7 +157,7 @@ bool process_magic(uint16_t keycode, keyrecord_t *record) {
|
||||
#endif
|
||||
break;
|
||||
case MAGIC_TOGGLE_NKRO:
|
||||
clear_keyboard(); // clear first buffer to prevent stuck keys
|
||||
clear_keyboard(); // clear first buffer to prevent stuck keys
|
||||
keymap_config.nkro = !keymap_config.nkro;
|
||||
break;
|
||||
case MAGIC_EE_HANDS_LEFT:
|
||||
@ -168,10 +169,13 @@ bool process_magic(uint16_t keycode, keyrecord_t *record) {
|
||||
case MAGIC_TOGGLE_GUI:
|
||||
keymap_config.no_gui = !keymap_config.no_gui;
|
||||
break;
|
||||
case MAGIC_TOGGLE_CONTROL_CAPSLOCK:
|
||||
keymap_config.swap_control_capslock = !keymap_config.swap_control_capslock;
|
||||
break;
|
||||
}
|
||||
|
||||
eeconfig_update_keymap(keymap_config.raw);
|
||||
clear_keyboard(); // clear to prevent stuck keys
|
||||
clear_keyboard(); // clear to prevent stuck keys
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -22,13 +22,19 @@
|
||||
|
||||
# ifdef MIDI_BASIC
|
||||
|
||||
void process_midi_basic_noteon(uint8_t note) { midi_send_noteon(&midi_device, 0, note, 127); }
|
||||
void process_midi_basic_noteon(uint8_t note) {
|
||||
midi_send_noteon(&midi_device, 0, note, 127);
|
||||
}
|
||||
|
||||
void process_midi_basic_noteoff(uint8_t note) { midi_send_noteoff(&midi_device, 0, note, 0); }
|
||||
void process_midi_basic_noteoff(uint8_t note) {
|
||||
midi_send_noteoff(&midi_device, 0, note, 0);
|
||||
}
|
||||
|
||||
void process_midi_all_notes_off(void) { midi_send_cc(&midi_device, 0, 0x7B, 0); }
|
||||
void process_midi_all_notes_off(void) {
|
||||
midi_send_cc(&midi_device, 0, 0x7B, 0);
|
||||
}
|
||||
|
||||
# endif // MIDI_BASIC
|
||||
# endif // MIDI_BASIC
|
||||
|
||||
# ifdef MIDI_ADVANCED
|
||||
|
||||
@ -41,7 +47,9 @@ static int8_t midi_modulation_step;
|
||||
static uint16_t midi_modulation_timer;
|
||||
midi_config_t midi_config;
|
||||
|
||||
inline uint8_t compute_velocity(uint8_t setting) { return setting * (128 / (MIDI_VELOCITY_MAX - MIDI_VELOCITY_MIN)); }
|
||||
inline uint8_t compute_velocity(uint8_t setting) {
|
||||
return setting * (128 / (MIDI_VELOCITY_MAX - MIDI_VELOCITY_MIN));
|
||||
}
|
||||
|
||||
void midi_init(void) {
|
||||
midi_config.octave = MI_OCT_2 - MIDI_OCTAVE_MIN;
|
||||
@ -60,7 +68,9 @@ void midi_init(void) {
|
||||
midi_modulation_timer = 0;
|
||||
}
|
||||
|
||||
uint8_t midi_compute_note(uint16_t keycode) { return 12 * midi_config.octave + (keycode - MIDI_TONE_MIN) + midi_config.transpose; }
|
||||
uint8_t midi_compute_note(uint16_t keycode) {
|
||||
return 12 * midi_config.octave + (keycode - MIDI_TONE_MIN) + midi_config.transpose;
|
||||
}
|
||||
|
||||
bool process_midi(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
@ -238,7 +248,7 @@ bool process_midi(uint16_t keycode, keyrecord_t *record) {
|
||||
return true;
|
||||
}
|
||||
|
||||
# endif // MIDI_ADVANCED
|
||||
# endif // MIDI_ADVANCED
|
||||
|
||||
void midi_task(void) {
|
||||
midi_device_process(&midi_device);
|
||||
@ -263,4 +273,4 @@ void midi_task(void) {
|
||||
# endif
|
||||
}
|
||||
|
||||
#endif // MIDI_ENABLE
|
||||
#endif // MIDI_ENABLE
|
||||
|
@ -49,6 +49,6 @@ bool process_midi(uint16_t keycode, keyrecord_t *record);
|
||||
# define MIDI_TONE_COUNT (MIDI_TONE_MAX - MIDI_TONE_MIN + 1)
|
||||
|
||||
uint8_t midi_compute_note(uint16_t keycode);
|
||||
# endif // MIDI_ADVANCED
|
||||
# endif // MIDI_ADVANCED
|
||||
|
||||
#endif // MIDI_ENABLE
|
||||
#endif // MIDI_ENABLE
|
||||
|
@ -146,7 +146,7 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
if (music_activated || midi_activated) {
|
||||
if (record->event.pressed) {
|
||||
if (keycode == KC_LEFT_CTRL) { // Start recording
|
||||
if (keycode == KC_LEFT_CTRL) { // Start recording
|
||||
music_all_notes_off();
|
||||
music_sequence_recording = true;
|
||||
music_sequence_recorded = false;
|
||||
@ -155,9 +155,9 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (keycode == KC_LEFT_ALT) { // Stop recording/playing
|
||||
if (keycode == KC_LEFT_ALT) { // Stop recording/playing
|
||||
music_all_notes_off();
|
||||
if (music_sequence_recording) { // was recording
|
||||
if (music_sequence_recording) { // was recording
|
||||
music_sequence_recorded = true;
|
||||
}
|
||||
music_sequence_recording = false;
|
||||
@ -165,7 +165,7 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (keycode == KC_LEFT_GUI && music_sequence_recorded) { // Start playing
|
||||
if (keycode == KC_LEFT_GUI && music_sequence_recorded) { // Start playing
|
||||
music_all_notes_off();
|
||||
music_sequence_recording = false;
|
||||
music_sequence_playing = true;
|
||||
@ -230,11 +230,17 @@ bool music_mask(uint16_t keycode) {
|
||||
# endif
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool music_mask_kb(uint16_t keycode) { return music_mask_user(keycode); }
|
||||
__attribute__((weak)) bool music_mask_kb(uint16_t keycode) {
|
||||
return music_mask_user(keycode);
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool music_mask_user(uint16_t keycode) { return keycode < 0xFF; }
|
||||
__attribute__((weak)) bool music_mask_user(uint16_t keycode) {
|
||||
return keycode < 0xFF;
|
||||
}
|
||||
|
||||
bool is_music_on(void) { return (music_activated != 0); }
|
||||
bool is_music_on(void) {
|
||||
return (music_activated != 0);
|
||||
}
|
||||
|
||||
void music_toggle(void) {
|
||||
if (!music_activated) {
|
||||
@ -260,7 +266,9 @@ void music_off(void) {
|
||||
# endif
|
||||
}
|
||||
|
||||
bool is_midi_on(void) { return (midi_activated != 0); }
|
||||
bool is_midi_on(void) {
|
||||
return (midi_activated != 0);
|
||||
}
|
||||
|
||||
void midi_toggle(void) {
|
||||
if (!midi_activated) {
|
||||
@ -315,4 +323,4 @@ __attribute__((weak)) void midi_on_user() {}
|
||||
|
||||
__attribute__((weak)) void music_scale_user() {}
|
||||
|
||||
#endif // defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
|
||||
#endif // defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
|
||||
|
@ -51,8 +51,10 @@ bool music_mask_kb(uint16_t keycode);
|
||||
bool music_mask_user(uint16_t keycode);
|
||||
|
||||
# ifndef SCALE
|
||||
# define SCALE \
|
||||
(int8_t[]) { 0 + (12 * 0), 2 + (12 * 0), 4 + (12 * 0), 5 + (12 * 0), 7 + (12 * 0), 9 + (12 * 0), 11 + (12 * 0), 0 + (12 * 1), 2 + (12 * 1), 4 + (12 * 1), 5 + (12 * 1), 7 + (12 * 1), 9 + (12 * 1), 11 + (12 * 1), 0 + (12 * 2), 2 + (12 * 2), 4 + (12 * 2), 5 + (12 * 2), 7 + (12 * 2), 9 + (12 * 2), 11 + (12 * 2), 0 + (12 * 3), 2 + (12 * 3), 4 + (12 * 3), 5 + (12 * 3), 7 + (12 * 3), 9 + (12 * 3), 11 + (12 * 3), 0 + (12 * 4), 2 + (12 * 4), 4 + (12 * 4), 5 + (12 * 4), 7 + (12 * 4), 9 + (12 * 4), 11 + (12 * 4), }
|
||||
# define SCALE \
|
||||
(int8_t[]) { \
|
||||
0 + (12 * 0), 2 + (12 * 0), 4 + (12 * 0), 5 + (12 * 0), 7 + (12 * 0), 9 + (12 * 0), 11 + (12 * 0), 0 + (12 * 1), 2 + (12 * 1), 4 + (12 * 1), 5 + (12 * 1), 7 + (12 * 1), 9 + (12 * 1), 11 + (12 * 1), 0 + (12 * 2), 2 + (12 * 2), 4 + (12 * 2), 5 + (12 * 2), 7 + (12 * 2), 9 + (12 * 2), 11 + (12 * 2), 0 + (12 * 3), 2 + (12 * 3), 4 + (12 * 3), 5 + (12 * 3), 7 + (12 * 3), 9 + (12 * 3), 11 + (12 * 3), 0 + (12 * 4), 2 + (12 * 4), 4 + (12 * 4), 5 + (12 * 4), 7 + (12 * 4), 9 + (12 * 4), 11 + (12 * 4), \
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif // defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
|
||||
#endif // defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
|
||||
|
@ -16,16 +16,19 @@
|
||||
|
||||
#include "process_printer.h"
|
||||
#include "action_util.h"
|
||||
#include "uart.h"
|
||||
|
||||
bool printing_enabled = false;
|
||||
uint8_t character_shift = 0;
|
||||
|
||||
void enable_printing(void) {
|
||||
printing_enabled = true;
|
||||
serial_init();
|
||||
uart_init(19200);
|
||||
}
|
||||
|
||||
void disable_printing(void) { printing_enabled = false; }
|
||||
void disable_printing(void) {
|
||||
printing_enabled = false;
|
||||
}
|
||||
|
||||
uint8_t shifted_numbers[10] = {0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, 0x26, 0x2A, 0x28, 0x29};
|
||||
|
||||
@ -35,12 +38,13 @@ uint8_t shifted_numbers[10] = {0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, 0x26, 0x2A, 0
|
||||
|
||||
void print_char(char c) {
|
||||
USB_Disable();
|
||||
serial_send(c);
|
||||
uart_write(c);
|
||||
USB_Init();
|
||||
}
|
||||
|
||||
void print_string(char c[]) {
|
||||
for (uint8_t i = 0; i < strlen(c); i++) print_char(c[i]);
|
||||
for (uint8_t i = 0; i < strlen(c); i++)
|
||||
print_char(c[i]);
|
||||
}
|
||||
|
||||
void print_box_string(const char text[]) {
|
||||
|
@ -18,6 +18,4 @@
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#include "protocol/serial.h"
|
||||
|
||||
bool process_printer(uint16_t keycode, keyrecord_t *record);
|
||||
|
@ -25,13 +25,21 @@ uint8_t character_shift = 0;
|
||||
#define SERIAL_PIN_MASK _BV(PD3)
|
||||
#define SERIAL_DELAY 52
|
||||
|
||||
inline static void serial_delay(void) { _delay_us(SERIAL_DELAY); }
|
||||
inline static void serial_delay(void) {
|
||||
_delay_us(SERIAL_DELAY);
|
||||
}
|
||||
|
||||
inline static void serial_high(void) { SERIAL_PIN_PORT |= SERIAL_PIN_MASK; }
|
||||
inline static void serial_high(void) {
|
||||
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
|
||||
}
|
||||
|
||||
inline static void serial_low(void) { SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK; }
|
||||
inline static void serial_low(void) {
|
||||
SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK;
|
||||
}
|
||||
|
||||
inline static void serial_output(void) { SERIAL_PIN_DDR |= SERIAL_PIN_MASK; }
|
||||
inline static void serial_output(void) {
|
||||
SERIAL_PIN_DDR |= SERIAL_PIN_MASK;
|
||||
}
|
||||
|
||||
void enable_printing() {
|
||||
printing_enabled = true;
|
||||
@ -39,7 +47,9 @@ void enable_printing() {
|
||||
serial_high();
|
||||
}
|
||||
|
||||
void disable_printing() { printing_enabled = false; }
|
||||
void disable_printing() {
|
||||
printing_enabled = false;
|
||||
}
|
||||
|
||||
uint8_t shifted_numbers[10] = {0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, 0x26, 0x2A, 0x28, 0x29};
|
||||
|
||||
@ -61,7 +71,8 @@ void print_char(char c) {
|
||||
}
|
||||
|
||||
void print_string(char c[]) {
|
||||
for (uint8_t i = 0; i < strlen(c); i++) print_char(c[i]);
|
||||
for (uint8_t i = 0; i < strlen(c); i++)
|
||||
print_char(c[i]);
|
||||
}
|
||||
|
||||
bool process_printer(uint16_t keycode, keyrecord_t *record) {
|
||||
|
@ -51,12 +51,8 @@ static void __attribute__((noinline, unused)) handleKeycodeRGBMode(const uint8_t
|
||||
* Handle keycodes for both rgblight and rgbmatrix
|
||||
*/
|
||||
bool process_rgb(const uint16_t keycode, const keyrecord_t *record) {
|
||||
#ifndef SPLIT_KEYBOARD
|
||||
if (record->event.pressed) {
|
||||
#else
|
||||
// Split keyboards need to trigger on key-up for edge-case issue
|
||||
// need to trigger on key-up for edge-case issue
|
||||
if (!record->event.pressed) {
|
||||
#endif
|
||||
#if (defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)) || (defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES))
|
||||
uint8_t shifted = get_mods() & MOD_MASK_SHIFT;
|
||||
#endif
|
||||
|
@ -102,11 +102,17 @@ void steno_set_mode(steno_mode_t new_mode) {
|
||||
/* override to intercept chords right before they get sent.
|
||||
* return zero to suppress normal sending behavior.
|
||||
*/
|
||||
__attribute__((weak)) bool send_steno_chord_user(steno_mode_t mode, uint8_t chord[6]) { return true; }
|
||||
__attribute__((weak)) bool send_steno_chord_user(steno_mode_t mode, uint8_t chord[6]) {
|
||||
return true;
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool postprocess_steno_user(uint16_t keycode, keyrecord_t *record, steno_mode_t mode, uint8_t chord[6], int8_t pressed) { return true; }
|
||||
__attribute__((weak)) bool postprocess_steno_user(uint16_t keycode, keyrecord_t *record, steno_mode_t mode, uint8_t chord[6], int8_t pressed) {
|
||||
return true;
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool process_steno_user(uint16_t keycode, keyrecord_t *record) { return true; }
|
||||
__attribute__((weak)) bool process_steno_user(uint16_t keycode, keyrecord_t *record) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static void send_steno_chord(void) {
|
||||
if (send_steno_chord_user(mode, chord)) {
|
||||
@ -114,11 +120,11 @@ static void send_steno_chord(void) {
|
||||
case STENO_MODE_BOLT:
|
||||
send_steno_state(BOLT_STATE_SIZE, false);
|
||||
#ifdef VIRTSER_ENABLE
|
||||
virtser_send(0); // terminating byte
|
||||
virtser_send(0); // terminating byte
|
||||
#endif
|
||||
break;
|
||||
case STENO_MODE_GEMINI:
|
||||
chord[0] |= 0x80; // Indicate start of packet
|
||||
chord[0] |= 0x80; // Indicate start of packet
|
||||
send_steno_state(GEMINI_STATE_SIZE, true);
|
||||
break;
|
||||
}
|
||||
@ -126,9 +132,13 @@ static void send_steno_chord(void) {
|
||||
steno_clear_state();
|
||||
}
|
||||
|
||||
uint8_t *steno_get_state(void) { return &state[0]; }
|
||||
uint8_t *steno_get_state(void) {
|
||||
return &state[0];
|
||||
}
|
||||
|
||||
uint8_t *steno_get_chord(void) { return &chord[0]; }
|
||||
uint8_t *steno_get_chord(void) {
|
||||
return &chord[0];
|
||||
}
|
||||
|
||||
static bool update_state_bolt(uint8_t key, bool press) {
|
||||
uint8_t boltcode = pgm_read_byte(boltmap + key);
|
||||
|
@ -86,7 +86,9 @@ static inline void _process_tap_dance_action_fn(qk_tap_dance_state_t *state, voi
|
||||
}
|
||||
}
|
||||
|
||||
static inline void process_tap_dance_action_on_each_tap(qk_tap_dance_action_t *action) { _process_tap_dance_action_fn(&action->state, action->user_data, action->fn.on_each_tap); }
|
||||
static inline void process_tap_dance_action_on_each_tap(qk_tap_dance_action_t *action) {
|
||||
_process_tap_dance_action_fn(&action->state, action->user_data, action->fn.on_each_tap);
|
||||
}
|
||||
|
||||
void process_tap_dance_action_on_dance_finished(qk_tap_dance_action_t *action) {
|
||||
if (action->state.finished) return;
|
||||
@ -173,7 +175,7 @@ void tap_dance_task() {
|
||||
tap_user_defined = action->custom_tapping_term;
|
||||
} else {
|
||||
#ifdef TAPPING_TERM_PER_KEY
|
||||
tap_user_defined = get_tapping_term(action->state.keycode, NULL);
|
||||
tap_user_defined = get_tapping_term(action->state.keycode, &(keyrecord_t){});
|
||||
#else
|
||||
tap_user_defined = TAPPING_TERM;
|
||||
#endif
|
||||
|
@ -27,12 +27,12 @@
|
||||
bool terminal_enabled = false;
|
||||
char buffer[80] = "";
|
||||
char cmd_buffer[CMD_BUFF_SIZE][80];
|
||||
bool cmd_buffer_enabled = true; // replace with ifdef?
|
||||
bool cmd_buffer_enabled = true; // replace with ifdef?
|
||||
char newline[2] = "\n";
|
||||
char arguments[6][20];
|
||||
bool firstTime = true;
|
||||
|
||||
short int current_cmd_buffer_pos = 0; // used for up/down arrows - keeps track of where you are in the command buffer
|
||||
short int current_cmd_buffer_pos = 0; // used for up/down arrows - keeps track of where you are in the command buffer
|
||||
|
||||
__attribute__((weak)) const char terminal_prompt[8] = "> ";
|
||||
|
||||
@ -59,7 +59,8 @@ void enable_terminal(void) {
|
||||
terminal_enabled = true;
|
||||
strcpy(buffer, "");
|
||||
memset(cmd_buffer, 0, CMD_BUFF_SIZE * 80);
|
||||
for (int i = 0; i < 6; i++) strcpy(arguments[i], "");
|
||||
for (int i = 0; i < 6; i++)
|
||||
strcpy(arguments[i], "");
|
||||
// select all text to start over
|
||||
// SEND_STRING(SS_LCTL("a"));
|
||||
send_string(terminal_prompt);
|
||||
@ -160,7 +161,7 @@ void print_cmd_buff(void) {
|
||||
for (int i = 0; i < CMD_BUFF_SIZE; i++) {
|
||||
char tmpChar = ' ';
|
||||
itoa(i, &tmpChar, 10);
|
||||
const char *tmpCnstCharStr = &tmpChar; // because sned_string wont take a normal char *
|
||||
const char *tmpCnstCharStr = &tmpChar; // because sned_string wont take a normal char *
|
||||
send_string(tmpCnstCharStr);
|
||||
SEND_STRING(". ");
|
||||
send_string(cmd_buffer[i]);
|
||||
@ -185,7 +186,7 @@ void terminal_help(void) {
|
||||
}
|
||||
|
||||
void command_not_found(void) {
|
||||
wait_ms(50); // sometimes buffer isnt grabbed quick enough
|
||||
wait_ms(50); // sometimes buffer isnt grabbed quick enough
|
||||
SEND_STRING("command \"");
|
||||
send_string(buffer);
|
||||
SEND_STRING("\" not found\n");
|
||||
@ -217,15 +218,16 @@ void process_terminal_command(void) {
|
||||
|
||||
if (terminal_enabled) {
|
||||
strcpy(buffer, "");
|
||||
for (int i = 0; i < 6; i++) strcpy(arguments[i], "");
|
||||
for (int i = 0; i < 6; i++)
|
||||
strcpy(arguments[i], "");
|
||||
SEND_STRING(SS_TAP(X_HOME));
|
||||
send_string(terminal_prompt);
|
||||
}
|
||||
}
|
||||
void check_pos(void) {
|
||||
if (current_cmd_buffer_pos >= CMD_BUFF_SIZE) { // if over the top, move it back down to the top of the buffer so you can climb back down...
|
||||
if (current_cmd_buffer_pos >= CMD_BUFF_SIZE) { // if over the top, move it back down to the top of the buffer so you can climb back down...
|
||||
current_cmd_buffer_pos = CMD_BUFF_SIZE - 1;
|
||||
} else if (current_cmd_buffer_pos < 0) { //...and if you fall under the bottom of the buffer, reset back to 0 so you can climb back up
|
||||
} else if (current_cmd_buffer_pos < 0) { //...and if you fall under the bottom of the buffer, reset back to 0 so you can climb back up
|
||||
current_cmd_buffer_pos = 0;
|
||||
}
|
||||
}
|
||||
@ -278,33 +280,33 @@ bool process_terminal(uint16_t keycode, keyrecord_t *record) {
|
||||
case KC_RIGHT:
|
||||
return false;
|
||||
break;
|
||||
case KC_UP: // 0 = recent
|
||||
check_pos(); // check our current buffer position is valid
|
||||
if (current_cmd_buffer_pos <= CMD_BUFF_SIZE - 1) { // once we get to the top, dont do anything
|
||||
case KC_UP: // 0 = recent
|
||||
check_pos(); // check our current buffer position is valid
|
||||
if (current_cmd_buffer_pos <= CMD_BUFF_SIZE - 1) { // once we get to the top, dont do anything
|
||||
str_len = strlen(buffer);
|
||||
for (int i = 0; i < str_len; ++i) {
|
||||
send_string(SS_TAP(X_BSPACE)); // clear w/e is on the line already
|
||||
send_string(SS_TAP(X_BSPACE)); // clear w/e is on the line already
|
||||
// process_terminal(KC_BACKSPACE,record);
|
||||
}
|
||||
strncpy(buffer, cmd_buffer[current_cmd_buffer_pos], 80);
|
||||
|
||||
send_string(buffer);
|
||||
++current_cmd_buffer_pos; // get ready to access the above cmd if up/down is pressed again
|
||||
++current_cmd_buffer_pos; // get ready to access the above cmd if up/down is pressed again
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case KC_DOWN:
|
||||
check_pos();
|
||||
if (current_cmd_buffer_pos >= 0) { // once we get to the bottom, dont do anything
|
||||
if (current_cmd_buffer_pos >= 0) { // once we get to the bottom, dont do anything
|
||||
str_len = strlen(buffer);
|
||||
for (int i = 0; i < str_len; ++i) {
|
||||
send_string(SS_TAP(X_BSPACE)); // clear w/e is on the line already
|
||||
send_string(SS_TAP(X_BSPACE)); // clear w/e is on the line already
|
||||
// process_terminal(KC_BACKSPACE,record);
|
||||
}
|
||||
strncpy(buffer, cmd_buffer[current_cmd_buffer_pos], 79);
|
||||
|
||||
send_string(buffer);
|
||||
--current_cmd_buffer_pos; // get ready to access the above cmd if down/up is pressed again
|
||||
--current_cmd_buffer_pos; // get ready to access the above cmd if down/up is pressed again
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
|
@ -27,7 +27,7 @@ void qk_ucis_start(void) {
|
||||
|
||||
__attribute__((weak)) void qk_ucis_start_user(void) {
|
||||
unicode_input_start();
|
||||
register_hex(0x2328); // ⌨
|
||||
register_hex(0x2328); // ⌨
|
||||
unicode_input_finish();
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,9 @@ void unicode_input_mode_init(void) {
|
||||
dprintf("Unicode input mode init to: %u\n", unicode_config.input_mode);
|
||||
}
|
||||
|
||||
uint8_t get_unicode_input_mode(void) { return unicode_config.input_mode; }
|
||||
uint8_t get_unicode_input_mode(void) {
|
||||
return unicode_config.input_mode;
|
||||
}
|
||||
|
||||
void set_unicode_input_mode(uint8_t mode) {
|
||||
unicode_config.input_mode = mode;
|
||||
@ -76,7 +78,9 @@ void cycle_unicode_input_mode(int8_t offset) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void persist_unicode_input_mode(void) { eeprom_update_byte(EECONFIG_UNICODEMODE, unicode_config.input_mode); }
|
||||
void persist_unicode_input_mode(void) {
|
||||
eeprom_update_byte(EECONFIG_UNICODEMODE, unicode_config.input_mode);
|
||||
}
|
||||
|
||||
__attribute__((weak)) void unicode_input_start(void) {
|
||||
unicode_saved_caps_lock = host_keyboard_led_state().caps_lock;
|
||||
@ -90,8 +94,8 @@ __attribute__((weak)) void unicode_input_start(void) {
|
||||
tap_code(KC_CAPS_LOCK);
|
||||
}
|
||||
|
||||
unicode_saved_mods = get_mods(); // Save current mods
|
||||
clear_mods(); // Unregister mods to start from a clean state
|
||||
unicode_saved_mods = get_mods(); // Save current mods
|
||||
clear_mods(); // Unregister mods to start from a clean state
|
||||
|
||||
switch (unicode_config.input_mode) {
|
||||
case UC_MAC:
|
||||
@ -140,7 +144,7 @@ __attribute__((weak)) void unicode_input_finish(void) {
|
||||
break;
|
||||
}
|
||||
|
||||
set_mods(unicode_saved_mods); // Reregister previously set mods
|
||||
set_mods(unicode_saved_mods); // Reregister previously set mods
|
||||
}
|
||||
|
||||
__attribute__((weak)) void unicode_input_cancel(void) {
|
||||
@ -165,7 +169,7 @@ __attribute__((weak)) void unicode_input_cancel(void) {
|
||||
break;
|
||||
}
|
||||
|
||||
set_mods(unicode_saved_mods); // Reregister previously set mods
|
||||
set_mods(unicode_saved_mods); // Reregister previously set mods
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
@ -262,16 +266,16 @@ void send_unicode_hex_string(const char *str) {
|
||||
static const char *decode_utf8(const char *str, int32_t *code_point) {
|
||||
const char *next;
|
||||
|
||||
if (str[0] < 0x80) { // U+0000-007F
|
||||
if (str[0] < 0x80) { // U+0000-007F
|
||||
*code_point = str[0];
|
||||
next = str + 1;
|
||||
} else if ((str[0] & 0xE0) == 0xC0) { // U+0080-07FF
|
||||
} else if ((str[0] & 0xE0) == 0xC0) { // U+0080-07FF
|
||||
*code_point = ((int32_t)(str[0] & 0x1F) << 6) | ((int32_t)(str[1] & 0x3F) << 0);
|
||||
next = str + 2;
|
||||
} else if ((str[0] & 0xF0) == 0xE0) { // U+0800-FFFF
|
||||
} else if ((str[0] & 0xF0) == 0xE0) { // U+0800-FFFF
|
||||
*code_point = ((int32_t)(str[0] & 0x0F) << 12) | ((int32_t)(str[1] & 0x3F) << 6) | ((int32_t)(str[2] & 0x3F) << 0);
|
||||
next = str + 3;
|
||||
} else if ((str[0] & 0xF8) == 0xF0 && (str[0] <= 0xF4)) { // U+10000-10FFFF
|
||||
} else if ((str[0] & 0xF8) == 0xF0 && (str[0] <= 0xF4)) { // U+10000-10FFFF
|
||||
*code_point = ((int32_t)(str[0] & 0x07) << 18) | ((int32_t)(str[1] & 0x3F) << 12) | ((int32_t)(str[2] & 0x3F) << 6) | ((int32_t)(str[3] & 0x3F) << 0);
|
||||
next = str + 4;
|
||||
} else {
|
||||
|
@ -59,12 +59,12 @@
|
||||
#define UC_OSX UC_MAC
|
||||
|
||||
enum unicode_input_modes {
|
||||
UC_MAC, // macOS using Unicode Hex Input
|
||||
UC_LNX, // Linux using IBus
|
||||
UC_WIN, // Windows using EnableHexNumpad
|
||||
UC_BSD, // BSD (not implemented)
|
||||
UC_WINC, // Windows using WinCompose (https://github.com/samhocevar/wincompose)
|
||||
UC__COUNT // Number of available input modes (always leave at the end)
|
||||
UC_MAC, // macOS using Unicode Hex Input
|
||||
UC_LNX, // Linux using IBus
|
||||
UC_WIN, // Windows using EnableHexNumpad
|
||||
UC_BSD, // BSD (not implemented)
|
||||
UC_WINC, // Windows using WinCompose (https://github.com/samhocevar/wincompose)
|
||||
UC__COUNT // Number of available input modes (always leave at the end)
|
||||
};
|
||||
|
||||
typedef union {
|
||||
|
Reference in New Issue
Block a user