Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
108:34e6b704fe68
.

Who changed what in which revision?

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