Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65006cc376 | ||
|
|
fc01b29823 | ||
|
|
462595ef03 | ||
|
|
b0d85795f4 | ||
|
|
2c91ef51db | ||
|
|
a54e7ac0a8 | ||
|
|
64f54c268b | ||
|
|
d889d51a7d | ||
|
|
b284e9fa58 | ||
|
|
1a0da7971a | ||
|
|
53a82a5f57 | ||
|
|
10985abcdb | ||
|
|
e60a282742 | ||
|
|
a691b16ebe | ||
|
|
c38114648a |
16
CHANGELOG.md
16
CHANGELOG.md
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
|
||||
The format is loosely based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to the [UHK Versioning](VERSIONING.md) conventions.
|
||||
|
||||
## [8.3.1] - 2018-06-07
|
||||
|
||||
Device Protocol: 4.3.1 | Module Protocol: 4.0.0 | User Config: 4.1.0 | Hardware Config: 1.0.0
|
||||
|
||||
- Fix media key repetition bug on Windows.
|
||||
- Fix bug that made Windows unable to sleep when the UHK was plugged in.
|
||||
- Fix bug that made Chrome Remote Desktop blocked from interacting on Windows.
|
||||
- Fix bug that made locked layers not release. This bug was introduced in the previous release.
|
||||
|
||||
## [8.3.0] - 2018-06-03
|
||||
|
||||
Device Protocol: 4.3.1 | Module Protocol: 4.0.0 | User Config: 4.**1.0** | Hardware Config: 1.0.0
|
||||
|
||||
- Make the config parser handle switch layer actions with hold on double tap disabled. `USERCONFIG:MINOR`
|
||||
- Set key debounce timeout from 80ms to 100ms. This should further reduce key chattering.
|
||||
|
||||
## [8.2.5] - 2018-05-27
|
||||
|
||||
Device Protocol: 4.3.1 | Module Protocol: 4.0.0 | User Config: 4.0.1 | Hardware Config: 1.0.0
|
||||
|
||||
Submodule lib/agent updated: 8e20c85e07...81a83994ab
@@ -48,7 +48,7 @@ static parser_error_t parseKeyStrokeAction(key_action_t *keyAction, uint8_t keyS
|
||||
static parser_error_t parseSwitchLayerAction(key_action_t *KeyAction, config_buffer_t *buffer)
|
||||
{
|
||||
uint8_t layer = ReadUInt8(buffer) + 1;
|
||||
uint8_t mode = ReadBool(buffer) ? SwitchLayerMode_Toggle : SwitchLayerMode_HoldAndDoubleTapToggle;
|
||||
switch_layer_mode_t mode = ReadUInt8(buffer);
|
||||
|
||||
KeyAction->type = KeyActionType_SwitchLayer;
|
||||
KeyAction->switchLayer.layer = layer;
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
} keystroke_type_t;
|
||||
|
||||
typedef enum {
|
||||
SwitchLayerMode_Hold,
|
||||
SwitchLayerMode_HoldAndDoubleTapToggle,
|
||||
SwitchLayerMode_Toggle,
|
||||
SwitchLayerMode_Hold,
|
||||
} switch_layer_mode_t;
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
// Macros:
|
||||
|
||||
#define KEY_DEBOUNCER_INTERVAL_MSEC 1
|
||||
#define KEY_DEBOUNCER_TIMEOUT_MSEC 80
|
||||
#define KEY_DEBOUNCER_TIMEOUT_MSEC 100
|
||||
|
||||
// Functions:
|
||||
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
#include "keymap.h"
|
||||
|
||||
static bool heldLayers[LAYER_COUNT];
|
||||
static switch_layer_mode_t pressedLayers[LAYER_COUNT];
|
||||
static bool toggledLayers[LAYER_COUNT];
|
||||
|
||||
void updateLayerStates(void)
|
||||
{
|
||||
memset(heldLayers, false, LAYER_COUNT);
|
||||
memset(pressedLayers, false, LAYER_COUNT);
|
||||
memset(toggledLayers, false, LAYER_COUNT);
|
||||
|
||||
for (uint8_t slotId=0; slotId<SLOT_COUNT; slotId++) {
|
||||
for (uint8_t keyId=0; keyId<MAX_KEY_COUNT_PER_MODULE; keyId++) {
|
||||
@@ -20,9 +20,8 @@ void updateLayerStates(void)
|
||||
if (action.type == KeyActionType_SwitchLayer) {
|
||||
if (action.switchLayer.mode != SwitchLayerMode_Toggle) {
|
||||
heldLayers[action.switchLayer.layer] = true;
|
||||
}
|
||||
if (action.switchLayer.mode != SwitchLayerMode_Hold && !keyState->previous && keyState->current) {
|
||||
pressedLayers[action.switchLayer.layer] = action.switchLayer.mode;
|
||||
} else if (!keyState->previous) {
|
||||
toggledLayers[action.switchLayer.layer] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,11 +39,11 @@ layer_id_t GetActiveLayer()
|
||||
// Handle toggled layers
|
||||
|
||||
for (layer_id_t layerId=LayerId_Mod; layerId<=LayerId_Mouse; layerId++) {
|
||||
if (pressedLayers[layerId]) {
|
||||
if (toggledLayers[layerId]) {
|
||||
if (ToggledLayer == layerId) {
|
||||
ToggledLayer = LayerId_Base;
|
||||
break;
|
||||
} else if (ToggledLayer == LayerId_Base && pressedLayers[layerId] == SwitchLayerMode_Toggle) {
|
||||
} else if (ToggledLayer == LayerId_Base && toggledLayers[layerId] == SwitchLayerMode_Toggle) {
|
||||
ToggledLayer = layerId;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
static usb_basic_keyboard_report_t usbBasicKeyboardReports[2];
|
||||
uint32_t UsbBasicKeyboardActionCounter;
|
||||
usb_basic_keyboard_report_t* ActiveUsbBasicKeyboardReport = usbBasicKeyboardReports;
|
||||
volatile bool IsUsbBasicKeyboardReportSent = false;
|
||||
static uint8_t usbBasicKeyboardInBuffer[USB_BASIC_KEYBOARD_REPORT_LENGTH];
|
||||
|
||||
static usb_basic_keyboard_report_t* getInactiveUsbBasicKeyboardReport(void)
|
||||
@@ -22,14 +21,12 @@ void ResetActiveUsbBasicKeyboardReport(void)
|
||||
bzero(ActiveUsbBasicKeyboardReport, USB_BASIC_KEYBOARD_REPORT_LENGTH);
|
||||
}
|
||||
|
||||
static usb_status_t UsbBasicKeyboardAction(void)
|
||||
usb_status_t UsbBasicKeyboardAction(void)
|
||||
{
|
||||
usb_status_t status = USB_DeviceHidSend(
|
||||
UsbCompositeDevice.basicKeyboardHandle, USB_BASIC_KEYBOARD_ENDPOINT_INDEX,
|
||||
(uint8_t*)getInactiveUsbBasicKeyboardReport(), USB_BASIC_KEYBOARD_REPORT_LENGTH);
|
||||
IsUsbBasicKeyboardReportSent = true;
|
||||
UsbBasicKeyboardActionCounter++;
|
||||
return status;
|
||||
return USB_DeviceHidSend(
|
||||
UsbCompositeDevice.basicKeyboardHandle, USB_BASIC_KEYBOARD_ENDPOINT_INDEX,
|
||||
(uint8_t*)getInactiveUsbBasicKeyboardReport(), USB_BASIC_KEYBOARD_REPORT_LENGTH);
|
||||
}
|
||||
|
||||
usb_status_t UsbBasicKeyboardCallback(class_handle_t handle, uint32_t event, void *param)
|
||||
@@ -38,10 +35,6 @@ usb_status_t UsbBasicKeyboardCallback(class_handle_t handle, uint32_t event, voi
|
||||
|
||||
switch (event) {
|
||||
case kUSB_DeviceHidEventSendResponse:
|
||||
if (UsbCompositeDevice.attach) {
|
||||
return UsbBasicKeyboardAction();
|
||||
}
|
||||
break;
|
||||
case kUSB_DeviceHidEventGetReport:
|
||||
error = kStatus_USB_InvalidRequest;
|
||||
break;
|
||||
@@ -80,7 +73,7 @@ usb_status_t UsbBasicKeyboardCallback(class_handle_t handle, uint32_t event, voi
|
||||
usb_status_t UsbBasicKeyboardSetConfiguration(class_handle_t handle, uint8_t configuration)
|
||||
{
|
||||
if (USB_COMPOSITE_CONFIGURATION_INDEX == configuration) {
|
||||
return UsbBasicKeyboardAction();
|
||||
//return UsbBasicKeyboardAction();
|
||||
}
|
||||
return kStatus_USB_Error;
|
||||
}
|
||||
@@ -88,7 +81,7 @@ usb_status_t UsbBasicKeyboardSetConfiguration(class_handle_t handle, uint8_t con
|
||||
usb_status_t UsbBasicKeyboardSetInterface(class_handle_t handle, uint8_t interface, uint8_t alternateSetting)
|
||||
{
|
||||
if (USB_BASIC_KEYBOARD_INTERFACE_INDEX == interface) {
|
||||
return UsbBasicKeyboardAction();
|
||||
//return UsbBasicKeyboardAction();
|
||||
}
|
||||
return kStatus_USB_Error;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
|
||||
// Variables:
|
||||
|
||||
extern volatile bool IsUsbBasicKeyboardReportSent;
|
||||
extern uint32_t UsbBasicKeyboardActionCounter;
|
||||
extern usb_basic_keyboard_report_t* ActiveUsbBasicKeyboardReport;
|
||||
|
||||
@@ -43,5 +42,6 @@
|
||||
|
||||
void ResetActiveUsbBasicKeyboardReport(void);
|
||||
void SwitchActiveUsbBasicKeyboardReport(void);
|
||||
usb_status_t UsbBasicKeyboardAction(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
uint32_t UsbMediaKeyboardActionCounter;
|
||||
static usb_media_keyboard_report_t usbMediaKeyboardReports[2];
|
||||
usb_media_keyboard_report_t* ActiveUsbMediaKeyboardReport = usbMediaKeyboardReports;
|
||||
volatile bool IsUsbMediaKeyboardReportSent = false;
|
||||
|
||||
static usb_media_keyboard_report_t* getInactiveUsbMediaKeyboardReport(void)
|
||||
{
|
||||
@@ -20,14 +19,12 @@ void ResetActiveUsbMediaKeyboardReport(void)
|
||||
bzero(ActiveUsbMediaKeyboardReport, USB_MEDIA_KEYBOARD_REPORT_LENGTH);
|
||||
}
|
||||
|
||||
static usb_status_t UsbMediaKeyboardAction(void)
|
||||
usb_status_t UsbMediaKeyboardAction()
|
||||
{
|
||||
usb_status_t status = USB_DeviceHidSend(
|
||||
UsbCompositeDevice.mediaKeyboardHandle, USB_MEDIA_KEYBOARD_ENDPOINT_INDEX,
|
||||
(uint8_t*)getInactiveUsbMediaKeyboardReport(), USB_MEDIA_KEYBOARD_REPORT_LENGTH);
|
||||
IsUsbMediaKeyboardReportSent = true;
|
||||
UsbMediaKeyboardActionCounter++;
|
||||
return status;
|
||||
return USB_DeviceHidSend(
|
||||
UsbCompositeDevice.mediaKeyboardHandle, USB_MEDIA_KEYBOARD_ENDPOINT_INDEX,
|
||||
(uint8_t*)getInactiveUsbMediaKeyboardReport(), USB_MEDIA_KEYBOARD_REPORT_LENGTH);
|
||||
}
|
||||
|
||||
usb_status_t UsbMediaKeyboardCallback(class_handle_t handle, uint32_t event, void *param)
|
||||
@@ -36,10 +33,6 @@ usb_status_t UsbMediaKeyboardCallback(class_handle_t handle, uint32_t event, voi
|
||||
|
||||
switch (event) {
|
||||
case kUSB_DeviceHidEventSendResponse:
|
||||
if (UsbCompositeDevice.attach) {
|
||||
return UsbMediaKeyboardAction();
|
||||
}
|
||||
break;
|
||||
case kUSB_DeviceHidEventGetReport:
|
||||
case kUSB_DeviceHidEventSetReport:
|
||||
case kUSB_DeviceHidEventRequestReportBuffer:
|
||||
@@ -60,7 +53,7 @@ usb_status_t UsbMediaKeyboardCallback(class_handle_t handle, uint32_t event, voi
|
||||
usb_status_t UsbMediaKeyboardSetConfiguration(class_handle_t handle, uint8_t configuration)
|
||||
{
|
||||
if (USB_COMPOSITE_CONFIGURATION_INDEX == configuration) {
|
||||
return UsbMediaKeyboardAction();
|
||||
//return UsbMediaKeyboardAction();
|
||||
}
|
||||
return kStatus_USB_Error;
|
||||
}
|
||||
@@ -68,7 +61,7 @@ usb_status_t UsbMediaKeyboardSetConfiguration(class_handle_t handle, uint8_t con
|
||||
usb_status_t UsbMediaKeyboardSetInterface(class_handle_t handle, uint8_t interface, uint8_t alternateSetting)
|
||||
{
|
||||
if (USB_MEDIA_KEYBOARD_INTERFACE_INDEX == interface) {
|
||||
return UsbMediaKeyboardAction();
|
||||
//return UsbMediaKeyboardAction();
|
||||
}
|
||||
return kStatus_USB_Error;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
// Variables:
|
||||
|
||||
extern volatile bool IsUsbMediaKeyboardReportSent;
|
||||
extern uint32_t UsbMediaKeyboardActionCounter;
|
||||
extern usb_media_keyboard_report_t* ActiveUsbMediaKeyboardReport;
|
||||
|
||||
@@ -40,5 +39,6 @@
|
||||
|
||||
void ResetActiveUsbMediaKeyboardReport(void);
|
||||
void SwitchActiveUsbMediaKeyboardReport(void);
|
||||
usb_status_t UsbMediaKeyboardAction();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
uint32_t UsbMouseActionCounter;
|
||||
static usb_mouse_report_t usbMouseReports[2];
|
||||
usb_mouse_report_t* ActiveUsbMouseReport = usbMouseReports;
|
||||
volatile bool IsUsbMouseReportSent = false;
|
||||
|
||||
static usb_mouse_report_t* getInactiveUsbMouseReport(void)
|
||||
{
|
||||
@@ -20,25 +19,31 @@ void ResetActiveUsbMouseReport(void)
|
||||
bzero(ActiveUsbMouseReport, USB_MOUSE_REPORT_LENGTH);
|
||||
}
|
||||
|
||||
static volatile usb_status_t usbMouseAction(void)
|
||||
usb_status_t usbMouseAction(void)
|
||||
{
|
||||
usb_mouse_report_t *mouseReport = getInactiveUsbMouseReport();
|
||||
IsUsbMouseReportSent = true;
|
||||
return USB_DeviceHidSend(UsbCompositeDevice.mouseHandle, USB_MOUSE_ENDPOINT_INDEX,
|
||||
(uint8_t*)mouseReport, USB_MOUSE_REPORT_LENGTH);
|
||||
UsbMouseActionCounter++;
|
||||
return USB_DeviceHidSend(
|
||||
UsbCompositeDevice.mouseHandle, USB_MOUSE_ENDPOINT_INDEX,
|
||||
(uint8_t*)getInactiveUsbMouseReport(), USB_MOUSE_REPORT_LENGTH);
|
||||
}
|
||||
|
||||
usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param)
|
||||
{
|
||||
UsbMouseActionCounter++;
|
||||
static bool usbMouseActionActive = false;
|
||||
usb_status_t error = kStatus_USB_Error;
|
||||
|
||||
switch (event) {
|
||||
case kUSB_DeviceHidEventSendResponse:
|
||||
if (UsbCompositeDevice.attach) {
|
||||
return usbMouseAction();
|
||||
// Send out the report continuously if the report is not zeros
|
||||
usb_mouse_report_t *report = getInactiveUsbMouseReport();
|
||||
uint8_t zeroBuf[sizeof(usb_mouse_report_t)] = { 0 };
|
||||
bool reportChanged = memcmp(report, zeroBuf, sizeof(usb_mouse_report_t)) != 0;
|
||||
if (usbMouseActionActive || reportChanged) {
|
||||
usbMouseActionActive = reportChanged; // Used to send out all zeros once after a report has been sent
|
||||
return usbMouseAction();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case kUSB_DeviceHidEventGetReport:
|
||||
case kUSB_DeviceHidEventSetReport:
|
||||
case kUSB_DeviceHidEventRequestReportBuffer:
|
||||
@@ -59,7 +64,7 @@ usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param
|
||||
usb_status_t UsbMouseSetConfiguration(class_handle_t handle, uint8_t configuration)
|
||||
{
|
||||
if (USB_COMPOSITE_CONFIGURATION_INDEX == configuration) {
|
||||
return usbMouseAction();
|
||||
//return usbMouseAction();
|
||||
}
|
||||
return kStatus_USB_Error;
|
||||
}
|
||||
@@ -67,7 +72,7 @@ usb_status_t UsbMouseSetConfiguration(class_handle_t handle, uint8_t configurati
|
||||
usb_status_t UsbMouseSetInterface(class_handle_t handle, uint8_t interface, uint8_t alternateSetting)
|
||||
{
|
||||
if (USB_MOUSE_INTERFACE_INDEX == interface) {
|
||||
return usbMouseAction();
|
||||
//return usbMouseAction();
|
||||
}
|
||||
return kStatus_USB_Error;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
|
||||
// Variables:
|
||||
|
||||
extern volatile bool IsUsbMouseReportSent;
|
||||
extern uint32_t UsbMouseActionCounter;
|
||||
extern usb_mouse_report_t* ActiveUsbMouseReport;
|
||||
|
||||
@@ -43,5 +42,6 @@
|
||||
|
||||
void ResetActiveUsbMouseReport(void);
|
||||
void SwitchActiveUsbMouseReport(void);
|
||||
usb_status_t usbMouseAction(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
uint32_t UsbSystemKeyboardActionCounter;
|
||||
static usb_system_keyboard_report_t usbSystemKeyboardReports[2];
|
||||
usb_system_keyboard_report_t* ActiveUsbSystemKeyboardReport = usbSystemKeyboardReports;
|
||||
volatile bool IsUsbSystemKeyboardReportSent = false;
|
||||
|
||||
static usb_system_keyboard_report_t* getInactiveUsbSystemKeyboardReport()
|
||||
{
|
||||
@@ -20,14 +19,12 @@ void ResetActiveUsbSystemKeyboardReport(void)
|
||||
bzero(ActiveUsbSystemKeyboardReport, USB_SYSTEM_KEYBOARD_REPORT_LENGTH);
|
||||
}
|
||||
|
||||
static usb_status_t UsbSystemKeyboardAction(void)
|
||||
usb_status_t UsbSystemKeyboardAction(void)
|
||||
{
|
||||
usb_status_t status = USB_DeviceHidSend(
|
||||
UsbCompositeDevice.systemKeyboardHandle, USB_SYSTEM_KEYBOARD_ENDPOINT_INDEX,
|
||||
(uint8_t*)getInactiveUsbSystemKeyboardReport(), USB_SYSTEM_KEYBOARD_REPORT_LENGTH);
|
||||
IsUsbSystemKeyboardReportSent = true;
|
||||
UsbSystemKeyboardActionCounter++;
|
||||
return status;
|
||||
return USB_DeviceHidSend(
|
||||
UsbCompositeDevice.systemKeyboardHandle, USB_SYSTEM_KEYBOARD_ENDPOINT_INDEX,
|
||||
(uint8_t*)getInactiveUsbSystemKeyboardReport(), USB_SYSTEM_KEYBOARD_REPORT_LENGTH);
|
||||
}
|
||||
|
||||
usb_status_t UsbSystemKeyboardCallback(class_handle_t handle, uint32_t event, void *param)
|
||||
@@ -36,10 +33,6 @@ usb_status_t UsbSystemKeyboardCallback(class_handle_t handle, uint32_t event, vo
|
||||
|
||||
switch (event) {
|
||||
case kUSB_DeviceHidEventSendResponse:
|
||||
if (UsbCompositeDevice.attach) {
|
||||
return UsbSystemKeyboardAction();
|
||||
}
|
||||
break;
|
||||
case kUSB_DeviceHidEventGetReport:
|
||||
case kUSB_DeviceHidEventSetReport:
|
||||
case kUSB_DeviceHidEventRequestReportBuffer:
|
||||
@@ -60,7 +53,7 @@ usb_status_t UsbSystemKeyboardCallback(class_handle_t handle, uint32_t event, vo
|
||||
usb_status_t UsbSystemKeyboardSetConfiguration(class_handle_t handle, uint8_t configuration)
|
||||
{
|
||||
if (USB_COMPOSITE_CONFIGURATION_INDEX == configuration) {
|
||||
return UsbSystemKeyboardAction();
|
||||
//return UsbSystemKeyboardAction();
|
||||
}
|
||||
return kStatus_USB_Error;
|
||||
}
|
||||
@@ -68,7 +61,7 @@ usb_status_t UsbSystemKeyboardSetConfiguration(class_handle_t handle, uint8_t co
|
||||
usb_status_t UsbSystemKeyboardSetInterface(class_handle_t handle, uint8_t interface, uint8_t alternateSetting)
|
||||
{
|
||||
if (USB_SYSTEM_KEYBOARD_INTERFACE_INDEX == interface) {
|
||||
return UsbSystemKeyboardAction();
|
||||
//return UsbSystemKeyboardAction();
|
||||
}
|
||||
return kStatus_USB_Error;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
|
||||
// Variables:
|
||||
|
||||
extern volatile bool IsUsbSystemKeyboardReportSent;
|
||||
extern uint32_t UsbSystemKeyboardActionCounter;
|
||||
extern usb_system_keyboard_report_t* ActiveUsbSystemKeyboardReport;
|
||||
|
||||
@@ -41,5 +40,6 @@
|
||||
|
||||
void ResetActiveUsbSystemKeyboardReport(void);
|
||||
void SwitchActiveUsbSystemKeyboardReport(void);
|
||||
usb_status_t UsbSystemKeyboardAction(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -191,23 +191,56 @@ static void processMouseActions()
|
||||
}
|
||||
|
||||
static layer_id_t previousLayer = LayerId_Base;
|
||||
|
||||
static void handleSwitchLayerAction(key_state_t *keyState, key_action_t *action)
|
||||
{
|
||||
static key_state_t *doubleTapSwitchLayerKey;
|
||||
static uint32_t doubleTapSwitchLayerStartTime;
|
||||
static uint32_t doubleTapSwitchLayerTriggerTime;
|
||||
static bool isLayerDoubleTapToggled;
|
||||
|
||||
if (doubleTapSwitchLayerKey && doubleTapSwitchLayerKey != keyState && !keyState->previous) {
|
||||
doubleTapSwitchLayerKey = NULL;
|
||||
}
|
||||
|
||||
if (!keyState->previous && isLayerDoubleTapToggled && ToggledLayer == action->switchLayer.layer) {
|
||||
ToggledLayer = LayerId_Base;
|
||||
isLayerDoubleTapToggled = false;
|
||||
}
|
||||
|
||||
if (action->type != KeyActionType_SwitchLayer) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (keyState->previous && doubleTapSwitchLayerKey == keyState &&
|
||||
Timer_GetElapsedTime(&doubleTapSwitchLayerTriggerTime) > DoubleTapSwitchLayerReleaseTimeout)
|
||||
{
|
||||
ToggledLayer = LayerId_Base;
|
||||
}
|
||||
|
||||
if (!keyState->previous && previousLayer == LayerId_Base && action->switchLayer.mode == SwitchLayerMode_HoldAndDoubleTapToggle) {
|
||||
if (doubleTapSwitchLayerKey && Timer_GetElapsedTimeAndSetCurrent(&doubleTapSwitchLayerStartTime) < DoubleTapSwitchLayerTimeout) {
|
||||
ToggledLayer = action->switchLayer.layer;
|
||||
isLayerDoubleTapToggled = true;
|
||||
doubleTapSwitchLayerTriggerTime = Timer_GetCurrentTime();
|
||||
} else {
|
||||
doubleTapSwitchLayerKey = keyState;
|
||||
}
|
||||
doubleTapSwitchLayerStartTime = Timer_GetCurrentTime();
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t basicScancodeIndex = 0;
|
||||
static uint8_t mediaScancodeIndex = 0;
|
||||
static uint8_t systemScancodeIndex = 0;
|
||||
|
||||
static void applyKeyAction(key_state_t *keyState, key_action_t *action)
|
||||
{
|
||||
static key_state_t *doubleTapSwitchLayerKey;
|
||||
static uint32_t doubleTapSwitchLayerStartTime;
|
||||
static uint32_t doubleTapSwitchLayerTriggerTime;
|
||||
|
||||
if (keyState->suppressed) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (doubleTapSwitchLayerKey && doubleTapSwitchLayerKey != keyState && !keyState->previous) {
|
||||
doubleTapSwitchLayerKey = NULL;
|
||||
}
|
||||
handleSwitchLayerAction(keyState, action);
|
||||
|
||||
switch (action->type) {
|
||||
case KeyActionType_Keystroke:
|
||||
@@ -238,21 +271,7 @@ static void applyKeyAction(key_state_t *keyState, key_action_t *action)
|
||||
activeMouseStates[action->mouseAction] = true;
|
||||
break;
|
||||
case KeyActionType_SwitchLayer:
|
||||
if (keyState->previous && doubleTapSwitchLayerKey == keyState &&
|
||||
Timer_GetElapsedTime(&doubleTapSwitchLayerTriggerTime) > DoubleTapSwitchLayerReleaseTimeout)
|
||||
{
|
||||
ToggledLayer = LayerId_Base;
|
||||
}
|
||||
|
||||
if (!keyState->previous && previousLayer == LayerId_Base && action->switchLayer.mode == SwitchLayerMode_HoldAndDoubleTapToggle) {
|
||||
if (doubleTapSwitchLayerKey && Timer_GetElapsedTimeAndSetCurrent(&doubleTapSwitchLayerStartTime) < DoubleTapSwitchLayerTimeout) {
|
||||
ToggledLayer = action->switchLayer.layer;
|
||||
doubleTapSwitchLayerTriggerTime = Timer_GetCurrentTime();
|
||||
} else {
|
||||
doubleTapSwitchLayerKey = keyState;
|
||||
}
|
||||
doubleTapSwitchLayerStartTime = Timer_GetCurrentTime();
|
||||
}
|
||||
// Handled by handleSwitchLayerAction()
|
||||
break;
|
||||
case KeyActionType_SwitchKeymap:
|
||||
if (!keyState->previous) {
|
||||
@@ -389,8 +408,6 @@ void UpdateUsbReports(void)
|
||||
return;
|
||||
}
|
||||
Timer_SetCurrentTime(&lastMouseUpdateTime);
|
||||
} else if (!IsUsbBasicKeyboardReportSent || !IsUsbMediaKeyboardReportSent || !IsUsbSystemKeyboardReportSent || !IsUsbMouseReportSent) {
|
||||
return;
|
||||
}
|
||||
|
||||
ResetActiveUsbBasicKeyboardReport();
|
||||
@@ -401,34 +418,42 @@ void UpdateUsbReports(void)
|
||||
updateActiveUsbReports();
|
||||
|
||||
static usb_basic_keyboard_report_t last_basic_report = { .scancodes[0] = 0xFF };
|
||||
bool HasUsbBasicKeyboardReportChanged = false;
|
||||
if (memcmp(ActiveUsbBasicKeyboardReport, &last_basic_report, sizeof(usb_basic_keyboard_report_t)) != 0) {
|
||||
last_basic_report = *ActiveUsbBasicKeyboardReport;
|
||||
SwitchActiveUsbBasicKeyboardReport();
|
||||
IsUsbBasicKeyboardReportSent = false;
|
||||
HasUsbBasicKeyboardReportChanged = true;
|
||||
UsbBasicKeyboardAction();
|
||||
}
|
||||
|
||||
static usb_media_keyboard_report_t last_media_report = { .scancodes[0] = 0xFF };
|
||||
bool HasUsbMediaKeyboardReportChanged = false;
|
||||
if (memcmp(ActiveUsbMediaKeyboardReport, &last_media_report, sizeof(usb_media_keyboard_report_t)) != 0) {
|
||||
last_media_report = *ActiveUsbMediaKeyboardReport;
|
||||
HasUsbMediaKeyboardReportChanged = true;
|
||||
SwitchActiveUsbMediaKeyboardReport();
|
||||
IsUsbMediaKeyboardReportSent = false;
|
||||
UsbMediaKeyboardAction();
|
||||
}
|
||||
|
||||
static usb_system_keyboard_report_t last_system_report = { .scancodes[0] = 0xFF };
|
||||
bool HasUsbSystemKeyboardReportChanged = false;
|
||||
if (memcmp(ActiveUsbSystemKeyboardReport, &last_system_report, sizeof(usb_system_keyboard_report_t)) != 0) {
|
||||
last_system_report = *ActiveUsbSystemKeyboardReport;
|
||||
HasUsbSystemKeyboardReportChanged = true;
|
||||
SwitchActiveUsbSystemKeyboardReport();
|
||||
IsUsbSystemKeyboardReportSent = false;
|
||||
UsbSystemKeyboardAction();
|
||||
}
|
||||
|
||||
static usb_mouse_report_t last_mouse_report = { .buttons = 0xFF };
|
||||
bool HasUsbMouseReportChanged = false;
|
||||
if (memcmp(ActiveUsbMouseReport, &last_mouse_report, sizeof(usb_mouse_report_t)) != 0) {
|
||||
last_mouse_report = *ActiveUsbMouseReport;
|
||||
HasUsbMouseReportChanged = true;
|
||||
SwitchActiveUsbMouseReport();
|
||||
IsUsbMouseReportSent = false;
|
||||
usbMouseAction();
|
||||
}
|
||||
|
||||
if ((previousLayer != LayerId_Base || !IsUsbBasicKeyboardReportSent || !IsUsbMediaKeyboardReportSent || !IsUsbSystemKeyboardReportSent || !IsUsbMouseReportSent) && IsHostSleeping) {
|
||||
if ((previousLayer != LayerId_Base || HasUsbBasicKeyboardReportChanged || HasUsbMediaKeyboardReportChanged || HasUsbSystemKeyboardReportChanged || HasUsbMouseReportChanged) && IsHostSleeping) {
|
||||
WakeUpHost(true); // Wake up the host if any key is pressed and the computer is sleeping.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
"commander": "^2.11.0",
|
||||
"shelljs": "^0.7.8"
|
||||
},
|
||||
"firmwareVersion": "8.2.5",
|
||||
"firmwareVersion": "8.3.1",
|
||||
"deviceProtocolVersion": "4.3.1",
|
||||
"moduleProtocolVersion": "4.0.0",
|
||||
"userConfigVersion": "4.0.1",
|
||||
"userConfigVersion": "4.1.0",
|
||||
"hardwareConfigVersion": "1.0.0",
|
||||
"devices": [
|
||||
{
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
// Variables:
|
||||
|
||||
#define FIRMWARE_MAJOR_VERSION 8
|
||||
#define FIRMWARE_MINOR_VERSION 2
|
||||
#define FIRMWARE_PATCH_VERSION 5
|
||||
#define FIRMWARE_MINOR_VERSION 3
|
||||
#define FIRMWARE_PATCH_VERSION 1
|
||||
|
||||
#define DEVICE_PROTOCOL_MAJOR_VERSION 4
|
||||
#define DEVICE_PROTOCOL_MINOR_VERSION 3
|
||||
@@ -31,8 +31,8 @@
|
||||
#define MODULE_PROTOCOL_PATCH_VERSION 0
|
||||
|
||||
#define USER_CONFIG_MAJOR_VERSION 4
|
||||
#define USER_CONFIG_MINOR_VERSION 0
|
||||
#define USER_CONFIG_PATCH_VERSION 1
|
||||
#define USER_CONFIG_MINOR_VERSION 1
|
||||
#define USER_CONFIG_PATCH_VERSION 0
|
||||
|
||||
#define HARDWARE_CONFIG_MAJOR_VERSION 1
|
||||
#define HARDWARE_CONFIG_MINOR_VERSION 0
|
||||
|
||||
Reference in New Issue
Block a user