keyboard_class.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /**
  2. **************************************************************************
  3. * @file keyboard_class.h
  4. * @version v2.0.6
  5. * @date 2021-12-31
  6. * @brief usb hid keyboard header file
  7. **************************************************************************
  8. * Copyright notice & Disclaimer
  9. *
  10. * The software Board Support Package (BSP) that is made available to
  11. * download from Artery official website is the copyrighted work of Artery.
  12. * Artery authorizes customers to use, copy, and distribute the BSP
  13. * software and its related documentation for the purpose of design and
  14. * development in conjunction with Artery microcontrollers. Use of the
  15. * software is governed by this copyright notice and the following disclaimer.
  16. *
  17. * THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
  18. * GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
  19. * TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
  20. * STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
  21. * INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
  22. * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
  23. *
  24. **************************************************************************
  25. */
  26. /* define to prevent recursive inclusion -------------------------------------*/
  27. #ifndef __KEYBOARD_CLASS_H
  28. #define __KEYBOARD_CLASS_H
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. #include "usb_std.h"
  33. #include "usbd_core.h"
  34. /** @addtogroup AT32F403A_407_middlewares_usbd_class
  35. * @{
  36. */
  37. /** @addtogroup USB_keyboard_class
  38. * @{
  39. */
  40. /** @defgroup USB_keyboard_class_endpoint_definition
  41. * @{
  42. */
  43. /**
  44. * @brief usb hid use endpoint define
  45. */
  46. #define USBD_HID_IN_EPT 0x81
  47. /**
  48. * @brief usb hid in and out max packet size define
  49. */
  50. #define USBD_IN_MAXPACKET_SIZE 0x40
  51. #define USBD_OUT_MAXPACKET_SIZE 0x40
  52. /**
  53. * @}
  54. */
  55. /** @defgroup USB_hid_class_request_code_definition
  56. * @{
  57. */
  58. /**
  59. * @brief usb hid class request code define
  60. */
  61. #define HID_REQ_SET_PROTOCOL 0x0B
  62. #define HID_REQ_GET_PROTOCOL 0x03
  63. #define HID_REQ_SET_IDLE 0x0A
  64. #define HID_REQ_GET_IDLE 0x02
  65. #define HID_REQ_SET_REPORT 0x09
  66. #define HID_REQ_GET_REPORT 0x01
  67. #define HID_DESCRIPTOR_TYPE 0x21
  68. #define HID_REPORT_DESC 0x22
  69. /**
  70. * @}
  71. */
  72. /** @defgroup USB_hid_class_exported_functions
  73. * @{
  74. */
  75. extern usbd_class_handler keyboard_class_handler;
  76. extern __IO uint8_t g_u8tx_completed;
  77. usb_sts_type class_send_report(void *udev, uint8_t *report, uint16_t len);
  78. void usb_hid_keyboard_send_char(void *udev, uint8_t ascii_code);
  79. /**
  80. * @}
  81. */
  82. /**
  83. * @}
  84. */
  85. /**
  86. * @}
  87. */
  88. #ifdef __cplusplus
  89. }
  90. #endif
  91. #endif