introduces new format [broken] [skip ci]
This commit is contained in:
parent
6b2a3492b7
commit
98ac10fd74
@ -117,18 +117,13 @@ void unregister_code16 (uint16_t code) {
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
bool process_action_kb(keyrecord_t *record) {
|
||||
return true;
|
||||
level_t process_kb(uint16_t keycode, keyrecord_t *record) {
|
||||
return CONTINUE;
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||
return process_record_user(keycode, record);
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
return true;
|
||||
level_t process_user(uint16_t keycode, keyrecord_t *record) {
|
||||
return CONTINUE;
|
||||
}
|
||||
|
||||
void reset_keyboard(void) {
|
||||
@ -162,7 +157,8 @@ void reset_keyboard(void) {
|
||||
static bool shift_interrupted[2] = {0, 0};
|
||||
static uint16_t scs_timer[2] = {0, 0};
|
||||
|
||||
bool process_record_quantum(keyrecord_t *record) {
|
||||
level_t process_quantum(keyrecord_t *record) {
|
||||
level_t level = CONTINUE;
|
||||
|
||||
/* This gets the keycode from the key pressed */
|
||||
keypos_t key = record->event.key;
|
||||
@ -182,7 +178,7 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||
keycode = keymap_key_to_keycode(layer, key);
|
||||
} else
|
||||
#endif
|
||||
keycode = keymap_key_to_keycode(layer_switch_get_layer(key), key);
|
||||
keycode = keymap_key_to_keycode(layer_switch_get_layer(key), key);
|
||||
|
||||
// This is how you use actions here
|
||||
// if (keycode == KC_LEAD) {
|
||||
@ -192,47 +188,57 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if (!(
|
||||
process_record_kb(keycode, record) &&
|
||||
level |= process_user(keycode, record);
|
||||
if (!(level & STOP_KEYBOARD))
|
||||
level |= process_kb(keycode, record);
|
||||
#if defined(MIDI_ENABLE) && defined(MIDI_ADVANCED)
|
||||
process_midi(keycode, record) &&
|
||||
if (!(level & STOP_FEATURES))
|
||||
level |= process_midi(keycode, record);
|
||||
#endif
|
||||
#ifdef AUDIO_ENABLE
|
||||
process_audio(keycode, record) &&
|
||||
if (!(level & STOP_FEATURES))
|
||||
level |= process_audio(keycode, record);
|
||||
#endif
|
||||
#ifdef STENO_ENABLE
|
||||
process_steno(keycode, record) &&
|
||||
if (!(level & STOP_FEATURES))
|
||||
level |= process_steno(keycode, record);
|
||||
#endif
|
||||
#if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
|
||||
process_music(keycode, record) &&
|
||||
if (!(level & STOP_FEATURES))
|
||||
level |= process_music(keycode, record);
|
||||
#endif
|
||||
#ifdef TAP_DANCE_ENABLE
|
||||
process_tap_dance(keycode, record) &&
|
||||
if (!(level & STOP_FEATURES))
|
||||
level |= process_tap_dance(keycode, record);
|
||||
#endif
|
||||
#ifndef DISABLE_LEADER
|
||||
process_leader(keycode, record) &&
|
||||
if (!(level & STOP_FEATURES))
|
||||
level |= process_leader(keycode, record);
|
||||
#endif
|
||||
#ifndef DISABLE_CHORDING
|
||||
process_chording(keycode, record) &&
|
||||
if (!(level & STOP_FEATURES))
|
||||
level |= process_chording(keycode, record)
|
||||
#endif
|
||||
#ifdef COMBO_ENABLE
|
||||
process_combo(keycode, record) &&
|
||||
if (!(level & STOP_FEATURES))
|
||||
level |= process_combo(keycode, record);
|
||||
#endif
|
||||
#ifdef UNICODE_ENABLE
|
||||
process_unicode(keycode, record) &&
|
||||
if (!(level & STOP_FEATURES))
|
||||
level |= process_unicode(keycode, record);
|
||||
#endif
|
||||
#ifdef UCIS_ENABLE
|
||||
process_ucis(keycode, record) &&
|
||||
if (!(level & STOP_FEATURES))
|
||||
level |= process_ucis(keycode, record);
|
||||
#endif
|
||||
#ifdef PRINTING_ENABLE
|
||||
process_printer(keycode, record) &&
|
||||
if (!(level & STOP_FEATURES))
|
||||
level |= process_printer(keycode, record);
|
||||
#endif
|
||||
#ifdef UNICODEMAP_ENABLE
|
||||
process_unicode_map(keycode, record) &&
|
||||
if (!(level & STOP_FEATURES))
|
||||
level |= process_unicode_map(keycode, record);
|
||||
#endif
|
||||
true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Shift / paren setup
|
||||
|
||||
@ -241,33 +247,33 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
reset_keyboard();
|
||||
}
|
||||
return false;
|
||||
return (level | STOP_ALL);
|
||||
break;
|
||||
case DEBUG:
|
||||
if (record->event.pressed) {
|
||||
print("\nDEBUG: enabled.\n");
|
||||
debug_enable = true;
|
||||
}
|
||||
return false;
|
||||
return (level | STOP_ALL);
|
||||
break;
|
||||
#ifdef FAUXCLICKY_ENABLE
|
||||
case FC_TOG:
|
||||
if (record->event.pressed) {
|
||||
FAUXCLICKY_TOGGLE;
|
||||
}
|
||||
return false;
|
||||
return (level | STOP_ALL);
|
||||
break;
|
||||
case FC_ON:
|
||||
if (record->event.pressed) {
|
||||
FAUXCLICKY_ON;
|
||||
}
|
||||
return false;
|
||||
return (level | STOP_ALL);
|
||||
break;
|
||||
case FC_OFF:
|
||||
if (record->event.pressed) {
|
||||
FAUXCLICKY_OFF;
|
||||
}
|
||||
return false;
|
||||
return (level | STOP_ALL);
|
||||
break;
|
||||
#endif
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
@ -275,49 +281,49 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
rgblight_toggle();
|
||||
}
|
||||
return false;
|
||||
return (level | STOP_ALL);
|
||||
break;
|
||||
case RGB_MOD:
|
||||
if (record->event.pressed) {
|
||||
rgblight_step();
|
||||
}
|
||||
return false;
|
||||
return (level | STOP_ALL);
|
||||
break;
|
||||
case RGB_HUI:
|
||||
if (record->event.pressed) {
|
||||
rgblight_increase_hue();
|
||||
}
|
||||
return false;
|
||||
return (level | STOP_ALL);
|
||||
break;
|
||||
case RGB_HUD:
|
||||
if (record->event.pressed) {
|
||||
rgblight_decrease_hue();
|
||||
}
|
||||
return false;
|
||||
return (level | STOP_ALL);
|
||||
break;
|
||||
case RGB_SAI:
|
||||
if (record->event.pressed) {
|
||||
rgblight_increase_sat();
|
||||
}
|
||||
return false;
|
||||
return (level | STOP_ALL);
|
||||
break;
|
||||
case RGB_SAD:
|
||||
if (record->event.pressed) {
|
||||
rgblight_decrease_sat();
|
||||
}
|
||||
return false;
|
||||
return (level | STOP_ALL);
|
||||
break;
|
||||
case RGB_VAI:
|
||||
if (record->event.pressed) {
|
||||
rgblight_increase_val();
|
||||
}
|
||||
return false;
|
||||
return (level | STOP_ALL);
|
||||
break;
|
||||
case RGB_VAD:
|
||||
if (record->event.pressed) {
|
||||
rgblight_decrease_val();
|
||||
}
|
||||
return false;
|
||||
return (level | STOP_ALL);
|
||||
break;
|
||||
#endif
|
||||
#ifdef PROTOCOL_LUFA
|
||||
@ -325,20 +331,20 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
set_output(OUTPUT_AUTO);
|
||||
}
|
||||
return false;
|
||||
return (level | STOP_ALL);
|
||||
break;
|
||||
case OUT_USB:
|
||||
if (record->event.pressed) {
|
||||
set_output(OUTPUT_USB);
|
||||
}
|
||||
return false;
|
||||
return (level | STOP_ALL);
|
||||
break;
|
||||
#ifdef BLUETOOTH_ENABLE
|
||||
case OUT_BT:
|
||||
if (record->event.pressed) {
|
||||
set_output(OUTPUT_BLUETOOTH);
|
||||
}
|
||||
return false;
|
||||
return (level | STOP_ALL);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
@ -423,7 +429,7 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||
eeconfig_update_keymap(keymap_config.raw);
|
||||
clear_keyboard(); // clear to prevent stuck keys
|
||||
|
||||
return false;
|
||||
return (level | STOP_ALL);
|
||||
}
|
||||
break;
|
||||
case KC_LSPO: {
|
||||
@ -445,7 +451,7 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||
}
|
||||
unregister_mods(MOD_BIT(KC_LSFT));
|
||||
}
|
||||
return false;
|
||||
return (level | STOP_ALL);
|
||||
// break;
|
||||
}
|
||||
|
||||
@ -468,7 +474,7 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||
}
|
||||
unregister_mods(MOD_BIT(KC_RSFT));
|
||||
}
|
||||
return false;
|
||||
return (level | STOP_ALL);
|
||||
// break;
|
||||
}
|
||||
case GRAVE_ESC: {
|
||||
@ -486,7 +492,7 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||
}
|
||||
}
|
||||
|
||||
return process_action_kb(record);
|
||||
return level;
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
|
@ -119,9 +119,29 @@ void matrix_init_kb(void);
|
||||
void matrix_scan_kb(void);
|
||||
void matrix_init_user(void);
|
||||
void matrix_scan_user(void);
|
||||
|
||||
|
||||
bool process_action_kb(keyrecord_t *record);
|
||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record);
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
typedef enum {
|
||||
PL_STOP_SYSTEM,
|
||||
PL_STOP_FEATURES,
|
||||
PL_STOP_KEYBOARD
|
||||
} process_level_t;
|
||||
|
||||
#define CONTINUE (0)
|
||||
#define STOP_SYSTEM (1<<PL_STOP_SYSTEM)
|
||||
#define STOP_FEAUTRES (1<<PL_STOP_FEAUTRES)
|
||||
#define STOP_KEYBOARD (1<<PL_STOP_KEYBOARD)
|
||||
#define STOP_ALL (STOP_SYSTEM|STOP_FEAUTRES|STOP_KEYBOARD)
|
||||
|
||||
// uint8_t supports up to 8 stops
|
||||
#define level_t uint8_t
|
||||
|
||||
/* keyboard-specific key event (pre)processing */
|
||||
level_t process_quantum(keyrecord_t *record);
|
||||
level_t process_kb(uint16_t keycode, keyrecord_t *record);
|
||||
level_t process_user(uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
void reset_keyboard(void);
|
||||
|
||||
|
@ -40,6 +40,8 @@ int tp_buttons;
|
||||
#include <fauxclicky.h>
|
||||
#endif
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
void action_exec(keyevent_t event)
|
||||
{
|
||||
if (!IS_NOEVENT(event)) {
|
||||
@ -120,24 +122,21 @@ void process_record_nocache(keyrecord_t *record)
|
||||
}
|
||||
#endif
|
||||
|
||||
__attribute__ ((weak))
|
||||
bool process_record_quantum(keyrecord_t *record) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void process_record(keyrecord_t *record)
|
||||
{
|
||||
if (IS_NOEVENT(record->event)) { return; }
|
||||
|
||||
if(!process_record_quantum(record))
|
||||
uint8_t level = process_quantum(record);
|
||||
|
||||
if (level & STOP_SYSTEM)
|
||||
return;
|
||||
|
||||
action_t action = store_or_get_action(record->event.pressed, record->event.key);
|
||||
dprint("ACTION: "); debug_action(action);
|
||||
#ifndef NO_ACTION_LAYER
|
||||
dprint(" layer_state: "); layer_debug();
|
||||
dprint(" default_layer_state: "); default_layer_debug();
|
||||
#endif
|
||||
#ifndef NO_ACTION_LAYER
|
||||
dprint(" layer_state: "); layer_debug();
|
||||
dprint(" default_layer_state: "); default_layer_debug();
|
||||
#endif
|
||||
dprintln();
|
||||
|
||||
process_action(record, action);
|
||||
|
@ -58,9 +58,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt);
|
||||
/* user defined special function */
|
||||
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt);
|
||||
|
||||
/* keyboard-specific key event (pre)processing */
|
||||
bool process_record_quantum(keyrecord_t *record);
|
||||
|
||||
/* Utilities for actions. */
|
||||
#if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
|
||||
extern bool disable_action_cache;
|
||||
|
Reference in New Issue
Block a user