mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Wed Feb 20 22:31:08 2019 +0000
Revision:
189:f392fc9709a3
Parent:
180:96ed750bd169
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 144:ef7eb2e8f9f7 1 /**
<> 144:ef7eb2e8f9f7 2 ******************************************************************************
<> 144:ef7eb2e8f9f7 3 * @file stm32f0xx_hal.c
<> 144:ef7eb2e8f9f7 4 * @author MCD Application Team
<> 144:ef7eb2e8f9f7 5 * @brief HAL module driver.
<> 144:ef7eb2e8f9f7 6 * This is the common part of the HAL initialization
<> 144:ef7eb2e8f9f7 7 *
<> 144:ef7eb2e8f9f7 8 @verbatim
<> 144:ef7eb2e8f9f7 9 ==============================================================================
<> 144:ef7eb2e8f9f7 10 ##### How to use this driver #####
<> 144:ef7eb2e8f9f7 11 ==============================================================================
<> 144:ef7eb2e8f9f7 12 [..]
<> 144:ef7eb2e8f9f7 13 The common HAL driver contains a set of generic and common APIs that can be
<> 144:ef7eb2e8f9f7 14 used by the PPP peripheral drivers and the user to start using the HAL.
<> 144:ef7eb2e8f9f7 15 [..]
<> 144:ef7eb2e8f9f7 16 The HAL contains two APIs categories:
<> 144:ef7eb2e8f9f7 17 (+) HAL Initialization and de-initialization functions
<> 144:ef7eb2e8f9f7 18 (+) HAL Control functions
<> 144:ef7eb2e8f9f7 19
<> 144:ef7eb2e8f9f7 20 @endverbatim
<> 144:ef7eb2e8f9f7 21 ******************************************************************************
<> 144:ef7eb2e8f9f7 22 * @attention
<> 144:ef7eb2e8f9f7 23 *
<> 144:ef7eb2e8f9f7 24 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
<> 144:ef7eb2e8f9f7 25 *
<> 144:ef7eb2e8f9f7 26 * Redistribution and use in source and binary forms, with or without modification,
<> 144:ef7eb2e8f9f7 27 * are permitted provided that the following conditions are met:
<> 144:ef7eb2e8f9f7 28 * 1. Redistributions of source code must retain the above copyright notice,
<> 144:ef7eb2e8f9f7 29 * this list of conditions and the following disclaimer.
<> 144:ef7eb2e8f9f7 30 * 2. Redistributions in binary form must reproduce the above copyright notice,
<> 144:ef7eb2e8f9f7 31 * this list of conditions and the following disclaimer in the documentation
<> 144:ef7eb2e8f9f7 32 * and/or other materials provided with the distribution.
<> 144:ef7eb2e8f9f7 33 * 3. Neither the name of STMicroelectronics nor the names of its contributors
<> 144:ef7eb2e8f9f7 34 * may be used to endorse or promote products derived from this software
<> 144:ef7eb2e8f9f7 35 * without specific prior written permission.
<> 144:ef7eb2e8f9f7 36 *
<> 144:ef7eb2e8f9f7 37 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
<> 144:ef7eb2e8f9f7 38 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
<> 144:ef7eb2e8f9f7 39 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
<> 144:ef7eb2e8f9f7 40 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
<> 144:ef7eb2e8f9f7 41 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
<> 144:ef7eb2e8f9f7 42 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
<> 144:ef7eb2e8f9f7 43 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
<> 144:ef7eb2e8f9f7 44 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
<> 144:ef7eb2e8f9f7 45 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<> 144:ef7eb2e8f9f7 46 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<> 144:ef7eb2e8f9f7 47 *
<> 144:ef7eb2e8f9f7 48 ******************************************************************************
<> 144:ef7eb2e8f9f7 49 */
<> 144:ef7eb2e8f9f7 50
<> 144:ef7eb2e8f9f7 51 /* Includes ------------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 52 #include "stm32f0xx_hal.h"
<> 144:ef7eb2e8f9f7 53
<> 144:ef7eb2e8f9f7 54 /** @addtogroup STM32F0xx_HAL_Driver
<> 144:ef7eb2e8f9f7 55 * @{
<> 144:ef7eb2e8f9f7 56 */
<> 144:ef7eb2e8f9f7 57
<> 144:ef7eb2e8f9f7 58 /** @defgroup HAL HAL
<> 144:ef7eb2e8f9f7 59 * @brief HAL module driver.
<> 144:ef7eb2e8f9f7 60 * @{
<> 144:ef7eb2e8f9f7 61 */
<> 144:ef7eb2e8f9f7 62
<> 144:ef7eb2e8f9f7 63 #ifdef HAL_MODULE_ENABLED
<> 144:ef7eb2e8f9f7 64
<> 144:ef7eb2e8f9f7 65 /* Private typedef -----------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 66 /* Private define ------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 67 /** @defgroup HAL_Private_Constants HAL Private Constants
<> 144:ef7eb2e8f9f7 68 * @{
<> 144:ef7eb2e8f9f7 69 */
<> 144:ef7eb2e8f9f7 70 /**
Anna Bridge 180:96ed750bd169 71 * @brief STM32F0xx HAL Driver version number V1.7.0
<> 144:ef7eb2e8f9f7 72 */
<> 144:ef7eb2e8f9f7 73 #define __STM32F0xx_HAL_VERSION_MAIN (0x01) /*!< [31:24] main version */
Anna Bridge 180:96ed750bd169 74 #define __STM32F0xx_HAL_VERSION_SUB1 (0x07) /*!< [23:16] sub1 version */
<> 144:ef7eb2e8f9f7 75 #define __STM32F0xx_HAL_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
<> 144:ef7eb2e8f9f7 76 #define __STM32F0xx_HAL_VERSION_RC (0x00) /*!< [7:0] release candidate */
<> 156:95d6b41a828b 77 #define __STM32F0xx_HAL_VERSION ((__STM32F0xx_HAL_VERSION_MAIN << 24U)\
<> 156:95d6b41a828b 78 |(__STM32F0xx_HAL_VERSION_SUB1 << 16U)\
<> 156:95d6b41a828b 79 |(__STM32F0xx_HAL_VERSION_SUB2 << 8U )\
<> 144:ef7eb2e8f9f7 80 |(__STM32F0xx_HAL_VERSION_RC))
<> 144:ef7eb2e8f9f7 81
<> 156:95d6b41a828b 82 #define IDCODE_DEVID_MASK (0x00000FFFU)
<> 144:ef7eb2e8f9f7 83 /**
<> 144:ef7eb2e8f9f7 84 * @}
<> 144:ef7eb2e8f9f7 85 */
<> 144:ef7eb2e8f9f7 86
<> 144:ef7eb2e8f9f7 87 /* Private macro -------------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 88 /** @defgroup HAL_Private_Macros HAL Private Macros
<> 144:ef7eb2e8f9f7 89 * @{
<> 144:ef7eb2e8f9f7 90 */
<> 144:ef7eb2e8f9f7 91 /**
<> 144:ef7eb2e8f9f7 92 * @}
<> 144:ef7eb2e8f9f7 93 */
<> 144:ef7eb2e8f9f7 94
<> 144:ef7eb2e8f9f7 95 /* Private variables ---------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 96 /** @defgroup HAL_Private_Variables HAL Private Variables
<> 144:ef7eb2e8f9f7 97 * @{
<> 144:ef7eb2e8f9f7 98 */
<> 144:ef7eb2e8f9f7 99 __IO uint32_t uwTick;
<> 144:ef7eb2e8f9f7 100 /**
<> 144:ef7eb2e8f9f7 101 * @}
<> 144:ef7eb2e8f9f7 102 */
<> 144:ef7eb2e8f9f7 103 /* Private function prototypes -----------------------------------------------*/
<> 144:ef7eb2e8f9f7 104 /* Exported functions ---------------------------------------------------------*/
<> 144:ef7eb2e8f9f7 105
<> 144:ef7eb2e8f9f7 106 /** @defgroup HAL_Exported_Functions HAL Exported Functions
<> 144:ef7eb2e8f9f7 107 * @{
<> 144:ef7eb2e8f9f7 108 */
<> 144:ef7eb2e8f9f7 109
<> 144:ef7eb2e8f9f7 110 /** @defgroup HAL_Exported_Functions_Group1 Initialization and de-initialization Functions
<> 144:ef7eb2e8f9f7 111 * @brief Initialization and de-initialization functions
<> 144:ef7eb2e8f9f7 112 *
<> 144:ef7eb2e8f9f7 113 @verbatim
<> 144:ef7eb2e8f9f7 114 ===============================================================================
<> 144:ef7eb2e8f9f7 115 ##### Initialization and de-initialization functions #####
<> 144:ef7eb2e8f9f7 116 ===============================================================================
<> 144:ef7eb2e8f9f7 117 [..] This section provides functions allowing to:
<> 144:ef7eb2e8f9f7 118 (+) Initializes the Flash interface, the NVIC allocation and initial clock
<> 144:ef7eb2e8f9f7 119 configuration. It initializes the source of time base also when timeout
<> 144:ef7eb2e8f9f7 120 is needed and the backup domain when enabled.
<> 144:ef7eb2e8f9f7 121 (+) de-Initializes common part of the HAL.
<> 144:ef7eb2e8f9f7 122 (+) Configure The time base source to have 1ms time base with a dedicated
<> 144:ef7eb2e8f9f7 123 Tick interrupt priority.
<> 144:ef7eb2e8f9f7 124 (++) Systick timer is used by default as source of time base, but user
<> 144:ef7eb2e8f9f7 125 can eventually implement his proper time base source (a general purpose
<> 144:ef7eb2e8f9f7 126 timer for example or other time source), keeping in mind that Time base
<> 144:ef7eb2e8f9f7 127 duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
<> 144:ef7eb2e8f9f7 128 handled in milliseconds basis.
<> 144:ef7eb2e8f9f7 129 (++) Time base configuration function (HAL_InitTick ()) is called automatically
<> 144:ef7eb2e8f9f7 130 at the beginning of the program after reset by HAL_Init() or at any time
<> 144:ef7eb2e8f9f7 131 when clock is configured, by HAL_RCC_ClockConfig().
<> 144:ef7eb2e8f9f7 132 (++) Source of time base is configured to generate interrupts at regular
<> 144:ef7eb2e8f9f7 133 time intervals. Care must be taken if HAL_Delay() is called from a
<> 144:ef7eb2e8f9f7 134 peripheral ISR process, the Tick interrupt line must have higher priority
<> 144:ef7eb2e8f9f7 135 (numerically lower) than the peripheral interrupt. Otherwise the caller
<> 144:ef7eb2e8f9f7 136 ISR process will be blocked.
<> 144:ef7eb2e8f9f7 137 (++) functions affecting time base configurations are declared as __Weak
<> 144:ef7eb2e8f9f7 138 to make override possible in case of other implementations in user file.
<> 144:ef7eb2e8f9f7 139
<> 144:ef7eb2e8f9f7 140 @endverbatim
<> 144:ef7eb2e8f9f7 141 * @{
<> 144:ef7eb2e8f9f7 142 */
<> 144:ef7eb2e8f9f7 143
<> 144:ef7eb2e8f9f7 144 /**
<> 144:ef7eb2e8f9f7 145 * @brief This function configures the Flash prefetch,
<> 144:ef7eb2e8f9f7 146 * Configures time base source, NVIC and Low level hardware
<> 144:ef7eb2e8f9f7 147 * @note This function is called at the beginning of program after reset and before
<> 144:ef7eb2e8f9f7 148 * the clock configuration
<> 144:ef7eb2e8f9f7 149 * @note The time base configuration is based on HSI clock when exiting from Reset.
<> 144:ef7eb2e8f9f7 150 * Once done, time base tick start incrementing.
<> 144:ef7eb2e8f9f7 151 * In the default implementation,Systick is used as source of time base.
<> 144:ef7eb2e8f9f7 152 * The tick variable is incremented each 1ms in its ISR.
<> 144:ef7eb2e8f9f7 153 * @retval HAL status
<> 144:ef7eb2e8f9f7 154 */
<> 144:ef7eb2e8f9f7 155 HAL_StatusTypeDef HAL_Init(void)
<> 144:ef7eb2e8f9f7 156 {
<> 144:ef7eb2e8f9f7 157 /* Configure Flash prefetch */
<> 144:ef7eb2e8f9f7 158 #if (PREFETCH_ENABLE != 0)
<> 144:ef7eb2e8f9f7 159 __HAL_FLASH_PREFETCH_BUFFER_ENABLE();
<> 144:ef7eb2e8f9f7 160 #endif /* PREFETCH_ENABLE */
<> 144:ef7eb2e8f9f7 161
<> 144:ef7eb2e8f9f7 162 /* Use systick as time base source and configure 1ms tick (default clock after Reset is HSI) */
<> 144:ef7eb2e8f9f7 163
<> 144:ef7eb2e8f9f7 164 HAL_InitTick(TICK_INT_PRIORITY);
<> 144:ef7eb2e8f9f7 165
<> 144:ef7eb2e8f9f7 166 /* Init the low level hardware */
<> 144:ef7eb2e8f9f7 167 HAL_MspInit();
<> 144:ef7eb2e8f9f7 168
<> 144:ef7eb2e8f9f7 169 /* Return function status */
<> 144:ef7eb2e8f9f7 170 return HAL_OK;
<> 144:ef7eb2e8f9f7 171 }
<> 144:ef7eb2e8f9f7 172
<> 144:ef7eb2e8f9f7 173 /**
<> 144:ef7eb2e8f9f7 174 * @brief This function de-Initializes common part of the HAL and stops the source
<> 144:ef7eb2e8f9f7 175 * of time base.
<> 144:ef7eb2e8f9f7 176 * @note This function is optional.
<> 144:ef7eb2e8f9f7 177 * @retval HAL status
<> 144:ef7eb2e8f9f7 178 */
<> 144:ef7eb2e8f9f7 179 HAL_StatusTypeDef HAL_DeInit(void)
<> 144:ef7eb2e8f9f7 180 {
<> 144:ef7eb2e8f9f7 181 /* Reset of all peripherals */
<> 144:ef7eb2e8f9f7 182 __HAL_RCC_APB1_FORCE_RESET();
<> 144:ef7eb2e8f9f7 183 __HAL_RCC_APB1_RELEASE_RESET();
<> 144:ef7eb2e8f9f7 184
<> 144:ef7eb2e8f9f7 185 __HAL_RCC_APB2_FORCE_RESET();
<> 144:ef7eb2e8f9f7 186 __HAL_RCC_APB2_RELEASE_RESET();
<> 144:ef7eb2e8f9f7 187
<> 144:ef7eb2e8f9f7 188 __HAL_RCC_AHB_FORCE_RESET();
<> 144:ef7eb2e8f9f7 189 __HAL_RCC_AHB_RELEASE_RESET();
<> 144:ef7eb2e8f9f7 190
<> 144:ef7eb2e8f9f7 191 /* De-Init the low level hardware */
<> 144:ef7eb2e8f9f7 192 HAL_MspDeInit();
<> 144:ef7eb2e8f9f7 193
<> 144:ef7eb2e8f9f7 194 /* Return function status */
<> 144:ef7eb2e8f9f7 195 return HAL_OK;
<> 144:ef7eb2e8f9f7 196 }
<> 144:ef7eb2e8f9f7 197
<> 144:ef7eb2e8f9f7 198 /**
<> 144:ef7eb2e8f9f7 199 * @brief Initializes the MSP.
<> 144:ef7eb2e8f9f7 200 * @retval None
<> 144:ef7eb2e8f9f7 201 */
<> 144:ef7eb2e8f9f7 202 __weak void HAL_MspInit(void)
<> 144:ef7eb2e8f9f7 203 {
<> 144:ef7eb2e8f9f7 204 /* NOTE : This function Should not be modified, when the callback is needed,
<> 144:ef7eb2e8f9f7 205 the HAL_MspInit could be implemented in the user file
<> 144:ef7eb2e8f9f7 206 */
<> 144:ef7eb2e8f9f7 207 }
<> 144:ef7eb2e8f9f7 208
<> 144:ef7eb2e8f9f7 209 /**
<> 144:ef7eb2e8f9f7 210 * @brief DeInitializes the MSP.
<> 144:ef7eb2e8f9f7 211 * @retval None
<> 144:ef7eb2e8f9f7 212 */
<> 144:ef7eb2e8f9f7 213 __weak void HAL_MspDeInit(void)
<> 144:ef7eb2e8f9f7 214 {
<> 144:ef7eb2e8f9f7 215 /* NOTE : This function Should not be modified, when the callback is needed,
<> 144:ef7eb2e8f9f7 216 the HAL_MspDeInit could be implemented in the user file
<> 144:ef7eb2e8f9f7 217 */
<> 144:ef7eb2e8f9f7 218 }
<> 144:ef7eb2e8f9f7 219
<> 144:ef7eb2e8f9f7 220 /**
<> 144:ef7eb2e8f9f7 221 * @brief This function configures the source of the time base.
<> 144:ef7eb2e8f9f7 222 * The time source is configured to have 1ms time base with a dedicated
<> 144:ef7eb2e8f9f7 223 * Tick interrupt priority.
<> 144:ef7eb2e8f9f7 224 * @note This function is called automatically at the beginning of program after
<> 144:ef7eb2e8f9f7 225 * reset by HAL_Init() or at any time when clock is reconfigured by HAL_RCC_ClockConfig().
<> 144:ef7eb2e8f9f7 226 * @note In the default implementation, SysTick timer is the source of time base.
<> 144:ef7eb2e8f9f7 227 * It is used to generate interrupts at regular time intervals.
<> 144:ef7eb2e8f9f7 228 * Care must be taken if HAL_Delay() is called from a peripheral ISR process,
<> 144:ef7eb2e8f9f7 229 * The the SysTick interrupt must have higher priority (numerically lower)
<> 144:ef7eb2e8f9f7 230 * than the peripheral interrupt. Otherwise the caller ISR process will be blocked.
<> 144:ef7eb2e8f9f7 231 * The function is declared as __Weak to be overwritten in case of other
<> 144:ef7eb2e8f9f7 232 * implementation in user file.
Anna Bridge 180:96ed750bd169 233 * @param TickPriority Tick interrupt priority.
<> 144:ef7eb2e8f9f7 234 * @retval HAL status
<> 144:ef7eb2e8f9f7 235 */
<> 144:ef7eb2e8f9f7 236 __weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
<> 144:ef7eb2e8f9f7 237 {
<> 144:ef7eb2e8f9f7 238 /*Configure the SysTick to have interrupt in 1ms time basis*/
<> 156:95d6b41a828b 239 HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000U);
<> 144:ef7eb2e8f9f7 240
<> 144:ef7eb2e8f9f7 241 /*Configure the SysTick IRQ priority */
<> 156:95d6b41a828b 242 HAL_NVIC_SetPriority(SysTick_IRQn, TickPriority ,0U);
<> 144:ef7eb2e8f9f7 243
<> 144:ef7eb2e8f9f7 244 /* Return function status */
<> 144:ef7eb2e8f9f7 245 return HAL_OK;
<> 144:ef7eb2e8f9f7 246 }
<> 144:ef7eb2e8f9f7 247
<> 144:ef7eb2e8f9f7 248 /**
<> 144:ef7eb2e8f9f7 249 * @}
<> 144:ef7eb2e8f9f7 250 */
<> 144:ef7eb2e8f9f7 251
<> 144:ef7eb2e8f9f7 252 /** @defgroup HAL_Exported_Functions_Group2 HAL Control functions
<> 144:ef7eb2e8f9f7 253 * @brief HAL Control functions
<> 144:ef7eb2e8f9f7 254 *
<> 144:ef7eb2e8f9f7 255 @verbatim
<> 144:ef7eb2e8f9f7 256 ===============================================================================
<> 144:ef7eb2e8f9f7 257 ##### HAL Control functions #####
<> 144:ef7eb2e8f9f7 258 ===============================================================================
<> 144:ef7eb2e8f9f7 259 [..] This section provides functions allowing to:
<> 144:ef7eb2e8f9f7 260 (+) Provide a tick value in millisecond
<> 144:ef7eb2e8f9f7 261 (+) Provide a blocking delay in millisecond
<> 144:ef7eb2e8f9f7 262 (+) Suspend the time base source interrupt
<> 144:ef7eb2e8f9f7 263 (+) Resume the time base source interrupt
<> 144:ef7eb2e8f9f7 264 (+) Get the HAL API driver version
<> 144:ef7eb2e8f9f7 265 (+) Get the device identifier
<> 144:ef7eb2e8f9f7 266 (+) Get the device revision identifier
<> 144:ef7eb2e8f9f7 267 (+) Enable/Disable Debug module during Sleep mode
<> 144:ef7eb2e8f9f7 268 (+) Enable/Disable Debug module during STOP mode
<> 144:ef7eb2e8f9f7 269 (+) Enable/Disable Debug module during STANDBY mode
<> 144:ef7eb2e8f9f7 270
<> 144:ef7eb2e8f9f7 271 @endverbatim
<> 144:ef7eb2e8f9f7 272 * @{
<> 144:ef7eb2e8f9f7 273 */
<> 144:ef7eb2e8f9f7 274
<> 144:ef7eb2e8f9f7 275 /**
<> 144:ef7eb2e8f9f7 276 * @brief This function is called to increment a global variable "uwTick"
<> 144:ef7eb2e8f9f7 277 * used as application time base.
<> 144:ef7eb2e8f9f7 278 * @note In the default implementation, this variable is incremented each 1ms
<> 144:ef7eb2e8f9f7 279 * in Systick ISR.
<> 144:ef7eb2e8f9f7 280 * @note This function is declared as __weak to be overwritten in case of other
<> 144:ef7eb2e8f9f7 281 * implementations in user file.
<> 144:ef7eb2e8f9f7 282 * @retval None
<> 144:ef7eb2e8f9f7 283 */
<> 144:ef7eb2e8f9f7 284 __weak void HAL_IncTick(void)
<> 144:ef7eb2e8f9f7 285 {
<> 144:ef7eb2e8f9f7 286 uwTick++;
<> 144:ef7eb2e8f9f7 287 }
<> 144:ef7eb2e8f9f7 288
<> 144:ef7eb2e8f9f7 289 /**
<> 144:ef7eb2e8f9f7 290 * @brief Provides a tick value in millisecond.
<> 144:ef7eb2e8f9f7 291 * @note This function is declared as __weak to be overwritten in case of other
<> 144:ef7eb2e8f9f7 292 * implementations in user file.
<> 144:ef7eb2e8f9f7 293 * @retval tick value
<> 144:ef7eb2e8f9f7 294 */
<> 144:ef7eb2e8f9f7 295 __weak uint32_t HAL_GetTick(void)
<> 144:ef7eb2e8f9f7 296 {
<> 144:ef7eb2e8f9f7 297 return uwTick;
<> 144:ef7eb2e8f9f7 298 }
<> 144:ef7eb2e8f9f7 299
<> 144:ef7eb2e8f9f7 300 /**
<> 144:ef7eb2e8f9f7 301 * @brief This function provides accurate delay (in milliseconds) based
<> 144:ef7eb2e8f9f7 302 * on variable incremented.
<> 144:ef7eb2e8f9f7 303 * @note In the default implementation , SysTick timer is the source of time base.
<> 144:ef7eb2e8f9f7 304 * It is used to generate interrupts at regular time intervals where uwTick
<> 144:ef7eb2e8f9f7 305 * is incremented.
<> 144:ef7eb2e8f9f7 306 * @note ThiS function is declared as __weak to be overwritten in case of other
<> 144:ef7eb2e8f9f7 307 * implementations in user file.
Anna Bridge 180:96ed750bd169 308 * @param Delay specifies the delay time length, in milliseconds.
<> 144:ef7eb2e8f9f7 309 * @retval None
<> 144:ef7eb2e8f9f7 310 */
<> 144:ef7eb2e8f9f7 311 __weak void HAL_Delay(__IO uint32_t Delay)
<> 144:ef7eb2e8f9f7 312 {
Anna Bridge 180:96ed750bd169 313 uint32_t tickstart = HAL_GetTick();
Anna Bridge 180:96ed750bd169 314 uint32_t wait = Delay;
Anna Bridge 180:96ed750bd169 315
Anna Bridge 180:96ed750bd169 316 /* Add a period to guarantee minimum wait */
Anna Bridge 180:96ed750bd169 317 if (wait < HAL_MAX_DELAY)
Anna Bridge 180:96ed750bd169 318 {
Anna Bridge 180:96ed750bd169 319 wait++;
Anna Bridge 180:96ed750bd169 320 }
Anna Bridge 180:96ed750bd169 321
Anna Bridge 180:96ed750bd169 322 while((HAL_GetTick() - tickstart) < wait)
<> 144:ef7eb2e8f9f7 323 {
<> 144:ef7eb2e8f9f7 324 }
<> 144:ef7eb2e8f9f7 325 }
<> 144:ef7eb2e8f9f7 326
<> 144:ef7eb2e8f9f7 327 /**
<> 144:ef7eb2e8f9f7 328 * @brief Suspend Tick increment.
<> 144:ef7eb2e8f9f7 329 * @note In the default implementation , SysTick timer is the source of time base. It is
<> 144:ef7eb2e8f9f7 330 * used to generate interrupts at regular time intervals. Once HAL_SuspendTick()
<> 144:ef7eb2e8f9f7 331 * is called, the the SysTick interrupt will be disabled and so Tick increment
<> 144:ef7eb2e8f9f7 332 * is suspended.
<> 144:ef7eb2e8f9f7 333 * @note This function is declared as __weak to be overwritten in case of other
<> 144:ef7eb2e8f9f7 334 * implementations in user file.
<> 144:ef7eb2e8f9f7 335 * @retval None
<> 144:ef7eb2e8f9f7 336 */
<> 144:ef7eb2e8f9f7 337 __weak void HAL_SuspendTick(void)
<> 144:ef7eb2e8f9f7 338
<> 144:ef7eb2e8f9f7 339 {
<> 144:ef7eb2e8f9f7 340 /* Disable SysTick Interrupt */
<> 144:ef7eb2e8f9f7 341 CLEAR_BIT(SysTick->CTRL,SysTick_CTRL_TICKINT_Msk);
<> 144:ef7eb2e8f9f7 342 }
<> 144:ef7eb2e8f9f7 343
<> 144:ef7eb2e8f9f7 344 /**
<> 144:ef7eb2e8f9f7 345 * @brief Resume Tick increment.
<> 144:ef7eb2e8f9f7 346 * @note In the default implementation , SysTick timer is the source of time base. It is
<> 144:ef7eb2e8f9f7 347 * used to generate interrupts at regular time intervals. Once HAL_ResumeTick()
<> 144:ef7eb2e8f9f7 348 * is called, the the SysTick interrupt will be enabled and so Tick increment
<> 144:ef7eb2e8f9f7 349 * is resumed.
<> 144:ef7eb2e8f9f7 350 * @note This function is declared as __weak to be overwritten in case of other
<> 144:ef7eb2e8f9f7 351 * implementations in user file.
<> 144:ef7eb2e8f9f7 352 * @retval None
<> 144:ef7eb2e8f9f7 353 */
<> 144:ef7eb2e8f9f7 354 __weak void HAL_ResumeTick(void)
<> 144:ef7eb2e8f9f7 355 {
<> 144:ef7eb2e8f9f7 356 /* Enable SysTick Interrupt */
<> 144:ef7eb2e8f9f7 357 SET_BIT(SysTick->CTRL,SysTick_CTRL_TICKINT_Msk);
<> 144:ef7eb2e8f9f7 358 }
<> 144:ef7eb2e8f9f7 359
<> 144:ef7eb2e8f9f7 360 /**
<> 144:ef7eb2e8f9f7 361 * @brief This method returns the HAL revision
<> 144:ef7eb2e8f9f7 362 * @retval version : 0xXYZR (8bits for each decimal, R for RC)
<> 144:ef7eb2e8f9f7 363 */
<> 144:ef7eb2e8f9f7 364 uint32_t HAL_GetHalVersion(void)
<> 144:ef7eb2e8f9f7 365 {
<> 144:ef7eb2e8f9f7 366 return __STM32F0xx_HAL_VERSION;
<> 144:ef7eb2e8f9f7 367 }
<> 144:ef7eb2e8f9f7 368
<> 144:ef7eb2e8f9f7 369 /**
<> 144:ef7eb2e8f9f7 370 * @brief Returns the device revision identifier.
<> 144:ef7eb2e8f9f7 371 * @retval Device revision identifier
<> 144:ef7eb2e8f9f7 372 */
<> 144:ef7eb2e8f9f7 373 uint32_t HAL_GetREVID(void)
<> 144:ef7eb2e8f9f7 374 {
<> 156:95d6b41a828b 375 return((DBGMCU->IDCODE) >> 16U);
<> 144:ef7eb2e8f9f7 376 }
<> 144:ef7eb2e8f9f7 377
<> 144:ef7eb2e8f9f7 378 /**
<> 144:ef7eb2e8f9f7 379 * @brief Returns the device identifier.
<> 144:ef7eb2e8f9f7 380 * @retval Device identifier
<> 144:ef7eb2e8f9f7 381 */
<> 144:ef7eb2e8f9f7 382 uint32_t HAL_GetDEVID(void)
<> 144:ef7eb2e8f9f7 383 {
<> 144:ef7eb2e8f9f7 384 return((DBGMCU->IDCODE) & IDCODE_DEVID_MASK);
<> 144:ef7eb2e8f9f7 385 }
<> 144:ef7eb2e8f9f7 386
<> 144:ef7eb2e8f9f7 387 /**
Anna Bridge 180:96ed750bd169 388 * @brief Returns first word of the unique device identifier (UID based on 96 bits)
Anna Bridge 180:96ed750bd169 389 * @retval Device identifier
Anna Bridge 180:96ed750bd169 390 */
Anna Bridge 180:96ed750bd169 391 uint32_t HAL_GetUIDw0(void)
Anna Bridge 180:96ed750bd169 392 {
Anna Bridge 180:96ed750bd169 393 return(READ_REG(*((uint32_t *)UID_BASE)));
Anna Bridge 180:96ed750bd169 394 }
Anna Bridge 180:96ed750bd169 395
Anna Bridge 180:96ed750bd169 396 /**
Anna Bridge 180:96ed750bd169 397 * @brief Returns second word of the unique device identifier (UID based on 96 bits)
Anna Bridge 180:96ed750bd169 398 * @retval Device identifier
Anna Bridge 180:96ed750bd169 399 */
Anna Bridge 180:96ed750bd169 400 uint32_t HAL_GetUIDw1(void)
Anna Bridge 180:96ed750bd169 401 {
Anna Bridge 180:96ed750bd169 402 return(READ_REG(*((uint32_t *)(UID_BASE + 4U))));
Anna Bridge 180:96ed750bd169 403 }
Anna Bridge 180:96ed750bd169 404
Anna Bridge 180:96ed750bd169 405 /**
Anna Bridge 180:96ed750bd169 406 * @brief Returns third word of the unique device identifier (UID based on 96 bits)
Anna Bridge 180:96ed750bd169 407 * @retval Device identifier
Anna Bridge 180:96ed750bd169 408 */
Anna Bridge 180:96ed750bd169 409 uint32_t HAL_GetUIDw2(void)
Anna Bridge 180:96ed750bd169 410 {
Anna Bridge 180:96ed750bd169 411 return(READ_REG(*((uint32_t *)(UID_BASE + 8U))));
Anna Bridge 180:96ed750bd169 412 }
Anna Bridge 180:96ed750bd169 413
Anna Bridge 180:96ed750bd169 414 /**
<> 144:ef7eb2e8f9f7 415 * @brief Enable the Debug Module during STOP mode
<> 144:ef7eb2e8f9f7 416 * @retval None
<> 144:ef7eb2e8f9f7 417 */
<> 144:ef7eb2e8f9f7 418 void HAL_DBGMCU_EnableDBGStopMode(void)
<> 144:ef7eb2e8f9f7 419 {
<> 144:ef7eb2e8f9f7 420 SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP);
<> 144:ef7eb2e8f9f7 421 }
<> 144:ef7eb2e8f9f7 422
<> 144:ef7eb2e8f9f7 423 /**
<> 144:ef7eb2e8f9f7 424 * @brief Disable the Debug Module during STOP mode
<> 144:ef7eb2e8f9f7 425 * @retval None
<> 144:ef7eb2e8f9f7 426 */
<> 144:ef7eb2e8f9f7 427 void HAL_DBGMCU_DisableDBGStopMode(void)
<> 144:ef7eb2e8f9f7 428 {
<> 144:ef7eb2e8f9f7 429 CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP);
<> 144:ef7eb2e8f9f7 430 }
<> 144:ef7eb2e8f9f7 431
<> 144:ef7eb2e8f9f7 432 /**
<> 144:ef7eb2e8f9f7 433 * @brief Enable the Debug Module during STANDBY mode
<> 144:ef7eb2e8f9f7 434 * @retval None
<> 144:ef7eb2e8f9f7 435 */
<> 144:ef7eb2e8f9f7 436 void HAL_DBGMCU_EnableDBGStandbyMode(void)
<> 144:ef7eb2e8f9f7 437 {
<> 144:ef7eb2e8f9f7 438 SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY);
<> 144:ef7eb2e8f9f7 439 }
<> 144:ef7eb2e8f9f7 440
<> 144:ef7eb2e8f9f7 441 /**
<> 144:ef7eb2e8f9f7 442 * @brief Disable the Debug Module during STANDBY mode
<> 144:ef7eb2e8f9f7 443 * @retval None
<> 144:ef7eb2e8f9f7 444 */
<> 144:ef7eb2e8f9f7 445 void HAL_DBGMCU_DisableDBGStandbyMode(void)
<> 144:ef7eb2e8f9f7 446 {
<> 144:ef7eb2e8f9f7 447 CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY);
<> 144:ef7eb2e8f9f7 448 }
<> 144:ef7eb2e8f9f7 449
<> 144:ef7eb2e8f9f7 450 /**
<> 144:ef7eb2e8f9f7 451 * @}
<> 144:ef7eb2e8f9f7 452 */
<> 144:ef7eb2e8f9f7 453
<> 144:ef7eb2e8f9f7 454 /**
<> 144:ef7eb2e8f9f7 455 * @}
<> 144:ef7eb2e8f9f7 456 */
<> 144:ef7eb2e8f9f7 457
<> 144:ef7eb2e8f9f7 458 #endif /* HAL_MODULE_ENABLED */
<> 144:ef7eb2e8f9f7 459 /**
<> 144:ef7eb2e8f9f7 460 * @}
<> 144:ef7eb2e8f9f7 461 */
<> 144:ef7eb2e8f9f7 462
<> 144:ef7eb2e8f9f7 463 /**
<> 144:ef7eb2e8f9f7 464 * @}
<> 144:ef7eb2e8f9f7 465 */
<> 144:ef7eb2e8f9f7 466
<> 144:ef7eb2e8f9f7 467 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/