8 Commits

Author SHA1 Message Date
László Monda
d21fe30139 Bump firmware version to 8.3.2. Update changelog, package.json and versions.h 2018-06-27 14:26:29 +02:00
László Monda
224d9eae42 Merge pull request #130 from UltimateHackingKeyboard/key-release-debouncing
Fix key chattering
2018-06-27 14:13:05 +02:00
Eric Tang
cdfabaec42 Make the debounce counters count down 2018-06-26 21:58:48 -07:00
Eric Tang
ff99c2e734 Change KEY_DEBOUNCER_TIMEOUT_MSEC to match keyswitch datasheets 2018-06-26 18:27:01 -07:00
Eric Tang
6d356114a8 Debounce key releases 2018-06-26 18:24:30 -07:00
Eric Tang
3041132959 Merge pull request #129 from UltimateHackingKeyboard/revert-120-dev
Revert "The UHK now only sends out data when it changes"
2018-06-26 18:13:36 -07:00
Eric Tang
2877773cac Revert "The UHK now only sends out data when it changes" 2018-06-26 17:59:57 -07:00
László Monda
b1cbeefa28 Add base layer key mappings for the left and right modules for testing purposes. 2018-06-13 02:41:01 +02:00
15 changed files with 173 additions and 59 deletions

View File

@@ -5,6 +5,14 @@ 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.2] - 2018-06-27
Device Protocol: 4.3.1 | Module Protocol: 4.0.0 | User Config: 4.1.0 | Hardware Config: 1.0.0
- Make the debouncer debounce not only on key presses but also on key releases, and change the debounce interval from 100ms to the suggested 5ms of MX switches.
- Revert the Windows related commits of firmware 8.3.1 because they introduced a nondeterministic bug that made USB hang.
- Add base layer key mappings for the left and right add-ons for testing purposes.
## [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

View File

@@ -11,8 +11,8 @@ void PIT_KEY_DEBOUNCER_HANDLER(void)
for (uint8_t slotId=0; slotId<SLOT_COUNT; slotId++) {
for (uint8_t keyId=0; keyId<MAX_KEY_COUNT_PER_MODULE; keyId++) {
uint8_t *debounceCounter = &KeyStates[slotId][keyId].debounceCounter;
if (*debounceCounter < 0xff) {
(*debounceCounter)++;
if (*debounceCounter) {
--(*debounceCounter);
}
}
}

View File

@@ -9,7 +9,7 @@
// Macros:
#define KEY_DEBOUNCER_INTERVAL_MSEC 1
#define KEY_DEBOUNCER_TIMEOUT_MSEC 100
#define KEY_DEBOUNCER_TIMEOUT_MSEC 5
// Functions:

View File

@@ -128,6 +128,102 @@ key_action_t CurrentKeymap[LAYER_COUNT][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] =
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_V }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_B }},
// Row 5
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_CONTROL }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_GUI }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_ALT }},
{ .type = KeyActionType_SwitchLayer, .switchLayer = { .layer = LayerId_Fn }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_SPACE }},
{ .type = KeyActionType_SwitchLayer, .switchLayer = { .layer = LayerId_Mod }},
{ .type = KeyActionType_None },
},
// Left module
{
// Row 1
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_GRAVE_ACCENT_AND_TILDE }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_1_AND_EXCLAMATION }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_2_AND_AT }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_3_AND_HASHMARK }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_4_AND_DOLLAR }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_5_AND_PERCENTAGE }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_6_AND_CARET }},
// Row 2
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_TAB }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_Q }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_W }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_E }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_R }},
{ .type = KeyActionType_None },
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_T }},
// Row 3
{ .type = KeyActionType_SwitchLayer, .switchLayer = { .layer = LayerId_Mouse }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_A }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_S }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_D }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_F }},
{ .type = KeyActionType_None },
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_G }},
// Row 4
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_SHIFT }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_NON_US_BACKSLASH_AND_PIPE }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_Z }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_X }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_C }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_V }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_B }},
// Row 5
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_CONTROL }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_GUI }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_ALT }},
{ .type = KeyActionType_SwitchLayer, .switchLayer = { .layer = LayerId_Fn }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_SPACE }},
{ .type = KeyActionType_SwitchLayer, .switchLayer = { .layer = LayerId_Mod }},
{ .type = KeyActionType_None },
},
// Right module
{
// Row 1
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_GRAVE_ACCENT_AND_TILDE }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_1_AND_EXCLAMATION }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_2_AND_AT }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_3_AND_HASHMARK }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_4_AND_DOLLAR }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_5_AND_PERCENTAGE }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_6_AND_CARET }},
// Row 2
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_TAB }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_Q }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_W }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_E }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_R }},
{ .type = KeyActionType_None },
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_T }},
// Row 3
{ .type = KeyActionType_SwitchLayer, .switchLayer = { .layer = LayerId_Mouse }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_A }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_S }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_D }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_F }},
{ .type = KeyActionType_None },
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_G }},
// Row 4
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_SHIFT }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_NON_US_BACKSLASH_AND_PIPE }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_Z }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_X }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_C }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_V }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_B }},
// Row 5
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_CONTROL }},
{ .type = KeyActionType_Keystroke, .keystroke = { .scancode = HID_KEYBOARD_SC_LEFT_GUI }},

