CamelCase of handle_*_key*

pull/141/head
Jesse Vincent 7 years ago
parent 2582441523
commit 210287684f
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -13,7 +13,7 @@ Kaleidoscope_::setup(void) {
Keyboard.begin(); Keyboard.begin();
// A workaround, so that the compiler does not optimize this out... // A workaround, so that the compiler does not optimize this out...
handle_keyswitch_event(Key_NoKey, 255, 255, 0); handleKeyswitchEvent(Key_NoKey, 255, 255, 0);
} }
void void

@ -1,6 +1,6 @@
#include "Kaleidoscope.h" #include "Kaleidoscope.h"
static bool handle_synthetic_keyswitch_event(Key mappedKey, uint8_t keyState) { static bool handleSyntheticKeyswitchEvent(Key mappedKey, uint8_t keyState) {
if (mappedKey.flags & RESERVED) if (mappedKey.flags & RESERVED)
return false; return false;
@ -26,12 +26,12 @@ static bool handle_synthetic_keyswitch_event(Key mappedKey, uint8_t keyState) {
return true; return true;
} }
static bool handle_keyswitch_event_default(Key mappedKey, byte row, byte col, uint8_t keyState) { static bool handleKeyswitchEventDefault(Key mappedKey, byte row, byte col, uint8_t keyState) {
//for every newly pressed button, figure out what logical key it is and send a key down event //for every newly pressed button, figure out what logical key it is and send a key down event
// for every newly released button, figure out what logical key it is and send a key up event // for every newly released button, figure out what logical key it is and send a key up event
if (mappedKey.flags & SYNTHETIC) { if (mappedKey.flags & SYNTHETIC) {
handle_synthetic_keyswitch_event(mappedKey, keyState); handleSyntheticKeyswitchEvent(mappedKey, keyState);
} else if (keyIsPressed(keyState)) { } else if (keyIsPressed(keyState)) {
press_key(mappedKey); press_key(mappedKey);
} else if (keyToggledOff(keyState) && (keyState & INJECTED)) { } else if (keyToggledOff(keyState) && (keyState & INJECTED)) {
@ -79,7 +79,7 @@ void release_key(Key mappedKey) {
Keyboard.release(mappedKey.keyCode); Keyboard.release(mappedKey.keyCode);
} }
void handle_keyswitch_event(Key mappedKey, byte row, byte col, uint8_t keyState) { void handleKeyswitchEvent(Key mappedKey, byte row, byte col, uint8_t keyState) {
if (!(keyState & INJECTED)) { if (!(keyState & INJECTED)) {
mappedKey = Layer.lookup(row, col); mappedKey = Layer.lookup(row, col);
} }
@ -92,5 +92,5 @@ void handle_keyswitch_event(Key mappedKey, byte row, byte col, uint8_t keyState)
mappedKey = Layer.eventHandler(mappedKey, row, col, keyState); mappedKey = Layer.eventHandler(mappedKey, row, col, keyState);
if (mappedKey.raw == Key_NoKey.raw) if (mappedKey.raw == Key_NoKey.raw)
return; return;
handle_keyswitch_event_default(mappedKey, row, col, keyState); handleKeyswitchEventDefault(mappedKey, row, col, keyState);
} }

@ -13,13 +13,13 @@ extern const Key keymaps[][ROWS][COLS];
#define UNKNOWN_KEYSWITCH_LOCATION 255,255 #define UNKNOWN_KEYSWITCH_LOCATION 255,255
// sending events to the computer // sending events to the computer
/* The event handling starts with the Scanner calling handle_keyswitch_event() for /* The event handling starts with the Scanner calling handleKeyswitchEvent() for
* every key in the matrix, and it is the task of this method to figure out what * every key in the matrix, and it is the task of this method to figure out what
* to do, it is the main entry point. * to do, it is the main entry point.
* *
* This function will iterate through an array of handler functions, and stop as * This function will iterate through an array of handler functions, and stop as
* soon as one of them signals that the event has been handled. To make it * soon as one of them signals that the event has been handled. To make it
* possible to inject synthetic events, one can call handle_keyswitch_event from * possible to inject synthetic events, one can call handleKeyswitchEvent from
* within a custom handler (making the event handling recursive), with a * within a custom handler (making the event handling recursive), with a
* different keycode. * different keycode.
* *
@ -28,20 +28,20 @@ extern const Key keymaps[][ROWS][COLS];
* normal modifier instead. In this case, the keymap would contain a key with * normal modifier instead. In this case, the keymap would contain a key with
* OSM flags set, and the event handler would remove the OSM flags, and let the * OSM flags set, and the event handler would remove the OSM flags, and let the
* system handle the key as it would have, without the OSM flags. So we simply * system handle the key as it would have, without the OSM flags. So we simply
* clear the flags, and call handle_keyswitch_event again, with the modifier keycode * clear the flags, and call handleKeyswitchEvent again, with the modifier keycode
* as the first argument. This way, we could insert an event, and have the whole * as the first argument. This way, we could insert an event, and have the whole
* chain re-process it, instead of registering the keycode ourselves with HID * chain re-process it, instead of registering the keycode ourselves with HID
* ourselves. Injecting allows any and all custom handlers to have a chance, * ourselves. Injecting allows any and all custom handlers to have a chance,
* too. * too.
* *
* For this reason, the handle_keyswitch_event receives four arguments: the mapped key * For this reason, the handleKeyswitchEvent receives four arguments: the mapped key
* (or Key_NoKey if we do not want to override what is in the keymap), the row * (or Key_NoKey if we do not want to override what is in the keymap), the row
* and column of the key, so we can look up the code for it, and the current and * and column of the key, so we can look up the code for it, and the current and
* previous state of the key, so we can determine what the event is. The * previous state of the key, so we can determine what the event is. The
* currentState may be flagged INJECTED, which signals that the event was * currentState may be flagged INJECTED, which signals that the event was
* injected, and is not a direct result of a keypress, coming from the scanner. * injected, and is not a direct result of a keypress, coming from the scanner.
*/ */
void handle_keyswitch_event(Key mappedKey, byte row, byte col, uint8_t keyState); void handleKeyswitchEvent(Key mappedKey, byte row, byte col, uint8_t keyState);
// Internal use // Internal use
void press_key(Key mappedKey); void press_key(Key mappedKey);

@ -7,7 +7,7 @@ uint8_t Layer_::highestLayer;
uint8_t Layer_::keyMap[ROWS][COLS]; uint8_t Layer_::keyMap[ROWS][COLS];
Key(*Layer_::getKey)(uint8_t layer, byte row, byte col) = Layer.getKeyFromPROGMEM; Key(*Layer_::getKey)(uint8_t layer, byte row, byte col) = Layer.getKeyFromPROGMEM;
static void handle_keymap_keyswitch_event(Key keymapEntry, uint8_t keyState) { static void handleKeymapKeyswitchEvent(Key keymapEntry, uint8_t keyState) {
if (keymapEntry.keyCode >= MOMENTARY_OFFSET) { if (keymapEntry.keyCode >= MOMENTARY_OFFSET) {
uint8_t target = keymapEntry.keyCode - MOMENTARY_OFFSET; uint8_t target = keymapEntry.keyCode - MOMENTARY_OFFSET;
@ -44,7 +44,7 @@ Layer_::eventHandler(Key mappedKey, byte row, byte col, uint8_t keyState) {
if (mappedKey.flags != (SYNTHETIC | SWITCH_TO_KEYMAP)) if (mappedKey.flags != (SYNTHETIC | SWITCH_TO_KEYMAP))
return mappedKey; return mappedKey;
handle_keymap_keyswitch_event(mappedKey, keyState); handleKeymapKeyswitchEvent(mappedKey, keyState);
return Key_NoKey; return Key_NoKey;
} }

Loading…
Cancel
Save