Subversion Repositories EngineBay2

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 28
Line 1... Line 1...
1
/**
1
/**
2
  ******************************************************************************
2
  ******************************************************************************
3
  * @file    stm32l1xx_hal_rcc.h
3
  * @file    stm32l1xx_hal_rcc.h
4
  * @author  MCD Application Team
4
  * @author  MCD Application Team
5
  * @version V1.2.0
-
 
6
  * @date    01-July-2016
-
 
7
  * @brief   Header file of RCC HAL module.
5
  * @brief   Header file of RCC HAL module.
8
  ******************************************************************************
6
  ******************************************************************************
9
  * @attention
7
  * @attention
10
  *
8
  *
11
  * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
9
  * <h2><center>&copy; Copyright(c) 2017 STMicroelectronics.
-
 
10
  * All rights reserved.</center></h2>
12
  *
11
  *
13
  * Redistribution and use in source and binary forms, with or without modification,
12
  * This software component is licensed by ST under BSD 3-Clause license,
14
  * are permitted provided that the following conditions are met:
13
  * the "License"; You may not use this file except in compliance with the
15
  *   1. Redistributions of source code must retain the above copyright notice,
-
 
16
  *      this list of conditions and the following disclaimer.
-
 
17
  *   2. Redistributions in binary form must reproduce the above copyright notice,
-
 
18
  *      this list of conditions and the following disclaimer in the documentation
-
 
19
  *      and/or other materials provided with the distribution.
14
  * License. You may obtain a copy of the License at:
20
  *   3. Neither the name of STMicroelectronics nor the names of its contributors
-
 
21
  *      may be used to endorse or promote products derived from this software
15
  *                        opensource.org/licenses/BSD-3-Clause
22
  *      without specific prior written permission.
-
 
23
  *
-
 
24
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-
 
25
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-
 
26
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-
 
27
  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-
 
28
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-
 
29
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-
 
30
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-
 
31
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-
 
32
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-
 
33
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
 
34
  *
16
  *
35
  ******************************************************************************
17
  ******************************************************************************
36
  */
18
  */
37
 
19
 
38
/* Define to prevent recursive inclusion -------------------------------------*/
20
/* Define to prevent recursive inclusion -------------------------------------*/
Line 58... Line 40...
58
  * @{
40
  * @{
59
  */
41
  */
60
 
42
 
61
/** @defgroup RCC_Timeout RCC Timeout
43
/** @defgroup RCC_Timeout RCC Timeout
62
  * @{
44
  * @{
63
  */
45
  */
64
 
46
 
65
/* Disable Backup domain write protection state change timeout */
47
/* Disable Backup domain write protection state change timeout */
66
#define RCC_DBP_TIMEOUT_VALUE      (100U)       /* 100 ms */
48
#define RCC_DBP_TIMEOUT_VALUE      (100U)       /* 100 ms */
67
/* LSE state change timeout */
49
/* LSE state change timeout */
68
#define RCC_LSE_TIMEOUT_VALUE      LSE_STARTUP_TIMEOUT
50
#define RCC_LSE_TIMEOUT_VALUE      LSE_STARTUP_TIMEOUT
69
#define CLOCKSWITCH_TIMEOUT_VALUE  (5000U)  /* 5 s    */
51
#define CLOCKSWITCH_TIMEOUT_VALUE  (5000U)  /* 5 s    */
70
#define HSE_TIMEOUT_VALUE          HSE_STARTUP_TIMEOUT
52
#define HSE_TIMEOUT_VALUE          HSE_STARTUP_TIMEOUT
71
#define MSI_TIMEOUT_VALUE          (2U)      /* 2 ms (minimum Tick + 1) */
53
#define MSI_TIMEOUT_VALUE          (2U)      /* 2 ms (minimum Tick + 1U) */
72
#define HSI_TIMEOUT_VALUE          (2U)      /* 2 ms (minimum Tick + 1) */
54
#define HSI_TIMEOUT_VALUE          (2U)      /* 2 ms (minimum Tick + 1U) */
73
#define LSI_TIMEOUT_VALUE          (2U)      /* 2 ms (minimum Tick + 1) */
55
#define LSI_TIMEOUT_VALUE          (2U)      /* 2 ms (minimum Tick + 1U) */
74
#define PLL_TIMEOUT_VALUE          (2U)      /* 2 ms (minimum Tick + 1) */
56
#define PLL_TIMEOUT_VALUE          (2U)      /* 2 ms (minimum Tick + 1U) */
75
/**
57
/**
76
  * @}
58
  * @}
77
  */
59
  */
78
 
60
 
79
/** @defgroup RCC_Register_Offset Register offsets
61
/** @defgroup RCC_Register_Offset Register offsets
80
  * @{
62
  * @{
81
  */
63
  */
82
#define RCC_OFFSET                (RCC_BASE - PERIPH_BASE)
64
#define RCC_OFFSET                (RCC_BASE - PERIPH_BASE)
83
#define RCC_CR_OFFSET             0x00
65
#define RCC_CR_OFFSET             0x00
Line 97... Line 79...
97
#define RCC_CIR_OFFSET_BB         (RCC_OFFSET + RCC_CIR_OFFSET)
79
#define RCC_CIR_OFFSET_BB         (RCC_OFFSET + RCC_CIR_OFFSET)
98
#define RCC_CSR_OFFSET_BB         (RCC_OFFSET + RCC_CSR_OFFSET)
80
#define RCC_CSR_OFFSET_BB         (RCC_OFFSET + RCC_CSR_OFFSET)
99
 
81
 
100
/* --- CR Register ---*/
82
/* --- CR Register ---*/
101
/* Alias word address of HSION bit */
83
/* Alias word address of HSION bit */
102
#define RCC_HSION_BIT_NUMBER      POSITION_VAL(RCC_CR_HSION)
84
#define RCC_HSION_BIT_NUMBER      RCC_CR_HSION_Pos
103
#define RCC_CR_HSION_BB           ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32) + (RCC_HSION_BIT_NUMBER * 4)))
85
#define RCC_CR_HSION_BB           ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32U) + (RCC_HSION_BIT_NUMBER * 4U)))
104
/* Alias word address of MSION bit */
86
/* Alias word address of MSION bit */
105
#define RCC_MSION_BIT_NUMBER      POSITION_VAL(RCC_CR_MSION)
87
#define RCC_MSION_BIT_NUMBER      RCC_CR_MSION_Pos
106
#define RCC_CR_MSION_BB           ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32) + (RCC_MSION_BIT_NUMBER * 4)))
88
#define RCC_CR_MSION_BB           ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32U) + (RCC_MSION_BIT_NUMBER * 4U)))
107
/* Alias word address of HSEON bit */
89
/* Alias word address of HSEON bit */
108
#define RCC_HSEON_BIT_NUMBER      POSITION_VAL(RCC_CR_HSEON)
90
#define RCC_HSEON_BIT_NUMBER      RCC_CR_HSEON_Pos
109
#define RCC_CR_HSEON_BB           ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32) + (RCC_HSEON_BIT_NUMBER * 4)))
91
#define RCC_CR_HSEON_BB           ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32U) + (RCC_HSEON_BIT_NUMBER * 4U)))
110
/* Alias word address of CSSON bit */
92
/* Alias word address of CSSON bit */
111
#define RCC_CSSON_BIT_NUMBER      POSITION_VAL(RCC_CR_CSSON)
93
#define RCC_CSSON_BIT_NUMBER      RCC_CR_CSSON_Pos
112
#define RCC_CR_CSSON_BB           ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32) + (RCC_CSSON_BIT_NUMBER * 4)))
94
#define RCC_CR_CSSON_BB           ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32U) + (RCC_CSSON_BIT_NUMBER * 4U)))
113
/* Alias word address of PLLON bit */
95
/* Alias word address of PLLON bit */
114
#define RCC_PLLON_BIT_NUMBER      POSITION_VAL(RCC_CR_PLLON)
96
#define RCC_PLLON_BIT_NUMBER      RCC_CR_PLLON_Pos
115
#define RCC_CR_PLLON_BB           ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32) + (RCC_PLLON_BIT_NUMBER * 4)))
97
#define RCC_CR_PLLON_BB           ((uint32_t)(PERIPH_BB_BASE + (RCC_CR_OFFSET_BB * 32U) + (RCC_PLLON_BIT_NUMBER * 4U)))
116
 
98
 
117
/* --- CSR Register ---*/
99
/* --- CSR Register ---*/
118
/* Alias word address of LSION bit */
100
/* Alias word address of LSION bit */
119
#define RCC_LSION_BIT_NUMBER      POSITION_VAL(RCC_CSR_LSION)
101
#define RCC_LSION_BIT_NUMBER      RCC_CSR_LSION_Pos
120
#define RCC_CSR_LSION_BB          ((uint32_t)(PERIPH_BB_BASE + (RCC_CSR_OFFSET_BB * 32) + (RCC_LSION_BIT_NUMBER * 4)))
102
#define RCC_CSR_LSION_BB          ((uint32_t)(PERIPH_BB_BASE + (RCC_CSR_OFFSET_BB * 32U) + (RCC_LSION_BIT_NUMBER * 4U)))
121
 
103
 
122
/* Alias word address of RMVF bit */
104
/* Alias word address of RMVF bit */
123
#define RCC_RMVF_BIT_NUMBER       POSITION_VAL(RCC_CSR_RMVF)
105
#define RCC_RMVF_BIT_NUMBER       RCC_CSR_RMVF_Pos
124
#define RCC_CSR_RMVF_BB           ((uint32_t)(PERIPH_BB_BASE + (RCC_CSR_OFFSET_BB * 32) + (RCC_RMVF_BIT_NUMBER * 4)))
106
#define RCC_CSR_RMVF_BB           ((uint32_t)(PERIPH_BB_BASE + (RCC_CSR_OFFSET_BB * 32U) + (RCC_RMVF_BIT_NUMBER * 4U)))
125
 
107
 
126
/* Alias word address of LSEON bit */
108
/* Alias word address of LSEON bit */
127
#define RCC_LSEON_BIT_NUMBER      POSITION_VAL(RCC_CSR_LSEON)
109
#define RCC_LSEON_BIT_NUMBER      RCC_CSR_LSEON_Pos
128
#define RCC_CSR_LSEON_BB          ((uint32_t)(PERIPH_BB_BASE + (RCC_CSR_OFFSET_BB * 32) + (RCC_LSEON_BIT_NUMBER * 4)))
110
#define RCC_CSR_LSEON_BB          ((uint32_t)(PERIPH_BB_BASE + (RCC_CSR_OFFSET_BB * 32U) + (RCC_LSEON_BIT_NUMBER * 4U)))
129
 
111
 
130
/* Alias word address of LSEON bit */
112
/* Alias word address of LSEON bit */
131
#define RCC_LSEBYP_BIT_NUMBER     POSITION_VAL(RCC_CSR_LSEBYP)
113
#define RCC_LSEBYP_BIT_NUMBER     RCC_CSR_LSEBYP_Pos
132
#define RCC_CSR_LSEBYP_BB         ((uint32_t)(PERIPH_BB_BASE + (RCC_CSR_OFFSET_BB * 32) + (RCC_LSEBYP_BIT_NUMBER * 4)))
114
#define RCC_CSR_LSEBYP_BB         ((uint32_t)(PERIPH_BB_BASE + (RCC_CSR_OFFSET_BB * 32U) + (RCC_LSEBYP_BIT_NUMBER * 4U)))
133
 
115
 
134
/* Alias word address of RTCEN bit */
116
/* Alias word address of RTCEN bit */
135
#define RCC_RTCEN_BIT_NUMBER      POSITION_VAL(RCC_CSR_RTCEN)
117
#define RCC_RTCEN_BIT_NUMBER      RCC_CSR_RTCEN_Pos
136
#define RCC_CSR_RTCEN_BB          ((uint32_t)(PERIPH_BB_BASE + (RCC_CSR_OFFSET_BB * 32) + (RCC_RTCEN_BIT_NUMBER * 4)))
118
#define RCC_CSR_RTCEN_BB          ((uint32_t)(PERIPH_BB_BASE + (RCC_CSR_OFFSET_BB * 32U) + (RCC_RTCEN_BIT_NUMBER * 4U)))
137
 
119
 
138
/* Alias word address of RTCRST bit */
120
/* Alias word address of RTCRST bit */
139
#define RCC_RTCRST_BIT_NUMBER     POSITION_VAL(RCC_CSR_RTCRST)
121
#define RCC_RTCRST_BIT_NUMBER     RCC_CSR_RTCRST_Pos
140
#define RCC_CSR_RTCRST_BB         ((uint32_t)(PERIPH_BB_BASE + (RCC_CSR_OFFSET_BB * 32) + (RCC_RTCRST_BIT_NUMBER * 4)))
122
#define RCC_CSR_RTCRST_BB         ((uint32_t)(PERIPH_BB_BASE + (RCC_CSR_OFFSET_BB * 32U) + (RCC_RTCRST_BIT_NUMBER * 4U)))
141
 
123
 
142
/**
124
/**
143
  * @}
125
  * @}
144
  */
126
  */
145
 
127
 
146
/* CR register byte 2 (Bits[23:16]) base address */
128
/* CR register byte 2 (Bits[23:16]) base address */
147
#define RCC_CR_BYTE2_ADDRESS          ((uint32_t)(RCC_BASE + RCC_CR_OFFSET + 0x02))
129
#define RCC_CR_BYTE2_ADDRESS          ((uint32_t)(RCC_BASE + RCC_CR_OFFSET + 0x02U))
148
 
130
 
149
/* CIR register byte 1 (Bits[15:8]) base address */
131
/* CIR register byte 1 (Bits[15:8]) base address */
150
#define RCC_CIR_BYTE1_ADDRESS     ((uint32_t)(RCC_BASE + RCC_CIR_OFFSET + 0x01))
132
#define RCC_CIR_BYTE1_ADDRESS     ((uint32_t)(RCC_BASE + RCC_CIR_OFFSET + 0x01U))
151
 
133
 
152
/* CIR register byte 2 (Bits[23:16]) base address */
134
/* CIR register byte 2 (Bits[23:16]) base address */
153
#define RCC_CIR_BYTE2_ADDRESS     ((uint32_t)(RCC_BASE + RCC_CIR_OFFSET + 0x02))
135
#define RCC_CIR_BYTE2_ADDRESS     ((uint32_t)(RCC_BASE + RCC_CIR_OFFSET + 0x02U))
154
 
136
 
155
/* Defines used for Flags */
137
/* Defines used for Flags */
156
#define CR_REG_INDEX                     ((uint8_t)1)
138
#define CR_REG_INDEX                     ((uint8_t)1U)
157
#define CSR_REG_INDEX                    ((uint8_t)2)
139
#define CSR_REG_INDEX                    ((uint8_t)2U)
158
 
140
 
159
#define RCC_FLAG_MASK                    ((uint8_t)0x1F)
141
#define RCC_FLAG_MASK                    ((uint8_t)0x1FU)
160
 
142
 
161
/**
143
/**
162
  * @}
144
  * @}
163
  */
145
  */
164
 
146
 
Line 176... Line 158...
176
#define IS_RCC_HSE(__HSE__) (((__HSE__) == RCC_HSE_OFF) || ((__HSE__) == RCC_HSE_ON) || \
158
#define IS_RCC_HSE(__HSE__) (((__HSE__) == RCC_HSE_OFF) || ((__HSE__) == RCC_HSE_ON) || \
177
                             ((__HSE__) == RCC_HSE_BYPASS))
159
                             ((__HSE__) == RCC_HSE_BYPASS))
178
#define IS_RCC_LSE(__LSE__) (((__LSE__) == RCC_LSE_OFF) || ((__LSE__) == RCC_LSE_ON) || \
160
#define IS_RCC_LSE(__LSE__) (((__LSE__) == RCC_LSE_OFF) || ((__LSE__) == RCC_LSE_ON) || \
179
                             ((__LSE__) == RCC_LSE_BYPASS))
161
                             ((__LSE__) == RCC_LSE_BYPASS))
180
#define IS_RCC_HSI(__HSI__) (((__HSI__) == RCC_HSI_OFF) || ((__HSI__) == RCC_HSI_ON))
162
#define IS_RCC_HSI(__HSI__) (((__HSI__) == RCC_HSI_OFF) || ((__HSI__) == RCC_HSI_ON))
181
#define IS_RCC_CALIBRATION_VALUE(__VALUE__) ((__VALUE__) <= 0x1F)
163
#define IS_RCC_CALIBRATION_VALUE(__VALUE__) ((__VALUE__) <= 0x1FU)
182
#define IS_RCC_MSICALIBRATION_VALUE(__VALUE__) ((__VALUE__) <= 0xFF)
164
#define IS_RCC_MSICALIBRATION_VALUE(__VALUE__) ((__VALUE__) <= 0xFFU)
183
#define IS_RCC_MSI_CLOCK_RANGE(__RANGE__)  (((__RANGE__) == RCC_MSIRANGE_0) || \
165
#define IS_RCC_MSI_CLOCK_RANGE(__RANGE__)  (((__RANGE__) == RCC_MSIRANGE_0) || \
184
                                            ((__RANGE__) == RCC_MSIRANGE_1) || \
166
                                            ((__RANGE__) == RCC_MSIRANGE_1) || \
185
                                            ((__RANGE__) == RCC_MSIRANGE_2) || \
167
                                            ((__RANGE__) == RCC_MSIRANGE_2) || \
186
                                            ((__RANGE__) == RCC_MSIRANGE_3) || \
168
                                            ((__RANGE__) == RCC_MSIRANGE_3) || \
187
                                            ((__RANGE__) == RCC_MSIRANGE_4) || \
169
                                            ((__RANGE__) == RCC_MSIRANGE_4) || \
Line 221... Line 203...
221
                               ((__PCLK__) == RCC_HCLK_DIV4) || ((__PCLK__) == RCC_HCLK_DIV8) || \
203
                               ((__PCLK__) == RCC_HCLK_DIV4) || ((__PCLK__) == RCC_HCLK_DIV8) || \
222
                               ((__PCLK__) == RCC_HCLK_DIV16))
204
                               ((__PCLK__) == RCC_HCLK_DIV16))
223
#define IS_RCC_MCO(__MCO__)  ((__MCO__) == RCC_MCO)
205
#define IS_RCC_MCO(__MCO__)  ((__MCO__) == RCC_MCO)
224
#define IS_RCC_MCODIV(__DIV__) (((__DIV__) == RCC_MCODIV_1) || ((__DIV__) == RCC_MCODIV_2) || \
206
#define IS_RCC_MCODIV(__DIV__) (((__DIV__) == RCC_MCODIV_1) || ((__DIV__) == RCC_MCODIV_2) || \
225
                                ((__DIV__) == RCC_MCODIV_4) || ((__DIV__) == RCC_MCODIV_8) || \
207
                                ((__DIV__) == RCC_MCODIV_4) || ((__DIV__) == RCC_MCODIV_8) || \
226
                                ((__DIV__) == RCC_MCODIV_16)) 
208
                                ((__DIV__) == RCC_MCODIV_16))
227
#define IS_RCC_MCO1SOURCE(__SOURCE__) (((__SOURCE__) == RCC_MCO1SOURCE_SYSCLK) || ((__SOURCE__) == RCC_MCO1SOURCE_MSI) \
209
#define IS_RCC_MCO1SOURCE(__SOURCE__) (((__SOURCE__) == RCC_MCO1SOURCE_SYSCLK) || ((__SOURCE__) == RCC_MCO1SOURCE_MSI) \
228
                                    || ((__SOURCE__) == RCC_MCO1SOURCE_HSI)    || ((__SOURCE__) == RCC_MCO1SOURCE_LSE) \
210
                                    || ((__SOURCE__) == RCC_MCO1SOURCE_HSI)    || ((__SOURCE__) == RCC_MCO1SOURCE_LSE) \
229
                                    || ((__SOURCE__) == RCC_MCO1SOURCE_LSI)    || ((__SOURCE__) == RCC_MCO1SOURCE_HSE) \
211
                                    || ((__SOURCE__) == RCC_MCO1SOURCE_LSI)    || ((__SOURCE__) == RCC_MCO1SOURCE_HSE) \
230
                                    || ((__SOURCE__) == RCC_MCO1SOURCE_PLLCLK) || ((__SOURCE__) == RCC_MCO1SOURCE_NOCLOCK))