View File

@@ -4,6 +4,7 @@
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)
@@ -21,12 +22,14 @@ void ResetActiveUsbBasicKeyboardReport(void)
bzero(ActiveUsbBasicKeyboardReport, USB_BASIC_KEYBOARD_REPORT_LENGTH);
}
usb_status_t UsbBasicKeyboardAction(void)
static 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 USB_DeviceHidSend(
UsbCompositeDevice.basicKeyboardHandle, USB_BASIC_KEYBOARD_ENDPOINT_INDEX,
(uint8_t*)getInactiveUsbBasicKeyboardReport(), USB_BASIC_KEYBOARD_REPORT_LENGTH);
return status;
}
usb_status_t UsbBasicKeyboardCallback(class_handle_t handle, uint32_t event, void *param)
@@ -35,6 +38,10 @@ 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;
@@ -73,7 +80,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;
}
@@ -81,7 +88,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;
}

View File

@@ -31,6 +31,7 @@
// Variables:
extern volatile bool IsUsbBasicKeyboardReportSent;
extern uint32_t UsbBasicKeyboardActionCounter;
extern usb_basic_keyboard_report_t* ActiveUsbBasicKeyboardReport;
@@ -42,6 +43,5 @@
void ResetActiveUsbBasicKeyboardReport(void);
void SwitchActiveUsbBasicKeyboardReport(void);
usb_status_t UsbBasicKeyboardAction(void);
#endif

View File

@@ -3,6 +3,7 @@
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)
{
@@ -19,12 +20,14 @@ void ResetActiveUsbMediaKeyboardReport(void)
bzero(ActiveUsbMediaKeyboardReport, USB_MEDIA_KEYBOARD_REPORT_LENGTH);
}
usb_status_t UsbMediaKeyboardAction()
static usb_status_t UsbMediaKeyboardAction(void)
{
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 USB_DeviceHidSend(
UsbCompositeDevice.mediaKeyboardHandle, USB_MEDIA_KEYBOARD_ENDPOINT_INDEX,
(uint8_t*)getInactiveUsbMediaKeyboardReport(), USB_MEDIA_KEYBOARD_REPORT_LENGTH);
return status;
}
usb_status_t UsbMediaKeyboardCallback(class_handle_t handle, uint32_t event, void *param)
@@ -33,6 +36,10 @@ 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:
@@ -53,7 +60,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;
}
@@ -61,7 +68,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;
}

View File

@@ -28,6 +28,7 @@
// Variables:
extern volatile bool IsUsbMediaKeyboardReportSent;
extern uint32_t UsbMediaKeyboardActionCounter;
extern usb_media_keyboard_report_t* ActiveUsbMediaKeyboardReport;
@@ -39,6 +40,5 @@
void ResetActiveUsbMediaKeyboardReport(void);
void SwitchActiveUsbMediaKeyboardReport(void);
usb_status_t UsbMediaKeyboardAction();
#endif

View File

@@ -3,6 +3,7 @@
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)
{
@@ -19,31 +20,25 @@ void ResetActiveUsbMouseReport(void)
bzero(ActiveUsbMouseReport, USB_MOUSE_REPORT_LENGTH);
}
usb_status_t usbMouseAction(void)
static volatile usb_status_t usbMouseAction(void)
{
UsbMouseActionCounter++;
return USB_DeviceHidSend(
UsbCompositeDevice.mouseHandle, USB_MOUSE_ENDPOINT_INDEX,
(uint8_t*)getInactiveUsbMouseReport(), USB_MOUSE_REPORT_LENGTH);
usb_mouse_report_t *mouseReport = getInactiveUsbMouseReport();
IsUsbMouseReportSent = true;
return USB_DeviceHidSend(UsbCompositeDevice.mouseHandle, USB_MOUSE_ENDPOINT_INDEX,
(uint8_t*)mouseReport, USB_MOUSE_REPORT_LENGTH);
}
usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param)
{
static bool usbMouseActionActive = false;
UsbMouseActionCounter++;
usb_status_t error = kStatus_USB_Error;
switch (event) {
case kUSB_DeviceHidEventSendResponse:
if (UsbCompositeDevice.attach) {
// 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();
}
return usbMouseAction();
}
break;
case kUSB_DeviceHidEventGetReport:
case kUSB_DeviceHidEventSetReport:
case kUSB_DeviceHidEventRequestReportBuffer:
@@ -64,7 +59,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;
}
@@ -72,7 +67,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;
}

