usbd_conf.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * @file : usbd_conf.h
  5. * @version : v3.0_Cube
  6. * @brief : Header for usbd_conf.c file.
  7. ******************************************************************************
  8. * @attention
  9. *
  10. * Copyright (c) 2025 STMicroelectronics.
  11. * All rights reserved.
  12. *
  13. * This software is licensed under terms that can be found in the LICENSE file
  14. * in the root directory of this software component.
  15. * If no LICENSE file comes with this software, it is provided AS-IS.
  16. *
  17. ******************************************************************************
  18. */
  19. /* USER CODE END Header */
  20. /* Define to prevent recursive inclusion -------------------------------------*/
  21. #ifndef __USBD_CONF__H__
  22. #define __USBD_CONF__H__
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /* Includes ------------------------------------------------------------------*/
  27. #include <stdio.h>
  28. #include <stdlib.h>
  29. #include <string.h>
  30. #include "stm32g4xx.h"
  31. #include "stm32g4xx_hal.h"
  32. /* USER CODE BEGIN INCLUDE */
  33. /* USER CODE END INCLUDE */
  34. /** @addtogroup USBD_OTG_DRIVER
  35. * @brief Driver for Usb device.
  36. * @{
  37. */
  38. /** @defgroup USBD_CONF USBD_CONF
  39. * @brief Configuration file for Usb otg low level driver.
  40. * @{
  41. */
  42. /** @defgroup USBD_CONF_Exported_Variables USBD_CONF_Exported_Variables
  43. * @brief Public variables.
  44. * @{
  45. */
  46. /* Private variables ---------------------------------------------------------*/
  47. /* USER CODE BEGIN PV */
  48. /* USER CODE END PV */
  49. /**
  50. * @}
  51. */
  52. /** @defgroup USBD_CONF_Exported_Defines USBD_CONF_Exported_Defines
  53. * @brief Defines for configuration of the Usb device.
  54. * @{
  55. */
  56. /*---------- -----------*/
  57. #define USBD_MAX_NUM_INTERFACES 1U
  58. /*---------- -----------*/
  59. #define USBD_MAX_NUM_CONFIGURATION 1U
  60. /*---------- -----------*/
  61. #define USBD_MAX_STR_DESC_SIZ 512U
  62. /*---------- -----------*/
  63. #define USBD_DEBUG_LEVEL 0U
  64. /*---------- -----------*/
  65. #define USBD_LPM_ENABLED 1U
  66. /*---------- -----------*/
  67. #define USBD_SELF_POWERED 1U
  68. /*---------- -----------*/
  69. #define USBD_CUSTOMHID_OUTREPORT_BUF_SIZE 64U
  70. /*---------- -----------*/
  71. #define USBD_CUSTOM_HID_REPORT_DESC_SIZE 33U
  72. /*---------- -----------*/
  73. #define CUSTOM_HID_FS_BINTERVAL 0x5U
  74. /****************************************/
  75. /* #define for FS and HS identification */
  76. #define DEVICE_FS 0
  77. /**
  78. * @}
  79. */
  80. /** @defgroup USBD_CONF_Exported_Macros USBD_CONF_Exported_Macros
  81. * @brief Aliases.
  82. * @{
  83. */
  84. /* Memory management macros */
  85. /** Alias for memory allocation. */
  86. #define USBD_malloc (void *)USBD_static_malloc
  87. /** Alias for memory release. */
  88. #define USBD_free USBD_static_free
  89. /** Alias for memory set. */
  90. #define USBD_memset memset
  91. /** Alias for memory copy. */
  92. #define USBD_memcpy memcpy
  93. /** Alias for delay. */
  94. #define USBD_Delay HAL_Delay
  95. /* DEBUG macros */
  96. #if (USBD_DEBUG_LEVEL > 0)
  97. #define USBD_UsrLog(...) printf(__VA_ARGS__);\
  98. printf("\n");
  99. #else
  100. #define USBD_UsrLog(...)
  101. #endif
  102. #if (USBD_DEBUG_LEVEL > 1)
  103. #define USBD_ErrLog(...) printf("ERROR: ") ;\
  104. printf(__VA_ARGS__);\
  105. printf("\n");
  106. #else
  107. #define USBD_ErrLog(...)
  108. #endif
  109. #if (USBD_DEBUG_LEVEL > 2)
  110. #define USBD_DbgLog(...) printf("DEBUG : ") ;\
  111. printf(__VA_ARGS__);\
  112. printf("\n");
  113. #else
  114. #define USBD_DbgLog(...)
  115. #endif
  116. /**
  117. * @}
  118. */
  119. /** @defgroup USBD_CONF_Exported_Types USBD_CONF_Exported_Types
  120. * @brief Types.
  121. * @{
  122. */
  123. /**
  124. * @}
  125. */
  126. /** @defgroup USBD_CONF_Exported_FunctionsPrototype USBD_CONF_Exported_FunctionsPrototype
  127. * @brief Declaration of public functions for Usb device.
  128. * @{
  129. */
  130. /* Exported functions -------------------------------------------------------*/
  131. void *USBD_static_malloc(uint32_t size);
  132. void USBD_static_free(void *p);
  133. /**
  134. * @}
  135. */
  136. /**
  137. * @}
  138. */
  139. /**
  140. * @}
  141. */
  142. #ifdef __cplusplus
  143. }
  144. #endif
  145. #endif /* __USBD_CONF__H__ */