pull/389/head
Michael Richters 7 years ago
parent c112cc615d
commit d33deda114

@ -8,22 +8,22 @@ enum { MACRO_TOGGLE_QUKEYS };
KEYMAPS( KEYMAPS(
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
( (
Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey,
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab, Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab,
Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G, Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G,
Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape, Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift, Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
___, ___,
M(MACRO_TOGGLE_QUKEYS), Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip, M(MACRO_TOGGLE_QUKEYS), Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip,
Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals, Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals,
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote, Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
Key_skip, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus, Key_skip, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
___), ___),
) )
// Defining a macro (on the "any" key: see above) to toggle Qukeys on and off // Defining a macro (on the "any" key: see above) to toggle Qukeys on and off

@ -136,7 +136,7 @@ void Qukeys::flushKey(bool qukey_state, uint8_t keyswitch_state) {
memcpy(Keyboard.keyReport.allkeys, hid_report.allkeys, sizeof(hid_report)); memcpy(Keyboard.keyReport.allkeys, hid_report.allkeys, sizeof(hid_report));
// Last, if the key is still down, add its code back in // Last, if the key is still down, add its code back in
if ( ! keyToggledOn(keyswitch_state) ) if (! keyToggledOn(keyswitch_state))
handleKeyswitchEvent(keycode, row, col, IS_PRESSED | WAS_PRESSED | INJECTED); handleKeyswitchEvent(keycode, row, col, IS_PRESSED | WAS_PRESSED | INJECTED);
// Shift the queue, so key_queue[0] is always the first key that gets processed // Shift the queue, so key_queue[0] is always the first key that gets processed
@ -165,7 +165,7 @@ void Qukeys::flushQueue(int8_t index) {
void Qukeys::flushQueue(void) { void Qukeys::flushQueue(void) {
// flush keys until we find a qukey: // flush keys until we find a qukey:
while (key_queue_length_ > 0 && while (key_queue_length_ > 0 &&
lookupQukey(key_queue_[0].addr) == QUKEY_NOT_FOUND) { lookupQukey(key_queue_[0].addr) == QUKEY_NOT_FOUND) {
flushKey(QUKEY_STATE_PRIMARY, IS_PRESSED | WAS_PRESSED); flushKey(QUKEY_STATE_PRIMARY, IS_PRESSED | WAS_PRESSED);
} }
} }
@ -194,7 +194,7 @@ Key Qukeys::keyScanHook(Key mapped_key, byte row, byte col, uint8_t key_state) {
if (keyToggledOn(key_state)) { if (keyToggledOn(key_state)) {
// If the queue is empty and the key isn't a qukey, proceed: // If the queue is empty and the key isn't a qukey, proceed:
if (key_queue_length_ == 0 && if (key_queue_length_ == 0 &&
qukey_index == QUKEY_NOT_FOUND) qukey_index == QUKEY_NOT_FOUND)
return mapped_key; return mapped_key;
// Otherwise, queue the key and stop processing: // Otherwise, queue the key and stop processing:
enqueue(key_addr); enqueue(key_addr);
@ -245,7 +245,7 @@ void Qukeys::preReportHook(void) {
// state to the alternate keycode and add it to the report // state to the alternate keycode and add it to the report
uint32_t current_time = millis(); uint32_t current_time = millis();
while (key_queue_length_ > 0) { while (key_queue_length_ > 0) {
if ( lookupQukey(key_queue_[0].addr) == QUKEY_NOT_FOUND ) { if (lookupQukey(key_queue_[0].addr) == QUKEY_NOT_FOUND) {
flushKey(QUKEY_STATE_PRIMARY, IS_PRESSED | WAS_PRESSED); flushKey(QUKEY_STATE_PRIMARY, IS_PRESSED | WAS_PRESSED);
} else if (current_time > key_queue_[0].flush_time) { } else if (current_time > key_queue_[0].flush_time) {
flushKey(QUKEY_STATE_ALTERNATE, IS_PRESSED | WAS_PRESSED); flushKey(QUKEY_STATE_ALTERNATE, IS_PRESSED | WAS_PRESSED);

@ -105,7 +105,7 @@ class Qukeys : public KaleidoscopePlugin {
//static uint8_t keyswitch_state[]; //static uint8_t keyswitch_state[];
// Qukey state bitfield // Qukey state bitfield
static uint8_t qukey_state_[(TOTAL_KEYS)/8 + ((TOTAL_KEYS)%8 ? 1 : 0)]; static uint8_t qukey_state_[(TOTAL_KEYS) / 8 + ((TOTAL_KEYS) % 8 ? 1 : 0)];
static bool getQukeyState(uint8_t addr) { static bool getQukeyState(uint8_t addr) {
return bitRead(qukey_state_[addr / 8], addr % 8); return bitRead(qukey_state_[addr / 8], addr % 8);
} }

Loading…
Cancel
Save