View File

@@ -31,6 +31,7 @@
// Variables:
extern volatile bool IsUsbMouseReportSent;
extern uint32_t UsbMouseActionCounter;
extern usb_mouse_report_t* ActiveUsbMouseReport;
@@ -42,6 +43,5 @@
void ResetActiveUsbMouseReport(void);
void SwitchActiveUsbMouseReport(void);
usb_status_t usbMouseAction(void);
#endif

View File

@@ -3,6 +3,7 @@
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()
{
@@ -19,12 +20,14 @@ void ResetActiveUsbSystemKeyboardReport(void)
bzero(ActiveUsbSystemKeyboardReport, USB_SYSTEM_KEYBOARD_REPORT_LENGTH);
}
usb_status_t UsbSystemKeyboardAction(void)
static 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 USB_DeviceHidSend(
UsbCompositeDevice.systemKeyboardHandle, USB_SYSTEM_KEYBOARD_ENDPOINT_INDEX,
(uint8_t*)getInactiveUsbSystemKeyboardReport(), USB_SYSTEM_KEYBOARD_REPORT_LENGTH);
return status;
}
usb_status_t UsbSystemKeyboardCallback(class_handle_t handle, uint32_t event, void *param)
@@ -33,6 +36,10 @@ 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:
@@ -53,7 +60,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;
}
@@ -61,7 +68,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;
}

View File

@@ -29,6 +29,7 @@
// Variables:
extern volatile bool IsUsbSystemKeyboardReportSent;
extern uint32_t UsbSystemKeyboardActionCounter;
extern usb_system_keyboard_report_t* ActiveUsbSystemKeyboardReport;
@@ -40,6 +41,5 @@
void ResetActiveUsbSystemKeyboardReport(void);
void SwitchActiveUsbSystemKeyboardReport(void);
usb_status_t UsbSystemKeyboardAction(void);
#endif

View File

@@ -324,10 +324,10 @@ static void updateActiveUsbReports(void)
key_state_t *keyState = &KeyStates[slotId][keyId];
key_action_t *action = &CurrentKeymap[activeLayer][slotId][keyId];
if (keyState->debounceCounter < KEY_DEBOUNCER_TIMEOUT_MSEC) {
if (keyState->debounceCounter) {
keyState->current = keyState->previous;
} else if (!keyState->previous && keyState->current) {
keyState->debounceCounter = 0;
} else if (keyState->previous != keyState->current) {
keyState->debounceCounter = KEY_DEBOUNCER_TIMEOUT_MSEC + 1;
}
if (keyState->current) {
@@ -408,6 +408,8 @@ void UpdateUsbReports(void)
return;
}
Timer_SetCurrentTime(&lastMouseUpdateTime);
} else if (!IsUsbBasicKeyboardReportSent || !IsUsbMediaKeyboardReportSent || !IsUsbSystemKeyboardReportSent || !IsUsbMouseReportSent) {
return;
}
ResetActiveUsbBasicKeyboardReport();
@@ -418,42 +420,34 @@ 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();
HasUsbBasicKeyboardReportChanged = true;
UsbBasicKeyboardAction();
IsUsbBasicKeyboardReportSent = false;
}
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();
UsbMediaKeyboardAction();
IsUsbMediaKeyboardReportSent = false;
}
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();
UsbSystemKeyboardAction();
IsUsbSystemKeyboardReportSent = false;
}
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();
usbMouseAction();
IsUsbMouseReportSent = false;
}
if ((previousLayer != LayerId_Base || HasUsbBasicKeyboardReportChanged || HasUsbMediaKeyboardReportChanged || HasUsbSystemKeyboardReportChanged || HasUsbMouseReportChanged) && IsHostSleeping) {
if ((previousLayer != LayerId_Base || !IsUsbBasicKeyboardReportSent || !IsUsbMediaKeyboardReportSent || !IsUsbSystemKeyboardReportSent || !IsUsbMouseReportSent) && IsHostSleeping) {
WakeUpHost(true); // Wake up the host if any key is pressed and the computer is sleeping.
}
}

View File

@@ -15,7 +15,7 @@
"commander": "^2.11.0",
"shelljs": "^0.7.8"
},
"firmwareVersion": "8.3.1",
"firmwareVersion": "8.3.2",
"deviceProtocolVersion": "4.3.1",
"moduleProtocolVersion": "4.0.0",
"userConfigVersion": "4.1.0",

View File

@@ -20,7 +20,7 @@
#define FIRMWARE_MAJOR_VERSION 8
#define FIRMWARE_MINOR_VERSION 3
#define FIRMWARE_PATCH_VERSION 1
#define FIRMWARE_PATCH_VERSION 2
#define DEVICE_PROTOCOL_MAJOR_VERSION 4
#define DEVICE_PROTOCOL_MINOR_VERSION 3