STM32F103xB HAL User Manual
stm32f1xx_hal_conf.h
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32f1xx_hal_conf.h
00004   * @author  MCD Application Team
00005   * @brief   HAL configuration template file.
00006   *          This file should be copied to the application folder and renamed
00007   *          to stm32f1xx_hal_conf.h.
00008   ******************************************************************************
00009   * @attention
00010   *
00011   * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
00012   * All rights reserved.</center></h2>
00013   *
00014   * This software component is licensed by ST under BSD 3-Clause license,
00015   * the "License"; You may not use this file except in compliance with the
00016   * License. You may obtain a copy of the License at:
00017   *                        opensource.org/licenses/BSD-3-Clause
00018   *
00019   ******************************************************************************
00020   */
00021 
00022 /* Define to prevent recursive inclusion -------------------------------------*/
00023 #ifndef __STM32F1xx_HAL_CONF_H
00024 #define __STM32F1xx_HAL_CONF_H
00025 
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029 
00030 /* Exported types ------------------------------------------------------------*/
00031 /* Exported constants --------------------------------------------------------*/
00032 
00033 /* ########################## Module Selection ############################## */
00034 /**
00035   * @brief This is the list of modules to be used in the HAL driver
00036   */
00037 #define HAL_MODULE_ENABLED
00038 #define HAL_ADC_MODULE_ENABLED
00039 #define HAL_CAN_MODULE_ENABLED
00040 /* #define HAL_CAN_LEGACY_MODULE_ENABLED */
00041 #define HAL_CEC_MODULE_ENABLED
00042 #define HAL_CORTEX_MODULE_ENABLED
00043 #define HAL_CRC_MODULE_ENABLED
00044 #define HAL_DAC_MODULE_ENABLED
00045 #define HAL_DMA_MODULE_ENABLED
00046 #define HAL_ETH_MODULE_ENABLED
00047 #define HAL_EXTI_MODULE_ENABLED
00048 #define HAL_FLASH_MODULE_ENABLED
00049 #define HAL_GPIO_MODULE_ENABLED
00050 #define HAL_HCD_MODULE_ENABLED
00051 #define HAL_I2C_MODULE_ENABLED
00052 #define HAL_I2S_MODULE_ENABLED
00053 #define HAL_IRDA_MODULE_ENABLED
00054 #define HAL_IWDG_MODULE_ENABLED
00055 #define HAL_NAND_MODULE_ENABLED
00056 #define HAL_NOR_MODULE_ENABLED
00057 #define HAL_PCCARD_MODULE_ENABLED
00058 #define HAL_PCD_MODULE_ENABLED
00059 #define HAL_PWR_MODULE_ENABLED
00060 #define HAL_RCC_MODULE_ENABLED
00061 #define HAL_RTC_MODULE_ENABLED
00062 #define HAL_SD_MODULE_ENABLED
00063 #define HAL_SMARTCARD_MODULE_ENABLED
00064 #define HAL_SPI_MODULE_ENABLED
00065 #define HAL_SRAM_MODULE_ENABLED
00066 #define HAL_TIM_MODULE_ENABLED
00067 #define HAL_UART_MODULE_ENABLED
00068 #define HAL_USART_MODULE_ENABLED
00069 #define HAL_WWDG_MODULE_ENABLED
00070 #define HAL_MMC_MODULE_ENABLED
00071 
00072 /* ########################## Oscillator Values adaptation ####################*/
00073 /**
00074   * @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
00075   *        This value is used by the RCC HAL module to compute the system frequency
00076   *        (when HSE is used as system clock source, directly or through the PLL).
00077   */
00078 #if !defined  (HSE_VALUE)
00079 #if defined(USE_STM3210C_EVAL)
00080 #define HSE_VALUE    25000000U /*!< Value of the External oscillator in Hz */
00081 #else
00082 #define HSE_VALUE    8000000U /*!< Value of the External oscillator in Hz */
00083 #endif
00084 #endif /* HSE_VALUE */
00085 
00086 #if !defined  (HSE_STARTUP_TIMEOUT)
00087 #define HSE_STARTUP_TIMEOUT    100U      /*!< Time out for HSE start up, in ms */
00088 #endif /* HSE_STARTUP_TIMEOUT */
00089 
00090 /**
00091   * @brief Internal High Speed oscillator (HSI) value.
00092   *        This value is used by the RCC HAL module to compute the system frequency
00093   *        (when HSI is used as system clock source, directly or through the PLL).
00094   */
00095 #if !defined  (HSI_VALUE)
00096 #define HSI_VALUE              8000000U  /*!< Value of the Internal oscillator in Hz */
00097 #endif /* HSI_VALUE */
00098 
00099 /**
00100   * @brief Internal Low Speed oscillator (LSI) value.
00101   */
00102 #if !defined  (LSI_VALUE)
00103 #define LSI_VALUE               40000U     /*!< LSI Typical Value in Hz */
00104 #endif /* LSI_VALUE */                     /*!< Value of the Internal Low Speed oscillator in Hz
00105                                                 The real value may vary depending on the variations
00106                                                 in voltage and temperature. */
00107 /**
00108   * @brief External Low Speed oscillator (LSE) value.
00109   *        This value is used by the UART, RTC HAL module to compute the system frequency
00110   */
00111 #if !defined  (LSE_VALUE)
00112 #define LSE_VALUE               32768U    /*!< Value of the External Low Speed oscillator in Hz */
00113 #endif /* LSE_VALUE */
00114 
00115 #if !defined  (LSE_STARTUP_TIMEOUT)
00116 #define LSE_STARTUP_TIMEOUT    5000U     /*!< Time out for LSE start up, in ms */
00117 #endif /* LSE_STARTUP_TIMEOUT */
00118 
00119 /* Tip: To avoid modifying this file each time you need to use different HSE,
00120    ===  you can define the HSE value in your toolchain compiler preprocessor. */
00121 
00122 /* ########################### System Configuration ######################### */
00123 /**
00124   * @brief This is the HAL system configuration section
00125   */
00126 #define  VDD_VALUE                    3300U /*!< Value of VDD in mv */
00127 #define  TICK_INT_PRIORITY            0x0FU /*!< tick interrupt priority */
00128 #define  USE_RTOS                     0U
00129 #define  PREFETCH_ENABLE              1U
00130 
00131 #define  USE_HAL_ADC_REGISTER_CALLBACKS 1U /* ADC register callback disabled       */
00132 #define  USE_HAL_CAN_REGISTER_CALLBACKS 1U /* CAN register callback disabled       */
00133 #define  USE_HAL_CEC_REGISTER_CALLBACKS 1U /* CEC register callback disabled       */
00134 #define  USE_HAL_DAC_REGISTER_CALLBACKS 1U /* DAC register callback disabled       */
00135 #define  USE_HAL_ETH_REGISTER_CALLBACKS 1U /* ETH register callback disabled       */
00136 #define  USE_HAL_HCD_REGISTER_CALLBACKS 1U /* HCD register callback disabled       */
00137 #define  USE_HAL_I2C_REGISTER_CALLBACKS 1U /* I2C register callback disabled       */
00138 #define  USE_HAL_I2S_REGISTER_CALLBACKS 1U /* I2S register callback disabled       */
00139 #define  USE_HAL_MMC_REGISTER_CALLBACKS 1U /* MMC register callback disabled       */
00140 #define  USE_HAL_NAND_REGISTER_CALLBACKS 1U /* NAND register callback disabled      */
00141 #define  USE_HAL_NOR_REGISTER_CALLBACKS 1U /* NOR register callback disabled       */
00142 #define  USE_HAL_PCCARD_REGISTER_CALLBACKS 1U /* PCCARD register callback disabled    */
00143 #define  USE_HAL_PCD_REGISTER_CALLBACKS 1U /* PCD register callback disabled       */
00144 #define  USE_HAL_RTC_REGISTER_CALLBACKS 1U /* RTC register callback disabled       */
00145 #define  USE_HAL_SD_REGISTER_CALLBACKS 1U /* SD register callback disabled        */
00146 #define  USE_HAL_SMARTCARD_REGISTER_CALLBACKS 1U /* SMARTCARD register callback disabled */
00147 #define  USE_HAL_IRDA_REGISTER_CALLBACKS 1U /* IRDA register callback disabled      */
00148 #define  USE_HAL_SRAM_REGISTER_CALLBACKS 1U /* SRAM register callback disabled      */
00149 #define  USE_HAL_SPI_REGISTER_CALLBACKS 1U /* SPI register callback disabled       */
00150 #define  USE_HAL_TIM_REGISTER_CALLBACKS 1U /* TIM register callback disabled       */
00151 #define  USE_HAL_UART_REGISTER_CALLBACKS 1U /* UART register callback disabled      */
00152 #define  USE_HAL_USART_REGISTER_CALLBACKS 1U /* USART register callback disabled     */
00153 #define  USE_HAL_WWDG_REGISTER_CALLBACKS 1U /* WWDG register callback disabled      */
00154 
00155 /* ########################## Assert Selection ############################## */
00156 /**
00157   * @brief Uncomment the line below to expanse the "assert_param" macro in the
00158   *        HAL drivers code
00159   */
00160 /* #define USE_FULL_ASSERT    1U */
00161 
00162 /* ################## Ethernet peripheral configuration ##################### */
00163 
00164 /* Section 1 : Ethernet peripheral configuration */
00165 
00166 /* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */
00167 #define MAC_ADDR0   2U
00168 #define MAC_ADDR1   0U
00169 #define MAC_ADDR2   0U
00170 #define MAC_ADDR3   0U
00171 #define MAC_ADDR4   0U
00172 #define MAC_ADDR5   0U
00173 
00174 /* Definition of the Ethernet driver buffers size and count */
00175 #define ETH_RX_BUF_SIZE                ETH_MAX_PACKET_SIZE /* buffer size for receive               */
00176 #define ETH_TX_BUF_SIZE                ETH_MAX_PACKET_SIZE /* buffer size for transmit              */
00177 #define ETH_RXBUFNB                    8U                  /* 8 Rx buffers of size ETH_RX_BUF_SIZE  */
00178 #define ETH_TXBUFNB                    4U                  /* 4 Tx buffers of size ETH_TX_BUF_SIZE  */
00179 
00180 /* Section 2: PHY configuration section */
00181 
00182 /* DP83848 PHY Address*/
00183 #define DP83848_PHY_ADDRESS             0x01U
00184 /* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
00185 #define PHY_RESET_DELAY                 0x000000FFU
00186 /* PHY Configuration delay */
00187 #define PHY_CONFIG_DELAY                0x00000FFFU
00188 
00189 #define PHY_READ_TO                     0x0000FFFFU
00190 #define PHY_WRITE_TO                    0x0000FFFFU
00191 
00192 /* Section 3: Common PHY Registers */
00193 
00194 #define PHY_BCR                         ((uint16_t)0x0000)  /*!< Transceiver Basic Control Register   */
00195 #define PHY_BSR                         ((uint16_t)0x0001)  /*!< Transceiver Basic Status Register    */
00196 
00197 #define PHY_RESET                       ((uint16_t)0x8000)  /*!< PHY Reset */
00198 #define PHY_LOOPBACK                    ((uint16_t)0x4000)  /*!< Select loop-back mode */
00199 #define PHY_FULLDUPLEX_100M             ((uint16_t)0x2100)  /*!< Set the full-duplex mode at 100 Mb/s */
00200 #define PHY_HALFDUPLEX_100M             ((uint16_t)0x2000)  /*!< Set the half-duplex mode at 100 Mb/s */
00201 #define PHY_FULLDUPLEX_10M              ((uint16_t)0x0100)  /*!< Set the full-duplex mode at 10 Mb/s  */
00202 #define PHY_HALFDUPLEX_10M              ((uint16_t)0x0000)  /*!< Set the half-duplex mode at 10 Mb/s  */
00203 #define PHY_AUTONEGOTIATION             ((uint16_t)0x1000)  /*!< Enable auto-negotiation function     */
00204 #define PHY_RESTART_AUTONEGOTIATION     ((uint16_t)0x0200)  /*!< Restart auto-negotiation function    */
00205 #define PHY_POWERDOWN                   ((uint16_t)0x0800)  /*!< Select the power down mode           */
00206 #define PHY_ISOLATE                     ((uint16_t)0x0400)  /*!< Isolate PHY from MII                 */
00207 
00208 #define PHY_AUTONEGO_COMPLETE           ((uint16_t)0x0020)  /*!< Auto-Negotiation process completed   */
00209 #define PHY_LINKED_STATUS               ((uint16_t)0x0004)  /*!< Valid link established               */
00210 #define PHY_JABBER_DETECTION            ((uint16_t)0x0002)  /*!< Jabber condition detected            */
00211 
00212 /* Section 4: Extended PHY Registers */
00213 
00214 #define PHY_SR                          ((uint16_t)0x0010)  /*!< PHY status register Offset                      */
00215 #define PHY_MICR                        ((uint16_t)0x0011)  /*!< MII Interrupt Control Register                  */
00216 #define PHY_MISR                        ((uint16_t)0x0012)  /*!< MII Interrupt Status and Misc. Control Register */
00217 
00218 #define PHY_LINK_STATUS                 ((uint16_t)0x0001)  /*!< PHY Link mask                                   */
00219 #define PHY_SPEED_STATUS                ((uint16_t)0x0002)  /*!< PHY Speed mask                                  */
00220 #define PHY_DUPLEX_STATUS               ((uint16_t)0x0004)  /*!< PHY Duplex mask                                 */
00221 
00222 #define PHY_MICR_INT_EN                 ((uint16_t)0x0002)  /*!< PHY Enable interrupts                           */
00223 #define PHY_MICR_INT_OE                 ((uint16_t)0x0001)  /*!< PHY Enable output interrupt events              */
00224 
00225 #define PHY_MISR_LINK_INT_EN            ((uint16_t)0x0020)  /*!< Enable Interrupt on change of link status       */
00226 #define PHY_LINK_INTERRUPT              ((uint16_t)0x2000)  /*!< PHY link status interrupt mask                  */
00227 
00228 /* ################## SPI peripheral configuration ########################## */
00229 
00230 /* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver
00231 * Activated: CRC code is present inside driver
00232 * Deactivated: CRC code cleaned from driver
00233 */
00234 
00235 #define USE_SPI_CRC                     1U
00236 
00237 /* Includes ------------------------------------------------------------------*/
00238 /**
00239   * @brief Include module's header file
00240   */
00241 
00242 #ifdef HAL_RCC_MODULE_ENABLED
00243 #include "stm32f1xx_hal_rcc.h"
00244 #endif /* HAL_RCC_MODULE_ENABLED */
00245 
00246 #ifdef HAL_GPIO_MODULE_ENABLED
00247 #include "stm32f1xx_hal_gpio.h"
00248 #endif /* HAL_GPIO_MODULE_ENABLED */
00249 
00250 #ifdef HAL_EXTI_MODULE_ENABLED
00251 #include "stm32f1xx_hal_exti.h"
00252 #endif /* HAL_EXTI_MODULE_ENABLED */
00253 
00254 #ifdef HAL_DMA_MODULE_ENABLED
00255 #include "stm32f1xx_hal_dma.h"
00256 #endif /* HAL_DMA_MODULE_ENABLED */
00257 
00258 #ifdef HAL_ETH_MODULE_ENABLED
00259 #include "stm32f1xx_hal_eth.h"
00260 #endif /* HAL_ETH_MODULE_ENABLED */
00261 
00262 #ifdef HAL_CAN_MODULE_ENABLED
00263 #include "stm32f1xx_hal_can.h"
00264 #endif /* HAL_CAN_MODULE_ENABLED */
00265 
00266 #ifdef HAL_CAN_LEGACY_MODULE_ENABLED
00267   #include "Legacy/stm32f1xx_hal_can_legacy.h"
00268 #endif /* HAL_CAN_LEGACY_MODULE_ENABLED */
00269 
00270 #ifdef HAL_CEC_MODULE_ENABLED
00271 #include "stm32f1xx_hal_cec.h"
00272 #endif /* HAL_CEC_MODULE_ENABLED */
00273 
00274 #ifdef HAL_CORTEX_MODULE_ENABLED
00275 #include "stm32f1xx_hal_cortex.h"
00276 #endif /* HAL_CORTEX_MODULE_ENABLED */
00277 
00278 #ifdef HAL_ADC_MODULE_ENABLED
00279 #include "stm32f1xx_hal_adc.h"
00280 #endif /* HAL_ADC_MODULE_ENABLED */
00281 
00282 #ifdef HAL_CRC_MODULE_ENABLED
00283 #include "stm32f1xx_hal_crc.h"
00284 #endif /* HAL_CRC_MODULE_ENABLED */
00285 
00286 #ifdef HAL_DAC_MODULE_ENABLED
00287 #include "stm32f1xx_hal_dac.h"
00288 #endif /* HAL_DAC_MODULE_ENABLED */
00289 
00290 #ifdef HAL_FLASH_MODULE_ENABLED
00291 #include "stm32f1xx_hal_flash.h"
00292 #endif /* HAL_FLASH_MODULE_ENABLED */
00293 
00294 #ifdef HAL_SRAM_MODULE_ENABLED
00295 #include "stm32f1xx_hal_sram.h"
00296 #endif /* HAL_SRAM_MODULE_ENABLED */
00297 
00298 #ifdef HAL_NOR_MODULE_ENABLED
00299 #include "stm32f1xx_hal_nor.h"
00300 #endif /* HAL_NOR_MODULE_ENABLED */
00301 
00302 #ifdef HAL_I2C_MODULE_ENABLED
00303 #include "stm32f1xx_hal_i2c.h"
00304 #endif /* HAL_I2C_MODULE_ENABLED */
00305 
00306 #ifdef HAL_I2S_MODULE_ENABLED
00307 #include "stm32f1xx_hal_i2s.h"
00308 #endif /* HAL_I2S_MODULE_ENABLED */
00309 
00310 #ifdef HAL_IWDG_MODULE_ENABLED
00311 #include "stm32f1xx_hal_iwdg.h"
00312 #endif /* HAL_IWDG_MODULE_ENABLED */
00313 
00314 #ifdef HAL_PWR_MODULE_ENABLED
00315 #include "stm32f1xx_hal_pwr.h"
00316 #endif /* HAL_PWR_MODULE_ENABLED */
00317 
00318 #ifdef HAL_RTC_MODULE_ENABLED
00319 #include "stm32f1xx_hal_rtc.h"
00320 #endif /* HAL_RTC_MODULE_ENABLED */
00321 
00322 #ifdef HAL_PCCARD_MODULE_ENABLED
00323 #include "stm32f1xx_hal_pccard.h"
00324 #endif /* HAL_PCCARD_MODULE_ENABLED */
00325 
00326 #ifdef HAL_SD_MODULE_ENABLED
00327 #include "stm32f1xx_hal_sd.h"
00328 #endif /* HAL_SD_MODULE_ENABLED */
00329 
00330 #ifdef HAL_NAND_MODULE_ENABLED
00331 #include "stm32f1xx_hal_nand.h"
00332 #endif /* HAL_NAND_MODULE_ENABLED */
00333 
00334 #ifdef HAL_SPI_MODULE_ENABLED
00335 #include "stm32f1xx_hal_spi.h"
00336 #endif /* HAL_SPI_MODULE_ENABLED */
00337 
00338 #ifdef HAL_TIM_MODULE_ENABLED
00339 #include "stm32f1xx_hal_tim.h"
00340 #endif /* HAL_TIM_MODULE_ENABLED */
00341 
00342 #ifdef HAL_UART_MODULE_ENABLED
00343 #include "stm32f1xx_hal_uart.h"
00344 #endif /* HAL_UART_MODULE_ENABLED */
00345 
00346 #ifdef HAL_USART_MODULE_ENABLED
00347 #include "stm32f1xx_hal_usart.h"
00348 #endif /* HAL_USART_MODULE_ENABLED */
00349 
00350 #ifdef HAL_IRDA_MODULE_ENABLED
00351 #include "stm32f1xx_hal_irda.h"
00352 #endif /* HAL_IRDA_MODULE_ENABLED */
00353 
00354 #ifdef HAL_SMARTCARD_MODULE_ENABLED
00355 #include "stm32f1xx_hal_smartcard.h"
00356 #endif /* HAL_SMARTCARD_MODULE_ENABLED */
00357 
00358 #ifdef HAL_WWDG_MODULE_ENABLED
00359 #include "stm32f1xx_hal_wwdg.h"
00360 #endif /* HAL_WWDG_MODULE_ENABLED */
00361 
00362 #ifdef HAL_PCD_MODULE_ENABLED
00363 #include "stm32f1xx_hal_pcd.h"
00364 #endif /* HAL_PCD_MODULE_ENABLED */
00365 
00366 #ifdef HAL_HCD_MODULE_ENABLED
00367 #include "stm32f1xx_hal_hcd.h"
00368 #endif /* HAL_HCD_MODULE_ENABLED */
00369 
00370 #ifdef HAL_MMC_MODULE_ENABLED
00371 #include "stm32f1xx_hal_mmc.h"
00372 #endif /* HAL_MMC_MODULE_ENABLED */
00373 
00374 /* Exported macro ------------------------------------------------------------*/
00375 #ifdef  USE_FULL_ASSERT
00376 /**
00377   * @brief  The assert_param macro is used for function's parameters check.
00378   * @param  expr If expr is false, it calls assert_failed function
00379   *         which reports the name of the source file and the source
00380   *         line number of the call that failed.
00381   *         If expr is true, it returns no value.
00382   * @retval None
00383   */
00384 #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
00385 /* Exported functions ------------------------------------------------------- */
00386 void assert_failed(uint8_t* file, uint32_t line);
00387 #else
00388 #define assert_param(expr) ((void)0U)
00389 #endif /* USE_FULL_ASSERT */
00390 
00391 
00392 #ifdef __cplusplus
00393 }
00394 #endif
00395 
00396 #endif /* __STM32F1xx_HAL_CONF_H */
00397 
00398 
00399 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/