212
                                    || ((__SOURCE__) == RCC_MCO1SOURCE_PLLCLK) || ((__SOURCE__) == RCC_MCO1SOURCE_NOCLOCK))
231
#define IS_RCC_RTCCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_RTCCLKSOURCE_NO_CLK)   || \
213
#define IS_RCC_RTCCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_RTCCLKSOURCE_NO_CLK)   || \
Line 244... Line 226...
244
 
226
 
245
/** @defgroup RCC_Exported_Types RCC Exported Types
227
/** @defgroup RCC_Exported_Types RCC Exported Types
246
  * @{
228
  * @{
247
  */
229
  */
248
 
230
 
249
/**
231
/**
250
  * @brief  RCC PLL configuration structure definition  
232
  * @brief  RCC PLL configuration structure definition
251
  */
233
  */
252
typedef struct
234
typedef struct
253
{
235
{
254
  uint32_t PLLState;      /*!< PLLState: The new state of the PLL.
236
  uint32_t PLLState;      /*!< PLLState: The new state of the PLL.
255
                              This parameter can be a value of @ref RCC_PLL_Config */
237
                              This parameter can be a value of @ref RCC_PLL_Config */
256
 
238
 
257
  uint32_t PLLSource;     /*!< PLLSource: PLL entry clock source.
239
  uint32_t PLLSource;     /*!< PLLSource: PLL entry clock source.
258
                              This parameter must be a value of @ref RCC_PLL_Clock_Source */          
240
                              This parameter must be a value of @ref RCC_PLL_Clock_Source */
259
 
241
 
260
  uint32_t PLLMUL;        /*!< PLLMUL: Multiplication factor for PLL VCO input clock
242
  uint32_t PLLMUL;        /*!< PLLMUL: Multiplication factor for PLL VCO input clock
261
                              This parameter must be a value of @ref RCC_PLL_Multiplication_Factor*/      
243
                              This parameter must be a value of @ref RCC_PLL_Multiplication_Factor*/
262
 
244
 
263
  uint32_t PLLDIV;        /*!< PLLDIV: Division factor for PLL VCO input clock
245
  uint32_t PLLDIV;        /*!< PLLDIV: Division factor for PLL VCO input clock
264
                              This parameter must be a value of @ref RCC_PLL_Division_Factor*/      
246
                              This parameter must be a value of @ref RCC_PLL_Division_Factor*/
265
} RCC_PLLInitTypeDef;
247
} RCC_PLLInitTypeDef;
266
   
248
 
267
/**
249
/**
268
  * @brief  RCC Internal/External Oscillator (HSE, HSI, LSE and LSI) configuration structure definition  
250
  * @brief  RCC Internal/External Oscillator (HSE, HSI, LSE and LSI) configuration structure definition
269
  */
251
  */
270
typedef struct
252
typedef struct
271
{
253
{
272
  uint32_t OscillatorType;        /*!< The oscillators to be configured.
254
  uint32_t OscillatorType;        /*!< The oscillators to be configured.
273
                                       This parameter can be a value of @ref RCC_Oscillator_Type */
255
                                       This parameter can be a value of @ref RCC_Oscillator_Type */
Line 280... Line 262...
280
 
262
 
281
  uint32_t HSIState;              /*!< The new state of the HSI.
263
  uint32_t HSIState;              /*!< The new state of the HSI.
282
                                       This parameter can be a value of @ref RCC_HSI_Config */
264
                                       This parameter can be a value of @ref RCC_HSI_Config */
283
 
265
 
284
  uint32_t HSICalibrationValue;   /*!< The HSI calibration trimming value (default is RCC_HSICALIBRATION_DEFAULT).
266
  uint32_t HSICalibrationValue;   /*!< The HSI calibration trimming value (default is RCC_HSICALIBRATION_DEFAULT).
285
                                       This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x1F */
267
                                       This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x1FU */
286
 
268
 
287
  uint32_t LSIState;              /*!< The new state of the LSI.
269
  uint32_t LSIState;              /*!< The new state of the LSI.
288
                                       This parameter can be a value of @ref RCC_LSI_Config */
270
                                       This parameter can be a value of @ref RCC_LSI_Config */
289
 
271
 
290
  uint32_t MSIState;              /*!< The new state of the MSI.
272
  uint32_t MSIState;              /*!< The new state of the MSI.
291
                                       This parameter can be a value of @ref RCC_MSI_Config */
273
                                       This parameter can be a value of @ref RCC_MSI_Config */
292
 
274
 
293
  uint32_t MSICalibrationValue;   /*!< The MSI calibration trimming value. (default is RCC_MSICALIBRATION_DEFAULT).
275
  uint32_t MSICalibrationValue;   /*!< The MSI calibration trimming value. (default is RCC_MSICALIBRATION_DEFAULT).
294
                                       This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF */
276
                                       This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFFU */
295
 
277
 
296
  uint32_t MSIClockRange;         /*!< The MSI  frequency  range.
278
  uint32_t MSIClockRange;         /*!< The MSI  frequency  range.
297
                                        This parameter can be a value of @ref RCC_MSI_Clock_Range */
279
                                        This parameter can be a value of @ref RCC_MSI_Clock_Range */
298
 
280
 
299
  RCC_PLLInitTypeDef PLL;         /*!< PLL structure parameters */    
281
  RCC_PLLInitTypeDef PLL;         /*!< PLL structure parameters */
300
 
282
 
301
} RCC_OscInitTypeDef;
283
} RCC_OscInitTypeDef;
302
 
284
 
303
/**
285
/**
304
  * @brief  RCC System, AHB and APB busses clock configuration structure definition  
286
  * @brief  RCC System, AHB and APB busses clock configuration structure definition
305
  */
287
  */
306
typedef struct
288
typedef struct
307
{
289
{
308
  uint32_t ClockType;             /*!< The clock to be configured.
290
  uint32_t ClockType;             /*!< The clock to be configured.
309
                                       This parameter can be a value of @ref RCC_System_Clock_Type */
291
                                       This parameter can be a value of @ref RCC_System_Clock_Type */
Line 342... Line 324...
342
  */
324
  */
343
 
325
 
344
/** @defgroup RCC_Oscillator_Type Oscillator Type
326
/** @defgroup RCC_Oscillator_Type Oscillator Type
345
  * @{
327
  * @{
346
  */
328
  */
347
#define RCC_OSCILLATORTYPE_NONE            ((uint32_t)0x00000000)
329
#define RCC_OSCILLATORTYPE_NONE            (0x00000000U)
348
#define RCC_OSCILLATORTYPE_HSE             ((uint32_t)0x00000001)
330
#define RCC_OSCILLATORTYPE_HSE             (0x00000001U)
349
#define RCC_OSCILLATORTYPE_HSI             ((uint32_t)0x00000002)
331
#define RCC_OSCILLATORTYPE_HSI             (0x00000002U)
350
#define RCC_OSCILLATORTYPE_LSE             ((uint32_t)0x00000004)
332
#define RCC_OSCILLATORTYPE_LSE             (0x00000004U)
351
#define RCC_OSCILLATORTYPE_LSI             ((uint32_t)0x00000008)
333
#define RCC_OSCILLATORTYPE_LSI             (0x00000008U)
352
#define RCC_OSCILLATORTYPE_MSI             ((uint32_t)0x00000010)
334
#define RCC_OSCILLATORTYPE_MSI             (0x00000010U)
353
/**
335
/**
354
  * @}
336
  * @}
355
  */
337
  */
356
 
338
 
357
/** @defgroup RCC_HSE_Config HSE Config
339
/** @defgroup RCC_HSE_Config HSE Config
358
  * @{
340
  * @{
359
  */
341
  */
360
#define RCC_HSE_OFF                      ((uint32_t)0x00000000)                     /*!< HSE clock deactivation */
342
#define RCC_HSE_OFF                      (0x00000000U)                     /*!< HSE clock deactivation */
361
#define RCC_HSE_ON                       ((uint32_t)0x00000001)                     /*!< HSE clock activation */
343
#define RCC_HSE_ON                       (0x00000001U)                     /*!< HSE clock activation */
362
#define RCC_HSE_BYPASS                   ((uint32_t)0x00000005)                     /*!< External clock source for HSE clock */
344
#define RCC_HSE_BYPASS                   (0x00000005U)                     /*!< External clock source for HSE clock */
363
/**
345
/**
364
  * @}
346
  * @}
365
  */
347
  */
366
 
348
 
367
/** @defgroup RCC_LSE_Config LSE Config
349
/** @defgroup RCC_LSE_Config LSE Config
368
  * @{
350
  * @{
369
  */
351
  */
370
#define RCC_LSE_OFF                      ((uint32_t)0x00000000)                       /*!< LSE clock deactivation */
352
#define RCC_LSE_OFF                      (0x00000000U)                       /*!< LSE clock deactivation */
371
#define RCC_LSE_ON                       ((uint32_t)0x00000001)                       /*!< LSE clock activation */
353
#define RCC_LSE_ON                       (0x00000001U)                       /*!< LSE clock activation */
372
#define RCC_LSE_BYPASS                   ((uint32_t)0x00000005)                       /*!< External clock source for LSE clock */
354
#define RCC_LSE_BYPASS                   (0x00000005U)                       /*!< External clock source for LSE clock */
373
 
355
 
374
/**
356
/**
375
  * @}
357
  * @}
376
  */
358
  */
377
 
359
 
378
/** @defgroup RCC_HSI_Config HSI Config
360
/** @defgroup RCC_HSI_Config HSI Config
379
  * @{
361
  * @{
380
  */
362
  */
381
#define RCC_HSI_OFF                      ((uint32_t)0x00000000)           /*!< HSI clock deactivation */
363
#define RCC_HSI_OFF                      (0x00000000U)           /*!< HSI clock deactivation */
382
#define RCC_HSI_ON                       RCC_CR_HSION                     /*!< HSI clock activation */
364
#define RCC_HSI_ON                       RCC_CR_HSION                     /*!< HSI clock activation */
383
 
365
 
384
#define RCC_HSICALIBRATION_DEFAULT       ((uint32_t)0x10)         /* Default HSI calibration trimming value */
366
#define RCC_HSICALIBRATION_DEFAULT       (0x10U)         /* Default HSI calibration trimming value */
385
 
367
 
386
/**
368
/**
387
  * @}
369
  * @}
388
  */
370
  */
389
 
371
 
Line 400... Line 382...
400
#define RCC_MSIRANGE_6                   RCC_ICSCR_MSIRANGE_6 /*!< MSI = 4.194 MHz   */
382
#define RCC_MSIRANGE_6                   RCC_ICSCR_MSIRANGE_6 /*!< MSI = 4.194 MHz   */
401
 
383
 
402
/**
384
/**
403
  * @}
385
  * @}
404
  */
386
  */
405
 
387
 
406
/** @defgroup RCC_LSI_Config LSI Config
388
/** @defgroup RCC_LSI_Config LSI Config
407
  * @{
389
  * @{
408
  */
390
  */
409
#define RCC_LSI_OFF                      ((uint32_t)0x00000000)   /*!< LSI clock deactivation */
391
#define RCC_LSI_OFF                      (0x00000000U)   /*!< LSI clock deactivation */
410
#define RCC_LSI_ON                       RCC_CSR_LSION            /*!< LSI clock activation */
392
#define RCC_LSI_ON                       RCC_CSR_LSION            /*!< LSI clock activation */
411
 
393
 
412
/**
394
/**
413
  * @}
395
  * @}
414
  */
396
  */
415
 
397
 
416
/** @defgroup RCC_MSI_Config MSI Config
398
/** @defgroup RCC_MSI_Config MSI Config
417
  * @{
399
  * @{
418
  */
400
  */
419
#define RCC_MSI_OFF                      ((uint32_t)0x00000000)
401
#define RCC_MSI_OFF                      (0x00000000U)
420
#define RCC_MSI_ON                       ((uint32_t)0x00000001)
402
#define RCC_MSI_ON                       (0x00000001U)
421
 
403
 
422
#define RCC_MSICALIBRATION_DEFAULT       ((uint32_t)0x00000000U)   /* Default MSI calibration trimming value */
404
#define RCC_MSICALIBRATION_DEFAULT       (0x00000000U)   /* Default MSI calibration trimming value */
423
 
405
 
424
/**
406
/**
425
  * @}
407
  * @}
426
  */
408
  */
427
 
409
 
428
/** @defgroup RCC_PLL_Config PLL Config
410
/** @defgroup RCC_PLL_Config PLL Config
429
  * @{
411
  * @{
430
  */
412
  */
431
#define RCC_PLL_NONE                      ((uint32_t)0x00000000)  /*!< PLL is not configured */
413
#define RCC_PLL_NONE                      (0x00000000U)  /*!< PLL is not configured */
432
#define RCC_PLL_OFF                       ((uint32_t)0x00000001)  /*!< PLL deactivation */
414
#define RCC_PLL_OFF                       (0x00000001U)  /*!< PLL deactivation */
433
#define RCC_PLL_ON                        ((uint32_t)0x00000002)  /*!< PLL activation */
415
#define RCC_PLL_ON                        (0x00000002U)  /*!< PLL activation */
434
 
416
 
435
/**
417
/**
436
  * @}
418
  * @}
437
  */
419
  */
438
 
420
 
439
/** @defgroup RCC_System_Clock_Type System Clock Type
421
/** @defgroup RCC_System_Clock_Type System Clock Type
440
  * @{
422
  * @{
441
  */
423
  */
442
#define RCC_CLOCKTYPE_SYSCLK             ((uint32_t)0x00000001) /*!< SYSCLK to configure */
424
#define RCC_CLOCKTYPE_SYSCLK             (0x00000001U) /*!< SYSCLK to configure */
443
#define RCC_CLOCKTYPE_HCLK               ((uint32_t)0x00000002) /*!< HCLK to configure */
425
#define RCC_CLOCKTYPE_HCLK               (0x00000002U) /*!< HCLK to configure */
444
#define RCC_CLOCKTYPE_PCLK1              ((uint32_t)0x00000004) /*!< PCLK1 to configure */
426
#define RCC_CLOCKTYPE_PCLK1              (0x00000004U) /*!< PCLK1 to configure */
445
#define RCC_CLOCKTYPE_PCLK2              ((uint32_t)0x00000008) /*!< PCLK2 to configure */
427
#define RCC_CLOCKTYPE_PCLK2              (0x00000008U) /*!< PCLK2 to configure */
446
 
428
 
447
/**
429
/**
448
  * @}
430
  * @}
449
  */
431
  */
450
 
432
 
Line 486... Line 468...
486
#define RCC_SYSCLK_DIV512                RCC_CFGR_HPRE_DIV512 /*!< SYSCLK divided by 512 */
468
#define RCC_SYSCLK_DIV512                RCC_CFGR_HPRE_DIV512 /*!< SYSCLK divided by 512 */
487
 
469
 
488
/**
470
/**
489
  * @}
471
  * @}
490
  */
472
  */
491
 
473
 
492
/** @defgroup RCC_APB1_APB2_Clock_Source APB1 APB2 Clock Source
474
/** @defgroup RCC_APB1_APB2_Clock_Source APB1 APB2 Clock Source
493
  * @{
475
  * @{
494
  */
476
  */
495
#define RCC_HCLK_DIV1                    RCC_CFGR_PPRE1_DIV1  /*!< HCLK not divided */
477
#define RCC_HCLK_DIV1                    RCC_CFGR_PPRE1_DIV1  /*!< HCLK not divided */
496
#define RCC_HCLK_DIV2                    RCC_CFGR_PPRE1_DIV2  /*!< HCLK divided by 2 */
478
#define RCC_HCLK_DIV2                    RCC_CFGR_PPRE1_DIV2  /*!< HCLK divided by 2 */
Line 503... Line 485...
503
  */
485
  */
504
 
486
 
505
/** @defgroup RCC_HAL_EC_RTC_HSE_DIV RTC HSE Prescaler
487
/** @defgroup RCC_HAL_EC_RTC_HSE_DIV RTC HSE Prescaler
506
  * @{
488
  * @{
507
  */
489
  */
508
#define RCC_RTC_HSE_DIV_2               (uint32_t)0x00000000U /*!< HSE is divided by 2 for RTC clock  */
490
#define RCC_RTC_HSE_DIV_2               0x00000000U /*!< HSE is divided by 2 for RTC clock  */
509
#define RCC_RTC_HSE_DIV_4               RCC_CR_RTCPRE_0       /*!< HSE is divided by 4 for RTC clock  */
491
#define RCC_RTC_HSE_DIV_4               RCC_CR_RTCPRE_0       /*!< HSE is divided by 4 for RTC clock  */
510
#define RCC_RTC_HSE_DIV_8               RCC_CR_RTCPRE_1       /*!< HSE is divided by 8 for RTC clock  */
492
#define RCC_RTC_HSE_DIV_8               RCC_CR_RTCPRE_1       /*!< HSE is divided by 8 for RTC clock  */
511
#define RCC_RTC_HSE_DIV_16              RCC_CR_RTCPRE         /*!< HSE is divided by 16 for RTC clock */
493
#define RCC_RTC_HSE_DIV_16              RCC_CR_RTCPRE         /*!< HSE is divided by 16 for RTC clock */
512
/**
494
/**
513
  * @}
495
  * @}
514
  */
496
  */
515
 
497
 
516
/** @defgroup RCC_RTC_LCD_Clock_Source RTC LCD Clock Source
498
/** @defgroup RCC_RTC_LCD_Clock_Source RTC LCD Clock Source
517
  * @{
499
  * @{
518
  */
500
  */
519
#define RCC_RTCCLKSOURCE_NO_CLK          ((uint32_t)0x00000000)                 /*!< No clock */
501
#define RCC_RTCCLKSOURCE_NO_CLK          (0x00000000U)                 /*!< No clock */
520
#define RCC_RTCCLKSOURCE_LSE             RCC_CSR_RTCSEL_LSE                  /*!< LSE oscillator clock used as RTC clock */
502
#define RCC_RTCCLKSOURCE_LSE             RCC_CSR_RTCSEL_LSE                  /*!< LSE oscillator clock used as RTC clock */
521
#define RCC_RTCCLKSOURCE_LSI             RCC_CSR_RTCSEL_LSI                  /*!< LSI oscillator clock used as RTC clock */
503
#define RCC_RTCCLKSOURCE_LSI             RCC_CSR_RTCSEL_LSI                  /*!< LSI oscillator clock used as RTC clock */
522
#define RCC_RTCCLKSOURCE_HSE_DIVX        RCC_CSR_RTCSEL_HSE                         /*!< HSE oscillator clock divided by X used as RTC clock */
504
#define RCC_RTCCLKSOURCE_HSE_DIVX        RCC_CSR_RTCSEL_HSE                         /*!< HSE oscillator clock divided by X used as RTC clock */
523
#define RCC_RTCCLKSOURCE_HSE_DIV2        (RCC_RTC_HSE_DIV_2  | RCC_CSR_RTCSEL_HSE)  /*!< HSE oscillator clock divided by 2 used as RTC clock */
505
#define RCC_RTCCLKSOURCE_HSE_DIV2        (RCC_RTC_HSE_DIV_2  | RCC_CSR_RTCSEL_HSE)  /*!< HSE oscillator clock divided by 2 used as RTC clock */
524
#define RCC_RTCCLKSOURCE_HSE_DIV4        (RCC_RTC_HSE_DIV_4  | RCC_CSR_RTCSEL_HSE)  /*!< HSE oscillator clock divided by 4 used as RTC clock */
506
#define RCC_RTCCLKSOURCE_HSE_DIV4        (RCC_RTC_HSE_DIV_4  | RCC_CSR_RTCSEL_HSE)  /*!< HSE oscillator clock divided by 4 used as RTC clock */
Line 549... Line 531...
549
#define RCC_PLL_MUL6                    RCC_CFGR_PLLMUL6
531
#define RCC_PLL_MUL6                    RCC_CFGR_PLLMUL6
550
#define RCC_PLL_MUL8                    RCC_CFGR_PLLMUL8
532
#define RCC_PLL_MUL8                    RCC_CFGR_PLLMUL8
551
#define RCC_PLL_MUL12                   RCC_CFGR_PLLMUL12
533
#define RCC_PLL_MUL12                   RCC_CFGR_PLLMUL12
552
#define RCC_PLL_MUL16                   RCC_CFGR_PLLMUL16
534
#define RCC_PLL_MUL16                   RCC_CFGR_PLLMUL16
553
#define RCC_PLL_MUL24                   RCC_CFGR_PLLMUL24
535
#define RCC_PLL_MUL24                   RCC_CFGR_PLLMUL24
554
#define RCC_PLL_MUL32                   RCC_CFGR_PLLMUL32 
536
#define RCC_PLL_MUL32                   RCC_CFGR_PLLMUL32
555
#define RCC_PLL_MUL48                   RCC_CFGR_PLLMUL48
537
#define RCC_PLL_MUL48                   RCC_CFGR_PLLMUL48
556
 
538
 
557
/**
539
/**
558
  * @}
540
  * @}
559
  */
541
  */
560
 
542
 
561
/** @defgroup RCC_MCO_Index MCO Index
543
/** @defgroup RCC_MCO_Index MCO Index
562
  * @{
544
  * @{
563
  */
545
  */
564
#define RCC_MCO1                         ((uint32_t)0x00000000)
546
#define RCC_MCO1                         (0x00000000U)
565
#define RCC_MCO                          RCC_MCO1               /*!< MCO1 to be compliant with other families with 2 MCOs*/
547
#define RCC_MCO                          RCC_MCO1               /*!< MCO1 to be compliant with other families with 2 MCOs*/
566
 
548
 
567
/**
549
/**
568
  * @}
550
  * @}
569
  */
551
  */
Line 607... Line 589...
607
#define RCC_IT_MSIRDY                    ((uint8_t)RCC_CIR_MSIRDYF)   /*!< MSI Ready Interrupt flag */
589
#define RCC_IT_MSIRDY                    ((uint8_t)RCC_CIR_MSIRDYF)   /*!< MSI Ready Interrupt flag */
608
#define RCC_IT_LSECSS                    ((uint8_t)RCC_CIR_LSECSSF)   /*!< LSE Clock Security System Interrupt flag */
590
#define RCC_IT_LSECSS                    ((uint8_t)RCC_CIR_LSECSSF)   /*!< LSE Clock Security System Interrupt flag */
609
#define RCC_IT_CSS                       ((uint8_t)RCC_CIR_CSSF)      /*!< Clock Security System Interrupt flag */
591
#define RCC_IT_CSS                       ((uint8_t)RCC_CIR_CSSF)      /*!< Clock Security System Interrupt flag */
610
/**
592
/**
611
  * @}
593
  * @}
612
  */
594
  */
613
 
595
 
614
/** @defgroup RCC_Flag Flags
596
/** @defgroup RCC_Flag Flags
615
  *        Elements values convention: XXXYYYYYb
597
  *        Elements values convention: XXXYYYYYb
616
  *           - YYYYY  : Flag position in the register
598
  *           - YYYYY  : Flag position in the register
617
  *           - XXX  : Register index
599
  *           - XXX  : Register index
618
  *                 - 001: CR register
600
  *                 - 001: CR register
619
  *                 - 010: CSR register
601
  *                 - 010: CSR register
620
  * @{
602
  * @{
621
  */
603
  */
622
/* Flags in the CR register */
604
/* Flags in the CR register */
623
#define RCC_FLAG_HSIRDY                  ((uint8_t)((CR_REG_INDEX << 5) | POSITION_VAL(RCC_CR_HSIRDY))) /*!< Internal High Speed clock ready flag */
605
#define RCC_FLAG_HSIRDY                  ((uint8_t)((CR_REG_INDEX << 5U) | RCC_CR_HSIRDY_Pos)) /*!< Internal High Speed clock ready flag */
624
#define RCC_FLAG_MSIRDY                  ((uint8_t)((CR_REG_INDEX << 5) | POSITION_VAL(RCC_CR_MSIRDY))) /*!< MSI clock ready flag */
606
#define RCC_FLAG_MSIRDY                  ((uint8_t)((CR_REG_INDEX << 5U) | RCC_CR_MSIRDY_Pos)) /*!< MSI clock ready flag */
625
#define RCC_FLAG_HSERDY                  ((uint8_t)((CR_REG_INDEX << 5) | POSITION_VAL(RCC_CR_HSERDY))) /*!< External High Speed clock ready flag */
607
#define RCC_FLAG_HSERDY                  ((uint8_t)((CR_REG_INDEX << 5U) | RCC_CR_HSERDY_Pos)) /*!< External High Speed clock ready flag */
626
#define RCC_FLAG_PLLRDY                  ((uint8_t)((CR_REG_INDEX << 5) | POSITION_VAL(RCC_CR_PLLRDY))) /*!< PLL clock ready flag */
608
#define RCC_FLAG_PLLRDY                  ((uint8_t)((CR_REG_INDEX << 5U) | RCC_CR_PLLRDY_Pos)) /*!< PLL clock ready flag */
627
 
609
 
628
/* Flags in the CSR register */
610
/* Flags in the CSR register */
629
#define RCC_FLAG_LSIRDY                  ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_LSIRDY)))   /*!< Internal Low Speed oscillator Ready */
611
#define RCC_FLAG_LSIRDY                  ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_LSIRDY_Pos))   /*!< Internal Low Speed oscillator Ready */
630
#define RCC_FLAG_LSECSS                  ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_LSECSSD)))  /*!< CSS on LSE failure Detection */
612
#define RCC_FLAG_LSECSS                  ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_LSECSSD_Pos))  /*!< CSS on LSE failure Detection */
631
#define RCC_FLAG_OBLRST                  ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_OBLRSTF)))  /*!< Options bytes loading reset flag */
613
#define RCC_FLAG_OBLRST                  ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_OBLRSTF_Pos))  /*!< Options bytes loading reset flag */
632
#define RCC_FLAG_PINRST                  ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_PINRSTF)))  /*!< PIN reset flag */
614
#define RCC_FLAG_PINRST                  ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_PINRSTF_Pos))  /*!< PIN reset flag */
633
#define RCC_FLAG_PORRST                  ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_PORRSTF)))  /*!< POR/PDR reset flag */
615
#define RCC_FLAG_PORRST                  ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_PORRSTF_Pos))  /*!< POR/PDR reset flag */
634
#define RCC_FLAG_SFTRST                  ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_SFTRSTF)))  /*!< Software Reset flag */
616
#define RCC_FLAG_SFTRST                  ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_SFTRSTF_Pos))  /*!< Software Reset flag */
635
#define RCC_FLAG_IWDGRST                 ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_IWDGRSTF))) /*!< Independent Watchdog reset flag */
617
#define RCC_FLAG_IWDGRST                 ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_IWDGRSTF_Pos)) /*!< Independent Watchdog reset flag */
636
#define RCC_FLAG_WWDGRST                 ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_WWDGRSTF))) /*!< Window watchdog reset flag */
618
#define RCC_FLAG_WWDGRST                 ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_WWDGRSTF_Pos)) /*!< Window watchdog reset flag */
637
#define RCC_FLAG_LPWRRST                 ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_LPWRRSTF))) /*!< Low-Power reset flag */
619
#define RCC_FLAG_LPWRRST                 ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_LPWRRSTF_Pos)) /*!< Low-Power reset flag */
638
#define RCC_FLAG_LSERDY                  ((uint8_t)((CSR_REG_INDEX << 5) | POSITION_VAL(RCC_CSR_LSERDY))) /*!< External Low Speed oscillator Ready */
620
#define RCC_FLAG_LSERDY                  ((uint8_t)((CSR_REG_INDEX << 5U) | RCC_CSR_LSERDY_Pos)) /*!< External Low Speed oscillator Ready */
639
 
621
 
640
/**
622
/**
641
  * @}
623
  * @}
642
  */
624
  */
643
 
625
 
Line 652... Line 634...
652
  */
634
  */
653
 
635
 
654
/** @defgroup RCC_Peripheral_Clock_Enable_Disable Peripheral Clock Enable Disable
636
/** @defgroup RCC_Peripheral_Clock_Enable_Disable Peripheral Clock Enable Disable
655
  * @brief  Enable or disable the AHB1 peripheral clock.
637
  * @brief  Enable or disable the AHB1 peripheral clock.
656
  * @note   After reset, the peripheral clock (used for registers read/write access)
638
  * @note   After reset, the peripheral clock (used for registers read/write access)
657
  *         is disabled and the application software has to enable this clock before
639
  *         is disabled and the application software has to enable this clock before
658
  *         using it.  
640
  *         using it.
659
  * @{
641
  * @{
660
  */
642
  */
661
#define __HAL_RCC_GPIOA_CLK_ENABLE()   do { \
643
#define __HAL_RCC_GPIOA_CLK_ENABLE()   do { \
662
                                        __IO uint32_t tmpreg; \
644
                                        __IO uint32_t tmpreg; \
663
                                        SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIOAEN);\
645
                                        SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIOAEN);\
