STM32F103xB HAL User Manual
stm32f1xx_hal.h
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32f1xx_hal.h
00004   * @author  MCD Application Team
00005   * @brief   This file contains all the functions prototypes for the HAL
00006   *          module driver.
00007   ******************************************************************************
00008   * @attention
00009   *
00010   * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
00011   * All rights reserved.</center></h2>
00012   *
00013   * This software component is licensed by ST under BSD 3-Clause license,
00014   * the "License"; You may not use this file except in compliance with the
00015   * License. You may obtain a copy of the License at:
00016   *                        opensource.org/licenses/BSD-3-Clause
00017   *
00018   ******************************************************************************
00019   */
00020 
00021 /* Define to prevent recursive inclusion -------------------------------------*/
00022 #ifndef __STM32F1xx_HAL_H
00023 #define __STM32F1xx_HAL_H
00024 
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028 
00029 /* Includes ------------------------------------------------------------------*/
00030 #include "stm32f1xx_hal_conf.h"
00031 
00032 /** @addtogroup STM32F1xx_HAL_Driver
00033   * @{
00034   */
00035 
00036 /** @addtogroup HAL
00037   * @{
00038   */
00039 
00040 /* Exported constants --------------------------------------------------------*/
00041 
00042 /** @defgroup HAL_Exported_Constants HAL Exported Constants
00043   * @{
00044   */
00045 
00046 /** @defgroup HAL_TICK_FREQ Tick Frequency
00047   * @{
00048   */
00049 typedef enum
00050 {
00051   HAL_TICK_FREQ_10HZ         = 100U,
00052   HAL_TICK_FREQ_100HZ        = 10U,
00053   HAL_TICK_FREQ_1KHZ         = 1U,
00054   HAL_TICK_FREQ_DEFAULT      = HAL_TICK_FREQ_1KHZ
00055 } HAL_TickFreqTypeDef;
00056 /**
00057   * @}
00058   */
00059 /* Exported types ------------------------------------------------------------*/
00060 extern __IO uint32_t uwTick;
00061 extern uint32_t uwTickPrio;
00062 extern HAL_TickFreqTypeDef uwTickFreq;
00063 
00064 /**
00065   * @}
00066   */
00067 /* Exported macro ------------------------------------------------------------*/
00068 /** @defgroup HAL_Exported_Macros HAL Exported Macros
00069   * @{
00070   */
00071 
00072 /** @defgroup DBGMCU_Freeze_Unfreeze Freeze Unfreeze Peripherals in Debug mode
00073   * @brief   Freeze/Unfreeze Peripherals in Debug mode
00074   * Note: On devices STM32F10xx8 and STM32F10xxB,
00075   *                  STM32F101xC/D/E and STM32F103xC/D/E,
00076   *                  STM32F101xF/G and STM32F103xF/G
00077   *                  STM32F10xx4 and STM32F10xx6
00078   *       Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in
00079   *       debug mode (not accessible by the user software in normal mode).
00080   *       Refer to errata sheet of these devices for more details.
00081   * @{
00082   */
00083 
00084 /* Peripherals on APB1 */
00085 /**
00086   * @brief  TIM2 Peripherals Debug mode
00087   */
00088 #define __HAL_DBGMCU_FREEZE_TIM2()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM2_STOP)
00089 #define __HAL_DBGMCU_UNFREEZE_TIM2()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM2_STOP)
00090 
00091 /**
00092   * @brief  TIM3 Peripherals Debug mode
00093   */
00094 #define __HAL_DBGMCU_FREEZE_TIM3()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM3_STOP)
00095 #define __HAL_DBGMCU_UNFREEZE_TIM3()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM3_STOP)
00096 
00097 #if defined (DBGMCU_CR_DBG_TIM4_STOP)
00098 /**
00099   * @brief  TIM4 Peripherals Debug mode
00100   */
00101 #define __HAL_DBGMCU_FREEZE_TIM4()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM4_STOP)
00102 #define __HAL_DBGMCU_UNFREEZE_TIM4()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM4_STOP)
00103 #endif
00104 
00105 #if defined (DBGMCU_CR_DBG_TIM5_STOP)
00106 /**
00107   * @brief  TIM5 Peripherals Debug mode
00108   */
00109 #define __HAL_DBGMCU_FREEZE_TIM5()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM5_STOP)
00110 #define __HAL_DBGMCU_UNFREEZE_TIM5()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM5_STOP)
00111 #endif
00112 
00113 #if defined (DBGMCU_CR_DBG_TIM6_STOP)
00114 /**
00115   * @brief  TIM6 Peripherals Debug mode
00116   */
00117 #define __HAL_DBGMCU_FREEZE_TIM6()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM6_STOP)
00118 #define __HAL_DBGMCU_UNFREEZE_TIM6()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM6_STOP)
00119 #endif
00120 
00121 #if defined (DBGMCU_CR_DBG_TIM7_STOP)
00122 /**
00123   * @brief  TIM7 Peripherals Debug mode
00124   */
00125 #define __HAL_DBGMCU_FREEZE_TIM7()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM7_STOP)
00126 #define __HAL_DBGMCU_UNFREEZE_TIM7()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM7_STOP)
00127 #endif
00128 
00129 #if defined (DBGMCU_CR_DBG_TIM12_STOP)
00130 /**
00131   * @brief  TIM12 Peripherals Debug mode
00132   */
00133 #define __HAL_DBGMCU_FREEZE_TIM12()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM12_STOP)
00134 #define __HAL_DBGMCU_UNFREEZE_TIM12()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM12_STOP)
00135 #endif
00136 
00137 #if defined (DBGMCU_CR_DBG_TIM13_STOP)
00138 /**
00139   * @brief  TIM13 Peripherals Debug mode
00140   */
00141 #define __HAL_DBGMCU_FREEZE_TIM13()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM13_STOP)
00142 #define __HAL_DBGMCU_UNFREEZE_TIM13()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM13_STOP)
00143 #endif
00144 
00145 #if defined (DBGMCU_CR_DBG_TIM14_STOP)
00146 /**
00147   * @brief  TIM14 Peripherals Debug mode
00148   */
00149 #define __HAL_DBGMCU_FREEZE_TIM14()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM14_STOP)
00150 #define __HAL_DBGMCU_UNFREEZE_TIM14()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM14_STOP)
00151 #endif
00152 
00153 /**
00154   * @brief  WWDG Peripherals Debug mode
00155   */
00156 #define __HAL_DBGMCU_FREEZE_WWDG()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_WWDG_STOP)
00157 #define __HAL_DBGMCU_UNFREEZE_WWDG()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_WWDG_STOP)
00158 
00159 /**
00160   * @brief  IWDG Peripherals Debug mode
00161   */
00162 #define __HAL_DBGMCU_FREEZE_IWDG()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_IWDG_STOP)
00163 #define __HAL_DBGMCU_UNFREEZE_IWDG()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_IWDG_STOP)
00164 
00165 /**
00166   * @brief  I2C1 Peripherals Debug mode
00167   */
00168 #define __HAL_DBGMCU_FREEZE_I2C1_TIMEOUT()    SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C1_SMBUS_TIMEOUT)
00169 #define __HAL_DBGMCU_UNFREEZE_I2C1_TIMEOUT()  CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C1_SMBUS_TIMEOUT)
00170 
00171 #if defined (DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT)
00172 /**
00173   * @brief  I2C2 Peripherals Debug mode
00174   */
00175 #define __HAL_DBGMCU_FREEZE_I2C2_TIMEOUT()    SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT)
00176 #define __HAL_DBGMCU_UNFREEZE_I2C2_TIMEOUT()  CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_I2C2_SMBUS_TIMEOUT)
00177 #endif
00178 
00179 #if defined (DBGMCU_CR_DBG_CAN1_STOP)
00180 /**
00181   * @brief  CAN1 Peripherals Debug mode
00182   */
00183 #define __HAL_DBGMCU_FREEZE_CAN1()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN1_STOP)
00184 #define __HAL_DBGMCU_UNFREEZE_CAN1()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN1_STOP)
00185 #endif
00186 
00187 #if defined (DBGMCU_CR_DBG_CAN2_STOP)
00188 /**
00189   * @brief  CAN2 Peripherals Debug mode
00190   */
00191 #define __HAL_DBGMCU_FREEZE_CAN2()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN2_STOP)
00192 #define __HAL_DBGMCU_UNFREEZE_CAN2()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_CAN2_STOP)
00193 #endif
00194 
00195 /* Peripherals on APB2 */
00196 #if defined (DBGMCU_CR_DBG_TIM1_STOP)
00197 /**
00198   * @brief  TIM1 Peripherals Debug mode
00199   */
00200 #define __HAL_DBGMCU_FREEZE_TIM1()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM1_STOP)
00201 #define __HAL_DBGMCU_UNFREEZE_TIM1()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM1_STOP)
00202 #endif
00203 
00204 #if defined (DBGMCU_CR_DBG_TIM8_STOP)
00205 /**
00206   * @brief  TIM8 Peripherals Debug mode
00207   */
00208 #define __HAL_DBGMCU_FREEZE_TIM8()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM8_STOP)
00209 #define __HAL_DBGMCU_UNFREEZE_TIM8()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM8_STOP)
00210 #endif
00211 
00212 #if defined (DBGMCU_CR_DBG_TIM9_STOP)
00213 /**
00214   * @brief  TIM9 Peripherals Debug mode
00215   */
00216 #define __HAL_DBGMCU_FREEZE_TIM9()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM9_STOP)
00217 #define __HAL_DBGMCU_UNFREEZE_TIM9()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM9_STOP)
00218 #endif
00219 
00220 #if defined (DBGMCU_CR_DBG_TIM10_STOP)
00221 /**
00222   * @brief  TIM10 Peripherals Debug mode
00223   */
00224 #define __HAL_DBGMCU_FREEZE_TIM10()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM10_STOP)
00225 #define __HAL_DBGMCU_UNFREEZE_TIM10()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM10_STOP)
00226 #endif
00227 
00228 #if defined (DBGMCU_CR_DBG_TIM11_STOP)
00229 /**
00230   * @brief  TIM11 Peripherals Debug mode
00231   */
00232 #define __HAL_DBGMCU_FREEZE_TIM11()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM11_STOP)
00233 #define __HAL_DBGMCU_UNFREEZE_TIM11()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM11_STOP)
00234 #endif
00235 
00236 
00237 #if defined (DBGMCU_CR_DBG_TIM15_STOP)
00238 /**
00239   * @brief  TIM15 Peripherals Debug mode
00240   */
00241 #define __HAL_DBGMCU_FREEZE_TIM15()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM15_STOP)
00242 #define __HAL_DBGMCU_UNFREEZE_TIM15()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM15_STOP)
00243 #endif
00244 
00245 #if defined (DBGMCU_CR_DBG_TIM16_STOP)
00246 /**
00247   * @brief  TIM16 Peripherals Debug mode
00248   */
00249 #define __HAL_DBGMCU_FREEZE_TIM16()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM16_STOP)
00250 #define __HAL_DBGMCU_UNFREEZE_TIM16()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM16_STOP)
00251 #endif
00252 
00253 #if defined (DBGMCU_CR_DBG_TIM17_STOP)
00254 /**
00255   * @brief  TIM17 Peripherals Debug mode
00256   */
00257 #define __HAL_DBGMCU_FREEZE_TIM17()            SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM17_STOP)
00258 #define __HAL_DBGMCU_UNFREEZE_TIM17()          CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_TIM17_STOP)
00259 #endif
00260 
00261 /**
00262   * @}
00263   */
00264 
00265 /** @defgroup HAL_Private_Macros HAL Private Macros
00266   * @{
00267   */
00268 #define IS_TICKFREQ(FREQ) (((FREQ) == HAL_TICK_FREQ_10HZ)  || \
00269                            ((FREQ) == HAL_TICK_FREQ_100HZ) || \
00270                            ((FREQ) == HAL_TICK_FREQ_1KHZ))
00271 /**
00272   * @}
00273   */
00274 
00275 /* Exported functions --------------------------------------------------------*/
00276 /** @addtogroup HAL_Exported_Functions
00277   * @{
00278   */
00279 /** @addtogroup HAL_Exported_Functions_Group1
00280   * @{
00281   */
00282 /* Initialization and de-initialization functions  ******************************/
00283 HAL_StatusTypeDef HAL_Init(void);
00284 HAL_StatusTypeDef HAL_DeInit(void);
00285 void HAL_MspInit(void);
00286 void HAL_MspDeInit(void);
00287 HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority);
00288 /**
00289   * @}
00290   */
00291 
00292 /** @addtogroup HAL_Exported_Functions_Group2
00293   * @{
00294   */
00295 /* Peripheral Control functions  ************************************************/
00296 void HAL_IncTick(void);
00297 void HAL_Delay(uint32_t Delay);
00298 uint32_t HAL_GetTick(void);
00299 uint32_t HAL_GetTickPrio(void);
00300 HAL_StatusTypeDef HAL_SetTickFreq(HAL_TickFreqTypeDef Freq);
00301 HAL_TickFreqTypeDef HAL_GetTickFreq(void);
00302 void HAL_SuspendTick(void);
00303 void HAL_ResumeTick(void);
00304 uint32_t HAL_GetHalVersion(void);
00305 uint32_t HAL_GetREVID(void);
00306 uint32_t HAL_GetDEVID(void);
00307 uint32_t HAL_GetUIDw0(void);
00308 uint32_t HAL_GetUIDw1(void);
00309 uint32_t HAL_GetUIDw2(void);
00310 void HAL_DBGMCU_EnableDBGSleepMode(void);
00311 void HAL_DBGMCU_DisableDBGSleepMode(void);
00312 void HAL_DBGMCU_EnableDBGStopMode(void);
00313 void HAL_DBGMCU_DisableDBGStopMode(void);
00314 void HAL_DBGMCU_EnableDBGStandbyMode(void);
00315 void HAL_DBGMCU_DisableDBGStandbyMode(void);
00316 /**
00317   * @}
00318   */
00319 
00320 /**
00321   * @}
00322   */
00323 
00324 /**
00325   * @}
00326   */
00327 /* Private types -------------------------------------------------------------*/
00328 /* Private variables ---------------------------------------------------------*/
00329 /** @defgroup HAL_Private_Variables HAL Private Variables
00330   * @{
00331   */
00332 /**
00333   * @}
00334   */
00335 /* Private constants ---------------------------------------------------------*/
00336 /** @defgroup HAL_Private_Constants HAL Private Constants
00337   * @{
00338   */
00339 /**
00340   * @}
00341   */
00342 /* Private macros ------------------------------------------------------------*/
00343 /* Private functions ---------------------------------------------------------*/
00344 /**
00345   * @}
00346   */
00347 
00348 /**
00349   * @}
00350   */
00351 
00352 #ifdef __cplusplus
00353 }
00354 #endif
00355 
00356 #endif /* __STM32F1xx_HAL_H */
00357 
00358 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/