Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: SPIne CH_Communicatuin_Test CH_Communicatuin_Test2 MCP_SPIne ... more
Fork of mbed-dev-f303 by
targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal.c@165:e614a9f1c9e2, 2017-05-26 (annotated)
- Committer:
- AnnaBridge
- Date:
- Fri May 26 12:39:01 2017 +0100
- Revision:
- 165:e614a9f1c9e2
- Parent:
- 154:37f96f9d4de2
This updates the lib to the mbed lib v 143
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| <> | 144:ef7eb2e8f9f7 | 1 | /** |
| <> | 144:ef7eb2e8f9f7 | 2 | ****************************************************************************** |
| <> | 144:ef7eb2e8f9f7 | 3 | * @file stm32f1xx_hal.c |
| <> | 144:ef7eb2e8f9f7 | 4 | * @author MCD Application Team |
| AnnaBridge | 165:e614a9f1c9e2 | 5 | * @version V1.1.0 |
| AnnaBridge | 165:e614a9f1c9e2 | 6 | * @date 14-April-2017 |
| <> | 144:ef7eb2e8f9f7 | 7 | * @brief HAL module driver. |
| <> | 144:ef7eb2e8f9f7 | 8 | * This is the common part of the HAL initialization |
| <> | 144:ef7eb2e8f9f7 | 9 | * |
| <> | 144:ef7eb2e8f9f7 | 10 | @verbatim |
| <> | 144:ef7eb2e8f9f7 | 11 | ============================================================================== |
| <> | 144:ef7eb2e8f9f7 | 12 | ##### How to use this driver ##### |
| <> | 144:ef7eb2e8f9f7 | 13 | ============================================================================== |
| <> | 144:ef7eb2e8f9f7 | 14 | [..] |
| <> | 144:ef7eb2e8f9f7 | 15 | The common HAL driver contains a set of generic and common APIs that can be |
| <> | 144:ef7eb2e8f9f7 | 16 | used by the PPP peripheral drivers and the user to start using the HAL. |
| <> | 144:ef7eb2e8f9f7 | 17 | [..] |
| <> | 144:ef7eb2e8f9f7 | 18 | The HAL contains two APIs' categories: |
| <> | 144:ef7eb2e8f9f7 | 19 | (+) Common HAL APIs |
| <> | 144:ef7eb2e8f9f7 | 20 | (+) Services HAL APIs |
| <> | 144:ef7eb2e8f9f7 | 21 | |
| <> | 144:ef7eb2e8f9f7 | 22 | @endverbatim |
| <> | 144:ef7eb2e8f9f7 | 23 | ****************************************************************************** |
| <> | 144:ef7eb2e8f9f7 | 24 | * @attention |
| <> | 144:ef7eb2e8f9f7 | 25 | * |
| <> | 144:ef7eb2e8f9f7 | 26 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
| <> | 144:ef7eb2e8f9f7 | 27 | * |
| <> | 144:ef7eb2e8f9f7 | 28 | * Redistribution and use in source and binary forms, with or without modification, |
| <> | 144:ef7eb2e8f9f7 | 29 | * are permitted provided that the following conditions are met: |
| <> | 144:ef7eb2e8f9f7 | 30 | * 1. Redistributions of source code must retain the above copyright notice, |
| <> | 144:ef7eb2e8f9f7 | 31 | * this list of conditions and the following disclaimer. |
| <> | 144:ef7eb2e8f9f7 | 32 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| <> | 144:ef7eb2e8f9f7 | 33 | * this list of conditions and the following disclaimer in the documentation |
| <> | 144:ef7eb2e8f9f7 | 34 | * and/or other materials provided with the distribution. |
| <> | 144:ef7eb2e8f9f7 | 35 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
| <> | 144:ef7eb2e8f9f7 | 36 | * may be used to endorse or promote products derived from this software |
| <> | 144:ef7eb2e8f9f7 | 37 | * without specific prior written permission. |
| <> | 144:ef7eb2e8f9f7 | 38 | * |
| <> | 144:ef7eb2e8f9f7 | 39 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| <> | 144:ef7eb2e8f9f7 | 40 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| <> | 144:ef7eb2e8f9f7 | 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| <> | 144:ef7eb2e8f9f7 | 42 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| <> | 144:ef7eb2e8f9f7 | 43 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| <> | 144:ef7eb2e8f9f7 | 44 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| <> | 144:ef7eb2e8f9f7 | 45 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| <> | 144:ef7eb2e8f9f7 | 46 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| <> | 144:ef7eb2e8f9f7 | 47 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| <> | 144:ef7eb2e8f9f7 | 48 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| <> | 144:ef7eb2e8f9f7 | 49 | * |
| <> | 144:ef7eb2e8f9f7 | 50 | ****************************************************************************** |
| <> | 144:ef7eb2e8f9f7 | 51 | */ |
| <> | 144:ef7eb2e8f9f7 | 52 | |
| <> | 144:ef7eb2e8f9f7 | 53 | /* Includes ------------------------------------------------------------------*/ |
| <> | 144:ef7eb2e8f9f7 | 54 | #include "stm32f1xx_hal.h" |
| <> | 144:ef7eb2e8f9f7 | 55 | |
| <> | 144:ef7eb2e8f9f7 | 56 | /** @addtogroup STM32F1xx_HAL_Driver |
| <> | 144:ef7eb2e8f9f7 | 57 | * @{ |
| <> | 144:ef7eb2e8f9f7 | 58 | */ |
| <> | 144:ef7eb2e8f9f7 | 59 | |
| <> | 144:ef7eb2e8f9f7 | 60 | /** @defgroup HAL HAL |
| <> | 144:ef7eb2e8f9f7 | 61 | * @brief HAL module driver. |
| <> | 144:ef7eb2e8f9f7 | 62 | * @{ |
| <> | 144:ef7eb2e8f9f7 | 63 | */ |
| <> | 144:ef7eb2e8f9f7 | 64 | |
| <> | 144:ef7eb2e8f9f7 | 65 | #ifdef HAL_MODULE_ENABLED |
| <> | 144:ef7eb2e8f9f7 | 66 | |
| <> | 144:ef7eb2e8f9f7 | 67 | /* Private typedef -----------------------------------------------------------*/ |
| <> | 144:ef7eb2e8f9f7 | 68 | /* Private define ------------------------------------------------------------*/ |
| <> | 144:ef7eb2e8f9f7 | 69 | |
| <> | 144:ef7eb2e8f9f7 | 70 | /** @defgroup HAL_Private_Constants HAL Private Constants |
| <> | 144:ef7eb2e8f9f7 | 71 | * @{ |
| <> | 144:ef7eb2e8f9f7 | 72 | */ |
| <> | 144:ef7eb2e8f9f7 | 73 | /** |
| AnnaBridge | 165:e614a9f1c9e2 | 74 | * @brief STM32F1xx HAL Driver version number V1.1.0 |
| <> | 144:ef7eb2e8f9f7 | 75 | */ |
| AnnaBridge | 165:e614a9f1c9e2 | 76 | #define __STM32F1xx_HAL_VERSION_MAIN (0x01U) /*!< [31:24] main version */ |
| AnnaBridge | 165:e614a9f1c9e2 | 77 | #define __STM32F1xx_HAL_VERSION_SUB1 (0x01U) /*!< [23:16] sub1 version */ |
| AnnaBridge | 165:e614a9f1c9e2 | 78 | #define __STM32F1xx_HAL_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */ |
| AnnaBridge | 165:e614a9f1c9e2 | 79 | #define __STM32F1xx_HAL_VERSION_RC (0x00U) /*!< [7:0] release candidate */ |
| <> | 144:ef7eb2e8f9f7 | 80 | #define __STM32F1xx_HAL_VERSION ((__STM32F1xx_HAL_VERSION_MAIN << 24)\ |
| <> | 144:ef7eb2e8f9f7 | 81 | |(__STM32F1xx_HAL_VERSION_SUB1 << 16)\ |
| <> | 144:ef7eb2e8f9f7 | 82 | |(__STM32F1xx_HAL_VERSION_SUB2 << 8 )\ |
| <> | 144:ef7eb2e8f9f7 | 83 | |(__STM32F1xx_HAL_VERSION_RC)) |
| <> | 144:ef7eb2e8f9f7 | 84 | |
| AnnaBridge | 165:e614a9f1c9e2 | 85 | #define IDCODE_DEVID_MASK 0x00000FFFU |
| <> | 144:ef7eb2e8f9f7 | 86 | |
| <> | 144:ef7eb2e8f9f7 | 87 | /** |
| <> | 144:ef7eb2e8f9f7 | 88 | * @} |
| <> | 144:ef7eb2e8f9f7 | 89 | */ |
| <> | 144:ef7eb2e8f9f7 | 90 | |
| <> | 144:ef7eb2e8f9f7 | 91 | /* Private macro -------------------------------------------------------------*/ |
| <> | 144:ef7eb2e8f9f7 | 92 | /* Private variables ---------------------------------------------------------*/ |
| <> | 144:ef7eb2e8f9f7 | 93 | |
| <> | 144:ef7eb2e8f9f7 | 94 | /** @defgroup HAL_Private_Variables HAL Private Variables |
| <> | 144:ef7eb2e8f9f7 | 95 | * @{ |
| <> | 144:ef7eb2e8f9f7 | 96 | */ |
| AnnaBridge | 165:e614a9f1c9e2 | 97 | __IO uint32_t uwTick; |
| <> | 144:ef7eb2e8f9f7 | 98 | /** |
| <> | 144:ef7eb2e8f9f7 | 99 | * @} |
| <> | 144:ef7eb2e8f9f7 | 100 | */ |
| <> | 144:ef7eb2e8f9f7 | 101 | /* Private function prototypes -----------------------------------------------*/ |
| <> | 144:ef7eb2e8f9f7 | 102 | /* Exported functions ---------------------------------------------------------*/ |
| <> | 144:ef7eb2e8f9f7 | 103 | |
| <> | 144:ef7eb2e8f9f7 | 104 | /** @defgroup HAL_Exported_Functions HAL Exported Functions |
| <> | 144:ef7eb2e8f9f7 | 105 | * @{ |
| <> | 144:ef7eb2e8f9f7 | 106 | */ |
| <> | 144:ef7eb2e8f9f7 | 107 | |
| <> | 144:ef7eb2e8f9f7 | 108 | /** @defgroup HAL_Exported_Functions_Group1 Initialization and de-initialization Functions |
| <> | 144:ef7eb2e8f9f7 | 109 | * @brief Initialization and de-initialization functions |
| <> | 144:ef7eb2e8f9f7 | 110 | * |
| <> | 144:ef7eb2e8f9f7 | 111 | @verbatim |
| <> | 144:ef7eb2e8f9f7 | 112 | =============================================================================== |
| <> | 144:ef7eb2e8f9f7 | 113 | ##### Initialization and de-initialization functions ##### |
| <> | 144:ef7eb2e8f9f7 | 114 | =============================================================================== |
| <> | 144:ef7eb2e8f9f7 | 115 | [..] This section provides functions allowing to: |
| <> | 144:ef7eb2e8f9f7 | 116 | (+) Initializes the Flash interface, the NVIC allocation and initial clock |
| <> | 144:ef7eb2e8f9f7 | 117 | configuration. It initializes the source of time base also when timeout |
| <> | 144:ef7eb2e8f9f7 | 118 | is needed and the backup domain when enabled. |
| <> | 144:ef7eb2e8f9f7 | 119 | (+) de-Initializes common part of the HAL. |
| <> | 144:ef7eb2e8f9f7 | 120 | (+) Configure The time base source to have 1ms time base with a dedicated |
| <> | 144:ef7eb2e8f9f7 | 121 | Tick interrupt priority. |
| <> | 144:ef7eb2e8f9f7 | 122 | (++) Systick timer is used by default as source of time base, but user |
| <> | 144:ef7eb2e8f9f7 | 123 | can eventually implement his proper time base source (a general purpose |
| <> | 144:ef7eb2e8f9f7 | 124 | timer for example or other time source), keeping in mind that Time base |
| <> | 144:ef7eb2e8f9f7 | 125 | duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and |
| <> | 144:ef7eb2e8f9f7 | 126 | handled in milliseconds basis. |
| <> | 144:ef7eb2e8f9f7 | 127 | (++) Time base configuration function (HAL_InitTick ()) is called automatically |
| <> | 144:ef7eb2e8f9f7 | 128 | at the beginning of the program after reset by HAL_Init() or at any time |
| <> | 144:ef7eb2e8f9f7 | 129 | when clock is configured, by HAL_RCC_ClockConfig(). |
| <> | 144:ef7eb2e8f9f7 | 130 | (++) Source of time base is configured to generate interrupts at regular |
| <> | 144:ef7eb2e8f9f7 | 131 | time intervals. Care must be taken if HAL_Delay() is called from a |
| <> | 144:ef7eb2e8f9f7 | 132 | peripheral ISR process, the Tick interrupt line must have higher priority |
| <> | 144:ef7eb2e8f9f7 | 133 | (numerically lower) than the peripheral interrupt. Otherwise the caller |
| <> | 144:ef7eb2e8f9f7 | 134 | ISR process will be blocked. |
| AnnaBridge | 165:e614a9f1c9e2 | 135 | (++) functions affecting time base configurations are declared as __weak |
| <> | 144:ef7eb2e8f9f7 | 136 | to make override possible in case of other implementations in user file. |
| <> | 144:ef7eb2e8f9f7 | 137 | @endverbatim |
| <> | 144:ef7eb2e8f9f7 | 138 | * @{ |
| <> | 144:ef7eb2e8f9f7 | 139 | */ |
| <> | 144:ef7eb2e8f9f7 | 140 | |
| <> | 144:ef7eb2e8f9f7 | 141 | /** |
| AnnaBridge | 165:e614a9f1c9e2 | 142 | * @brief This function is used to initialize the HAL Library; it must be the first |
| AnnaBridge | 165:e614a9f1c9e2 | 143 | * instruction to be executed in the main program (before to call any other |
| AnnaBridge | 165:e614a9f1c9e2 | 144 | * HAL function), it performs the following: |
| AnnaBridge | 165:e614a9f1c9e2 | 145 | * Configure the Flash prefetch. |
| AnnaBridge | 165:e614a9f1c9e2 | 146 | * Configures the SysTick to generate an interrupt each 1 millisecond, |
| AnnaBridge | 165:e614a9f1c9e2 | 147 | * which is clocked by the HSI (at this stage, the clock is not yet |
| AnnaBridge | 165:e614a9f1c9e2 | 148 | * configured and thus the system is running from the internal HSI at 16 MHz). |
| AnnaBridge | 165:e614a9f1c9e2 | 149 | * Set NVIC Group Priority to 4. |
| AnnaBridge | 165:e614a9f1c9e2 | 150 | * Calls the HAL_MspInit() callback function defined in user file |
| AnnaBridge | 165:e614a9f1c9e2 | 151 | * "stm32f1xx_hal_msp.c" to do the global low level hardware initialization |
| AnnaBridge | 165:e614a9f1c9e2 | 152 | * |
| AnnaBridge | 165:e614a9f1c9e2 | 153 | * @note SysTick is used as time base for the HAL_Delay() function, the application |
| AnnaBridge | 165:e614a9f1c9e2 | 154 | * need to ensure that the SysTick time base is always set to 1 millisecond |
| AnnaBridge | 165:e614a9f1c9e2 | 155 | * to have correct HAL operation. |
| <> | 144:ef7eb2e8f9f7 | 156 | * @retval HAL status |
| <> | 144:ef7eb2e8f9f7 | 157 | */ |
| <> | 144:ef7eb2e8f9f7 | 158 | HAL_StatusTypeDef HAL_Init(void) |
| <> | 144:ef7eb2e8f9f7 | 159 | { |
| <> | 144:ef7eb2e8f9f7 | 160 | /* Configure Flash prefetch */ |
| <> | 144:ef7eb2e8f9f7 | 161 | #if (PREFETCH_ENABLE != 0) |
| <> | 144:ef7eb2e8f9f7 | 162 | #if defined(STM32F101x6) || defined(STM32F101xB) || defined(STM32F101xE) || defined(STM32F101xG) || \ |
| <> | 144:ef7eb2e8f9f7 | 163 | defined(STM32F102x6) || defined(STM32F102xB) || \ |
| <> | 144:ef7eb2e8f9f7 | 164 | defined(STM32F103x6) || defined(STM32F103xB) || defined(STM32F103xE) || defined(STM32F103xG) || \ |
| <> | 144:ef7eb2e8f9f7 | 165 | defined(STM32F105xC) || defined(STM32F107xC) |
| <> | 144:ef7eb2e8f9f7 | 166 | |
| <> | 144:ef7eb2e8f9f7 | 167 | /* Prefetch buffer is not available on value line devices */ |
| <> | 144:ef7eb2e8f9f7 | 168 | __HAL_FLASH_PREFETCH_BUFFER_ENABLE(); |
| <> | 144:ef7eb2e8f9f7 | 169 | #endif |
| <> | 144:ef7eb2e8f9f7 | 170 | #endif /* PREFETCH_ENABLE */ |
| <> | 144:ef7eb2e8f9f7 | 171 | |
| <> | 144:ef7eb2e8f9f7 | 172 | /* Set Interrupt Group Priority */ |
| <> | 144:ef7eb2e8f9f7 | 173 | HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); |
| <> | 144:ef7eb2e8f9f7 | 174 | |
| <> | 144:ef7eb2e8f9f7 | 175 | /* Use systick as time base source and configure 1ms tick (default clock after Reset is MSI) */ |
| <> | 144:ef7eb2e8f9f7 | 176 | HAL_InitTick(TICK_INT_PRIORITY); |
| <> | 144:ef7eb2e8f9f7 | 177 | |
| <> | 144:ef7eb2e8f9f7 | 178 | /* Init the low level hardware */ |
| <> | 144:ef7eb2e8f9f7 | 179 | HAL_MspInit(); |
| <> | 144:ef7eb2e8f9f7 | 180 | |
| <> | 144:ef7eb2e8f9f7 | 181 | /* Return function status */ |
| <> | 144:ef7eb2e8f9f7 | 182 | return HAL_OK; |
| <> | 144:ef7eb2e8f9f7 | 183 | } |
| <> | 144:ef7eb2e8f9f7 | 184 | |
| <> | 144:ef7eb2e8f9f7 | 185 | /** |
| <> | 144:ef7eb2e8f9f7 | 186 | * @brief This function de-Initializes common part of the HAL and stops the source |
| <> | 144:ef7eb2e8f9f7 | 187 | * of time base. |
| <> | 144:ef7eb2e8f9f7 | 188 | * @note This function is optional. |
| <> | 144:ef7eb2e8f9f7 | 189 | * @retval HAL status |
| <> | 144:ef7eb2e8f9f7 | 190 | */ |
| <> | 144:ef7eb2e8f9f7 | 191 | HAL_StatusTypeDef HAL_DeInit(void) |
| <> | 144:ef7eb2e8f9f7 | 192 | { |
| <> | 144:ef7eb2e8f9f7 | 193 | /* Reset of all peripherals */ |
| <> | 144:ef7eb2e8f9f7 | 194 | __HAL_RCC_APB1_FORCE_RESET(); |
| <> | 144:ef7eb2e8f9f7 | 195 | __HAL_RCC_APB1_RELEASE_RESET(); |
| <> | 144:ef7eb2e8f9f7 | 196 | |
| <> | 144:ef7eb2e8f9f7 | 197 | __HAL_RCC_APB2_FORCE_RESET(); |
| <> | 144:ef7eb2e8f9f7 | 198 | __HAL_RCC_APB2_RELEASE_RESET(); |
| <> | 144:ef7eb2e8f9f7 | 199 | |
| <> | 144:ef7eb2e8f9f7 | 200 | #if defined(STM32F105xC) || defined(STM32F107xC) |
| <> | 144:ef7eb2e8f9f7 | 201 | __HAL_RCC_AHB_FORCE_RESET(); |
| <> | 144:ef7eb2e8f9f7 | 202 | __HAL_RCC_AHB_RELEASE_RESET(); |
| <> | 144:ef7eb2e8f9f7 | 203 | #endif |
| <> | 144:ef7eb2e8f9f7 | 204 | |
| <> | 144:ef7eb2e8f9f7 | 205 | /* De-Init the low level hardware */ |
| <> | 144:ef7eb2e8f9f7 | 206 | HAL_MspDeInit(); |
| <> | 144:ef7eb2e8f9f7 | 207 | |
| <> | 144:ef7eb2e8f9f7 | 208 | /* Return function status */ |
| <> | 144:ef7eb2e8f9f7 | 209 | return HAL_OK; |
| <> | 144:ef7eb2e8f9f7 | 210 | } |
| <> | 144:ef7eb2e8f9f7 | 211 | |
| <> | 144:ef7eb2e8f9f7 | 212 | /** |
| <> | 144:ef7eb2e8f9f7 | 213 | * @brief Initializes the MSP. |
| <> | 144:ef7eb2e8f9f7 | 214 | * @retval None |
| <> | 144:ef7eb2e8f9f7 | 215 | */ |
| <> | 144:ef7eb2e8f9f7 | 216 | __weak void HAL_MspInit(void) |
| <> | 144:ef7eb2e8f9f7 | 217 | { |
| <> | 144:ef7eb2e8f9f7 | 218 | /* NOTE : This function Should not be modified, when the callback is needed, |
| <> | 144:ef7eb2e8f9f7 | 219 | the HAL_MspInit could be implemented in the user file |
| <> | 144:ef7eb2e8f9f7 | 220 | */ |
| <> | 144:ef7eb2e8f9f7 | 221 | } |
| <> | 144:ef7eb2e8f9f7 | 222 | |
| <> | 144:ef7eb2e8f9f7 | 223 | /** |
| <> | 144:ef7eb2e8f9f7 | 224 | * @brief DeInitializes the MSP. |
| <> | 144:ef7eb2e8f9f7 | 225 | * @retval None |
| <> | 144:ef7eb2e8f9f7 | 226 | */ |
| <> | 144:ef7eb2e8f9f7 | 227 | __weak void HAL_MspDeInit(void) |
| <> | 144:ef7eb2e8f9f7 | 228 | { |
| <> | 144:ef7eb2e8f9f7 | 229 | /* NOTE : This function Should not be modified, when the callback is needed, |
| <> | 144:ef7eb2e8f9f7 | 230 | the HAL_MspDeInit could be implemented in the user file |
| <> | 144:ef7eb2e8f9f7 | 231 | */ |
| <> | 144:ef7eb2e8f9f7 | 232 | } |
| <> | 144:ef7eb2e8f9f7 | 233 | |
| <> | 144:ef7eb2e8f9f7 | 234 | /** |
| <> | 144:ef7eb2e8f9f7 | 235 | * @brief This function configures the source of the time base. |
| <> | 144:ef7eb2e8f9f7 | 236 | * The time source is configured to have 1ms time base with a dedicated |
| <> | 144:ef7eb2e8f9f7 | 237 | * Tick interrupt priority. |
| <> | 144:ef7eb2e8f9f7 | 238 | * @note This function is called automatically at the beginning of program after |
| <> | 144:ef7eb2e8f9f7 | 239 | * reset by HAL_Init() or at any time when clock is reconfigured by HAL_RCC_ClockConfig(). |
| <> | 144:ef7eb2e8f9f7 | 240 | * @note In the default implementation, SysTick timer is the source of time base. |
| <> | 144:ef7eb2e8f9f7 | 241 | * It is used to generate interrupts at regular time intervals. |
| <> | 144:ef7eb2e8f9f7 | 242 | * Care must be taken if HAL_Delay() is called from a peripheral ISR process, |
| <> | 144:ef7eb2e8f9f7 | 243 | * The the SysTick interrupt must have higher priority (numerically lower) |
| <> | 144:ef7eb2e8f9f7 | 244 | * than the peripheral interrupt. Otherwise the caller ISR process will be blocked. |
| AnnaBridge | 165:e614a9f1c9e2 | 245 | * The function is declared as __weak to be overwritten in case of other |
| <> | 144:ef7eb2e8f9f7 | 246 | * implementation in user file. |
| <> | 144:ef7eb2e8f9f7 | 247 | * @param TickPriority: Tick interrupt priority. |
| <> | 144:ef7eb2e8f9f7 | 248 | * @retval HAL status |
| <> | 144:ef7eb2e8f9f7 | 249 | */ |
| <> | 144:ef7eb2e8f9f7 | 250 | __weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) |
| <> | 144:ef7eb2e8f9f7 | 251 | { |
| <> | 144:ef7eb2e8f9f7 | 252 | /*Configure the SysTick to have interrupt in 1ms time basis*/ |
| AnnaBridge | 165:e614a9f1c9e2 | 253 | HAL_SYSTICK_Config(SystemCoreClock/1000U); |
| <> | 144:ef7eb2e8f9f7 | 254 | |
| <> | 144:ef7eb2e8f9f7 | 255 | /*Configure the SysTick IRQ priority */ |
| AnnaBridge | 165:e614a9f1c9e2 | 256 | HAL_NVIC_SetPriority(SysTick_IRQn, TickPriority ,0U); |
| <> | 144:ef7eb2e8f9f7 | 257 | |
| AnnaBridge | 165:e614a9f1c9e2 | 258 | /* Return function status */ |
| <> | 144:ef7eb2e8f9f7 | 259 | return HAL_OK; |
| <> | 144:ef7eb2e8f9f7 | 260 | } |
| <> | 144:ef7eb2e8f9f7 | 261 | |
| <> | 144:ef7eb2e8f9f7 | 262 | /** |
| <> | 144:ef7eb2e8f9f7 | 263 | * @} |
| <> | 144:ef7eb2e8f9f7 | 264 | */ |
| <> | 144:ef7eb2e8f9f7 | 265 | |
| <> | 144:ef7eb2e8f9f7 | 266 | /** @defgroup HAL_Exported_Functions_Group2 HAL Control functions |
| AnnaBridge | 165:e614a9f1c9e2 | 267 | * @brief HAL Control functions |
| AnnaBridge | 165:e614a9f1c9e2 | 268 | * |
| <> | 144:ef7eb2e8f9f7 | 269 | @verbatim |
| <> | 144:ef7eb2e8f9f7 | 270 | =============================================================================== |
| <> | 144:ef7eb2e8f9f7 | 271 | ##### HAL Control functions ##### |
| <> | 144:ef7eb2e8f9f7 | 272 | =============================================================================== |
| <> | 144:ef7eb2e8f9f7 | 273 | [..] This section provides functions allowing to: |
| <> | 144:ef7eb2e8f9f7 | 274 | (+) Provide a tick value in millisecond |
| <> | 144:ef7eb2e8f9f7 | 275 | (+) Provide a blocking delay in millisecond |
| <> | 144:ef7eb2e8f9f7 | 276 | (+) Suspend the time base source interrupt |
| <> | 144:ef7eb2e8f9f7 | 277 | (+) Resume the time base source interrupt |
| <> | 144:ef7eb2e8f9f7 | 278 | (+) Get the HAL API driver version |
| <> | 144:ef7eb2e8f9f7 | 279 | (+) Get the device identifier |
| <> | 144:ef7eb2e8f9f7 | 280 | (+) Get the device revision identifier |
| AnnaBridge | 165:e614a9f1c9e2 | 281 | (+) Enable/Disable Debug module during SLEEP mode |
| <> | 144:ef7eb2e8f9f7 | 282 | (+) Enable/Disable Debug module during STOP mode |
| <> | 144:ef7eb2e8f9f7 | 283 | (+) Enable/Disable Debug module during STANDBY mode |
| AnnaBridge | 165:e614a9f1c9e2 | 284 | |
| <> | 144:ef7eb2e8f9f7 | 285 | @endverbatim |
| <> | 144:ef7eb2e8f9f7 | 286 | * @{ |
| <> | 144:ef7eb2e8f9f7 | 287 | */ |
| <> | 144:ef7eb2e8f9f7 | 288 | |
| <> | 144:ef7eb2e8f9f7 | 289 | /** |
| <> | 144:ef7eb2e8f9f7 | 290 | * @brief This function is called to increment a global variable "uwTick" |
| <> | 144:ef7eb2e8f9f7 | 291 | * used as application time base. |
| <> | 144:ef7eb2e8f9f7 | 292 | * @note In the default implementation, this variable is incremented each 1ms |
| <> | 144:ef7eb2e8f9f7 | 293 | * in Systick ISR. |
| <> | 144:ef7eb2e8f9f7 | 294 | * @note This function is declared as __weak to be overwritten in case of other |
| <> | 144:ef7eb2e8f9f7 | 295 | * implementations in user file. |
| <> | 144:ef7eb2e8f9f7 | 296 | * @retval None |
| <> | 144:ef7eb2e8f9f7 | 297 | */ |
| <> | 144:ef7eb2e8f9f7 | 298 | __weak void HAL_IncTick(void) |
| <> | 144:ef7eb2e8f9f7 | 299 | { |
| <> | 144:ef7eb2e8f9f7 | 300 | uwTick++; |
| <> | 144:ef7eb2e8f9f7 | 301 | } |
| <> | 144:ef7eb2e8f9f7 | 302 | |
| <> | 144:ef7eb2e8f9f7 | 303 | /** |
| <> | 144:ef7eb2e8f9f7 | 304 | * @brief Provides a tick value in millisecond. |
| AnnaBridge | 165:e614a9f1c9e2 | 305 | * @note This function is declared as __weak to be overwritten in case of other |
| <> | 144:ef7eb2e8f9f7 | 306 | * implementations in user file. |
| <> | 144:ef7eb2e8f9f7 | 307 | * @retval tick value |
| <> | 144:ef7eb2e8f9f7 | 308 | */ |
| <> | 144:ef7eb2e8f9f7 | 309 | __weak uint32_t HAL_GetTick(void) |
| <> | 144:ef7eb2e8f9f7 | 310 | { |
| <> | 144:ef7eb2e8f9f7 | 311 | return uwTick; |
| <> | 144:ef7eb2e8f9f7 | 312 | } |
| <> | 144:ef7eb2e8f9f7 | 313 | |
| <> | 144:ef7eb2e8f9f7 | 314 | /** |
| AnnaBridge | 165:e614a9f1c9e2 | 315 | * @brief This function provides minimum delay (in milliseconds) based |
| <> | 144:ef7eb2e8f9f7 | 316 | * on variable incremented. |
| <> | 144:ef7eb2e8f9f7 | 317 | * @note In the default implementation , SysTick timer is the source of time base. |
| <> | 144:ef7eb2e8f9f7 | 318 | * It is used to generate interrupts at regular time intervals where uwTick |
| <> | 144:ef7eb2e8f9f7 | 319 | * is incremented. |
| AnnaBridge | 165:e614a9f1c9e2 | 320 | * @note This function is declared as __weak to be overwritten in case of other |
| <> | 144:ef7eb2e8f9f7 | 321 | * implementations in user file. |
| <> | 144:ef7eb2e8f9f7 | 322 | * @param Delay: specifies the delay time length, in milliseconds. |
| <> | 144:ef7eb2e8f9f7 | 323 | * @retval None |
| <> | 144:ef7eb2e8f9f7 | 324 | */ |
| <> | 144:ef7eb2e8f9f7 | 325 | __weak void HAL_Delay(__IO uint32_t Delay) |
| <> | 144:ef7eb2e8f9f7 | 326 | { |
| AnnaBridge | 165:e614a9f1c9e2 | 327 | uint32_t tickstart = HAL_GetTick(); |
| AnnaBridge | 165:e614a9f1c9e2 | 328 | uint32_t wait = Delay; |
| AnnaBridge | 165:e614a9f1c9e2 | 329 | |
| AnnaBridge | 165:e614a9f1c9e2 | 330 | /* Add a period to guarantee minimum wait */ |
| AnnaBridge | 165:e614a9f1c9e2 | 331 | if (wait < HAL_MAX_DELAY) |
| AnnaBridge | 165:e614a9f1c9e2 | 332 | { |
| AnnaBridge | 165:e614a9f1c9e2 | 333 | wait++; |
| AnnaBridge | 165:e614a9f1c9e2 | 334 | } |
| AnnaBridge | 165:e614a9f1c9e2 | 335 | |
| AnnaBridge | 165:e614a9f1c9e2 | 336 | while((HAL_GetTick() - tickstart) < wait) |
| <> | 144:ef7eb2e8f9f7 | 337 | { |
| <> | 144:ef7eb2e8f9f7 | 338 | } |
| <> | 144:ef7eb2e8f9f7 | 339 | } |
| <> | 144:ef7eb2e8f9f7 | 340 | |
| <> | 144:ef7eb2e8f9f7 | 341 | /** |
| <> | 144:ef7eb2e8f9f7 | 342 | * @brief Suspend Tick increment. |
| <> | 144:ef7eb2e8f9f7 | 343 | * @note In the default implementation , SysTick timer is the source of time base. It is |
| <> | 144:ef7eb2e8f9f7 | 344 | * used to generate interrupts at regular time intervals. Once HAL_SuspendTick() |
| AnnaBridge | 165:e614a9f1c9e2 | 345 | * is called, the SysTick interrupt will be disabled and so Tick increment |
| <> | 144:ef7eb2e8f9f7 | 346 | * is suspended. |
| <> | 144:ef7eb2e8f9f7 | 347 | * @note This function is declared as __weak to be overwritten in case of other |
| <> | 144:ef7eb2e8f9f7 | 348 | * implementations in user file. |
| <> | 144:ef7eb2e8f9f7 | 349 | * @retval None |
| <> | 144:ef7eb2e8f9f7 | 350 | */ |
| <> | 144:ef7eb2e8f9f7 | 351 | __weak void HAL_SuspendTick(void) |
| <> | 144:ef7eb2e8f9f7 | 352 | { |
| <> | 144:ef7eb2e8f9f7 | 353 | /* Disable SysTick Interrupt */ |
| <> | 144:ef7eb2e8f9f7 | 354 | CLEAR_BIT(SysTick->CTRL,SysTick_CTRL_TICKINT_Msk); |
| <> | 144:ef7eb2e8f9f7 | 355 | } |
| <> | 144:ef7eb2e8f9f7 | 356 | |
| <> | 144:ef7eb2e8f9f7 | 357 | /** |
| <> | 144:ef7eb2e8f9f7 | 358 | * @brief Resume Tick increment. |
| <> | 144:ef7eb2e8f9f7 | 359 | * @note In the default implementation , SysTick timer is the source of time base. It is |
| <> | 144:ef7eb2e8f9f7 | 360 | * used to generate interrupts at regular time intervals. Once HAL_ResumeTick() |
| AnnaBridge | 165:e614a9f1c9e2 | 361 | * is called, the SysTick interrupt will be enabled and so Tick increment |
| <> | 144:ef7eb2e8f9f7 | 362 | * is resumed. |
| AnnaBridge | 165:e614a9f1c9e2 | 363 | * @note This function is declared as __weak to be overwritten in case of other |
| <> | 144:ef7eb2e8f9f7 | 364 | * implementations in user file. |
| <> | 144:ef7eb2e8f9f7 | 365 | * @retval None |
| <> | 144:ef7eb2e8f9f7 | 366 | */ |
| <> | 144:ef7eb2e8f9f7 | 367 | __weak void HAL_ResumeTick(void) |
| <> | 144:ef7eb2e8f9f7 | 368 | { |
| <> | 144:ef7eb2e8f9f7 | 369 | /* Enable SysTick Interrupt */ |
| <> | 144:ef7eb2e8f9f7 | 370 | SET_BIT(SysTick->CTRL,SysTick_CTRL_TICKINT_Msk); |
| <> | 144:ef7eb2e8f9f7 | 371 | } |
| <> | 144:ef7eb2e8f9f7 | 372 | |
| <> | 144:ef7eb2e8f9f7 | 373 | /** |
| AnnaBridge | 165:e614a9f1c9e2 | 374 | * @brief Returns the HAL revision |
| AnnaBridge | 165:e614a9f1c9e2 | 375 | * @retval version : 0xXYZR (8bits for each decimal, R for RC) |
| <> | 144:ef7eb2e8f9f7 | 376 | */ |
| <> | 144:ef7eb2e8f9f7 | 377 | uint32_t HAL_GetHalVersion(void) |
| <> | 144:ef7eb2e8f9f7 | 378 | { |
| <> | 144:ef7eb2e8f9f7 | 379 | return __STM32F1xx_HAL_VERSION; |
| <> | 144:ef7eb2e8f9f7 | 380 | } |
| <> | 144:ef7eb2e8f9f7 | 381 | |
| <> | 144:ef7eb2e8f9f7 | 382 | /** |
| <> | 144:ef7eb2e8f9f7 | 383 | * @brief Returns the device revision identifier. |
| <> | 144:ef7eb2e8f9f7 | 384 | * Note: On devices STM32F10xx8 and STM32F10xxB, |
| <> | 144:ef7eb2e8f9f7 | 385 | * STM32F101xC/D/E and STM32F103xC/D/E, |
| <> | 144:ef7eb2e8f9f7 | 386 | * STM32F101xF/G and STM32F103xF/G |
| <> | 144:ef7eb2e8f9f7 | 387 | * STM32F10xx4 and STM32F10xx6 |
| <> | 144:ef7eb2e8f9f7 | 388 | * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in |
| <> | 144:ef7eb2e8f9f7 | 389 | * debug mode (not accessible by the user software in normal mode). |
| <> | 144:ef7eb2e8f9f7 | 390 | * Refer to errata sheet of these devices for more details. |
| <> | 144:ef7eb2e8f9f7 | 391 | * @retval Device revision identifier |
| <> | 144:ef7eb2e8f9f7 | 392 | */ |
| <> | 144:ef7eb2e8f9f7 | 393 | uint32_t HAL_GetREVID(void) |
| <> | 144:ef7eb2e8f9f7 | 394 | { |
| AnnaBridge | 165:e614a9f1c9e2 | 395 | return((DBGMCU->IDCODE) >> DBGMCU_IDCODE_REV_ID_Pos); |
| <> | 144:ef7eb2e8f9f7 | 396 | } |
| <> | 144:ef7eb2e8f9f7 | 397 | |
| <> | 144:ef7eb2e8f9f7 | 398 | /** |
| <> | 144:ef7eb2e8f9f7 | 399 | * @brief Returns the device identifier. |
| <> | 144:ef7eb2e8f9f7 | 400 | * Note: On devices STM32F10xx8 and STM32F10xxB, |
| <> | 144:ef7eb2e8f9f7 | 401 | * STM32F101xC/D/E and STM32F103xC/D/E, |
| <> | 144:ef7eb2e8f9f7 | 402 | * STM32F101xF/G and STM32F103xF/G |
| <> | 144:ef7eb2e8f9f7 | 403 | * STM32F10xx4 and STM32F10xx6 |
| <> | 144:ef7eb2e8f9f7 | 404 | * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in |
| <> | 144:ef7eb2e8f9f7 | 405 | * debug mode (not accessible by the user software in normal mode). |
| <> | 144:ef7eb2e8f9f7 | 406 | * Refer to errata sheet of these devices for more details. |
| <> | 144:ef7eb2e8f9f7 | 407 | * @retval Device identifier |
| <> | 144:ef7eb2e8f9f7 | 408 | */ |
| <> | 144:ef7eb2e8f9f7 | 409 | uint32_t HAL_GetDEVID(void) |
| <> | 144:ef7eb2e8f9f7 | 410 | { |
| <> | 144:ef7eb2e8f9f7 | 411 | return((DBGMCU->IDCODE) & IDCODE_DEVID_MASK); |
| <> | 144:ef7eb2e8f9f7 | 412 | } |
| <> | 144:ef7eb2e8f9f7 | 413 | |
| <> | 144:ef7eb2e8f9f7 | 414 | /** |
| <> | 144:ef7eb2e8f9f7 | 415 | * @brief Enable the Debug Module during SLEEP mode |
| <> | 144:ef7eb2e8f9f7 | 416 | * @retval None |
| <> | 144:ef7eb2e8f9f7 | 417 | */ |
| <> | 144:ef7eb2e8f9f7 | 418 | void HAL_DBGMCU_EnableDBGSleepMode(void) |
| <> | 144:ef7eb2e8f9f7 | 419 | { |
| <> | 144:ef7eb2e8f9f7 | 420 | SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP); |
| <> | 144:ef7eb2e8f9f7 | 421 | } |
| <> | 144:ef7eb2e8f9f7 | 422 | |
| <> | 144:ef7eb2e8f9f7 | 423 | /** |
| <> | 144:ef7eb2e8f9f7 | 424 | * @brief Disable the Debug Module during SLEEP mode |
| <> | 144:ef7eb2e8f9f7 | 425 | * Note: On devices STM32F10xx8 and STM32F10xxB, |
| <> | 144:ef7eb2e8f9f7 | 426 | * STM32F101xC/D/E and STM32F103xC/D/E, |
| <> | 144:ef7eb2e8f9f7 | 427 | * STM32F101xF/G and STM32F103xF/G |
| <> | 144:ef7eb2e8f9f7 | 428 | * STM32F10xx4 and STM32F10xx6 |
| <> | 144:ef7eb2e8f9f7 | 429 | * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in |
| <> | 144:ef7eb2e8f9f7 | 430 | * debug mode (not accessible by the user software in normal mode). |
| <> | 144:ef7eb2e8f9f7 | 431 | * Refer to errata sheet of these devices for more details. |
| <> | 144:ef7eb2e8f9f7 | 432 | * @retval None |
| <> | 144:ef7eb2e8f9f7 | 433 | */ |
| <> | 144:ef7eb2e8f9f7 | 434 | void HAL_DBGMCU_DisableDBGSleepMode(void) |
| <> | 144:ef7eb2e8f9f7 | 435 | { |
| <> | 144:ef7eb2e8f9f7 | 436 | CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_SLEEP); |
| <> | 144:ef7eb2e8f9f7 | 437 | } |
| <> | 144:ef7eb2e8f9f7 | 438 | |
| <> | 144:ef7eb2e8f9f7 | 439 | /** |
| <> | 144:ef7eb2e8f9f7 | 440 | * @brief Enable the Debug Module during STOP mode |
| <> | 144:ef7eb2e8f9f7 | 441 | * Note: On devices STM32F10xx8 and STM32F10xxB, |
| <> | 144:ef7eb2e8f9f7 | 442 | * STM32F101xC/D/E and STM32F103xC/D/E, |
| <> | 144:ef7eb2e8f9f7 | 443 | * STM32F101xF/G and STM32F103xF/G |
| <> | 144:ef7eb2e8f9f7 | 444 | * STM32F10xx4 and STM32F10xx6 |
| <> | 144:ef7eb2e8f9f7 | 445 | * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in |
| <> | 144:ef7eb2e8f9f7 | 446 | * debug mode (not accessible by the user software in normal mode). |
| <> | 144:ef7eb2e8f9f7 | 447 | * Refer to errata sheet of these devices for more details. |
| <> | 144:ef7eb2e8f9f7 | 448 | * Note: On all STM32F1 devices: |
| <> | 144:ef7eb2e8f9f7 | 449 | * If the system tick timer interrupt is enabled during the Stop mode |
| <> | 144:ef7eb2e8f9f7 | 450 | * debug (DBG_STOP bit set in the DBGMCU_CR register ), it will wakeup |
| <> | 144:ef7eb2e8f9f7 | 451 | * the system from Stop mode. |
| <> | 144:ef7eb2e8f9f7 | 452 | * Workaround: To debug the Stop mode, disable the system tick timer |
| <> | 144:ef7eb2e8f9f7 | 453 | * interrupt. |
| <> | 144:ef7eb2e8f9f7 | 454 | * Refer to errata sheet of these devices for more details. |
| <> | 144:ef7eb2e8f9f7 | 455 | * Note: On all STM32F1 devices: |
| <> | 144:ef7eb2e8f9f7 | 456 | * If the system tick timer interrupt is enabled during the Stop mode |
| <> | 144:ef7eb2e8f9f7 | 457 | * debug (DBG_STOP bit set in the DBGMCU_CR register ), it will wakeup |
| <> | 144:ef7eb2e8f9f7 | 458 | * the system from Stop mode. |
| <> | 144:ef7eb2e8f9f7 | 459 | * Workaround: To debug the Stop mode, disable the system tick timer |
| <> | 144:ef7eb2e8f9f7 | 460 | * interrupt. |
| <> | 144:ef7eb2e8f9f7 | 461 | * Refer to errata sheet of these devices for more details. |
| <> | 144:ef7eb2e8f9f7 | 462 | * @retval None |
| <> | 144:ef7eb2e8f9f7 | 463 | */ |
| <> | 144:ef7eb2e8f9f7 | 464 | void HAL_DBGMCU_EnableDBGStopMode(void) |
| <> | 144:ef7eb2e8f9f7 | 465 | { |
| <> | 144:ef7eb2e8f9f7 | 466 | SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP); |
| <> | 144:ef7eb2e8f9f7 | 467 | } |
| <> | 144:ef7eb2e8f9f7 | 468 | |
| <> | 144:ef7eb2e8f9f7 | 469 | /** |
| <> | 144:ef7eb2e8f9f7 | 470 | * @brief Disable the Debug Module during STOP mode |
| <> | 144:ef7eb2e8f9f7 | 471 | * Note: On devices STM32F10xx8 and STM32F10xxB, |
| <> | 144:ef7eb2e8f9f7 | 472 | * STM32F101xC/D/E and STM32F103xC/D/E, |
| <> | 144:ef7eb2e8f9f7 | 473 | * STM32F101xF/G and STM32F103xF/G |
| <> | 144:ef7eb2e8f9f7 | 474 | * STM32F10xx4 and STM32F10xx6 |
| <> | 144:ef7eb2e8f9f7 | 475 | * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in |
| <> | 144:ef7eb2e8f9f7 | 476 | * debug mode (not accessible by the user software in normal mode). |
| <> | 144:ef7eb2e8f9f7 | 477 | * Refer to errata sheet of these devices for more details. |
| <> | 144:ef7eb2e8f9f7 | 478 | * @retval None |
| <> | 144:ef7eb2e8f9f7 | 479 | */ |
| <> | 144:ef7eb2e8f9f7 | 480 | void HAL_DBGMCU_DisableDBGStopMode(void) |
| <> | 144:ef7eb2e8f9f7 | 481 | { |
| <> | 144:ef7eb2e8f9f7 | 482 | CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STOP); |
| <> | 144:ef7eb2e8f9f7 | 483 | } |
| <> | 144:ef7eb2e8f9f7 | 484 | |
| <> | 144:ef7eb2e8f9f7 | 485 | /** |
| <> | 144:ef7eb2e8f9f7 | 486 | * @brief Enable the Debug Module during STANDBY mode |
| <> | 144:ef7eb2e8f9f7 | 487 | * Note: On devices STM32F10xx8 and STM32F10xxB, |
| <> | 144:ef7eb2e8f9f7 | 488 | * STM32F101xC/D/E and STM32F103xC/D/E, |
| <> | 144:ef7eb2e8f9f7 | 489 | * STM32F101xF/G and STM32F103xF/G |
| <> | 144:ef7eb2e8f9f7 | 490 | * STM32F10xx4 and STM32F10xx6 |
| <> | 144:ef7eb2e8f9f7 | 491 | * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in |
| <> | 144:ef7eb2e8f9f7 | 492 | * debug mode (not accessible by the user software in normal mode). |
| <> | 144:ef7eb2e8f9f7 | 493 | * Refer to errata sheet of these devices for more details. |
| <> | 144:ef7eb2e8f9f7 | 494 | * @retval None |
| <> | 144:ef7eb2e8f9f7 | 495 | */ |
| <> | 144:ef7eb2e8f9f7 | 496 | void HAL_DBGMCU_EnableDBGStandbyMode(void) |
| <> | 144:ef7eb2e8f9f7 | 497 | { |
| <> | 144:ef7eb2e8f9f7 | 498 | SET_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY); |
| <> | 144:ef7eb2e8f9f7 | 499 | } |
| <> | 144:ef7eb2e8f9f7 | 500 | |
| <> | 144:ef7eb2e8f9f7 | 501 | /** |
| <> | 144:ef7eb2e8f9f7 | 502 | * @brief Disable the Debug Module during STANDBY mode |
| <> | 144:ef7eb2e8f9f7 | 503 | * Note: On devices STM32F10xx8 and STM32F10xxB, |
| <> | 144:ef7eb2e8f9f7 | 504 | * STM32F101xC/D/E and STM32F103xC/D/E, |
| <> | 144:ef7eb2e8f9f7 | 505 | * STM32F101xF/G and STM32F103xF/G |
| <> | 144:ef7eb2e8f9f7 | 506 | * STM32F10xx4 and STM32F10xx6 |
| <> | 144:ef7eb2e8f9f7 | 507 | * Debug registers DBGMCU_IDCODE and DBGMCU_CR are accessible only in |
| <> | 144:ef7eb2e8f9f7 | 508 | * debug mode (not accessible by the user software in normal mode). |
| <> | 144:ef7eb2e8f9f7 | 509 | * Refer to errata sheet of these devices for more details. |
| <> | 144:ef7eb2e8f9f7 | 510 | * @retval None |
| <> | 144:ef7eb2e8f9f7 | 511 | */ |
| <> | 144:ef7eb2e8f9f7 | 512 | void HAL_DBGMCU_DisableDBGStandbyMode(void) |
| <> | 144:ef7eb2e8f9f7 | 513 | { |
| <> | 144:ef7eb2e8f9f7 | 514 | CLEAR_BIT(DBGMCU->CR, DBGMCU_CR_DBG_STANDBY); |
| <> | 144:ef7eb2e8f9f7 | 515 | } |
| <> | 144:ef7eb2e8f9f7 | 516 | |
| <> | 144:ef7eb2e8f9f7 | 517 | /** |
| AnnaBridge | 165:e614a9f1c9e2 | 518 | * @brief Return the unique device identifier (UID based on 96 bits) |
| AnnaBridge | 165:e614a9f1c9e2 | 519 | * @param UID: pointer to 3 words array. |
| AnnaBridge | 165:e614a9f1c9e2 | 520 | * @retval Device identifier |
| AnnaBridge | 165:e614a9f1c9e2 | 521 | */ |
| AnnaBridge | 165:e614a9f1c9e2 | 522 | void HAL_GetUID(uint32_t *UID) |
| AnnaBridge | 165:e614a9f1c9e2 | 523 | { |
| AnnaBridge | 165:e614a9f1c9e2 | 524 | UID[0] = (uint32_t)(READ_REG(*((uint32_t *)UID_BASE))); |
| AnnaBridge | 165:e614a9f1c9e2 | 525 | UID[1] = (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE + 4U)))); |
| AnnaBridge | 165:e614a9f1c9e2 | 526 | UID[2] = (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE + 8U)))); |
| AnnaBridge | 165:e614a9f1c9e2 | 527 | } |
| AnnaBridge | 165:e614a9f1c9e2 | 528 | |
| AnnaBridge | 165:e614a9f1c9e2 | 529 | /** |
| <> | 144:ef7eb2e8f9f7 | 530 | * @} |
| <> | 144:ef7eb2e8f9f7 | 531 | */ |
| <> | 144:ef7eb2e8f9f7 | 532 | |
| <> | 144:ef7eb2e8f9f7 | 533 | /** |
| <> | 144:ef7eb2e8f9f7 | 534 | * @} |
| <> | 144:ef7eb2e8f9f7 | 535 | */ |
| <> | 144:ef7eb2e8f9f7 | 536 | |
| <> | 144:ef7eb2e8f9f7 | 537 | #endif /* HAL_MODULE_ENABLED */ |
| <> | 144:ef7eb2e8f9f7 | 538 | /** |
| <> | 144:ef7eb2e8f9f7 | 539 | * @} |
| <> | 144:ef7eb2e8f9f7 | 540 | */ |
| <> | 144:ef7eb2e8f9f7 | 541 | |
| <> | 144:ef7eb2e8f9f7 | 542 | /** |
| <> | 144:ef7eb2e8f9f7 | 543 | * @} |
| <> | 144:ef7eb2e8f9f7 | 544 | */ |
| <> | 144:ef7eb2e8f9f7 | 545 | |
| <> | 144:ef7eb2e8f9f7 | 546 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
