mouse_class.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /**
  2. **************************************************************************
  3. * @file mouse_class.h
  4. * @version v2.0.6
  5. * @date 2021-12-31
  6. * @brief usb hid mouse 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 __MOUSE_CLASS_H
  28. #define __MOUSE_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_mouse_class
  38. * @{
  39. */
  40. /** @defgroup USB_mouse_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. /**
  52. * @}
  53. */
  54. /** @defgroup USB_mouse_class_request_code_definition
  55. * @{
  56. */
  57. /**
  58. * @brief usb hid class request code define
  59. */
  60. #define HID_REQ_SET_PROTOCOL 0x0B
  61. #define HID_REQ_GET_PROTOCOL 0x03
  62. #define HID_REQ_SET_IDLE 0x0A
  63. #define HID_REQ_GET_IDLE 0x02
  64. #define HID_REQ_SET_REPORT 0x09
  65. #define HID_REQ_GET_REPORT 0x01
  66. #define HID_DESCRIPTOR_TYPE 0x21
  67. #define HID_REPORT_DESC 0x22
  68. /**
  69. * @brief usb hid mouse operation
  70. */
  71. #define MOVE_STEP 20
  72. #define BUTTON_RELEASE 0
  73. #define LEFT_BUTTON 1
  74. #define RIGHT_BUTTON 2
  75. #define LEFT_MOVE 3
  76. #define RIGHT_MOVE 4
  77. #define UP_MOVE 5
  78. #define DOWN_MOVE 6
  79. /**
  80. * @}
  81. */
  82. /** @defgroup USB_hid_class_exported_functions
  83. * @{
  84. */
  85. extern usbd_class_handler mouse_class_handler;
  86. usb_sts_type class_send_report(void *udev, uint8_t *report, uint16_t len);
  87. void usb_hid_mouse_send(void *udev, uint8_t op);
  88. /**
  89. * @}
  90. */
  91. /**
  92. * @}
  93. */
  94. /**
  95. * @}
  96. */
  97. #ifdef __cplusplus
  98. }
  99. #endif
  100. #endif