stm8l15x_clk.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. /**
  2. ******************************************************************************
  3. * @file stm8l15x_clk.h
  4. * @author MCD Application Team
  5. * @version V1.6.1
  6. * @date 30-September-2014
  7. * @brief This file contains all the functions prototypes for the CLK firmware
  8. * library.
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
  13. *
  14. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  15. * You may not use this file except in compliance with the License.
  16. * You may obtain a copy of the License at:
  17. *
  18. * http://www.st.com/software_license_agreement_liberty_v2
  19. *
  20. * Unless required by applicable law or agreed to in writing, software
  21. * distributed under the License is distributed on an "AS IS" BASIS,
  22. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. * See the License for the specific language governing permissions and
  24. * limitations under the License.
  25. *
  26. ******************************************************************************
  27. */
  28. /* Define to prevent recursive inclusion -------------------------------------*/
  29. #ifndef __STM8L15x_CLK_H
  30. #define __STM8L15x_CLK_H
  31. /* Includes ------------------------------------------------------------------*/
  32. #include "stm8l15x.h"
  33. /** @addtogroup STM8L15x_StdPeriph_Driver
  34. * @{
  35. */
  36. /** @addtogroup CLK
  37. * @{
  38. */
  39. /* Exported types ------------------------------------------------------------*/
  40. /** @defgroup Exported_Types
  41. * @{
  42. */
  43. /** @defgroup CLK_HSE_Configuration
  44. * @{
  45. */
  46. typedef enum {
  47. CLK_HSE_OFF = (uint8_t)0x00, /*!< HSE Disable */
  48. CLK_HSE_ON = (uint8_t)0x01, /*!< HSE Enable */
  49. CLK_HSE_Bypass = (uint8_t)0x11 /*!< HSE Bypass and enable */
  50. } CLK_HSE_TypeDef;
  51. #define IS_CLK_HSE(CONFIG) (((CONFIG) == CLK_HSE_ON) ||\
  52. ((CONFIG) == CLK_HSE_OFF)||\
  53. ((CONFIG) == CLK_HSE_Bypass))
  54. /**
  55. * @}
  56. */
  57. /** @defgroup CLK_LSE_Configuration
  58. * @{
  59. */
  60. typedef enum {
  61. CLK_LSE_OFF = (uint8_t)0x00, /*!< LSE Disable */
  62. CLK_LSE_ON = (uint8_t)0x04, /*!< LSE Enable */
  63. CLK_LSE_Bypass = (uint8_t)0x24 /*!< LSE Bypass and enable */
  64. } CLK_LSE_TypeDef;
  65. #define IS_CLK_LSE(CONFIG) (((CONFIG) == CLK_LSE_OFF) ||\
  66. ((CONFIG) == CLK_LSE_ON) ||\
  67. ((CONFIG) == CLK_LSE_Bypass))
  68. /**
  69. * @}
  70. */
  71. /** @defgroup CLK_System_Clock_Sources
  72. * @{
  73. */
  74. typedef enum {
  75. CLK_SYSCLKSource_HSI = (uint8_t)0x01, /*!< System Clock Source HSI */
  76. CLK_SYSCLKSource_LSI = (uint8_t)0x02, /*!< System Clock Source LSI */
  77. CLK_SYSCLKSource_HSE = (uint8_t)0x04, /*!< System Clock Source HSE */
  78. CLK_SYSCLKSource_LSE = (uint8_t)0x08 /*!< System Clock Source LSE */
  79. } CLK_SYSCLKSource_TypeDef;
  80. #define IS_CLK_SOURCE(SOURCE) (((SOURCE) == CLK_SYSCLKSource_HSI) ||\
  81. ((SOURCE) == CLK_SYSCLKSource_LSI) ||\
  82. ((SOURCE) == CLK_SYSCLKSource_HSE) ||\
  83. ((SOURCE) == CLK_SYSCLKSource_LSE))
  84. /**
  85. * @}
  86. */
  87. /** @defgroup CLK_Clock_Output_Selection
  88. * @{
  89. */
  90. typedef enum {
  91. CLK_CCOSource_Off = (uint8_t)0x00, /*!< Clock Output Off */
  92. CLK_CCOSource_HSI = (uint8_t)0x02, /*!< HSI Clock Output */
  93. CLK_CCOSource_LSI = (uint8_t)0x04, /*!< LSI Clock Output */
  94. CLK_CCOSource_HSE = (uint8_t)0x08, /*!< HSE Clock Output */
  95. CLK_CCOSource_LSE = (uint8_t)0x10 /*!< LSE Clock Output */
  96. } CLK_CCOSource_TypeDef;
  97. #define IS_CLK_OUTPUT(OUTPUT) (((OUTPUT) == CLK_CCOSource_Off) ||\
  98. ((OUTPUT) == CLK_CCOSource_HSI) ||\
  99. ((OUTPUT) == CLK_CCOSource_LSI) ||\
  100. ((OUTPUT) == CLK_CCOSource_HSE) ||\
  101. ((OUTPUT) == CLK_CCOSource_LSE))
  102. /**
  103. * @}
  104. */
  105. /** @defgroup CLK_Clock_Output_Prescaler
  106. * @{
  107. */
  108. typedef enum {
  109. CLK_CCODiv_1 = (uint8_t)0x00, /*!< Clock Output Div 1 */
  110. CLK_CCODiv_2 = (uint8_t)0x20, /*!< Clock Output Div 2 */
  111. CLK_CCODiv_4 = (uint8_t)0x40, /*!< Clock Output Div 4 */
  112. CLK_CCODiv_8 = (uint8_t)0x60, /*!< Clock Output Div 8 */
  113. CLK_CCODiv_16 = (uint8_t)0x80, /*!< Clock Output Div 16 */
  114. CLK_CCODiv_32 = (uint8_t)0xA0, /*!< Clock Output Div 32 */
  115. CLK_CCODiv_64 = (uint8_t)0xC0 /*!< Clock Output Div 64 */
  116. } CLK_CCODiv_TypeDef;
  117. #define IS_CLK_OUTPUT_DIVIDER(PRESCALER) (((PRESCALER) == CLK_CCODiv_1) ||\
  118. ((PRESCALER) == CLK_CCODiv_2) ||\
  119. ((PRESCALER) == CLK_CCODiv_4) ||\
  120. ((PRESCALER) == CLK_CCODiv_8) ||\
  121. ((PRESCALER) == CLK_CCODiv_16) ||\
  122. ((PRESCALER) == CLK_CCODiv_32) ||\
  123. ((PRESCALER) == CLK_CCODiv_64))
  124. /**
  125. * @}
  126. */
  127. /** @defgroup CLK_Beep_Selection
  128. * @{
  129. */
  130. typedef enum {
  131. CLK_BEEPCLKSource_Off = (uint8_t)0x00, /*!< Clock BEEP Off */
  132. CLK_BEEPCLKSource_LSI = (uint8_t)0x02, /*!< Clock BEEP : LSI */
  133. CLK_BEEPCLKSource_LSE = (uint8_t)0x04 /*!< Clock BEEP : LSE */
  134. } CLK_BEEPCLKSource_TypeDef;
  135. #define IS_CLK_CLOCK_BEEP(OUTPUT) (((OUTPUT) == CLK_BEEPCLKSource_Off) ||\
  136. ((OUTPUT) == CLK_BEEPCLKSource_LSI) ||\
  137. ((OUTPUT) == CLK_BEEPCLKSource_LSE))
  138. /**
  139. * @}
  140. */
  141. /** @defgroup CLK_RTC_Selection
  142. * @{
  143. */
  144. typedef enum {
  145. CLK_RTCCLKSource_Off = (uint8_t)0x00, /*!< Clock RTC Off */
  146. CLK_RTCCLKSource_HSI = (uint8_t)0x02, /*!< Clock RTC : HSI */
  147. CLK_RTCCLKSource_LSI = (uint8_t)0x04, /*!< Clock RTC : LSI */
  148. CLK_RTCCLKSource_HSE = (uint8_t)0x08, /*!< Clock RTC : HSE */
  149. CLK_RTCCLKSource_LSE = (uint8_t)0x10 /*!< Clock RTC : LSE */
  150. } CLK_RTCCLKSource_TypeDef;
  151. #define IS_CLK_CLOCK_RTC(OUTPUT) (((OUTPUT) == CLK_RTCCLKSource_Off) ||\
  152. ((OUTPUT) == CLK_RTCCLKSource_HSI) ||\
  153. ((OUTPUT) == CLK_RTCCLKSource_LSI) ||\
  154. ((OUTPUT) == CLK_RTCCLKSource_HSE) ||\
  155. ((OUTPUT) == CLK_RTCCLKSource_LSE))
  156. /**
  157. * @}
  158. */
  159. /** @defgroup CLK_RTC_Prescaler
  160. * @{
  161. */
  162. typedef enum {
  163. CLK_RTCCLKDiv_1 = (uint8_t)0x00, /*!< Clock RTC Div 1 */
  164. CLK_RTCCLKDiv_2 = (uint8_t)0x20, /*!< Clock RTC Div 2 */
  165. CLK_RTCCLKDiv_4 = (uint8_t)0x40, /*!< Clock RTC Div 4 */
  166. CLK_RTCCLKDiv_8 = (uint8_t)0x60, /*!< Clock RTC Div 8 */
  167. CLK_RTCCLKDiv_16 = (uint8_t)0x80, /*!< Clock RTC Div 16 */
  168. CLK_RTCCLKDiv_32 = (uint8_t)0xA0, /*!< Clock RTC Div 32 */
  169. CLK_RTCCLKDiv_64 = (uint8_t)0xC0 /*!< Clock RTC Div 64 */
  170. } CLK_RTCCLKDiv_TypeDef;
  171. #define IS_CLK_CLOCK_RTC_DIV(DIV) (((DIV) == CLK_RTCCLKDiv_1) ||\
  172. ((DIV) == CLK_RTCCLKDiv_2) ||\
  173. ((DIV) == CLK_RTCCLKDiv_4) ||\
  174. ((DIV) == CLK_RTCCLKDiv_8) ||\
  175. ((DIV) == CLK_RTCCLKDiv_16) ||\
  176. ((DIV) == CLK_RTCCLKDiv_32) ||\
  177. ((DIV) == CLK_RTCCLKDiv_64))
  178. /**
  179. * @}
  180. */
  181. /** @defgroup CLK_Peripherals
  182. * @{
  183. */
  184. /* Elements values convention: 0xXY
  185. X = choice between the peripheral registers
  186. X = 0 : PCKENR1
  187. X = 1 : PCKENR2
  188. X = 2 : PCKENR3
  189. Y = Peripheral position in the register
  190. */
  191. typedef enum {
  192. CLK_Peripheral_TIM2 = (uint8_t)0x00, /*!< Peripheral Clock Enable 1, TIM2 */
  193. CLK_Peripheral_TIM3 = (uint8_t)0x01, /*!< Peripheral Clock Enable 1, TIM3 */
  194. CLK_Peripheral_TIM4 = (uint8_t)0x02, /*!< Peripheral Clock Enable 1, TIM4 */
  195. CLK_Peripheral_I2C1 = (uint8_t)0x03, /*!< Peripheral Clock Enable 1, I2C1 */
  196. CLK_Peripheral_SPI1 = (uint8_t)0x04, /*!< Peripheral Clock Enable 1, SPI1 */
  197. CLK_Peripheral_USART1 = (uint8_t)0x05, /*!< Peripheral Clock Enable 1, USART1 */
  198. CLK_Peripheral_BEEP = (uint8_t)0x06, /*!< Peripheral Clock Enable 1, BEEP */
  199. CLK_Peripheral_DAC = (uint8_t)0x07, /*!< Peripheral Clock Enable 1, DAC */
  200. CLK_Peripheral_ADC1 = (uint8_t)0x10, /*!< Peripheral Clock Enable 2, ADC1 */
  201. CLK_Peripheral_TIM1 = (uint8_t)0x11, /*!< Peripheral Clock Enable 2, TIM1 */
  202. CLK_Peripheral_RTC = (uint8_t)0x12, /*!< Peripheral Clock Enable 2, RTC */
  203. CLK_Peripheral_LCD = (uint8_t)0x13, /*!< Peripheral Clock Enable 2, LCD */
  204. CLK_Peripheral_DMA1 = (uint8_t)0x14, /*!< Peripheral Clock Enable 2, DMA1 */
  205. CLK_Peripheral_COMP = (uint8_t)0x15, /*!< Peripheral Clock Enable 2, COMP1 and COMP2 */
  206. CLK_Peripheral_BOOTROM = (uint8_t)0x17,/*!< Peripheral Clock Enable 2, Boot ROM */
  207. CLK_Peripheral_AES = (uint8_t)0x20, /*!< Peripheral Clock Enable 3, AES */
  208. CLK_Peripheral_TIM5 = (uint8_t)0x21, /*!< Peripheral Clock Enable 3, TIM5 */
  209. CLK_Peripheral_SPI2 = (uint8_t)0x22, /*!< Peripheral Clock Enable 3, SPI2 */
  210. CLK_Peripheral_USART2 = (uint8_t)0x23, /*!< Peripheral Clock Enable 3, USART2 */
  211. CLK_Peripheral_USART3 = (uint8_t)0x24, /*!< Peripheral Clock Enable 3, USART3 */
  212. CLK_Peripheral_CSSLSE = (uint8_t)0x25 /*!< Peripheral Clock Enable 3, CSS on LSE */
  213. } CLK_Peripheral_TypeDef;
  214. #define IS_CLK_PERIPHERAL(PERIPHERAL) (((PERIPHERAL) == CLK_Peripheral_DAC) ||\
  215. ((PERIPHERAL) == CLK_Peripheral_ADC1) ||\
  216. ((PERIPHERAL) == CLK_Peripheral_DMA1) ||\
  217. ((PERIPHERAL) == CLK_Peripheral_RTC) ||\
  218. ((PERIPHERAL) == CLK_Peripheral_LCD) ||\
  219. ((PERIPHERAL) == CLK_Peripheral_COMP) ||\
  220. ((PERIPHERAL) == CLK_Peripheral_TIM1) ||\
  221. ((PERIPHERAL) == CLK_Peripheral_USART1) ||\
  222. ((PERIPHERAL) == CLK_Peripheral_SPI1) ||\
  223. ((PERIPHERAL) == CLK_Peripheral_I2C1) ||\
  224. ((PERIPHERAL) == CLK_Peripheral_TIM4) ||\
  225. ((PERIPHERAL) == CLK_Peripheral_TIM3) ||\
  226. ((PERIPHERAL) == CLK_Peripheral_BEEP) ||\
  227. ((PERIPHERAL) == CLK_Peripheral_BOOTROM) ||\
  228. ((PERIPHERAL) == CLK_Peripheral_AES) ||\
  229. ((PERIPHERAL) == CLK_Peripheral_TIM5) ||\
  230. ((PERIPHERAL) == CLK_Peripheral_SPI2) ||\
  231. ((PERIPHERAL) == CLK_Peripheral_USART2) ||\
  232. ((PERIPHERAL) == CLK_Peripheral_USART3) ||\
  233. ((PERIPHERAL) == CLK_Peripheral_CSSLSE) ||\
  234. ((PERIPHERAL) == CLK_Peripheral_TIM2))
  235. /**
  236. * @}
  237. */
  238. /** @defgroup CLK_System_Clock_Divider
  239. * @{
  240. */
  241. typedef enum {
  242. CLK_SYSCLKDiv_1 = (uint8_t)0x00, /*!< System Clock Divider: 1 */
  243. CLK_SYSCLKDiv_2 = (uint8_t)0x01, /*!< System Clock Divider: 2 */
  244. CLK_SYSCLKDiv_4 = (uint8_t)0x02, /*!< System Clock Divider: 4 */
  245. CLK_SYSCLKDiv_8 = (uint8_t)0x03, /*!< System Clock Divider: 8 */
  246. CLK_SYSCLKDiv_16 = (uint8_t)0x04, /*!< System Clock Divider: 16 */
  247. CLK_SYSCLKDiv_32 = (uint8_t)0x05, /*!< System Clock Divider: 32 */
  248. CLK_SYSCLKDiv_64 = (uint8_t)0x06, /*!< System Clock Divider: 64 */
  249. CLK_SYSCLKDiv_128 = (uint8_t)0x07 /*!< System Clock Divider: 128 */
  250. } CLK_SYSCLKDiv_TypeDef;
  251. #define IS_CLK_SYSTEM_DIVIDER(DIV) (((DIV) == CLK_SYSCLKDiv_1) ||\
  252. ((DIV) == CLK_SYSCLKDiv_2) ||\
  253. ((DIV) == CLK_SYSCLKDiv_4) ||\
  254. ((DIV) == CLK_SYSCLKDiv_8) ||\
  255. ((DIV) == CLK_SYSCLKDiv_16) ||\
  256. ((DIV) == CLK_SYSCLKDiv_32) ||\
  257. ((DIV) == CLK_SYSCLKDiv_64) ||\
  258. ((DIV) == CLK_SYSCLKDiv_128))
  259. /**
  260. * @}
  261. */
  262. /** @defgroup CLK_Flags
  263. * @{
  264. */
  265. /* Elements values convention: 0xXY
  266. X = choice between the register's flags
  267. X = 0 : CLK_CRTCR
  268. X = 1 : CLK_ICKCR
  269. X = 2 : CLK_CCOR
  270. X = 3 : CLK_ECKCR
  271. X = 4 : CLK_SWCR
  272. X = 5 : CLK_CSSR
  273. X = 6 : CLK_CBEEPR
  274. X = 7 : CLK_REGCSRR
  275. X = 8 : CSSLSE_CSR
  276. Y = flag position in the register
  277. */
  278. typedef enum {
  279. CLK_FLAG_RTCSWBSY = (uint8_t)0x00, /*!< RTC clock busy in switch Flag */
  280. CLK_FLAG_HSIRDY = (uint8_t)0x11, /*!< High speed internal oscillator ready Flag */
  281. CLK_FLAG_LSIRDY = (uint8_t)0x13, /*!< Low speed internal oscillator ready Flag */
  282. CLK_FLAG_CCOBSY = (uint8_t)0x20, /*!< Configurable clock output busy */
  283. CLK_FLAG_HSERDY = (uint8_t)0x31, /*!< High speed external oscillator ready Flag */
  284. CLK_FLAG_LSERDY = (uint8_t)0x33, /*!< Low speed external oscillator ready Flag */
  285. CLK_FLAG_SWBSY = (uint8_t)0x40, /*!< Switch busy Flag */
  286. CLK_FLAG_AUX = (uint8_t)0x51, /*!< Auxiliary oscillator connected to master clock */
  287. CLK_FLAG_CSSD = (uint8_t)0x53, /*!< Clock security system detection Flag */
  288. CLK_FLAG_BEEPSWBSY = (uint8_t)0x60, /*!< BEEP clock busy in switch Flag*/
  289. CLK_FLAG_EEREADY = (uint8_t)0x77, /*!< Flash program memory and Data EEPROM ready Flag */
  290. CLK_FLAG_EEBUSY = (uint8_t)0x76, /*!< Flash program memory and Data EEPROM busy Flag */
  291. CLK_FLAG_LSEPD = (uint8_t)0x75, /*!< LSE power-down Flag */
  292. CLK_FLAG_HSEPD = (uint8_t)0x74, /*!< HSE power-down Flag */
  293. CLK_FLAG_LSIPD = (uint8_t)0x73, /*!< LSI power-down Flag */
  294. CLK_FLAG_HSIPD = (uint8_t)0x72, /*!< HSI power-down Flag */
  295. CLK_FLAG_REGREADY = (uint8_t)0x70, /*!< REGREADY Flag */
  296. CLK_FLAG_LSECSSF = (uint8_t)0x83, /*!< CSS on LSE detection Flag */
  297. CLK_FLAG_RTCCLKSWF = (uint8_t)0x84 /*!< RTCCLK switch completed flag on LSE failure */
  298. }CLK_FLAG_TypeDef;
  299. #define IS_CLK_FLAGS(FLAG) (((FLAG) == CLK_FLAG_LSIRDY) ||\
  300. ((FLAG) == CLK_FLAG_HSIRDY) ||\
  301. ((FLAG) == CLK_FLAG_HSERDY) ||\
  302. ((FLAG) == CLK_FLAG_SWBSY) ||\
  303. ((FLAG) == CLK_FLAG_CSSD) ||\
  304. ((FLAG) == CLK_FLAG_AUX) ||\
  305. ((FLAG) == CLK_FLAG_LSERDY) ||\
  306. ((FLAG) == CLK_FLAG_CCOBSY) ||\
  307. ((FLAG) == CLK_FLAG_RTCSWBSY) ||\
  308. ((FLAG) == CLK_FLAG_EEREADY) ||\
  309. ((FLAG) == CLK_FLAG_EEBUSY) ||\
  310. ((FLAG) == CLK_FLAG_LSEPD) ||\
  311. ((FLAG) == CLK_FLAG_LSIPD) ||\
  312. ((FLAG) == CLK_FLAG_HSEPD) ||\
  313. ((FLAG) == CLK_FLAG_HSIPD) ||\
  314. ((FLAG) == CLK_FLAG_REGREADY) ||\
  315. ((FLAG) == CLK_FLAG_BEEPSWBSY)||\
  316. ((FLAG) == CLK_FLAG_LSECSSF)||\
  317. ((FLAG) == CLK_FLAG_RTCCLKSWF))
  318. /**
  319. * @}
  320. */
  321. /** @defgroup CLK_Interrupts
  322. * @{
  323. */
  324. typedef enum {
  325. CLK_IT_CSSD = (uint8_t)0x0C, /*!< Clock security system detection Flag */
  326. CLK_IT_SWIF = (uint8_t)0x1C, /*!< Clock switch interrupt Flag */
  327. CLK_IT_LSECSSF = (uint8_t)0x2C /*!< LSE Clock security system detection Interrupt */
  328. }CLK_IT_TypeDef;
  329. #define IS_CLK_IT(IT) (((IT) == CLK_IT_CSSD) ||\
  330. ((IT) == CLK_IT_SWIF) ||\
  331. ((IT) == CLK_IT_LSECSSF))
  332. #define IS_CLK_CLEAR_IT(IT) (((IT) == CLK_IT_SWIF)||\
  333. ((IT) == CLK_IT_LSECSSF))
  334. /**
  335. * @}
  336. */
  337. /** @defgroup CLK_Halt_Configuration
  338. * @{
  339. */
  340. typedef enum {
  341. CLK_Halt_BEEPRunning = (uint8_t)0x40, /*!< BEEP clock Halt/Active-halt mode */
  342. CLK_Halt_FastWakeup = (uint8_t)0x20, /*!< Fast wakeup from Halt/Active-halt modes */
  343. CLK_Halt_SlowWakeup = (uint8_t)0x10 /*!< Slow Active-halt mode */
  344. }
  345. CLK_Halt_TypeDef;
  346. #define IS_CLK_HALT(HALT) (((HALT) == CLK_Halt_BEEPRunning) ||\
  347. ((HALT) == CLK_Halt_FastWakeup) ||\
  348. ((HALT) == CLK_Halt_SlowWakeup))
  349. /**
  350. * @}
  351. */
  352. /**
  353. * @}
  354. */
  355. /* Exported constants --------------------------------------------------------*/
  356. /* Exported macro ------------------------------------------------------------*/
  357. /* Exported functions ------------------------------------------------------- */
  358. /* Function used to set the CLK configuration to the default reset state ******/
  359. void CLK_DeInit(void);
  360. /* Internal/external clocks, CSS and CCO configuration functions **************/
  361. void CLK_HSICmd(FunctionalState NewState);
  362. void CLK_AdjustHSICalibrationValue(uint8_t CLK_HSICalibrationValue);
  363. void CLK_LSICmd(FunctionalState NewState);
  364. void CLK_HSEConfig(CLK_HSE_TypeDef CLK_HSE);
  365. void CLK_LSEConfig(CLK_LSE_TypeDef CLK_LSE);
  366. void CLK_ClockSecuritySystemEnable(void);
  367. void CLK_ClockSecuritySytemDeglitchCmd(FunctionalState NewState);
  368. void CLK_CCOConfig(CLK_CCOSource_TypeDef CLK_CCOSource, CLK_CCODiv_TypeDef CLK_CCODiv);
  369. /* System clocks configuration functions ******************/
  370. void CLK_SYSCLKSourceConfig(CLK_SYSCLKSource_TypeDef CLK_SYSCLKSource);
  371. CLK_SYSCLKSource_TypeDef CLK_GetSYSCLKSource(void);
  372. uint32_t CLK_GetClockFreq(void);
  373. void CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_TypeDef CLK_SYSCLKDiv);
  374. void CLK_SYSCLKSourceSwitchCmd(FunctionalState NewState);
  375. /* Peripheral clocks configuration functions **********************************/
  376. void CLK_RTCClockConfig(CLK_RTCCLKSource_TypeDef CLK_RTCCLKSource, CLK_RTCCLKDiv_TypeDef CLK_RTCCLKDiv);
  377. void CLK_BEEPClockConfig(CLK_BEEPCLKSource_TypeDef CLK_BEEPCLKSource);
  378. void CLK_PeripheralClockConfig(CLK_Peripheral_TypeDef CLK_Peripheral, FunctionalState NewState);
  379. /* CSS on LSE configuration functions *****************************************/
  380. void CLK_LSEClockSecuritySystemEnable(void);
  381. void CLK_RTCCLKSwitchOnLSEFailureEnable(void);
  382. /* Low power clock configuration functions ************************************/
  383. void CLK_HaltConfig(CLK_Halt_TypeDef CLK_Halt, FunctionalState NewState);
  384. void CLK_MainRegulatorCmd(FunctionalState NewState);
  385. /* Interrupts and flags management functions **********************************/
  386. void CLK_ITConfig(CLK_IT_TypeDef CLK_IT, FunctionalState NewState);
  387. FlagStatus CLK_GetFlagStatus(CLK_FLAG_TypeDef CLK_FLAG);
  388. void CLK_ClearFlag(void);
  389. ITStatus CLK_GetITStatus(CLK_IT_TypeDef CLK_IT);
  390. void CLK_ClearITPendingBit(CLK_IT_TypeDef CLK_IT);
  391. #endif /* __STM8L15x_CLK_H */
  392. /**
  393. * @}
  394. */
  395. /**
  396. * @}
  397. */
  398. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/