664
                                        /* Delay after an RCC peripheral clock enabling */\
646
                                        /* Delay after an RCC peripheral clock enabling */\
665
                                        tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_GPIOAEN);\
647
                                        tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_GPIOAEN);\
666
                                        UNUSED(tmpreg); \
648
                                        UNUSED(tmpreg); \
667
                                      } while(0)
649
                                      } while(0U)
668
#define __HAL_RCC_GPIOB_CLK_ENABLE()   do { \
650
#define __HAL_RCC_GPIOB_CLK_ENABLE()   do { \
669
                                        __IO uint32_t tmpreg; \
651
                                        __IO uint32_t tmpreg; \
670
                                        SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIOBEN);\
652
                                        SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIOBEN);\
671
                                        /* Delay after an RCC peripheral clock enabling */\
653
                                        /* Delay after an RCC peripheral clock enabling */\
672
                                        tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_GPIOBEN);\
654
                                        tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_GPIOBEN);\
673
                                        UNUSED(tmpreg); \
655
                                        UNUSED(tmpreg); \
674
                                      } while(0)
656
                                      } while(0U)
675
#define __HAL_RCC_GPIOC_CLK_ENABLE()   do { \
657
#define __HAL_RCC_GPIOC_CLK_ENABLE()   do { \
676
                                        __IO uint32_t tmpreg; \
658
                                        __IO uint32_t tmpreg; \
677
                                        SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIOCEN);\
659
                                        SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIOCEN);\
678
                                        /* Delay after an RCC peripheral clock enabling */\
660
                                        /* Delay after an RCC peripheral clock enabling */\
679
                                        tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_GPIOCEN);\
661
                                        tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_GPIOCEN);\
680
                                        UNUSED(tmpreg); \
662
                                        UNUSED(tmpreg); \
681
                                      } while(0)
663
                                      } while(0U)
682
#define __HAL_RCC_GPIOD_CLK_ENABLE()   do { \
664
#define __HAL_RCC_GPIOD_CLK_ENABLE()   do { \
683
                                        __IO uint32_t tmpreg; \
665
                                        __IO uint32_t tmpreg; \
684
                                        SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIODEN);\
666
                                        SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIODEN);\
685
                                        /* Delay after an RCC peripheral clock enabling */\
667
                                        /* Delay after an RCC peripheral clock enabling */\
686
                                        tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_GPIODEN);\
668
                                        tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_GPIODEN);\
687
                                        UNUSED(tmpreg); \
669
                                        UNUSED(tmpreg); \
688
                                      } while(0)
670
                                      } while(0U)
689
#define __HAL_RCC_GPIOH_CLK_ENABLE()   do { \
671
#define __HAL_RCC_GPIOH_CLK_ENABLE()   do { \
690
                                        __IO uint32_t tmpreg; \
672
                                        __IO uint32_t tmpreg; \
691
                                        SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIOHEN);\
673
                                        SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIOHEN);\
692
                                        /* Delay after an RCC peripheral clock enabling */\
674
                                        /* Delay after an RCC peripheral clock enabling */\
693
                                        tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_GPIOHEN);\
675
                                        tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_GPIOHEN);\
694
                                        UNUSED(tmpreg); \
676
                                        UNUSED(tmpreg); \
695
                                      } while(0)
677
                                      } while(0U)
696
#define __HAL_RCC_CRC_CLK_ENABLE()   do { \
678
#define __HAL_RCC_CRC_CLK_ENABLE()   do { \
697
                                        __IO uint32_t tmpreg; \
679
                                        __IO uint32_t tmpreg; \
698
                                        SET_BIT(RCC->AHBENR, RCC_AHBENR_CRCEN);\
680
                                        SET_BIT(RCC->AHBENR, RCC_AHBENR_CRCEN);\
699
                                        /* Delay after an RCC peripheral clock enabling */\
681
                                        /* Delay after an RCC peripheral clock enabling */\
700
                                        tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_CRCEN);\
682
                                        tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_CRCEN);\
701
                                        UNUSED(tmpreg); \
683
                                        UNUSED(tmpreg); \
702
                                      } while(0)
684
                                      } while(0U)
703
#define __HAL_RCC_FLITF_CLK_ENABLE()   do { \
685
#define __HAL_RCC_FLITF_CLK_ENABLE()   do { \
704
                                        __IO uint32_t tmpreg; \
686
                                        __IO uint32_t tmpreg; \
705
                                        SET_BIT(RCC->AHBENR, RCC_AHBENR_FLITFEN);\
687
                                        SET_BIT(RCC->AHBENR, RCC_AHBENR_FLITFEN);\
706
                                        /* Delay after an RCC peripheral clock enabling */\
688
                                        /* Delay after an RCC peripheral clock enabling */\
707
                                        tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_FLITFEN);\
689
                                        tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_FLITFEN);\
708
                                        UNUSED(tmpreg); \
690
                                        UNUSED(tmpreg); \
709
                                      } while(0)
691
                                      } while(0U)
710
#define __HAL_RCC_DMA1_CLK_ENABLE()   do { \
692
#define __HAL_RCC_DMA1_CLK_ENABLE()   do { \
711
                                        __IO uint32_t tmpreg; \
693
                                        __IO uint32_t tmpreg; \
712
                                        SET_BIT(RCC->AHBENR, RCC_AHBENR_DMA1EN);\
694
                                        SET_BIT(RCC->AHBENR, RCC_AHBENR_DMA1EN);\
713
                                        /* Delay after an RCC peripheral clock enabling */\
695
                                        /* Delay after an RCC peripheral clock enabling */\
714
                                        tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_DMA1EN);\
696
                                        tmpreg = READ_BIT(RCC->AHBENR, RCC_AHBENR_DMA1EN);\
715
                                        UNUSED(tmpreg); \
697
                                        UNUSED(tmpreg); \
716
                                      } while(0)
698
                                      } while(0U)
717
 
699
 
718
#define __HAL_RCC_GPIOA_CLK_DISABLE()     (RCC->AHBENR &= ~(RCC_AHBENR_GPIOAEN))
700
#define __HAL_RCC_GPIOA_CLK_DISABLE()     (RCC->AHBENR &= ~(RCC_AHBENR_GPIOAEN))
719
#define __HAL_RCC_GPIOB_CLK_DISABLE()     (RCC->AHBENR &= ~(RCC_AHBENR_GPIOBEN))
701
#define __HAL_RCC_GPIOB_CLK_DISABLE()     (RCC->AHBENR &= ~(RCC_AHBENR_GPIOBEN))
720
#define __HAL_RCC_GPIOC_CLK_DISABLE()     (RCC->AHBENR &= ~(RCC_AHBENR_GPIOCEN))
702
#define __HAL_RCC_GPIOC_CLK_DISABLE()     (RCC->AHBENR &= ~(RCC_AHBENR_GPIOCEN))
721
#define __HAL_RCC_GPIOD_CLK_DISABLE()     (RCC->AHBENR &= ~(RCC_AHBENR_GPIODEN))
703
#define __HAL_RCC_GPIOD_CLK_DISABLE()     (RCC->AHBENR &= ~(RCC_AHBENR_GPIODEN))
Line 730... Line 712...
730
  */
712
  */
731
 
713
 
732
/** @defgroup RCC_APB1_Clock_Enable_Disable APB1 Clock Enable Disable
714
/** @defgroup RCC_APB1_Clock_Enable_Disable APB1 Clock Enable Disable
733
  * @brief  Enable or disable the Low Speed APB (APB1) peripheral clock.
715
  * @brief  Enable or disable the Low Speed APB (APB1) peripheral clock.
734
  * @note   After reset, the peripheral clock (used for registers read/write access)
716
  * @note   After reset, the peripheral clock (used for registers read/write access)
735
  *         is disabled and the application software has to enable this clock before
717
  *         is disabled and the application software has to enable this clock before
736
  *         using it.
718
  *         using it.
737
  * @{  
719
  * @{
738
  */
720
  */
739
#define __HAL_RCC_TIM2_CLK_ENABLE()   do { \
721
#define __HAL_RCC_TIM2_CLK_ENABLE()   do { \
740
                                        __IO uint32_t tmpreg; \
722
                                        __IO uint32_t tmpreg; \
741
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
723
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
742
                                        /* Delay after an RCC peripheral clock enabling */\
724
                                        /* Delay after an RCC peripheral clock enabling */\
743
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
725
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
744
                                        UNUSED(tmpreg); \
726
                                        UNUSED(tmpreg); \
745
                                      } while(0)
727
                                      } while(0U)
746
#define __HAL_RCC_TIM3_CLK_ENABLE()   do { \
728
#define __HAL_RCC_TIM3_CLK_ENABLE()   do { \
747
                                        __IO uint32_t tmpreg; \
729
                                        __IO uint32_t tmpreg; \
748
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
730
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
749
                                        /* Delay after an RCC peripheral clock enabling */\
731
                                        /* Delay after an RCC peripheral clock enabling */\
750
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
732
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
751
                                        UNUSED(tmpreg); \
733
                                        UNUSED(tmpreg); \
752
                                      } while(0)
734
                                      } while(0U)
753
#define __HAL_RCC_TIM4_CLK_ENABLE()   do { \
735
#define __HAL_RCC_TIM4_CLK_ENABLE()   do { \
754
                                        __IO uint32_t tmpreg; \
736
                                        __IO uint32_t tmpreg; \
755
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
737
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
756
                                        /* Delay after an RCC peripheral clock enabling */\
738
                                        /* Delay after an RCC peripheral clock enabling */\
757
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
739
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
758
                                        UNUSED(tmpreg); \
740
                                        UNUSED(tmpreg); \
759
                                      } while(0)
741
                                      } while(0U)
760
#define __HAL_RCC_TIM6_CLK_ENABLE()   do { \
742
#define __HAL_RCC_TIM6_CLK_ENABLE()   do { \
761
                                        __IO uint32_t tmpreg; \
743
                                        __IO uint32_t tmpreg; \
762
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
744
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
763
                                        /* Delay after an RCC peripheral clock enabling */\
745
                                        /* Delay after an RCC peripheral clock enabling */\
764
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
746
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
765
                                        UNUSED(tmpreg); \
747
                                        UNUSED(tmpreg); \
766
                                      } while(0)
748
                                      } while(0U)
767
#define __HAL_RCC_TIM7_CLK_ENABLE()   do { \
749
#define __HAL_RCC_TIM7_CLK_ENABLE()   do { \
768
                                        __IO uint32_t tmpreg; \
750
                                        __IO uint32_t tmpreg; \
769
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
751
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
770
                                        /* Delay after an RCC peripheral clock enabling */\
752
                                        /* Delay after an RCC peripheral clock enabling */\
771
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
753
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
772
                                        UNUSED(tmpreg); \
754
                                        UNUSED(tmpreg); \
773
                                      } while(0)
755
                                      } while(0U)
774
#define __HAL_RCC_WWDG_CLK_ENABLE()   do { \
756
#define __HAL_RCC_WWDG_CLK_ENABLE()   do { \
775
                                        __IO uint32_t tmpreg; \
757
                                        __IO uint32_t tmpreg; \
776
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_WWDGEN);\
758
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_WWDGEN);\
777
                                        /* Delay after an RCC peripheral clock enabling */\
759
                                        /* Delay after an RCC peripheral clock enabling */\
778
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_WWDGEN);\
760
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_WWDGEN);\
779
                                        UNUSED(tmpreg); \
761
                                        UNUSED(tmpreg); \
780
                                      } while(0)
762
                                      } while(0U)
781
#define __HAL_RCC_SPI2_CLK_ENABLE()   do { \
763
#define __HAL_RCC_SPI2_CLK_ENABLE()   do { \
782
                                        __IO uint32_t tmpreg; \
764
                                        __IO uint32_t tmpreg; \
