Compare commits
1 Commits
v8.5.4
...
semaphore-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aeaef7b788 |
@@ -1,6 +1,5 @@
|
|||||||
#include "led_display.h"
|
#include "led_display.h"
|
||||||
#include "usb_composite_device.h"
|
#include "usb_composite_device.h"
|
||||||
#include "usb_report_updater.h"
|
|
||||||
|
|
||||||
static usb_basic_keyboard_report_t usbBasicKeyboardReports[2];
|
static usb_basic_keyboard_report_t usbBasicKeyboardReports[2];
|
||||||
uint32_t UsbBasicKeyboardActionCounter;
|
uint32_t UsbBasicKeyboardActionCounter;
|
||||||
@@ -45,7 +44,6 @@ usb_status_t UsbBasicKeyboardCallback(class_handle_t handle, uint32_t event, voi
|
|||||||
switch (event) {
|
switch (event) {
|
||||||
// This event is received when the report has been sent
|
// This event is received when the report has been sent
|
||||||
case kUSB_DeviceHidEventSendResponse:
|
case kUSB_DeviceHidEventSendResponse:
|
||||||
UsbReportUpdateSemaphore &= ~(1 << USB_BASIC_KEYBOARD_INTERFACE_INDEX);
|
|
||||||
if (UsbCompositeDevice.attach) {
|
if (UsbCompositeDevice.attach) {
|
||||||
error = kStatus_USB_Success;
|
error = kStatus_USB_Success;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#include "usb_composite_device.h"
|
#include "usb_composite_device.h"
|
||||||
#include "usb_report_updater.h"
|
|
||||||
|
|
||||||
uint32_t UsbMediaKeyboardActionCounter;
|
uint32_t UsbMediaKeyboardActionCounter;
|
||||||
static usb_media_keyboard_report_t usbMediaKeyboardReports[2];
|
static usb_media_keyboard_report_t usbMediaKeyboardReports[2];
|
||||||
@@ -43,7 +42,6 @@ usb_status_t UsbMediaKeyboardCallback(class_handle_t handle, uint32_t event, voi
|
|||||||
switch (event) {
|
switch (event) {
|
||||||
// This event is received when the report has been sent
|
// This event is received when the report has been sent
|
||||||
case kUSB_DeviceHidEventSendResponse:
|
case kUSB_DeviceHidEventSendResponse:
|
||||||
UsbReportUpdateSemaphore &= ~(1 << USB_MEDIA_KEYBOARD_INTERFACE_INDEX);
|
|
||||||
if (UsbCompositeDevice.attach) {
|
if (UsbCompositeDevice.attach) {
|
||||||
error = kStatus_USB_Success;
|
error = kStatus_USB_Success;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#include "usb_composite_device.h"
|
#include "usb_composite_device.h"
|
||||||
#include "usb_report_updater.h"
|
|
||||||
|
|
||||||
uint32_t UsbMouseActionCounter;
|
uint32_t UsbMouseActionCounter;
|
||||||
static usb_mouse_report_t usbMouseReports[2];
|
static usb_mouse_report_t usbMouseReports[2];
|
||||||
@@ -43,7 +42,6 @@ usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param
|
|||||||
switch (event) {
|
switch (event) {
|
||||||
// This event is received when the report has been sent
|
// This event is received when the report has been sent
|
||||||
case kUSB_DeviceHidEventSendResponse:
|
case kUSB_DeviceHidEventSendResponse:
|
||||||
UsbReportUpdateSemaphore &= ~(1 << USB_MOUSE_INTERFACE_INDEX);
|
|
||||||
if (UsbCompositeDevice.attach) {
|
if (UsbCompositeDevice.attach) {
|
||||||
error = kStatus_USB_Success;
|
error = kStatus_USB_Success;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#include "usb_composite_device.h"
|
#include "usb_composite_device.h"
|
||||||
#include "usb_report_updater.h"
|
|
||||||
|
|
||||||
uint32_t UsbSystemKeyboardActionCounter;
|
uint32_t UsbSystemKeyboardActionCounter;
|
||||||
static usb_system_keyboard_report_t usbSystemKeyboardReports[2];
|
static usb_system_keyboard_report_t usbSystemKeyboardReports[2];
|
||||||
@@ -43,7 +42,6 @@ usb_status_t UsbSystemKeyboardCallback(class_handle_t handle, uint32_t event, vo
|
|||||||
switch (event) {
|
switch (event) {
|
||||||
// This event is received when the report has been sent
|
// This event is received when the report has been sent
|
||||||
case kUSB_DeviceHidEventSendResponse:
|
case kUSB_DeviceHidEventSendResponse:
|
||||||
UsbReportUpdateSemaphore &= ~(1 << USB_SYSTEM_KEYBOARD_INTERFACE_INDEX);
|
|
||||||
if (UsbCompositeDevice.attach) {
|
if (UsbCompositeDevice.attach) {
|
||||||
error = kStatus_USB_Success;
|
error = kStatus_USB_Success;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ static uint16_t DoubleTapSwitchLayerReleaseTimeout = 200;
|
|||||||
static bool activeMouseStates[ACTIVE_MOUSE_STATES_COUNT];
|
static bool activeMouseStates[ACTIVE_MOUSE_STATES_COUNT];
|
||||||
bool TestUsbStack = false;
|
bool TestUsbStack = false;
|
||||||
|
|
||||||
volatile uint8_t UsbReportUpdateSemaphore = 0;
|
|
||||||
|
|
||||||
mouse_kinetic_state_t MouseMoveState = {
|
mouse_kinetic_state_t MouseMoveState = {
|
||||||
.isScroll = false,
|
.isScroll = false,
|
||||||
.upState = SerializedMouseAction_MoveUp,
|
.upState = SerializedMouseAction_MoveUp,
|
||||||
@@ -437,10 +435,6 @@ void UpdateUsbReports(void)
|
|||||||
KeyStates[SlotId_RightKeyboardHalf][keyId].current = RightKeyMatrix.keyStates[keyId];
|
KeyStates[SlotId_RightKeyboardHalf][keyId].current = RightKeyMatrix.keyStates[keyId];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UsbReportUpdateSemaphore && !SleepModeActive) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
UsbReportUpdateCounter++;
|
UsbReportUpdateCounter++;
|
||||||
|
|
||||||
ResetActiveUsbBasicKeyboardReport();
|
ResetActiveUsbBasicKeyboardReport();
|
||||||
@@ -456,32 +450,20 @@ void UpdateUsbReports(void)
|
|||||||
bool HasUsbMouseReportChanged = memcmp(ActiveUsbMouseReport, GetInactiveUsbMouseReport(), sizeof(usb_mouse_report_t)) != 0;
|
bool HasUsbMouseReportChanged = memcmp(ActiveUsbMouseReport, GetInactiveUsbMouseReport(), sizeof(usb_mouse_report_t)) != 0;
|
||||||
|
|
||||||
if (HasUsbBasicKeyboardReportChanged) {
|
if (HasUsbBasicKeyboardReportChanged) {
|
||||||
usb_status_t status = UsbBasicKeyboardAction();
|
UsbBasicKeyboardAction();
|
||||||
if (status == kStatus_USB_Success) {
|
|
||||||
UsbReportUpdateSemaphore |= 1 << USB_BASIC_KEYBOARD_INTERFACE_INDEX;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasUsbMediaKeyboardReportChanged) {
|
if (HasUsbMediaKeyboardReportChanged) {
|
||||||
usb_status_t status = UsbMediaKeyboardAction();
|
UsbMediaKeyboardAction();
|
||||||
if (status == kStatus_USB_Success) {
|
|
||||||
UsbReportUpdateSemaphore |= 1 << USB_MEDIA_KEYBOARD_INTERFACE_INDEX;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasUsbSystemKeyboardReportChanged) {
|
if (HasUsbSystemKeyboardReportChanged) {
|
||||||
usb_status_t status = UsbSystemKeyboardAction();
|
UsbSystemKeyboardAction();
|
||||||
if (status == kStatus_USB_Success) {
|
|
||||||
UsbReportUpdateSemaphore |= 1 << USB_SYSTEM_KEYBOARD_INTERFACE_INDEX;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send out the mouse position and wheel values continuously if the report is not zeros, but only send the mouse button states when they change.
|
// Send out the mouse position and wheel values continuously if the report is not zeros, but only send the mouse button states when they change.
|
||||||
if (HasUsbMouseReportChanged || ActiveUsbMouseReport->x || ActiveUsbMouseReport->y ||
|
if (HasUsbMouseReportChanged || ActiveUsbMouseReport->x || ActiveUsbMouseReport->y ||
|
||||||
ActiveUsbMouseReport->wheelX || ActiveUsbMouseReport->wheelY) {
|
ActiveUsbMouseReport->wheelX || ActiveUsbMouseReport->wheelY) {
|
||||||
usb_status_t status = UsbMouseAction();
|
UsbMouseAction();
|
||||||
if (status == kStatus_USB_Success) {
|
|
||||||
UsbReportUpdateSemaphore |= 1 << USB_MOUSE_INTERFACE_INDEX;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,6 @@
|
|||||||
extern mouse_kinetic_state_t MouseMoveState;
|
extern mouse_kinetic_state_t MouseMoveState;
|
||||||
extern mouse_kinetic_state_t MouseScrollState;
|
extern mouse_kinetic_state_t MouseScrollState;
|
||||||
extern uint32_t UsbReportUpdateCounter;
|
extern uint32_t UsbReportUpdateCounter;
|
||||||
extern volatile uint8_t UsbReportUpdateSemaphore;
|
|
||||||
extern bool TestUsbStack;
|
extern bool TestUsbStack;
|
||||||
|
|
||||||
// Functions:
|
// Functions:
|
||||||
|
|||||||
Reference in New Issue
Block a user