introduces new format [broken] [skip ci]

process_keycode_update
Jack Humbert 7 years ago
parent 6b2a3492b7
commit 98ac10fd74

@ -1,90 +1,90 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.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/>.
*/
#ifndef CONFIG_H
#define CONFIG_H
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x3060
#define DEVICE_VER 0x0001
#define MANUFACTURER xyxjj
#define PRODUCT DeltaSplit75
#define DESCRIPTION 75% split keyboard
/* key matrix size */
// Rows are doubled-up
#define MATRIX_ROWS 14
#define MATRIX_COLS 8
// wiring of each half
#define MATRIX_ROW_PINS { F4, F5, F6, F7, B1, B3, B2 }
#define MATRIX_COL_PINS { B6, B5, B4, E6, D7, C6, D4, D1}
#define CATERINA_BOOTLOADER
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
/* number of backlight levels */
// #define BACKLIGHT_LEVELS 3
/* Set 0 if debouncing isn't needed */
#define DEBOUNCING_DELAY 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
/* key combination for command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
/* ws2812 RGB LED */
#define RGB_DI_PIN D3
#define RGBLIGHT_TIMER
#define RGBLED_NUM 12 // Number of LEDs
#define ws2812_PORTREG PORTD
#define ws2812_DDRREG DDRD
/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/
/* disable debug print */
// #define NO_DEBUG
/* disable print */
// #define NO_PRINT
/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
/*
Copyright 2012 Jun Wako <wakojun@gmail.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/>.
*/
#ifndef CONFIG_H
#define CONFIG_H
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x3060
#define DEVICE_VER 0x0001
#define MANUFACTURER xyxjj
#define PRODUCT DeltaSplit75
#define DESCRIPTION 75% split keyboard
/* key matrix size */
// Rows are doubled-up
#define MATRIX_ROWS 14
#define MATRIX_COLS 8
// wiring of each half
#define MATRIX_ROW_PINS { F4, F5, F6, F7, B1, B3, B2 }
#define MATRIX_COL_PINS { B6, B5, B4, E6, D7, C6, D4, D1}
#define CATERINA_BOOTLOADER
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
/* number of backlight levels */
// #define BACKLIGHT_LEVELS 3
/* Set 0 if debouncing isn't needed */
#define DEBOUNCING_DELAY 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
/* key combination for command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
/* ws2812 RGB LED */
#define RGB_DI_PIN D3
#define RGBLIGHT_TIMER
#define RGBLED_NUM 12 // Number of LEDs
#define ws2812_PORTREG PORTD
#define ws2812_DDRREG DDRD
/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/
/* disable debug print */
// #define NO_DEBUG
/* disable print */
// #define NO_PRINT
/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
#endif

@ -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;

Loading…
Cancel
Save