This commit is contained in:
刘可亮
2024-06-04 19:00:30 +08:00
parent 990c72f5be
commit 0a13af6a1d
1668 changed files with 342810 additions and 37726 deletions

View File

@@ -1,3 +1,9 @@
/*
* Copyright (c) 2022, sakumisu
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "usbd_core.h"
#include "usbd_hid.h"
@@ -204,9 +210,15 @@ void usbd_event_handler(uint8_t event)
/*!< hid state ! Data can be sent only when state is idle */
static volatile uint8_t hid_state = HID_STATE_IDLE;
USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t write_buffer[64];
void usbd_hid_int_callback(uint8_t ep, uint32_t nbytes)
{
if (hid_state == HID_STATE_BUSY) {
memset(write_buffer, 0, 8);
usbd_ep_start_write(HID_INT_EP, write_buffer, 8);
}
hid_state = HID_STATE_IDLE;
}
@@ -226,8 +238,6 @@ void hid_keyboard_init(void)
usbd_initialize();
}
USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t write_buffer[64];
void hid_keyboard_test(void)
{
const uint8_t sendbuffer[8] = { 0x00, 0x00, HID_KBD_USAGE_A, 0x00, 0x00, 0x00, 0x00, 0x00 };