783
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI2EN);\
765
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI2EN);\
784
                                        /* Delay after an RCC peripheral clock enabling */\
766
                                        /* Delay after an RCC peripheral clock enabling */\
785
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI2EN);\
767
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI2EN);\
786
                                        UNUSED(tmpreg); \
768
                                        UNUSED(tmpreg); \
787
                                      } while(0)
769
                                      } while(0U)
788
#define __HAL_RCC_USART2_CLK_ENABLE()   do { \
770
#define __HAL_RCC_USART2_CLK_ENABLE()   do { \
789
                                        __IO uint32_t tmpreg; \
771
                                        __IO uint32_t tmpreg; \
790
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART2EN);\
772
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART2EN);\
791
                                        /* Delay after an RCC peripheral clock enabling */\
773
                                        /* Delay after an RCC peripheral clock enabling */\
792
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART2EN);\
774
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART2EN);\
793
                                        UNUSED(tmpreg); \
775
                                        UNUSED(tmpreg); \
794
                                      } while(0)
776
                                      } while(0U)
795
#define __HAL_RCC_USART3_CLK_ENABLE()   do { \
777
#define __HAL_RCC_USART3_CLK_ENABLE()   do { \
796
                                        __IO uint32_t tmpreg; \
778
                                        __IO uint32_t tmpreg; \
797
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
779
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
798
                                        /* Delay after an RCC peripheral clock enabling */\
780
                                        /* Delay after an RCC peripheral clock enabling */\
799
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
781
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
800
                                        UNUSED(tmpreg); \
782
                                        UNUSED(tmpreg); \
801
                                      } while(0)
783
                                      } while(0U)
802
#define __HAL_RCC_I2C1_CLK_ENABLE()   do { \
784
#define __HAL_RCC_I2C1_CLK_ENABLE()   do { \
803
                                        __IO uint32_t tmpreg; \
785
                                        __IO uint32_t tmpreg; \
804
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C1EN);\
786
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C1EN);\
805
                                        /* Delay after an RCC peripheral clock enabling */\
787
                                        /* Delay after an RCC peripheral clock enabling */\
806
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C1EN);\
788
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C1EN);\
807
                                        UNUSED(tmpreg); \
789
                                        UNUSED(tmpreg); \
808
                                      } while(0)
790
                                      } while(0U)
809
#define __HAL_RCC_I2C2_CLK_ENABLE()   do { \
791
#define __HAL_RCC_I2C2_CLK_ENABLE()   do { \
810
                                        __IO uint32_t tmpreg; \
792
                                        __IO uint32_t tmpreg; \
811
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C2EN);\
793
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C2EN);\
812
                                        /* Delay after an RCC peripheral clock enabling */\
794
                                        /* Delay after an RCC peripheral clock enabling */\
813
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C2EN);\
795
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C2EN);\
814
                                        UNUSED(tmpreg); \
796
                                        UNUSED(tmpreg); \
815
                                      } while(0)
797
                                      } while(0U)
816
#define __HAL_RCC_USB_CLK_ENABLE()   do { \
798
#define __HAL_RCC_USB_CLK_ENABLE()   do { \
817
                                        __IO uint32_t tmpreg; \
799
                                        __IO uint32_t tmpreg; \
818
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USBEN);\
800
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USBEN);\
819
                                        /* Delay after an RCC peripheral clock enabling */\
801
                                        /* Delay after an RCC peripheral clock enabling */\
820
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USBEN);\
802
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USBEN);\
821
                                        UNUSED(tmpreg); \
803
                                        UNUSED(tmpreg); \
822
                                      } while(0)
804
                                      } while(0U)
823
#define __HAL_RCC_PWR_CLK_ENABLE()   do { \
805
#define __HAL_RCC_PWR_CLK_ENABLE()   do { \
824
                                        __IO uint32_t tmpreg; \
806
                                        __IO uint32_t tmpreg; \
825
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_PWREN);\
807
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_PWREN);\
826
                                        /* Delay after an RCC peripheral clock enabling */\
808
                                        /* Delay after an RCC peripheral clock enabling */\
827
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_PWREN);\
809
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_PWREN);\
828
                                        UNUSED(tmpreg); \
810
                                        UNUSED(tmpreg); \
829
                                      } while(0)
811
                                      } while(0U)
830
#define __HAL_RCC_DAC_CLK_ENABLE()   do { \
812
#define __HAL_RCC_DAC_CLK_ENABLE()   do { \
831
                                        __IO uint32_t tmpreg; \
813
                                        __IO uint32_t tmpreg; \
832
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
814
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
833
                                        /* Delay after an RCC peripheral clock enabling */\
815
                                        /* Delay after an RCC peripheral clock enabling */\
834
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
816
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
835
                                        UNUSED(tmpreg); \
817
                                        UNUSED(tmpreg); \
836
                                      } while(0)
818
                                      } while(0U)
837
#define __HAL_RCC_COMP_CLK_ENABLE()   do { \
819
#define __HAL_RCC_COMP_CLK_ENABLE()   do { \
838
                                        __IO uint32_t tmpreg; \
820
                                        __IO uint32_t tmpreg; \
839
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_COMPEN);\
821
                                        SET_BIT(RCC->APB1ENR, RCC_APB1ENR_COMPEN);\
840
                                        /* Delay after an RCC peripheral clock enabling */\
822
                                        /* Delay after an RCC peripheral clock enabling */\
841
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_COMPEN);\
823
                                        tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_COMPEN);\
842
                                        UNUSED(tmpreg); \
824
                                        UNUSED(tmpreg); \
843
                                      } while(0)
825
                                      } while(0U)
844
 
826
 
845
 
827
 
846
#define __HAL_RCC_TIM2_CLK_DISABLE()      (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN))
828
#define __HAL_RCC_TIM2_CLK_DISABLE()      (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN))
847
#define __HAL_RCC_TIM3_CLK_DISABLE()      (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN))
829
#define __HAL_RCC_TIM3_CLK_DISABLE()      (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN))
848
#define __HAL_RCC_TIM4_CLK_DISABLE()      (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN))
830
#define __HAL_RCC_TIM4_CLK_DISABLE()      (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN))
Line 864... Line 846...
864
  */
846
  */
865
 
847
 
866
/** @defgroup RCC_APB2_Clock_Enable_Disable APB2 Clock Enable Disable
848
/** @defgroup RCC_APB2_Clock_Enable_Disable APB2 Clock Enable Disable
867
  * @brief  Enable or disable the High Speed APB (APB2) peripheral clock.
849
  * @brief  Enable or disable the High Speed APB (APB2) peripheral clock.
868
  * @note   After reset, the peripheral clock (used for registers read/write access)
850
  * @note   After reset, the peripheral clock (used for registers read/write access)
869
  *         is disabled and the application software has to enable this clock before
851
  *         is disabled and the application software has to enable this clock before
870
  *         using it.
852
  *         using it.
871
  * @{
853
  * @{
872
  */
854
  */
873
#define __HAL_RCC_SYSCFG_CLK_ENABLE()   do { \
855
#define __HAL_RCC_SYSCFG_CLK_ENABLE()   do { \
874
                                        __IO uint32_t tmpreg; \
856
                                        __IO uint32_t tmpreg; \
875
                                        SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SYSCFGEN);\
857
                                        SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SYSCFGEN);\
876
                                        /* Delay after an RCC peripheral clock enabling */\
858
                                        /* Delay after an RCC peripheral clock enabling */\
877
                                        tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SYSCFGEN);\
859
                                        tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SYSCFGEN);\
878
                                        UNUSED(tmpreg); \
860
                                        UNUSED(tmpreg); \
879
                                      } while(0)
861
                                      } while(0U)
880
#define __HAL_RCC_TIM9_CLK_ENABLE()   do { \
862
#define __HAL_RCC_TIM9_CLK_ENABLE()   do { \
881
                                        __IO uint32_t tmpreg; \
863
                                        __IO uint32_t tmpreg; \
882
                                        SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM9EN);\
864
                                        SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM9EN);\
883
                                        /* Delay after an RCC peripheral clock enabling */\
865
                                        /* Delay after an RCC peripheral clock enabling */\
884
                                        tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM9EN);\
866
                                        tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM9EN);\
885
                                        UNUSED(tmpreg); \
867
                                        UNUSED(tmpreg); \
886
                                      } while(0)
868
                                      } while(0U)
887
#define __HAL_RCC_TIM10_CLK_ENABLE()   do { \
869
#define __HAL_RCC_TIM10_CLK_ENABLE()   do { \
888
                                        __IO uint32_t tmpreg; \
870
                                        __IO uint32_t tmpreg; \
889
                                        SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
871
                                        SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
890
                                        /* Delay after an RCC peripheral clock enabling */\
872
                                        /* Delay after an RCC peripheral clock enabling */\
891
                                        tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
873
                                        tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
892
                                        UNUSED(tmpreg); \
874
                                        UNUSED(tmpreg); \
893
                                      } while(0)
875
                                      } while(0U)
894
#define __HAL_RCC_TIM11_CLK_ENABLE()   do { \
876
#define __HAL_RCC_TIM11_CLK_ENABLE()   do { \
895
                                        __IO uint32_t tmpreg; \
877
                                        __IO uint32_t tmpreg; \
896
                                        SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM11EN);\
878
                                        SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM11EN);\
897
                                        /* Delay after an RCC peripheral clock enabling */\
879
                                        /* Delay after an RCC peripheral clock enabling */\
898
                                        tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM11EN);\
880
                                        tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM11EN);\
899
                                        UNUSED(tmpreg); \
881
                                        UNUSED(tmpreg); \
900
                                      } while(0)
882
                                      } while(0U)
901
#define __HAL_RCC_ADC1_CLK_ENABLE()   do { \
883
#define __HAL_RCC_ADC1_CLK_ENABLE()   do { \
902
                                        __IO uint32_t tmpreg; \
884
                                        __IO uint32_t tmpreg; \
903
                                        SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC1EN);\
885
                                        SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC1EN);\
904
                                        /* Delay after an RCC peripheral clock enabling */\
886
                                        /* Delay after an RCC peripheral clock enabling */\
905
                                        tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC1EN);\
887
                                        tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC1EN);\
906
                                        UNUSED(tmpreg); \
888
                                        UNUSED(tmpreg); \
907
                                      } while(0)
889
                                      } while(0U)
908
#define __HAL_RCC_SPI1_CLK_ENABLE()   do { \
890
#define __HAL_RCC_SPI1_CLK_ENABLE()   do { \
909
                                        __IO uint32_t tmpreg; \
891
                                        __IO uint32_t tmpreg; \
910
                                        SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN);\
892
                                        SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN);\
911
                                        /* Delay after an RCC peripheral clock enabling */\
893
                                        /* Delay after an RCC peripheral clock enabling */\
912
                                        tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN);\
894
                                        tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN);\
913
                                        UNUSED(tmpreg); \
895
                                        UNUSED(tmpreg); \
914
                                      } while(0)
896
                                      } while(0U)
915
#define __HAL_RCC_USART1_CLK_ENABLE()   do { \
897
#define __HAL_RCC_USART1_CLK_ENABLE()   do { \
916
                                        __IO uint32_t tmpreg; \
898
                                        __IO uint32_t tmpreg; \
917
                                        SET_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\
899
                                        SET_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\
918
                                        /* Delay after an RCC peripheral clock enabling */\
900
                                        /* Delay after an RCC peripheral clock enabling */\
919
                                        tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\
901
                                        tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\
920
                                        UNUSED(tmpreg); \
902
                                        UNUSED(tmpreg); \
921
                                      } while(0)
903
                                      } while(0U)
922
 
904
 
923
#define __HAL_RCC_SYSCFG_CLK_DISABLE()    (RCC->APB2ENR &= ~(RCC_APB2ENR_SYSCFGEN))
905
#define __HAL_RCC_SYSCFG_CLK_DISABLE()    (RCC->APB2ENR &= ~(RCC_APB2ENR_SYSCFGEN))
924
#define __HAL_RCC_TIM9_CLK_DISABLE()      (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM9EN))
906
#define __HAL_RCC_TIM9_CLK_DISABLE()      (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM9EN))
925
#define __HAL_RCC_TIM10_CLK_DISABLE()     (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN))
907
#define __HAL_RCC_TIM10_CLK_DISABLE()     (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN))
926
#define __HAL_RCC_TIM11_CLK_DISABLE()     (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM11EN))
908
#define __HAL_RCC_TIM11_CLK_DISABLE()     (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM11EN))
Line 933... Line 915...
933
  */
915
  */
934
 
916
 
935
/** @defgroup RCC_Peripheral_Clock_Force_Release RCC Peripheral Clock Force Release
917
/** @defgroup RCC_Peripheral_Clock_Force_Release RCC Peripheral Clock Force Release
936
  * @brief  Force or release AHB peripheral reset.
918
  * @brief  Force or release AHB peripheral reset.
937
  * @{
919
  * @{
938
  */
920
  */
939
#define __HAL_RCC_AHB_FORCE_RESET()       (RCC->AHBRSTR = 0xFFFFFFFFU)
921
#define __HAL_RCC_AHB_FORCE_RESET()       (RCC->AHBRSTR = 0xFFFFFFFFU)
940
#define __HAL_RCC_GPIOA_FORCE_RESET()     (RCC->AHBRSTR |= (RCC_AHBRSTR_GPIOARST))
922
#define __HAL_RCC_GPIOA_FORCE_RESET()     (RCC->AHBRSTR |= (RCC_AHBRSTR_GPIOARST))
941
#define __HAL_RCC_GPIOB_FORCE_RESET()     (RCC->AHBRSTR |= (RCC_AHBRSTR_GPIOBRST))
923
#define __HAL_RCC_GPIOB_FORCE_RESET()     (RCC->AHBRSTR |= (RCC_AHBRSTR_GPIOBRST))
942
#define __HAL_RCC_GPIOC_FORCE_RESET()     (RCC->AHBRSTR |= (RCC_AHBRSTR_GPIOCRST))
924
#define __HAL_RCC_GPIOC_FORCE_RESET()     (RCC->AHBRSTR |= (RCC_AHBRSTR_GPIOCRST))
943
#define __HAL_RCC_GPIOD_FORCE_RESET()     (RCC->AHBRSTR |= (RCC_AHBRSTR_GPIODRST))
925
#define __HAL_RCC_GPIOD_FORCE_RESET()     (RCC->AHBRSTR |= (RCC_AHBRSTR_GPIODRST))
Line 962... Line 944...
962
  * @}
944
  * @}
963
  */
945
  */
964
 
946
 
965
/** @defgroup RCC_APB1_Force_Release_Reset APB1 Force Release Reset
947
/** @defgroup RCC_APB1_Force_Release_Reset APB1 Force Release Reset
966
  * @brief  Force or release APB1 peripheral reset.
948
  * @brief  Force or release APB1 peripheral reset.
967
  * @{  
949
  * @{
968
  */
950
  */
969
#define __HAL_RCC_APB1_FORCE_RESET()      (RCC->APB1RSTR = 0xFFFFFFFFU)  
951
#define __HAL_RCC_APB1_FORCE_RESET()      (RCC->APB1RSTR = 0xFFFFFFFFU)
970
#define __HAL_RCC_TIM2_FORCE_RESET()      (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST))
952
#define __HAL_RCC_TIM2_FORCE_RESET()      (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST))
971
#define __HAL_RCC_TIM3_FORCE_RESET()      (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST))
953
#define __HAL_RCC_TIM3_FORCE_RESET()      (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST))
972
#define __HAL_RCC_TIM4_FORCE_RESET()      (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST))
954
#define __HAL_RCC_TIM4_FORCE_RESET()      (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST))
973
#define __HAL_RCC_TIM6_FORCE_RESET()      (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST))
955
#define __HAL_RCC_TIM6_FORCE_RESET()      (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST))
974
#define __HAL_RCC_TIM7_FORCE_RESET()      (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST))
956
#define __HAL_RCC_TIM7_FORCE_RESET()      (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST))
Line 981... Line 963...
981
#define __HAL_RCC_USB_FORCE_RESET()       (RCC->APB1RSTR |= (RCC_APB1RSTR_USBRST))
963
#define __HAL_RCC_USB_FORCE_RESET()       (RCC->APB1RSTR |= (RCC_APB1RSTR_USBRST))
982
#define __HAL_RCC_PWR_FORCE_RESET()       (RCC->APB1RSTR |= (RCC_APB1RSTR_PWRRST))
964
#define __HAL_RCC_PWR_FORCE_RESET()       (RCC->APB1RSTR |= (RCC_APB1RSTR_PWRRST))
983
#define __HAL_RCC_DAC_FORCE_RESET()       (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST))
965
#define __HAL_RCC_DAC_FORCE_RESET()       (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST))
984
#define __HAL_RCC_COMP_FORCE_RESET()      (RCC->APB1RSTR |= (RCC_APB1RSTR_COMPRST))
966
#define __HAL_RCC_COMP_FORCE_RESET()      (RCC->APB1RSTR |= (RCC_APB1RSTR_COMPRST))
985
 
967
 
986
#define __HAL_RCC_APB1_RELEASE_RESET()    (RCC->APB1RSTR = 0x00000000U) 
968
#define __HAL_RCC_APB1_RELEASE_RESET()    (RCC->APB1RSTR = 0x00000000U)
987
#define __HAL_RCC_TIM2_RELEASE_RESET()    (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST))
969
#define __HAL_RCC_TIM2_RELEASE_RESET()    (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST))
988
#define __HAL_RCC_TIM3_RELEASE_RESET()    (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST))
970
#define __HAL_RCC_TIM3_RELEASE_RESET()    (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST))
989
#define __HAL_RCC_TIM4_RELEASE_RESET()    (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST))
971
#define __HAL_RCC_TIM4_RELEASE_RESET()    (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST))
990
#define __HAL_RCC_TIM6_RELEASE_RESET()    (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST))
972
#define __HAL_RCC_TIM6_RELEASE_RESET()    (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST))
991
#define __HAL_RCC_TIM7_RELEASE_RESET()    (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST))
973
#define __HAL_RCC_TIM7_RELEASE_RESET()    (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST))
Line 1004... Line 986...
1004
  * @}
986
  * @}
1005
  */
987
  */
1006
 
988
 
1007
/** @defgroup RCC_APB2_Force_Release_Reset APB2 Force Release Reset
989
/** @defgroup RCC_APB2_Force_Release_Reset APB2 Force Release Reset
1008
  * @brief  Force or release APB1 peripheral reset.
990
  * @brief  Force or release APB1 peripheral reset.
1009
  * @{  
991
  * @{
1010
  */
992
  */
1011
#define __HAL_RCC_APB2_FORCE_RESET()      (RCC->APB2RSTR = 0xFFFFFFFFU)  
993
#define __HAL_RCC_APB2_FORCE_RESET()      (RCC->APB2RSTR = 0xFFFFFFFFU)
1012
#define __HAL_RCC_SYSCFG_FORCE_RESET()    (RCC->APB2RSTR |= (RCC_APB2RSTR_SYSCFGRST))
994
#define __HAL_RCC_SYSCFG_FORCE_RESET()    (RCC->APB2RSTR |= (RCC_APB2RSTR_SYSCFGRST))
1013
#define __HAL_RCC_TIM9_FORCE_RESET()      (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM9RST))
995
#define __HAL_RCC_TIM9_FORCE_RESET()      (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM9RST))
1014
#define __HAL_RCC_TIM10_FORCE_RESET()     (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST))
996
#define __HAL_RCC_TIM10_FORCE_RESET()     (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST))
1015
#define __HAL_RCC_TIM11_FORCE_RESET()     (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM11RST))
997
#define __HAL_RCC_TIM11_FORCE_RESET()     (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM11RST))
1016
#define __HAL_RCC_ADC1_FORCE_RESET()      (RCC->APB2RSTR |= (RCC_APB2RSTR_ADC1RST))
998
#define __HAL_RCC_ADC1_FORCE_RESET()      (RCC->APB2RSTR |= (RCC_APB2RSTR_ADC1RST))
Line 1127... Line 1109...
1127
  *         is disabled and the application software has to enable this clock before
1109
  *         is disabled and the application software has to enable this clock before
1128
  *         using it.
1110
  *         using it.
