1 /* USER CODE BEGIN Header */ 2 /** 3 ****************************************************************************** 4 * @file : usbd_conf.h 5 * @version : v2.0_Cube 6 * @brief : Header for usbd_conf.c file. 7 ****************************************************************************** 8 * @attention 9 * 10 * <h2><center>© Copyright (c) 2019 STMicroelectronics. 11 * All rights reserved.</center></h2> 12 * 13 * This software component is licensed by ST under Ultimate Liberty license 14 * SLA0044, the "License"; You may not use this file except in compliance with 15 * the License. You may obtain a copy of the License at: 16 * www.st.com/SLA0044 17 * 18 ****************************************************************************** 19 */ 20 /* USER CODE END Header */ 21 22 /* Define to prevent recursive inclusion -------------------------------------*/ 23 #ifndef __USBD_CONF__H__ 24 #define __USBD_CONF__H__ 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 /* Includes ------------------------------------------------------------------*/ 31 #include <stdio.h> 32 #include <stdlib.h> 33 #include <string.h> 34 #include "main.h" 35 #include "stm32l1xx.h" 36 #include "stm32l1xx_hal.h" 37 38 /* USER CODE BEGIN INCLUDE */ 39 40 /* USER CODE END INCLUDE */ 41 42 /** @addtogroup USBD_OTG_DRIVER 43 * @{ 44 */ 45 46 /** @defgroup USBD_CONF USBD_CONF 47 * @brief Configuration file for Usb otg low level driver. 48 * @{ 49 */ 50 51 /** @defgroup USBD_CONF_Exported_Variables USBD_CONF_Exported_Variables 52 * @brief Public variables. 53 * @{ 54 */ 55 56 /** 57 * @} 58 */ 59 60 /** @defgroup USBD_CONF_Exported_Defines USBD_CONF_Exported_Defines 61 * @brief Defines for configuration of the Usb device. 62 * @{ 63 */ 64 65 /*---------- -----------*/ 66 #define USBD_MAX_NUM_INTERFACES 1U 67 /*---------- -----------*/ 68 #define USBD_MAX_NUM_CONFIGURATION 1U 69 /*---------- -----------*/ 70 #define USBD_MAX_STR_DESC_SIZ 512U 71 /*---------- -----------*/ 72 #define USBD_SUPPORT_USER_STRING 0U 73 /*---------- -----------*/ 74 #define USBD_DEBUG_LEVEL 0U 75 /*---------- -----------*/ 76 #define USBD_SELF_POWERED 1U 77 78 /****************************************/ 79 /* #define for FS and HS identification */ 80 #define DEVICE_FS 0 81 82 /** 83 * @} 84 */ 85 86 /** @defgroup USBD_CONF_Exported_Macros USBD_CONF_Exported_Macros 87 * @brief Aliases. 88 * @{ 89 */ 90 91 /* Memory management macros */ 92 93 /** Alias for memory allocation. */ 94 #define USBD_malloc (uint32_t *)USBD_static_malloc 95 96 /** Alias for memory release. */ 97 #define USBD_free USBD_static_free 98 99 /** Alias for memory set. */ 100 #define USBD_memset /* Not used */ 101 102 /** Alias for memory copy. */ 103 #define USBD_memcpy /* Not used */ 104 105 /** Alias for delay. */ 106 #define USBD_Delay HAL_Delay 107 108 /* For footprint reasons and since only one allocation is handled in the HID class 109 driver, the malloc/free is changed into a static allocation method */ 110 void *USBD_static_malloc(uint32_t size); 111 void USBD_static_free(void *p); 112 113 /* DEBUG macros */ 114 115 #if (USBD_DEBUG_LEVEL > 0) 116 #define USBD_UsrLog(...) printf(__VA_ARGS__);\ 117 printf("\n"); 118 #else 119 #define USBD_UsrLog(...) 120 #endif 121 122 #if (USBD_DEBUG_LEVEL > 1) 123 124 #define USBD_ErrLog(...) printf("ERROR: ") ;\ 125 printf(__VA_ARGS__);\ 126 printf("\n"); 127 #else 128 #define USBD_ErrLog(...) 129 #endif 130 131 #if (USBD_DEBUG_LEVEL > 2) 132 #define USBD_DbgLog(...) printf("DEBUG : ") ;\ 133 printf(__VA_ARGS__);\ 134 printf("\n"); 135 #else 136 #define USBD_DbgLog(...) 137 #endif 138 139 /** 140 * @} 141 */ 142 143 /** @defgroup USBD_CONF_Exported_Types USBD_CONF_Exported_Types 144 * @brief Types. 145 * @{ 146 */ 147 148 /** 149 * @} 150 */ 151 152 /** @defgroup USBD_CONF_Exported_FunctionsPrototype USBD_CONF_Exported_FunctionsPrototype 153 * @brief Declaration of public functions for Usb device. 154 * @{ 155 */ 156 157 /* Exported functions -------------------------------------------------------*/ 158 159 /** 160 * @} 161 */ 162 163 /** 164 * @} 165 */ 166 167 /** 168 * @} 169 */ 170 171 #ifdef __cplusplus 172 } 173 #endif 174 175 #endif /* __USBD_CONF__H__ */ 176 177 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 178