mirror of
https://github.com/ArteryTek/AT32F413_Firmware_Library.git
synced 2026-05-21 09:22:02 +00:00
upload version v2.0.0
This commit is contained in:
509
middlewares/usbd_class/keyboard/keyboard_class.c
Normal file
509
middlewares/usbd_class/keyboard/keyboard_class.c
Normal file
@@ -0,0 +1,509 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file keyboard_class.c
|
||||
* @version v2.0.0
|
||||
* @date 2021-11-26
|
||||
* @brief usb hid keyboard class type
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
* Artery authorizes customers to use, copy, and distribute the BSP
|
||||
* software and its related documentation for the purpose of design and
|
||||
* development in conjunction with Artery microcontrollers. Use of the
|
||||
* software is governed by this copyright notice and the following disclaimer.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
|
||||
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
|
||||
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
|
||||
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
|
||||
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
#include "usbd_core.h"
|
||||
#include "keyboard_class.h"
|
||||
#include "keyboard_desc.h"
|
||||
|
||||
/** @addtogroup AT32F413_middlewares_usbd_class
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup USB_keyboard_class
|
||||
* @brief usb device keyboard demo
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup USB_keyboard_class_private_functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
usb_sts_type class_init_handler(void *udev);
|
||||
usb_sts_type class_clear_handler(void *udev);
|
||||
usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup);
|
||||
usb_sts_type class_ept0_tx_handler(void *udev);
|
||||
usb_sts_type class_ept0_rx_handler(void *udev);
|
||||
usb_sts_type class_in_handler(void *udev, uint8_t ept_num);
|
||||
usb_sts_type class_out_handler(void *udev, uint8_t ept_num);
|
||||
usb_sts_type class_sof_handler(void *udev);
|
||||
usb_sts_type class_event_handler(void *udev, usbd_event_type event);
|
||||
|
||||
/* hid static variable */
|
||||
static uint32_t hid_protocol = 0;
|
||||
static uint32_t hid_set_idle = 0;
|
||||
static uint32_t alt_setting = 0;
|
||||
static uint8_t hid_state;
|
||||
uint8_t hid_suspend_flag = 0;
|
||||
uint8_t hid_set_report[64];
|
||||
uint8_t g_u8tx_completed = 0;
|
||||
|
||||
#define SHIFT 0x80
|
||||
const unsigned char _asciimap[128] =
|
||||
{
|
||||
0x00,// NUL
|
||||
0x00,// SOH
|
||||
0x00,// STX
|
||||
0x00,// ETX
|
||||
0x00,// EOT
|
||||
0x00,// ENQ
|
||||
0x00,// ACK
|
||||
0x00,// BEL
|
||||
0x2A,// BS Backspace
|
||||
0x2B,// TAB Tab
|
||||
0x28,// LF Enter
|
||||
0x00,// VT
|
||||
0x00,// FF
|
||||
0x00,// CR
|
||||
0x00,// SO
|
||||
0x00,// SI
|
||||
0x00,// DEL
|
||||
0x00,// DC1
|
||||
0x00,// DC2
|
||||
0x00,// DC3
|
||||
0x00,// DC4
|
||||
0x00,// NAK
|
||||
0x00,// SYN
|
||||
0x00,// ETB
|
||||
0x00,// CAN
|
||||
0x00,// EM
|
||||
0x00,// SUB
|
||||
0x00,// ESC
|
||||
0x00,// FS
|
||||
0x00,// GS
|
||||
0x00,// RS
|
||||
0x00,// US
|
||||
|
||||
0x2C,// ' '
|
||||
0x1E|SHIFT,// !
|
||||
0x34|SHIFT,// "
|
||||
0x20|SHIFT,// #
|
||||
0x21|SHIFT,// $
|
||||
0x22|SHIFT,// %
|
||||
0x24|SHIFT,// &
|
||||
0x34, // '
|
||||
0x26|SHIFT,// (
|
||||
0x27|SHIFT,// )
|
||||
0x25|SHIFT,// *
|
||||
0x2E|SHIFT,// +
|
||||
0x36,// ,
|
||||
0x2D,// -
|
||||
0x37,// .
|
||||
0x38,// /
|
||||
0x27,// 0
|
||||
0x1E,// 1
|
||||
0x1F,// 2
|
||||
0x20,// 3
|
||||
0x21,// 4
|
||||
0x22,// 5
|
||||
0x23,// 6
|
||||
0x24,// 7
|
||||
0x25,// 8
|
||||
0x26,// 9
|
||||
0x33|SHIFT,// :
|
||||
0x33, // ;
|
||||
0x36|SHIFT,// <
|
||||
0x2E, // =
|
||||
0x37|SHIFT,// >
|
||||
0x38|SHIFT,// ?
|
||||
0x1F|SHIFT,// @
|
||||
0x04|SHIFT,// A
|
||||
0x05|SHIFT,// B
|
||||
0x06|SHIFT,// C
|
||||
0x07|SHIFT,// D
|
||||
0x08|SHIFT,// E
|
||||
0x09|SHIFT,// F
|
||||
0x0A|SHIFT,// G
|
||||
0x0B|SHIFT,// H
|
||||
0x0C|SHIFT,// I
|
||||
0x0D|SHIFT,// J
|
||||
0x0E|SHIFT,// K
|
||||
0x0F|SHIFT,// L
|
||||
0x10|SHIFT,// M
|
||||
0x11|SHIFT,// N
|
||||
0x12|SHIFT,// O
|
||||
0x13|SHIFT,// P
|
||||
0x14|SHIFT,// Q
|
||||
0x15|SHIFT,// R
|
||||
0x16|SHIFT,// S
|
||||
0x17|SHIFT,// T
|
||||
0x18|SHIFT,// U
|
||||
0x19|SHIFT,// V
|
||||
0x1A|SHIFT,// W
|
||||
0x1B|SHIFT,// X
|
||||
0x1C|SHIFT,// Y
|
||||
0x1D|SHIFT,// Z
|
||||
0x2F, // [
|
||||
0x31, // bslash
|
||||
0x30, // ]
|
||||
0x23|SHIFT,// ^
|
||||
0x2D|SHIFT,// _
|
||||
0x35, // `
|
||||
0x04, // a
|
||||
0x05, // b
|
||||
0x06, // c
|
||||
0x07, // d
|
||||
0x08, // e
|
||||
0x09, // f
|
||||
0x0A, // g
|
||||
0x0B, // h
|
||||
0x0C, // i
|
||||
0x0D, // j
|
||||
0x0E, // k
|
||||
0x0F, // l
|
||||
0x10, // m
|
||||
0x11, // n
|
||||
0x12, // o
|
||||
0x13, // p
|
||||
0x14, // q
|
||||
0x15, // r
|
||||
0x16, // s
|
||||
0x17, // t
|
||||
0x18, // u
|
||||
0x19, // v
|
||||
0x1A, // w
|
||||
0x1B, // x
|
||||
0x1C, // y
|
||||
0x1D, // z
|
||||
0x2f|SHIFT,//
|
||||
0x31|SHIFT,// |
|
||||
0x30|SHIFT,// }
|
||||
0x35|SHIFT,// ~
|
||||
0 // DEL
|
||||
};
|
||||
|
||||
/* usb device class handler */
|
||||
usbd_class_handler keyboard_class_handler =
|
||||
{
|
||||
class_init_handler,
|
||||
class_clear_handler,
|
||||
class_setup_handler,
|
||||
class_ept0_tx_handler,
|
||||
class_ept0_rx_handler,
|
||||
class_in_handler,
|
||||
class_out_handler,
|
||||
class_sof_handler,
|
||||
class_event_handler,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief initialize usb endpoint
|
||||
* @param udev: to the structure of usbd_core_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type class_init_handler(void *udev)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
|
||||
#ifndef USB_EPT_AUTO_MALLOC_BUFFER
|
||||
/* use user define buffer address */
|
||||
usbd_ept_buf_custom_define(pudev, USBD_HID_IN_EPT, EPT1_TX_ADDR);
|
||||
#endif
|
||||
|
||||
/* open hid in endpoint */
|
||||
usbd_ept_open(pudev, USBD_HID_IN_EPT, EPT_INT_TYPE, USBD_IN_MAXPACKET_SIZE);
|
||||
|
||||
g_u8tx_completed = 1;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief clear endpoint or other state
|
||||
* @param udev: to the structure of usbd_core_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type class_clear_handler(void *udev)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
|
||||
/* close hid in endpoint */
|
||||
usbd_ept_close(pudev, USBD_HID_IN_EPT);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usb device class setup request handler
|
||||
* @param udev: to the structure of usbd_core_type
|
||||
* @param setup: setup packet
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
uint16_t len;
|
||||
uint8_t *buf;
|
||||
|
||||
switch(setup->bmRequestType & USB_REQ_TYPE_RESERVED)
|
||||
{
|
||||
/* class request */
|
||||
case USB_REQ_TYPE_CLASS:
|
||||
switch(setup->bRequest)
|
||||
{
|
||||
case HID_REQ_SET_PROTOCOL:
|
||||
hid_protocol = (uint8_t)setup->wValue;
|
||||
break;
|
||||
case HID_REQ_GET_PROTOCOL:
|
||||
usbd_ctrl_send(pudev, (uint8_t *)&hid_protocol, 1);
|
||||
break;
|
||||
case HID_REQ_SET_IDLE:
|
||||
hid_set_idle = (uint8_t)(setup->wValue >> 8);
|
||||
break;
|
||||
case HID_REQ_GET_IDLE:
|
||||
usbd_ctrl_send(pudev, (uint8_t *)&hid_set_idle, 1);
|
||||
break;
|
||||
case HID_REQ_SET_REPORT:
|
||||
hid_state = HID_REQ_SET_REPORT;
|
||||
usbd_ctrl_recv(pudev, hid_set_report, setup->wLength);
|
||||
break;
|
||||
default:
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
/* standard request */
|
||||
case USB_REQ_TYPE_STANDARD:
|
||||
switch(setup->bRequest)
|
||||
{
|
||||
case USB_STD_REQ_GET_DESCRIPTOR:
|
||||
if(setup->wValue >> 8 == HID_REPORT_DESC)
|
||||
{
|
||||
len = MIN(USBD_HID_SIZ_REPORT_DESC, setup->wLength);
|
||||
buf = (uint8_t *)g_usbd_hid_report;
|
||||
}
|
||||
else if(setup->wValue >> 8 == HID_DESCRIPTOR_TYPE)
|
||||
{
|
||||
len = MIN(9, setup->wLength);
|
||||
buf = (uint8_t *)g_hid_usb_desc;
|
||||
}
|
||||
usbd_ctrl_send(pudev, (uint8_t *)buf, len);
|
||||
break;
|
||||
case USB_STD_REQ_GET_INTERFACE:
|
||||
usbd_ctrl_send(pudev, (uint8_t *)&alt_setting, 1);
|
||||
break;
|
||||
case USB_STD_REQ_SET_INTERFACE:
|
||||
alt_setting = setup->wValue;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
usbd_ctrl_unsupport(pudev);
|
||||
break;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usb device class endpoint 0 in status stage complete
|
||||
* @param udev: to the structure of usbd_core_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type class_ept0_tx_handler(void *udev)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
|
||||
/* ...user code... */
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usb device class endpoint 0 out status stage complete
|
||||
* @param udev: to the structure of usbd_core_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type class_ept0_rx_handler(void *udev)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
uint32_t recv_len = usbd_get_recv_len(pudev, 0);
|
||||
/* ...user code... */
|
||||
if( hid_state == HID_REQ_SET_REPORT)
|
||||
{
|
||||
/* hid buffer process */
|
||||
hid_state = 0;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usb device class transmision complete handler
|
||||
* @param udev: to the structure of usbd_core_type
|
||||
* @param ept_num: endpoint number
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type class_in_handler(void *udev, uint8_t ept_num)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
|
||||
/* ...user code...
|
||||
trans next packet data
|
||||
*/
|
||||
g_u8tx_completed = 1;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usb device class endpoint receive data
|
||||
* @param udev: to the structure of usbd_core_type
|
||||
* @param ept_num: endpoint number
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usb device class sof handler
|
||||
* @param udev: to the structure of usbd_core_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type class_sof_handler(void *udev)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
|
||||
/* ...user code... */
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usb device class event handler
|
||||
* @param udev: to the structure of usbd_core_type
|
||||
* @param event: usb device event
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type class_event_handler(void *udev, usbd_event_type event)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
switch(event)
|
||||
{
|
||||
case USBD_RESET_EVENT:
|
||||
|
||||
/* ...user code... */
|
||||
|
||||
break;
|
||||
case USBD_SUSPEND_EVENT:
|
||||
hid_suspend_flag = 1;
|
||||
/* ...user code... */
|
||||
|
||||
break;
|
||||
case USBD_WAKEUP_EVENT:
|
||||
/* ...user code... */
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usb device class send report
|
||||
* @param udev: to the structure of usbd_core_type
|
||||
* @param report: report buffer
|
||||
* @param len: report length
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type class_send_report(void *udev, uint8_t *report, uint16_t len)
|
||||
{
|
||||
usb_sts_type status = USB_OK;
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
|
||||
if(usbd_connect_state_get(pudev) == USB_CONN_STATE_CONFIGURED)
|
||||
usbd_ept_send(pudev, USBD_HID_IN_EPT, report, len);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief usb device class report function
|
||||
* @param udev: to the structure of usbd_core_type
|
||||
* @param op: operation
|
||||
* @retval none
|
||||
*/
|
||||
void usb_hid_keyboard_send_char(void *udev, uint8_t ascii_code)
|
||||
{
|
||||
uint8_t key_data = 0;
|
||||
static uint8_t temp = 0;
|
||||
static uint8_t keyboard_buf[8] = {0, 0, 6, 0, 0, 0, 0, 0};
|
||||
|
||||
if(ascii_code > 128)
|
||||
{
|
||||
ascii_code = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ascii_code = _asciimap[ascii_code];
|
||||
if(!ascii_code)
|
||||
{
|
||||
ascii_code = 0;
|
||||
}
|
||||
|
||||
if(ascii_code & SHIFT)
|
||||
{
|
||||
key_data = 0x2;
|
||||
ascii_code &= 0x7F;
|
||||
}
|
||||
}
|
||||
|
||||
if((temp == ascii_code) && (ascii_code != 0))
|
||||
{
|
||||
keyboard_buf[0] = 0;
|
||||
keyboard_buf[2] = 0;
|
||||
class_send_report(udev, keyboard_buf, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
keyboard_buf[0] = key_data;
|
||||
keyboard_buf[2] = ascii_code;
|
||||
class_send_report(udev, keyboard_buf, 8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
108
middlewares/usbd_class/keyboard/keyboard_class.h
Normal file
108
middlewares/usbd_class/keyboard/keyboard_class.h
Normal file
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file keyboard_class.h
|
||||
* @version v2.0.0
|
||||
* @date 2021-11-26
|
||||
* @brief usb hid keyboard header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
* Artery authorizes customers to use, copy, and distribute the BSP
|
||||
* software and its related documentation for the purpose of design and
|
||||
* development in conjunction with Artery microcontrollers. Use of the
|
||||
* software is governed by this copyright notice and the following disclaimer.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
|
||||
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
|
||||
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
|
||||
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
|
||||
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
/* define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __KEYBOARD_CLASS_H
|
||||
#define __KEYBOARD_CLASS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "usb_std.h"
|
||||
#include "usbd_core.h"
|
||||
|
||||
/** @addtogroup AT32F413_middlewares_usbd_class
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup USB_keyboard_class
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup USB_keyboard_class_endpoint_definition
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief usb hid use endpoint define
|
||||
*/
|
||||
#define USBD_HID_IN_EPT 0x81
|
||||
|
||||
/**
|
||||
* @brief usb hid in and out max packet size define
|
||||
*/
|
||||
#define USBD_IN_MAXPACKET_SIZE 0x40
|
||||
#define USBD_OUT_MAXPACKET_SIZE 0x40
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USB_hid_class_request_code_definition
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief usb hid class request code define
|
||||
*/
|
||||
#define HID_REQ_SET_PROTOCOL 0x0B
|
||||
#define HID_REQ_GET_PROTOCOL 0x03
|
||||
#define HID_REQ_SET_IDLE 0x0A
|
||||
#define HID_REQ_GET_IDLE 0x02
|
||||
#define HID_REQ_SET_REPORT 0x09
|
||||
#define HID_REQ_GET_REPORT 0x01
|
||||
#define HID_DESCRIPTOR_TYPE 0x21
|
||||
#define HID_REPORT_DESC 0x22
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USB_hid_class_exported_functions
|
||||
* @{
|
||||
*/
|
||||
extern usbd_class_handler keyboard_class_handler;
|
||||
extern uint8_t g_u8tx_completed;
|
||||
|
||||
usb_sts_type class_send_report(void *udev, uint8_t *report, uint16_t len);
|
||||
void usb_hid_keyboard_send_char(void *udev, uint8_t ascii_code);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
449
middlewares/usbd_class/keyboard/keyboard_desc.c
Normal file
449
middlewares/usbd_class/keyboard/keyboard_desc.c
Normal file
@@ -0,0 +1,449 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file keyboard_desc.c
|
||||
* @version v2.0.0
|
||||
* @date 2021-11-26
|
||||
* @brief usb hid keyboard device descriptor
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
* Artery authorizes customers to use, copy, and distribute the BSP
|
||||
* software and its related documentation for the purpose of design and
|
||||
* development in conjunction with Artery microcontrollers. Use of the
|
||||
* software is governed by this copyright notice and the following disclaimer.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
|
||||
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
|
||||
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
|
||||
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
|
||||
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
#include "usb_std.h"
|
||||
#include "usbd_sdr.h"
|
||||
#include "usbd_core.h"
|
||||
#include "keyboard_desc.h"
|
||||
|
||||
/** @addtogroup AT32F413_middlewares_usbd_class
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup USB_keyboard_desc
|
||||
* @brief usb device keyboard descriptor
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup USB_keyboard_desc_private_functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
usbd_desc_t *get_device_descriptor(void);
|
||||
usbd_desc_t *get_device_qualifier(void);
|
||||
usbd_desc_t *get_device_configuration(void);
|
||||
usbd_desc_t *get_device_other_speed(void);
|
||||
usbd_desc_t *get_device_lang_id(void);
|
||||
usbd_desc_t *get_device_manufacturer_string(void);
|
||||
usbd_desc_t *get_device_product_string(void);
|
||||
usbd_desc_t *get_device_serial_string(void);
|
||||
usbd_desc_t *get_device_interface_string(void);
|
||||
usbd_desc_t *get_device_config_string(void);
|
||||
|
||||
uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
|
||||
static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
|
||||
static void get_serial_num(void);
|
||||
static uint8_t g_usbd_desc_buffer[256];
|
||||
|
||||
/**
|
||||
* @brief keyboard device descriptor handler structure
|
||||
*/
|
||||
usbd_desc_handler keyboard_desc_handler =
|
||||
{
|
||||
get_device_descriptor,
|
||||
get_device_qualifier,
|
||||
get_device_configuration,
|
||||
get_device_other_speed,
|
||||
get_device_lang_id,
|
||||
get_device_manufacturer_string,
|
||||
get_device_product_string,
|
||||
get_device_serial_string,
|
||||
get_device_interface_string,
|
||||
get_device_config_string,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief usb device standard descriptor
|
||||
*/
|
||||
uint8_t g_usbd_descriptor[USB_DEVICE_DESC_LEN] =
|
||||
{
|
||||
USB_DEVICE_DESC_LEN, /* bLength */
|
||||
USB_DESCIPTOR_TYPE_DEVICE, /* bDescriptorType */
|
||||
0x00, /* bcdUSB */
|
||||
0x02,
|
||||
0x00, /* bDeviceClass */
|
||||
0x00, /* bDeviceSubClass */
|
||||
0x00, /* bDeviceProtocol */
|
||||
USB_MAX_EP0_SIZE, /* bMaxPacketSize */
|
||||
LBYTE(USBD_VENDOR_ID), /* idVendor */
|
||||
HBYTE(USBD_VENDOR_ID), /* idVendor */
|
||||
LBYTE(USBD_PRODUCT_ID), /* idProduct */
|
||||
HBYTE(USBD_PRODUCT_ID), /* idProduct */
|
||||
0x00, /* bcdDevice rel. 2.00 */
|
||||
0x02,
|
||||
USB_MFC_STRING, /* Index of manufacturer string */
|
||||
USB_PRODUCT_STRING, /* Index of product string */
|
||||
USB_SERIAL_STRING, /* Index of serial number string */
|
||||
1 /* bNumConfigurations */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief usb configuration standard descriptor
|
||||
*/
|
||||
uint8_t g_usbd_configuration[USBD_CONFIG_DESC_SIZE] =
|
||||
{
|
||||
USB_DEVICE_CFG_DESC_LEN, /* bLength: configuration descriptor size */
|
||||
USB_DESCIPTOR_TYPE_CONFIGURATION, /* bDescriptorType: configuration */
|
||||
LBYTE(USBD_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
|
||||
HBYTE(USBD_CONFIG_DESC_SIZE), /* wTotalLength: bytes returned */
|
||||
0x01, /* bNumInterfaces: 1 interface */
|
||||
0x01, /* bConfigurationValue: configuration value */
|
||||
0x00, /* iConfiguration: index of string descriptor describing
|
||||
the configuration */
|
||||
0xE0, /* bmAttributes: self powered ans support remote wakeup*/
|
||||
0x32, /* MaxPower 100 mA: this current is used for detecting vbus */
|
||||
|
||||
USB_DEVICE_IF_DESC_LEN, /* bLength: interface descriptor size */
|
||||
USB_DESCIPTOR_TYPE_INTERFACE, /* bDescriptorType: interface descriptor type */
|
||||
0x00, /* bInterfaceNumber: number of interface */
|
||||
0x00, /* bAlternateSetting: alternate set */
|
||||
0x01, /* bNumEndpoints: number of endpoints */
|
||||
USB_CLASS_CODE_HID, /* bInterfaceClass: class code hid */
|
||||
0x01, /* bInterfaceSubClass: subclass code */
|
||||
0x01, /* bInterfaceProtocol: protocol code */
|
||||
0x00, /* iInterface: index of string descriptor */
|
||||
|
||||
0x09, /* bLength: size of HID descriptor in bytes */
|
||||
HID_CLASS_DESC_HID, /* bDescriptorType: HID descriptor type */
|
||||
LBYTE(HID_BCD_NUM),
|
||||
HBYTE(HID_BCD_NUM), /* bcdHID: HID class specification release number */
|
||||
0x00, /* bCountryCode: hardware target conutry */
|
||||
0x01, /* bNumDescriptors: number of HID class descriptor to follow */
|
||||
HID_CLASS_DESC_REPORT, /* bDescriptorType: report descriptor type */
|
||||
LBYTE(sizeof(g_usbd_hid_report)),
|
||||
HBYTE(sizeof(g_usbd_hid_report)), /* wDescriptorLength: total length of reprot descriptor */
|
||||
|
||||
USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
|
||||
USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */
|
||||
USBD_HID_IN_EPT, /* bEndpointAddress: the address of endpoint on usb device described by this descriptor */
|
||||
USB_EPT_DESC_INTERRUPT, /* bmAttributes: endpoint attributes */
|
||||
LBYTE(USBD_IN_MAXPACKET_SIZE),
|
||||
HBYTE(USBD_IN_MAXPACKET_SIZE), /* wMaxPacketSize: maximum packe size this endpoint */
|
||||
HID_BINTERVAL_TIME, /* bInterval: interval for polling endpoint for data transfers */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief usb mouse report descriptor
|
||||
*/
|
||||
uint8_t g_usbd_hid_report[USBD_HID_SIZ_REPORT_DESC] =
|
||||
{
|
||||
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
|
||||
0x09, 0x06, // USAGE (Keyboard)
|
||||
0xa1, 0x01, // COLLECTION (Application)
|
||||
0x05, 0x07, // USAGE_PAGE (Keyboard)
|
||||
0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl)
|
||||
0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI)
|
||||
0x15, 0x00, // LOGICAL_MINIMUM (0)
|
||||
0x25, 0x01, // LOGICAL_MAXIMUM (1)
|
||||
0x75, 0x01, // REPORT_SIZE (1)
|
||||
0x95, 0x08, // REPORT_COUNT (8)
|
||||
0x81, 0x02, // INPUT (Data,Var,Abs)
|
||||
0x95, 0x01, // REPORT_COUNT (1)
|
||||
0x75, 0x08, // REPORT_SIZE (8)
|
||||
0x81, 0x03, // INPUT (Cnst,Var,Abs)
|
||||
0x95, 0x05, // REPORT_COUNT (5)
|
||||
0x75, 0x01, // REPORT_SIZE (1)
|
||||
0x05, 0x08, // USAGE_PAGE (LEDs)
|
||||
0x19, 0x01, // USAGE_MINIMUM (Num Lock)
|
||||
0x29, 0x05, // USAGE_MAXIMUM (Kana)
|
||||
0x91, 0x02, // OUTPUT (Data,Var,Abs)
|
||||
0x95, 0x01, // REPORT_COUNT (1)
|
||||
0x75, 0x03, // REPORT_SIZE (3)
|
||||
0x91, 0x03, // OUTPUT (Cnst,Var,Abs)
|
||||
0x95, 0x06, // REPORT_COUNT (6)
|
||||
0x75, 0x08, // REPORT_SIZE (8)
|
||||
0x15, 0x00, // LOGICAL_MINIMUM (0)
|
||||
0x25, 0xFF, // LOGICAL_MAXIMUM (255)
|
||||
0x05, 0x07, // USAGE_PAGE (Keyboard)
|
||||
0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated))
|
||||
0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application)
|
||||
0x81, 0x00, // INPUT (Data,Ary,Abs)
|
||||
0xc0 // END_COLLECTION
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief usb hid descriptor
|
||||
*/
|
||||
uint8_t g_hid_usb_desc[9] =
|
||||
{
|
||||
0x09, /* bLength: size of HID descriptor in bytes */
|
||||
HID_CLASS_DESC_HID, /* bDescriptorType: HID descriptor type */
|
||||
LBYTE(HID_BCD_NUM),
|
||||
HBYTE(HID_BCD_NUM), /* bcdHID: HID class specification release number */
|
||||
0x00, /* bCountryCode: hardware target conutry */
|
||||
0x01, /* bNumDescriptors: number of HID class descriptor to follow */
|
||||
HID_CLASS_DESC_REPORT, /* bDescriptorType: report descriptor type */
|
||||
LBYTE(sizeof(g_usbd_hid_report)),
|
||||
HBYTE(sizeof(g_usbd_hid_report)), /* wDescriptorLength: total length of reprot descriptor */
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief usb string lang id
|
||||
*/
|
||||
uint8_t g_string_lang_id[USBD_SIZ_STRING_LANGID] =
|
||||
{
|
||||
USBD_SIZ_STRING_LANGID,
|
||||
USB_DESCIPTOR_TYPE_STRING,
|
||||
0x09,
|
||||
0x04,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief usb string serial
|
||||
*/
|
||||
uint8_t g_string_serial[USBD_SIZ_STRING_SERIAL] =
|
||||
{
|
||||
USBD_SIZ_STRING_SERIAL,
|
||||
USB_DESCIPTOR_TYPE_STRING,
|
||||
};
|
||||
|
||||
|
||||
/* device descriptor */
|
||||
usbd_desc_t device_descriptor =
|
||||
{
|
||||
USB_DEVICE_DESC_LEN,
|
||||
g_usbd_descriptor
|
||||
};
|
||||
|
||||
/* config descriptor */
|
||||
usbd_desc_t config_descriptor =
|
||||
{
|
||||
USBD_CONFIG_DESC_SIZE,
|
||||
g_usbd_configuration
|
||||
};
|
||||
|
||||
/* langid descriptor */
|
||||
usbd_desc_t langid_descriptor =
|
||||
{
|
||||
USBD_SIZ_STRING_LANGID,
|
||||
g_string_lang_id
|
||||
};
|
||||
|
||||
/* serial descriptor */
|
||||
usbd_desc_t serial_descriptor =
|
||||
{
|
||||
USBD_SIZ_STRING_SERIAL,
|
||||
g_string_serial
|
||||
};
|
||||
|
||||
usbd_desc_t vp_desc;
|
||||
|
||||
/**
|
||||
* @brief standard usb unicode convert
|
||||
* @param string: source string
|
||||
* @param unicode_buf: unicode buffer
|
||||
* @retval length
|
||||
*/
|
||||
uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf)
|
||||
{
|
||||
uint16_t str_len = 0, id_pos = 2;
|
||||
uint8_t *tmp_str = string;
|
||||
|
||||
while(*tmp_str != '\0')
|
||||
{
|
||||
str_len ++;
|
||||
unicode_buf[id_pos ++] = *tmp_str ++;
|
||||
unicode_buf[id_pos ++] = 0x00;
|
||||
}
|
||||
|
||||
str_len = str_len * 2 + 2;
|
||||
unicode_buf[0] = str_len;
|
||||
unicode_buf[1] = USB_DESCIPTOR_TYPE_STRING;
|
||||
|
||||
return str_len;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usb int convert to unicode
|
||||
* @param value: int value
|
||||
* @param pbus: unicode buffer
|
||||
* @param len: length
|
||||
* @retval none
|
||||
*/
|
||||
static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len)
|
||||
{
|
||||
uint8_t idx = 0;
|
||||
|
||||
for( idx = 0 ; idx < len ; idx ++)
|
||||
{
|
||||
if( ((value >> 28)) < 0xA )
|
||||
{
|
||||
pbuf[ 2 * idx] = (value >> 28) + '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
pbuf[2 * idx] = (value >> 28) + 'A' - 10;
|
||||
}
|
||||
|
||||
value = value << 4;
|
||||
|
||||
pbuf[2 * idx + 1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief usb get serial number
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
static void get_serial_num(void)
|
||||
{
|
||||
uint32_t serial0, serial1, serial2;
|
||||
|
||||
serial0 = *(uint32_t*)MCU_ID1;
|
||||
serial1 = *(uint32_t*)MCU_ID2;
|
||||
serial2 = *(uint32_t*)MCU_ID3;
|
||||
|
||||
serial0 += serial2;
|
||||
|
||||
if (serial0 != 0)
|
||||
{
|
||||
usbd_int_to_unicode (serial0, &g_string_serial[2] ,8);
|
||||
usbd_int_to_unicode (serial1, &g_string_serial[18] ,4);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get device descriptor
|
||||
* @param none
|
||||
* @retval usbd_desc
|
||||
*/
|
||||
usbd_desc_t *get_device_descriptor(void)
|
||||
{
|
||||
return &device_descriptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get device qualifier
|
||||
* @param none
|
||||
* @retval usbd_desc
|
||||
*/
|
||||
usbd_desc_t * get_device_qualifier(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get config descriptor
|
||||
* @param none
|
||||
* @retval usbd_desc
|
||||
*/
|
||||
usbd_desc_t *get_device_configuration(void)
|
||||
{
|
||||
return &config_descriptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get other speed descriptor
|
||||
* @param none
|
||||
* @retval usbd_desc
|
||||
*/
|
||||
usbd_desc_t *get_device_other_speed(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get lang id descriptor
|
||||
* @param none
|
||||
* @retval usbd_desc
|
||||
*/
|
||||
usbd_desc_t *get_device_lang_id(void)
|
||||
{
|
||||
return &langid_descriptor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief get manufacturer descriptor
|
||||
* @param none
|
||||
* @retval usbd_desc
|
||||
*/
|
||||
usbd_desc_t *get_device_manufacturer_string(void)
|
||||
{
|
||||
vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_DESC_MANUFACTURER_STRING, g_usbd_desc_buffer);
|
||||
vp_desc.descriptor = g_usbd_desc_buffer;
|
||||
return &vp_desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get product descriptor
|
||||
* @param none
|
||||
* @retval usbd_desc
|
||||
*/
|
||||
usbd_desc_t *get_device_product_string(void)
|
||||
{
|
||||
vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_DESC_PRODUCT_STRING, g_usbd_desc_buffer);
|
||||
vp_desc.descriptor = g_usbd_desc_buffer;
|
||||
return &vp_desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get serial descriptor
|
||||
* @param none
|
||||
* @retval usbd_desc
|
||||
*/
|
||||
usbd_desc_t *get_device_serial_string(void)
|
||||
{
|
||||
get_serial_num();
|
||||
return &serial_descriptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get interface descriptor
|
||||
* @param none
|
||||
* @retval usbd_desc
|
||||
*/
|
||||
usbd_desc_t *get_device_interface_string(void)
|
||||
{
|
||||
vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_DESC_INTERFACE_STRING, g_usbd_desc_buffer);
|
||||
vp_desc.descriptor = g_usbd_desc_buffer;
|
||||
return &vp_desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get device config descriptor
|
||||
* @param none
|
||||
* @retval usbd_desc
|
||||
*/
|
||||
usbd_desc_t *get_device_config_string(void)
|
||||
{
|
||||
vp_desc.length = usbd_unicode_convert((uint8_t *)USBD_DESC_CONFIGURATION_STRING, g_usbd_desc_buffer);
|
||||
vp_desc.descriptor = g_usbd_desc_buffer;
|
||||
return &vp_desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
119
middlewares/usbd_class/keyboard/keyboard_desc.h
Normal file
119
middlewares/usbd_class/keyboard/keyboard_desc.h
Normal file
@@ -0,0 +1,119 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file keyboard_desc.h
|
||||
* @version v2.0.0
|
||||
* @date 2021-11-26
|
||||
* @brief usb keyboard descriptor header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
*
|
||||
* The software Board Support Package (BSP) that is made available to
|
||||
* download from Artery official website is the copyrighted work of Artery.
|
||||
* Artery authorizes customers to use, copy, and distribute the BSP
|
||||
* software and its related documentation for the purpose of design and
|
||||
* development in conjunction with Artery microcontrollers. Use of the
|
||||
* software is governed by this copyright notice and the following disclaimer.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
|
||||
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
|
||||
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
|
||||
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
|
||||
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
/* define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __KEYBOARD_DESC_H
|
||||
#define __KEYBOARD_DESC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "keyboard_class.h"
|
||||
#include "usbd_core.h"
|
||||
|
||||
/** @addtogroup AT32F413_middlewares_usbd_class
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup USB_keyboard_desc
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup USB_keyboard_desc_definition
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief usb bcd number define
|
||||
*/
|
||||
#define HID_BCD_NUM 0x0110
|
||||
|
||||
/**
|
||||
* @brief usb hid class descriptor define
|
||||
*/
|
||||
#define HID_CLASS_DESC_HID 0x21
|
||||
#define HID_CLASS_DESC_REPORT 0x22
|
||||
#define HID_CLASS_DESC_PHYSICAL 0x23
|
||||
|
||||
/**
|
||||
* @brief usb vendor id and product id define
|
||||
*/
|
||||
#define USBD_VENDOR_ID 0x2E3C
|
||||
#define USBD_PRODUCT_ID 0x6040
|
||||
|
||||
/**
|
||||
* @brief usb descriptor size define
|
||||
*/
|
||||
#define USBD_CONFIG_DESC_SIZE 34
|
||||
#define USBD_HID_SIZ_REPORT_DESC 63
|
||||
#define USBD_SIZ_STRING_LANGID 4
|
||||
#define USBD_SIZ_STRING_SERIAL 0x1A
|
||||
|
||||
/**
|
||||
* @brief usb string define(vendor, product configuration, interface)
|
||||
*/
|
||||
#define USBD_DESC_MANUFACTURER_STRING "Artery"
|
||||
#define USBD_DESC_PRODUCT_STRING "Keyboard"
|
||||
#define USBD_DESC_CONFIGURATION_STRING "Keyboard Config"
|
||||
#define USBD_DESC_INTERFACE_STRING "Keyboard Interface"
|
||||
|
||||
/**
|
||||
* @brief usb hid endpoint interval define
|
||||
*/
|
||||
#define HID_BINTERVAL_TIME 0x0A
|
||||
|
||||
/**
|
||||
* @brief usb mcu id address deine
|
||||
*/
|
||||
#define MCU_ID1 (0x1FFFF7E8)
|
||||
#define MCU_ID2 (0x1FFFF7EC)
|
||||
#define MCU_ID3 (0x1FFFF7F0)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
extern uint8_t g_usbd_descriptor[USB_DEVICE_DESC_LEN];
|
||||
extern uint8_t g_usbd_configuration[USBD_CONFIG_DESC_SIZE];
|
||||
extern uint8_t g_usbd_hid_report[USBD_HID_SIZ_REPORT_DESC];
|
||||
extern uint8_t g_hid_usb_desc[9];
|
||||
extern usbd_desc_handler keyboard_desc_handler;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user