1129
  * @{
1111
  * @{
1130
  */
1112
  */
1131
 
1113
 
1132
#define __HAL_RCC_GPIOA_IS_CLK_ENABLED()       ((RCC->AHBENR & (RCC_AHBENR_GPIOAEN)) != RESET)
1114
#define __HAL_RCC_GPIOA_IS_CLK_ENABLED()       ((RCC->AHBENR & (RCC_AHBENR_GPIOAEN)) != 0U)
1133
#define __HAL_RCC_GPIOB_IS_CLK_ENABLED()       ((RCC->AHBENR & (RCC_AHBENR_GPIOBEN)) != RESET)
1115
#define __HAL_RCC_GPIOB_IS_CLK_ENABLED()       ((RCC->AHBENR & (RCC_AHBENR_GPIOBEN)) != 0U)
1134
#define __HAL_RCC_GPIOC_IS_CLK_ENABLED()       ((RCC->AHBENR & (RCC_AHBENR_GPIOCEN)) != RESET)
1116
#define __HAL_RCC_GPIOC_IS_CLK_ENABLED()       ((RCC->AHBENR & (RCC_AHBENR_GPIOCEN)) != 0U)
1135
#define __HAL_RCC_GPIOD_IS_CLK_ENABLED()       ((RCC->AHBENR & (RCC_AHBENR_GPIODEN)) != RESET)
1117
#define __HAL_RCC_GPIOD_IS_CLK_ENABLED()       ((RCC->AHBENR & (RCC_AHBENR_GPIODEN)) != 0U)
1136
#define __HAL_RCC_GPIOH_IS_CLK_ENABLED()       ((RCC->AHBENR & (RCC_AHBENR_GPIOHEN)) != RESET)
1118
#define __HAL_RCC_GPIOH_IS_CLK_ENABLED()       ((RCC->AHBENR & (RCC_AHBENR_GPIOHEN)) != 0U)
1137
#define __HAL_RCC_CRC_IS_CLK_ENABLED()         ((RCC->AHBENR & (RCC_AHBENR_CRCEN)) != RESET)
1119
#define __HAL_RCC_CRC_IS_CLK_ENABLED()         ((RCC->AHBENR & (RCC_AHBENR_CRCEN)) != 0U)
1138
#define __HAL_RCC_FLITF_IS_CLK_ENABLED()       ((RCC->AHBENR & (RCC_AHBENR_FLITFEN)) != RESET)
1120
#define __HAL_RCC_FLITF_IS_CLK_ENABLED()       ((RCC->AHBENR & (RCC_AHBENR_FLITFEN)) != 0U)
1139
#define __HAL_RCC_DMA1_IS_CLK_ENABLED()        ((RCC->AHBENR & (RCC_AHBENR_DMA1EN)) != RESET)
1121
#define __HAL_RCC_DMA1_IS_CLK_ENABLED()        ((RCC->AHBENR & (RCC_AHBENR_DMA1EN)) != 0U)
1140
#define __HAL_RCC_GPIOA_IS_CLK_DISABLED()      ((RCC->AHBENR & (RCC_AHBENR_GPIOAEN)) == RESET)
1122
#define __HAL_RCC_GPIOA_IS_CLK_DISABLED()      ((RCC->AHBENR & (RCC_AHBENR_GPIOAEN)) == 0U)
1141
#define __HAL_RCC_GPIOB_IS_CLK_DISABLED()      ((RCC->AHBENR & (RCC_AHBENR_GPIOBEN)) == RESET)
1123
#define __HAL_RCC_GPIOB_IS_CLK_DISABLED()      ((RCC->AHBENR & (RCC_AHBENR_GPIOBEN)) == 0U)
1142
#define __HAL_RCC_GPIOC_IS_CLK_DISABLED()      ((RCC->AHBENR & (RCC_AHBENR_GPIOCEN)) == RESET)
1124
#define __HAL_RCC_GPIOC_IS_CLK_DISABLED()      ((RCC->AHBENR & (RCC_AHBENR_GPIOCEN)) == 0U)
1143
#define __HAL_RCC_GPIOD_IS_CLK_DISABLED()      ((RCC->AHBENR & (RCC_AHBENR_GPIODEN)) == RESET)
1125
#define __HAL_RCC_GPIOD_IS_CLK_DISABLED()      ((RCC->AHBENR & (RCC_AHBENR_GPIODEN)) == 0U)
1144
#define __HAL_RCC_GPIOH_IS_CLK_DISABLED()      ((RCC->AHBENR & (RCC_AHBENR_GPIOHEN)) == RESET)
1126
#define __HAL_RCC_GPIOH_IS_CLK_DISABLED()      ((RCC->AHBENR & (RCC_AHBENR_GPIOHEN)) == 0U)
1145
#define __HAL_RCC_CRC_IS_CLK_DISABLED()        ((RCC->AHBENR & (RCC_AHBENR_CRCEN)) == RESET)
1127
#define __HAL_RCC_CRC_IS_CLK_DISABLED()        ((RCC->AHBENR & (RCC_AHBENR_CRCEN)) == 0U)
1146
#define __HAL_RCC_FLITF_IS_CLK_DISABLED()      ((RCC->AHBENR & (RCC_AHBENR_FLITFEN)) == RESET)
1128
#define __HAL_RCC_FLITF_IS_CLK_DISABLED()      ((RCC->AHBENR & (RCC_AHBENR_FLITFEN)) == 0U)
1147
#define __HAL_RCC_DMA1_IS_CLK_DISABLED()       ((RCC->AHBENR & (RCC_AHBENR_DMA1EN)) == RESET)
1129
#define __HAL_RCC_DMA1_IS_CLK_DISABLED()       ((RCC->AHBENR & (RCC_AHBENR_DMA1EN)) == 0U)
1148
 
1130
 
1149
/**
1131
/**
1150
  * @}
1132
  * @}
1151
  */
1133
  */
1152
 
1134
 
Line 1156... Line 1138...
1156
  *         is disabled and the application software has to enable this clock before
1138
  *         is disabled and the application software has to enable this clock before
1157
  *         using it.
1139
  *         using it.
1158
  * @{
1140
  * @{
1159
  */
1141
  */
1160
 
1142
 
1161
#define __HAL_RCC_TIM2_IS_CLK_ENABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET)
1143
#define __HAL_RCC_TIM2_IS_CLK_ENABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != 0U)
1162
#define __HAL_RCC_TIM3_IS_CLK_ENABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET)
1144
#define __HAL_RCC_TIM3_IS_CLK_ENABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != 0U)
1163
#define __HAL_RCC_TIM4_IS_CLK_ENABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET)
1145
#define __HAL_RCC_TIM4_IS_CLK_ENABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != 0U)
1164
#define __HAL_RCC_TIM6_IS_CLK_ENABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET)
1146
#define __HAL_RCC_TIM6_IS_CLK_ENABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != 0U)
1165
#define __HAL_RCC_TIM7_IS_CLK_ENABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET)
1147
#define __HAL_RCC_TIM7_IS_CLK_ENABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != 0U)
1166
#define __HAL_RCC_WWDG_IS_CLK_ENABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_WWDGEN)) != RESET)
1148
#define __HAL_RCC_WWDG_IS_CLK_ENABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_WWDGEN)) != 0U)
1167
#define __HAL_RCC_SPI2_IS_CLK_ENABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_SPI2EN)) != RESET)
1149
#define __HAL_RCC_SPI2_IS_CLK_ENABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_SPI2EN)) != 0U)
1168
#define __HAL_RCC_USART2_IS_CLK_ENABLED()      ((RCC->APB1ENR & (RCC_APB1ENR_USART2EN)) != RESET)
1150
#define __HAL_RCC_USART2_IS_CLK_ENABLED()      ((RCC->APB1ENR & (RCC_APB1ENR_USART2EN)) != 0U)
1169
#define __HAL_RCC_USART3_IS_CLK_ENABLED()      ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) != RESET)
1151
#define __HAL_RCC_USART3_IS_CLK_ENABLED()      ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) != 0U)
1170
#define __HAL_RCC_I2C1_IS_CLK_ENABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_I2C1EN)) != RESET)
1152
#define __HAL_RCC_I2C1_IS_CLK_ENABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_I2C1EN)) != 0U)
1171
#define __HAL_RCC_I2C2_IS_CLK_ENABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_I2C2EN)) != RESET)
1153
#define __HAL_RCC_I2C2_IS_CLK_ENABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_I2C2EN)) != 0U)
1172
#define __HAL_RCC_USB_IS_CLK_ENABLED()         ((RCC->APB1ENR & (RCC_APB1ENR_USBEN)) != RESET)
1154
#define __HAL_RCC_USB_IS_CLK_ENABLED()         ((RCC->APB1ENR & (RCC_APB1ENR_USBEN)) != 0U)
1173
#define __HAL_RCC_PWR_IS_CLK_ENABLED()         ((RCC->APB1ENR & (RCC_APB1ENR_PWREN)) != RESET)
1155
#define __HAL_RCC_PWR_IS_CLK_ENABLED()         ((RCC->APB1ENR & (RCC_APB1ENR_PWREN)) != 0U)
1174
#define __HAL_RCC_DAC_IS_CLK_ENABLED()         ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET)
1156
#define __HAL_RCC_DAC_IS_CLK_ENABLED()         ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != 0U)
1175
#define __HAL_RCC_COMP_IS_CLK_ENABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_COMPEN)) != RESET)
1157
#define __HAL_RCC_COMP_IS_CLK_ENABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_COMPEN)) != 0U)
1176
#define __HAL_RCC_TIM2_IS_CLK_DISABLED()       ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET)
1158
#define __HAL_RCC_TIM2_IS_CLK_DISABLED()       ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == 0U)
1177
#define __HAL_RCC_TIM3_IS_CLK_DISABLED()       ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET)
1159
#define __HAL_RCC_TIM3_IS_CLK_DISABLED()       ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == 0U)
1178
#define __HAL_RCC_TIM4_IS_CLK_DISABLED()       ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET)
1160
#define __HAL_RCC_TIM4_IS_CLK_DISABLED()       ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == 0U)
1179
#define __HAL_RCC_TIM6_IS_CLK_DISABLED()       ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET)
1161
#define __HAL_RCC_TIM6_IS_CLK_DISABLED()       ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == 0U)
1180
#define __HAL_RCC_TIM7_IS_CLK_DISABLED()       ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET)
1162
#define __HAL_RCC_TIM7_IS_CLK_DISABLED()       ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == 0U)
1181
#define __HAL_RCC_WWDG_IS_CLK_DISABLED()       ((RCC->APB1ENR & (RCC_APB1ENR_WWDGEN)) == RESET)
1163
#define __HAL_RCC_WWDG_IS_CLK_DISABLED()       ((RCC->APB1ENR & (RCC_APB1ENR_WWDGEN)) == 0U)
1182
#define __HAL_RCC_SPI2_IS_CLK_DISABLED()       ((RCC->APB1ENR & (RCC_APB1ENR_SPI2EN)) == RESET)
1164
#define __HAL_RCC_SPI2_IS_CLK_DISABLED()       ((RCC->APB1ENR & (RCC_APB1ENR_SPI2EN)) == 0U)
1183
#define __HAL_RCC_USART2_IS_CLK_DISABLED()     ((RCC->APB1ENR & (RCC_APB1ENR_USART2EN)) == RESET)
1165
#define __HAL_RCC_USART2_IS_CLK_DISABLED()     ((RCC->APB1ENR & (RCC_APB1ENR_USART2EN)) == 0U)
1184
#define __HAL_RCC_USART3_IS_CLK_DISABLED()     ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) == RESET)
1166
#define __HAL_RCC_USART3_IS_CLK_DISABLED()     ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) == 0U)
1185
#define __HAL_RCC_I2C1_IS_CLK_DISABLED()       ((RCC->APB1ENR & (RCC_APB1ENR_I2C1EN)) == RESET)
1167
#define __HAL_RCC_I2C1_IS_CLK_DISABLED()       ((RCC->APB1ENR & (RCC_APB1ENR_I2C1EN)) == 0U)
1186
#define __HAL_RCC_I2C2_IS_CLK_DISABLED()       ((RCC->APB1ENR & (RCC_APB1ENR_I2C2EN)) == RESET)
1168
#define __HAL_RCC_I2C2_IS_CLK_DISABLED()       ((RCC->APB1ENR & (RCC_APB1ENR_I2C2EN)) == 0U)
1187
#define __HAL_RCC_USB_IS_CLK_DISABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_USBEN)) == RESET)
1169
#define __HAL_RCC_USB_IS_CLK_DISABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_USBEN)) == 0U)
1188
#define __HAL_RCC_PWR_IS_CLK_DISABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_PWREN)) == RESET)
1170
#define __HAL_RCC_PWR_IS_CLK_DISABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_PWREN)) == 0U)
1189
#define __HAL_RCC_DAC_IS_CLK_DISABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET)
1171
#define __HAL_RCC_DAC_IS_CLK_DISABLED()        ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == 0U)
1190
#define __HAL_RCC_COMP_IS_CLK_DISABLED()       ((RCC->APB1ENR & (RCC_APB1ENR_COMPEN)) == RESET)
1172
#define __HAL_RCC_COMP_IS_CLK_DISABLED()       ((RCC->APB1ENR & (RCC_APB1ENR_COMPEN)) == 0U)
1191
 
1173
 
1192
/**
1174
/**
1193
  * @}
1175
  * @}
1194
  */
1176
  */
1195
 
1177
 
Line 1199... Line 1181...
1199
  *         is disabled and the application software has to enable this clock before
1181
  *         is disabled and the application software has to enable this clock before
1200
  *         using it.
1182
  *         using it.
1201
  * @{
1183
  * @{
1202
  */
1184
  */
1203
 
1185
 
1204
#define __HAL_RCC_SYSCFG_IS_CLK_ENABLED()      ((RCC->APB2ENR & (RCC_APB2ENR_SYSCFGEN)) != RESET)
1186
#define __HAL_RCC_SYSCFG_IS_CLK_ENABLED()      ((RCC->APB2ENR & (RCC_APB2ENR_SYSCFGEN)) != 0U)
1205
#define __HAL_RCC_TIM9_IS_CLK_ENABLED()        ((RCC->APB2ENR & (RCC_APB2ENR_TIM9EN)) != RESET)
1187
#define __HAL_RCC_TIM9_IS_CLK_ENABLED()        ((RCC->APB2ENR & (RCC_APB2ENR_TIM9EN)) != 0U)
1206
#define __HAL_RCC_TIM10_IS_CLK_ENABLED()       ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET)
1188
#define __HAL_RCC_TIM10_IS_CLK_ENABLED()       ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != 0U)
1207
#define __HAL_RCC_TIM11_IS_CLK_ENABLED()       ((RCC->APB2ENR & (RCC_APB2ENR_TIM11EN)) != RESET)
1189
#define __HAL_RCC_TIM11_IS_CLK_ENABLED()       ((RCC->APB2ENR & (RCC_APB2ENR_TIM11EN)) != 0U)
1208
#define __HAL_RCC_ADC1_IS_CLK_ENABLED()        ((RCC->APB2ENR & (RCC_APB2ENR_ADC1EN)) != RESET)
1190
#define __HAL_RCC_ADC1_IS_CLK_ENABLED()        ((RCC->APB2ENR & (RCC_APB2ENR_ADC1EN)) != 0U)
1209
#define __HAL_RCC_SPI1_IS_CLK_ENABLED()        ((RCC->APB2ENR & (RCC_APB2ENR_SPI1EN)) != RESET)
1191
#define __HAL_RCC_SPI1_IS_CLK_ENABLED()        ((RCC->APB2ENR & (RCC_APB2ENR_SPI1EN)) != 0U)
1210
#define __HAL_RCC_USART1_IS_CLK_ENABLED()      ((RCC->APB2ENR & (RCC_APB2ENR_USART1EN)) != RESET)
1192
#define __HAL_RCC_USART1_IS_CLK_ENABLED()      ((RCC->APB2ENR & (RCC_APB2ENR_USART1EN)) != 0U)
1211
#define __HAL_RCC_SYSCFG_IS_CLK_DISABLED()     ((RCC->APB2ENR & (RCC_APB2ENR_SYSCFGEN)) == RESET)
1193
#define __HAL_RCC_SYSCFG_IS_CLK_DISABLED()     ((RCC->APB2ENR & (RCC_APB2ENR_SYSCFGEN)) == 0U)
1212
#define __HAL_RCC_TIM9_IS_CLK_DISABLED()       ((RCC->APB2ENR & (RCC_APB2ENR_TIM9EN)) == RESET)
1194
#define __HAL_RCC_TIM9_IS_CLK_DISABLED()       ((RCC->APB2ENR & (RCC_APB2ENR_TIM9EN)) == 0U)
1213
#define __HAL_RCC_TIM10_IS_CLK_DISABLED()      ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET)
1195
#define __HAL_RCC_TIM10_IS_CLK_DISABLED()      ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == 0U)
1214
#define __HAL_RCC_TIM11_IS_CLK_DISABLED()      ((RCC->APB2ENR & (RCC_APB2ENR_TIM11EN)) == RESET)
1196
#define __HAL_RCC_TIM11_IS_CLK_DISABLED()      ((RCC->APB2ENR & (RCC_APB2ENR_TIM11EN)) == 0U)
1215
#define __HAL_RCC_ADC1_IS_CLK_DISABLED()       ((RCC->APB2ENR & (RCC_APB2ENR_ADC1EN)) == RESET)
1197
#define __HAL_RCC_ADC1_IS_CLK_DISABLED()       ((RCC->APB2ENR & (RCC_APB2ENR_ADC1EN)) == 0U)
1216
#define __HAL_RCC_SPI1_IS_CLK_DISABLED()       ((RCC->APB2ENR & (RCC_APB2ENR_SPI1EN)) == RESET)
1198
#define __HAL_RCC_SPI1_IS_CLK_DISABLED()       ((RCC->APB2ENR & (RCC_APB2ENR_SPI1EN)) == 0U)
1217
#define __HAL_RCC_USART1_IS_CLK_DISABLED()     ((RCC->APB2ENR & (RCC_APB2ENR_USART1EN)) == RESET)
1199
#define __HAL_RCC_USART1_IS_CLK_DISABLED()     ((RCC->APB2ENR & (RCC_APB2ENR_USART1EN)) == 0U)
1218
 
1200
 
1219
/**
1201
/**
1220
  * @}
1202
  * @}
1221
  */
1203
  */
1222
 
1204
 
1223
/** @defgroup RCC_AHB_Clock_Sleep_Enable_Disable_Status AHB Peripheral Clock Sleep Enable Disable Status
1205
/** @defgroup RCC_AHB_Clock_Sleep_Enable_Disable_Status AHB Peripheral Clock Sleep Enable Disable Status
Line 1227... Line 1209...
1227
  * @note   After wakeup from SLEEP mode, the peripheral clock is enabled again.
1209
  * @note   After wakeup from SLEEP mode, the peripheral clock is enabled again.
1228
  * @note   By default, all peripheral clocks are enabled during SLEEP mode.
1210
  * @note   By default, all peripheral clocks are enabled during SLEEP mode.
1229
  * @{
1211
  * @{
1230
  */
1212
  */
1231
 
1213
 
1232
#define __HAL_RCC_GPIOA_IS_CLK_SLEEP_ENABLED()       ((RCC->AHBLPENR & (RCC_AHBLPENR_GPIOALPEN)) != RESET)
1214
#define __HAL_RCC_GPIOA_IS_CLK_SLEEP_ENABLED()       ((RCC->AHBLPENR & (RCC_AHBLPENR_GPIOALPEN)) != 0U)
1233
#define __HAL_RCC_GPIOB_IS_CLK_SLEEP_ENABLED()       ((RCC->AHBLPENR & (RCC_AHBLPENR_GPIOBLPEN)) != RESET)
1215
#define __HAL_RCC_GPIOB_IS_CLK_SLEEP_ENABLED()       ((RCC->AHBLPENR & (RCC_AHBLPENR_GPIOBLPEN)) != 0U)
1234
#define __HAL_RCC_GPIOC_IS_CLK_SLEEP_ENABLED()       ((RCC->AHBLPENR & (RCC_AHBLPENR_GPIOCLPEN)) != RESET)
1216
#define __HAL_RCC_GPIOC_IS_CLK_SLEEP_ENABLED()       ((RCC->AHBLPENR & (RCC_AHBLPENR_GPIOCLPEN)) != 0U)
1235
#define __HAL_RCC_GPIOD_IS_CLK_SLEEP_ENABLED()       ((RCC->AHBLPENR & (RCC_AHBLPENR_GPIODLPEN)) != RESET)
1217
#define __HAL_RCC_GPIOD_IS_CLK_SLEEP_ENABLED()       ((RCC->AHBLPENR & (RCC_AHBLPENR_GPIODLPEN)) != 0U)
1236
#define __HAL_RCC_GPIOH_IS_CLK_SLEEP_ENABLED()       ((RCC->AHBLPENR & (RCC_AHBLPENR_GPIOHLPEN)) != RESET)
1218
#define __HAL_RCC_GPIOH_IS_CLK_SLEEP_ENABLED()       ((RCC->AHBLPENR & (RCC_AHBLPENR_GPIOHLPEN)) != 0U)
1237
#define __HAL_RCC_CRC_IS_CLK_SLEEP_ENABLED()         ((RCC->AHBLPENR & (RCC_AHBLPENR_CRCLPEN)) != RESET)
1219
#define __HAL_RCC_CRC_IS_CLK_SLEEP_ENABLED()         ((RCC->AHBLPENR & (RCC_AHBLPENR_CRCLPEN)) != 0U)
1238
#define __HAL_RCC_FLITF_IS_CLK_SLEEP_ENABLED()       ((RCC->AHBLPENR & (RCC_AHBLPENR_FLITFLPEN)) != RESET)
1220
#define __HAL_RCC_FLITF_IS_CLK_SLEEP_ENABLED()       ((RCC->AHBLPENR & (RCC_AHBLPENR_FLITFLPEN)) != 0U)
1239
#define __HAL_RCC_DMA1_IS_CLK_SLEEP_ENABLED()        ((RCC->AHBLPENR & (RCC_AHBLPENR_DMA1LPEN)) != RESET)
1221
#define __HAL_RCC_DMA1_IS_CLK_SLEEP_ENABLED()        ((RCC->AHBLPENR & (RCC_AHBLPENR_DMA1LPEN)) != 0U)
1240
#define __HAL_RCC_GPIOA_IS_CLK_SLEEP_DISABLED()      ((RCC->AHBLPENR & (RCC_AHBLPENR_GPIOALPEN)) == RESET)
1222
#define __HAL_RCC_GPIOA_IS_CLK_SLEEP_DISABLED()      ((RCC->AHBLPENR & (RCC_AHBLPENR_GPIOALPEN)) == 0U)
1241
#define __HAL_RCC_GPIOB_IS_CLK_SLEEP_DISABLED()      ((RCC->AHBLPENR & (RCC_AHBLPENR_GPIOBLPEN)) == RESET)
1223
#define __HAL_RCC_GPIOB_IS_CLK_SLEEP_DISABLED()      ((RCC->AHBLPENR & (RCC_AHBLPENR_GPIOBLPEN)) == 0U)
1242
#define __HAL_RCC_GPIOC_IS_CLK_SLEEP_DISABLED()      ((RCC->AHBLPENR & (RCC_AHBLPENR_GPIOCLPEN)) == RESET)
1224
#define __HAL_RCC_GPIOC_IS_CLK_SLEEP_DISABLED()      ((RCC->AHBLPENR & (RCC_AHBLPENR_GPIOCLPEN)) == 0U)
1243
#define __HAL_RCC_GPIOD_IS_CLK_SLEEP_DISABLED()      ((RCC->AHBLPENR & (RCC_AHBLPENR_GPIODLPEN)) == RESET)
1225
#define __HAL_RCC_GPIOD_IS_CLK_SLEEP_DISABLED()      ((RCC->AHBLPENR & (RCC_AHBLPENR_GPIODLPEN)) == 0U)
1244
#define __HAL_RCC_GPIOH_IS_CLK_SLEEP_DISABLED()      ((RCC->AHBLPENR & (RCC_AHBLPENR_GPIOHLPEN)) == RESET)
1226
#define __HAL_RCC_GPIOH_IS_CLK_SLEEP_DISABLED()      ((RCC->AHBLPENR & (RCC_AHBLPENR_GPIOHLPEN)) == 0U)
1245
#define __HAL_RCC_CRC_IS_CLK_SLEEP_DISABLED()        ((RCC->AHBLPENR & (RCC_AHBLPENR_CRCLPEN)) == RESET)
1227
#define __HAL_RCC_CRC_IS_CLK_SLEEP_DISABLED()        ((RCC->AHBLPENR & (RCC_AHBLPENR_CRCLPEN)) == 0U)
1246
#define __HAL_RCC_FLITF_IS_CLK_SLEEP_DISABLED()      ((RCC->AHBLPENR & (RCC_AHBLPENR_FLITFLPEN)) == RESET)
1228
#define __HAL_RCC_FLITF_IS_CLK_SLEEP_DISABLED()      ((RCC->AHBLPENR & (RCC_AHBLPENR_FLITFLPEN)) == 0U)
1247
#define __HAL_RCC_DMA1_IS_CLK_SLEEP_DISABLED()       ((RCC->AHBLPENR & (RCC_AHBLPENR_DMA1LPEN)) == RESET)
1229
#define __HAL_RCC_DMA1_IS_CLK_SLEEP_DISABLED()       ((RCC->AHBLPENR & (RCC_AHBLPENR_DMA1LPEN)) == 0U)
1248
 
1230
 
1249
/**
1231
/**
1250
  * @}
1232
  * @}
1251
  */
1233
  */
1252
 
1234
 
Line 1257... Line 1239...
1257
  * @note   After wakeup from SLEEP mode, the peripheral clock is enabled again.
1239
  * @note   After wakeup from SLEEP mode, the peripheral clock is enabled again.
1258
  * @note   By default, all peripheral clocks are enabled during SLEEP mode.
1240
  * @note   By default, all peripheral clocks are enabled during SLEEP mode.
1259
  * @{
1241
  * @{
1260
  */
1242
  */
1261
 
1243
 
1262
#define __HAL_RCC_TIM2_IS_CLK_SLEEP_ENABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM2LPEN)) != RESET)
1244
#define __HAL_RCC_TIM2_IS_CLK_SLEEP_ENABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM2LPEN)) != 0U)
1263
#define __HAL_RCC_TIM3_IS_CLK_SLEEP_ENABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM3LPEN)) != RESET)
1245
#define __HAL_RCC_TIM3_IS_CLK_SLEEP_ENABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM3LPEN)) != 0U)
1264
#define __HAL_RCC_TIM4_IS_CLK_SLEEP_ENABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM4LPEN)) != RESET)
1246
#define __HAL_RCC_TIM4_IS_CLK_SLEEP_ENABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM4LPEN)) != 0U)
1265
#define __HAL_RCC_TIM6_IS_CLK_SLEEP_ENABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM6LPEN)) != RESET)
1247
#define __HAL_RCC_TIM6_IS_CLK_SLEEP_ENABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM6LPEN)) != 0U)
1266
#define __HAL_RCC_TIM7_IS_CLK_SLEEP_ENABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM7LPEN)) != RESET)
1248
#define __HAL_RCC_TIM7_IS_CLK_SLEEP_ENABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM7LPEN)) != 0U)
1267
#define __HAL_RCC_WWDG_IS_CLK_SLEEP_ENABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_WWDGLPEN)) != RESET)
1249
#define __HAL_RCC_WWDG_IS_CLK_SLEEP_ENABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_WWDGLPEN)) != 0U)
1268
#define __HAL_RCC_SPI2_IS_CLK_SLEEP_ENABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_SPI2LPEN)) != RESET)
1250
#define __HAL_RCC_SPI2_IS_CLK_SLEEP_ENABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_SPI2LPEN)) != 0U)
1269
#define __HAL_RCC_USART2_IS_CLK_SLEEP_ENABLED()      ((RCC->APB1LPENR & (RCC_APB1LPENR_USART2LPEN)) != RESET)
1251
#define __HAL_RCC_USART2_IS_CLK_SLEEP_ENABLED()      ((RCC->APB1LPENR & (RCC_APB1LPENR_USART2LPEN)) != 0U)
1270
#define __HAL_RCC_USART3_IS_CLK_SLEEP_ENABLED()      ((RCC->APB1LPENR & (RCC_APB1LPENR_USART3LPEN)) != RESET)
1252
#define __HAL_RCC_USART3_IS_CLK_SLEEP_ENABLED()      ((RCC->APB1LPENR & (RCC_APB1LPENR_USART3LPEN)) != 0U)
1271
#define __HAL_RCC_I2C1_IS_CLK_SLEEP_ENABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C1LPEN)) != RESET)
1253
#define __HAL_RCC_I2C1_IS_CLK_SLEEP_ENABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C1LPEN)) != 0U)
1272
#define __HAL_RCC_I2C2_IS_CLK_SLEEP_ENABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C2LPEN)) != RESET)
1254
#define __HAL_RCC_I2C2_IS_CLK_SLEEP_ENABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C2LPEN)) != 0U)
1273
#define __HAL_RCC_USB_IS_CLK_SLEEP_ENABLED()         ((RCC->APB1LPENR & (RCC_APB1LPENR_USBLPEN)) != RESET)
1255
#define __HAL_RCC_USB_IS_CLK_SLEEP_ENABLED()         ((RCC->APB1LPENR & (RCC_APB1LPENR_USBLPEN)) != 0U)
1274
#define __HAL_RCC_PWR_IS_CLK_SLEEP_ENABLED()         ((RCC->APB1LPENR & (RCC_APB1LPENR_PWRLPEN)) != RESET)
1256
#define __HAL_RCC_PWR_IS_CLK_SLEEP_ENABLED()         ((RCC->APB1LPENR & (RCC_APB1LPENR_PWRLPEN)) != 0U)
1275
#define __HAL_RCC_DAC_IS_CLK_SLEEP_ENABLED()         ((RCC->APB1LPENR & (RCC_APB1LPENR_DACLPEN)) != RESET)
1257
#define __HAL_RCC_DAC_IS_CLK_SLEEP_ENABLED()         ((RCC->APB1LPENR & (RCC_APB1LPENR_DACLPEN)) != 0U)
1276
#define __HAL_RCC_COMP_IS_CLK_SLEEP_ENABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_COMPLPEN)) != RESET)
1258
#define __HAL_RCC_COMP_IS_CLK_SLEEP_ENABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_COMPLPEN)) != 0U)
1277
#define __HAL_RCC_TIM2_IS_CLK_SLEEP_DISABLED()       ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM2LPEN)) == RESET)
1259
#define __HAL_RCC_TIM2_IS_CLK_SLEEP_DISABLED()       ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM2LPEN)) == 0U)
1278
#define __HAL_RCC_TIM3_IS_CLK_SLEEP_DISABLED()       ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM3LPEN)) == RESET)
1260
#define __HAL_RCC_TIM3_IS_CLK_SLEEP_DISABLED()       ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM3LPEN)) == 0U)
1279
#define __HAL_RCC_TIM4_IS_CLK_SLEEP_DISABLED()       ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM4LPEN)) == RESET)
1261
#define __HAL_RCC_TIM4_IS_CLK_SLEEP_DISABLED()       ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM4LPEN)) == 0U)
1280
#define __HAL_RCC_TIM6_IS_CLK_SLEEP_DISABLED()       ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM6LPEN)) == RESET)
1262
#define __HAL_RCC_TIM6_IS_CLK_SLEEP_DISABLED()       ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM6LPEN)) == 0U)
1281
#define __HAL_RCC_TIM7_IS_CLK_SLEEP_DISABLED()       ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM7LPEN)) == RESET)
1263
#define __HAL_RCC_TIM7_IS_CLK_SLEEP_DISABLED()       ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM7LPEN)) == 0U)
1282
#define __HAL_RCC_WWDG_IS_CLK_SLEEP_DISABLED()       ((RCC->APB1LPENR & (RCC_APB1LPENR_WWDGLPEN)) == RESET)
1264
#define __HAL_RCC_WWDG_IS_CLK_SLEEP_DISABLED()       ((RCC->APB1LPENR & (RCC_APB1LPENR_WWDGLPEN)) == 0U)
1283
#define __HAL_RCC_SPI2_IS_CLK_SLEEP_DISABLED()       ((RCC->APB1LPENR & (RCC_APB1LPENR_SPI2LPEN)) == RESET)
1265
#define __HAL_RCC_SPI2_IS_CLK_SLEEP_DISABLED()       ((RCC->APB1LPENR & (RCC_APB1LPENR_SPI2LPEN)) == 0U)
1284
#define __HAL_RCC_USART2_IS_CLK_SLEEP_DISABLED()     ((RCC->APB1LPENR & (RCC_APB1LPENR_USART2LPEN)) == RESET)
1266
#define __HAL_RCC_USART2_IS_CLK_SLEEP_DISABLED()     ((RCC->APB1LPENR & (RCC_APB1LPENR_USART2LPEN)) == 0U)
1285
#define __HAL_RCC_USART3_IS_CLK_SLEEP_DISABLED()     ((RCC->APB1LPENR & (RCC_APB1LPENR_USART3LPEN)) == RESET)
1267
#define __HAL_RCC_USART3_IS_CLK_SLEEP_DISABLED()     ((RCC->APB1LPENR & (RCC_APB1LPENR_USART3LPEN)) == 0U)
1286
#define __HAL_RCC_I2C1_IS_CLK_SLEEP_DISABLED()       ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C1LPEN)) == RESET)
1268
#define __HAL_RCC_I2C1_IS_CLK_SLEEP_DISABLED()       ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C1LPEN)) == 0U)
1287
#define __HAL_RCC_I2C2_IS_CLK_SLEEP_DISABLED()       ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C2LPEN)) == RESET)
1269
#define __HAL_RCC_I2C2_IS_CLK_SLEEP_DISABLED()       ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C2LPEN)) == 0U)
1288
#define __HAL_RCC_USB_IS_CLK_SLEEP_DISABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_USBLPEN)) == RESET)
1270
#define __HAL_RCC_USB_IS_CLK_SLEEP_DISABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_USBLPEN)) == 0U)
1289
#define __HAL_RCC_PWR_IS_CLK_SLEEP_DISABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_PWRLPEN)) == RESET)
1271
#define __HAL_RCC_PWR_IS_CLK_SLEEP_DISABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_PWRLPEN)) == 0U)
1290
#define __HAL_RCC_DAC_IS_CLK_SLEEP_DISABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_DACLPEN)) == RESET)
1272
#define __HAL_RCC_DAC_IS_CLK_SLEEP_DISABLED()        ((RCC->APB1LPENR & (RCC_APB1LPENR_DACLPEN)) == 0U)
1291
#define __HAL_RCC_COMP_IS_CLK_SLEEP_DISABLED()       ((RCC->APB1LPENR & (RCC_APB1LPENR_COMPLPEN)) == RESET)
1273
#define __HAL_RCC_COMP_IS_CLK_SLEEP_DISABLED()       ((RCC->APB1LPENR & (RCC_APB1LPENR_COMPLPEN)) == 0U)
1292
 
1274
 
1293
/**
1275
/**
1294
  * @}
1276
  * @}
1295
  */
1277
  */
1296
 
1278
 
Line 1301... Line 1283...
1301
  * @note   After wakeup from SLEEP mode, the peripheral clock is enabled again.
1283
  * @note   After wakeup from SLEEP mode, the peripheral clock is enabled again.
1302
  * @note   By default, all peripheral clocks are enabled during SLEEP mode.
1284
  * @note   By default, all peripheral clocks are enabled during SLEEP mode.
1303
  * @{
1285
  * @{
1304
  */
1286
  */
1305
 
1287
 
1306
#define __HAL_RCC_SYSCFG_IS_CLK_SLEEP_ENABLED()      ((RCC->APB2LPENR & (RCC_APB2LPENR_SYSCFGLPEN)) != RESET)
1288
#define __HAL_RCC_SYSCFG_IS_CLK_SLEEP_ENABLED()      ((RCC->APB2LPENR & (RCC_APB2LPENR_SYSCFGLPEN)) != 0U)
1307
#define __HAL_RCC_TIM9_IS_CLK_SLEEP_ENABLED()        ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM9LPEN)) != RESET)
1289
#define __HAL_RCC_TIM9_IS_CLK_SLEEP_ENABLED()        ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM9LPEN)) != 0U)
1308
#define __HAL_RCC_TIM10_IS_CLK_SLEEP_ENABLED()       ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM10LPEN)) != RESET)
1290
#define __HAL_RCC_TIM10_IS_CLK_SLEEP_ENABLED()       ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM10LPEN)) != 0U)
1309
#define __HAL_RCC_TIM11_IS_CLK_SLEEP_ENABLED()       ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM11LPEN)) != RESET)
1291
#define __HAL_RCC_TIM11_IS_CLK_SLEEP_ENABLED()       ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM11LPEN)) != 0U)
1310
#define __HAL_RCC_ADC1_IS_CLK_SLEEP_ENABLED()        ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC1LPEN)) != RESET)
1292
#define __HAL_RCC_ADC1_IS_CLK_SLEEP_ENABLED()        ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC1LPEN)) != 0U)
1311
#define __HAL_RCC_SPI1_IS_CLK_SLEEP_ENABLED()        ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI1LPEN)) != RESET)
1293
#define __HAL_RCC_SPI1_IS_CLK_SLEEP_ENABLED()        ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI1LPEN)) != 0U)
1312
#define __HAL_RCC_USART1_IS_CLK_SLEEP_ENABLED()      ((RCC->APB2LPENR & (RCC_APB2LPENR_USART1LPEN)) != RESET)
1294
#define __HAL_RCC_USART1_IS_CLK_SLEEP_ENABLED()      ((RCC->APB2LPENR & (RCC_APB2LPENR_USART1LPEN)) != 0U)
1313
#define __HAL_RCC_SYSCFG_IS_CLK_SLEEP_DISABLED()     ((RCC->APB2LPENR & (RCC_APB2LPENR_SYSCFGLPEN)) == RESET)
1295
#define __HAL_RCC_SYSCFG_IS_CLK_SLEEP_DISABLED()     ((RCC->APB2LPENR & (RCC_APB2LPENR_SYSCFGLPEN)) == 0U)
1314
#define __HAL_RCC_TIM9_IS_CLK_SLEEP_DISABLED()       ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM9LPEN)) == RESET)
1296
#define __HAL_RCC_TIM9_IS_CLK_SLEEP_DISABLED()       ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM9LPEN)) == 0U)
1315
#define __HAL_RCC_TIM10_IS_CLK_SLEEP_DISABLED()      ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM10LPEN)) == RESET)
1297
#define __HAL_RCC_TIM10_IS_CLK_SLEEP_DISABLED()      ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM10LPEN)) == 0U)
1316
#define __HAL_RCC_TIM11_IS_CLK_SLEEP_DISABLED()      ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM11LPEN)) == RESET)
1298
#define __HAL_RCC_TIM11_IS_CLK_SLEEP_DISABLED()      ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM11LPEN)) == 0U)
1317
#define __HAL_RCC_ADC1_IS_CLK_SLEEP_DISABLED()       ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC1LPEN)) == RESET)
1299
#define __HAL_RCC_ADC1_IS_CLK_SLEEP_DISABLED()       ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC1LPEN)) == 0U)
1318
#define __HAL_RCC_SPI1_IS_CLK_SLEEP_DISABLED()       ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI1LPEN)) == RESET)
1300
#define __HAL_RCC_SPI1_IS_CLK_SLEEP_DISABLED()       ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI1LPEN)) == 0U)
1319
#define __HAL_RCC_USART1_IS_CLK_SLEEP_DISABLED()     ((RCC->APB2LPENR & (RCC_APB2LPENR_USART1LPEN)) == RESET)
1301
#define __HAL_RCC_USART1_IS_CLK_SLEEP_DISABLED()     ((RCC->APB2LPENR & (RCC_APB2LPENR_USART1LPEN)) == 0U)
1320
 
1302
 
1321
/**
1303
/**
1322
  * @}
1304
  * @}
1323
  */
1305
  */
1324
 
1306
 
1325
/** @defgroup RCC_HSI_Configuration HSI Configuration
1307
/** @defgroup RCC_HSI_Configuration HSI Configuration
1326
  * @{  
1308
  * @{
1327
  */
1309
  */
1328
 
1310
 
1329
/** @brief  Macros to enable or disable the Internal High Speed oscillator (HSI).
1311
/** @brief  Macros to enable or disable the Internal High Speed oscillator (HSI).
1330
  * @note   The HSI is stopped by hardware when entering STOP and STANDBY modes.
1312
  * @note   The HSI is stopped by hardware when entering STOP and STANDBY modes.
1331
  * @note   HSI can not be stopped if it is used as system clock source. In this case,
1313
  * @note   HSI can not be stopped if it is used as system clock source. In this case,
1332
  *         you have to select another source of the system clock then stop the HSI.  
1314
  *         you have to select another source of the system clock then stop the HSI.
1333
  * @note   After enabling the HSI, the application software should wait on HSIRDY
1315
  * @note   After enabling the HSI, the application software should wait on HSIRDY
1334
  *         flag to be set indicating that HSI clock is stable and can be used as
1316
  *         flag to be set indicating that HSI clock is stable and can be used as
1335
  *         system clock source.  
1317
  *         system clock source.
1336
  * @note   When the HSI is stopped, HSIRDY flag goes low after 6 HSI oscillator
1318
  * @note   When the HSI is stopped, HSIRDY flag goes low after 6 HSI oscillator
1337
  *         clock cycles.  
1319
  *         clock cycles.
1338
  */
1320
  */
1339
#define __HAL_RCC_HSI_ENABLE()  (*(__IO uint32_t *) RCC_CR_HSION_BB = ENABLE)
1321
#define __HAL_RCC_HSI_ENABLE()  (*(__IO uint32_t *) RCC_CR_HSION_BB = ENABLE)
1340
#define __HAL_RCC_HSI_DISABLE() (*(__IO uint32_t *) RCC_CR_HSION_BB = DISABLE)
1322
#define __HAL_RCC_HSI_DISABLE() (*(__IO uint32_t *) RCC_CR_HSION_BB = DISABLE)
1341
 
1323
 
1342
/** @brief  Macro to adjust the Internal High Speed oscillator (HSI) calibration value.
1324
/** @brief  Macro to adjust the Internal High Speed oscillator (HSI) calibration value.
1343
  * @note   The calibration is used to compensate for the variations in voltage
1325
  * @note   The calibration is used to compensate for the variations in voltage
1344
  *         and temperature that influence the frequency of the internal HSI RC.
1326
  *         and temperature that influence the frequency of the internal HSI RC.
1345
  * @param  _HSICALIBRATIONVALUE_ specifies the calibration trimming value.
1327
  * @param  _HSICALIBRATIONVALUE_ specifies the calibration trimming value.
1346
  *         (default is RCC_HSICALIBRATION_DEFAULT).
1328
  *         (default is RCC_HSICALIBRATION_DEFAULT).
1347
  *         This parameter must be a number between 0 and 0x1F.
1329
  *         This parameter must be a number between 0 and 0x1F.
1348
  */  
1330
  */
1349
#define __HAL_RCC_HSI_CALIBRATIONVALUE_ADJUST(_HSICALIBRATIONVALUE_) \
1331
#define __HAL_RCC_HSI_CALIBRATIONVALUE_ADJUST(_HSICALIBRATIONVALUE_) \
1350
          (MODIFY_REG(RCC->ICSCR, RCC_ICSCR_HSITRIM, (uint32_t)(_HSICALIBRATIONVALUE_) << POSITION_VAL(RCC_ICSCR_HSITRIM)))
1332
          (MODIFY_REG(RCC->ICSCR, RCC_ICSCR_HSITRIM, (uint32_t)(_HSICALIBRATIONVALUE_) << RCC_ICSCR_HSITRIM_Pos))
1351
 
1333
 
1352
/**
1334
/**
1353
  * @}
1335
  * @}
1354
  */
1336
  */
1355
 
1337
 
1356
/** @defgroup RCC_LSI_Configuration  LSI Configuration
1338
/** @defgroup RCC_LSI_Configuration  LSI Configuration
1357
  * @{  
1339
  * @{
1358
  */
1340
  */
1359
 
1341
 
1360
/** @brief Macro to enable the Internal Low Speed oscillator (LSI).
1342
/** @brief Macro to enable the Internal Low Speed oscillator (LSI).
1361
  * @note   After enabling the LSI, the application software should wait on
1343
  * @note   After enabling the LSI, the application software should wait on
1362
  *         LSIRDY flag to be set indicating that LSI clock is stable and can
1344
  *         LSIRDY flag to be set indicating that LSI clock is stable and can
1363
  *         be used to clock the IWDG and/or the RTC.
1345
  *         be used to clock the IWDG and/or the RTC.
1364
  */
1346
  */
1365
#define __HAL_RCC_LSI_ENABLE()  (*(__IO uint32_t *) RCC_CSR_LSION_BB = ENABLE)
1347
#define __HAL_RCC_LSI_ENABLE()  (*(__IO uint32_t *) RCC_CSR_LSION_BB = ENABLE)
1366
 
1348
 
1367
/** @brief Macro to disable the Internal Low Speed oscillator (LSI).
1349
/** @brief Macro to disable the Internal Low Speed oscillator (LSI).
1368
  * @note   LSI can not be disabled if the IWDG is running.  
1350
  * @note   LSI can not be disabled if the IWDG is running.
1369
  * @note   When the LSI is stopped, LSIRDY flag goes low after 6 LSI oscillator
1351
  * @note   When the LSI is stopped, LSIRDY flag goes low after 6 LSI oscillator
1370
  *         clock cycles.
1352
  *         clock cycles.
1371
  */
1353
  */
1372
#define __HAL_RCC_LSI_DISABLE() (*(__IO uint32_t *) RCC_CSR_LSION_BB = DISABLE)
1354
#define __HAL_RCC_LSI_DISABLE() (*(__IO uint32_t *) RCC_CSR_LSION_BB = DISABLE)
1373
 
1355
 
1374
/**
1356
/**
1375
  * @}
1357
  * @}
1376
  */
1358
  */
1377
 
1359
 
1378
/** @defgroup RCC_HSE_Configuration HSE Configuration
1360
/** @defgroup RCC_HSE_Configuration HSE Configuration
1379
  * @{  
1361
  * @{
1380
  */
1362
  */
1381
 
1363
 
1382
/**
1364
/**
1383
  * @brief  Macro to configure the External High Speed oscillator (HSE).
1365
  * @brief  Macro to configure the External High Speed oscillator (HSE).
1384
  * @note   Transition HSE Bypass to HSE On and HSE On to HSE Bypass are not
1366
  * @note   Transition HSE Bypass to HSE On and HSE On to HSE Bypass are not
Line 1420... Line 1402...
1420
                      else                                                  \
1402
                      else                                                  \
1421
                      {                                                     \
1403
                      {                                                     \
1422
                        CLEAR_BIT(RCC->CR, RCC_CR_HSEON);                   \
1404
                        CLEAR_BIT(RCC->CR, RCC_CR_HSEON);                   \
1423
                        CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP);                  \
1405
                        CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP);                  \
1424
                      }                                                     \
1406
                      }                                                     \
1425
                    }while(0)
1407
                    }while(0U)
1426
 
1408
 
1427
/**
1409
/**
1428
  * @}
1410
  * @}
1429
  */
1411
  */
1430
 
1412
 
1431
/** @defgroup RCC_LSE_Configuration LSE Configuration
1413
/** @defgroup RCC_LSE_Configuration LSE Configuration
1432
  * @{  
1414
  * @{
1433
  */
1415
  */
1434
 
1416
 
1435
/**
1417
/**
1436
  * @brief  Macro to configure the External Low Speed oscillator (LSE).
1418
  * @brief  Macro to configure the External Low Speed oscillator (LSE).
1437
  * @note Transitions LSE Bypass to LSE On and LSE On to LSE Bypass are not supported by this macro.
1419
  * @note Transitions LSE Bypass to LSE On and LSE On to LSE Bypass are not supported by this macro.
1438
  * @note   As the LSE is in the Backup domain and write access is denied to
1420
  * @note   As the LSE is in the Backup domain and write access is denied to
1439
  *         this domain after reset, you have to enable write access using
1421
  *         this domain after reset, you have to enable write access using
1440
  *         @ref HAL_PWR_EnableBkUpAccess() function before to configure the LSE
1422
  *         @ref HAL_PWR_EnableBkUpAccess() function before to configure the LSE
1441
  *         (to be done once after reset).  
1423
  *         (to be done once after reset).
1442
  * @note   After enabling the LSE (RCC_LSE_ON or RCC_LSE_BYPASS), the application
1424
  * @note   After enabling the LSE (RCC_LSE_ON or RCC_LSE_BYPASS), the application
1443
  *         software should wait on LSERDY flag to be set indicating that LSE clock
1425
  *         software should wait on LSERDY flag to be set indicating that LSE clock
1444
  *         is stable and can be used to clock the RTC.
1426
  *         is stable and can be used to clock the RTC.
1445
  * @param  __STATE__ specifies the new state of the LSE.
1427
  * @param  __STATE__ specifies the new state of the LSE.
1446
  *         This parameter can be one of the following values:
1428
  *         This parameter can be one of the following values:
Line 1468... Line 1450...
1468
                      else                                                  \
1450
                      else                                                  \
1469
                      {                                                     \
1451
                      {                                                     \
1470
                        CLEAR_BIT(RCC->CSR, RCC_CSR_LSEON);                 \
1452
                        CLEAR_BIT(RCC->CSR, RCC_CSR_LSEON);                 \
1471
                        CLEAR_BIT(RCC->CSR, RCC_CSR_LSEBYP);                \
1453
                        CLEAR_BIT(RCC->CSR, RCC_CSR_LSEBYP);                \
1472
                      }                                                     \
1454
                      }                                                     \
1473
                    }while(0)
1455
                    }while(0U)
1474
 
1456
 
1475
/**
1457
/**
1476
  * @}
1458
  * @}
1477
  */
1459
  */
1478
 
1460
 
1479
/** @defgroup RCC_MSI_Configuration  MSI Configuration
1461
/** @defgroup RCC_MSI_Configuration  MSI Configuration
1480
  * @{  
1462
  * @{
1481
  */
1463
  */
1482
 
1464
 
1483
/** @brief  Macro to enable Internal Multi Speed oscillator (MSI).
1465
/** @brief  Macro to enable Internal Multi Speed oscillator (MSI).
1484
  * @note   After enabling the MSI, the application software should wait on MSIRDY
1466
  * @note   After enabling the MSI, the application software should wait on MSIRDY
1485
  *         flag to be set indicating that MSI clock is stable and can be used as
1467
  *         flag to be set indicating that MSI clock is stable and can be used as
1486
  *         system clock source.  
1468
  *         system clock source.
1487
  */
1469
  */
1488
#define __HAL_RCC_MSI_ENABLE()  (*(__IO uint32_t *) RCC_CR_MSION_BB = ENABLE)
1470
#define __HAL_RCC_MSI_ENABLE()  (*(__IO uint32_t *) RCC_CR_MSION_BB = ENABLE)
1489
                                       
-
 
-
 
1471
 
1490
/** @brief  Macro to disable the Internal Multi Speed oscillator (MSI).
1472
/** @brief  Macro to disable the Internal Multi Speed oscillator (MSI).
1491
  * @note   The MSI is stopped by hardware when entering STOP and STANDBY modes.
1473
  * @note   The MSI is stopped by hardware when entering STOP and STANDBY modes.
1492
  *         It is used (enabled by hardware) as system clock source after startup
1474
  *         It is used (enabled by hardware) as system clock source after startup
1493
  *         from Reset, wakeup from STOP and STANDBY mode, or in case of failure
1475
  *         from Reset, wakeup from STOP and STANDBY mode, or in case of failure
1494
  *         of the HSE used directly or indirectly as system clock (if the Clock
1476
  *         of the HSE used directly or indirectly as system clock (if the Clock
1495
  *         Security System CSS is enabled).            
1477
  *         Security System CSS is enabled).
1496
  * @note   MSI can not be stopped if it is used as system clock source. In this case,
1478
  * @note   MSI can not be stopped if it is used as system clock source. In this case,
1497
  *         you have to select another source of the system clock then stop the MSI.  
1479
  *         you have to select another source of the system clock then stop the MSI.
1498
  * @note   When the MSI is stopped, MSIRDY flag goes low after 6 MSI oscillator
1480
  * @note   When the MSI is stopped, MSIRDY flag goes low after 6 MSI oscillator
1499
  *         clock cycles.  
1481
  *         clock cycles.
1500
  */
1482
  */
1501
#define __HAL_RCC_MSI_DISABLE() (*(__IO uint32_t *) RCC_CR_MSION_BB = DISABLE)
1483
#define __HAL_RCC_MSI_DISABLE() (*(__IO uint32_t *) RCC_CR_MSION_BB = DISABLE)
1502
 
1484
 
1503
/** @brief  Macro adjusts Internal Multi Speed oscillator (MSI) calibration value.
1485
/** @brief  Macro adjusts Internal Multi Speed oscillator (MSI) calibration value.
1504
  * @note   The calibration is used to compensate for the variations in voltage
1486
  * @note   The calibration is used to compensate for the variations in voltage
1505
  *         and temperature that influence the frequency of the internal MSI RC.
1487
  *         and temperature that influence the frequency of the internal MSI RC.
1506
  * @param  _MSICALIBRATIONVALUE_ specifies the calibration trimming value.
1488
  * @param  _MSICALIBRATIONVALUE_ specifies the calibration trimming value.
1507
  *         (default is RCC_MSICALIBRATION_DEFAULT).
1489
  *         (default is RCC_MSICALIBRATION_DEFAULT).
1508
  *         This parameter must be a number between 0 and 0xFF.
1490
  *         This parameter must be a number between 0 and 0xFF.
1509
  */  
1491
  */
1510
#define __HAL_RCC_MSI_CALIBRATIONVALUE_ADJUST(_MSICALIBRATIONVALUE_) \
1492
#define __HAL_RCC_MSI_CALIBRATIONVALUE_ADJUST(_MSICALIBRATIONVALUE_) \
1511
          (MODIFY_REG(RCC->ICSCR, RCC_ICSCR_MSITRIM, (uint32_t)(_MSICALIBRATIONVALUE_) << POSITION_VAL(RCC_ICSCR_MSITRIM)))
1493
          (MODIFY_REG(RCC->ICSCR, RCC_ICSCR_MSITRIM, (uint32_t)(_MSICALIBRATIONVALUE_) << RCC_ICSCR_MSITRIM_Pos))
1512
         
1494
 
1513
/* @brief  Macro to configures the Internal Multi Speed oscillator (MSI) clock range.
1495
/* @brief  Macro to configures the Internal Multi Speed oscillator (MSI) clock range.
1514
  * @note     After restart from Reset or wakeup from STANDBY, the MSI clock is
1496
  * @note     After restart from Reset or wakeup from STANDBY, the MSI clock is
1515
  *           around 2.097 MHz. The MSI clock does not change after wake-up from
1497
  *           around 2.097 MHz. The MSI clock does not change after wake-up from
1516
  *           STOP mode.
1498
  *           STOP mode.
1517
  * @note    The MSI clock range can be modified on the fly.    
1499
  * @note    The MSI clock range can be modified on the fly.
1518
  * @param  _MSIRANGEVALUE_ specifies the MSI Clock range.
1500
  * @param  _MSIRANGEVALUE_ specifies the MSI Clock range.
1519
  *   This parameter must be one of the following values:
1501
  *   This parameter must be one of the following values:
1520
  *     @arg @ref RCC_MSIRANGE_0 MSI clock is around 65.536 KHz
1502
  *     @arg @ref RCC_MSIRANGE_0 MSI clock is around 65.536 KHz
1521
  *     @arg @ref RCC_MSIRANGE_1 MSI clock is around 131.072 KHz
1503
  *     @arg @ref RCC_MSIRANGE_1 MSI clock is around 131.072 KHz
1522
  *     @arg @ref RCC_MSIRANGE_2 MSI clock is around 262.144 KHz
1504
  *     @arg @ref RCC_MSIRANGE_2 MSI clock is around 262.144 KHz
1523
  *     @arg @ref RCC_MSIRANGE_3 MSI clock is around 524.288 KHz
1505
  *     @arg @ref RCC_MSIRANGE_3 MSI clock is around 524.288 KHz
1524
  *     @arg @ref RCC_MSIRANGE_4 MSI clock is around 1.048 MHz
1506
  *     @arg @ref RCC_MSIRANGE_4 MSI clock is around 1.048 MHz
1525
  *     @arg @ref RCC_MSIRANGE_5 MSI clock is around 2.097 MHz (default after Reset or wake-up from STANDBY)
1507
  *     @arg @ref RCC_MSIRANGE_5 MSI clock is around 2.097 MHz (default after Reset or wake-up from STANDBY)
1526
  *     @arg @ref RCC_MSIRANGE_6 MSI clock is around 4.194 MHz
1508
  *     @arg @ref RCC_MSIRANGE_6 MSI clock is around 4.194 MHz
1527
  */  
1509
  */
1528
#define __HAL_RCC_MSI_RANGE_CONFIG(_MSIRANGEVALUE_) (MODIFY_REG(RCC->ICSCR, \
1510
#define __HAL_RCC_MSI_RANGE_CONFIG(_MSIRANGEVALUE_) (MODIFY_REG(RCC->ICSCR, \
1529
          RCC_ICSCR_MSIRANGE, (uint32_t)(_MSIRANGEVALUE_)))
1511
          RCC_ICSCR_MSIRANGE, (uint32_t)(_MSIRANGEVALUE_)))
1530
 
1512
 
1531
/** @brief  Macro to get the Internal Multi Speed oscillator (MSI) clock range in run mode
1513
/** @brief  Macro to get the Internal Multi Speed oscillator (MSI) clock range in run mode
1532
  * @retval MSI clock range.
1514
  * @retval MSI clock range.
Line 1544... Line 1526...
1544
/**
1526
/**
1545
  * @}
1527
  * @}
1546
  */
1528
  */
1547
 
1529
 
1548
/** @defgroup RCC_PLL_Configuration PLL Configuration
1530
/** @defgroup RCC_PLL_Configuration PLL Configuration
1549
  * @{  
1531
  * @{
1550
  */
1532
  */
1551
 
1533
 
1552
/** @brief Macro to enable the main PLL.
1534
/** @brief Macro to enable the main PLL.
1553
  * @note   After enabling the main PLL, the application software should wait on
1535
  * @note   After enabling the main PLL, the application software should wait on
1554
  *         PLLRDY flag to be set indicating that PLL clock is stable and can
1536
  *         PLLRDY flag to be set indicating that PLL clock is stable and can
1555
  *         be used as system clock source.
1537
  *         be used as system clock source.
1556
  * @note   The main PLL is disabled by hardware when entering STOP and STANDBY modes.
1538
  * @note   The main PLL is disabled by hardware when entering STOP and STANDBY modes.
1557
  */
1539
  */
1558
#define __HAL_RCC_PLL_ENABLE()          (*(__IO uint32_t *) RCC_CR_PLLON_BB = ENABLE)
1540
#define __HAL_RCC_PLL_ENABLE()          (*(__IO uint32_t *) RCC_CR_PLLON_BB = ENABLE)
Line 1562... Line 1544...
1562
  */
1544
  */
1563
#define __HAL_RCC_PLL_DISABLE()         (*(__IO uint32_t *) RCC_CR_PLLON_BB = DISABLE)
1545
#define __HAL_RCC_PLL_DISABLE()         (*(__IO uint32_t *) RCC_CR_PLLON_BB = DISABLE)
1564
 
1546
 
1565
/** @brief Macro to configure the main PLL clock source, multiplication and division factors.
1547
/** @brief Macro to configure the main PLL clock source, multiplication and division factors.
1566
  * @note   This function must be used only when the main PLL is disabled.
1548
  * @note   This function must be used only when the main PLL is disabled.
1567
  *  
1549
  *
1568
  * @param  __RCC_PLLSOURCE__ specifies the PLL entry clock source.
1550
  * @param  __RCC_PLLSOURCE__ specifies the PLL entry clock source.
1569
  *          This parameter can be one of the following values:
1551
  *          This parameter can be one of the following values:
1570
  *            @arg @ref RCC_PLLSOURCE_HSI HSI oscillator clock selected as PLL clock entry
1552
  *            @arg @ref RCC_PLLSOURCE_HSI HSI oscillator clock selected as PLL clock entry
1571
  *            @arg @ref RCC_PLLSOURCE_HSE HSE oscillator clock selected as PLL clock entry
1553
  *            @arg @ref RCC_PLLSOURCE_HSE HSE oscillator clock selected as PLL clock entry
1572
  * @param  __PLLMUL__ specifies the multiplication factor for PLL VCO output clock
1554
  * @param  __PLLMUL__ specifies the multiplication factor for PLL VCO output clock
Line 1587... Line 1569...
1587
  * @param  __PLLDIV__ specifies the division factor for PLL VCO input clock
1569
  * @param  __PLLDIV__ specifies the division factor for PLL VCO input clock
1588
  *          This parameter can be one of the following values:
1570
  *          This parameter can be one of the following values:
1589
  *             @arg @ref RCC_PLL_DIV2 PLL clock output = PLLVCO / 2
1571
  *             @arg @ref RCC_PLL_DIV2 PLL clock output = PLLVCO / 2
1590
  *             @arg @ref RCC_PLL_DIV3 PLL clock output = PLLVCO / 3
1572
  *             @arg @ref RCC_PLL_DIV3 PLL clock output = PLLVCO / 3
1591
  *             @arg @ref RCC_PLL_DIV4 PLL clock output = PLLVCO / 4
1573
  *             @arg @ref RCC_PLL_DIV4 PLL clock output = PLLVCO / 4
1592
  *  
1574
  *
1593
  */
1575
  */
1594
#define __HAL_RCC_PLL_CONFIG(__RCC_PLLSOURCE__, __PLLMUL__, __PLLDIV__)\
1576
#define __HAL_RCC_PLL_CONFIG(__RCC_PLLSOURCE__, __PLLMUL__, __PLLDIV__)\
1595
          MODIFY_REG(RCC->CFGR, (RCC_CFGR_PLLSRC|RCC_CFGR_PLLMUL|RCC_CFGR_PLLDIV),((__RCC_PLLSOURCE__) | (__PLLMUL__) | (__PLLDIV__)))
1577
          MODIFY_REG(RCC->CFGR, (RCC_CFGR_PLLSRC|RCC_CFGR_PLLMUL|RCC_CFGR_PLLDIV),((__RCC_PLLSOURCE__) | (__PLLMUL__) | (__PLLDIV__)))
1596
 
1578
 
1597
/** @brief  Get oscillator clock selected as PLL input clock
1579
/** @brief  Get oscillator clock selected as PLL input clock
Line 1605... Line 1587...
1605
/**
1587
/**
1606
  * @}
1588
  * @}
1607
  */
1589
  */
1608
 
1590
 
1609
/** @defgroup RCC_Get_Clock_source Get Clock source
1591
/** @defgroup RCC_Get_Clock_source Get Clock source
1610
  * @{  
1592
  * @{
1611
  */
1593
  */
1612
 
1594
 
1613
/**
1595
/**
1614
  * @brief  Macro to configure the system clock source.
1596
  * @brief  Macro to configure the system clock source.
1615
  * @param  __SYSCLKSOURCE__ specifies the system clock source.
1597
  * @param  __SYSCLKSOURCE__ specifies the system clock source.
Line 1635... Line 1617...
1635
/**
1617
/**
1636
  * @}
1618
  * @}
1637
  */
1619
  */
1638
 
1620
 
1639
/** @defgroup RCCEx_MCOx_Clock_Config RCC Extended MCOx Clock Config
1621
/** @defgroup RCCEx_MCOx_Clock_Config RCC Extended MCOx Clock Config
1640
  * @{  
1622
  * @{
1641
  */
1623
  */
1642
 
1624
 
1643
/** @brief  Macro to configure the MCO clock.
1625
/** @brief  Macro to configure the MCO clock.
1644
  * @param  __MCOCLKSOURCE__ specifies the MCO clock source.
1626
  * @param  __MCOCLKSOURCE__ specifies the MCO clock source.
1645
  *          This parameter can be one of the following values:
1627
  *          This parameter can be one of the following values:
1646
  *            @arg @ref RCC_MCO1SOURCE_NOCLOCK      No clock selected as MCO clock
1628
  *            @arg @ref RCC_MCO1SOURCE_NOCLOCK      No clock selected as MCO clock
1647
  *            @arg @ref RCC_MCO1SOURCE_SYSCLK       System Clock selected as MCO clock
1629
  *            @arg @ref RCC_MCO1SOURCE_SYSCLK       System Clock selected as MCO clock
1648
  *            @arg @ref RCC_MCO1SOURCE_HSI          HSI oscillator clock selected as MCO clock
1630
  *            @arg @ref RCC_MCO1SOURCE_HSI          HSI oscillator clock selected as MCO clock
1649
  *            @arg @ref RCC_MCO1SOURCE_MSI          MSI oscillator clock selected as MCO clock
1631
  *            @arg @ref RCC_MCO1SOURCE_MSI          MSI oscillator clock selected as MCO clock
1650
  *            @arg @ref RCC_MCO1SOURCE_HSE HSE oscillator clock selected as MCO clock
1632
  *            @arg @ref RCC_MCO1SOURCE_HSE HSE oscillator clock selected as MCO clock
1651
  *            @arg @ref RCC_MCO1SOURCE_PLLCLK       PLL clock selected as MCO clock
1633
  *            @arg @ref RCC_MCO1SOURCE_PLLCLK       PLL clock selected as MCO clock
1652
  *            @arg @ref RCC_MCO1SOURCE_LSI          LSI clock selected as MCO clock
1634
  *            @arg @ref RCC_MCO1SOURCE_LSI          LSI clock selected as MCO clock
1653
  *            @arg @ref RCC_MCO1SOURCE_LSE          LSE clock selected as MCO clock
1635
  *            @arg @ref RCC_MCO1SOURCE_LSE          LSE clock selected as MCO clock
1654
  * @param  __MCODIV__ specifies the MCO clock prescaler.
1636
  * @param  __MCODIV__ specifies the MCO clock prescaler.
Line 1665... Line 1647...
1665
/**
1647
/**
1666
  * @}
1648
  * @}
1667
  */
1649
  */
1668
 
1650
 
1669
  /** @defgroup RCC_RTC_Clock_Configuration RCC RTC Clock Configuration
1651
  /** @defgroup RCC_RTC_Clock_Configuration RCC RTC Clock Configuration
1670
  * @{  
1652
  * @{
1671
  */
1653
  */
1672
 
1654
 
1673
/** @brief Macro to configure the RTC clock (RTCCLK).
1655
/** @brief Macro to configure the RTC clock (RTCCLK).
1674
  * @note   As the RTC clock configuration bits are in the Backup domain and write
1656
  * @note   As the RTC clock configuration bits are in the Backup domain and write
1675
  *         access is denied to this domain after reset, you have to enable write
1657
  *         access is denied to this domain after reset, you have to enable write
1676
  *         access using the Power Backup Access macro before to configure
1658
  *         access using the Power Backup Access macro before to configure
1677
  *         the RTC clock source (to be done once after reset).    
1659
  *         the RTC clock source (to be done once after reset).
1678
  * @note   Once the RTC clock is configured it cannot be changed unless the  
1660
  * @note   Once the RTC clock is configured it cannot be changed unless the
1679
  *         Backup domain is reset using @ref __HAL_RCC_BACKUPRESET_FORCE() macro, or by
1661
  *         Backup domain is reset using @ref __HAL_RCC_BACKUPRESET_FORCE() macro, or by
1680
  *         a Power On Reset (POR).
1662
  *         a Power On Reset (POR).
1681
  * @note   RTC prescaler cannot be modified if HSE is enabled (HSEON = 1).
1663
  * @note   RTC prescaler cannot be modified if HSE is enabled (HSEON = 1).
1682
  *
1664
  *
1683
  * @param  __RTC_CLKSOURCE__ specifies the RTC clock source.
1665
  * @param  __RTC_CLKSOURCE__ specifies the RTC clock source.
Line 1690... Line 1672...
1690
  *             @arg @ref RCC_RTCCLKSOURCE_HSE_DIV8 HSE divided by 8 selected as RTC clock
1672
  *             @arg @ref RCC_RTCCLKSOURCE_HSE_DIV8 HSE divided by 8 selected as RTC clock
1691
  *             @arg @ref RCC_RTCCLKSOURCE_HSE_DIV16 HSE divided by 16 selected as RTC clock
1673
  *             @arg @ref RCC_RTCCLKSOURCE_HSE_DIV16 HSE divided by 16 selected as RTC clock
1692
  * @note   If the LSE or LSI is used as RTC clock source, the RTC continues to
1674
  * @note   If the LSE or LSI is used as RTC clock source, the RTC continues to
1693
  *         work in STOP and STANDBY modes, and can be used as wakeup source.
1675
  *         work in STOP and STANDBY modes, and can be used as wakeup source.
1694
  *         However, when the HSE clock is used as RTC clock source, the RTC
1676
  *         However, when the HSE clock is used as RTC clock source, the RTC
1695
  *         cannot be used in STOP and STANDBY modes.    
1677
  *         cannot be used in STOP and STANDBY modes.
1696
  * @note   The maximum input clock frequency for RTC is 1MHz (when using HSE as
1678
  * @note   The maximum input clock frequency for RTC is 1MHz (when using HSE as
1697
  *         RTC clock source).
1679
  *         RTC clock source).
1698
  */
1680
  */
1699
#define __HAL_RCC_RTC_CLKPRESCALER(__RTC_CLKSOURCE__) do { \
1681
#define __HAL_RCC_RTC_CLKPRESCALER(__RTC_CLKSOURCE__) do { \
1700
            if(((__RTC_CLKSOURCE__) & RCC_CSR_RTCSEL_HSE) == RCC_CSR_RTCSEL_HSE)          \
1682
            if(((__RTC_CLKSOURCE__) & RCC_CSR_RTCSEL_HSE) == RCC_CSR_RTCSEL_HSE)          \
1701
            {                                                                             \
1683
            {                                                                             \
1702
              MODIFY_REG(RCC->CR, RCC_CR_RTCPRE, ((__RTC_CLKSOURCE__) & RCC_CR_RTCPRE));  \
1684
              MODIFY_REG(RCC->CR, RCC_CR_RTCPRE, ((__RTC_CLKSOURCE__) & RCC_CR_RTCPRE));  \
1703
            }                                                                             \
1685
            }                                                                             \
1704
          } while (0)
1686
          } while (0U)
1705
 
1687
 
1706
#define __HAL_RCC_RTC_CONFIG(__RTC_CLKSOURCE__) do { \
1688
#define __HAL_RCC_RTC_CONFIG(__RTC_CLKSOURCE__) do { \
1707
                                      __HAL_RCC_RTC_CLKPRESCALER(__RTC_CLKSOURCE__);      \
1689
                                      __HAL_RCC_RTC_CLKPRESCALER(__RTC_CLKSOURCE__);      \
1708
                                      RCC->CSR |= ((__RTC_CLKSOURCE__) & RCC_CSR_RTCSEL); \
1690
                                      RCC->CSR |= ((__RTC_CLKSOURCE__) & RCC_CSR_RTCSEL); \
1709
                                    } while (0)
1691
                                    } while (0U)
1710
                                                   
-
 
-
 
1692
 
1711
/** @brief Macro to get the RTC clock source.
1693
/** @brief Macro to get the RTC clock source.
1712
  * @retval The clock source can be one of the following values:
1694
  * @retval The clock source can be one of the following values:
1713
  *            @arg @ref RCC_RTCCLKSOURCE_NO_CLK No clock selected as RTC clock
1695
  *            @arg @ref RCC_RTCCLKSOURCE_NO_CLK No clock selected as RTC clock
1714
  *            @arg @ref RCC_RTCCLKSOURCE_LSE LSE selected as RTC clock
1696
  *            @arg @ref RCC_RTCCLKSOURCE_LSE LSE selected as RTC clock
1715
  *            @arg @ref RCC_RTCCLKSOURCE_LSI LSI selected as RTC clock
1697
  *            @arg @ref RCC_RTCCLKSOURCE_LSI LSI selected as RTC clock
Line 1725... Line 1707...
1725
  *         @arg @ref RCC_RTC_HSE_DIV_4  HSE divided by 4 selected as RTC clock
1707
  *         @arg @ref RCC_RTC_HSE_DIV_4  HSE divided by 4 selected as RTC clock
1726
  *         @arg @ref RCC_RTC_HSE_DIV_8  HSE divided by 8 selected as RTC clock
1708
  *         @arg @ref RCC_RTC_HSE_DIV_8  HSE divided by 8 selected as RTC clock
1727
  *         @arg @ref RCC_RTC_HSE_DIV_16 HSE divided by 16 selected as RTC clock
1709
  *         @arg @ref RCC_RTC_HSE_DIV_16 HSE divided by 16 selected as RTC clock
1728
  *
1710
  *
1729
  */
1711
  */
1730
#define  __HAL_RCC_GET_RTC_HSE_PRESCALER() ((uint32_t)(READ_BIT(RCC->CR, RCC_CR_RTCPRE)))                                                   
1712
#define  __HAL_RCC_GET_RTC_HSE_PRESCALER() ((uint32_t)(READ_BIT(RCC->CR, RCC_CR_RTCPRE)))
1731
 
1713
 
1732
/** @brief Macro to enable the the RTC clock.
1714
/** @brief Macro to enable the the RTC clock.
1733
  * @note   These macros must be used only after the RTC clock source was selected.
1715
  * @note   These macros must be used only after the RTC clock source was selected.
1734
  */
1716
  */
1735
#define __HAL_RCC_RTC_ENABLE()          (*(__IO uint32_t *) RCC_CSR_RTCEN_BB = ENABLE)
1717
#define __HAL_RCC_RTC_ENABLE()          (*(__IO uint32_t *) RCC_CSR_RTCEN_BB = ENABLE)
Line 1740... Line 1722...
1740
#define __HAL_RCC_RTC_DISABLE()         (*(__IO uint32_t *) RCC_CSR_RTCEN_BB = DISABLE)
1722
#define __HAL_RCC_RTC_DISABLE()         (*(__IO uint32_t *) RCC_CSR_RTCEN_BB = DISABLE)
1741
 
1723
 
1742
/** @brief  Macro to force the Backup domain reset.
1724
/** @brief  Macro to force the Backup domain reset.
1743
  * @note   This function resets the RTC peripheral (including the backup registers)
1725
  * @note   This function resets the RTC peripheral (including the backup registers)
1744
  *         and the RTC clock source selection in RCC_CSR register.
1726
  *         and the RTC clock source selection in RCC_CSR register.
1745
  * @note   The BKPSRAM is not affected by this reset.  
1727
  * @note   The BKPSRAM is not affected by this reset.
1746
  */
1728
  */
1747
#define __HAL_RCC_BACKUPRESET_FORCE()   (*(__IO uint32_t *) RCC_CSR_RTCRST_BB = ENABLE)
1729
#define __HAL_RCC_BACKUPRESET_FORCE()   (*(__IO uint32_t *) RCC_CSR_RTCRST_BB = ENABLE)
1748
 
1730
 
1749
/** @brief  Macros to release the Backup domain reset.
1731
/** @brief  Macros to release the Backup domain reset.
1750
  */
1732
  */
Line 1838... Line 1820...
1838
  *            @arg @ref RCC_FLAG_WWDGRST Window Watchdog reset.
1820
  *            @arg @ref RCC_FLAG_WWDGRST Window Watchdog reset.
1839
  *            @arg @ref RCC_FLAG_LPWRRST Low Power reset.
1821
  *            @arg @ref RCC_FLAG_LPWRRST Low Power reset.
1840
  * @note (*) This bit is available in high and medium+ density devices only.
1822
  * @note (*) This bit is available in high and medium+ density devices only.
1841
  * @retval The new state of __FLAG__ (TRUE or FALSE).
1823
  * @retval The new state of __FLAG__ (TRUE or FALSE).
1842
  */
1824
  */
1843
#define __HAL_RCC_GET_FLAG(__FLAG__) (((((__FLAG__) >> 5) == CR_REG_INDEX)? RCC->CR :RCC->CSR) & ((uint32_t)1 << ((__FLAG__) & RCC_FLAG_MASK)))   
1825
#define __HAL_RCC_GET_FLAG(__FLAG__) (((((__FLAG__) >> 5U) == CR_REG_INDEX)? RCC->CR :RCC->CSR) & (1U << ((__FLAG__) & RCC_FLAG_MASK)))
1844
 
1826
 
1845
/**
1827
/**
1846
  * @}
1828
  * @}
1847
  */
1829
  */
1848
 
1830
 
Line 1861... Line 1843...
1861
/** @addtogroup RCC_Exported_Functions_Group1
1843
/** @addtogroup RCC_Exported_Functions_Group1
1862
  * @{
1844
  * @{
1863
  */
1845
  */
1864
 
1846
 
1865
/* Initialization and de-initialization functions  ******************************/
1847
/* Initialization and de-initialization functions  ******************************/
1866
void              HAL_RCC_DeInit(void);
1848
HAL_StatusTypeDef HAL_RCC_DeInit(void);
1867
HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef  *RCC_OscInitStruct);
1849
HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef  *RCC_OscInitStruct);
1868
HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef  *RCC_ClkInitStruct, uint32_t FLatency);
1850
HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef  *RCC_ClkInitStruct, uint32_t FLatency);
1869
 
