提交 | 用户 | age
|
bfc108
|
1 |
/**
|
Q |
2 |
******************************************************************************
|
|
3 |
* @file stm32f0xx_hal_rcc.h
|
|
4 |
* @author MCD Application Team
|
|
5 |
* @brief Header file of RCC HAL module.
|
|
6 |
******************************************************************************
|
|
7 |
* @attention
|
|
8 |
*
|
|
9 |
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
|
|
10 |
*
|
|
11 |
* Redistribution and use in source and binary forms, with or without modification,
|
|
12 |
* are permitted provided that the following conditions are met:
|
|
13 |
* 1. Redistributions of source code must retain the above copyright notice,
|
|
14 |
* this list of conditions and the following disclaimer.
|
|
15 |
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
16 |
* this list of conditions and the following disclaimer in the documentation
|
|
17 |
* and/or other materials provided with the distribution.
|
|
18 |
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
19 |
* may be used to endorse or promote products derived from this software
|
|
20 |
* without specific prior written permission.
|
|
21 |
*
|
|
22 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
23 |
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
24 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
25 |
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
26 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
27 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
28 |
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
29 |
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
30 |
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
31 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32 |
*
|
|
33 |
******************************************************************************
|
|
34 |
*/
|
|
35 |
|
|
36 |
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
37 |
#ifndef __STM32F0xx_HAL_RCC_H
|
|
38 |
#define __STM32F0xx_HAL_RCC_H
|
|
39 |
|
|
40 |
#ifdef __cplusplus
|
|
41 |
extern "C" {
|
|
42 |
#endif
|
|
43 |
|
|
44 |
/* Includes ------------------------------------------------------------------*/
|
|
45 |
#include "stm32f0xx_hal_def.h"
|
|
46 |
|
|
47 |
/** @addtogroup STM32F0xx_HAL_Driver
|
|
48 |
* @{
|
|
49 |
*/
|
|
50 |
|
|
51 |
/** @addtogroup RCC
|
|
52 |
* @{
|
|
53 |
*/
|
|
54 |
|
|
55 |
/** @addtogroup RCC_Private_Constants
|
|
56 |
* @{
|
|
57 |
*/
|
|
58 |
|
|
59 |
/** @defgroup RCC_Timeout RCC Timeout
|
|
60 |
* @{
|
|
61 |
*/
|
|
62 |
|
|
63 |
/* Disable Backup domain write protection state change timeout */
|
|
64 |
#define RCC_DBP_TIMEOUT_VALUE (100U) /* 100 ms */
|
|
65 |
/* LSE state change timeout */
|
|
66 |
#define RCC_LSE_TIMEOUT_VALUE LSE_STARTUP_TIMEOUT
|
|
67 |
#define CLOCKSWITCH_TIMEOUT_VALUE (5000U) /* 5 s */
|
|
68 |
#define HSE_TIMEOUT_VALUE HSE_STARTUP_TIMEOUT
|
|
69 |
#define HSI_TIMEOUT_VALUE (2U) /* 2 ms (minimum Tick + 1U) */
|
|
70 |
#define LSI_TIMEOUT_VALUE (2U) /* 2 ms (minimum Tick + 1U) */
|
|
71 |
#define PLL_TIMEOUT_VALUE (2U) /* 2 ms (minimum Tick + 1U) */
|
|
72 |
#define HSI14_TIMEOUT_VALUE (2U) /* 2 ms (minimum Tick + 1U) */
|
|
73 |
#if defined(RCC_HSI48_SUPPORT)
|
|
74 |
#define HSI48_TIMEOUT_VALUE (2U) /* 2 ms (minimum Tick + 1U) */
|
|
75 |
#endif /* RCC_HSI48_SUPPORT */
|
|
76 |
/**
|
|
77 |
* @}
|
|
78 |
*/
|
|
79 |
|
|
80 |
/** @defgroup RCC_Register_Offset Register offsets
|
|
81 |
* @{
|
|
82 |
*/
|
|
83 |
#define RCC_OFFSET (RCC_BASE - PERIPH_BASE)
|
|
84 |
#define RCC_CR_OFFSET 0x00
|
|
85 |
#define RCC_CFGR_OFFSET 0x04
|
|
86 |
#define RCC_CIR_OFFSET 0x08
|
|
87 |
#define RCC_BDCR_OFFSET 0x20
|
|
88 |
#define RCC_CSR_OFFSET 0x24
|
|
89 |
|
|
90 |
/**
|
|
91 |
* @}
|
|
92 |
*/
|
|
93 |
|
|
94 |
|
|
95 |
/* CR register byte 2 (Bits[23:16]) base address */
|
|
96 |
#define RCC_CR_BYTE2_ADDRESS ((uint32_t)(RCC_BASE + RCC_CR_OFFSET + 0x02U))
|
|
97 |
|
|
98 |
/* CIR register byte 1 (Bits[15:8]) base address */
|
|
99 |
#define RCC_CIR_BYTE1_ADDRESS ((uint32_t)(RCC_BASE + RCC_CIR_OFFSET + 0x01U))
|
|
100 |
|
|
101 |
/* CIR register byte 2 (Bits[23:16]) base address */
|
|
102 |
#define RCC_CIR_BYTE2_ADDRESS ((uint32_t)(RCC_BASE + RCC_CIR_OFFSET + 0x02U))
|
|
103 |
|
|
104 |
/* Defines used for Flags */
|
|
105 |
#define CR_REG_INDEX ((uint8_t)1U)
|
|
106 |
#define CR2_REG_INDEX ((uint8_t)2U)
|
|
107 |
#define BDCR_REG_INDEX ((uint8_t)3U)
|
|
108 |
#define CSR_REG_INDEX ((uint8_t)4U)
|
|
109 |
|
|
110 |
/* Bits position in in the CFGR register */
|
|
111 |
#define RCC_CFGR_PLLMUL_BITNUMBER 18U
|
|
112 |
#define RCC_CFGR_HPRE_BITNUMBER 4U
|
|
113 |
#define RCC_CFGR_PPRE_BITNUMBER 8U
|
|
114 |
/* Flags in the CFGR2 register */
|
|
115 |
#define RCC_CFGR2_PREDIV_BITNUMBER 0
|
|
116 |
/* Flags in the CR register */
|
|
117 |
#define RCC_CR_HSIRDY_BitNumber 1
|
|
118 |
#define RCC_CR_HSERDY_BitNumber 17
|
|
119 |
#define RCC_CR_PLLRDY_BitNumber 25
|
|
120 |
/* Flags in the CR2 register */
|
|
121 |
#define RCC_CR2_HSI14RDY_BitNumber 1
|
|
122 |
#define RCC_CR2_HSI48RDY_BitNumber 16
|
|
123 |
/* Flags in the BDCR register */
|
|
124 |
#define RCC_BDCR_LSERDY_BitNumber 1
|
|
125 |
/* Flags in the CSR register */
|
|
126 |
#define RCC_CSR_LSIRDY_BitNumber 1
|
|
127 |
#define RCC_CSR_V18PWRRSTF_BitNumber 23
|
|
128 |
#define RCC_CSR_RMVF_BitNumber 24
|
|
129 |
#define RCC_CSR_OBLRSTF_BitNumber 25
|
|
130 |
#define RCC_CSR_PINRSTF_BitNumber 26
|
|
131 |
#define RCC_CSR_PORRSTF_BitNumber 27
|
|
132 |
#define RCC_CSR_SFTRSTF_BitNumber 28
|
|
133 |
#define RCC_CSR_IWDGRSTF_BitNumber 29
|
|
134 |
#define RCC_CSR_WWDGRSTF_BitNumber 30
|
|
135 |
#define RCC_CSR_LPWRRSTF_BitNumber 31
|
|
136 |
/* Flags in the HSITRIM register */
|
|
137 |
#define RCC_CR_HSITRIM_BitNumber 3
|
|
138 |
#define RCC_HSI14TRIM_BIT_NUMBER 3
|
|
139 |
#define RCC_FLAG_MASK ((uint8_t)0x1FU)
|
|
140 |
|
|
141 |
/**
|
|
142 |
* @}
|
|
143 |
*/
|
|
144 |
|
|
145 |
/** @addtogroup RCC_Private_Macros
|
|
146 |
* @{
|
|
147 |
*/
|
|
148 |
#define IS_RCC_HSE(__HSE__) (((__HSE__) == RCC_HSE_OFF) || ((__HSE__) == RCC_HSE_ON) || \
|
|
149 |
((__HSE__) == RCC_HSE_BYPASS))
|
|
150 |
#define IS_RCC_LSE(__LSE__) (((__LSE__) == RCC_LSE_OFF) || ((__LSE__) == RCC_LSE_ON) || \
|
|
151 |
((__LSE__) == RCC_LSE_BYPASS))
|
|
152 |
#define IS_RCC_HSI(__HSI__) (((__HSI__) == RCC_HSI_OFF) || ((__HSI__) == RCC_HSI_ON))
|
|
153 |
#define IS_RCC_HSI14(__HSI14__) (((__HSI14__) == RCC_HSI14_OFF) || ((__HSI14__) == RCC_HSI14_ON) || ((__HSI14__) == RCC_HSI14_ADC_CONTROL))
|
|
154 |
#define IS_RCC_CALIBRATION_VALUE(__VALUE__) ((__VALUE__) <= 0x1FU)
|
|
155 |
#define IS_RCC_LSI(__LSI__) (((__LSI__) == RCC_LSI_OFF) || ((__LSI__) == RCC_LSI_ON))
|
|
156 |
#define IS_RCC_PLL(__PLL__) (((__PLL__) == RCC_PLL_NONE) || ((__PLL__) == RCC_PLL_OFF) || \
|
|
157 |
((__PLL__) == RCC_PLL_ON))
|
|
158 |
#define IS_RCC_PREDIV(__PREDIV__) (((__PREDIV__) == RCC_PREDIV_DIV1) || ((__PREDIV__) == RCC_PREDIV_DIV2) || \
|
|
159 |
((__PREDIV__) == RCC_PREDIV_DIV3) || ((__PREDIV__) == RCC_PREDIV_DIV4) || \
|
|
160 |
((__PREDIV__) == RCC_PREDIV_DIV5) || ((__PREDIV__) == RCC_PREDIV_DIV6) || \
|
|
161 |
((__PREDIV__) == RCC_PREDIV_DIV7) || ((__PREDIV__) == RCC_PREDIV_DIV8) || \
|
|
162 |
((__PREDIV__) == RCC_PREDIV_DIV9) || ((__PREDIV__) == RCC_PREDIV_DIV10) || \
|
|
163 |
((__PREDIV__) == RCC_PREDIV_DIV11) || ((__PREDIV__) == RCC_PREDIV_DIV12) || \
|
|
164 |
((__PREDIV__) == RCC_PREDIV_DIV13) || ((__PREDIV__) == RCC_PREDIV_DIV14) || \
|
|
165 |
((__PREDIV__) == RCC_PREDIV_DIV15) || ((__PREDIV__) == RCC_PREDIV_DIV16))
|
|
166 |
|
|
167 |
#define IS_RCC_PLL_MUL(__MUL__) (((__MUL__) == RCC_PLL_MUL2) || ((__MUL__) == RCC_PLL_MUL3) || \
|
|
168 |
((__MUL__) == RCC_PLL_MUL4) || ((__MUL__) == RCC_PLL_MUL5) || \
|
|
169 |
((__MUL__) == RCC_PLL_MUL6) || ((__MUL__) == RCC_PLL_MUL7) || \
|
|
170 |
((__MUL__) == RCC_PLL_MUL8) || ((__MUL__) == RCC_PLL_MUL9) || \
|
|
171 |
((__MUL__) == RCC_PLL_MUL10) || ((__MUL__) == RCC_PLL_MUL11) || \
|
|
172 |
((__MUL__) == RCC_PLL_MUL12) || ((__MUL__) == RCC_PLL_MUL13) || \
|
|
173 |
((__MUL__) == RCC_PLL_MUL14) || ((__MUL__) == RCC_PLL_MUL15) || \
|
|
174 |
((__MUL__) == RCC_PLL_MUL16))
|
|
175 |
#define IS_RCC_CLOCKTYPE(__CLK__) ((((__CLK__) & RCC_CLOCKTYPE_SYSCLK) == RCC_CLOCKTYPE_SYSCLK) || \
|
|
176 |
(((__CLK__) & RCC_CLOCKTYPE_HCLK) == RCC_CLOCKTYPE_HCLK) || \
|
|
177 |
(((__CLK__) & RCC_CLOCKTYPE_PCLK1) == RCC_CLOCKTYPE_PCLK1))
|
|
178 |
#define IS_RCC_HCLK(__HCLK__) (((__HCLK__) == RCC_SYSCLK_DIV1) || ((__HCLK__) == RCC_SYSCLK_DIV2) || \
|
|
179 |
((__HCLK__) == RCC_SYSCLK_DIV4) || ((__HCLK__) == RCC_SYSCLK_DIV8) || \
|
|
180 |
((__HCLK__) == RCC_SYSCLK_DIV16) || ((__HCLK__) == RCC_SYSCLK_DIV64) || \
|
|
181 |
((__HCLK__) == RCC_SYSCLK_DIV128) || ((__HCLK__) == RCC_SYSCLK_DIV256) || \
|
|
182 |
((__HCLK__) == RCC_SYSCLK_DIV512))
|
|
183 |
#define IS_RCC_PCLK(__PCLK__) (((__PCLK__) == RCC_HCLK_DIV1) || ((__PCLK__) == RCC_HCLK_DIV2) || \
|
|
184 |
((__PCLK__) == RCC_HCLK_DIV4) || ((__PCLK__) == RCC_HCLK_DIV8) || \
|
|
185 |
((__PCLK__) == RCC_HCLK_DIV16))
|
|
186 |
#define IS_RCC_MCO(__MCO__) ((__MCO__) == RCC_MCO)
|
|
187 |
#define IS_RCC_RTCCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_RTCCLKSOURCE_NO_CLK) || \
|
|
188 |
((__SOURCE__) == RCC_RTCCLKSOURCE_LSE) || \
|
|
189 |
((__SOURCE__) == RCC_RTCCLKSOURCE_LSI) || \
|
|
190 |
((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV32))
|
|
191 |
#define IS_RCC_USART1CLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_USART1CLKSOURCE_PCLK1) || \
|
|
192 |
((__SOURCE__) == RCC_USART1CLKSOURCE_SYSCLK) || \
|
|
193 |
((__SOURCE__) == RCC_USART1CLKSOURCE_LSE) || \
|
|
194 |
((__SOURCE__) == RCC_USART1CLKSOURCE_HSI))
|
|
195 |
#define IS_RCC_I2C1CLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_I2C1CLKSOURCE_HSI) || \
|
|
196 |
((__SOURCE__) == RCC_I2C1CLKSOURCE_SYSCLK))
|
|
197 |
|
|
198 |
/**
|
|
199 |
* @}
|
|
200 |
*/
|
|
201 |
|
|
202 |
/* Exported types ------------------------------------------------------------*/
|
|
203 |
|
|
204 |
/** @defgroup RCC_Exported_Types RCC Exported Types
|
|
205 |
* @{
|
|
206 |
*/
|
|
207 |
|
|
208 |
/**
|
|
209 |
* @brief RCC PLL configuration structure definition
|
|
210 |
*/
|
|
211 |
typedef struct
|
|
212 |
{
|
|
213 |
uint32_t PLLState; /*!< PLLState: The new state of the PLL.
|
|
214 |
This parameter can be a value of @ref RCC_PLL_Config */
|
|
215 |
|
|
216 |
uint32_t PLLSource; /*!< PLLSource: PLL entry clock source.
|
|
217 |
This parameter must be a value of @ref RCC_PLL_Clock_Source */
|
|
218 |
|
|
219 |
uint32_t PLLMUL; /*!< PLLMUL: Multiplication factor for PLL VCO input clock
|
|
220 |
This parameter must be a value of @ref RCC_PLL_Multiplication_Factor*/
|
|
221 |
|
|
222 |
uint32_t PREDIV; /*!< PREDIV: Predivision factor for PLL VCO input clock
|
|
223 |
This parameter must be a value of @ref RCC_PLL_Prediv_Factor */
|
|
224 |
|
|
225 |
} RCC_PLLInitTypeDef;
|
|
226 |
|
|
227 |
/**
|
|
228 |
* @brief RCC Internal/External Oscillator (HSE, HSI, LSE and LSI) configuration structure definition
|
|
229 |
*/
|
|
230 |
typedef struct
|
|
231 |
{
|
|
232 |
uint32_t OscillatorType; /*!< The oscillators to be configured.
|
|
233 |
This parameter can be a value of @ref RCC_Oscillator_Type */
|
|
234 |
|
|
235 |
uint32_t HSEState; /*!< The new state of the HSE.
|
|
236 |
This parameter can be a value of @ref RCC_HSE_Config */
|
|
237 |
|
|
238 |
uint32_t LSEState; /*!< The new state of the LSE.
|
|
239 |
This parameter can be a value of @ref RCC_LSE_Config */
|
|
240 |
|
|
241 |
uint32_t HSIState; /*!< The new state of the HSI.
|
|
242 |
This parameter can be a value of @ref RCC_HSI_Config */
|
|
243 |
|
|
244 |
uint32_t HSICalibrationValue; /*!< The HSI calibration trimming value (default is RCC_HSICALIBRATION_DEFAULT).
|
|
245 |
This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x1FU */
|
|
246 |
|
|
247 |
uint32_t HSI14State; /*!< The new state of the HSI14.
|
|
248 |
This parameter can be a value of @ref RCC_HSI14_Config */
|
|
249 |
|
|
250 |
uint32_t HSI14CalibrationValue; /*!< The HSI14 calibration trimming value (default is RCC_HSI14CALIBRATION_DEFAULT).
|
|
251 |
This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x1FU */
|
|
252 |
|
|
253 |
uint32_t LSIState; /*!< The new state of the LSI.
|
|
254 |
This parameter can be a value of @ref RCC_LSI_Config */
|
|
255 |
|
|
256 |
#if defined(RCC_HSI48_SUPPORT)
|
|
257 |
uint32_t HSI48State; /*!< The new state of the HSI48.
|
|
258 |
This parameter can be a value of @ref RCC_HSI48_Config */
|
|
259 |
|
|
260 |
#endif /* RCC_HSI48_SUPPORT */
|
|
261 |
RCC_PLLInitTypeDef PLL; /*!< PLL structure parameters */
|
|
262 |
|
|
263 |
} RCC_OscInitTypeDef;
|
|
264 |
|
|
265 |
/**
|
|
266 |
* @brief RCC System, AHB and APB busses clock configuration structure definition
|
|
267 |
*/
|
|
268 |
typedef struct
|
|
269 |
{
|
|
270 |
uint32_t ClockType; /*!< The clock to be configured.
|
|
271 |
This parameter can be a value of @ref RCC_System_Clock_Type */
|
|
272 |
|
|
273 |
uint32_t SYSCLKSource; /*!< The clock source (SYSCLKS) used as system clock.
|
|
274 |
This parameter can be a value of @ref RCC_System_Clock_Source */
|
|
275 |
|
|
276 |
uint32_t AHBCLKDivider; /*!< The AHB clock (HCLK) divider. This clock is derived from the system clock (SYSCLK).
|
|
277 |
This parameter can be a value of @ref RCC_AHB_Clock_Source */
|
|
278 |
|
|
279 |
uint32_t APB1CLKDivider; /*!< The APB1 clock (PCLK1) divider. This clock is derived from the AHB clock (HCLK).
|
|
280 |
This parameter can be a value of @ref RCC_APB1_Clock_Source */
|
|
281 |
|
|
282 |
} RCC_ClkInitTypeDef;
|
|
283 |
|
|
284 |
/**
|
|
285 |
* @}
|
|
286 |
*/
|
|
287 |
|
|
288 |
/* Exported constants --------------------------------------------------------*/
|
|
289 |
/** @defgroup RCC_Exported_Constants RCC Exported Constants
|
|
290 |
* @{
|
|
291 |
*/
|
|
292 |
|
|
293 |
/** @defgroup RCC_PLL_Clock_Source PLL Clock Source
|
|
294 |
* @{
|
|
295 |
*/
|
|
296 |
|
|
297 |
#define RCC_PLLSOURCE_HSE RCC_CFGR_PLLSRC_HSE_PREDIV /*!< HSE clock selected as PLL entry clock source */
|
|
298 |
|
|
299 |
/**
|
|
300 |
* @}
|
|
301 |
*/
|
|
302 |
|
|
303 |
/** @defgroup RCC_Oscillator_Type Oscillator Type
|
|
304 |
* @{
|
|
305 |
*/
|
|
306 |
#define RCC_OSCILLATORTYPE_NONE (0x00000000U)
|
|
307 |
#define RCC_OSCILLATORTYPE_HSE (0x00000001U)
|
|
308 |
#define RCC_OSCILLATORTYPE_HSI (0x00000002U)
|
|
309 |
#define RCC_OSCILLATORTYPE_LSE (0x00000004U)
|
|
310 |
#define RCC_OSCILLATORTYPE_LSI (0x00000008U)
|
|
311 |
#define RCC_OSCILLATORTYPE_HSI14 (0x00000010U)
|
|
312 |
#if defined(RCC_HSI48_SUPPORT)
|
|
313 |
#define RCC_OSCILLATORTYPE_HSI48 (0x00000020U)
|
|
314 |
#endif /* RCC_HSI48_SUPPORT */
|
|
315 |
/**
|
|
316 |
* @}
|
|
317 |
*/
|
|
318 |
|
|
319 |
/** @defgroup RCC_HSE_Config HSE Config
|
|
320 |
* @{
|
|
321 |
*/
|
|
322 |
#define RCC_HSE_OFF (0x00000000U) /*!< HSE clock deactivation */
|
|
323 |
#define RCC_HSE_ON (0x00000001U) /*!< HSE clock activation */
|
|
324 |
#define RCC_HSE_BYPASS (0x00000005U) /*!< External clock source for HSE clock */
|
|
325 |
/**
|
|
326 |
* @}
|
|
327 |
*/
|
|
328 |
|
|
329 |
/** @defgroup RCC_LSE_Config LSE Config
|
|
330 |
* @{
|
|
331 |
*/
|
|
332 |
#define RCC_LSE_OFF (0x00000000U) /*!< LSE clock deactivation */
|
|
333 |
#define RCC_LSE_ON (0x00000001U) /*!< LSE clock activation */
|
|
334 |
#define RCC_LSE_BYPASS (0x00000005U) /*!< External clock source for LSE clock */
|
|
335 |
|
|
336 |
/**
|
|
337 |
* @}
|
|
338 |
*/
|
|
339 |
|
|
340 |
/** @defgroup RCC_HSI_Config HSI Config
|
|
341 |
* @{
|
|
342 |
*/
|
|
343 |
#define RCC_HSI_OFF (0x00000000U) /*!< HSI clock deactivation */
|
|
344 |
#define RCC_HSI_ON RCC_CR_HSION /*!< HSI clock activation */
|
|
345 |
|
|
346 |
#define RCC_HSICALIBRATION_DEFAULT (0x10U) /* Default HSI calibration trimming value */
|
|
347 |
|
|
348 |
/**
|
|
349 |
* @}
|
|
350 |
*/
|
|
351 |
|
|
352 |
/** @defgroup RCC_HSI14_Config RCC HSI14 Config
|
|
353 |
* @{
|
|
354 |
*/
|
|
355 |
#define RCC_HSI14_OFF (0x00000000U)
|
|
356 |
#define RCC_HSI14_ON RCC_CR2_HSI14ON
|
|
357 |
#define RCC_HSI14_ADC_CONTROL (~RCC_CR2_HSI14DIS)
|
|
358 |
|
|
359 |
#define RCC_HSI14CALIBRATION_DEFAULT (0x10U) /* Default HSI14 calibration trimming value */
|
|
360 |
/**
|
|
361 |
* @}
|
|
362 |
*/
|
|
363 |
|
|
364 |
/** @defgroup RCC_LSI_Config LSI Config
|
|
365 |
* @{
|
|
366 |
*/
|
|
367 |
#define RCC_LSI_OFF (0x00000000U) /*!< LSI clock deactivation */
|
|
368 |
#define RCC_LSI_ON RCC_CSR_LSION /*!< LSI clock activation */
|
|
369 |
|
|
370 |
/**
|
|
371 |
* @}
|
|
372 |
*/
|
|
373 |
|
|
374 |
#if defined(RCC_HSI48_SUPPORT)
|
|
375 |
/** @defgroup RCC_HSI48_Config HSI48 Config
|
|
376 |
* @{
|
|
377 |
*/
|
|
378 |
#define RCC_HSI48_OFF ((uint8_t)0x00U)
|
|
379 |
#define RCC_HSI48_ON ((uint8_t)0x01U)
|
|
380 |
|
|
381 |
/**
|
|
382 |
* @}
|
|
383 |
*/
|
|
384 |
#endif /* RCC_HSI48_SUPPORT */
|
|
385 |
|
|
386 |
/** @defgroup RCC_PLL_Config PLL Config
|
|
387 |
* @{
|
|
388 |
*/
|
|
389 |
#define RCC_PLL_NONE (0x00000000U) /*!< PLL is not configured */
|
|
390 |
#define RCC_PLL_OFF (0x00000001U) /*!< PLL deactivation */
|
|
391 |
#define RCC_PLL_ON (0x00000002U) /*!< PLL activation */
|
|
392 |
|
|
393 |
/**
|
|
394 |
* @}
|
|
395 |
*/
|
|
396 |
|
|
397 |
/** @defgroup RCC_System_Clock_Type System Clock Type
|
|
398 |
* @{
|
|
399 |
*/
|
|
400 |
#define RCC_CLOCKTYPE_SYSCLK (0x00000001U) /*!< SYSCLK to configure */
|
|
401 |
#define RCC_CLOCKTYPE_HCLK (0x00000002U) /*!< HCLK to configure */
|
|
402 |
#define RCC_CLOCKTYPE_PCLK1 (0x00000004U) /*!< PCLK1 to configure */
|
|
403 |
|
|
404 |
/**
|
|
405 |
* @}
|
|
406 |
*/
|
|
407 |
|
|
408 |
/** @defgroup RCC_System_Clock_Source System Clock Source
|
|
409 |
* @{
|
|
410 |
*/
|
|
411 |
#define RCC_SYSCLKSOURCE_HSI RCC_CFGR_SW_HSI /*!< HSI selected as system clock */
|
|
412 |
#define RCC_SYSCLKSOURCE_HSE RCC_CFGR_SW_HSE /*!< HSE selected as system clock */
|
|
413 |
#define RCC_SYSCLKSOURCE_PLLCLK RCC_CFGR_SW_PLL /*!< PLL selected as system clock */
|
|
414 |
|
|
415 |
/**
|
|
416 |
* @}
|
|
417 |
*/
|
|
418 |
|
|
419 |
/** @defgroup RCC_System_Clock_Source_Status System Clock Source Status
|
|
420 |
* @{
|
|
421 |
*/
|
|
422 |
#define RCC_SYSCLKSOURCE_STATUS_HSI RCC_CFGR_SWS_HSI /*!< HSI used as system clock */
|
|
423 |
#define RCC_SYSCLKSOURCE_STATUS_HSE RCC_CFGR_SWS_HSE /*!< HSE used as system clock */
|
|
424 |
#define RCC_SYSCLKSOURCE_STATUS_PLLCLK RCC_CFGR_SWS_PLL /*!< PLL used as system clock */
|
|
425 |
|
|
426 |
/**
|
|
427 |
* @}
|
|
428 |
*/
|
|
429 |
|
|
430 |
/** @defgroup RCC_AHB_Clock_Source AHB Clock Source
|
|
431 |
* @{
|
|
432 |
*/
|
|
433 |
#define RCC_SYSCLK_DIV1 RCC_CFGR_HPRE_DIV1 /*!< SYSCLK not divided */
|
|
434 |
#define RCC_SYSCLK_DIV2 RCC_CFGR_HPRE_DIV2 /*!< SYSCLK divided by 2 */
|
|
435 |
#define RCC_SYSCLK_DIV4 RCC_CFGR_HPRE_DIV4 /*!< SYSCLK divided by 4 */
|
|
436 |
#define RCC_SYSCLK_DIV8 RCC_CFGR_HPRE_DIV8 /*!< SYSCLK divided by 8 */
|
|
437 |
#define RCC_SYSCLK_DIV16 RCC_CFGR_HPRE_DIV16 /*!< SYSCLK divided by 16 */
|
|
438 |
#define RCC_SYSCLK_DIV64 RCC_CFGR_HPRE_DIV64 /*!< SYSCLK divided by 64 */
|
|
439 |
#define RCC_SYSCLK_DIV128 RCC_CFGR_HPRE_DIV128 /*!< SYSCLK divided by 128 */
|
|
440 |
#define RCC_SYSCLK_DIV256 RCC_CFGR_HPRE_DIV256 /*!< SYSCLK divided by 256 */
|
|
441 |
#define RCC_SYSCLK_DIV512 RCC_CFGR_HPRE_DIV512 /*!< SYSCLK divided by 512 */
|
|
442 |
|
|
443 |
/**
|
|
444 |
* @}
|
|
445 |
*/
|
|
446 |
|
|
447 |
/** @defgroup RCC_APB1_Clock_Source RCC APB1 Clock Source
|
|
448 |
* @{
|
|
449 |
*/
|
|
450 |
#define RCC_HCLK_DIV1 RCC_CFGR_PPRE_DIV1 /*!< HCLK not divided */
|
|
451 |
#define RCC_HCLK_DIV2 RCC_CFGR_PPRE_DIV2 /*!< HCLK divided by 2 */
|
|
452 |
#define RCC_HCLK_DIV4 RCC_CFGR_PPRE_DIV4 /*!< HCLK divided by 4 */
|
|
453 |
#define RCC_HCLK_DIV8 RCC_CFGR_PPRE_DIV8 /*!< HCLK divided by 8 */
|
|
454 |
#define RCC_HCLK_DIV16 RCC_CFGR_PPRE_DIV16 /*!< HCLK divided by 16 */
|
|
455 |
|
|
456 |
/**
|
|
457 |
* @}
|
|
458 |
*/
|
|
459 |
|
|
460 |
/** @defgroup RCC_RTC_Clock_Source RTC Clock Source
|
|
461 |
* @{
|
|
462 |
*/
|
|
463 |
#define RCC_RTCCLKSOURCE_NO_CLK (0x00000000U) /*!< No clock */
|
|
464 |
#define RCC_RTCCLKSOURCE_LSE RCC_BDCR_RTCSEL_LSE /*!< LSE oscillator clock used as RTC clock */
|
|
465 |
#define RCC_RTCCLKSOURCE_LSI RCC_BDCR_RTCSEL_LSI /*!< LSI oscillator clock used as RTC clock */
|
|
466 |
#define RCC_RTCCLKSOURCE_HSE_DIV32 RCC_BDCR_RTCSEL_HSE /*!< HSE oscillator clock divided by 32 used as RTC clock */
|
|
467 |
/**
|
|
468 |
* @}
|
|
469 |
*/
|
|
470 |
|
|
471 |
/** @defgroup RCC_PLL_Multiplication_Factor RCC PLL Multiplication Factor
|
|
472 |
* @{
|
|
473 |
*/
|
|
474 |
#define RCC_PLL_MUL2 RCC_CFGR_PLLMUL2
|
|
475 |
#define RCC_PLL_MUL3 RCC_CFGR_PLLMUL3
|
|
476 |
#define RCC_PLL_MUL4 RCC_CFGR_PLLMUL4
|
|
477 |
#define RCC_PLL_MUL5 RCC_CFGR_PLLMUL5
|
|
478 |
#define RCC_PLL_MUL6 RCC_CFGR_PLLMUL6
|
|
479 |
#define RCC_PLL_MUL7 RCC_CFGR_PLLMUL7
|
|
480 |
#define RCC_PLL_MUL8 RCC_CFGR_PLLMUL8
|
|
481 |
#define RCC_PLL_MUL9 RCC_CFGR_PLLMUL9
|
|
482 |
#define RCC_PLL_MUL10 RCC_CFGR_PLLMUL10
|
|
483 |
#define RCC_PLL_MUL11 RCC_CFGR_PLLMUL11
|
|
484 |
#define RCC_PLL_MUL12 RCC_CFGR_PLLMUL12
|
|
485 |
#define RCC_PLL_MUL13 RCC_CFGR_PLLMUL13
|
|
486 |
#define RCC_PLL_MUL14 RCC_CFGR_PLLMUL14
|
|
487 |
#define RCC_PLL_MUL15 RCC_CFGR_PLLMUL15
|
|
488 |
#define RCC_PLL_MUL16 RCC_CFGR_PLLMUL16
|
|
489 |
|
|
490 |
/**
|
|
491 |
* @}
|
|
492 |
*/
|
|
493 |
|
|
494 |
/** @defgroup RCC_PLL_Prediv_Factor RCC PLL Prediv Factor
|
|
495 |
* @{
|
|
496 |
*/
|
|
497 |
|
|
498 |
#define RCC_PREDIV_DIV1 RCC_CFGR2_PREDIV_DIV1
|
|
499 |
#define RCC_PREDIV_DIV2 RCC_CFGR2_PREDIV_DIV2
|
|
500 |
#define RCC_PREDIV_DIV3 RCC_CFGR2_PREDIV_DIV3
|
|
501 |
#define RCC_PREDIV_DIV4 RCC_CFGR2_PREDIV_DIV4
|
|
502 |
#define RCC_PREDIV_DIV5 RCC_CFGR2_PREDIV_DIV5
|
|
503 |
#define RCC_PREDIV_DIV6 RCC_CFGR2_PREDIV_DIV6
|
|
504 |
#define RCC_PREDIV_DIV7 RCC_CFGR2_PREDIV_DIV7
|
|
505 |
#define RCC_PREDIV_DIV8 RCC_CFGR2_PREDIV_DIV8
|
|
506 |
#define RCC_PREDIV_DIV9 RCC_CFGR2_PREDIV_DIV9
|
|
507 |
#define RCC_PREDIV_DIV10 RCC_CFGR2_PREDIV_DIV10
|
|
508 |
#define RCC_PREDIV_DIV11 RCC_CFGR2_PREDIV_DIV11
|
|
509 |
#define RCC_PREDIV_DIV12 RCC_CFGR2_PREDIV_DIV12
|
|
510 |
#define RCC_PREDIV_DIV13 RCC_CFGR2_PREDIV_DIV13
|
|
511 |
#define RCC_PREDIV_DIV14 RCC_CFGR2_PREDIV_DIV14
|
|
512 |
#define RCC_PREDIV_DIV15 RCC_CFGR2_PREDIV_DIV15
|
|
513 |
#define RCC_PREDIV_DIV16 RCC_CFGR2_PREDIV_DIV16
|
|
514 |
|
|
515 |
/**
|
|
516 |
* @}
|
|
517 |
*/
|
|
518 |
|
|
519 |
|
|
520 |
/** @defgroup RCC_USART1_Clock_Source RCC USART1 Clock Source
|
|
521 |
* @{
|
|
522 |
*/
|
|
523 |
#define RCC_USART1CLKSOURCE_PCLK1 RCC_CFGR3_USART1SW_PCLK
|
|
524 |
#define RCC_USART1CLKSOURCE_SYSCLK RCC_CFGR3_USART1SW_SYSCLK
|
|
525 |
#define RCC_USART1CLKSOURCE_LSE RCC_CFGR3_USART1SW_LSE
|
|
526 |
#define RCC_USART1CLKSOURCE_HSI RCC_CFGR3_USART1SW_HSI
|
|
527 |
|
|
528 |
/**
|
|
529 |
* @}
|
|
530 |
*/
|
|
531 |
|
|
532 |
/** @defgroup RCC_I2C1_Clock_Source RCC I2C1 Clock Source
|
|
533 |
* @{
|
|
534 |
*/
|
|
535 |
#define RCC_I2C1CLKSOURCE_HSI RCC_CFGR3_I2C1SW_HSI
|
|
536 |
#define RCC_I2C1CLKSOURCE_SYSCLK RCC_CFGR3_I2C1SW_SYSCLK
|
|
537 |
|
|
538 |
/**
|
|
539 |
* @}
|
|
540 |
*/
|
|
541 |
/** @defgroup RCC_MCO_Index MCO Index
|
|
542 |
* @{
|
|
543 |
*/
|
|
544 |
#define RCC_MCO1 (0x00000000U)
|
|
545 |
#define RCC_MCO RCC_MCO1 /*!< MCO1 to be compliant with other families with 2 MCOs*/
|
|
546 |
|
|
547 |
/**
|
|
548 |
* @}
|
|
549 |
*/
|
|
550 |
|
|
551 |
/** @defgroup RCC_MCO_Clock_Source RCC MCO Clock Source
|
|
552 |
* @{
|
|
553 |
*/
|
|
554 |
#define RCC_MCO1SOURCE_NOCLOCK RCC_CFGR_MCO_NOCLOCK
|
|
555 |
#define RCC_MCO1SOURCE_LSI RCC_CFGR_MCO_LSI
|
|
556 |
#define RCC_MCO1SOURCE_LSE RCC_CFGR_MCO_LSE
|
|
557 |
#define RCC_MCO1SOURCE_SYSCLK RCC_CFGR_MCO_SYSCLK
|
|
558 |
#define RCC_MCO1SOURCE_HSI RCC_CFGR_MCO_HSI
|
|
559 |
#define RCC_MCO1SOURCE_HSE RCC_CFGR_MCO_HSE
|
|
560 |
#define RCC_MCO1SOURCE_PLLCLK_DIV2 RCC_CFGR_MCO_PLL
|
|
561 |
#define RCC_MCO1SOURCE_HSI14 RCC_CFGR_MCO_HSI14
|
|
562 |
|
|
563 |
/**
|
|
564 |
* @}
|
|
565 |
*/
|
|
566 |
|
|
567 |
/** @defgroup RCC_Interrupt Interrupts
|
|
568 |
* @{
|
|
569 |
*/
|
|
570 |
#define RCC_IT_LSIRDY ((uint8_t)RCC_CIR_LSIRDYF) /*!< LSI Ready Interrupt flag */
|
|
571 |
#define RCC_IT_LSERDY ((uint8_t)RCC_CIR_LSERDYF) /*!< LSE Ready Interrupt flag */
|
|
572 |
#define RCC_IT_HSIRDY ((uint8_t)RCC_CIR_HSIRDYF) /*!< HSI Ready Interrupt flag */
|
|
573 |
#define RCC_IT_HSERDY ((uint8_t)RCC_CIR_HSERDYF) /*!< HSE Ready Interrupt flag */
|
|
574 |
#define RCC_IT_PLLRDY ((uint8_t)RCC_CIR_PLLRDYF) /*!< PLL Ready Interrupt flag */
|
|
575 |
#define RCC_IT_HSI14RDY ((uint8_t)RCC_CIR_HSI14RDYF) /*!< HSI14 Ready Interrupt flag */
|
|
576 |
#if defined(RCC_CIR_HSI48RDYF)
|
|
577 |
#define RCC_IT_HSI48RDY ((uint8_t)RCC_CIR_HSI48RDYF) /*!< HSI48 Ready Interrupt flag */
|
|
578 |
#endif
|
|
579 |
#define RCC_IT_CSS ((uint8_t)RCC_CIR_CSSF) /*!< Clock Security System Interrupt flag */
|
|
580 |
/**
|
|
581 |
* @}
|
|
582 |
*/
|
|
583 |
|
|
584 |
/** @defgroup RCC_Flag Flags
|
|
585 |
* Elements values convention: XXXYYYYYb
|
|
586 |
* - YYYYY : Flag position in the register
|
|
587 |
* - XXX : Register index
|
|
588 |
* - 001: CR register
|
|
589 |
* - 010: CR2 register
|
|
590 |
* - 011: BDCR register
|
|
591 |
* - 0100: CSR register
|
|
592 |
* @{
|
|
593 |
*/
|
|
594 |
/* Flags in the CR register */
|
|
595 |
#define RCC_FLAG_HSIRDY ((uint8_t)((CR_REG_INDEX << 5U) | RCC_CR_HSIRDY_BitNumber))
|
|
596 |
#define RCC_FLAG_HSERDY ((uint8_t)((CR_REG_INDEX << 5U) | RCC_CR_HSERDY_BitNumber))
|
|
597 |
#define RCC_FLAG_PLLRDY ((uint8_t)((CR_REG_INDEX << 5U) | RCC_CR_PLLRDY_BitNumber))
|
|
598 |
/* Flags in the CR2 register */
|
|
599 |
#define RCC_FLAG_HSI14RDY ((uint8_t)((CR2_REG_INDEX << 5U) | RCC_CR2_HSI14RDY_BitNumber))
|
|
600 |
|
|
601 |
/* Flags in the CSR register */
|
|
602 |
#define RCC_FLAG_LSIRDY ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_LSIRDY_BitNumber))
|
|
603 |
#if defined(RCC_CSR_V18PWRRSTF)
|
|
604 |
#define RCC_FLAG_V18PWRRST ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_V18PWRRSTF_BitNumber))
|
|
605 |
#endif
|
|
606 |
#define RCC_FLAG_OBLRST ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_OBLRSTF_BitNumber))
|
|
607 |
#define RCC_FLAG_PINRST ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_PINRSTF_BitNumber)) /*!< PIN reset flag */
|
|
608 |
#define RCC_FLAG_PORRST ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_PORRSTF_BitNumber)) /*!< POR/PDR reset flag */
|
|
609 |
#define RCC_FLAG_SFTRST ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_SFTRSTF_BitNumber)) /*!< Software Reset flag */
|
|
610 |
#define RCC_FLAG_IWDGRST ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_IWDGRSTF_BitNumber)) /*!< Independent Watchdog reset flag */
|
|
611 |
#define RCC_FLAG_WWDGRST ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_WWDGRSTF_BitNumber)) /*!< Window watchdog reset flag */
|
|
612 |
#define RCC_FLAG_LPWRRST ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_LPWRRSTF_BitNumber)) /*!< Low-Power reset flag */
|
|
613 |
|
|
614 |
/* Flags in the BDCR register */
|
|
615 |
#define RCC_FLAG_LSERDY ((uint8_t)((BDCR_REG_INDEX << 5U) | RCC_BDCR_LSERDY_BitNumber)) /*!< External Low Speed oscillator Ready */
|
|
616 |
|
|
617 |
/**
|
|
618 |
* @}
|
|
619 |
*/
|
|
620 |
|
|
621 |
/**
|
|
622 |
* @}
|
|
623 |
*/
|
|
624 |
|
|
625 |
/* Exported macro ------------------------------------------------------------*/
|
|
626 |
|
|
627 |
/** @defgroup RCC_Exported_Macros RCC Exported Macros
|
|
628 |
* @{
|
|
629 |
*/
|
|
630 |
|
|
631 |
/** @defgroup RCC_AHB_Clock_Enable_Disable RCC AHB Clock Enable Disable
|
|
632 |
* @brief Enable or disable the AHB peripheral clock.
|
|
633 |
* @note After reset, the peripheral clock (used for registers read/write access)
|
|
634 |
* is disabled and the application software has to enable this clock before
|
|
635 |
* using it.
|
|
636 |
* @{
|
|
637 |
*/
|
|
638 |
#define __HAL_RCC_GPIOA_CLK_ENABLE() do { \
|
|
639 |
__IO uint32_t tmpreg; \
|
|
640 |
SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIOAEN);\
|
|
641 |
/* Delay after an RCC peripheral clock enabling */\
|
|
642 |
tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_GPIOAEN);\
|
|
643 |
UNUSED(tmpreg); \
|
|
644 |
} while(0U)
|
|
645 |
#define __HAL_RCC_GPIOB_CLK_ENABLE() do { \
|
|
646 |
__IO uint32_t tmpreg; \
|
|
647 |
SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIOBEN);\
|
|
648 |
/* Delay after an RCC peripheral clock enabling */\
|
|
649 |
tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_GPIOBEN);\
|
|
650 |
UNUSED(tmpreg); \
|
|
651 |
} while(0U)
|
|
652 |
#define __HAL_RCC_GPIOC_CLK_ENABLE() do { \
|
|
653 |
__IO uint32_t tmpreg; \
|
|
654 |
SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIOCEN);\
|
|
655 |
/* Delay after an RCC peripheral clock enabling */\
|
|
656 |
tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_GPIOCEN);\
|
|
657 |
UNUSED(tmpreg); \
|
|
658 |
} while(0U)
|
|
659 |
#define __HAL_RCC_GPIOF_CLK_ENABLE() do { \
|
|
660 |
__IO uint32_t tmpreg; \
|
|
661 |
SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIOFEN);\
|
|
662 |
/* Delay after an RCC peripheral clock enabling */\
|
|
663 |
tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_GPIOFEN);\
|
|
664 |
UNUSED(tmpreg); \
|
|
665 |
} while(0U)
|
|
666 |
#define __HAL_RCC_CRC_CLK_ENABLE() do { \
|
|
667 |
__IO uint32_t tmpreg; \
|
|
668 |
SET_BIT(RCC->AHBENR, RCC_AHBENR_CRCEN);\
|
|
669 |
/* Delay after an RCC peripheral clock enabling */\
|
|
670 |
tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_CRCEN);\
|
|
671 |
UNUSED(tmpreg); \
|
|
672 |
} while(0U)
|
|
673 |
#define __HAL_RCC_DMA1_CLK_ENABLE() do { \
|
|
674 |
__IO uint32_t tmpreg; \
|
|
675 |
SET_BIT(RCC->AHBENR, RCC_AHBENR_DMA1EN);\
|
|
676 |
/* Delay after an RCC peripheral clock enabling */\
|
|
677 |
tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_DMA1EN);\
|
|
678 |
UNUSED(tmpreg); \
|
|
679 |
} while(0U)
|
|
680 |
#define __HAL_RCC_SRAM_CLK_ENABLE() do { \
|
|
681 |
__IO uint32_t tmpreg; \
|
|
682 |
SET_BIT(RCC->AHBENR, RCC_AHBENR_SRAMEN);\
|
|
683 |
/* Delay after an RCC peripheral clock enabling */\
|
|
684 |
tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_SRAMEN);\
|
|
685 |
UNUSED(tmpreg); \
|
|
686 |
} while(0U)
|
|
687 |
#define __HAL_RCC_FLITF_CLK_ENABLE() do { \
|
|
688 |
__IO uint32_t tmpreg; \
|
|
689 |
SET_BIT(RCC->AHBENR, RCC_AHBENR_FLITFEN);\
|
|
690 |
/* Delay after an RCC peripheral clock enabling */\
|
|
691 |
tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_FLITFEN);\
|
|
692 |
UNUSED(tmpreg); \
|
|
693 |
} while(0U)
|
|
694 |
|
|
695 |
#define __HAL_RCC_GPIOA_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_GPIOAEN))
|
|
696 |
#define __HAL_RCC_GPIOB_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_GPIOBEN))
|
|
697 |
#define __HAL_RCC_GPIOC_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_GPIOCEN))
|
|
698 |
#define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_GPIOFEN))
|
|
699 |
#define __HAL_RCC_CRC_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_CRCEN))
|
|
700 |
#define __HAL_RCC_DMA1_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_DMA1EN))
|
|
701 |
#define __HAL_RCC_SRAM_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_SRAMEN))
|
|
702 |
#define __HAL_RCC_FLITF_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_FLITFEN))
|
|
703 |
/**
|
|
704 |
* @}
|
|
705 |
*/
|
|
706 |
|
|
707 |
/** @defgroup RCC_AHB_Peripheral_Clock_Enable_Disable_Status AHB Peripheral Clock Enable Disable Status
|
|
708 |
* @brief Get the enable or disable status of the AHB peripheral clock.
|
|
709 |
* @note After reset, the peripheral clock (used for registers read/write access)
|
|
710 |
* is disabled and the application software has to enable this clock before
|
|
711 |
* using it.
|
|
712 |
* @{
|
|
713 |
*/
|
|
714 |
#define __HAL_RCC_GPIOA_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_GPIOAEN)) != RESET)
|
|
715 |
#define __HAL_RCC_GPIOB_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_GPIOBEN)) != RESET)
|
|
716 |
#define __HAL_RCC_GPIOC_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_GPIOCEN)) != RESET)
|
|
717 |
#define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_GPIOFEN)) != RESET)
|
|
718 |
#define __HAL_RCC_CRC_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_CRCEN)) != RESET)
|
|
719 |
#define __HAL_RCC_DMA1_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_DMA1EN)) != RESET)
|
|
720 |
#define __HAL_RCC_SRAM_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_SRAMEN)) != RESET)
|
|
721 |
#define __HAL_RCC_FLITF_IS_CLK_ENABLED() ((RCC->AHBENR & (RCC_AHBENR_FLITFEN)) != RESET)
|
|
722 |
#define __HAL_RCC_GPIOA_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_GPIOAEN)) == RESET)
|
|
723 |
#define __HAL_RCC_GPIOB_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_GPIOBEN)) == RESET)
|
|
724 |
#define __HAL_RCC_GPIOC_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_GPIOCEN)) == RESET)
|
|
725 |
#define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_GPIOFEN)) == RESET)
|
|
726 |
#define __HAL_RCC_CRC_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_CRCEN)) == RESET)
|
|
727 |
#define __HAL_RCC_DMA1_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_DMA1EN)) == RESET)
|
|
728 |
#define __HAL_RCC_SRAM_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_SRAMEN)) == RESET)
|
|
729 |
#define __HAL_RCC_FLITF_IS_CLK_DISABLED() ((RCC->AHBENR & (RCC_AHBENR_FLITFEN)) == RESET)
|
|
730 |
/**
|
|
731 |
* @}
|
|
732 |
*/
|
|
733 |
|
|
734 |
/** @defgroup RCC_APB1_Clock_Enable_Disable RCC APB1 Clock Enable Disable
|
|
735 |
* @brief Enable or disable the Low Speed APB (APB1) peripheral clock.
|
|
736 |
* @note After reset, the peripheral clock (used for registers read/write access)
|
|
737 |
* is disabled and the application software has to enable this clock before
|
|
738 |
* using it.
|
|
739 |
* @{
|
|
740 |
*/
|
|
741 |
#define __HAL_RCC_TIM3_CLK_ENABLE() do { \
|
|
742 |
__IO uint32_t tmpreg; \
|
|
743 |
SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
|
|
744 |
/* Delay after an RCC peripheral clock enabling */\
|
|
745 |
tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
|
|
746 |
UNUSED(tmpreg); \
|
|
747 |
} while(0U)
|
|
748 |
#define __HAL_RCC_TIM14_CLK_ENABLE() do { \
|
|
749 |
__IO uint32_t tmpreg; \
|
|
750 |
SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
|
|
751 |
/* Delay after an RCC peripheral clock enabling */\
|
|
752 |
tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
|
|
753 |
UNUSED(tmpreg); \
|
|
754 |
} while(0U)
|
|
755 |
#define __HAL_RCC_WWDG_CLK_ENABLE() do { \
|
|
756 |
__IO uint32_t tmpreg; \
|
|
757 |
SET_BIT(RCC->APB1ENR, RCC_APB1ENR_WWDGEN);\
|
|
758 |
/* Delay after an RCC peripheral clock enabling */\
|
|
759 |
tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_WWDGEN);\
|
|
760 |
UNUSED(tmpreg); \
|
|
761 |
} while(0U)
|
|
762 |
#define __HAL_RCC_I2C1_CLK_ENABLE() do { \
|
|
763 |
__IO uint32_t tmpreg; \
|
|
764 |
SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C1EN);\
|
|
765 |
/* Delay after an RCC peripheral clock enabling */\
|
|
766 |
tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C1EN);\
|
|
767 |
UNUSED(tmpreg); \
|
|
768 |
} while(0U)
|
|
769 |
#define __HAL_RCC_PWR_CLK_ENABLE() do { \
|
|
770 |
__IO uint32_t tmpreg; \
|
|
771 |
SET_BIT(RCC->APB1ENR, RCC_APB1ENR_PWREN);\
|
|
772 |
/* Delay after an RCC peripheral clock enabling */\
|
|
773 |
tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_PWREN);\
|
|
774 |
UNUSED(tmpreg); \
|
|
775 |
} while(0U)
|
|
776 |
|
|
777 |
#define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN))
|
|
778 |
#define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN))
|
|
779 |
#define __HAL_RCC_WWDG_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_WWDGEN))
|
|
780 |
#define __HAL_RCC_I2C1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C1EN))
|
|
781 |
#define __HAL_RCC_PWR_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_PWREN))
|
|
782 |
/**
|
|
783 |
* @}
|
|
784 |
*/
|
|
785 |
|
|
786 |
/** @defgroup RCC_APB1_Peripheral_Clock_Enable_Disable_Status APB1 Peripheral Clock Enable Disable Status
|
|
787 |
* @brief Get the enable or disable status of the APB1 peripheral clock.
|
|
788 |
* @note After reset, the peripheral clock (used for registers read/write access)
|
|
789 |
* is disabled and the application software has to enable this clock before
|
|
790 |
* using it.
|
|
791 |
* @{
|
|
792 |
*/
|
|
793 |
#define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET)
|
|
794 |
#define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET)
|
|
795 |
#define __HAL_RCC_WWDG_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_WWDGEN)) != RESET)
|
|
796 |
#define __HAL_RCC_I2C1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C1EN)) != RESET)
|
|
797 |
#define __HAL_RCC_PWR_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_PWREN)) != RESET)
|
|
798 |
#define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET)
|
|
799 |
#define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET)
|
|
800 |
#define __HAL_RCC_WWDG_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_WWDGEN)) == RESET)
|
|
801 |
#define __HAL_RCC_I2C1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C1EN)) == RESET)
|
|
802 |
#define __HAL_RCC_PWR_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_PWREN)) == RESET)
|
|
803 |
/**
|
|
804 |
* @}
|
|
805 |
*/
|
|
806 |
|
|
807 |
|
|
808 |
/** @defgroup RCC_APB2_Clock_Enable_Disable RCC APB2 Clock Enable Disable
|
|
809 |
* @brief Enable or disable the High Speed APB (APB2) peripheral clock.
|
|
810 |
* @note After reset, the peripheral clock (used for registers read/write access)
|
|
811 |
* is disabled and the application software has to enable this clock before
|
|
812 |
* using it.
|
|
813 |
* @{
|
|
814 |
*/
|
|
815 |
#define __HAL_RCC_SYSCFG_CLK_ENABLE() do { \
|
|
816 |
__IO uint32_t tmpreg; \
|
|
817 |
SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SYSCFGEN);\
|
|
818 |
/* Delay after an RCC peripheral clock enabling */\
|
|
819 |
tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SYSCFGEN);\
|
|
820 |
UNUSED(tmpreg); \
|
|
821 |
} while(0U)
|
|
822 |
#define __HAL_RCC_ADC1_CLK_ENABLE() do { \
|
|
823 |
__IO uint32_t tmpreg; \
|
|
824 |
SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC1EN);\
|
|
825 |
/* Delay after an RCC peripheral clock enabling */\
|
|
826 |
tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC1EN);\
|
|
827 |
UNUSED(tmpreg); \
|
|
828 |
} while(0U)
|
|
829 |
#define __HAL_RCC_TIM1_CLK_ENABLE() do { \
|
|
830 |
__IO uint32_t tmpreg; \
|
|
831 |
SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN);\
|
|
832 |
/* Delay after an RCC peripheral clock enabling */\
|
|
833 |
tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN);\
|
|
834 |
UNUSED(tmpreg); \
|
|
835 |
} while(0U)
|
|
836 |
#define __HAL_RCC_SPI1_CLK_ENABLE() do { \
|
|
837 |
__IO uint32_t tmpreg; \
|
|
838 |
SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN);\
|
|
839 |
/* Delay after an RCC peripheral clock enabling */\
|
|
840 |
tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN);\
|
|
841 |
UNUSED(tmpreg); \
|
|
842 |
} while(0U)
|
|
843 |
#define __HAL_RCC_TIM16_CLK_ENABLE() do { \
|
|
844 |
__IO uint32_t tmpreg; \
|
|
845 |
SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM16EN);\
|
|
846 |
/* Delay after an RCC peripheral clock enabling */\
|
|
847 |
tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM16EN);\
|
|
848 |
UNUSED(tmpreg); \
|
|
849 |
} while(0U)
|
|
850 |
#define __HAL_RCC_TIM17_CLK_ENABLE() do { \
|
|
851 |
__IO uint32_t tmpreg; \
|
|
852 |
SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM17EN);\
|
|
853 |
/* Delay after an RCC peripheral clock enabling */\
|
|
854 |
tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM17EN);\
|
|
855 |
UNUSED(tmpreg); \
|
|
856 |
} while(0U)
|
|
857 |
#define __HAL_RCC_USART1_CLK_ENABLE() do { \
|
|
858 |
__IO uint32_t tmpreg; \
|
|
859 |
SET_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\
|
|
860 |
/* Delay after an RCC peripheral clock enabling */\
|
|
861 |
tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\
|
|
862 |
UNUSED(tmpreg); \
|
|
863 |
} while(0U)
|
|
864 |
#define __HAL_RCC_DBGMCU_CLK_ENABLE() do { \
|
|
865 |
__IO uint32_t tmpreg; \
|
|
866 |
SET_BIT(RCC->APB2ENR, RCC_APB2ENR_DBGMCUEN);\
|
|
867 |
/* Delay after an RCC peripheral clock enabling */\
|
|
868 |
tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_DBGMCUEN);\
|
|
869 |
UNUSED(tmpreg); \
|
|
870 |
} while(0U)
|
|
871 |
|
|
872 |
#define __HAL_RCC_SYSCFG_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SYSCFGEN))
|
|
873 |
#define __HAL_RCC_ADC1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC1EN))
|
|
874 |
#define __HAL_RCC_TIM1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM1EN))
|
|
875 |
#define __HAL_RCC_SPI1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI1EN))
|
|
876 |
#define __HAL_RCC_TIM16_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM16EN))
|
|
877 |
#define __HAL_RCC_TIM17_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM17EN))
|
|
878 |
#define __HAL_RCC_USART1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_USART1EN))
|
|
879 |
#define __HAL_RCC_DBGMCU_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_DBGMCUEN))
|
|
880 |
/**
|
|
881 |
* @}
|
|
882 |
*/
|
|
883 |
|
|
884 |
/** @defgroup RCC_APB2_Peripheral_Clock_Enable_Disable_Status APB2 Peripheral Clock Enable Disable Status
|
|
885 |
* @brief Get the enable or disable status of the APB2 peripheral clock.
|
|
886 |
* @note After reset, the peripheral clock (used for registers read/write access)
|
|
887 |
* is disabled and the application software has to enable this clock before
|
|
888 |
* using it.
|
|
889 |
* @{
|
|
890 |
*/
|
|
891 |
#define __HAL_RCC_SYSCFG_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SYSCFGEN)) != RESET)
|
|
892 |
#define __HAL_RCC_ADC1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC1EN)) != RESET)
|
|
893 |
#define __HAL_RCC_TIM1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM1EN)) != RESET)
|
|
894 |
#define __HAL_RCC_SPI1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI1EN)) != RESET)
|
|
895 |
#define __HAL_RCC_TIM16_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM16EN)) != RESET)
|
|
896 |
#define __HAL_RCC_TIM17_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM17EN)) != RESET)
|
|
897 |
#define __HAL_RCC_USART1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART1EN)) != RESET)
|
|
898 |
#define __HAL_RCC_DBGMCU_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DBGMCUEN)) != RESET)
|
|
899 |
#define __HAL_RCC_SYSCFG_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SYSCFGEN)) == RESET)
|
|
900 |
#define __HAL_RCC_ADC1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC1EN)) == RESET)
|
|
901 |
#define __HAL_RCC_TIM1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM1EN)) == RESET)
|
|
902 |
#define __HAL_RCC_SPI1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI1EN)) == RESET)
|
|
903 |
#define __HAL_RCC_TIM16_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM16EN)) == RESET)
|
|
904 |
#define __HAL_RCC_TIM17_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM17EN)) == RESET)
|
|
905 |
#define __HAL_RCC_USART1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART1EN)) == RESET)
|
|
906 |
#define __HAL_RCC_DBGMCU_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_DBGMCUEN)) == RESET)
|
|
907 |
/**
|
|
908 |
* @}
|
|
909 |
*/
|
|
910 |
|
|
911 |
/** @defgroup RCC_AHB_Force_Release_Reset RCC AHB Force Release Reset
|
|
912 |
* @brief Force or release AHB peripheral reset.
|
|
913 |
* @{
|
|
914 |
*/
|
|
915 |
#define __HAL_RCC_AHB_FORCE_RESET() (RCC->AHBRSTR = 0xFFFFFFFFU)
|
|
916 |
#define __HAL_RCC_GPIOA_FORCE_RESET() (RCC->AHBRSTR |= (RCC_AHBRSTR_GPIOARST))
|
|
917 |
#define __HAL_RCC_GPIOB_FORCE_RESET() (RCC->AHBRSTR |= (RCC_AHBRSTR_GPIOBRST))
|
|
918 |
#define __HAL_RCC_GPIOC_FORCE_RESET() (RCC->AHBRSTR |= (RCC_AHBRSTR_GPIOCRST))
|
|
919 |
#define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->AHBRSTR |= (RCC_AHBRSTR_GPIOFRST))
|
|
920 |
|
|
921 |
#define __HAL_RCC_AHB_RELEASE_RESET() (RCC->AHBRSTR = 0x00000000U)
|
|
922 |
#define __HAL_RCC_GPIOA_RELEASE_RESET() (RCC->AHBRSTR &= ~(RCC_AHBRSTR_GPIOARST))
|
|
923 |
#define __HAL_RCC_GPIOB_RELEASE_RESET() (RCC->AHBRSTR &= ~(RCC_AHBRSTR_GPIOBRST))
|
|
924 |
#define __HAL_RCC_GPIOC_RELEASE_RESET() (RCC->AHBRSTR &= ~(RCC_AHBRSTR_GPIOCRST))
|
|
925 |
#define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->AHBRSTR &= ~(RCC_AHBRSTR_GPIOFRST))
|
|
926 |
/**
|
|
927 |
* @}
|
|
928 |
*/
|
|
929 |
|
|
930 |
/** @defgroup RCC_APB1_Force_Release_Reset RCC APB1 Force Release Reset
|
|
931 |
* @brief Force or release APB1 peripheral reset.
|
|
932 |
* @{
|
|
933 |
*/
|
|
934 |
#define __HAL_RCC_APB1_FORCE_RESET() (RCC->APB1RSTR = 0xFFFFFFFFU)
|
|
935 |
#define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST))
|
|
936 |
#define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST))
|
|
937 |
#define __HAL_RCC_WWDG_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_WWDGRST))
|
|
938 |
#define __HAL_RCC_I2C1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C1RST))
|
|
939 |
#define __HAL_RCC_PWR_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_PWRRST))
|
|
940 |
|
|
941 |
#define __HAL_RCC_APB1_RELEASE_RESET() (RCC->APB1RSTR = 0x00000000U)
|
|
942 |
#define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST))
|
|
943 |
#define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST))
|
|
944 |
#define __HAL_RCC_WWDG_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_WWDGRST))
|
|
945 |
#define __HAL_RCC_I2C1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C1RST))
|
|
946 |
#define __HAL_RCC_PWR_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_PWRRST))
|
|
947 |
/**
|
|
948 |
* @}
|
|
949 |
*/
|
|
950 |
|
|
951 |
/** @defgroup RCC_APB2_Force_Release_Reset RCC APB2 Force Release Reset
|
|
952 |
* @brief Force or release APB2 peripheral reset.
|
|
953 |
* @{
|
|
954 |
*/
|
|
955 |
#define __HAL_RCC_APB2_FORCE_RESET() (RCC->APB2RSTR = 0xFFFFFFFFU)
|
|
956 |
#define __HAL_RCC_SYSCFG_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SYSCFGRST))
|
|
957 |
#define __HAL_RCC_ADC1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_ADC1RST))
|
|
958 |
#define __HAL_RCC_TIM1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM1RST))
|
|
959 |
#define __HAL_RCC_SPI1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI1RST))
|
|
960 |
#define __HAL_RCC_USART1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_USART1RST))
|
|
961 |
#define __HAL_RCC_TIM16_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM16RST))
|
|
962 |
#define __HAL_RCC_TIM17_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM17RST))
|
|
963 |
#define __HAL_RCC_DBGMCU_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_DBGMCURST))
|
|
964 |
|
|
965 |
#define __HAL_RCC_APB2_RELEASE_RESET() (RCC->APB2RSTR = 0x00000000U)
|
|
966 |
#define __HAL_RCC_SYSCFG_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SYSCFGRST))
|
|
967 |
#define __HAL_RCC_ADC1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_ADC1RST))
|
|
968 |
#define __HAL_RCC_TIM1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM1RST))
|
|
969 |
#define __HAL_RCC_SPI1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI1RST))
|
|
970 |
#define __HAL_RCC_USART1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_USART1RST))
|
|
971 |
#define __HAL_RCC_TIM16_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM16RST))
|
|
972 |
#define __HAL_RCC_TIM17_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM17RST))
|
|
973 |
#define __HAL_RCC_DBGMCU_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_DBGMCURST))
|
|
974 |
/**
|
|
975 |
* @}
|
|
976 |
*/
|
|
977 |
/** @defgroup RCC_HSI_Configuration HSI Configuration
|
|
978 |
* @{
|
|
979 |
*/
|
|
980 |
|
|
981 |
/** @brief Macros to enable or disable the Internal High Speed oscillator (HSI).
|
|
982 |
* @note The HSI is stopped by hardware when entering STOP and STANDBY modes.
|
|
983 |
* @note HSI can not be stopped if it is used as system clock source. In this case,
|
|
984 |
* you have to select another source of the system clock then stop the HSI.
|
|
985 |
* @note After enabling the HSI, the application software should wait on HSIRDY
|
|
986 |
* flag to be set indicating that HSI clock is stable and can be used as
|
|
987 |
* system clock source.
|
|
988 |
* @note When the HSI is stopped, HSIRDY flag goes low after 6 HSI oscillator
|
|
989 |
* clock cycles.
|
|
990 |
*/
|
|
991 |
#define __HAL_RCC_HSI_ENABLE() SET_BIT(RCC->CR, RCC_CR_HSION)
|
|
992 |
#define __HAL_RCC_HSI_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_HSION)
|
|
993 |
|
|
994 |
/** @brief Macro to adjust the Internal High Speed oscillator (HSI) calibration value.
|
|
995 |
* @note The calibration is used to compensate for the variations in voltage
|
|
996 |
* and temperature that influence the frequency of the internal HSI RC.
|
|
997 |
* @param _HSICALIBRATIONVALUE_ specifies the calibration trimming value.
|
|
998 |
* (default is RCC_HSICALIBRATION_DEFAULT).
|
|
999 |
* This parameter must be a number between 0 and 0x1F.
|
|
1000 |
*/
|
|
1001 |
#define __HAL_RCC_HSI_CALIBRATIONVALUE_ADJUST(_HSICALIBRATIONVALUE_) \
|
|
1002 |
MODIFY_REG(RCC->CR, RCC_CR_HSITRIM, (uint32_t)(_HSICALIBRATIONVALUE_) << RCC_CR_HSITRIM_BitNumber)
|
|
1003 |
|
|
1004 |
/**
|
|
1005 |
* @}
|
|
1006 |
*/
|
|
1007 |
|
|
1008 |
/** @defgroup RCC_LSI_Configuration LSI Configuration
|
|
1009 |
* @{
|
|
1010 |
*/
|
|
1011 |
|
|
1012 |
/** @brief Macro to enable the Internal Low Speed oscillator (LSI).
|
|
1013 |
* @note After enabling the LSI, the application software should wait on
|
|
1014 |
* LSIRDY flag to be set indicating that LSI clock is stable and can
|
|
1015 |
* be used to clock the IWDG and/or the RTC.
|
|
1016 |
*/
|
|
1017 |
#define __HAL_RCC_LSI_ENABLE() SET_BIT(RCC->CSR, RCC_CSR_LSION)
|
|
1018 |
|
|
1019 |
/** @brief Macro to disable the Internal Low Speed oscillator (LSI).
|
|
1020 |
* @note LSI can not be disabled if the IWDG is running.
|
|
1021 |
* @note When the LSI is stopped, LSIRDY flag goes low after 6 LSI oscillator
|
|
1022 |
* clock cycles.
|
|
1023 |
*/
|
|
1024 |
#define __HAL_RCC_LSI_DISABLE() CLEAR_BIT(RCC->CSR, RCC_CSR_LSION)
|
|
1025 |
|
|
1026 |
/**
|
|
1027 |
* @}
|
|
1028 |
*/
|
|
1029 |
|
|
1030 |
/** @defgroup RCC_HSE_Configuration HSE Configuration
|
|
1031 |
* @{
|
|
1032 |
*/
|
|
1033 |
|
|
1034 |
/**
|
|
1035 |
* @brief Macro to configure the External High Speed oscillator (HSE).
|
|
1036 |
* @note Transition HSE Bypass to HSE On and HSE On to HSE Bypass are not
|
|
1037 |
* supported by this macro. User should request a transition to HSE Off
|
|
1038 |
* first and then HSE On or HSE Bypass.
|
|
1039 |
* @note After enabling the HSE (RCC_HSE_ON or RCC_HSE_Bypass), the application
|
|
1040 |
* software should wait on HSERDY flag to be set indicating that HSE clock
|
|
1041 |
* is stable and can be used to clock the PLL and/or system clock.
|
|
1042 |
* @note HSE state can not be changed if it is used directly or through the
|
|
1043 |
* PLL as system clock. In this case, you have to select another source
|
|
1044 |
* of the system clock then change the HSE state (ex. disable it).
|
|
1045 |
* @note The HSE is stopped by hardware when entering STOP and STANDBY modes.
|
|
1046 |
* @note This function reset the CSSON bit, so if the clock security system(CSS)
|
|
1047 |
* was previously enabled you have to enable it again after calling this
|
|
1048 |
* function.
|
|
1049 |
* @param __STATE__ specifies the new state of the HSE.
|
|
1050 |
* This parameter can be one of the following values:
|
|
1051 |
* @arg @ref RCC_HSE_OFF turn OFF the HSE oscillator, HSERDY flag goes low after
|
|
1052 |
* 6 HSE oscillator clock cycles.
|
|
1053 |
* @arg @ref RCC_HSE_ON turn ON the HSE oscillator
|
|
1054 |
* @arg @ref RCC_HSE_BYPASS HSE oscillator bypassed with external clock
|
|
1055 |
*/
|
|
1056 |
#define __HAL_RCC_HSE_CONFIG(__STATE__) \
|
|
1057 |
do{ \
|
|
1058 |
if ((__STATE__) == RCC_HSE_ON) \
|
|
1059 |
{ \
|
|
1060 |
SET_BIT(RCC->CR, RCC_CR_HSEON); \
|
|
1061 |
} \
|
|
1062 |
else if ((__STATE__) == RCC_HSE_OFF) \
|
|
1063 |
{ \
|
|
1064 |
CLEAR_BIT(RCC->CR, RCC_CR_HSEON); \
|
|
1065 |
CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP); \
|
|
1066 |
} \
|
|
1067 |
else if ((__STATE__) == RCC_HSE_BYPASS) \
|
|
1068 |
{ \
|
|
1069 |
SET_BIT(RCC->CR, RCC_CR_HSEBYP); \
|
|
1070 |
SET_BIT(RCC->CR, RCC_CR_HSEON); \
|
|
1071 |
} \
|
|
1072 |
else \
|
|
1073 |
{ \
|
|
1074 |
CLEAR_BIT(RCC->CR, RCC_CR_HSEON); \
|
|
1075 |
CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP); \
|
|
1076 |
} \
|
|
1077 |
}while(0U)
|
|
1078 |
|
|
1079 |
/**
|
|
1080 |
* @brief Macro to configure the External High Speed oscillator (HSE) Predivision factor for PLL.
|
|
1081 |
* @note Predivision factor can not be changed if PLL is used as system clock
|
|
1082 |
* In this case, you have to select another source of the system clock, disable the PLL and
|
|
1083 |
* then change the HSE predivision factor.
|
|
1084 |
* @param __HSE_PREDIV_VALUE__ specifies the division value applied to HSE.
|
|
1085 |
* This parameter must be a number between RCC_HSE_PREDIV_DIV1 and RCC_HSE_PREDIV_DIV16.
|
|
1086 |
*/
|
|
1087 |
#define __HAL_RCC_HSE_PREDIV_CONFIG(__HSE_PREDIV_VALUE__) \
|
|
1088 |
MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PREDIV, (uint32_t)(__HSE_PREDIV_VALUE__))
|
|
1089 |
|
|
1090 |
/**
|
|
1091 |
* @}
|
|
1092 |
*/
|
|
1093 |
|
|
1094 |
/** @defgroup RCC_LSE_Configuration LSE Configuration
|
|
1095 |
* @{
|
|
1096 |
*/
|
|
1097 |
|
|
1098 |
/**
|
|
1099 |
* @brief Macro to configure the External Low Speed oscillator (LSE).
|
|
1100 |
* @note Transitions LSE Bypass to LSE On and LSE On to LSE Bypass are not supported by this macro.
|
|
1101 |
* @note As the LSE is in the Backup domain and write access is denied to
|
|
1102 |
* this domain after reset, you have to enable write access using
|
|
1103 |
* @ref HAL_PWR_EnableBkUpAccess() function before to configure the LSE
|
|
1104 |
* (to be done once after reset).
|
|
1105 |
* @note After enabling the LSE (RCC_LSE_ON or RCC_LSE_BYPASS), the application
|
|
1106 |
* software should wait on LSERDY flag to be set indicating that LSE clock
|
|
1107 |
* is stable and can be used to clock the RTC.
|
|
1108 |
* @param __STATE__ specifies the new state of the LSE.
|
|
1109 |
* This parameter can be one of the following values:
|
|
1110 |
* @arg @ref RCC_LSE_OFF turn OFF the LSE oscillator, LSERDY flag goes low after
|
|
1111 |
* 6 LSE oscillator clock cycles.
|
|
1112 |
* @arg @ref RCC_LSE_ON turn ON the LSE oscillator.
|
|
1113 |
* @arg @ref RCC_LSE_BYPASS LSE oscillator bypassed with external clock.
|
|
1114 |
*/
|
|
1115 |
#define __HAL_RCC_LSE_CONFIG(__STATE__) \
|
|
1116 |
do{ \
|
|
1117 |
if ((__STATE__) == RCC_LSE_ON) \
|
|
1118 |
{ \
|
|
1119 |
SET_BIT(RCC->BDCR, RCC_BDCR_LSEON); \
|
|
1120 |
} \
|
|
1121 |
else if ((__STATE__) == RCC_LSE_OFF) \
|
|
1122 |
{ \
|
|
1123 |
CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON); \
|
|
1124 |
CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); \
|
|
1125 |
} \
|
|
1126 |
else if ((__STATE__) == RCC_LSE_BYPASS) \
|
|
1127 |
{ \
|
|
1128 |
SET_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); \
|
|
1129 |
SET_BIT(RCC->BDCR, RCC_BDCR_LSEON); \
|
|
1130 |
} \
|
|
1131 |
else \
|
|
1132 |
{ \
|
|
1133 |
CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON); \
|
|
1134 |
CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEBYP); \
|
|
1135 |
} \
|
|
1136 |
}while(0U)
|
|
1137 |
|
|
1138 |
/**
|
|
1139 |
* @}
|
|
1140 |
*/
|
|
1141 |
|
|
1142 |
/** @defgroup RCC_HSI14_Configuration RCC_HSI14_Configuration
|
|
1143 |
* @{
|
|
1144 |
*/
|
|
1145 |
|
|
1146 |
/** @brief Macro to enable the Internal 14Mhz High Speed oscillator (HSI14).
|
|
1147 |
* @note After enabling the HSI14 with @ref __HAL_RCC_HSI14_ENABLE(), the application software
|
|
1148 |
* should wait on HSI14RDY flag to be set indicating that HSI clock is stable and can be
|
|
1149 |
* used as system clock source. This is not necessary if @ref HAL_RCC_OscConfig() is used.
|
|
1150 |
* clock cycles.
|
|
1151 |
*/
|
|
1152 |
#define __HAL_RCC_HSI14_ENABLE() SET_BIT(RCC->CR2, RCC_CR2_HSI14ON)
|
|
1153 |
|
|
1154 |
/** @brief Macro to disable the Internal 14Mhz High Speed oscillator (HSI14).
|
|
1155 |
* @note The HSI14 is stopped by hardware when entering STOP and STANDBY modes.
|
|
1156 |
* @note HSI14 can not be stopped if it is used as system clock source. In this case,
|
|
1157 |
* you have to select another source of the system clock then stop the HSI14.
|
|
1158 |
* @note When the HSI14 is stopped, HSI14RDY flag goes low after 6 HSI14 oscillator
|
|
1159 |
* clock cycles.
|
|
1160 |
*/
|
|
1161 |
#define __HAL_RCC_HSI14_DISABLE() CLEAR_BIT(RCC->CR2, RCC_CR2_HSI14ON)
|
|
1162 |
|
|
1163 |
/** @brief Macro to enable the Internal 14Mhz High Speed oscillator (HSI14) used by ADC.
|
|
1164 |
*/
|
|
1165 |
#define __HAL_RCC_HSI14ADC_ENABLE() CLEAR_BIT(RCC->CR2, RCC_CR2_HSI14DIS)
|
|
1166 |
|
|
1167 |
/** @brief Macro to disable the Internal 14Mhz High Speed oscillator (HSI14) used by ADC.
|
|
1168 |
*/
|
|
1169 |
#define __HAL_RCC_HSI14ADC_DISABLE() SET_BIT(RCC->CR2, RCC_CR2_HSI14DIS)
|
|
1170 |
|
|
1171 |
/** @brief Macro to adjust the Internal 14Mhz High Speed oscillator (HSI) calibration value.
|
|
1172 |
* @note The calibration is used to compensate for the variations in voltage
|
|
1173 |
* and temperature that influence the frequency of the internal HSI14 RC.
|
|
1174 |
* @param __HSI14CALIBRATIONVALUE__ specifies the calibration trimming value
|
|
1175 |
* (default is RCC_HSI14CALIBRATION_DEFAULT).
|
|
1176 |
* This parameter must be a number between 0 and 0x1F.
|
|
1177 |
*/
|
|
1178 |
#define __HAL_RCC_HSI14_CALIBRATIONVALUE_ADJUST(__HSI14CALIBRATIONVALUE__) \
|
|
1179 |
MODIFY_REG(RCC->CR2, RCC_CR2_HSI14TRIM, (uint32_t)(__HSI14CALIBRATIONVALUE__) << RCC_HSI14TRIM_BIT_NUMBER)
|
|
1180 |
/**
|
|
1181 |
* @}
|
|
1182 |
*/
|
|
1183 |
|
|
1184 |
/** @defgroup RCC_USARTx_Clock_Config RCC USARTx Clock Config
|
|
1185 |
* @{
|
|
1186 |
*/
|
|
1187 |
|
|
1188 |
/** @brief Macro to configure the USART1 clock (USART1CLK).
|
|
1189 |
* @param __USART1CLKSOURCE__ specifies the USART1 clock source.
|
|
1190 |
* This parameter can be one of the following values:
|
|
1191 |
* @arg @ref RCC_USART1CLKSOURCE_PCLK1 PCLK1 selected as USART1 clock
|
|
1192 |
* @arg @ref RCC_USART1CLKSOURCE_HSI HSI selected as USART1 clock
|
|
1193 |
* @arg @ref RCC_USART1CLKSOURCE_SYSCLK System Clock selected as USART1 clock
|
|
1194 |
* @arg @ref RCC_USART1CLKSOURCE_LSE LSE selected as USART1 clock
|
|
1195 |
*/
|
|
1196 |
#define __HAL_RCC_USART1_CONFIG(__USART1CLKSOURCE__) \
|
|
1197 |
MODIFY_REG(RCC->CFGR3, RCC_CFGR3_USART1SW, (uint32_t)(__USART1CLKSOURCE__))
|
|
1198 |
|
|
1199 |
/** @brief Macro to get the USART1 clock source.
|
|
1200 |
* @retval The clock source can be one of the following values:
|
|
1201 |
* @arg @ref RCC_USART1CLKSOURCE_PCLK1 PCLK1 selected as USART1 clock
|
|
1202 |
* @arg @ref RCC_USART1CLKSOURCE_HSI HSI selected as USART1 clock
|
|
1203 |
* @arg @ref RCC_USART1CLKSOURCE_SYSCLK System Clock selected as USART1 clock
|
|
1204 |
* @arg @ref RCC_USART1CLKSOURCE_LSE LSE selected as USART1 clock
|
|
1205 |
*/
|
|
1206 |
#define __HAL_RCC_GET_USART1_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR3, RCC_CFGR3_USART1SW)))
|
|
1207 |
|
|
1208 |
/**
|
|
1209 |
* @}
|
|
1210 |
*/
|
|
1211 |
|
|
1212 |
/** @defgroup RCC_I2Cx_Clock_Config RCC I2Cx Clock Config
|
|
1213 |
* @{
|
|
1214 |
*/
|
|
1215 |
|
|
1216 |
/** @brief Macro to configure the I2C1 clock (I2C1CLK).
|
|
1217 |
* @param __I2C1CLKSOURCE__ specifies the I2C1 clock source.
|
|
1218 |
* This parameter can be one of the following values:
|
|
1219 |
* @arg @ref RCC_I2C1CLKSOURCE_HSI HSI selected as I2C1 clock
|
|
1220 |
* @arg @ref RCC_I2C1CLKSOURCE_SYSCLK System Clock selected as I2C1 clock
|
|
1221 |
*/
|
|
1222 |
#define __HAL_RCC_I2C1_CONFIG(__I2C1CLKSOURCE__) \
|
|
1223 |
MODIFY_REG(RCC->CFGR3, RCC_CFGR3_I2C1SW, (uint32_t)(__I2C1CLKSOURCE__))
|
|
1224 |
|
|
1225 |
/** @brief Macro to get the I2C1 clock source.
|
|
1226 |
* @retval The clock source can be one of the following values:
|
|
1227 |
* @arg @ref RCC_I2C1CLKSOURCE_HSI HSI selected as I2C1 clock
|
|
1228 |
* @arg @ref RCC_I2C1CLKSOURCE_SYSCLK System Clock selected as I2C1 clock
|
|
1229 |
*/
|
|
1230 |
#define __HAL_RCC_GET_I2C1_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR3, RCC_CFGR3_I2C1SW)))
|
|
1231 |
/**
|
|
1232 |
* @}
|
|
1233 |
*/
|
|
1234 |
|
|
1235 |
/** @defgroup RCC_PLL_Configuration PLL Configuration
|
|
1236 |
* @{
|
|
1237 |
*/
|
|
1238 |
|
|
1239 |
/** @brief Macro to enable the main PLL.
|
|
1240 |
* @note After enabling the main PLL, the application software should wait on
|
|
1241 |
* PLLRDY flag to be set indicating that PLL clock is stable and can
|
|
1242 |
* be used as system clock source.
|
|
1243 |
* @note The main PLL is disabled by hardware when entering STOP and STANDBY modes.
|
|
1244 |
*/
|
|
1245 |
#define __HAL_RCC_PLL_ENABLE() SET_BIT(RCC->CR, RCC_CR_PLLON)
|
|
1246 |
|
|
1247 |
/** @brief Macro to disable the main PLL.
|
|
1248 |
* @note The main PLL can not be disabled if it is used as system clock source
|
|
1249 |
*/
|
|
1250 |
#define __HAL_RCC_PLL_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_PLLON)
|
|
1251 |
|
|
1252 |
/** @brief Macro to configure the PLL clock source, multiplication and division factors.
|
|
1253 |
* @note This function must be used only when the main PLL is disabled.
|
|
1254 |
*
|
|
1255 |
* @param __RCC_PLLSOURCE__ specifies the PLL entry clock source.
|
|
1256 |
* This parameter can be one of the following values:
|
|
1257 |
* @arg @ref RCC_PLLSOURCE_HSI HSI oscillator clock selected as PLL clock entry
|
|
1258 |
* @arg @ref RCC_PLLSOURCE_HSE HSE oscillator clock selected as PLL clock entry
|
|
1259 |
* @param __PLLMUL__ specifies the multiplication factor for PLL VCO output clock
|
|
1260 |
* This parameter can be one of the following values:
|
|
1261 |
* This parameter must be a number between RCC_PLL_MUL2 and RCC_PLL_MUL16.
|
|
1262 |
* @param __PREDIV__ specifies the predivider factor for PLL VCO input clock
|
|
1263 |
* This parameter must be a number between RCC_PREDIV_DIV1 and RCC_PREDIV_DIV16.
|
|
1264 |
*
|
|
1265 |
*/
|
|
1266 |
#define __HAL_RCC_PLL_CONFIG(__RCC_PLLSOURCE__ , __PREDIV__, __PLLMUL__) \
|
|
1267 |
do { \
|
|
1268 |
MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PREDIV, (__PREDIV__)); \
|
|
1269 |
MODIFY_REG(RCC->CFGR, RCC_CFGR_PLLMUL | RCC_CFGR_PLLSRC, (uint32_t)((__PLLMUL__)|(__RCC_PLLSOURCE__))); \
|
|
1270 |
} while(0U)
|
|
1271 |
|
|
1272 |
|
|
1273 |
/** @brief Get oscillator clock selected as PLL input clock
|
|
1274 |
* @retval The clock source used for PLL entry. The returned value can be one
|
|
1275 |
* of the following:
|
|
1276 |
* @arg @ref RCC_PLLSOURCE_HSE HSE oscillator clock selected as PLL input clock
|
|
1277 |
*/
|
|
1278 |
#define __HAL_RCC_GET_PLL_OSCSOURCE() ((uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PLLSRC)))
|
|
1279 |
|
|
1280 |
/**
|
|
1281 |
* @}
|
|
1282 |
*/
|
|
1283 |
|
|
1284 |
/** @defgroup RCC_Get_Clock_source Get Clock source
|
|
1285 |
* @{
|
|
1286 |
*/
|
|
1287 |
|
|
1288 |
/**
|
|
1289 |
* @brief Macro to configure the system clock source.
|
|
1290 |
* @param __SYSCLKSOURCE__ specifies the system clock source.
|
|
1291 |
* This parameter can be one of the following values:
|
|
1292 |
* @arg @ref RCC_SYSCLKSOURCE_HSI HSI oscillator is used as system clock source.
|
|
1293 |
* @arg @ref RCC_SYSCLKSOURCE_HSE HSE oscillator is used as system clock source.
|
|
1294 |
* @arg @ref RCC_SYSCLKSOURCE_PLLCLK PLL output is used as system clock source.
|
|
1295 |
*/
|
|
1296 |
#define __HAL_RCC_SYSCLK_CONFIG(__SYSCLKSOURCE__) \
|
|
1297 |
MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, (__SYSCLKSOURCE__))
|
|
1298 |
|
|
1299 |
/** @brief Macro to get the clock source used as system clock.
|
|
1300 |
* @retval The clock source used as system clock. The returned value can be one
|
|
1301 |
* of the following:
|
|
1302 |
* @arg @ref RCC_SYSCLKSOURCE_STATUS_HSI HSI used as system clock
|
|
1303 |
* @arg @ref RCC_SYSCLKSOURCE_STATUS_HSE HSE used as system clock
|
|
1304 |
* @arg @ref RCC_SYSCLKSOURCE_STATUS_PLLCLK PLL used as system clock
|
|
1305 |
*/
|
|
1306 |
#define __HAL_RCC_GET_SYSCLK_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR,RCC_CFGR_SWS)))
|
|
1307 |
|
|
1308 |
/**
|
|
1309 |
* @}
|
|
1310 |
*/
|
|
1311 |
|
|
1312 |
/** @defgroup RCCEx_MCOx_Clock_Config RCC Extended MCOx Clock Config
|
|
1313 |
* @{
|
|
1314 |
*/
|
|
1315 |
|
|
1316 |
#if defined(RCC_CFGR_MCOPRE)
|
|
1317 |
/** @brief Macro to configure the MCO clock.
|
|
1318 |
* @param __MCOCLKSOURCE__ specifies the MCO clock source.
|
|
1319 |
* This parameter can be one of the following values:
|
|
1320 |
* @arg @ref RCC_MCO1SOURCE_NOCLOCK No clock selected as MCO clock
|
|
1321 |
* @arg @ref RCC_MCO1SOURCE_SYSCLK System Clock selected as MCO clock
|
|
1322 |
* @arg @ref RCC_MCO1SOURCE_HSI HSI oscillator clock selected as MCO clock
|
|
1323 |
* @arg @ref RCC_MCO1SOURCE_HSE HSE selected as MCO clock
|
|
1324 |
* @arg @ref RCC_MCO1SOURCE_LSI LSI selected as MCO clock
|
|
1325 |
* @arg @ref RCC_MCO1SOURCE_LSE LSE selected as MCO clock
|
|
1326 |
* @arg @ref RCC_MCO1SOURCE_HSI14 HSI14 selected as MCO clock
|
|
1327 |
@if STM32F042x6
|
|
1328 |
* @arg @ref RCC_MCO1SOURCE_HSI48 HSI48 selected as MCO clock
|
|
1329 |
* @arg @ref RCC_MCO1SOURCE_PLLCLK PLLCLK selected as MCO clock
|
|
1330 |
@elseif STM32F048xx
|
|
1331 |
* @arg @ref RCC_MCO1SOURCE_HSI48 HSI48 selected as MCO clock
|
|
1332 |
* @arg @ref RCC_MCO1SOURCE_PLLCLK PLLCLK selected as MCO clock
|
|
1333 |
@elseif STM32F071xB
|
|
1334 |
* @arg @ref RCC_MCO1SOURCE_HSI48 HSI48 selected as MCO clock
|
|
1335 |
* @arg @ref RCC_MCO1SOURCE_PLLCLK PLLCLK selected as MCO clock
|
|
1336 |
@elseif STM32F072xB
|
|
1337 |
* @arg @ref RCC_MCO1SOURCE_HSI48 HSI48 selected as MCO clock
|
|
1338 |
* @arg @ref RCC_MCO1SOURCE_PLLCLK PLLCLK selected as MCO clock
|
|
1339 |
@elseif STM32F078xx
|
|
1340 |
* @arg @ref RCC_MCO1SOURCE_HSI48 HSI48 selected as MCO clock
|
|
1341 |
* @arg @ref RCC_MCO1SOURCE_PLLCLK PLLCLK selected as MCO clock
|
|
1342 |
@elseif STM32F091xC
|
|
1343 |
* @arg @ref RCC_MCO1SOURCE_HSI48 HSI48 selected as MCO clock
|
|
1344 |
* @arg @ref RCC_MCO1SOURCE_PLLCLK PLLCLK selected as MCO clock
|
|
1345 |
@elseif STM32F098xx
|
|
1346 |
* @arg @ref RCC_MCO1SOURCE_HSI48 HSI48 selected as MCO clock
|
|
1347 |
* @arg @ref RCC_MCO1SOURCE_PLLCLK PLLCLK selected as MCO clock
|
|
1348 |
@elseif STM32F030x6
|
|
1349 |
* @arg @ref RCC_MCO1SOURCE_PLLCLK PLLCLK selected as MCO clock
|
|
1350 |
@elseif STM32F030xC
|
|
1351 |
* @arg @ref RCC_MCO1SOURCE_PLLCLK PLLCLK selected as MCO clock
|
|
1352 |
@elseif STM32F031x6
|
|
1353 |
* @arg @ref RCC_MCO1SOURCE_PLLCLK PLLCLK selected as MCO clock
|
|
1354 |
@elseif STM32F038xx
|
|
1355 |
* @arg @ref RCC_MCO1SOURCE_PLLCLK PLLCLK selected as MCO clock
|
|
1356 |
@elseif STM32F070x6
|
|
1357 |
* @arg @ref RCC_MCO1SOURCE_PLLCLK PLLCLK selected as MCO clock
|
|
1358 |
@elseif STM32F070xB
|
|
1359 |
* @arg @ref RCC_MCO1SOURCE_PLLCLK PLLCLK selected as MCO clock
|
|
1360 |
@endif
|
|
1361 |
* @arg @ref RCC_MCO1SOURCE_PLLCLK_DIV2 PLLCLK Divided by 2 selected as MCO clock
|
|
1362 |
* @param __MCODIV__ specifies the MCO clock prescaler.
|
|
1363 |
* This parameter can be one of the following values:
|
|
1364 |
* @arg @ref RCC_MCODIV_1 MCO clock source is divided by 1
|
|
1365 |
* @arg @ref RCC_MCODIV_2 MCO clock source is divided by 2
|
|
1366 |
* @arg @ref RCC_MCODIV_4 MCO clock source is divided by 4
|
|
1367 |
* @arg @ref RCC_MCODIV_8 MCO clock source is divided by 8
|
|
1368 |
* @arg @ref RCC_MCODIV_16 MCO clock source is divided by 16
|
|
1369 |
* @arg @ref RCC_MCODIV_32 MCO clock source is divided by 32
|
|
1370 |
* @arg @ref RCC_MCODIV_64 MCO clock source is divided by 64
|
|
1371 |
* @arg @ref RCC_MCODIV_128 MCO clock source is divided by 128
|
|
1372 |
*/
|
|
1373 |
#else
|
|
1374 |
/** @brief Macro to configure the MCO clock.
|
|
1375 |
* @param __MCOCLKSOURCE__ specifies the MCO clock source.
|
|
1376 |
* This parameter can be one of the following values:
|
|
1377 |
* @arg @ref RCC_MCO1SOURCE_NOCLOCK No clock selected as MCO clock
|
|
1378 |
* @arg @ref RCC_MCO1SOURCE_SYSCLK System Clock selected as MCO clock
|
|
1379 |
* @arg @ref RCC_MCO1SOURCE_HSI HSI selected as MCO clock
|
|
1380 |
* @arg @ref RCC_MCO1SOURCE_HSE HSE selected as MCO clock
|
|
1381 |
* @arg @ref RCC_MCO1SOURCE_LSI LSI selected as MCO clock
|
|
1382 |
* @arg @ref RCC_MCO1SOURCE_LSE LSE selected as MCO clock
|
|
1383 |
* @arg @ref RCC_MCO1SOURCE_HSI14 HSI14 selected as MCO clock
|
|
1384 |
* @arg @ref RCC_MCO1SOURCE_PLLCLK_DIV2 PLLCLK Divided by 2 selected as MCO clock
|
|
1385 |
* @param __MCODIV__ specifies the MCO clock prescaler.
|
|
1386 |
* This parameter can be one of the following values:
|
|
1387 |
* @arg @ref RCC_MCODIV_1 No division applied on MCO clock source
|
|
1388 |
*/
|
|
1389 |
#endif
|
|
1390 |
#if defined(RCC_CFGR_MCOPRE)
|
|
1391 |
#define __HAL_RCC_MCO1_CONFIG(__MCOCLKSOURCE__, __MCODIV__) \
|
|
1392 |
MODIFY_REG(RCC->CFGR, (RCC_CFGR_MCO | RCC_CFGR_MCOPRE), ((__MCOCLKSOURCE__) | (__MCODIV__)))
|
|
1393 |
#else
|
|
1394 |
|
|
1395 |
#define __HAL_RCC_MCO1_CONFIG(__MCOCLKSOURCE__, __MCODIV__) \
|
|
1396 |
MODIFY_REG(RCC->CFGR, RCC_CFGR_MCO, (__MCOCLKSOURCE__))
|
|
1397 |
|
|
1398 |
#endif
|
|
1399 |
|
|
1400 |
/**
|
|
1401 |
* @}
|
|
1402 |
*/
|
|
1403 |
|
|
1404 |
/** @defgroup RCC_RTC_Clock_Configuration RCC RTC Clock Configuration
|
|
1405 |
* @{
|
|
1406 |
*/
|
|
1407 |
|
|
1408 |
/** @brief Macro to configure the RTC clock (RTCCLK).
|
|
1409 |
* @note As the RTC clock configuration bits are in the Backup domain and write
|
|
1410 |
* access is denied to this domain after reset, you have to enable write
|
|
1411 |
* access using the Power Backup Access macro before to configure
|
|
1412 |
* the RTC clock source (to be done once after reset).
|
|
1413 |
* @note Once the RTC clock is configured it cannot be changed unless the
|
|
1414 |
* Backup domain is reset using @ref __HAL_RCC_BACKUPRESET_FORCE() macro, or by
|
|
1415 |
* a Power On Reset (POR).
|
|
1416 |
*
|
|
1417 |
* @param __RTC_CLKSOURCE__ specifies the RTC clock source.
|
|
1418 |
* This parameter can be one of the following values:
|
|
1419 |
* @arg @ref RCC_RTCCLKSOURCE_NO_CLK No clock selected as RTC clock
|
|
1420 |
* @arg @ref RCC_RTCCLKSOURCE_LSE LSE selected as RTC clock
|
|
1421 |
* @arg @ref RCC_RTCCLKSOURCE_LSI LSI selected as RTC clock
|
|
1422 |
* @arg @ref RCC_RTCCLKSOURCE_HSE_DIV32 HSE clock divided by 32
|
|
1423 |
* @note If the LSE or LSI is used as RTC clock source, the RTC continues to
|
|
1424 |
* work in STOP and STANDBY modes, and can be used as wakeup source.
|
|
1425 |
* However, when the LSI clock and HSE clock divided by 32 is used as RTC clock source,
|
|
1426 |
* the RTC cannot be used in STOP and STANDBY modes.
|
|
1427 |
* @note The system must always be configured so as to get a PCLK frequency greater than or
|
|
1428 |
* equal to the RTCCLK frequency for a proper operation of the RTC.
|
|
1429 |
*/
|
|
1430 |
#define __HAL_RCC_RTC_CONFIG(__RTC_CLKSOURCE__) MODIFY_REG(RCC->BDCR, RCC_BDCR_RTCSEL, (__RTC_CLKSOURCE__))
|
|
1431 |
|
|
1432 |
/** @brief Macro to get the RTC clock source.
|
|
1433 |
* @retval The clock source can be one of the following values:
|
|
1434 |
* @arg @ref RCC_RTCCLKSOURCE_NO_CLK No clock selected as RTC clock
|
|
1435 |
* @arg @ref RCC_RTCCLKSOURCE_LSE LSE selected as RTC clock
|
|
1436 |
* @arg @ref RCC_RTCCLKSOURCE_LSI LSI selected as RTC clock
|
|
1437 |
* @arg @ref RCC_RTCCLKSOURCE_HSE_DIV32 HSE clock divided by 32
|
|
1438 |
*/
|
|
1439 |
#define __HAL_RCC_GET_RTC_SOURCE() (READ_BIT(RCC->BDCR, RCC_BDCR_RTCSEL))
|
|
1440 |
|
|
1441 |
/** @brief Macro to enable the the RTC clock.
|
|
1442 |
* @note These macros must be used only after the RTC clock source was selected.
|
|
1443 |
*/
|
|
1444 |
#define __HAL_RCC_RTC_ENABLE() SET_BIT(RCC->BDCR, RCC_BDCR_RTCEN)
|
|
1445 |
|
|
1446 |
/** @brief Macro to disable the the RTC clock.
|
|
1447 |
* @note These macros must be used only after the RTC clock source was selected.
|
|
1448 |
*/
|
|
1449 |
#define __HAL_RCC_RTC_DISABLE() CLEAR_BIT(RCC->BDCR, RCC_BDCR_RTCEN)
|
|
1450 |
|
|
1451 |
/** @brief Macro to force the Backup domain reset.
|
|
1452 |
* @note This function resets the RTC peripheral (including the backup registers)
|
|
1453 |
* and the RTC clock source selection in RCC_BDCR register.
|
|
1454 |
*/
|
|
1455 |
#define __HAL_RCC_BACKUPRESET_FORCE() SET_BIT(RCC->BDCR, RCC_BDCR_BDRST)
|
|
1456 |
|
|
1457 |
/** @brief Macros to release the Backup domain reset.
|
|
1458 |
*/
|
|
1459 |
#define __HAL_RCC_BACKUPRESET_RELEASE() CLEAR_BIT(RCC->BDCR, RCC_BDCR_BDRST)
|
|
1460 |
|
|
1461 |
/**
|
|
1462 |
* @}
|
|
1463 |
*/
|
|
1464 |
|
|
1465 |
/** @defgroup RCC_Flags_Interrupts_Management Flags Interrupts Management
|
|
1466 |
* @brief macros to manage the specified RCC Flags and interrupts.
|
|
1467 |
* @{
|
|
1468 |
*/
|
|
1469 |
|
|
1470 |
/** @brief Enable RCC interrupt.
|
|
1471 |
* @param __INTERRUPT__ specifies the RCC interrupt sources to be enabled.
|
|
1472 |
* This parameter can be any combination of the following values:
|
|
1473 |
* @arg @ref RCC_IT_LSIRDY LSI ready interrupt
|
|
1474 |
* @arg @ref RCC_IT_LSERDY LSE ready interrupt
|
|
1475 |
* @arg @ref RCC_IT_HSIRDY HSI ready interrupt
|
|
1476 |
* @arg @ref RCC_IT_HSERDY HSE ready interrupt
|
|
1477 |
* @arg @ref RCC_IT_PLLRDY main PLL ready interrupt
|
|
1478 |
* @arg @ref RCC_IT_HSI14RDY HSI14 ready interrupt
|
|
1479 |
@if STM32F042x6
|
|
1480 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1481 |
@elseif STM32F048xx
|
|
1482 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1483 |
@elseif STM32F071xB
|
|
1484 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1485 |
@elseif STM32F072xB
|
|
1486 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1487 |
@elseif STM32F078xx
|
|
1488 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1489 |
@elseif STM32F091xC
|
|
1490 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1491 |
@elseif STM32F098xx
|
|
1492 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1493 |
@endif
|
|
1494 |
*/
|
|
1495 |
#define __HAL_RCC_ENABLE_IT(__INTERRUPT__) (*(__IO uint8_t *) RCC_CIR_BYTE1_ADDRESS |= (__INTERRUPT__))
|
|
1496 |
|
|
1497 |
/** @brief Disable RCC interrupt.
|
|
1498 |
* @param __INTERRUPT__ specifies the RCC interrupt sources to be disabled.
|
|
1499 |
* This parameter can be any combination of the following values:
|
|
1500 |
* @arg @ref RCC_IT_LSIRDY LSI ready interrupt
|
|
1501 |
* @arg @ref RCC_IT_LSERDY LSE ready interrupt
|
|
1502 |
* @arg @ref RCC_IT_HSIRDY HSI ready interrupt
|
|
1503 |
* @arg @ref RCC_IT_HSERDY HSE ready interrupt
|
|
1504 |
* @arg @ref RCC_IT_PLLRDY main PLL ready interrupt
|
|
1505 |
* @arg @ref RCC_IT_HSI14RDY HSI14 ready interrupt
|
|
1506 |
@if STM32F042x6
|
|
1507 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1508 |
@elseif STM32F048xx
|
|
1509 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1510 |
@elseif STM32F071xB
|
|
1511 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1512 |
@elseif STM32F072xB
|
|
1513 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1514 |
@elseif STM32F078xx
|
|
1515 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1516 |
@elseif STM32F091xC
|
|
1517 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1518 |
@elseif STM32F098xx
|
|
1519 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1520 |
@endif
|
|
1521 |
*/
|
|
1522 |
#define __HAL_RCC_DISABLE_IT(__INTERRUPT__) (*(__IO uint8_t *) RCC_CIR_BYTE1_ADDRESS &= (uint8_t)(~(__INTERRUPT__)))
|
|
1523 |
|
|
1524 |
/** @brief Clear the RCC's interrupt pending bits.
|
|
1525 |
* @param __INTERRUPT__ specifies the interrupt pending bit to clear.
|
|
1526 |
* This parameter can be any combination of the following values:
|
|
1527 |
* @arg @ref RCC_IT_LSIRDY LSI ready interrupt.
|
|
1528 |
* @arg @ref RCC_IT_LSERDY LSE ready interrupt.
|
|
1529 |
* @arg @ref RCC_IT_HSIRDY HSI ready interrupt.
|
|
1530 |
* @arg @ref RCC_IT_HSERDY HSE ready interrupt.
|
|
1531 |
* @arg @ref RCC_IT_PLLRDY Main PLL ready interrupt.
|
|
1532 |
* @arg @ref RCC_IT_CSS Clock Security System interrupt
|
|
1533 |
* @arg @ref RCC_IT_HSI14RDY HSI14 ready interrupt
|
|
1534 |
@if STM32F042x6
|
|
1535 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1536 |
@elseif STM32F048xx
|
|
1537 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1538 |
@elseif STM32F071xB
|
|
1539 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1540 |
@elseif STM32F072xB
|
|
1541 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1542 |
@elseif STM32F078xx
|
|
1543 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1544 |
@elseif STM32F091xC
|
|
1545 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1546 |
@elseif STM32F098xx
|
|
1547 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1548 |
@endif
|
|
1549 |
*/
|
|
1550 |
#define __HAL_RCC_CLEAR_IT(__INTERRUPT__) (*(__IO uint8_t *) RCC_CIR_BYTE2_ADDRESS = (__INTERRUPT__))
|
|
1551 |
|
|
1552 |
/** @brief Check the RCC's interrupt has occurred or not.
|
|
1553 |
* @param __INTERRUPT__ specifies the RCC interrupt source to check.
|
|
1554 |
* This parameter can be one of the following values:
|
|
1555 |
* @arg @ref RCC_IT_LSIRDY LSI ready interrupt.
|
|
1556 |
* @arg @ref RCC_IT_LSERDY LSE ready interrupt.
|
|
1557 |
* @arg @ref RCC_IT_HSIRDY HSI ready interrupt.
|
|
1558 |
* @arg @ref RCC_IT_HSERDY HSE ready interrupt.
|
|
1559 |
* @arg @ref RCC_IT_PLLRDY Main PLL ready interrupt.
|
|
1560 |
* @arg @ref RCC_IT_CSS Clock Security System interrupt
|
|
1561 |
* @arg @ref RCC_IT_HSI14RDY HSI14 ready interrupt enable
|
|
1562 |
@if STM32F042x6
|
|
1563 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1564 |
@elseif STM32F048xx
|
|
1565 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1566 |
@elseif STM32F071xB
|
|
1567 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1568 |
@elseif STM32F072xB
|
|
1569 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1570 |
@elseif STM32F078xx
|
|
1571 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1572 |
@elseif STM32F091xC
|
|
1573 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1574 |
@elseif STM32F098xx
|
|
1575 |
* @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt
|
|
1576 |
@endif
|
|
1577 |
* @retval The new state of __INTERRUPT__ (TRUE or FALSE).
|
|
1578 |
*/
|
|
1579 |
#define __HAL_RCC_GET_IT(__INTERRUPT__) ((RCC->CIR & (__INTERRUPT__)) == (__INTERRUPT__))
|
|
1580 |
|
|
1581 |
/** @brief Set RMVF bit to clear the reset flags.
|
|
1582 |
* The reset flags are RCC_FLAG_PINRST, RCC_FLAG_PORRST, RCC_FLAG_SFTRST,
|
|
1583 |
* RCC_FLAG_OBLRST, RCC_FLAG_IWDGRST, RCC_FLAG_WWDGRST, RCC_FLAG_LPWRRST
|
|
1584 |
*/
|
|
1585 |
#define __HAL_RCC_CLEAR_RESET_FLAGS() (RCC->CSR |= RCC_CSR_RMVF)
|
|
1586 |
|
|
1587 |
/** @brief Check RCC flag is set or not.
|
|
1588 |
* @param __FLAG__ specifies the flag to check.
|
|
1589 |
* This parameter can be one of the following values:
|
|
1590 |
* @arg @ref RCC_FLAG_HSIRDY HSI oscillator clock ready.
|
|
1591 |
* @arg @ref RCC_FLAG_HSERDY HSE oscillator clock ready.
|
|
1592 |
* @arg @ref RCC_FLAG_PLLRDY Main PLL clock ready.
|
|
1593 |
* @arg @ref RCC_FLAG_HSI14RDY HSI14 oscillator clock ready
|
|
1594 |
@if STM32F038xx
|
|
1595 |
* @arg @ref RCC_FLAG_V18PWRRST Reset flag of the 1.8 V domain
|
|
1596 |
@elseif STM32F042x6
|
|
1597 |
* @arg @ref RCC_FLAG_HSI48RDY HSI48 oscillator clock ready
|
|
1598 |
@elseif STM32F048xx
|
|
1599 |
* @arg @ref RCC_FLAG_HSI48RDY HSI48 oscillator clock ready
|
|
1600 |
* @arg @ref RCC_FLAG_V18PWRRST Reset flag of the 1.8 V domain
|
|
1601 |
@elseif STM32F058xx
|
|
1602 |
* @arg @ref RCC_FLAG_V18PWRRST Reset flag of the 1.8 V domain
|
|
1603 |
@elseif STM32F071xB
|
|
1604 |
* @arg @ref RCC_FLAG_HSI48RDY HSI48 oscillator clock ready
|
|
1605 |
@elseif STM32F072xB
|
|
1606 |
* @arg @ref RCC_FLAG_HSI48RDY HSI48 oscillator clock ready
|
|
1607 |
@elseif STM32F078xx
|
|
1608 |
* @arg @ref RCC_FLAG_HSI48RDY HSI48 oscillator clock ready
|
|
1609 |
* @arg @ref RCC_FLAG_V18PWRRST Reset flag of the 1.8 V domain
|
|
1610 |
@elseif STM32F091xC
|
|
1611 |
* @arg @ref RCC_FLAG_HSI48RDY HSI48 oscillator clock ready
|
|
1612 |
@elseif STM32F098xx
|
|
1613 |
* @arg @ref RCC_FLAG_HSI48RDY HSI48 oscillator clock ready
|
|
1614 |
* @arg @ref RCC_FLAG_V18PWRRST Reset flag of the 1.8 V domain
|
|
1615 |
@endif
|
|
1616 |
* @arg @ref RCC_FLAG_LSERDY LSE oscillator clock ready.
|
|
1617 |
* @arg @ref RCC_FLAG_LSIRDY LSI oscillator clock ready.
|
|
1618 |
* @arg @ref RCC_FLAG_OBLRST Option Byte Load reset
|
|
1619 |
* @arg @ref RCC_FLAG_PINRST Pin reset.
|
|
1620 |
* @arg @ref RCC_FLAG_PORRST POR/PDR reset.
|
|
1621 |
* @arg @ref RCC_FLAG_SFTRST Software reset.
|
|
1622 |
* @arg @ref RCC_FLAG_IWDGRST Independent Watchdog reset.
|
|
1623 |
* @arg @ref RCC_FLAG_WWDGRST Window Watchdog reset.
|
|
1624 |
* @arg @ref RCC_FLAG_LPWRRST Low Power reset.
|
|
1625 |
* @retval The new state of __FLAG__ (TRUE or FALSE).
|
|
1626 |
*/
|
|
1627 |
#define __HAL_RCC_GET_FLAG(__FLAG__) (((((__FLAG__) >> 5U) == CR_REG_INDEX)? RCC->CR : \
|
|
1628 |
(((__FLAG__) >> 5U) == CR2_REG_INDEX)? RCC->CR2 : \
|
|
1629 |
(((__FLAG__) >> 5U) == BDCR_REG_INDEX) ? RCC->BDCR : \
|
|
1630 |
RCC->CSR) & (1U << ((__FLAG__) & RCC_FLAG_MASK)))
|
|
1631 |
|
|
1632 |
/**
|
|
1633 |
* @}
|
|
1634 |
*/
|
|
1635 |
|
|
1636 |
/**
|
|
1637 |
* @}
|
|
1638 |
*/
|
|
1639 |
|
|
1640 |
/* Include RCC HAL Extension module */
|
|
1641 |
#include "stm32f0xx_hal_rcc_ex.h"
|
|
1642 |
|
|
1643 |
/* Exported functions --------------------------------------------------------*/
|
|
1644 |
/** @addtogroup RCC_Exported_Functions
|
|
1645 |
* @{
|
|
1646 |
*/
|
|
1647 |
|
|
1648 |
/** @addtogroup RCC_Exported_Functions_Group1
|
|
1649 |
* @{
|
|
1650 |
*/
|
|
1651 |
|
|
1652 |
/* Initialization and de-initialization functions ******************************/
|
|
1653 |
void HAL_RCC_DeInit(void);
|
|
1654 |
HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct);
|
|
1655 |
HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t FLatency);
|
|
1656 |
|
|
1657 |
/**
|
|
1658 |
* @}
|
|
1659 |
*/
|
|
1660 |
|
|
1661 |
/** @addtogroup RCC_Exported_Functions_Group2
|
|
1662 |
* @{
|
|
1663 |
*/
|
|
1664 |
|
|
1665 |
/* Peripheral Control functions ************************************************/
|
|
1666 |
void HAL_RCC_MCOConfig(uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv);
|
|
1667 |
void HAL_RCC_EnableCSS(void);
|
|
1668 |
/* CSS NMI IRQ handler */
|
|
1669 |
void HAL_RCC_NMI_IRQHandler(void);
|
|
1670 |
/* User Callbacks in non blocking mode (IT mode) */
|
|
1671 |
void HAL_RCC_CSSCallback(void);
|
|
1672 |
void HAL_RCC_DisableCSS(void);
|
|
1673 |
uint32_t HAL_RCC_GetSysClockFreq(void);
|
|
1674 |
uint32_t HAL_RCC_GetHCLKFreq(void);
|
|
1675 |
uint32_t HAL_RCC_GetPCLK1Freq(void);
|
|
1676 |
void HAL_RCC_GetOscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct);
|
|
1677 |
void HAL_RCC_GetClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t *pFLatency);
|
|
1678 |
|
|
1679 |
/**
|
|
1680 |
* @}
|
|
1681 |
*/
|
|
1682 |
|
|
1683 |
/**
|
|
1684 |
* @}
|
|
1685 |
*/
|
|
1686 |
|
|
1687 |
/**
|
|
1688 |
* @}
|
|
1689 |
*/
|
|
1690 |
|
|
1691 |
/**
|
|
1692 |
* @}
|
|
1693 |
*/
|
|
1694 |
|
|
1695 |
#ifdef __cplusplus
|
|
1696 |
}
|
|
1697 |
#endif
|
|
1698 |
|
|
1699 |
#endif /* __STM32F0xx_HAL_RCC_H */
|
|
1700 |
|
|
1701 |
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
1702 |
|