usbd_conf.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #pragma once
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include "stm32wbxx.h"
  6. #include "stm32wbxx_hal.h"
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. #define USBD_MAX_NUM_INTERFACES 1U
  11. #define USBD_MAX_NUM_CONFIGURATION 1U
  12. #define USBD_MAX_STR_DESC_SIZ 512U
  13. #define USBD_DEBUG_LEVEL 0U
  14. #define USBD_LPM_ENABLED 0U
  15. #define USBD_SELF_POWERED 0U
  16. /****************************************/
  17. /* #define for FS and HS identification */
  18. #define DEVICE_FS 0
  19. /* Memory management macros */
  20. /** Alias for memory allocation. */
  21. #define USBD_malloc (void *)USBD_static_malloc
  22. /** Alias for memory release. */
  23. #define USBD_free USBD_static_free
  24. /** Alias for memory set. */
  25. #define USBD_memset memset
  26. /** Alias for memory copy. */
  27. #define USBD_memcpy memcpy
  28. /** Alias for delay. */
  29. #define USBD_Delay HAL_Delay
  30. /* DEBUG macros */
  31. #if (USBD_DEBUG_LEVEL > 0)
  32. #define USBD_UsrLog(...) printf(__VA_ARGS__);\
  33. printf("\n");
  34. #else
  35. #define USBD_UsrLog(...)
  36. #endif
  37. #if (USBD_DEBUG_LEVEL > 1)
  38. #define USBD_ErrLog(...) printf("ERROR: ") ;\
  39. printf(__VA_ARGS__);\
  40. printf("\n");
  41. #else
  42. #define USBD_ErrLog(...)
  43. #endif
  44. #if (USBD_DEBUG_LEVEL > 2)
  45. #define USBD_DbgLog(...) printf("DEBUG : ") ;\
  46. printf(__VA_ARGS__);\
  47. printf("\n");
  48. #else
  49. #define USBD_DbgLog(...)
  50. #endif
  51. void *USBD_static_malloc(uint32_t size);
  52. void USBD_static_free(void *p);
  53. #ifdef __cplusplus
  54. }
  55. #endif