1851
 
1870
/**
1852
/**
1871
  * @}
1853
  * @}
Line 1876... Line 1858...
1876
  */
1858
  */
1877
 
1859
 
1878
/* Peripheral Control functions  ************************************************/
1860
/* Peripheral Control functions  ************************************************/
1879
void              HAL_RCC_MCOConfig(uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv);
1861
void              HAL_RCC_MCOConfig(uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv);
1880
void              HAL_RCC_EnableCSS(void);
1862
void              HAL_RCC_EnableCSS(void);
-
 
1863
/* CSS NMI IRQ handler */
-
 
1864
void              HAL_RCC_NMI_IRQHandler(void);
-
 
1865
/* User Callbacks in non blocking mode (IT mode) */
-
 
1866
void              HAL_RCC_CSSCallback(void);
1881
void              HAL_RCC_DisableCSS(void);
1867
void              HAL_RCC_DisableCSS(void);
1882
uint32_t          HAL_RCC_GetSysClockFreq(void);
1868
uint32_t          HAL_RCC_GetSysClockFreq(void);
1883
uint32_t          HAL_RCC_GetHCLKFreq(void);
1869
uint32_t          HAL_RCC_GetHCLKFreq(void);
1884
uint32_t          HAL_RCC_GetPCLK1Freq(void);
1870
uint32_t          HAL_RCC_GetPCLK1Freq(void);
1885
uint32_t          HAL_RCC_GetPCLK2Freq(void);
1871
uint32_t          HAL_RCC_GetPCLK2Freq(void);
1886
void              HAL_RCC_GetOscConfig(RCC_OscInitTypeDef  *RCC_OscInitStruct);
1872
void              HAL_RCC_GetOscConfig(RCC_OscInitTypeDef  *RCC_OscInitStruct);
1887
void              HAL_RCC_GetClockConfig(RCC_ClkInitTypeDef  *RCC_ClkInitStruct, uint32_t *pFLatency);
1873
void              HAL_RCC_GetClockConfig(RCC_ClkInitTypeDef  *RCC_ClkInitStruct, uint32_t *pFLatency);
1888
 
1874
 
1889
/* CSS NMI IRQ handler */
-
 
1890
void              HAL_RCC_NMI_IRQHandler(void);
-
 
1891
 
-
 
1892
/* User Callbacks in non blocking mode (IT mode) */
-
 
1893
void              HAL_RCC_CSSCallback(void);
-
 
1894
 
-
 
1895
/**
1875
/**
1896
  * @}
1876
  * @}
1897
  */
1877
  */
1898
 
1878
 
1899
/**
1879
/**
Line 1905... Line 1885...
1905
  */
1885
  */
1906
 
1886
 
1907
/**
1887
/**
1908
  * @}
1888
  * @}
1909
  */
1889
  */
1910
 
1890
 
1911
#ifdef __cplusplus
1891
#ifdef __cplusplus
1912
}
1892
}
1913
#endif
1893
#endif
1914
 
1894
 
1915
#endif /* __STM32L1xx_HAL_RCC_H */
1895
#endif /* __STM32L1xx_HAL_RCC_H */