]> git.sur5r.net Git - freertos/blob - Demo/CORTEX_M0_STM32F0518_IAR/Libraries/CMSIS/Device/ST/STM32F0xx/Include/stm32f0xx.h
Start to re-arrange files to include FreeRTOS+ in main download.
[freertos] / Demo / CORTEX_M0_STM32F0518_IAR / Libraries / CMSIS / Device / ST / STM32F0xx / Include / stm32f0xx.h
1 /**\r
2   ******************************************************************************\r
3   * @file    stm32f0xx.h\r
4   * @author  MCD Application Team\r
5   * @version V1.0.0RC1\r
6   * @date    27-January-2012\r
7   * @brief   CMSIS Cortex-M0 Device Peripheral Access Layer Header File. \r
8   *          This file contains all the peripheral register's definitions, bits \r
9   *          definitions and memory mapping for STM32F0xx devices.  \r
10   *          \r
11   *          The file is the unique include file that the application programmer\r
12   *          is using in the C source code, usually in main.c. This file contains:\r
13   *           - Configuration section that allows to select:\r
14   *              - The device used in the target application\r
15   *              - To use or not the peripheral’s drivers in application code(i.e. \r
16   *                code will be based on direct access to peripheral’s registers \r
17   *                rather than drivers API), this option is controlled by \r
18   *                "#define USE_STDPERIPH_DRIVER"\r
19   *              - To change few application-specific parameters such as the HSE \r
20   *                crystal frequency\r
21   *           - Data structures and the address mapping for all peripherals\r
22   *           - Peripheral's registers declarations and bits definition\r
23   *           - Macros to access peripheral’s registers hardware\r
24   *                 \r
25   ******************************************************************************\r
26   * @attention\r
27   *\r
28   * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
29   * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE\r
30   * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY\r
31   * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING\r
32   * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE\r
33   * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
34   *\r
35   * FOR MORE INFORMATION PLEASE READ CAREFULLY THE LICENSE AGREEMENT FILE\r
36   * LOCATED IN THE ROOT DIRECTORY OF THIS FIRMWARE PACKAGE.\r
37   *\r
38   * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>\r
39   ******************************************************************************\r
40   */\r
41 \r
42 /** @addtogroup CMSIS\r
43   * @{\r
44   */\r
45 \r
46 /** @addtogroup stm32f0xx\r
47   * @{\r
48   */\r
49     \r
50 #ifndef __STM32F0XX_H\r
51 #define __STM32F0XX_H\r
52 \r
53 #ifdef __cplusplus\r
54  extern "C" {\r
55 #endif \r
56   \r
57 /** @addtogroup Library_configuration_section\r
58   * @{\r
59   */\r
60   \r
61 /* Uncomment the line below according to the target STM32F-0 device used in your \r
62    application \r
63   */\r
64 \r
65 #if !defined (STM32F0XX)\r
66   #define STM32F0XX    /*!< STM32F0XX: STM32F0xx devices */\r
67 #endif\r
68 /*  Tip: To avoid modifying this file each time you need to switch between these\r
69         devices, you can define the device in your toolchain compiler preprocessor.\r
70 \r
71  - STM32F0xx devices are STM32F050xx microcontrollers where the Flash memory \r
72    density ranges between 32 and 64 Kbytes.\r
73   */\r
74 \r
75 #if !defined (STM32F0XX)\r
76  #error "Please select first the target STM32F0xx device used in your application (in stm32f0xx.h file)"\r
77 #endif\r
78 \r
79 #if !defined  USE_STDPERIPH_DRIVER\r
80 /**\r
81  * @brief Comment the line below if you will not use the peripherals drivers.\r
82    In this case, these drivers will not be included and the application code will \r
83    be based on direct access to peripherals registers \r
84    */\r
85   /*#define USE_STDPERIPH_DRIVER*/\r
86 #endif\r
87 \r
88 /**\r
89  * @brief In the following line adjust the value of External High Speed oscillator (HSE)\r
90    used in your application \r
91    \r
92    Tip: To avoid modifying this file each time you need to use different HSE, you\r
93         can define the HSE value in your toolchain compiler preprocessor.\r
94   */\r
95 #if !defined  (HSE_VALUE)     \r
96 #define HSE_VALUE    ((uint32_t)8000000) /*!< Value of the External oscillator in Hz*/\r
97 #endif\r
98 \r
99 /**\r
100  * @brief In the following line adjust the External High Speed oscillator (HSE) Startup \r
101    Timeout value \r
102    */\r
103 #if !defined  (HSE_STARTUP_TIMEOUT)\r
104 #define HSE_STARTUP_TIMEOUT   ((uint16_t)0x0500) /*!< Time out for HSE start up */\r
105 #endif\r
106 \r
107 /**\r
108  * @brief In the following line adjust the Internal High Speed oscillator (HSI) Startup \r
109    Timeout value \r
110    */\r
111 #if !defined  (HSI_STARTUP_TIMEOUT)\r
112 #define HSI_STARTUP_TIMEOUT   ((uint16_t)0x0500) /*!< Time out for HSI start up */\r
113 #endif\r
114 \r
115 #if !defined  (HSI_VALUE) \r
116 #define HSI_VALUE  ((uint32_t)8000000) /*!< Value of the Internal High Speed oscillator in Hz.\r
117                                              The real value may vary depending on the variations\r
118                                              in voltage and temperature.  */\r
119 #endif\r
120 \r
121 #if !defined  (HSI14_VALUE) \r
122 #define HSI14_VALUE ((uint32_t)14000000) /*!< Value of the Internal High Speed oscillator for ADC in Hz.\r
123                                              The real value may vary depending on the variations\r
124                                              in voltage and temperature.  */\r
125 #endif\r
126 \r
127 #if !defined  (LSI_VALUE) \r
128 #define LSI_VALUE  ((uint32_t)40000)    /*!< Value of the Internal Low Speed oscillator in Hz\r
129                                              The real value may vary depending on the variations\r
130                                              in voltage and temperature.  */\r
131 #endif\r
132 #if !defined  (LSE_VALUE) \r
133 #define LSE_VALUE  ((uint32_t)32768)    /*!< Value of the External Low Speed oscillator in Hz */\r
134 #endif\r
135 \r
136 /**\r
137  * @brief STM32F0xx Standard Peripheral Library version number V1.0.0RC1\r
138    */\r
139 #define __STM32F0XX_STDPERIPH_VERSION_MAIN   (0x01) /*!< [31:24] main version */\r
140 #define __STM32F0XX_STDPERIPH_VERSION_SUB1   (0x00) /*!< [23:16] sub1 version */\r
141 #define __STM32F0XX_STDPERIPH_VERSION_SUB2   (0x00) /*!< [15:8]  sub2 version */\r
142 #define __STM32F0XX_STDPERIPH_VERSION_RC     (0x01) /*!< [7:0]  release candidate */ \r
143 #define __STM32F0XX_STDPERIPH_VERSION       ( (__STM32F0XX_STDPERIPH_VERSION_MAIN << 24)\\r
144                                              |(__STM32F0XX_STDPERIPH_VERSION_SUB1 << 16)\\r
145                                              |(__STM32F0XX_STDPERIPH_VERSION_SUB2 << 8)\\r
146                                              |(__STM32F0XX_STDPERIPH_VERSION_RC))\r
147 \r
148 /**\r
149   * @}\r
150   */\r
151 \r
152 /** @addtogroup Configuration_section_for_CMSIS\r
153   * @{\r
154   */\r
155 \r
156 /**\r
157  * @brief STM32F0xx Interrupt Number Definition, according to the selected device \r
158  *        in @ref Library_configuration_section \r
159  */\r
160 #define __CM0_REV                 0 /*!< Core Revision r0p0                            */\r
161 #define __MPU_PRESENT             0 /*!< STM32F0xx do not provide MPU                  */\r
162 #define __NVIC_PRIO_BITS          2 /*!< STM32F0xx uses 2 Bits for the Priority Levels */\r
163 #define __Vendor_SysTickConfig    0 /*!< Set to 1 if different SysTick Config is used  */\r
164 \r
165 /*!< Interrupt Number Definition */\r
166 typedef enum IRQn\r
167 {\r
168 /******  Cortex-M0 Processor Exceptions Numbers ******************************************************/\r
169   NonMaskableInt_IRQn         = -14,    /*!< 2 Non Maskable Interrupt                                */\r
170   HardFault_IRQn              = -13,    /*!< 3 Cortex-M0 Hard Fault Interrupt                        */\r
171   SVC_IRQn                    = -5,     /*!< 11 Cortex-M0 SV Call Interrupt                          */\r
172   PendSV_IRQn                 = -2,     /*!< 14 Cortex-M0 Pend SV Interrupt                          */\r
173   SysTick_IRQn                = -1,     /*!< 15 Cortex-M0 System Tick Interrupt                      */\r
174 \r
175 /******  STM32F-0 specific Interrupt Numbers *********************************************************/\r
176   WWDG_IRQn                   = 0,      /*!< Window WatchDog Interrupt                               */\r
177   PVD_IRQn                    = 1,      /*!< PVD through EXTI Line detect Interrupt                  */\r
178   RTC_IRQn                    = 2,      /*!< RTC through EXTI Line Interrupt                         */\r
179   FLASH_IRQn                  = 3,      /*!< FLASH Interrupt                                         */\r
180   RCC_IRQn                    = 4,      /*!< RCC Interrupt                                           */\r
181   EXTI0_1_IRQn                = 5,      /*!< EXTI Line 0 and 1 Interrupts                            */\r
182   EXTI2_3_IRQn                = 6,      /*!< EXTI Line 2 and 3 Interrupts                            */\r
183   EXTI4_15_IRQn               = 7,      /*!< EXTI Line 4 to 15 Interrupts                            */\r
184   TS_IRQn                     = 8,      /*!< TS Interrupt                                            */\r
185   DMA1_Channel1_IRQn          = 9,      /*!< DMA1 Channel 1 Interrupt                                */\r
186   DMA1_Channel2_3_IRQn        = 10,     /*!< DMA1 Channel 2 and Channel 3 Interrupts                 */\r
187   DMA1_Channel4_5_IRQn        = 11,     /*!< DMA1 Channel 4 and Channel 5 Interrupts                 */\r
188   ADC1_COMP_IRQn              = 12,     /*!< ADC1, COMP1 and COMP2 Interrupts                        */\r
189   TIM1_BRK_UP_TRG_COM_IRQn    = 13,     /*!< TIM1 Break, Update, Trigger and Commutation Interrupts  */\r
190   TIM1_CC_IRQn                = 14,     /*!< TIM1 Capture Compare Interrupt                          */\r
191   TIM2_IRQn                   = 15,     /*!< TIM2 Interrupt                                          */\r
192   TIM3_IRQn                   = 16,     /*!< TIM3 Interrupt                                          */\r
193   TIM6_DAC_IRQn               = 17,     /*!< TIM6 and DAC Interrupts                                 */\r
194   TIM14_IRQn                  = 19,     /*!< TIM14 Interrupt                                         */\r
195   TIM15_IRQn                  = 20,     /*!< TIM15 Interrupt                                         */\r
196   TIM16_IRQn                  = 21,     /*!< TIM16 Interrupt                                         */\r
197   TIM17_IRQn                  = 22,     /*!< TIM17 Interrupt                                         */\r
198   I2C1_IRQn                   = 23,     /*!< I2C1 Interrupt                                          */\r
199   I2C2_IRQn                   = 24,     /*!< I2C2 Interrupt                                          */\r
200   SPI1_IRQn                   = 25,     /*!< SPI1 Interrupt                                          */\r
201   SPI2_IRQn                   = 26,     /*!< SPI2 Interrupt                                          */\r
202   USART1_IRQn                 = 27,     /*!< USART1 Interrupt                                        */\r
203   USART2_IRQn                 = 28,     /*!< USART2 Interrupt                                        */\r
204   CEC_IRQn                    = 30      /*!< CEC Interrupt                                           */\r
205 } IRQn_Type;\r
206 \r
207 /**\r
208   * @}\r
209   */\r
210 \r
211 #include "core_cm0.h"\r
212 #include "system_stm32f0xx.h"\r
213 #include <stdint.h>\r
214 \r
215 /** @addtogroup Exported_types\r
216   * @{\r
217   */  \r
218 \r
219 typedef enum {RESET = 0, SET = !RESET} FlagStatus, ITStatus;\r
220 \r
221 typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;\r
222 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))\r
223 \r
224 typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrorStatus;\r
225 \r
226 /** @addtogroup Peripheral_registers_structures\r
227   * @{\r
228   */   \r
229 \r
230 /** \r
231   * @brief Analog to Digital Converter  \r
232   */\r
233 \r
234 typedef struct\r
235 {\r
236   __IO uint32_t ISR;          /*!< ADC Interrupt and Status register,                          Address offset:0x00 */\r
237   __IO uint32_t IER;          /*!< ADC Interrupt Enable register,                              Address offset:0x04 */\r
238   __IO uint32_t CR;           /*!< ADC Control register,                                       Address offset:0x08 */\r
239   __IO uint32_t CFGR1;        /*!< ADC Configuration register 1,                               Address offset:0x0C */\r
240   __IO uint32_t CFGR2;        /*!< ADC Configuration register 2,                               Address offset:0x10 */\r
241   __IO uint32_t SMPR;         /*!< ADC Sampling time register,                                 Address offset:0x14 */\r
242   uint32_t   RESERVED1;       /*!< Reserved,                                                                  0x18 */\r
243   uint32_t   RESERVED2;       /*!< Reserved,                                                                  0x1C */\r
244   __IO uint32_t TR;           /*!< ADC watchdog threshold register,                            Address offset:0x20 */\r
245   uint32_t   RESERVED3;       /*!< Reserved,                                                                  0x24 */\r
246   __IO uint32_t CHSELR;       /*!< ADC channel selection register,                             Address offset:0x28 */\r
247   uint32_t   RESERVED4[5];    /*!< Reserved,                                                                  0x2C */\r
248    __IO uint32_t DR;          /*!< ADC data register,                                          Address offset:0x40 */\r
249 } ADC_TypeDef;\r
250 \r
251 typedef struct\r
252 {\r
253   __IO uint32_t CCR;\r
254 } ADC_Common_TypeDef;\r
255 \r
256 /** \r
257   * @brief HDMI-CEC \r
258   */\r
259 \r
260 typedef struct\r
261 {\r
262   __IO uint32_t CR;           /*!< CEC control register,                                       Address offset:0x00 */\r
263   __IO uint32_t CFGR;         /*!< CEC configuration register,                                 Address offset:0x04 */\r
264   __IO uint32_t TXDR;         /*!< CEC Tx data register ,                                      Address offset:0x08 */\r
265   __IO uint32_t RXDR;         /*!< CEC Rx Data Register,                                       Address offset:0x0C */\r
266   __IO uint32_t ISR;          /*!< CEC Interrupt and Status Register,                          Address offset:0x10 */\r
267   __IO uint32_t IER;          /*!< CEC interrupt enable register,                              Address offset:0x14 */\r
268 }CEC_TypeDef;\r
269 \r
270 /**\r
271   * @brief Comparator \r
272   */\r
273 \r
274 typedef struct\r
275 {\r
276   __IO uint32_t CSR;     /*!< COMP comparator control and status register, Address offset: 0x1C */\r
277 } COMP_TypeDef;\r
278 \r
279 \r
280 /** \r
281   * @brief CRC calculation unit \r
282   */\r
283 \r
284 typedef struct\r
285 {\r
286   __IO uint32_t DR;       /*!< CRC Data register,                           Address offset: 0x00 */\r
287   __IO uint8_t  IDR;      /*!< CRC Independent data register,               Address offset: 0x04 */\r
288   uint8_t   RESERVED0;    /*!< Reserved,                                                    0x05 */\r
289   uint16_t  RESERVED1;    /*!< Reserved,                                                    0x06 */\r
290   __IO uint32_t CR;       /*!< CRC Control register,                        Address offset: 0x08 */\r
291   uint32_t  RESERVED2;    /*!< Reserved,                                                    0x0C */\r
292   __IO uint32_t INIT;     /*!< Initial CRC value register,                  Address offset: 0x10 */\r
293 } CRC_TypeDef;\r
294 \r
295 \r
296 /** \r
297   * @brief Digital to Analog Converter\r
298   */\r
299 \r
300 typedef struct\r
301 {\r
302   __IO uint32_t CR;           /*!< DAC control register,                                     Address offset: 0x00 */\r
303   __IO uint32_t SWTRIGR;      /*!< DAC software trigger register,                            Address offset: 0x04 */\r
304   __IO uint32_t DHR12R1;      /*!< DAC channel1 12-bit right-aligned data holding register,  Address offset: 0x08 */\r
305   __IO uint32_t DHR12L1;      /*!< DAC channel1 12-bit left aligned data holding register,   Address offset: 0x0C */\r
306   __IO uint32_t DHR8R1;       /*!< DAC channel1 8-bit right aligned data holding register,   Address offset: 0x10 */\r
307        uint32_t RESERVED[6];  /*!< Reserved,                                                                 0x14 */\r
308   __IO uint32_t DOR1;         /*!< DAC channel1 data output register,                        Address offset: 0x2C */\r
309        uint32_t RESERVED1;    /*!< Reserved,                                                                 0x30 */\r
310   __IO uint32_t SR;           /*!< DAC status register,                                      Address offset: 0x34 */\r
311 } DAC_TypeDef;\r
312 \r
313 /** \r
314   * @brief Debug MCU\r
315   */\r
316 \r
317 typedef struct\r
318 {\r
319   __IO uint32_t IDCODE;       /*!< MCU device ID code,                          Address offset: 0x00 */\r
320   __IO uint32_t CR;           /*!< Debug MCU configuration register,            Address offset: 0x04 */\r
321   __IO uint32_t APB1FZ;       /*!< Debug MCU APB1 freeze register,              Address offset: 0x08 */\r
322   __IO uint32_t APB2FZ;       /*!< Debug MCU APB2 freeze register,              Address offset: 0x0C */\r
323 }DBGMCU_TypeDef;\r
324 \r
325 /** \r
326   * @brief DMA Controller\r
327   */\r
328 \r
329 typedef struct\r
330 {\r
331   __IO uint32_t CCR;          /*!< DMA channel x configuration register                                           */\r
332   __IO uint32_t CNDTR;        /*!< DMA channel x number of data register                                          */\r
333   __IO uint32_t CPAR;         /*!< DMA channel x peripheral address register                                      */\r
334   __IO uint32_t CMAR;         /*!< DMA channel x memory address register                                          */\r
335 } DMA_Channel_TypeDef;\r
336 \r
337 typedef struct\r
338 {\r
339   __IO uint32_t ISR;          /*!< DMA interrupt status register,                            Address offset: 0x00 */\r
340   __IO uint32_t IFCR;         /*!< DMA interrupt flag clear register,                        Address offset: 0x04 */\r
341 } DMA_TypeDef;\r
342 \r
343 /** \r
344   * @brief External Interrupt/Event Controller\r
345   */\r
346 \r
347 typedef struct\r
348 {\r
349   __IO uint32_t IMR;          /*!<EXTI Interrupt mask register,                             Address offset: 0x00 */\r
350   __IO uint32_t EMR;          /*!<EXTI Event mask register,                                 Address offset: 0x04 */\r
351   __IO uint32_t RTSR;         /*!<EXTI Rising trigger selection register ,                  Address offset: 0x08 */\r
352   __IO uint32_t FTSR;         /*!<EXTI Falling trigger selection register,                  Address offset: 0x0C */\r
353   __IO uint32_t SWIER;        /*!<EXTI Software interrupt event register,                   Address offset: 0x10 */\r
354   __IO uint32_t PR;           /*!<EXTI Pending register,                                    Address offset: 0x14 */\r
355 }EXTI_TypeDef;\r
356 \r
357 /** \r
358   * @brief FLASH Registers\r
359   */\r
360 typedef struct\r
361 {\r
362   __IO uint32_t ACR;          /*!<FLASH access control register,                 Address offset: 0x00 */\r
363   __IO uint32_t KEYR;         /*!<FLASH key register,                            Address offset: 0x04 */\r
364   __IO uint32_t OPTKEYR;      /*!<FLASH OPT key register,                        Address offset: 0x08 */\r
365   __IO uint32_t SR;           /*!<FLASH status register,                         Address offset: 0x0C */\r
366   __IO uint32_t CR;           /*!<FLASH control register,                        Address offset: 0x10 */\r
367   __IO uint32_t AR;           /*!<FLASH address register,                        Address offset: 0x14 */\r
368   __IO uint32_t RESERVED;     /*!< Reserved,                                                     0x18 */\r
369   __IO uint32_t OBR;          /*!<FLASH option bytes register,                   Address offset: 0x1C */\r
370   __IO uint32_t WRPR;         /*!<FLASH option bytes register,                   Address offset: 0x20 */\r
371 } FLASH_TypeDef;\r
372 \r
373 \r
374 /** \r
375   * @brief Option Bytes Registers\r
376   */\r
377 typedef struct\r
378 {\r
379   __IO uint16_t RDP;          /*!<FLASH option byte Read protection,             Address offset: 0x00 */\r
380   __IO uint16_t USER;         /*!<FLASH option byte user options,                Address offset: 0x02 */\r
381   uint16_t RESERVED0;         /*!< Reserved,                                                     0x04 */\r
382   uint16_t RESERVED1;         /*!< Reserved,                                                     0x06 */\r
383   __IO uint16_t WRP0;         /*!<FLASH option byte write protection 0,          Address offset: 0x08 */\r
384   __IO uint16_t WRP1;         /*!<FLASH option byte write protection 1,          Address offset: 0x0C */\r
385 } OB_TypeDef;\r
386   \r
387 \r
388 /** \r
389   * @brief General Purpose IO\r
390   */\r
391 \r
392 typedef struct\r
393 {\r
394   __IO uint32_t MODER;        /*!< GPIO port mode register,                                  Address offset: 0x00 */\r
395   __IO uint16_t OTYPER;       /*!< GPIO port output type register,                           Address offset: 0x04 */\r
396   uint16_t RESERVED0;         /*!< Reserved,                                                                 0x06 */\r
397   __IO uint32_t OSPEEDR;      /*!< GPIO port output speed register,                          Address offset: 0x08 */\r
398   __IO uint32_t PUPDR;        /*!< GPIO port pull-up/pull-down register,                     Address offset: 0x0C */\r
399   __IO uint16_t IDR;          /*!< GPIO port input data register,                            Address offset: 0x10 */\r
400   uint16_t RESERVED1;         /*!< Reserved,                                                                 0x12 */\r
401   __IO uint16_t ODR;          /*!< GPIO port output data register,                           Address offset: 0x14 */\r
402   uint16_t RESERVED2;         /*!< Reserved,                                                                 0x16 */\r
403   __IO uint32_t BSRR;         /*!< GPIO port bit set/reset registerBSRR,                     Address offset: 0x18 */\r
404   __IO uint32_t LCKR;         /*!< GPIO port configuration lock register,                    Address offset: 0x1C */\r
405   __IO uint32_t AFR[2];       /*!< GPIO alternate function low register,                Address offset: 0x20-0x24 */\r
406   __IO uint16_t BRR;          /*!< GPIO bit reset register,                                  Address offset: 0x28 */\r
407   uint16_t RESERVED3;         /*!< Reserved,                                                                 0x2A */\r
408 }GPIO_TypeDef;\r
409 \r
410 /** \r
411   * @brief SysTem Configuration\r
412   */\r
413 \r
414 typedef struct\r
415 {\r
416   __IO uint32_t CFGR1;       /*!< SYSCFG configuration register 1,                           Address offset: 0x00 */\r
417        uint32_t RESERVED;    /*!< Reserved,                                                                  0x04 */\r
418   __IO uint32_t EXTICR[4];   /*!< SYSCFG external interrupt configuration register,     Address offset: 0x14-0x08 */\r
419   __IO uint32_t CFGR2;       /*!< SYSCFG configuration register 2,                           Address offset: 0x18 */\r
420 } SYSCFG_TypeDef;\r
421 \r
422 /** \r
423   * @brief Inter-integrated Circuit Interface\r
424   */\r
425 \r
426 typedef struct\r
427 {\r
428   __IO uint32_t CR1;      /*!< I2C Control register 1,            Address offset: 0x00 */\r
429   __IO uint32_t CR2;      /*!< I2C Control register 2,            Address offset: 0x04 */\r
430   __IO uint32_t OAR1;     /*!< I2C Own address 1 register,        Address offset: 0x08 */\r
431   __IO uint32_t OAR2;     /*!< I2C Own address 2 register,        Address offset: 0x0C */\r
432   __IO uint32_t TIMINGR;  /*!< I2C Timing register,               Address offset: 0x10 */\r
433   __IO uint32_t TIMEOUTR; /*!< I2C Timeout register,              Address offset: 0x14 */\r
434   __IO uint32_t ISR;      /*!< I2C Interrupt and status register, Address offset: 0x18 */\r
435   __IO uint32_t ICR;      /*!< I2C Interrupt clear register,      Address offset: 0x1C */\r
436   __IO uint32_t PECR;     /*!< I2C PEC register,                  Address offset: 0x20 */\r
437   __IO uint32_t RXDR;     /*!< I2C Receive data register,         Address offset: 0x24 */\r
438   __IO uint32_t TXDR;     /*!< I2C Transmit data register,        Address offset: 0x28 */\r
439 }I2C_TypeDef;\r
440 \r
441 \r
442 /** \r
443   * @brief Independent WATCHDOG\r
444   */\r
445 typedef struct\r
446 {\r
447   __IO uint32_t KR;   /*!< IWDG Key register,       Address offset: 0x00 */\r
448   __IO uint32_t PR;   /*!< IWDG Prescaler register, Address offset: 0x04 */\r
449   __IO uint32_t RLR;  /*!< IWDG Reload register,    Address offset: 0x08 */\r
450   __IO uint32_t SR;   /*!< IWDG Status register,    Address offset: 0x0C */\r
451   __IO uint32_t WINR; /*!< IWDG Window register,    Address offset: 0x10 */\r
452 } IWDG_TypeDef;\r
453 \r
454 /** \r
455   * @brief Power Control\r
456   */\r
457 \r
458 typedef struct\r
459 {\r
460   __IO uint32_t CR;   /*!< PWR power control register,        Address offset: 0x00 */\r
461   __IO uint32_t CSR;  /*!< PWR power control/status register, Address offset: 0x04 */\r
462 } PWR_TypeDef;\r
463 \r
464 \r
465 /** \r
466   * @brief Reset and Clock Control\r
467   */\r
468 typedef struct\r
469 {\r
470   __IO uint32_t CR;         /*!< RCC clock control register,                                  Address offset: 0x00 */\r
471   __IO uint32_t CFGR;       /*!< RCC clock configuration register,                            Address offset: 0x04 */\r
472   __IO uint32_t CIR;        /*!< RCC clock interrupt register,                                Address offset: 0x08 */\r
473   __IO uint32_t APB2RSTR;   /*!< RCC APB2 peripheral reset register,                          Address offset: 0x0C */\r
474   __IO uint32_t APB1RSTR;   /*!< RCC APB1 peripheral reset register,                          Address offset: 0x10 */\r
475   __IO uint32_t AHBENR;     /*!< RCC AHB peripheral clock register,                           Address offset: 0x14 */\r
476   __IO uint32_t APB2ENR;    /*!< RCC APB2 peripheral clock enable register,                   Address offset: 0x18 */\r
477   __IO uint32_t APB1ENR;    /*!< RCC APB1 peripheral clock enable register,                   Address offset: 0x1C */\r
478   __IO uint32_t BDCR;       /*!< RCC Backup domain control register,                          Address offset: 0x20 */ \r
479   __IO uint32_t CSR;        /*!< RCC clock control & status register,                         Address offset: 0x24 */\r
480   __IO uint32_t AHBRSTR;    /*!< RCC AHB peripheral reset register,                           Address offset: 0x28 */\r
481   __IO uint32_t CFGR2;      /*!< RCC clock configuration register 2,                          Address offset: 0x2C */\r
482   __IO uint32_t CFGR3;      /*!< RCC clock configuration register 3,                          Address offset: 0x30 */\r
483   __IO uint32_t CR2;        /*!< RCC clock control register 2,                                Address offset: 0x34 */\r
484 } RCC_TypeDef;\r
485 \r
486 /** \r
487   * @brief Real-Time Clock\r
488   */\r
489 \r
490 typedef struct\r
491 {                           \r
492   __IO uint32_t TR;         /*!< RTC time register,                                        Address offset: 0x00 */\r
493   __IO uint32_t DR;         /*!< RTC date register,                                        Address offset: 0x04 */\r
494   __IO uint32_t CR;         /*!< RTC control register,                                     Address offset: 0x08 */\r
495   __IO uint32_t ISR;        /*!< RTC initialization and status register,                   Address offset: 0x0C */\r
496   __IO uint32_t PRER;       /*!< RTC prescaler register,                                   Address offset: 0x10 */\r
497        uint32_t RESERVED0;  /*!< Reserved,                                                 Address offset: 0x14 */\r
498        uint32_t RESERVED1;  /*!< Reserved,                                                 Address offset: 0x18 */\r
499   __IO uint32_t ALRMAR;     /*!< RTC alarm A register,                                     Address offset: 0x1C */\r
500        uint32_t RESERVED2;  /*!< Reserved,                                                 Address offset: 0x20 */\r
501   __IO uint32_t WPR;        /*!< RTC write protection register,                            Address offset: 0x24 */\r
502   __IO uint32_t SSR;        /*!< RTC sub second register,                                  Address offset: 0x28 */\r
503   __IO uint32_t SHIFTR;     /*!< RTC shift control register,                               Address offset: 0x2C */\r
504   __IO uint32_t TSTR;       /*!< RTC time stamp time register,                             Address offset: 0x30 */\r
505   __IO uint32_t TSDR;       /*!< RTC time stamp date register,                             Address offset: 0x34 */\r
506   __IO uint32_t TSSSR;      /*!< RTC time-stamp sub second register,                       Address offset: 0x38 */\r
507   __IO uint32_t CAL;        /*!< RTC calibration register,                                 Address offset: 0x3C */\r
508   __IO uint32_t TAFCR;      /*!< RTC tamper and alternate function configuration register, Address offset: 0x40 */\r
509   __IO uint32_t ALRMASSR;   /*!< RTC alarm A sub second register,                          Address offset: 0x44 */\r
510        uint32_t RESERVED3;  /*!< Reserved,                                                 Address offset: 0x48 */\r
511        uint32_t RESERVED4;  /*!< Reserved,                                                 Address offset: 0x4C */\r
512   __IO uint32_t BKP0R;      /*!< RTC backup register 0,                                    Address offset: 0x50 */\r
513   __IO uint32_t BKP1R;      /*!< RTC backup register 1,                                    Address offset: 0x54 */\r
514   __IO uint32_t BKP2R;      /*!< RTC backup register 2,                                    Address offset: 0x58 */\r
515   __IO uint32_t BKP3R;      /*!< RTC backup register 3,                                    Address offset: 0x5C */\r
516   __IO uint32_t BKP4R;      /*!< RTC backup register 4,                                    Address offset: 0x60 */\r
517 } RTC_TypeDef;\r
518 \r
519 \r
520 /** \r
521   * @brief Serial Peripheral Interface\r
522   */\r
523   \r
524 typedef struct\r
525 {\r
526   __IO uint16_t CR1;      /*!< SPI Control register 1 (not used in I2S mode),       Address offset: 0x00 */\r
527   uint16_t  RESERVED0;    /*!< Reserved, 0x02                                                            */\r
528   __IO uint16_t CR2;      /*!< SPI Control register 2,                              Address offset: 0x04 */\r
529   uint16_t  RESERVED1;    /*!< Reserved, 0x06                                                            */\r
530   __IO uint16_t SR;       /*!< SPI Status register,                                 Address offset: 0x08 */\r
531   uint16_t  RESERVED2;    /*!< Reserved, 0x0A                                                            */\r
532   __IO uint16_t DR;       /*!< SPI data register,                                   Address offset: 0x0C */\r
533   uint16_t  RESERVED3;    /*!< Reserved, 0x0E                                                            */\r
534   __IO uint16_t CRCPR;    /*!< SPI CRC polynomial register (not used in I2S mode),  Address offset: 0x10 */\r
535   uint16_t  RESERVED4;    /*!< Reserved, 0x12                                                            */\r
536   __IO uint16_t RXCRCR;   /*!< SPI Rx CRC register (not used in I2S mode),          Address offset: 0x14 */\r
537   uint16_t  RESERVED5;    /*!< Reserved, 0x16                                                            */\r
538   __IO uint16_t TXCRCR;   /*!< SPI Tx CRC register (not used in I2S mode),          Address offset: 0x18 */\r
539   uint16_t  RESERVED6;    /*!< Reserved, 0x1A                                                            */ \r
540   __IO uint16_t I2SCFGR;  /*!< SPI_I2S configuration register,                      Address offset: 0x1C */\r
541   uint16_t  RESERVED7;    /*!< Reserved, 0x1E                                                            */\r
542   __IO uint16_t I2SPR;    /*!< SPI_I2S prescaler register,                          Address offset: 0x20 */\r
543   uint16_t  RESERVED8;    /*!< Reserved, 0x22                                                            */    \r
544 } SPI_TypeDef;\r
545 \r
546 \r
547 /** \r
548   * @brief TIM\r
549   */\r
550 typedef struct\r
551 {\r
552   __IO uint16_t CR1;             /*!< TIM control register 1,                      Address offset: 0x00 */\r
553   uint16_t      RESERVED0;       /*!< Reserved,                                                    0x02 */\r
554   __IO uint16_t CR2;             /*!< TIM control register 2,                      Address offset: 0x04 */\r
555   uint16_t      RESERVED1;       /*!< Reserved,                                                    0x06 */\r
556   __IO uint16_t SMCR;            /*!< TIM slave Mode Control register,             Address offset: 0x08 */\r
557   uint16_t      RESERVED2;       /*!< Reserved,                                                    0x0A */\r
558   __IO uint16_t DIER;            /*!< TIM DMA/interrupt enable register,           Address offset: 0x0C */\r
559   uint16_t      RESERVED3;       /*!< Reserved,                                                    0x0E */\r
560   __IO uint16_t SR;              /*!< TIM status register,                         Address offset: 0x10 */\r
561   uint16_t      RESERVED4;       /*!< Reserved,                                                    0x12 */\r
562   __IO uint16_t EGR;             /*!< TIM event generation register,               Address offset: 0x14 */\r
563   uint16_t      RESERVED5;       /*!< Reserved,                                                    0x16 */\r
564   __IO uint16_t CCMR1;           /*!< TIM  capture/compare mode register 1,        Address offset: 0x18 */\r
565   uint16_t      RESERVED6;       /*!< Reserved,                                                    0x1A */\r
566   __IO uint16_t CCMR2;           /*!< TIM  capture/compare mode register 2,        Address offset: 0x1C */\r
567   uint16_t      RESERVED7;       /*!< Reserved,                                                    0x1E */\r
568   __IO uint16_t CCER;            /*!< TIM capture/compare enable register,         Address offset: 0x20 */\r
569   uint16_t      RESERVED8;       /*!< Reserved,                                                    0x22 */\r
570   __IO uint32_t CNT;             /*!< TIM counter register,                        Address offset: 0x24 */\r
571   __IO uint16_t PSC;             /*!< TIM prescaler register,                      Address offset: 0x28 */\r
572   uint16_t      RESERVED10;      /*!< Reserved,                                                    0x2A */\r
573   __IO uint32_t ARR;             /*!< TIM auto-reload register,                    Address offset: 0x2C */\r
574   __IO uint16_t RCR;             /*!< TIM  repetition counter register,            Address offset: 0x30 */\r
575   uint16_t      RESERVED12;      /*!< Reserved,                                                    0x32 */\r
576   __IO uint32_t CCR1;            /*!< TIM capture/compare register 1,              Address offset: 0x34 */\r
577   __IO uint32_t CCR2;            /*!< TIM capture/compare register 2,              Address offset: 0x38 */\r
578   __IO uint32_t CCR3;            /*!< TIM capture/compare register 3,              Address offset: 0x3C */\r
579   __IO uint32_t CCR4;            /*!< TIM capture/compare register 4,              Address offset: 0x40 */\r
580   __IO uint16_t BDTR;            /*!< TIM break and dead-time register,            Address offset: 0x44 */\r
581   uint16_t      RESERVED17;      /*!< Reserved,                                                    0x26 */\r
582   __IO uint16_t DCR;             /*!< TIM DMA control register,                    Address offset: 0x48 */\r
583   uint16_t      RESERVED18;      /*!< Reserved,                                                    0x4A */\r
584   __IO uint16_t DMAR;            /*!< TIM DMA address for full transfer register,  Address offset: 0x4C */\r
585   uint16_t      RESERVED19;      /*!< Reserved,                                                    0x4E */\r
586   __IO uint16_t OR;              /*!< TIM option register,                         Address offset: 0x50 */\r
587   uint16_t      RESERVED20;      /*!< Reserved,                                                    0x52 */\r
588 } TIM_TypeDef;\r
589 \r
590 /** \r
591   * @brief Touch Sensing Controller (TSC)\r
592   */\r
593 typedef struct\r
594 {\r
595   __IO uint32_t CR;        /*!< TSC control register,                                     Address offset: 0x00 */\r
596   __IO uint32_t IER;       /*!< TSC interrupt enable register,                            Address offset: 0x04 */\r
597   __IO uint32_t ICR;       /*!< TSC interrupt clear register,                             Address offset: 0x08 */ \r
598   __IO uint32_t ISR;       /*!< TSC interrupt status register,                            Address offset: 0x0C */\r
599   __IO uint32_t IOHCR;     /*!< TSC I/O hysteresis control register,                      Address offset: 0x10 */\r
600   __IO uint32_t RESERVED1; /*!< Reserved,                                                 Address offset: 0x14 */\r
601   __IO uint32_t IOASCR;    /*!< TSC I/O analog switch control register,                   Address offset: 0x18 */\r
602   __IO uint32_t RESERVED2; /*!< Reserved,                                                 Address offset: 0x1C */\r
603   __IO uint32_t IOSCR;     /*!< TSC I/O sampling control register,                        Address offset: 0x20 */\r
604   __IO uint32_t RESERVED3; /*!< Reserved,                                                 Address offset: 0x24 */\r
605   __IO uint32_t IOCCR;     /*!< TSC I/O channel control register,                         Address offset: 0x28 */\r
606   __IO uint32_t RESERVED4; /*!< Reserved,                                                 Address offset: 0x2C */\r
607   __IO uint32_t IOGCSR;    /*!< TSC I/O group control status register,                    Address offset: 0x30 */\r
608   __IO uint32_t IOGXCR[6]; /*!< TSC I/O group x counter register,                         Address offset: 0x34-48 */\r
609 } TSC_TypeDef;\r
610 \r
611 /** \r
612   * @brief Universal Synchronous Asynchronous Receiver Transmitter\r
613   */\r
614   \r
615 typedef struct\r
616 {\r
617   __IO uint32_t CR1;    /*!< USART Control register 1,                 Address offset: 0x00 */ \r
618   __IO uint32_t CR2;    /*!< USART Control register 2,                 Address offset: 0x04 */ \r
619   __IO uint32_t CR3;    /*!< USART Control register 3,                 Address offset: 0x08 */\r
620   __IO uint16_t BRR;    /*!< USART Baud rate register,                 Address offset: 0x0C */\r
621   uint16_t  RESERVED1;  /*!< Reserved, 0x0E                                                 */  \r
622   __IO uint16_t GTPR;   /*!< USART Guard time and prescaler register,  Address offset: 0x10 */\r
623   uint16_t  RESERVED2;  /*!< Reserved, 0x12                                                 */\r
624   __IO uint32_t RTOR;   /*!< USART Receiver Time Out register,         Address offset: 0x14 */  \r
625   __IO uint16_t RQR;    /*!< USART Request register,                   Address offset: 0x18 */\r
626   uint16_t  RESERVED3;  /*!< Reserved, 0x1A                                                 */\r
627   __IO uint32_t ISR;    /*!< USART Interrupt and status register,      Address offset: 0x1C */\r
628   __IO uint32_t ICR;    /*!< USART Interrupt flag Clear register,      Address offset: 0x20 */\r
629   __IO uint16_t RDR;    /*!< USART Receive Data register,              Address offset: 0x24 */\r
630   uint16_t  RESERVED4;  /*!< Reserved, 0x26                                                 */\r
631   __IO uint16_t TDR;    /*!< USART Transmit Data register,             Address offset: 0x28 */\r
632   uint16_t  RESERVED5;  /*!< Reserved, 0x2A                                                 */\r
633 } USART_TypeDef;\r
634 \r
635 \r
636 /** \r
637   * @brief Window WATCHDOG\r
638   */\r
639 typedef struct\r
640 {\r
641   __IO uint32_t CR;   /*!< WWDG Control register,       Address offset: 0x00 */\r
642   __IO uint32_t CFR;  /*!< WWDG Configuration register, Address offset: 0x04 */\r
643   __IO uint32_t SR;   /*!< WWDG Status register,        Address offset: 0x08 */\r
644 } WWDG_TypeDef;\r
645 \r
646 \r
647 /**\r
648   * @}\r
649   */\r
650   \r
651 /** @addtogroup Peripheral_memory_map\r
652   * @{\r
653   */\r
654 \r
655 #define FLASH_BASE            ((uint32_t)0x08000000) /*!< FLASH base address in the alias region */\r
656 #define SRAM_BASE             ((uint32_t)0x20000000) /*!< SRAM base address in the alias region */\r
657 #define PERIPH_BASE           ((uint32_t)0x40000000) /*!< Peripheral base address in the alias region */\r
658 \r
659 /*!< Peripheral memory map */\r
660 #define APBPERIPH_BASE        PERIPH_BASE\r
661 #define AHBPERIPH_BASE        (PERIPH_BASE + 0x00020000)\r
662 #define AHB2PERIPH_BASE       (PERIPH_BASE + 0x08000000)\r
663 \r
664 #define TIM2_BASE             (APBPERIPH_BASE + 0x00000000)\r
665 #define TIM3_BASE             (APBPERIPH_BASE + 0x00000400)\r
666 #define TIM6_BASE             (APBPERIPH_BASE + 0x00001000)\r
667 #define TIM14_BASE            (APBPERIPH_BASE + 0x00002000)\r
668 #define RTC_BASE              (APBPERIPH_BASE + 0x00002800)\r
669 #define WWDG_BASE             (APBPERIPH_BASE + 0x00002C00)\r
670 #define IWDG_BASE             (APBPERIPH_BASE + 0x00003000)\r
671 #define SPI2_BASE             (APBPERIPH_BASE + 0x00003800)\r
672 #define USART2_BASE           (APBPERIPH_BASE + 0x00004400)\r
673 #define I2C1_BASE             (APBPERIPH_BASE + 0x00005400)\r
674 #define I2C2_BASE             (APBPERIPH_BASE + 0x00005800)\r
675 #define PWR_BASE              (APBPERIPH_BASE + 0x00007000)\r
676 #define DAC_BASE              (APBPERIPH_BASE + 0x00007400)\r
677 #define CEC_BASE              (APBPERIPH_BASE + 0x00007800)\r
678 \r
679 #define SYSCFG_BASE           (APBPERIPH_BASE + 0x00010000)\r
680 #define COMP_BASE             (APBPERIPH_BASE + 0x0001001C)\r
681 #define EXTI_BASE             (APBPERIPH_BASE + 0x00010400)\r
682 #define ADC1_BASE             (APBPERIPH_BASE + 0x00012400)\r
683 #define ADC_BASE              (APBPERIPH_BASE + 0x00012708)\r
684 #define TIM1_BASE             (APBPERIPH_BASE + 0x00012C00)\r
685 #define SPI1_BASE             (APBPERIPH_BASE + 0x00013000)\r
686 #define USART1_BASE           (APBPERIPH_BASE + 0x00013800)\r
687 #define TIM15_BASE            (APBPERIPH_BASE + 0x00014000)\r
688 #define TIM16_BASE            (APBPERIPH_BASE + 0x00014400)\r
689 #define TIM17_BASE            (APBPERIPH_BASE + 0x00014800)\r
690 #define DBGMCU_BASE           (APBPERIPH_BASE + 0x00015800)\r
691 \r
692 #define DMA1_BASE             (AHBPERIPH_BASE + 0x00000000)\r
693 #define DMA1_Channel1_BASE    (DMA1_BASE + 0x00000008)\r
694 #define DMA1_Channel2_BASE    (DMA1_BASE + 0x0000001C)\r
695 #define DMA1_Channel3_BASE    (DMA1_BASE + 0x00000030)\r
696 #define DMA1_Channel4_BASE    (DMA1_BASE + 0x00000044)\r
697 #define DMA1_Channel5_BASE    (DMA1_BASE + 0x00000058)\r
698 #define RCC_BASE              (AHBPERIPH_BASE + 0x00001000)\r
699 #define FLASH_R_BASE          (AHBPERIPH_BASE + 0x00002000) /*!< FLASH registers base address */\r
700 #define OB_BASE               ((uint32_t)0x1FFFF800)        /*!< FLASH Option Bytes base address */\r
701 #define CRC_BASE              (AHBPERIPH_BASE + 0x00003000)\r
702 #define TSC_BASE              (AHBPERIPH_BASE + 0x00004000)\r
703 \r
704 #define GPIOA_BASE            (AHB2PERIPH_BASE + 0x00000000)\r
705 #define GPIOB_BASE            (AHB2PERIPH_BASE + 0x00000400)\r
706 #define GPIOC_BASE            (AHB2PERIPH_BASE + 0x00000800)\r
707 #define GPIOD_BASE            (AHB2PERIPH_BASE + 0x00000C00)\r
708 #define GPIOF_BASE            (AHB2PERIPH_BASE + 0x00001400)\r
709 \r
710 /**\r
711   * @}\r
712   */\r
713   \r
714 /** @addtogroup Peripheral_declaration\r
715   * @{\r
716   */  \r
717 \r
718 #define TIM2                ((TIM_TypeDef *) TIM2_BASE)\r
719 #define TIM3                ((TIM_TypeDef *) TIM3_BASE)\r
720 #define TIM6                ((TIM_TypeDef *) TIM6_BASE)\r
721 #define TIM14               ((TIM_TypeDef *) TIM14_BASE)\r
722 #define RTC                 ((RTC_TypeDef *) RTC_BASE)\r
723 #define WWDG                ((WWDG_TypeDef *) WWDG_BASE)\r
724 #define IWDG                ((IWDG_TypeDef *) IWDG_BASE)\r
725 #define SPI2                ((SPI_TypeDef *) SPI2_BASE)\r
726 #define USART2              ((USART_TypeDef *) USART2_BASE)\r
727 #define I2C1                ((I2C_TypeDef *) I2C1_BASE)\r
728 #define I2C2                ((I2C_TypeDef *) I2C2_BASE)\r
729 #define PWR                 ((PWR_TypeDef *) PWR_BASE)\r
730 #define DAC                 ((DAC_TypeDef *) DAC_BASE)\r
731 #define CEC                 ((CEC_TypeDef *) CEC_BASE)\r
732 \r
733 #define SYSCFG              ((SYSCFG_TypeDef *) SYSCFG_BASE)\r
734 #define COMP                ((COMP_TypeDef *) COMP_BASE)\r
735 #define EXTI                ((EXTI_TypeDef *) EXTI_BASE)\r
736 #define ADC1                ((ADC_TypeDef *) ADC1_BASE)\r
737 #define ADC                 ((ADC_Common_TypeDef *) ADC_BASE)\r
738 #define TIM1                ((TIM_TypeDef *) TIM1_BASE)\r
739 #define SPI1                ((SPI_TypeDef *) SPI1_BASE)\r
740 #define USART1              ((USART_TypeDef *) USART1_BASE)\r
741 #define TIM15               ((TIM_TypeDef *) TIM15_BASE)\r
742 #define TIM16               ((TIM_TypeDef *) TIM16_BASE)\r
743 #define TIM17               ((TIM_TypeDef *) TIM17_BASE)\r
744 #define DBGMCU              ((DBGMCU_TypeDef *) DBGMCU_BASE)\r
745 \r
746 #define DMA1                ((DMA_TypeDef *) DMA1_BASE)\r
747 #define DMA1_Channel1       ((DMA_Channel_TypeDef *) DMA1_Channel1_BASE)\r
748 #define DMA1_Channel2       ((DMA_Channel_TypeDef *) DMA1_Channel2_BASE)\r
749 #define DMA1_Channel3       ((DMA_Channel_TypeDef *) DMA1_Channel3_BASE)\r
750 #define DMA1_Channel4       ((DMA_Channel_TypeDef *) DMA1_Channel4_BASE)\r
751 #define DMA1_Channel5       ((DMA_Channel_TypeDef *) DMA1_Channel5_BASE)\r
752 #define FLASH               ((FLASH_TypeDef *) FLASH_R_BASE)\r
753 #define OB                  ((OB_TypeDef *) OB_BASE) \r
754 #define RCC                 ((RCC_TypeDef *) RCC_BASE)\r
755 #define CRC                 ((CRC_TypeDef *) CRC_BASE)\r
756 #define TSC                 ((TSC_TypeDef *) TSC_BASE)\r
757 \r
758 #define GPIOA               ((GPIO_TypeDef *) GPIOA_BASE)\r
759 #define GPIOB               ((GPIO_TypeDef *) GPIOB_BASE)\r
760 #define GPIOC               ((GPIO_TypeDef *) GPIOC_BASE)\r
761 #define GPIOD               ((GPIO_TypeDef *) GPIOD_BASE)\r
762 #define GPIOF               ((GPIO_TypeDef *) GPIOF_BASE)\r
763 \r
764 /**\r
765   * @}\r
766   */\r
767 \r
768 /** @addtogroup Exported_constants\r
769   * @{\r
770   */\r
771   \r
772   /** @addtogroup Peripheral_Registers_Bits_Definition\r
773   * @{\r
774   */\r
775     \r
776 /******************************************************************************/\r
777 /*                         Peripheral Registers Bits Definition               */\r
778 /******************************************************************************/\r
779 /******************************************************************************/\r
780 /*                                                                            */\r
781 /*                      Analog to Digital Converter (ADC)                     */\r
782 /*                                                                            */\r
783 /******************************************************************************/\r
784 /********************  Bits definition for ADC_ISR register  ******************/\r
785 #define ADC_ISR_AWD                          ((uint32_t)0x00000080)        /*!< Analog watchdog flag */\r
786 #define ADC_ISR_OVR                          ((uint32_t)0x00000010)        /*!< Overrun flag */\r
787 #define ADC_ISR_EOS                          ((uint32_t)0x00000008)        /*!< End of Sequence flag */\r
788 #define ADC_ISR_EOC                          ((uint32_t)0x00000004)        /*!< End of Conversion */\r
789 #define ADC_ISR_EOSMP                        ((uint32_t)0x00000002)        /*!< End of sampling flag */\r
790 #define ADC_ISR_ADRDY                        ((uint32_t)0x00000001)        /*!< ADC Ready */\r
791 \r
792 /********************  Bits definition for ADC_IER register  ******************/\r
793 #define ADC_IER_AWDIE                        ((uint32_t)0x00000080)        /*!< Analog Watchdog interrupt enable */\r
794 #define ADC_IER_OVRIE                        ((uint32_t)0x00000010)        /*!< Overrun interrupt enable */\r
795 #define ADC_IER_EOSIE                        ((uint32_t)0x00000008)        /*!< End of Sequence of conversion interrupt enable */\r
796 #define ADC_IER_EOCIE                        ((uint32_t)0x00000004)        /*!< End of Conversion interrupt enable */\r
797 #define ADC_IER_EOSMPIE                      ((uint32_t)0x00000002)        /*!< End of sampling interrupt enable */\r
798 #define ADC_IER_ADRDYIE                      ((uint32_t)0x00000001)        /*!< ADC Ready interrupt enable */\r
799 \r
800 /********************  Bits definition for ADC_CR register  *******************/\r
801 #define ADC_CR_ADCAL                         ((uint32_t)0x80000000)        /*!< ADC calibration */\r
802 #define ADC_CR_ADSTP                         ((uint32_t)0x00000010)        /*!< ADC stop of conversion command */\r
803 #define ADC_CR_ADSTART                       ((uint32_t)0x00000004)        /*!< ADC start of conversion */\r
804 #define ADC_CR_ADDIS                         ((uint32_t)0x00000002)        /*!< ADC disable command */\r
805 #define ADC_CR_ADEN                          ((uint32_t)0x00000001)        /*!< ADC enable control */\r
806 \r
807 /*******************  Bits definition for ADC_CFGR1 register  *****************/\r
808 #define  ADC_CFGR1_AWDCH                      ((uint32_t)0x7C000000)       /*!< AWDCH[4:0] bits (Analog watchdog channel select bits) */\r
809 #define  ADC_CFGR1_AWDCH_0                    ((uint32_t)0x04000000)       /*!< Bit 0 */\r
810 #define  ADC_CFGR1_AWDCH_1                    ((uint32_t)0x08000000)       /*!< Bit 1 */\r
811 #define  ADC_CFGR1_AWDCH_2                    ((uint32_t)0x10000000)       /*!< Bit 2 */\r
812 #define  ADC_CFGR1_AWDCH_3                    ((uint32_t)0x20000000)       /*!< Bit 3 */\r
813 #define  ADC_CFGR1_AWDCH_4                    ((uint32_t)0x40000000)       /*!< Bit 4 */\r
814 #define  ADC_CFGR1_AWDEN                      ((uint32_t)0x00800000)       /*!< Analog watchdog enable on regular channels */\r
815 #define  ADC_CFGR1_AWDSGL                     ((uint32_t)0x00400000)       /*!< Enable the watchdog on a single channel or on all channels  */\r
816 #define  ADC_CFGR1_DISCEN                     ((uint32_t)0x00010000)       /*!< Discontinuous mode on regular channels */\r
817 #define  ADC_CFGR1_AUTOFF                     ((uint32_t)0x00008000)       /*!< ADC auto power off */\r
818 #define  ADC_CFGR1_AUTDLY                     ((uint32_t)0x00004000)       /*!< ADC delayed conversion mode */\r
819 #define  ADC_CFGR1_CONT                       ((uint32_t)0x00002000)       /*!< Continuous Conversion */\r
820 #define  ADC_CFGR1_OVRMOD                     ((uint32_t)0x00001000)       /*!< Overrun mode */\r
821 #define  ADC_CFGR1_EXTEN                      ((uint32_t)0x00000C00)       /*!< EXTEN[1:0] bits (External Trigger Conversion mode for regular channels) */\r
822 #define  ADC_CFGR1_EXTEN_0                    ((uint32_t)0x00000400)       /*!< Bit 0 */\r
823 #define  ADC_CFGR1_EXTEN_1                    ((uint32_t)0x00000800)       /*!< Bit 1 */\r
824 #define  ADC_CFGR1_EXTSEL                     ((uint32_t)0x000001C0)       /*!< EXTSEL[2:0] bits (External Event Select for regular group) */\r
825 #define  ADC_CFGR1_EXTSEL_0                   ((uint32_t)0x00000040)       /*!< Bit 0 */\r
826 #define  ADC_CFGR1_EXTSEL_1                   ((uint32_t)0x00000080)       /*!< Bit 1 */\r
827 #define  ADC_CFGR1_EXTSEL_2                   ((uint32_t)0x00000100)       /*!< Bit 2 */\r
828 #define  ADC_CFGR1_ALIGN                      ((uint32_t)0x00000020)       /*!< Data Alignment */\r
829 #define  ADC_CFGR1_RES                        ((uint32_t)0x00000018)       /*!< RES[1:0] bits (Resolution) */\r
830 #define  ADC_CFGR1_RES_0                      ((uint32_t)0x00000008)       /*!< Bit 0 */\r
831 #define  ADC_CFGR1_RES_1                      ((uint32_t)0x00000010)       /*!< Bit 1 */\r
832 #define  ADC_CFGR1_SCANDIR                    ((uint32_t)0x00000004)       /*!< Sequence scan direction */\r
833 #define  ADC_CFGR1_DMACFG                     ((uint32_t)0x00000002)       /*!< Direct memory access configuration */\r
834 #define  ADC_CFGR1_DMAEN                      ((uint32_t)0x00000001)       /*!< Direct memory access enable */\r
835 \r
836 /*******************  Bits definition for ADC_CFGR2 register  *****************/\r
837 #define  ADC_CFGR2_JITOFFDIV4                 ((uint32_t)0x80000000)       /*!< Jitter Off when ADC clocked by PCLK div4 */\r
838 #define  ADC_CFGR2_JITOFFDIV2                 ((uint32_t)0x40000000)       /*!< Jitter Off when ADC clocked by PCLK div2 */\r
839 \r
840 /******************  Bit definition for ADC_SMPR register  ********************/\r
841 #define  ADC_SMPR1_SMPR                      ((uint32_t)0x00000007)        /*!< SMPR[2:0] bits (Sampling time selection) */\r
842 #define  ADC_SMPR1_SMPR_0                    ((uint32_t)0x00000001)        /*!< Bit 0 */\r
843 #define  ADC_SMPR1_SMPR_1                    ((uint32_t)0x00000002)        /*!< Bit 1 */\r
844 #define  ADC_SMPR1_SMPR_2                    ((uint32_t)0x00000004)        /*!< Bit 2 */\r
845 \r
846 /*******************  Bit definition for ADC_HTR register  ********************/\r
847 #define  ADC_HTR_HT                          ((uint32_t)0x00000FFF)        /*!< Analog watchdog high threshold */\r
848 \r
849 /*******************  Bit definition for ADC_LTR register  ********************/\r
850 #define  ADC_LTR_LT                          ((uint32_t)0x00000FFF)        /*!< Analog watchdog low threshold */\r
851 \r
852 /******************  Bit definition for ADC_CHSELR register  ******************/\r
853 #define  ADC_CHSELR_CHSEL18                   ((uint32_t)0x00040000)        /*!< Channel 18 selection */\r
854 #define  ADC_CHSELR_CHSEL17                   ((uint32_t)0x00020000)        /*!< Channel 17 selection */\r
855 #define  ADC_CHSELR_CHSEL16                   ((uint32_t)0x00010000)        /*!< Channel 16 selection */\r
856 #define  ADC_CHSELR_CHSEL15                   ((uint32_t)0x00008000)        /*!< Channel 15 selection */\r
857 #define  ADC_CHSELR_CHSEL14                   ((uint32_t)0x00004000)        /*!< Channel 14 selection */\r
858 #define  ADC_CHSELR_CHSEL13                   ((uint32_t)0x00002000)        /*!< Channel 13 selection */\r
859 #define  ADC_CHSELR_CHSEL12                   ((uint32_t)0x00001000)        /*!< Channel 12 selection */\r
860 #define  ADC_CHSELR_CHSEL11                   ((uint32_t)0x00000800)        /*!< Channel 11 selection */\r
861 #define  ADC_CHSELR_CHSEL10                   ((uint32_t)0x00000400)        /*!< Channel 10 selection */\r
862 #define  ADC_CHSELR_CHSEL9                    ((uint32_t)0x00000200)        /*!< Channel 9 selection */\r
863 #define  ADC_CHSELR_CHSEL8                    ((uint32_t)0x00000100)        /*!< Channel 8 selection */\r
864 #define  ADC_CHSELR_CHSEL7                    ((uint32_t)0x00000080)        /*!< Channel 7 selection */\r
865 #define  ADC_CHSELR_CHSEL6                    ((uint32_t)0x00000040)        /*!< Channel 6 selection */\r
866 #define  ADC_CHSELR_CHSEL5                    ((uint32_t)0x00000020)        /*!< Channel 5 selection */\r
867 #define  ADC_CHSELR_CHSEL4                    ((uint32_t)0x00000010)        /*!< Channel 4 selection */\r
868 #define  ADC_CHSELR_CHSEL3                    ((uint32_t)0x00000008)        /*!< Channel 3 selection */\r
869 #define  ADC_CHSELR_CHSEL2                    ((uint32_t)0x00000004)        /*!< Channel 2 selection */\r
870 #define  ADC_CHSELR_CHSEL1                    ((uint32_t)0x00000002)        /*!< Channel 1 selection */\r
871 #define  ADC_CHSELR_CHSEL0                    ((uint32_t)0x00000001)        /*!< Channel 0 selection */\r
872 \r
873 /********************  Bit definition for ADC_DR register  ********************/\r
874 #define  ADC_DR_DATA                         ((uint32_t)0x0000FFFF)        /*!< Regular data */\r
875 \r
876 /*******************  Bit definition for ADC_CCR register  ********************/\r
877 #define  ADC_CCR_VBATEN                       ((uint32_t)0x01000000)       /*!< Voltage battery enable */\r
878 #define  ADC_CCR_TSEN                         ((uint32_t)0x00800000)       /*!< Tempurature sensore enable */\r
879 #define  ADC_CCR_VREFEN                       ((uint32_t)0x00400000)       /*!< Vrefint enable */\r
880 \r
881 /******************************************************************************/\r
882 /*                                                                            */\r
883 /*                                 HDMI-CEC (CEC)                             */\r
884 /*                                                                            */\r
885 /******************************************************************************/\r
886 \r
887 /*******************  Bit definition for CEC_CR register  *********************/\r
888 #define  CEC_CR_CECEN                        ((uint32_t)0x00000001)       /*!< CEC Enable                         */\r
889 #define  CEC_CR_TXSOM                        ((uint32_t)0x00000002)       /*!< CEC Tx Start Of Message            */\r
890 #define  CEC_CR_TXEOM                        ((uint32_t)0x00000004)       /*!< CEC Tx End Of Message              */\r
891 \r
892 /*******************  Bit definition for CEC_CFGR register  *******************/\r
893 #define  CEC_CFGR_SFT                        ((uint32_t)0x00000007)       /*!< CEC Signal Free Time               */\r
894 #define  CEC_CFGR_RXTOL                      ((uint32_t)0x00000008)       /*!< CEC Tolerance                      */\r
895 #define  CEC_CFGR_BRESTP                     ((uint32_t)0x00000010)       /*!< CEC Rx Stop                        */\r
896 #define  CEC_CFGR_BREGEN                     ((uint32_t)0x00000020)       /*!< CEC Bit Rising Error generation    */\r
897 #define  CEC_CFGR_LREGEN                     ((uint32_t)0x00000040)       /*!< CEC Long Period Error generation   */\r
898 #define  CEC_CFGR_BRDNOGEN                   ((uint32_t)0x00000080)       /*!< CEC Broadcast no Error generation  */\r
899 #define  CEC_CFGR_SFTOPT                     ((uint32_t)0x00000100)       /*!< CEC Signal Free Time optional      */\r
900 #define  CEC_CFGR_OAR                        ((uint32_t)0x7FFF0000)       /*!< CEC Own Address                    */\r
901 #define  CEC_CFGR_LSTN                       ((uint32_t)0x80000000)       /*!< CEC Listen mode                    */\r
902 \r
903 /*******************  Bit definition for CEC_TXDR register  *******************/\r
904 #define  CEC_TXDR_TXD                        ((uint32_t)0x000000FF)       /*!< CEC Tx Data                        */\r
905 \r
906 /*******************  Bit definition for CEC_RXDR register  *******************/\r
907 #define  CEC_TXDR_RXD                        ((uint32_t)0x000000FF)       /*!< CEC Rx Data                        */\r
908 \r
909 /*******************  Bit definition for CEC_ISR register  ********************/\r
910 #define  CEC_ISR_RXBR                        ((uint32_t)0x00000001)       /*!< CEC Rx-Byte Received                   */\r
911 #define  CEC_ISR_RXEND                       ((uint32_t)0x00000002)       /*!< CEC End Of Reception                   */\r
912 #define  CEC_ISR_RXOVR                       ((uint32_t)0x00000004)       /*!< CEC Rx-Overrun                         */\r
913 #define  CEC_ISR_BRE                         ((uint32_t)0x00000008)       /*!< CEC Rx Bit Rising Error                */\r
914 #define  CEC_ISR_SBPE                        ((uint32_t)0x00000010)       /*!< CEC Rx Short Bit period Error          */\r
915 #define  CEC_ISR_LBPE                        ((uint32_t)0x00000020)       /*!< CEC Rx Long Bit period Error           */\r
916 #define  CEC_ISR_RXACKE                      ((uint32_t)0x00000040)       /*!< CEC Rx Missing Acknowledge             */\r
917 #define  CEC_ISR_ARBLST                      ((uint32_t)0x00000080)       /*!< CEC Arbitration Lost                   */\r
918 #define  CEC_ISR_TXBR                        ((uint32_t)0x00000100)       /*!< CEC Tx Byte Request                    */\r
919 #define  CEC_ISR_TXEND                       ((uint32_t)0x00000200)       /*!< CEC End of Transmission                */\r
920 #define  CEC_ISR_TXUDR                       ((uint32_t)0x00000400)       /*!< CEC Tx-Buffer Underrun                 */\r
921 #define  CEC_ISR_TXERR                       ((uint32_t)0x00000800)       /*!< CEC Tx-Error                           */\r
922 #define  CEC_ISR_TXACKE                      ((uint32_t)0x00001000)       /*!< CEC Tx Missing Acknowledge             */\r
923 \r
924 /*******************  Bit definition for CEC_IER register  ********************/\r
925 #define  CEC_IER_RXBRIE                      ((uint32_t)0x00000001)       /*!< CEC Rx-Byte Received IT Enable         */\r
926 #define  CEC_IER_RXENDIE                     ((uint32_t)0x00000002)       /*!< CEC End Of Reception IT Enable         */\r
927 #define  CEC_IER_RXOVRIE                     ((uint32_t)0x00000004)       /*!< CEC Rx-Overrun IT Enable               */\r
928 #define  CEC_IER_BREIEIE                     ((uint32_t)0x00000008)       /*!< CEC Rx Bit Rising Error IT Enable      */\r
929 #define  CEC_IER_SBPEIE                      ((uint32_t)0x00000010)       /*!< CEC Rx Short Bit period Error IT Enable*/\r
930 #define  CEC_IER_LBPEIE                      ((uint32_t)0x00000020)       /*!< CEC Rx Long Bit period Error IT Enable */\r
931 #define  CEC_IER_RXACKEIE                    ((uint32_t)0x00000040)       /*!< CEC Rx Missing Acknowledge IT Enable   */\r
932 #define  CEC_IER_ARBLSTIE                    ((uint32_t)0x00000080)       /*!< CEC Arbitration Lost IT Enable         */\r
933 #define  CEC_IER_TXBRIE                      ((uint32_t)0x00000100)       /*!< CEC Tx Byte Request  IT Enable         */\r
934 #define  CEC_IER_TXENDIE                     ((uint32_t)0x00000200)       /*!< CEC End of Transmission IT Enable      */\r
935 #define  CEC_IER_TXUDRIE                     ((uint32_t)0x00000400)       /*!< CEC Tx-Buffer Underrun IT Enable       */\r
936 #define  CEC_IER_TXERRIE                     ((uint32_t)0x00000800)       /*!< CEC Tx-Error IT Enable                 */\r
937 #define  CEC_IER_TXACKEIE                    ((uint32_t)0x00001000)       /*!< CEC Tx Missing Acknowledge IT Enable   */\r
938 \r
939 /******************************************************************************/\r
940 /*                                                                            */\r
941 /*                      Analog Comparators (COMP)                             */\r
942 /*                                                                            */\r
943 /******************************************************************************/\r
944 /***********************  Bit definition for COMP_CSR register  ***************/\r
945 /* COMP1 bits definition */\r
946 #define COMP_CSR_COMP1EN               ((uint32_t)0x00000001) /*!< COMP1 enable */\r
947 #define COMP_CSR_COMP1SW1              ((uint32_t)0x00000002) /*!< SW1 switch control */\r
948 #define COMP_CSR_COMP1MODE             ((uint32_t)0x0000000C) /*!< COMP1 power mode */\r
949 #define COMP_CSR_COMP1MODE_0           ((uint32_t)0x00000004) /*!< COMP1 power mode bit 0 */\r
950 #define COMP_CSR_COMP1MODE_1           ((uint32_t)0x00000008) /*!< COMP1 power mode bit 1 */\r
951 #define COMP_CSR_COMP1INSEL            ((uint32_t)0x00000070) /*!< COMP1 inverting input select */\r
952 #define COMP_CSR_COMP1INSEL_0          ((uint32_t)0x00000010) /*!< COMP1 inverting input select bit 0 */\r
953 #define COMP_CSR_COMP1INSEL_1          ((uint32_t)0x00000020) /*!< COMP1 inverting input select bit 1 */\r
954 #define COMP_CSR_COMP1INSEL_2          ((uint32_t)0x00000040) /*!< COMP1 inverting input select bit 2 */\r
955 #define COMP_CSR_COMP1OUTSEL           ((uint32_t)0x00000700) /*!< COMP1 output select */\r
956 #define COMP_CSR_COMP1OUTSEL_0         ((uint32_t)0x00000100) /*!< COMP1 output select bit 0 */\r
957 #define COMP_CSR_COMP1OUTSEL_1         ((uint32_t)0x00000200) /*!< COMP1 output select bit 1 */\r
958 #define COMP_CSR_COMP1OUTSEL_2         ((uint32_t)0x00000400) /*!< COMP1 output select bit 2 */\r
959 #define COMP_CSR_COMP1POL              ((uint32_t)0x00000800) /*!< COMP1 output polarity */\r
960 #define COMP_CSR_COMP1HYST             ((uint32_t)0x00003000) /*!< COMP1 hysteresis */\r
961 #define COMP_CSR_COMP1HYST_0           ((uint32_t)0x00001000) /*!< COMP1 hysteresis bit 0 */\r
962 #define COMP_CSR_COMP1HYST_1           ((uint32_t)0x00002000) /*!< COMP1 hysteresis bit 1 */\r
963 #define COMP_CSR_COMP1OUT              ((uint32_t)0x00004000) /*!< COMP1 output level */\r
964 #define COMP_CSR_COMP1LOCK             ((uint32_t)0x00008000) /*!< COMP1 lock */\r
965 /* COMP2 bits definition */\r
966 #define COMP_CSR_COMP2EN               ((uint32_t)0x00010000) /*!< COMP2 enable */\r
967 #define COMP_CSR_COMP2MODE             ((uint32_t)0x000C0000) /*!< COMP2 power mode */\r
968 #define COMP_CSR_COMP2MODE_0           ((uint32_t)0x00040000) /*!< COMP2 power mode bit 0 */\r
969 #define COMP_CSR_COMP2MODE_1           ((uint32_t)0x00080000) /*!< COMP2 power mode bit 1 */\r
970 #define COMP_CSR_COMP2INSEL            ((uint32_t)0x00700000) /*!< COMP2 inverting input select */\r
971 #define COMP_CSR_COMP2INSEL_0          ((uint32_t)0x00100000) /*!< COMP2 inverting input select bit 0 */\r
972 #define COMP_CSR_COMP2INSEL_1          ((uint32_t)0x00200000) /*!< COMP2 inverting input select bit 1 */\r
973 #define COMP_CSR_COMP2INSEL_2          ((uint32_t)0x00400000) /*!< COMP2 inverting input select bit 2 */\r
974 #define COMP_CSR_WNDWEN                ((uint32_t)0x00800000) /*!< Comparators window mode enable */\r
975 #define COMP_CSR_COMP2OUTSEL           ((uint32_t)0x07000000) /*!< COMP2 output select */\r
976 #define COMP_CSR_COMP2OUTSEL_0         ((uint32_t)0x01000000) /*!< COMP2 output select bit 0 */\r
977 #define COMP_CSR_COMP2OUTSEL_1         ((uint32_t)0x02000000) /*!< COMP2 output select bit 1 */\r
978 #define COMP_CSR_COMP2OUTSEL_2         ((uint32_t)0x04000000) /*!< COMP2 output select bit 2 */\r
979 #define COMP_CSR_COMP2POL              ((uint32_t)0x08000000) /*!< COMP2 output polarity */\r
980 #define COMP_CSR_COMP2HYST             ((uint32_t)0x30000000) /*!< COMP2 hysteresis */\r
981 #define COMP_CSR_COMP2HYST_0           ((uint32_t)0x10000000) /*!< COMP2 hysteresis bit 0 */\r
982 #define COMP_CSR_COMP2HYST_1           ((uint32_t)0x20000000) /*!< COMP2 hysteresis bit 1 */\r
983 #define COMP_CSR_COMP2OUT              ((uint32_t)0x40000000) /*!< COMP2 output level */\r
984 #define COMP_CSR_COMP2LOCK             ((uint32_t)0x80000000) /*!< COMP2 lock */\r
985 \r
986 /******************************************************************************/\r
987 /*                                                                            */\r
988 /*                       CRC calculation unit (CRC)                           */\r
989 /*                                                                            */\r
990 /******************************************************************************/\r
991 /*******************  Bit definition for CRC_DR register  *********************/\r
992 #define  CRC_DR_DR                           ((uint32_t)0xFFFFFFFF) /*!< Data register bits */\r
993 \r
994 /*******************  Bit definition for CRC_IDR register  ********************/\r
995 #define  CRC_IDR_IDR                         ((uint8_t)0xFF)        /*!< General-purpose 8-bit data register bits */\r
996 \r
997 /********************  Bit definition for CRC_CR register  ********************/\r
998 #define  CRC_CR_RESET                        ((uint32_t)0x00000001) /*!< RESET the CRC computation unit bit */\r
999 #define  CRC_CR_REV_IN                       ((uint32_t)0x00000060) /*!< REV_IN Reverse Input Data bits */\r
1000 #define  CRC_CR_REV_IN_0                     ((uint32_t)0x00000020) /*!< REV_IN Bit 0 */\r
1001 #define  CRC_CR_REV_IN_1                     ((uint32_t)0x00000040) /*!< REV_IN Bit 1 */\r
1002 #define  CRC_CR_REV_OUT                      ((uint32_t)0x00000080) /*!< REV_OUT Reverse Output Data bits */\r
1003 \r
1004 /*******************  Bit definition for CRC_INIT register  *******************/\r
1005 #define  CRC_INIT_INIT                       ((uint32_t)0xFFFFFFFF) /*!< Initial CRC value bits */\r
1006 \r
1007 /******************************************************************************/\r
1008 /*                                                                            */\r
1009 /*                    Digital to Analog Converter (DAC)                       */\r
1010 /*                                                                            */\r
1011 /******************************************************************************/\r
1012 /********************  Bit definition for DAC_CR register  ********************/\r
1013 #define  DAC_CR_EN1                          ((uint32_t)0x00000001)        /*!<DAC channel1 enable */\r
1014 #define  DAC_CR_BOFF1                        ((uint32_t)0x00000002)        /*!<DAC channel1 output buffer disable */\r
1015 #define  DAC_CR_TEN1                         ((uint32_t)0x00000004)        /*!<DAC channel1 Trigger enable */\r
1016 \r
1017 #define  DAC_CR_TSEL1                        ((uint32_t)0x00000038)        /*!<TSEL1[2:0] (DAC channel1 Trigger selection) */\r
1018 #define  DAC_CR_TSEL1_0                      ((uint32_t)0x00000008)        /*!<Bit 0 */\r
1019 #define  DAC_CR_TSEL1_1                      ((uint32_t)0x00000010)        /*!<Bit 1 */\r
1020 #define  DAC_CR_TSEL1_2                      ((uint32_t)0x00000020)        /*!<Bit 2 */\r
1021 \r
1022 #define  DAC_CR_DMAEN1                       ((uint32_t)0x00001000)        /*!<DAC channel1 DMA enable */\r
1023 #define  DAC_CR_DMAUDRIE1                    ((uint32_t)0x00002000)        /*!<DAC channel1 DMA Underrun Interrupt enable */\r
1024 /*****************  Bit definition for DAC_SWTRIGR register  ******************/\r
1025 #define  DAC_SWTRIGR_SWTRIG1                 ((uint32_t)0x00000001)        /*!<DAC channel1 software trigger */\r
1026 \r
1027 /*****************  Bit definition for DAC_DHR12R1 register  ******************/\r
1028 #define  DAC_DHR12R1_DACC1DHR                ((uint32_t)0x00000FFF)        /*!<DAC channel1 12-bit Right aligned data */\r
1029 \r
1030 /*****************  Bit definition for DAC_DHR12L1 register  ******************/\r
1031 #define  DAC_DHR12L1_DACC1DHR                ((uint32_t)0x0000FFF0)        /*!<DAC channel1 12-bit Left aligned data */\r
1032 \r
1033 /******************  Bit definition for DAC_DHR8R1 register  ******************/\r
1034 #define  DAC_DHR8R1_DACC1DHR                 ((uint32_t)0x000000FF)         /*!<DAC channel1 8-bit Right aligned data */\r
1035 \r
1036 /*******************  Bit definition for DAC_DOR1 register  *******************/\r
1037 #define  DAC_DOR1_DACC1DOR                   ((uint32_t)0x00000FFF)        /*!<DAC channel1 data output */\r
1038 \r
1039 /********************  Bit definition for DAC_SR register  ********************/\r
1040 #define  DAC_SR_DMAUDR1                      ((uint32_t)0x00002000)        /*!<DAC channel1 DMA underrun flag */\r
1041 \r
1042 \r
1043 /******************************************************************************/\r
1044 /*                                                                            */\r
1045 /*                           Debug MCU (DBGMCU)                               */\r
1046 /*                                                                            */\r
1047 /******************************************************************************/\r
1048 \r
1049 /****************  Bit definition for DBGMCU_IDCODE register  *****************/\r
1050 #define  DBGMCU_IDCODE_DEV_ID                ((uint32_t)0x00000FFF)        /*!< Device Identifier */\r
1051 \r
1052 #define  DBGMCU_IDCODE_REV_ID                ((uint32_t)0xFFFF0000)        /*!< REV_ID[15:0] bits (Revision Identifier) */\r
1053 #define  DBGMCU_IDCODE_REV_ID_0              ((uint32_t)0x00010000)        /*!< Bit 0 */\r
1054 #define  DBGMCU_IDCODE_REV_ID_1              ((uint32_t)0x00020000)        /*!< Bit 1 */\r
1055 #define  DBGMCU_IDCODE_REV_ID_2              ((uint32_t)0x00040000)        /*!< Bit 2 */\r
1056 #define  DBGMCU_IDCODE_REV_ID_3              ((uint32_t)0x00080000)        /*!< Bit 3 */\r
1057 #define  DBGMCU_IDCODE_REV_ID_4              ((uint32_t)0x00100000)        /*!< Bit 4 */\r
1058 #define  DBGMCU_IDCODE_REV_ID_5              ((uint32_t)0x00200000)        /*!< Bit 5 */\r
1059 #define  DBGMCU_IDCODE_REV_ID_6              ((uint32_t)0x00400000)        /*!< Bit 6 */\r
1060 #define  DBGMCU_IDCODE_REV_ID_7              ((uint32_t)0x00800000)        /*!< Bit 7 */\r
1061 #define  DBGMCU_IDCODE_REV_ID_8              ((uint32_t)0x01000000)        /*!< Bit 8 */\r
1062 #define  DBGMCU_IDCODE_REV_ID_9              ((uint32_t)0x02000000)        /*!< Bit 9 */\r
1063 #define  DBGMCU_IDCODE_REV_ID_10             ((uint32_t)0x04000000)        /*!< Bit 10 */\r
1064 #define  DBGMCU_IDCODE_REV_ID_11             ((uint32_t)0x08000000)        /*!< Bit 11 */\r
1065 #define  DBGMCU_IDCODE_REV_ID_12             ((uint32_t)0x10000000)        /*!< Bit 12 */\r
1066 #define  DBGMCU_IDCODE_REV_ID_13             ((uint32_t)0x20000000)        /*!< Bit 13 */\r
1067 #define  DBGMCU_IDCODE_REV_ID_14             ((uint32_t)0x40000000)        /*!< Bit 14 */\r
1068 #define  DBGMCU_IDCODE_REV_ID_15             ((uint32_t)0x80000000)        /*!< Bit 15 */\r
1069 \r
1070 /******************  Bit definition for DBGMCU_CR register  *******************/\r
1071 #define  DBGMCU_CR_DBG_STOP                  ((uint32_t)0x00000002)        /*!< Debug Stop Mode */\r
1072 #define  DBGMCU_CR_DBG_STANDBY               ((uint32_t)0x00000004)        /*!< Debug Standby mode */\r
1073 \r
1074 /******************  Bit definition for DBGMCU_APB1_FZ register  **************/\r
1075 #define  DBGMCU_APB1_FZ_DBG_TIM2_STOP        ((uint32_t)0x00000001)        /*!< TIM2 counter stopped when core is halted */\r
1076 #define  DBGMCU_APB1_FZ_DBG_TIM3_STOP        ((uint32_t)0x00000002)        /*!< TIM3 counter stopped when core is halted */\r
1077 #define  DBGMCU_APB1_FZ_DBG_TIM6_STOP        ((uint32_t)0x00000010)        /*!< TIM6 counter stopped when core is halted */\r
1078 #define  DBGMCU_APB1_FZ_DBG_TIM14_STOP       ((uint32_t)0x00000100)        /*!< TIM14 counter stopped when core is halted */\r
1079 #define  DBGMCU_APB1_FZ_DBG_RTC_STOP         ((uint32_t)0x00000400)        /*!< RTC Calendar frozen when core is halted */\r
1080 #define  DBGMCU_APB1_FZ_DBG_WWDG_STOP        ((uint32_t)0x00000800)        /*!< Debug Window Watchdog stopped when Core is halted */\r
1081 #define  DBGMCU_APB1_FZ_DBG_IWDG_STOP        ((uint32_t)0x00001000)        /*!< Debug Independent Watchdog stopped when Core is halted */\r
1082 #define  DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT    ((uint32_t)0x00200000)   /*!< I2C1 SMBUS timeout mode stopped when Core is halted */\r
1083 \r
1084 /******************  Bit definition for DBGMCU_APB2_FZ register  **************/\r
1085 #define  DBGMCU_APB2_FZ_DBG_TIM1_STOP        ((uint32_t)0x00000800)        /*!< TIM1 counter stopped when core is halted */\r
1086 #define  DBGMCU_APB2_FZ_DBG_TIM15_STOP       ((uint32_t)0x00010000)        /*!< TIM15 counter stopped when core is halted */\r
1087 #define  DBGMCU_APB2_FZ_DBG_TIM16_STOP       ((uint32_t)0x00020000)        /*!< TIM16 counter stopped when core is halted */\r
1088 #define  DBGMCU_APB2_FZ_DBG_TIM17_STOP       ((uint32_t)0x00040000)        /*!< TIM17 counter stopped when core is halted */\r
1089 \r
1090 /******************************************************************************/\r
1091 /*                                                                            */\r
1092 /*                           DMA Controller (DMA)                             */\r
1093 /*                                                                            */\r
1094 /******************************************************************************/\r
1095 \r
1096 /*******************  Bit definition for DMA_ISR register  ********************/\r
1097 #define  DMA_ISR_GIF1                        ((uint32_t)0x00000001)        /*!< Channel 1 Global interrupt flag    */\r
1098 #define  DMA_ISR_TCIF1                       ((uint32_t)0x00000002)        /*!< Channel 1 Transfer Complete flag   */\r
1099 #define  DMA_ISR_HTIF1                       ((uint32_t)0x00000004)        /*!< Channel 1 Half Transfer flag       */\r
1100 #define  DMA_ISR_TEIF1                       ((uint32_t)0x00000008)        /*!< Channel 1 Transfer Error flag      */\r
1101 #define  DMA_ISR_GIF2                        ((uint32_t)0x00000010)        /*!< Channel 2 Global interrupt flag    */\r
1102 #define  DMA_ISR_TCIF2                       ((uint32_t)0x00000020)        /*!< Channel 2 Transfer Complete flag   */\r
1103 #define  DMA_ISR_HTIF2                       ((uint32_t)0x00000040)        /*!< Channel 2 Half Transfer flag       */\r
1104 #define  DMA_ISR_TEIF2                       ((uint32_t)0x00000080)        /*!< Channel 2 Transfer Error flag      */\r
1105 #define  DMA_ISR_GIF3                        ((uint32_t)0x00000100)        /*!< Channel 3 Global interrupt flag    */\r
1106 #define  DMA_ISR_TCIF3                       ((uint32_t)0x00000200)        /*!< Channel 3 Transfer Complete flag   */\r
1107 #define  DMA_ISR_HTIF3                       ((uint32_t)0x00000400)        /*!< Channel 3 Half Transfer flag       */\r
1108 #define  DMA_ISR_TEIF3                       ((uint32_t)0x00000800)        /*!< Channel 3 Transfer Error flag      */\r
1109 #define  DMA_ISR_GIF4                        ((uint32_t)0x00001000)        /*!< Channel 4 Global interrupt flag    */\r
1110 #define  DMA_ISR_TCIF4                       ((uint32_t)0x00002000)        /*!< Channel 4 Transfer Complete flag   */\r
1111 #define  DMA_ISR_HTIF4                       ((uint32_t)0x00004000)        /*!< Channel 4 Half Transfer flag       */\r
1112 #define  DMA_ISR_TEIF4                       ((uint32_t)0x00008000)        /*!< Channel 4 Transfer Error flag      */\r
1113 #define  DMA_ISR_GIF5                        ((uint32_t)0x00010000)        /*!< Channel 5 Global interrupt flag    */\r
1114 #define  DMA_ISR_TCIF5                       ((uint32_t)0x00020000)        /*!< Channel 5 Transfer Complete flag   */\r
1115 #define  DMA_ISR_HTIF5                       ((uint32_t)0x00040000)        /*!< Channel 5 Half Transfer flag       */\r
1116 #define  DMA_ISR_TEIF5                       ((uint32_t)0x00080000)        /*!< Channel 5 Transfer Error flag      */\r
1117 \r
1118 /*******************  Bit definition for DMA_IFCR register  *******************/\r
1119 #define  DMA_IFCR_CGIF1                      ((uint32_t)0x00000001)        /*!< Channel 1 Global interrupt clear    */\r
1120 #define  DMA_IFCR_CTCIF1                     ((uint32_t)0x00000002)        /*!< Channel 1 Transfer Complete clear   */\r
1121 #define  DMA_IFCR_CHTIF1                     ((uint32_t)0x00000004)        /*!< Channel 1 Half Transfer clear       */\r
1122 #define  DMA_IFCR_CTEIF1                     ((uint32_t)0x00000008)        /*!< Channel 1 Transfer Error clear      */\r
1123 #define  DMA_IFCR_CGIF2                      ((uint32_t)0x00000010)        /*!< Channel 2 Global interrupt clear    */\r
1124 #define  DMA_IFCR_CTCIF2                     ((uint32_t)0x00000020)        /*!< Channel 2 Transfer Complete clear   */\r
1125 #define  DMA_IFCR_CHTIF2                     ((uint32_t)0x00000040)        /*!< Channel 2 Half Transfer clear       */\r
1126 #define  DMA_IFCR_CTEIF2                     ((uint32_t)0x00000080)        /*!< Channel 2 Transfer Error clear      */\r
1127 #define  DMA_IFCR_CGIF3                      ((uint32_t)0x00000100)        /*!< Channel 3 Global interrupt clear    */\r
1128 #define  DMA_IFCR_CTCIF3                     ((uint32_t)0x00000200)        /*!< Channel 3 Transfer Complete clear   */\r
1129 #define  DMA_IFCR_CHTIF3                     ((uint32_t)0x00000400)        /*!< Channel 3 Half Transfer clear       */\r
1130 #define  DMA_IFCR_CTEIF3                     ((uint32_t)0x00000800)        /*!< Channel 3 Transfer Error clear      */\r
1131 #define  DMA_IFCR_CGIF4                      ((uint32_t)0x00001000)        /*!< Channel 4 Global interrupt clear    */\r
1132 #define  DMA_IFCR_CTCIF4                     ((uint32_t)0x00002000)        /*!< Channel 4 Transfer Complete clear   */\r
1133 #define  DMA_IFCR_CHTIF4                     ((uint32_t)0x00004000)        /*!< Channel 4 Half Transfer clear       */\r
1134 #define  DMA_IFCR_CTEIF4                     ((uint32_t)0x00008000)        /*!< Channel 4 Transfer Error clear      */\r
1135 #define  DMA_IFCR_CGIF5                      ((uint32_t)0x00010000)        /*!< Channel 5 Global interrupt clear    */\r
1136 #define  DMA_IFCR_CTCIF5                     ((uint32_t)0x00020000)        /*!< Channel 5 Transfer Complete clear   */\r
1137 #define  DMA_IFCR_CHTIF5                     ((uint32_t)0x00040000)        /*!< Channel 5 Half Transfer clear       */\r
1138 #define  DMA_IFCR_CTEIF5                     ((uint32_t)0x00080000)        /*!< Channel 5 Transfer Error clear      */\r
1139 \r
1140 /*******************  Bit definition for DMA_CCR register  ********************/\r
1141 #define  DMA_CCR_EN                          ((uint32_t)0x00000001)        /*!< Channel enable                      */\r
1142 #define  DMA_CCR_TCIE                        ((uint32_t)0x00000002)        /*!< Transfer complete interrupt enable  */\r
1143 #define  DMA_CCR_HTIE                        ((uint32_t)0x00000004)        /*!< Half Transfer interrupt enable      */\r
1144 #define  DMA_CCR_TEIE                        ((uint32_t)0x00000008)        /*!< Transfer error interrupt enable     */\r
1145 #define  DMA_CCR_DIR                         ((uint32_t)0x00000010)        /*!< Data transfer direction             */\r
1146 #define  DMA_CCR_CIRC                        ((uint32_t)0x00000020)        /*!< Circular mode                       */\r
1147 #define  DMA_CCR_PINC                        ((uint32_t)0x00000040)        /*!< Peripheral increment mode           */\r
1148 #define  DMA_CCR_MINC                        ((uint32_t)0x00000080)        /*!< Memory increment mode               */\r
1149 \r
1150 #define  DMA_CCR_PSIZE                       ((uint32_t)0x00000300)        /*!< PSIZE[1:0] bits (Peripheral size)   */\r
1151 #define  DMA_CCR_PSIZE_0                     ((uint32_t)0x00000100)        /*!< Bit 0                               */\r
1152 #define  DMA_CCR_PSIZE_1                     ((uint32_t)0x00000200)        /*!< Bit 1                               */\r
1153 \r
1154 #define  DMA_CCR_MSIZE                       ((uint32_t)0x00000C00)        /*!< MSIZE[1:0] bits (Memory size)       */\r
1155 #define  DMA_CCR_MSIZE_0                     ((uint32_t)0x00000400)        /*!< Bit 0                               */\r
1156 #define  DMA_CCR_MSIZE_1                     ((uint32_t)0x00000800)        /*!< Bit 1                               */\r
1157 \r
1158 #define  DMA_CCR_PL                          ((uint32_t)0x00003000)        /*!< PL[1:0] bits(Channel Priority level)*/\r
1159 #define  DMA_CCR_PL_0                        ((uint32_t)0x00001000)        /*!< Bit 0                               */\r
1160 #define  DMA_CCR_PL_1                        ((uint32_t)0x00002000)        /*!< Bit 1                               */\r
1161 \r
1162 #define  DMA_CCR_MEM2MEM                     ((uint32_t)0x00004000)        /*!< Memory to memory mode               */\r
1163 \r
1164 /******************  Bit definition for DMA_CNDTR register  *******************/\r
1165 #define  DMA_CNDTR_NDT                       ((uint32_t)0x0000FFFF)        /*!< Number of data to Transfer          */\r
1166 \r
1167 /******************  Bit definition for DMA_CPAR register  ********************/\r
1168 #define  DMA_CPAR_PA                         ((uint32_t)0xFFFFFFFF)        /*!< Peripheral Address                  */\r
1169 \r
1170 /******************  Bit definition for DMA_CMAR register  ********************/\r
1171 #define  DMA_CMAR_MA                         ((uint32_t)0xFFFFFFFF)        /*!< Memory Address                      */\r
1172 \r
1173 /******************************************************************************/\r
1174 /*                                                                            */\r
1175 /*                 External Interrupt/Event Controller (EXTI)                 */\r
1176 /*                                                                            */\r
1177 /******************************************************************************/\r
1178 /*******************  Bit definition for EXTI_IMR register  *******************/\r
1179 #define  EXTI_IMR_MR0                        ((uint32_t)0x00000001)        /*!< Interrupt Mask on line 0  */\r
1180 #define  EXTI_IMR_MR1                        ((uint32_t)0x00000002)        /*!< Interrupt Mask on line 1  */\r
1181 #define  EXTI_IMR_MR2                        ((uint32_t)0x00000004)        /*!< Interrupt Mask on line 2  */\r
1182 #define  EXTI_IMR_MR3                        ((uint32_t)0x00000008)        /*!< Interrupt Mask on line 3  */\r
1183 #define  EXTI_IMR_MR4                        ((uint32_t)0x00000010)        /*!< Interrupt Mask on line 4  */\r
1184 #define  EXTI_IMR_MR5                        ((uint32_t)0x00000020)        /*!< Interrupt Mask on line 5  */\r
1185 #define  EXTI_IMR_MR6                        ((uint32_t)0x00000040)        /*!< Interrupt Mask on line 6  */\r
1186 #define  EXTI_IMR_MR7                        ((uint32_t)0x00000080)        /*!< Interrupt Mask on line 7  */\r
1187 #define  EXTI_IMR_MR8                        ((uint32_t)0x00000100)        /*!< Interrupt Mask on line 8  */\r
1188 #define  EXTI_IMR_MR9                        ((uint32_t)0x00000200)        /*!< Interrupt Mask on line 9  */\r
1189 #define  EXTI_IMR_MR10                       ((uint32_t)0x00000400)        /*!< Interrupt Mask on line 10 */\r
1190 #define  EXTI_IMR_MR11                       ((uint32_t)0x00000800)        /*!< Interrupt Mask on line 11 */\r
1191 #define  EXTI_IMR_MR12                       ((uint32_t)0x00001000)        /*!< Interrupt Mask on line 12 */\r
1192 #define  EXTI_IMR_MR13                       ((uint32_t)0x00002000)        /*!< Interrupt Mask on line 13 */\r
1193 #define  EXTI_IMR_MR14                       ((uint32_t)0x00004000)        /*!< Interrupt Mask on line 14 */\r
1194 #define  EXTI_IMR_MR15                       ((uint32_t)0x00008000)        /*!< Interrupt Mask on line 15 */\r
1195 #define  EXTI_IMR_MR16                       ((uint32_t)0x00010000)        /*!< Interrupt Mask on line 16 */\r
1196 #define  EXTI_IMR_MR17                       ((uint32_t)0x00020000)        /*!< Interrupt Mask on line 17 */\r
1197 #define  EXTI_IMR_MR19                       ((uint32_t)0x00080000)        /*!< Interrupt Mask on line 19 */\r
1198 #define  EXTI_IMR_MR21                       ((uint32_t)0x00200000)        /*!< Interrupt Mask on line 21 */\r
1199 #define  EXTI_IMR_MR22                       ((uint32_t)0x00400000)        /*!< Interrupt Mask on line 22 */\r
1200 #define  EXTI_IMR_MR23                       ((uint32_t)0x00800000)        /*!< Interrupt Mask on line 23 */\r
1201 #define  EXTI_IMR_MR25                       ((uint32_t)0x02000000)        /*!< Interrupt Mask on line 25 */\r
1202 #define  EXTI_IMR_MR27                       ((uint32_t)0x08000000)        /*!< Interrupt Mask on line 27 */\r
1203 \r
1204 /******************  Bit definition for EXTI_EMR register  ********************/\r
1205 #define  EXTI_EMR_MR0                        ((uint32_t)0x00000001)        /*!< Event Mask on line 0  */\r
1206 #define  EXTI_EMR_MR1                        ((uint32_t)0x00000002)        /*!< Event Mask on line 1  */\r
1207 #define  EXTI_EMR_MR2                        ((uint32_t)0x00000004)        /*!< Event Mask on line 2  */\r
1208 #define  EXTI_EMR_MR3                        ((uint32_t)0x00000008)        /*!< Event Mask on line 3  */\r
1209 #define  EXTI_EMR_MR4                        ((uint32_t)0x00000010)        /*!< Event Mask on line 4  */\r
1210 #define  EXTI_EMR_MR5                        ((uint32_t)0x00000020)        /*!< Event Mask on line 5  */\r
1211 #define  EXTI_EMR_MR6                        ((uint32_t)0x00000040)        /*!< Event Mask on line 6  */\r
1212 #define  EXTI_EMR_MR7                        ((uint32_t)0x00000080)        /*!< Event Mask on line 7  */\r
1213 #define  EXTI_EMR_MR8                        ((uint32_t)0x00000100)        /*!< Event Mask on line 8  */\r
1214 #define  EXTI_EMR_MR9                        ((uint32_t)0x00000200)        /*!< Event Mask on line 9  */\r
1215 #define  EXTI_EMR_MR10                       ((uint32_t)0x00000400)        /*!< Event Mask on line 10 */\r
1216 #define  EXTI_EMR_MR11                       ((uint32_t)0x00000800)        /*!< Event Mask on line 11 */\r
1217 #define  EXTI_EMR_MR12                       ((uint32_t)0x00001000)        /*!< Event Mask on line 12 */\r
1218 #define  EXTI_EMR_MR13                       ((uint32_t)0x00002000)        /*!< Event Mask on line 13 */\r
1219 #define  EXTI_EMR_MR14                       ((uint32_t)0x00004000)        /*!< Event Mask on line 14 */\r
1220 #define  EXTI_EMR_MR15                       ((uint32_t)0x00008000)        /*!< Event Mask on line 15 */\r
1221 #define  EXTI_EMR_MR16                       ((uint32_t)0x00010000)        /*!< Event Mask on line 16 */\r
1222 #define  EXTI_EMR_MR17                       ((uint32_t)0x00020000)        /*!< Event Mask on line 17 */\r
1223 #define  EXTI_EMR_MR19                       ((uint32_t)0x00080000)        /*!< Event Mask on line 19 */\r
1224 #define  EXTI_EMR_MR21                       ((uint32_t)0x00200000)        /*!< Event Mask on line 21 */\r
1225 #define  EXTI_EMR_MR22                       ((uint32_t)0x00400000)        /*!< Event Mask on line 22 */\r
1226 #define  EXTI_EMR_MR23                       ((uint32_t)0x00800000)        /*!< Event Mask on line 23 */\r
1227 #define  EXTI_EMR_MR25                       ((uint32_t)0x02000000)        /*!< Event Mask on line 25 */\r
1228 #define  EXTI_EMR_MR27                       ((uint32_t)0x08000000)        /*!< Event Mask on line 27 */\r
1229 \r
1230 /*******************  Bit definition for EXTI_RTSR register  ******************/\r
1231 #define  EXTI_RTSR_TR0                       ((uint32_t)0x00000001)        /*!< Rising trigger event configuration bit of line 0 */\r
1232 #define  EXTI_RTSR_TR1                       ((uint32_t)0x00000002)        /*!< Rising trigger event configuration bit of line 1 */\r
1233 #define  EXTI_RTSR_TR2                       ((uint32_t)0x00000004)        /*!< Rising trigger event configuration bit of line 2 */\r
1234 #define  EXTI_RTSR_TR3                       ((uint32_t)0x00000008)        /*!< Rising trigger event configuration bit of line 3 */\r
1235 #define  EXTI_RTSR_TR4                       ((uint32_t)0x00000010)        /*!< Rising trigger event configuration bit of line 4 */\r
1236 #define  EXTI_RTSR_TR5                       ((uint32_t)0x00000020)        /*!< Rising trigger event configuration bit of line 5 */\r
1237 #define  EXTI_RTSR_TR6                       ((uint32_t)0x00000040)        /*!< Rising trigger event configuration bit of line 6 */\r
1238 #define  EXTI_RTSR_TR7                       ((uint32_t)0x00000080)        /*!< Rising trigger event configuration bit of line 7 */\r
1239 #define  EXTI_RTSR_TR8                       ((uint32_t)0x00000100)        /*!< Rising trigger event configuration bit of line 8 */\r
1240 #define  EXTI_RTSR_TR9                       ((uint32_t)0x00000200)        /*!< Rising trigger event configuration bit of line 9 */\r
1241 #define  EXTI_RTSR_TR10                      ((uint32_t)0x00000400)        /*!< Rising trigger event configuration bit of line 10 */\r
1242 #define  EXTI_RTSR_TR11                      ((uint32_t)0x00000800)        /*!< Rising trigger event configuration bit of line 11 */\r
1243 #define  EXTI_RTSR_TR12                      ((uint32_t)0x00001000)        /*!< Rising trigger event configuration bit of line 12 */\r
1244 #define  EXTI_RTSR_TR13                      ((uint32_t)0x00002000)        /*!< Rising trigger event configuration bit of line 13 */\r
1245 #define  EXTI_RTSR_TR14                      ((uint32_t)0x00004000)        /*!< Rising trigger event configuration bit of line 14 */\r
1246 #define  EXTI_RTSR_TR15                      ((uint32_t)0x00008000)        /*!< Rising trigger event configuration bit of line 15 */\r
1247 #define  EXTI_RTSR_TR16                      ((uint32_t)0x00010000)        /*!< Rising trigger event configuration bit of line 16 */\r
1248 #define  EXTI_RTSR_TR17                      ((uint32_t)0x00020000)        /*!< Rising trigger event configuration bit of line 17 */\r
1249 #define  EXTI_RTSR_TR19                      ((uint32_t)0x00080000)        /*!< Rising trigger event configuration bit of line 19 */\r
1250 \r
1251 /*******************  Bit definition for EXTI_FTSR register *******************/\r
1252 #define  EXTI_FTSR_TR0                       ((uint32_t)0x00000001)        /*!< Falling trigger event configuration bit of line 0 */\r
1253 #define  EXTI_FTSR_TR1                       ((uint32_t)0x00000002)        /*!< Falling trigger event configuration bit of line 1 */\r
1254 #define  EXTI_FTSR_TR2                       ((uint32_t)0x00000004)        /*!< Falling trigger event configuration bit of line 2 */\r
1255 #define  EXTI_FTSR_TR3                       ((uint32_t)0x00000008)        /*!< Falling trigger event configuration bit of line 3 */\r
1256 #define  EXTI_FTSR_TR4                       ((uint32_t)0x00000010)        /*!< Falling trigger event configuration bit of line 4 */\r
1257 #define  EXTI_FTSR_TR5                       ((uint32_t)0x00000020)        /*!< Falling trigger event configuration bit of line 5 */\r
1258 #define  EXTI_FTSR_TR6                       ((uint32_t)0x00000040)        /*!< Falling trigger event configuration bit of line 6 */\r
1259 #define  EXTI_FTSR_TR7                       ((uint32_t)0x00000080)        /*!< Falling trigger event configuration bit of line 7 */\r
1260 #define  EXTI_FTSR_TR8                       ((uint32_t)0x00000100)        /*!< Falling trigger event configuration bit of line 8 */\r
1261 #define  EXTI_FTSR_TR9                       ((uint32_t)0x00000200)        /*!< Falling trigger event configuration bit of line 9 */\r
1262 #define  EXTI_FTSR_TR10                      ((uint32_t)0x00000400)        /*!< Falling trigger event configuration bit of line 10 */\r
1263 #define  EXTI_FTSR_TR11                      ((uint32_t)0x00000800)        /*!< Falling trigger event configuration bit of line 11 */\r
1264 #define  EXTI_FTSR_TR12                      ((uint32_t)0x00001000)        /*!< Falling trigger event configuration bit of line 12 */\r
1265 #define  EXTI_FTSR_TR13                      ((uint32_t)0x00002000)        /*!< Falling trigger event configuration bit of line 13 */\r
1266 #define  EXTI_FTSR_TR14                      ((uint32_t)0x00004000)        /*!< Falling trigger event configuration bit of line 14 */\r
1267 #define  EXTI_FTSR_TR15                      ((uint32_t)0x00008000)        /*!< Falling trigger event configuration bit of line 15 */\r
1268 #define  EXTI_FTSR_TR16                      ((uint32_t)0x00010000)        /*!< Falling trigger event configuration bit of line 16 */\r
1269 #define  EXTI_FTSR_TR17                      ((uint32_t)0x00020000)        /*!< Falling trigger event configuration bit of line 17 */\r
1270 #define  EXTI_FTSR_TR19                      ((uint32_t)0x00080000)        /*!< Falling trigger event configuration bit of line 19 */\r
1271 \r
1272 /******************* Bit definition for EXTI_SWIER register *******************/\r
1273 #define  EXTI_SWIER_SWIER0                   ((uint32_t)0x00000001)        /*!< Software Interrupt on line 0  */\r
1274 #define  EXTI_SWIER_SWIER1                   ((uint32_t)0x00000002)        /*!< Software Interrupt on line 1  */\r
1275 #define  EXTI_SWIER_SWIER2                   ((uint32_t)0x00000004)        /*!< Software Interrupt on line 2  */\r
1276 #define  EXTI_SWIER_SWIER3                   ((uint32_t)0x00000008)        /*!< Software Interrupt on line 3  */\r
1277 #define  EXTI_SWIER_SWIER4                   ((uint32_t)0x00000010)        /*!< Software Interrupt on line 4  */\r
1278 #define  EXTI_SWIER_SWIER5                   ((uint32_t)0x00000020)        /*!< Software Interrupt on line 5  */\r
1279 #define  EXTI_SWIER_SWIER6                   ((uint32_t)0x00000040)        /*!< Software Interrupt on line 6  */\r
1280 #define  EXTI_SWIER_SWIER7                   ((uint32_t)0x00000080)        /*!< Software Interrupt on line 7  */\r
1281 #define  EXTI_SWIER_SWIER8                   ((uint32_t)0x00000100)        /*!< Software Interrupt on line 8  */\r
1282 #define  EXTI_SWIER_SWIER9                   ((uint32_t)0x00000200)        /*!< Software Interrupt on line 9  */\r
1283 #define  EXTI_SWIER_SWIER10                  ((uint32_t)0x00000400)        /*!< Software Interrupt on line 10 */\r
1284 #define  EXTI_SWIER_SWIER11                  ((uint32_t)0x00000800)        /*!< Software Interrupt on line 11 */\r
1285 #define  EXTI_SWIER_SWIER12                  ((uint32_t)0x00001000)        /*!< Software Interrupt on line 12 */\r
1286 #define  EXTI_SWIER_SWIER13                  ((uint32_t)0x00002000)        /*!< Software Interrupt on line 13 */\r
1287 #define  EXTI_SWIER_SWIER14                  ((uint32_t)0x00004000)        /*!< Software Interrupt on line 14 */\r
1288 #define  EXTI_SWIER_SWIER15                  ((uint32_t)0x00008000)        /*!< Software Interrupt on line 15 */\r
1289 #define  EXTI_SWIER_SWIER16                  ((uint32_t)0x00010000)        /*!< Software Interrupt on line 16 */\r
1290 #define  EXTI_SWIER_SWIER17                  ((uint32_t)0x00020000)        /*!< Software Interrupt on line 17 */\r
1291 #define  EXTI_SWIER_SWIER19                  ((uint32_t)0x00080000)        /*!< Software Interrupt on line 19 */\r
1292 \r
1293 /******************  Bit definition for EXTI_PR register  *********************/\r
1294 #define  EXTI_PR_PR0                         ((uint32_t)0x00000001)        /*!< Pending bit 0  */\r
1295 #define  EXTI_PR_PR1                         ((uint32_t)0x00000002)        /*!< Pending bit 1  */\r
1296 #define  EXTI_PR_PR2                         ((uint32_t)0x00000004)        /*!< Pending bit 2  */\r
1297 #define  EXTI_PR_PR3                         ((uint32_t)0x00000008)        /*!< Pending bit 3  */\r
1298 #define  EXTI_PR_PR4                         ((uint32_t)0x00000010)        /*!< Pending bit 4  */\r
1299 #define  EXTI_PR_PR5                         ((uint32_t)0x00000020)        /*!< Pending bit 5  */\r
1300 #define  EXTI_PR_PR6                         ((uint32_t)0x00000040)        /*!< Pending bit 6  */\r
1301 #define  EXTI_PR_PR7                         ((uint32_t)0x00000080)        /*!< Pending bit 7  */\r
1302 #define  EXTI_PR_PR8                         ((uint32_t)0x00000100)        /*!< Pending bit 8  */\r
1303 #define  EXTI_PR_PR9                         ((uint32_t)0x00000200)        /*!< Pending bit 9  */\r
1304 #define  EXTI_PR_PR10                        ((uint32_t)0x00000400)        /*!< Pending bit 10 */\r
1305 #define  EXTI_PR_PR11                        ((uint32_t)0x00000800)        /*!< Pending bit 11 */\r
1306 #define  EXTI_PR_PR12                        ((uint32_t)0x00001000)        /*!< Pending bit 12 */\r
1307 #define  EXTI_PR_PR13                        ((uint32_t)0x00002000)        /*!< Pending bit 13 */\r
1308 #define  EXTI_PR_PR14                        ((uint32_t)0x00004000)        /*!< Pending bit 14 */\r
1309 #define  EXTI_PR_PR15                        ((uint32_t)0x00008000)        /*!< Pending bit 15 */\r
1310 #define  EXTI_PR_PR16                        ((uint32_t)0x00010000)        /*!< Pending bit 16 */\r
1311 #define  EXTI_PR_PR17                        ((uint32_t)0x00020000)        /*!< Pending bit 17 */\r
1312 #define  EXTI_PR_PR19                        ((uint32_t)0x00080000)        /*!< Pending bit 19 */\r
1313 \r
1314 /******************************************************************************/\r
1315 /*                                                                            */\r
1316 /*                      FLASH and Option Bytes Registers                      */\r
1317 /*                                                                            */\r
1318 /******************************************************************************/\r
1319 \r
1320 /*******************  Bit definition for FLASH_ACR register  ******************/\r
1321 #define  FLASH_ACR_LATENCY                   ((uint32_t)0x00000001)        /*!< LATENCY bit (Latency) */\r
1322 \r
1323 #define  FLASH_ACR_PRFTBE                    ((uint32_t)0x00000010)        /*!< Prefetch Buffer Enable */\r
1324 #define  FLASH_ACR_PRFTBS                    ((uint32_t)0x00000020)        /*!< Prefetch Buffer Status */\r
1325 \r
1326 /******************  Bit definition for FLASH_KEYR register  ******************/\r
1327 #define  FLASH_KEYR_FKEYR                    ((uint32_t)0xFFFFFFFF)        /*!< FPEC Key */\r
1328 \r
1329 /*****************  Bit definition for FLASH_OPTKEYR register  ****************/\r
1330 #define  FLASH_OPTKEYR_OPTKEYR               ((uint32_t)0xFFFFFFFF)        /*!< Option Byte Key */\r
1331 \r
1332 /******************  Bit definition for FLASH_SR register  *******************/\r
1333 #define  FLASH_SR_BSY                        ((uint32_t)0x00000001)        /*!< Busy */\r
1334 #define  FLASH_SR_PGERR                      ((uint32_t)0x00000004)        /*!< Programming Error */\r
1335 #define  FLASH_SR_WRPERR                     ((uint32_t)0x00000010)        /*!< Write Protection Error */\r
1336 #define  FLASH_SR_EOP                        ((uint32_t)0x00000020)        /*!< End of operation */\r
1337 \r
1338 /*******************  Bit definition for FLASH_CR register  *******************/\r
1339 #define  FLASH_CR_PG                         ((uint32_t)0x00000001)        /*!< Programming */\r
1340 #define  FLASH_CR_PER                        ((uint32_t)0x00000002)        /*!< Page Erase */\r
1341 #define  FLASH_CR_MER                        ((uint32_t)0x00000004)        /*!< Mass Erase */\r
1342 #define  FLASH_CR_OPTPG                      ((uint32_t)0x00000010)        /*!< Option Byte Programming */\r
1343 #define  FLASH_CR_OPTER                      ((uint32_t)0x00000020)        /*!< Option Byte Erase */\r
1344 #define  FLASH_CR_STRT                       ((uint32_t)0x00000040)        /*!< Start */\r
1345 #define  FLASH_CR_LOCK                       ((uint32_t)0x00000080)        /*!< Lock */\r
1346 #define  FLASH_CR_OPTWRE                     ((uint32_t)0x00000200)        /*!< Option Bytes Write Enable */\r
1347 #define  FLASH_CR_ERRIE                      ((uint32_t)0x00000400)        /*!< Error Interrupt Enable */\r
1348 #define  FLASH_CR_EOPIE                      ((uint32_t)0x00001000)        /*!< End of operation interrupt enable */\r
1349 #define  FLASH_CR_OBL_LAUNCH                 ((uint32_t)0x00002000)        /*!< OptionBytes Loader Launch */\r
1350 \r
1351 /*******************  Bit definition for FLASH_AR register  *******************/\r
1352 #define  FLASH_AR_FAR                        ((uint32_t)0xFFFFFFFF)        /*!< Flash Address */\r
1353 \r
1354 /******************  Bit definition for FLASH_OBR register  *******************/\r
1355 #define  FLASH_OBR_OPTERR                    ((uint32_t)0x00000001)        /*!< Option Byte Error */\r
1356 #define  FLASH_OBR_RDPRT1                    ((uint32_t)0x00000002)        /*!< Read protection Level 1 */\r
1357 #define  FLASH_OBR_RDPRT2                    ((uint32_t)0x00000004)        /*!< Read protection Level 2 */\r
1358 \r
1359 #define  FLASH_OBR_USER                      ((uint32_t)0x00003700)        /*!< User Option Bytes */\r
1360 #define  FLASH_OBR_IWDG_SW                   ((uint32_t)0x00000100)        /*!< IWDG SW */\r
1361 #define  FLASH_OBR_nRST_STOP                 ((uint32_t)0x00000200)        /*!< nRST_STOP */\r
1362 #define  FLASH_OBR_nRST_STDBY                ((uint32_t)0x00000400)        /*!< nRST_STDBY */\r
1363 #define  FLASH_OBR_BOOT1                     ((uint32_t)0x00001000)        /*!< BOOT1 */\r
1364 #define  FLASH_OBR_VDDA_ANALOG               ((uint32_t)0x00002000)        /*!< VDDA Analog Monitoring */\r
1365 \r
1366 /******************  Bit definition for FLASH_WRPR register  ******************/\r
1367 #define  FLASH_WRPR_WRP                      ((uint32_t)0x0000FFFF)        /*!< Write Protect */\r
1368 \r
1369 /*----------------------------------------------------------------------------*/\r
1370 \r
1371 /******************  Bit definition for OB_RDP register  **********************/\r
1372 #define  OB_RDP_RDP                          ((uint32_t)0x000000FF)        /*!< Read protection option byte */\r
1373 #define  OB_RDP_nRDP                         ((uint32_t)0x0000FF00)        /*!< Read protection complemented option byte */\r
1374 \r
1375 /******************  Bit definition for OB_USER register  *********************/\r
1376 #define  OB_USER_USER                        ((uint32_t)0x00FF0000)        /*!< User option byte */\r
1377 #define  OB_USER_nUSER                       ((uint32_t)0xFF000000)        /*!< User complemented option byte */\r
1378 \r
1379 /******************  Bit definition for OB_WRP0 register  *********************/\r
1380 #define  OB_WRP0_WRP0                        ((uint32_t)0x000000FF)        /*!< Flash memory write protection option bytes */\r
1381 #define  OB_WRP0_nWRP0                       ((uint32_t)0x0000FF00)        /*!< Flash memory write protection complemented option bytes */\r
1382 \r
1383 /******************  Bit definition for OB_WRP1 register  *********************/\r
1384 #define  OB_WRP1_WRP1                        ((uint32_t)0x00FF0000)        /*!< Flash memory write protection option bytes */\r
1385 #define  OB_WRP1_nWRP1                       ((uint32_t)0xFF000000)        /*!< Flash memory write protection complemented option bytes */\r
1386 \r
1387 /******************************************************************************/\r
1388 /*                                                                            */\r
1389 /*                       General Purpose IOs (GPIO)                           */\r
1390 /*                                                                            */\r
1391 /******************************************************************************/\r
1392 /*******************  Bit definition for GPIO_MODER register  *****************/\r
1393 #define GPIO_MODER_MODER0          ((uint32_t)0x00000003)\r
1394 #define GPIO_MODER_MODER0_0        ((uint32_t)0x00000001)\r
1395 #define GPIO_MODER_MODER0_1        ((uint32_t)0x00000002)\r
1396 #define GPIO_MODER_MODER1          ((uint32_t)0x0000000C)\r
1397 #define GPIO_MODER_MODER1_0        ((uint32_t)0x00000004)\r
1398 #define GPIO_MODER_MODER1_1        ((uint32_t)0x00000008)\r
1399 #define GPIO_MODER_MODER2          ((uint32_t)0x00000030)\r
1400 #define GPIO_MODER_MODER2_0        ((uint32_t)0x00000010)\r
1401 #define GPIO_MODER_MODER2_1        ((uint32_t)0x00000020)\r
1402 #define GPIO_MODER_MODER3          ((uint32_t)0x000000C0)\r
1403 #define GPIO_MODER_MODER3_0        ((uint32_t)0x00000040)\r
1404 #define GPIO_MODER_MODER3_1        ((uint32_t)0x00000080)\r
1405 #define GPIO_MODER_MODER4          ((uint32_t)0x00000300)\r
1406 #define GPIO_MODER_MODER4_0        ((uint32_t)0x00000100)\r
1407 #define GPIO_MODER_MODER4_1        ((uint32_t)0x00000200)\r
1408 #define GPIO_MODER_MODER5          ((uint32_t)0x00000C00)\r
1409 #define GPIO_MODER_MODER5_0        ((uint32_t)0x00000400)\r
1410 #define GPIO_MODER_MODER5_1        ((uint32_t)0x00000800)\r
1411 #define GPIO_MODER_MODER6          ((uint32_t)0x00003000)\r
1412 #define GPIO_MODER_MODER6_0        ((uint32_t)0x00001000)\r
1413 #define GPIO_MODER_MODER6_1        ((uint32_t)0x00002000)\r
1414 #define GPIO_MODER_MODER7          ((uint32_t)0x0000C000)\r
1415 #define GPIO_MODER_MODER7_0        ((uint32_t)0x00004000)\r
1416 #define GPIO_MODER_MODER7_1        ((uint32_t)0x00008000)\r
1417 #define GPIO_MODER_MODER8          ((uint32_t)0x00030000)\r
1418 #define GPIO_MODER_MODER8_0        ((uint32_t)0x00010000)\r
1419 #define GPIO_MODER_MODER8_1        ((uint32_t)0x00020000)\r
1420 #define GPIO_MODER_MODER9          ((uint32_t)0x000C0000)\r
1421 #define GPIO_MODER_MODER9_0        ((uint32_t)0x00040000)\r
1422 #define GPIO_MODER_MODER9_1        ((uint32_t)0x00080000)\r
1423 #define GPIO_MODER_MODER10         ((uint32_t)0x00300000)\r
1424 #define GPIO_MODER_MODER10_0       ((uint32_t)0x00100000)\r
1425 #define GPIO_MODER_MODER10_1       ((uint32_t)0x00200000)\r
1426 #define GPIO_MODER_MODER11         ((uint32_t)0x00C00000)\r
1427 #define GPIO_MODER_MODER11_0       ((uint32_t)0x00400000)\r
1428 #define GPIO_MODER_MODER11_1       ((uint32_t)0x00800000)\r
1429 #define GPIO_MODER_MODER12         ((uint32_t)0x03000000)\r
1430 #define GPIO_MODER_MODER12_0       ((uint32_t)0x01000000)\r
1431 #define GPIO_MODER_MODER12_1       ((uint32_t)0x02000000)\r
1432 #define GPIO_MODER_MODER13         ((uint32_t)0x0C000000)\r
1433 #define GPIO_MODER_MODER13_0       ((uint32_t)0x04000000)\r
1434 #define GPIO_MODER_MODER13_1       ((uint32_t)0x08000000)\r
1435 #define GPIO_MODER_MODER14         ((uint32_t)0x30000000)\r
1436 #define GPIO_MODER_MODER14_0       ((uint32_t)0x10000000)\r
1437 #define GPIO_MODER_MODER14_1       ((uint32_t)0x20000000)\r
1438 #define GPIO_MODER_MODER15         ((uint32_t)0xC0000000)\r
1439 #define GPIO_MODER_MODER15_0       ((uint32_t)0x40000000)\r
1440 #define GPIO_MODER_MODER15_1       ((uint32_t)0x80000000)\r
1441 \r
1442 /******************  Bit definition for GPIO_OTYPER register  *****************/\r
1443 #define GPIO_OTYPER_OT_0           ((uint32_t)0x00000001)\r
1444 #define GPIO_OTYPER_OT_1           ((uint32_t)0x00000002)\r
1445 #define GPIO_OTYPER_OT_2           ((uint32_t)0x00000004)\r
1446 #define GPIO_OTYPER_OT_3           ((uint32_t)0x00000008)\r
1447 #define GPIO_OTYPER_OT_4           ((uint32_t)0x00000010)\r
1448 #define GPIO_OTYPER_OT_5           ((uint32_t)0x00000020)\r
1449 #define GPIO_OTYPER_OT_6           ((uint32_t)0x00000040)\r
1450 #define GPIO_OTYPER_OT_7           ((uint32_t)0x00000080)\r
1451 #define GPIO_OTYPER_OT_8           ((uint32_t)0x00000100)\r
1452 #define GPIO_OTYPER_OT_9           ((uint32_t)0x00000200)\r
1453 #define GPIO_OTYPER_OT_10          ((uint32_t)0x00000400)\r
1454 #define GPIO_OTYPER_OT_11          ((uint32_t)0x00000800)\r
1455 #define GPIO_OTYPER_OT_12          ((uint32_t)0x00001000)\r
1456 #define GPIO_OTYPER_OT_13          ((uint32_t)0x00002000)\r
1457 #define GPIO_OTYPER_OT_14          ((uint32_t)0x00004000)\r
1458 #define GPIO_OTYPER_OT_15          ((uint32_t)0x00008000)\r
1459 \r
1460 /****************  Bit definition for GPIO_OSPEEDR register  ******************/\r
1461 #define GPIO_OSPEEDER_OSPEEDR0     ((uint32_t)0x00000003)\r
1462 #define GPIO_OSPEEDER_OSPEEDR0_0   ((uint32_t)0x00000001)\r
1463 #define GPIO_OSPEEDER_OSPEEDR0_1   ((uint32_t)0x00000002)\r
1464 #define GPIO_OSPEEDER_OSPEEDR1     ((uint32_t)0x0000000C)\r
1465 #define GPIO_OSPEEDER_OSPEEDR1_0   ((uint32_t)0x00000004)\r
1466 #define GPIO_OSPEEDER_OSPEEDR1_1   ((uint32_t)0x00000008)\r
1467 #define GPIO_OSPEEDER_OSPEEDR2     ((uint32_t)0x00000030)\r
1468 #define GPIO_OSPEEDER_OSPEEDR2_0   ((uint32_t)0x00000010)\r
1469 #define GPIO_OSPEEDER_OSPEEDR2_1   ((uint32_t)0x00000020)\r
1470 #define GPIO_OSPEEDER_OSPEEDR3     ((uint32_t)0x000000C0)\r
1471 #define GPIO_OSPEEDER_OSPEEDR3_0   ((uint32_t)0x00000040)\r
1472 #define GPIO_OSPEEDER_OSPEEDR3_1   ((uint32_t)0x00000080)\r
1473 #define GPIO_OSPEEDER_OSPEEDR4     ((uint32_t)0x00000300)\r
1474 #define GPIO_OSPEEDER_OSPEEDR4_0   ((uint32_t)0x00000100)\r
1475 #define GPIO_OSPEEDER_OSPEEDR4_1   ((uint32_t)0x00000200)\r
1476 #define GPIO_OSPEEDER_OSPEEDR5     ((uint32_t)0x00000C00)\r
1477 #define GPIO_OSPEEDER_OSPEEDR5_0   ((uint32_t)0x00000400)\r
1478 #define GPIO_OSPEEDER_OSPEEDR5_1   ((uint32_t)0x00000800)\r
1479 #define GPIO_OSPEEDER_OSPEEDR6     ((uint32_t)0x00003000)\r
1480 #define GPIO_OSPEEDER_OSPEEDR6_0   ((uint32_t)0x00001000)\r
1481 #define GPIO_OSPEEDER_OSPEEDR6_1   ((uint32_t)0x00002000)\r
1482 #define GPIO_OSPEEDER_OSPEEDR7     ((uint32_t)0x0000C000)\r
1483 #define GPIO_OSPEEDER_OSPEEDR7_0   ((uint32_t)0x00004000)\r
1484 #define GPIO_OSPEEDER_OSPEEDR7_1   ((uint32_t)0x00008000)\r
1485 #define GPIO_OSPEEDER_OSPEEDR8     ((uint32_t)0x00030000)\r
1486 #define GPIO_OSPEEDER_OSPEEDR8_0   ((uint32_t)0x00010000)\r
1487 #define GPIO_OSPEEDER_OSPEEDR8_1   ((uint32_t)0x00020000)\r
1488 #define GPIO_OSPEEDER_OSPEEDR9     ((uint32_t)0x000C0000)\r
1489 #define GPIO_OSPEEDER_OSPEEDR9_0   ((uint32_t)0x00040000)\r
1490 #define GPIO_OSPEEDER_OSPEEDR9_1   ((uint32_t)0x00080000)\r
1491 #define GPIO_OSPEEDER_OSPEEDR10    ((uint32_t)0x00300000)\r
1492 #define GPIO_OSPEEDER_OSPEEDR10_0  ((uint32_t)0x00100000)\r
1493 #define GPIO_OSPEEDER_OSPEEDR10_1  ((uint32_t)0x00200000)\r
1494 #define GPIO_OSPEEDER_OSPEEDR11    ((uint32_t)0x00C00000)\r
1495 #define GPIO_OSPEEDER_OSPEEDR11_0  ((uint32_t)0x00400000)\r
1496 #define GPIO_OSPEEDER_OSPEEDR11_1  ((uint32_t)0x00800000)\r
1497 #define GPIO_OSPEEDER_OSPEEDR12    ((uint32_t)0x03000000)\r
1498 #define GPIO_OSPEEDER_OSPEEDR12_0  ((uint32_t)0x01000000)\r
1499 #define GPIO_OSPEEDER_OSPEEDR12_1  ((uint32_t)0x02000000)\r
1500 #define GPIO_OSPEEDER_OSPEEDR13    ((uint32_t)0x0C000000)\r
1501 #define GPIO_OSPEEDER_OSPEEDR13_0  ((uint32_t)0x04000000)\r
1502 #define GPIO_OSPEEDER_OSPEEDR13_1  ((uint32_t)0x08000000)\r
1503 #define GPIO_OSPEEDER_OSPEEDR14    ((uint32_t)0x30000000)\r
1504 #define GPIO_OSPEEDER_OSPEEDR14_0  ((uint32_t)0x10000000)\r
1505 #define GPIO_OSPEEDER_OSPEEDR14_1  ((uint32_t)0x20000000)\r
1506 #define GPIO_OSPEEDER_OSPEEDR15    ((uint32_t)0xC0000000)\r
1507 #define GPIO_OSPEEDER_OSPEEDR15_0  ((uint32_t)0x40000000)\r
1508 #define GPIO_OSPEEDER_OSPEEDR15_1  ((uint32_t)0x80000000)\r
1509 \r
1510 /*******************  Bit definition for GPIO_PUPDR register ******************/\r
1511 #define GPIO_PUPDR_PUPDR0          ((uint32_t)0x00000003)\r
1512 #define GPIO_PUPDR_PUPDR0_0        ((uint32_t)0x00000001)\r
1513 #define GPIO_PUPDR_PUPDR0_1        ((uint32_t)0x00000002)\r
1514 #define GPIO_PUPDR_PUPDR1          ((uint32_t)0x0000000C)\r
1515 #define GPIO_PUPDR_PUPDR1_0        ((uint32_t)0x00000004)\r
1516 #define GPIO_PUPDR_PUPDR1_1        ((uint32_t)0x00000008)\r
1517 #define GPIO_PUPDR_PUPDR2          ((uint32_t)0x00000030)\r
1518 #define GPIO_PUPDR_PUPDR2_0        ((uint32_t)0x00000010)\r
1519 #define GPIO_PUPDR_PUPDR2_1        ((uint32_t)0x00000020)\r
1520 #define GPIO_PUPDR_PUPDR3          ((uint32_t)0x000000C0)\r
1521 #define GPIO_PUPDR_PUPDR3_0        ((uint32_t)0x00000040)\r
1522 #define GPIO_PUPDR_PUPDR3_1        ((uint32_t)0x00000080)\r
1523 #define GPIO_PUPDR_PUPDR4          ((uint32_t)0x00000300)\r
1524 #define GPIO_PUPDR_PUPDR4_0        ((uint32_t)0x00000100)\r
1525 #define GPIO_PUPDR_PUPDR4_1        ((uint32_t)0x00000200)\r
1526 #define GPIO_PUPDR_PUPDR5          ((uint32_t)0x00000C00)\r
1527 #define GPIO_PUPDR_PUPDR5_0        ((uint32_t)0x00000400)\r
1528 #define GPIO_PUPDR_PUPDR5_1        ((uint32_t)0x00000800)\r
1529 #define GPIO_PUPDR_PUPDR6          ((uint32_t)0x00003000)\r
1530 #define GPIO_PUPDR_PUPDR6_0        ((uint32_t)0x00001000)\r
1531 #define GPIO_PUPDR_PUPDR6_1        ((uint32_t)0x00002000)\r
1532 #define GPIO_PUPDR_PUPDR7          ((uint32_t)0x0000C000)\r
1533 #define GPIO_PUPDR_PUPDR7_0        ((uint32_t)0x00004000)\r
1534 #define GPIO_PUPDR_PUPDR7_1        ((uint32_t)0x00008000)\r
1535 #define GPIO_PUPDR_PUPDR8          ((uint32_t)0x00030000)\r
1536 #define GPIO_PUPDR_PUPDR8_0        ((uint32_t)0x00010000)\r
1537 #define GPIO_PUPDR_PUPDR8_1        ((uint32_t)0x00020000)\r
1538 #define GPIO_PUPDR_PUPDR9          ((uint32_t)0x000C0000)\r
1539 #define GPIO_PUPDR_PUPDR9_0        ((uint32_t)0x00040000)\r
1540 #define GPIO_PUPDR_PUPDR9_1        ((uint32_t)0x00080000)\r
1541 #define GPIO_PUPDR_PUPDR10         ((uint32_t)0x00300000)\r
1542 #define GPIO_PUPDR_PUPDR10_0       ((uint32_t)0x00100000)\r
1543 #define GPIO_PUPDR_PUPDR10_1       ((uint32_t)0x00200000)\r
1544 #define GPIO_PUPDR_PUPDR11         ((uint32_t)0x00C00000)\r
1545 #define GPIO_PUPDR_PUPDR11_0       ((uint32_t)0x00400000)\r
1546 #define GPIO_PUPDR_PUPDR11_1       ((uint32_t)0x00800000)\r
1547 #define GPIO_PUPDR_PUPDR12         ((uint32_t)0x03000000)\r
1548 #define GPIO_PUPDR_PUPDR12_0       ((uint32_t)0x01000000)\r
1549 #define GPIO_PUPDR_PUPDR12_1       ((uint32_t)0x02000000)\r
1550 #define GPIO_PUPDR_PUPDR13         ((uint32_t)0x0C000000)\r
1551 #define GPIO_PUPDR_PUPDR13_0       ((uint32_t)0x04000000)\r
1552 #define GPIO_PUPDR_PUPDR13_1       ((uint32_t)0x08000000)\r
1553 #define GPIO_PUPDR_PUPDR14         ((uint32_t)0x30000000)\r
1554 #define GPIO_PUPDR_PUPDR14_0       ((uint32_t)0x10000000)\r
1555 #define GPIO_PUPDR_PUPDR14_1       ((uint32_t)0x20000000)\r
1556 #define GPIO_PUPDR_PUPDR15         ((uint32_t)0xC0000000)\r
1557 #define GPIO_PUPDR_PUPDR15_0       ((uint32_t)0x40000000)\r
1558 #define GPIO_PUPDR_PUPDR15_1       ((uint32_t)0x80000000)\r
1559 \r
1560 /*******************  Bit definition for GPIO_IDR register  *******************/\r
1561 #define GPIO_IDR_0                 ((uint32_t)0x00000001)\r
1562 #define GPIO_IDR_1                 ((uint32_t)0x00000002)\r
1563 #define GPIO_IDR_2                 ((uint32_t)0x00000004)\r
1564 #define GPIO_IDR_3                 ((uint32_t)0x00000008)\r
1565 #define GPIO_IDR_4                 ((uint32_t)0x00000010)\r
1566 #define GPIO_IDR_5                 ((uint32_t)0x00000020)\r
1567 #define GPIO_IDR_6                 ((uint32_t)0x00000040)\r
1568 #define GPIO_IDR_7                 ((uint32_t)0x00000080)\r
1569 #define GPIO_IDR_8                 ((uint32_t)0x00000100)\r
1570 #define GPIO_IDR_9                 ((uint32_t)0x00000200)\r
1571 #define GPIO_IDR_10                ((uint32_t)0x00000400)\r
1572 #define GPIO_IDR_11                ((uint32_t)0x00000800)\r
1573 #define GPIO_IDR_12                ((uint32_t)0x00001000)\r
1574 #define GPIO_IDR_13                ((uint32_t)0x00002000)\r
1575 #define GPIO_IDR_14                ((uint32_t)0x00004000)\r
1576 #define GPIO_IDR_15                ((uint32_t)0x00008000)\r
1577 \r
1578 /******************  Bit definition for GPIO_ODR register  ********************/\r
1579 #define GPIO_ODR_0                 ((uint32_t)0x00000001)\r
1580 #define GPIO_ODR_1                 ((uint32_t)0x00000002)\r
1581 #define GPIO_ODR_2                 ((uint32_t)0x00000004)\r
1582 #define GPIO_ODR_3                 ((uint32_t)0x00000008)\r
1583 #define GPIO_ODR_4                 ((uint32_t)0x00000010)\r
1584 #define GPIO_ODR_5                 ((uint32_t)0x00000020)\r
1585 #define GPIO_ODR_6                 ((uint32_t)0x00000040)\r
1586 #define GPIO_ODR_7                 ((uint32_t)0x00000080)\r
1587 #define GPIO_ODR_8                 ((uint32_t)0x00000100)\r
1588 #define GPIO_ODR_9                 ((uint32_t)0x00000200)\r
1589 #define GPIO_ODR_10                ((uint32_t)0x00000400)\r
1590 #define GPIO_ODR_11                ((uint32_t)0x00000800)\r
1591 #define GPIO_ODR_12                ((uint32_t)0x00001000)\r
1592 #define GPIO_ODR_13                ((uint32_t)0x00002000)\r
1593 #define GPIO_ODR_14                ((uint32_t)0x00004000)\r
1594 #define GPIO_ODR_15                ((uint32_t)0x00008000)\r
1595 \r
1596 /****************** Bit definition for GPIO_BSRR register  ********************/\r
1597 #define GPIO_BSRR_BS_0             ((uint32_t)0x00000001)\r
1598 #define GPIO_BSRR_BS_1             ((uint32_t)0x00000002)\r
1599 #define GPIO_BSRR_BS_2             ((uint32_t)0x00000004)\r
1600 #define GPIO_BSRR_BS_3             ((uint32_t)0x00000008)\r
1601 #define GPIO_BSRR_BS_4             ((uint32_t)0x00000010)\r
1602 #define GPIO_BSRR_BS_5             ((uint32_t)0x00000020)\r
1603 #define GPIO_BSRR_BS_6             ((uint32_t)0x00000040)\r
1604 #define GPIO_BSRR_BS_7             ((uint32_t)0x00000080)\r
1605 #define GPIO_BSRR_BS_8             ((uint32_t)0x00000100)\r
1606 #define GPIO_BSRR_BS_9             ((uint32_t)0x00000200)\r
1607 #define GPIO_BSRR_BS_10            ((uint32_t)0x00000400)\r
1608 #define GPIO_BSRR_BS_11            ((uint32_t)0x00000800)\r
1609 #define GPIO_BSRR_BS_12            ((uint32_t)0x00001000)\r
1610 #define GPIO_BSRR_BS_13            ((uint32_t)0x00002000)\r
1611 #define GPIO_BSRR_BS_14            ((uint32_t)0x00004000)\r
1612 #define GPIO_BSRR_BS_15            ((uint32_t)0x00008000)\r
1613 #define GPIO_BSRR_BR_0             ((uint32_t)0x00010000)\r
1614 #define GPIO_BSRR_BR_1             ((uint32_t)0x00020000)\r
1615 #define GPIO_BSRR_BR_2             ((uint32_t)0x00040000)\r
1616 #define GPIO_BSRR_BR_3             ((uint32_t)0x00080000)\r
1617 #define GPIO_BSRR_BR_4             ((uint32_t)0x00100000)\r
1618 #define GPIO_BSRR_BR_5             ((uint32_t)0x00200000)\r
1619 #define GPIO_BSRR_BR_6             ((uint32_t)0x00400000)\r
1620 #define GPIO_BSRR_BR_7             ((uint32_t)0x00800000)\r
1621 #define GPIO_BSRR_BR_8             ((uint32_t)0x01000000)\r
1622 #define GPIO_BSRR_BR_9             ((uint32_t)0x02000000)\r
1623 #define GPIO_BSRR_BR_10            ((uint32_t)0x04000000)\r
1624 #define GPIO_BSRR_BR_11            ((uint32_t)0x08000000)\r
1625 #define GPIO_BSRR_BR_12            ((uint32_t)0x10000000)\r
1626 #define GPIO_BSRR_BR_13            ((uint32_t)0x20000000)\r
1627 #define GPIO_BSRR_BR_14            ((uint32_t)0x40000000)\r
1628 #define GPIO_BSRR_BR_15            ((uint32_t)0x80000000)\r
1629 \r
1630 /****************** Bit definition for GPIO_LCKR register  ********************/\r
1631 #define GPIO_LCKR_LCK0             ((uint32_t)0x00000001)\r
1632 #define GPIO_LCKR_LCK1             ((uint32_t)0x00000002)\r
1633 #define GPIO_LCKR_LCK2             ((uint32_t)0x00000004)\r
1634 #define GPIO_LCKR_LCK3             ((uint32_t)0x00000008)\r
1635 #define GPIO_LCKR_LCK4             ((uint32_t)0x00000010)\r
1636 #define GPIO_LCKR_LCK5             ((uint32_t)0x00000020)\r
1637 #define GPIO_LCKR_LCK6             ((uint32_t)0x00000040)\r
1638 #define GPIO_LCKR_LCK7             ((uint32_t)0x00000080)\r
1639 #define GPIO_LCKR_LCK8             ((uint32_t)0x00000100)\r
1640 #define GPIO_LCKR_LCK9             ((uint32_t)0x00000200)\r
1641 #define GPIO_LCKR_LCK10            ((uint32_t)0x00000400)\r
1642 #define GPIO_LCKR_LCK11            ((uint32_t)0x00000800)\r
1643 #define GPIO_LCKR_LCK12            ((uint32_t)0x00001000)\r
1644 #define GPIO_LCKR_LCK13            ((uint32_t)0x00002000)\r
1645 #define GPIO_LCKR_LCK14            ((uint32_t)0x00004000)\r
1646 #define GPIO_LCKR_LCK15            ((uint32_t)0x00008000)\r
1647 #define GPIO_LCKR_LCKK             ((uint32_t)0x00010000)\r
1648 \r
1649 /****************** Bit definition for GPIO_AFRL register  ********************/\r
1650 #define GPIO_AFRL_AFRL0            ((uint32_t)0x0000000F)\r
1651 #define GPIO_AFRL_AFRL1            ((uint32_t)0x000000F0)\r
1652 #define GPIO_AFRL_AFRL2            ((uint32_t)0x00000F00)\r
1653 #define GPIO_AFRL_AFRL3            ((uint32_t)0x0000F000)\r
1654 #define GPIO_AFRL_AFRL4            ((uint32_t)0x000F0000)\r
1655 #define GPIO_AFRL_AFRL5            ((uint32_t)0x00F00000)\r
1656 #define GPIO_AFRL_AFRL6            ((uint32_t)0x0F000000)\r
1657 #define GPIO_AFRL_AFRL7            ((uint32_t)0xF0000000)\r
1658 \r
1659 /****************** Bit definition for GPIO_AFRH register  ********************/\r
1660 #define GPIO_AFRH_AFRH0            ((uint32_t)0x0000000F)\r
1661 #define GPIO_AFRH_AFRH1            ((uint32_t)0x000000F0)\r
1662 #define GPIO_AFRH_AFRH2            ((uint32_t)0x00000F00)\r
1663 #define GPIO_AFRH_AFRH3            ((uint32_t)0x0000F000)\r
1664 #define GPIO_AFRH_AFRH4            ((uint32_t)0x000F0000)\r
1665 #define GPIO_AFRH_AFRH5            ((uint32_t)0x00F00000)\r
1666 #define GPIO_AFRH_AFRH6            ((uint32_t)0x0F000000)\r
1667 #define GPIO_AFRH_AFRH7            ((uint32_t)0xF0000000)\r
1668 \r
1669 /****************** Bit definition for GPIO_BRR register  *********************/\r
1670 #define GPIO_BRR_BR_0              ((uint32_t)0x00000001)\r
1671 #define GPIO_BRR_BR_1              ((uint32_t)0x00000002)\r
1672 #define GPIO_BRR_BR_2              ((uint32_t)0x00000004)\r
1673 #define GPIO_BRR_BR_3              ((uint32_t)0x00000008)\r
1674 #define GPIO_BRR_BR_4              ((uint32_t)0x00000010)\r
1675 #define GPIO_BRR_BR_5              ((uint32_t)0x00000020)\r
1676 #define GPIO_BRR_BR_6              ((uint32_t)0x00000040)\r
1677 #define GPIO_BRR_BR_7              ((uint32_t)0x00000080)\r
1678 #define GPIO_BRR_BR_8              ((uint32_t)0x00000100)\r
1679 #define GPIO_BRR_BR_9              ((uint32_t)0x00000200)\r
1680 #define GPIO_BRR_BR_10             ((uint32_t)0x00000400)\r
1681 #define GPIO_BRR_BR_11             ((uint32_t)0x00000800)\r
1682 #define GPIO_BRR_BR_12             ((uint32_t)0x00001000)\r
1683 #define GPIO_BRR_BR_13             ((uint32_t)0x00002000)\r
1684 #define GPIO_BRR_BR_14             ((uint32_t)0x00004000)\r
1685 #define GPIO_BRR_BR_15             ((uint32_t)0x00008000)\r
1686 \r
1687 /******************************************************************************/\r
1688 /*                                                                            */\r
1689 /*                   Inter-integrated Circuit Interface (I2C)                 */\r
1690 /*                                                                            */\r
1691 /******************************************************************************/\r
1692 \r
1693 /*******************  Bit definition for I2C_CR1 register  *******************/\r
1694 #define  I2C_CR1_PE                          ((uint32_t)0x00000001)        /*!< Peripheral enable */\r
1695 #define  I2C_CR1_TXIE                        ((uint32_t)0x00000002)        /*!< TX interrupt enable */\r
1696 #define  I2C_CR1_RXIE                        ((uint32_t)0x00000004)        /*!< RX interrupt enable */\r
1697 #define  I2C_CR1_ADDRIE                      ((uint32_t)0x00000008)        /*!< Address match interrupt enable */\r
1698 #define  I2C_CR1_NACKIE                      ((uint32_t)0x00000010)        /*!< NACK received interrupt enable */\r
1699 #define  I2C_CR1_STOPIE                      ((uint32_t)0x00000020)        /*!< STOP detection interrupt enable */\r
1700 #define  I2C_CR1_TCIE                        ((uint32_t)0x00000040)        /*!< Transfer complete interrupt enable */\r
1701 #define  I2C_CR1_ERRIE                       ((uint32_t)0x00000080)        /*!< Errors interrupt enable */\r
1702 #define  I2C_CR1_DFN                         ((uint32_t)0x00000F00)        /*!< Digital noise filter */\r
1703 #define  I2C_CR1_ANFOFF                      ((uint32_t)0x00001000)        /*!< Analog noise filter OFF */\r
1704 #define  I2C_CR1_SWRST                       ((uint32_t)0x00002000)        /*!< Software reset */\r
1705 #define  I2C_CR1_TXDMAEN                     ((uint32_t)0x00004000)        /*!< DMA transmission requests enable */\r
1706 #define  I2C_CR1_RXDMAEN                     ((uint32_t)0x00008000)        /*!< DMA reception requests enable */\r
1707 #define  I2C_CR1_SBC                         ((uint32_t)0x00010000)        /*!< Slave byte control */\r
1708 #define  I2C_CR1_NOSTRETCH                   ((uint32_t)0x00020000)        /*!< Clock stretching disable */\r
1709 #define  I2C_CR1_WUPEN                       ((uint32_t)0x00040000)        /*!< Wakeup from STOP enable */\r
1710 #define  I2C_CR1_GCEN                        ((uint32_t)0x00080000)        /*!< General call enable */\r
1711 #define  I2C_CR1_SMBHEN                      ((uint32_t)0x00100000)        /*!< SMBus host address enable */\r
1712 #define  I2C_CR1_SMBDEN                      ((uint32_t)0x00200000)        /*!< SMBus device default address enable */\r
1713 #define  I2C_CR1_ALERTEN                     ((uint32_t)0x00400000)        /*!< SMBus alert enable */\r
1714 #define  I2C_CR1_PECEN                       ((uint32_t)0x00800000)        /*!< PEC enable */\r
1715 \r
1716 /******************  Bit definition for I2C_CR2 register  ********************/\r
1717 #define  I2C_CR2_SADD                        ((uint32_t)0x000003FF)        /*!< Slave address (master mode) */\r
1718 #define  I2C_CR2_RD_WRN                      ((uint32_t)0x00000400)        /*!< Transfer direction (master mode) */\r
1719 #define  I2C_CR2_ADD10                       ((uint32_t)0x00000800)        /*!< 10-bit addressing mode (master mode) */\r
1720 #define  I2C_CR2_HEAD10R                     ((uint32_t)0x00001000)        /*!< 10-bit address header only read direction (master mode) */\r
1721 #define  I2C_CR2_START                       ((uint32_t)0x00002000)        /*!< START generation */\r
1722 #define  I2C_CR2_STOP                        ((uint32_t)0x00004000)        /*!< STOP generation (master mode) */\r
1723 #define  I2C_CR2_NACK                        ((uint32_t)0x00008000)        /*!< NACK generation (slave mode) */\r
1724 #define  I2C_CR2_NBYTES                      ((uint32_t)0x00FF0000)        /*!< Number of bytes */\r
1725 #define  I2C_CR2_RELOAD                      ((uint32_t)0x01000000)        /*!< NBYTES reload mode */\r
1726 #define  I2C_CR2_AUTOEND                     ((uint32_t)0x02000000)        /*!< Automatic end mode (master mode) */\r
1727 #define  I2C_CR2_PECBYTE                     ((uint32_t)0x04000000)        /*!< Packet error checking byte */\r
1728 \r
1729 /*******************  Bit definition for I2C_OAR1 register  ******************/\r
1730 #define  I2C_OAR1_OA1                        ((uint32_t)0x000003FF)        /*!< Interface own address 1 */\r
1731 #define  I2C_OAR1_OA1MODE                    ((uint32_t)0x00000400)        /*!< Own address 1 10-bit mode */\r
1732 #define  I2C_OAR1_OA1EN                      ((uint32_t)0x00008000)        /*!< Own address 1 enable */\r
1733 \r
1734 /*******************  Bit definition for I2C_OAR2 register  ******************/\r
1735 #define  I2C_OAR2_OA2                        ((uint32_t)0x000000FE)        /*!< Interface own address 2 */\r
1736 #define  I2C_OAR2_OA2MSK                     ((uint32_t)0x00000700)        /*!< Own address 2 masks */\r
1737 #define  I2C_OAR2_OA2EN                      ((uint32_t)0x00008000)        /*!< Own address 2 enable */\r
1738 \r
1739 /*******************  Bit definition for I2C_TIMINGR register *******************/\r
1740 #define  I2C_TIMINGR_SCLL                    ((uint32_t)0x000000FF)        /*!< SCL low period (master mode) */\r
1741 #define  I2C_TIMINGR_SCLH                    ((uint32_t)0x0000FF00)        /*!< SCL high period (master mode) */\r
1742 #define  I2C_TIMINGR_SDADEL                  ((uint32_t)0x000F0000)        /*!< Data hold time */\r
1743 #define  I2C_TIMINGR_SCLDEL                  ((uint32_t)0x00F00000)        /*!< Data setup time */\r
1744 #define  I2C_TIMINGR_PRESC                   ((uint32_t)0xF0000000)        /*!< Timings prescaler */\r
1745 \r
1746 /******************* Bit definition for I2C_TIMEOUTR register *******************/\r
1747 #define  I2C_TIMEOUTR_TIMEOUTA               ((uint32_t)0x00000FFF)        /*!< Bus timeout A */\r
1748 #define  I2C_TIMEOUTR_TIDLE                  ((uint32_t)0x00001000)        /*!< Idle clock timeout detection */\r
1749 #define  I2C_TIMEOUTR_TIMOUTEN               ((uint32_t)0x00008000)        /*!< Clock timeout enable */\r
1750 #define  I2C_TIMEOUTR_TIMEOUTB               ((uint32_t)0x0FFF0000)        /*!< Bus timeout B*/\r
1751 #define  I2C_TIMEOUTR_TEXTEN                 ((uint32_t)0x80000000)        /*!< Extended clock timeout enable */\r
1752 \r
1753 /******************  Bit definition for I2C_ISR register  *********************/\r
1754 #define  I2C_ISR_TXE                         ((uint32_t)0x00000001)        /*!< Transmit data register empty */\r
1755 #define  I2C_ISR_TXIS                        ((uint32_t)0x00000002)        /*!< Transmit interrupt status */\r
1756 #define  I2C_ISR_RXNE                        ((uint32_t)0x00000004)        /*!< Receive data register not empty */\r
1757 #define  I2C_ISR_ADDR                        ((uint32_t)0x00000008)        /*!< Address matched (slave mode)*/\r
1758 #define  I2C_ISR_NACKF                       ((uint32_t)0x00000010)        /*!< NACK received flag */\r
1759 #define  I2C_ISR_STOPF                       ((uint32_t)0x00000020)        /*!< STOP detection flag */\r
1760 #define  I2C_ISR_TC                          ((uint32_t)0x00000040)        /*!< Transfer complete (master mode) */\r
1761 #define  I2C_ISR_TCR                         ((uint32_t)0x00000080)        /*!< Transfer complete reload */\r
1762 #define  I2C_ISR_BERR                        ((uint32_t)0x00000100)        /*!< Bus error */\r
1763 #define  I2C_ISR_ARLO                        ((uint32_t)0x00000200)        /*!< Arbitration lost */\r
1764 #define  I2C_ISR_OVR                         ((uint32_t)0x00000400)        /*!< Overrun/Underrun */\r
1765 #define  I2C_ISR_PECERR                      ((uint32_t)0x00000800)        /*!< PEC error in reception */\r
1766 #define  I2C_ISR_TIMEOUT                     ((uint32_t)0x00001000)        /*!< Timeout or Tlow detection flag */\r
1767 #define  I2C_ISR_ALERT                       ((uint32_t)0x00002000)        /*!< SMBus alert */\r
1768 #define  I2C_ISR_BUSY                        ((uint32_t)0x00008000)        /*!< Bus busy */\r
1769 #define  I2C_ISR_DIR                         ((uint32_t)0x00010000)        /*!< Transfer direction (slave mode) */\r
1770 #define  I2C_ISR_ADDCODE                     ((uint32_t)0x00FE0000)        /*!< Address match code (slave mode) */\r
1771 \r
1772 /******************  Bit definition for I2C_ICR register  *********************/\r
1773 #define  I2C_ICR_ADDRCF                      ((uint32_t)0x00000008)        /*!< Address matched clear flag */\r
1774 #define  I2C_ICR_NACKCF                      ((uint32_t)0x00000010)        /*!< NACK clear flag */\r
1775 #define  I2C_ICR_STOPCF                      ((uint32_t)0x00000020)        /*!< STOP detection clear flag */\r
1776 #define  I2C_ICR_BERRCF                      ((uint32_t)0x00000100)        /*!< Bus error clear flag */\r
1777 #define  I2C_ICR_ARLOCF                      ((uint32_t)0x00000200)        /*!< Arbitration lost clear flag */\r
1778 #define  I2C_ICR_OVRCF                       ((uint32_t)0x00000400)        /*!< Overrun/Underrun clear flag */\r
1779 #define  I2C_ICR_PECCF                       ((uint32_t)0x00000800)        /*!< PAC error clear flag */\r
1780 #define  I2C_ICR_TIMOUTCF                    ((uint32_t)0x00001000)        /*!< Timeout clear flag */\r
1781 #define  I2C_ICR_ALERTCF                     ((uint32_t)0x00002000)        /*!< Alert clear flag */\r
1782 \r
1783 /******************  Bit definition for I2C_PECR register  *********************/\r
1784 #define  I2C_PECR_PEC                        ((uint32_t)0x000000FF)       /*!< PEC register */\r
1785 \r
1786 /******************  Bit definition for I2C_RXDR register  *********************/\r
1787 #define  I2C_RXDR_RXDATA                     ((uint32_t)0x000000FF)        /*!< 8-bit receive data */\r
1788 \r
1789 /******************  Bit definition for I2C_TXDR register  *********************/\r
1790 #define  I2C_TXDR_TXDATA                     ((uint32_t)0x000000FF)        /*!< 8-bit transmit data */\r
1791 \r
1792 /******************************************************************************/\r
1793 /*                                                                            */\r
1794 /*                        Independent WATCHDOG (IWDG)                         */\r
1795 /*                                                                            */\r
1796 /******************************************************************************/\r
1797 /*******************  Bit definition for IWDG_KR register  ********************/\r
1798 #define  IWDG_KR_KEY                         ((uint16_t)0xFFFF)            /*!< Key value (write only, read 0000h) */\r
1799 \r
1800 /*******************  Bit definition for IWDG_PR register  ********************/\r
1801 #define  IWDG_PR_PR                          ((uint8_t)0x07)               /*!< PR[2:0] (Prescaler divider) */\r
1802 #define  IWDG_PR_PR_0                        ((uint8_t)0x01)               /*!< Bit 0 */\r
1803 #define  IWDG_PR_PR_1                        ((uint8_t)0x02)               /*!< Bit 1 */\r
1804 #define  IWDG_PR_PR_2                        ((uint8_t)0x04)               /*!< Bit 2 */\r
1805 \r
1806 /*******************  Bit definition for IWDG_RLR register  *******************/\r
1807 #define  IWDG_RLR_RL                         ((uint16_t)0x0FFF)            /*!< Watchdog counter reload value */\r
1808 \r
1809 /*******************  Bit definition for IWDG_SR register  ********************/\r
1810 #define  IWDG_SR_PVU                         ((uint8_t)0x01)               /*!< Watchdog prescaler value update */\r
1811 #define  IWDG_SR_RVU                         ((uint8_t)0x02)               /*!< Watchdog counter reload value update */\r
1812 #define  IWDG_SR_WVU                         ((uint8_t)0x04)               /*!< Watchdog counter window value update */\r
1813 \r
1814 /*******************  Bit definition for IWDG_KR register  ********************/\r
1815 #define  IWDG_WINR_WIN                         ((uint16_t)0x0FFF)            /*!< Watchdog counter window value */\r
1816 \r
1817 /******************************************************************************/\r
1818 /*                                                                            */\r
1819 /*                          Power Control (PWR)                               */\r
1820 /*                                                                            */\r
1821 /******************************************************************************/\r
1822 \r
1823 /********************  Bit definition for PWR_CR register  ********************/\r
1824 #define  PWR_CR_LPSDSR                       ((uint16_t)0x0001)     /*!< Low-power deepsleep/sleep/low power run */\r
1825 #define  PWR_CR_PDDS                         ((uint16_t)0x0002)     /*!< Power Down Deepsleep */\r
1826 #define  PWR_CR_CWUF                         ((uint16_t)0x0004)     /*!< Clear Wakeup Flag */\r
1827 #define  PWR_CR_CSBF                         ((uint16_t)0x0008)     /*!< Clear Standby Flag */\r
1828 #define  PWR_CR_PVDE                         ((uint16_t)0x0010)     /*!< Power Voltage Detector Enable */\r
1829 \r
1830 #define  PWR_CR_PLS                          ((uint16_t)0x00E0)     /*!< PLS[2:0] bits (PVD Level Selection) */\r
1831 #define  PWR_CR_PLS_0                        ((uint16_t)0x0020)     /*!< Bit 0 */\r
1832 #define  PWR_CR_PLS_1                        ((uint16_t)0x0040)     /*!< Bit 1 */\r
1833 #define  PWR_CR_PLS_2                        ((uint16_t)0x0080)     /*!< Bit 2 */\r
1834 \r
1835 /*!< PVD level configuration */\r
1836 #define  PWR_CR_PLS_LEV0                     ((uint16_t)0x0000)     /*!< PVD level 0 */\r
1837 #define  PWR_CR_PLS_LEV1                     ((uint16_t)0x0020)     /*!< PVD level 1 */\r
1838 #define  PWR_CR_PLS_LEV2                     ((uint16_t)0x0040)     /*!< PVD level 2 */\r
1839 #define  PWR_CR_PLS_LEV3                     ((uint16_t)0x0060)     /*!< PVD level 3 */\r
1840 #define  PWR_CR_PLS_LEV4                     ((uint16_t)0x0080)     /*!< PVD level 4 */\r
1841 #define  PWR_CR_PLS_LEV5                     ((uint16_t)0x00A0)     /*!< PVD level 5 */\r
1842 #define  PWR_CR_PLS_LEV6                     ((uint16_t)0x00C0)     /*!< PVD level 6 */\r
1843 #define  PWR_CR_PLS_LEV7                     ((uint16_t)0x00E0)     /*!< PVD level 7 */\r
1844 \r
1845 #define  PWR_CR_DBP                          ((uint16_t)0x0100)     /*!< Disable Backup Domain write protection */\r
1846 \r
1847 /*******************  Bit definition for PWR_CSR register  ********************/\r
1848 #define  PWR_CSR_WUF                         ((uint16_t)0x0001)     /*!< Wakeup Flag */\r
1849 #define  PWR_CSR_SBF                         ((uint16_t)0x0002)     /*!< Standby Flag */\r
1850 #define  PWR_CSR_PVDO                        ((uint16_t)0x0004)     /*!< PVD Output */\r
1851 #define  PWR_CSR_VREFINTRDYF                 ((uint16_t)0x0008)     /*!< Internal voltage reference (VREFINT) ready flag */\r
1852 \r
1853 #define  PWR_CSR_EWUP1                       ((uint16_t)0x0100)     /*!< Enable WKUP pin 1 */\r
1854 #define  PWR_CSR_EWUP2                       ((uint16_t)0x0200)     /*!< Enable WKUP pin 2 */\r
1855 \r
1856 /******************************************************************************/\r
1857 /*                                                                            */\r
1858 /*                         Reset and Clock Control                            */\r
1859 /*                                                                            */\r
1860 /******************************************************************************/\r
1861 \r
1862 /********************  Bit definition for RCC_CR register  ********************/\r
1863 #define  RCC_CR_HSION                        ((uint32_t)0x00000001)        /*!< Internal High Speed clock enable */\r
1864 #define  RCC_CR_HSIRDY                       ((uint32_t)0x00000002)        /*!< Internal High Speed clock ready flag */\r
1865 #define  RCC_CR_HSITRIM                      ((uint32_t)0x000000F8)        /*!< Internal High Speed clock trimming */\r
1866 #define  RCC_CR_HSICAL                       ((uint32_t)0x0000FF00)        /*!< Internal High Speed clock Calibration */\r
1867 #define  RCC_CR_HSEON                        ((uint32_t)0x00010000)        /*!< External High Speed clock enable */\r
1868 #define  RCC_CR_HSERDY                       ((uint32_t)0x00020000)        /*!< External High Speed clock ready flag */\r
1869 #define  RCC_CR_HSEBYP                       ((uint32_t)0x00040000)        /*!< External High Speed clock Bypass */\r
1870 #define  RCC_CR_CSSON                        ((uint32_t)0x00080000)        /*!< Clock Security System enable */\r
1871 #define  RCC_CR_PLLON                        ((uint32_t)0x01000000)        /*!< PLL enable */\r
1872 #define  RCC_CR_PLLRDY                       ((uint32_t)0x02000000)        /*!< PLL clock ready flag */\r
1873 \r
1874 /*******************  Bit definition for RCC_CFGR register  *******************/\r
1875 /*!< SW configuration */\r
1876 #define  RCC_CFGR_SW                         ((uint32_t)0x00000003)        /*!< SW[1:0] bits (System clock Switch) */\r
1877 #define  RCC_CFGR_SW_0                       ((uint32_t)0x00000001)        /*!< Bit 0 */\r
1878 #define  RCC_CFGR_SW_1                       ((uint32_t)0x00000002)        /*!< Bit 1 */\r
1879 \r
1880 #define  RCC_CFGR_SW_HSI                     ((uint32_t)0x00000000)        /*!< HSI selected as system clock */\r
1881 #define  RCC_CFGR_SW_HSE                     ((uint32_t)0x00000001)        /*!< HSE selected as system clock */\r
1882 #define  RCC_CFGR_SW_PLL                     ((uint32_t)0x00000002)        /*!< PLL selected as system clock */\r
1883 \r
1884 /*!< SWS configuration */\r
1885 #define  RCC_CFGR_SWS                        ((uint32_t)0x0000000C)        /*!< SWS[1:0] bits (System Clock Switch Status) */\r
1886 #define  RCC_CFGR_SWS_0                      ((uint32_t)0x00000004)        /*!< Bit 0 */\r
1887 #define  RCC_CFGR_SWS_1                      ((uint32_t)0x00000008)        /*!< Bit 1 */\r
1888 \r
1889 #define  RCC_CFGR_SWS_HSI                    ((uint32_t)0x00000000)        /*!< HSI oscillator used as system clock */\r
1890 #define  RCC_CFGR_SWS_HSE                    ((uint32_t)0x00000004)        /*!< HSE oscillator used as system clock */\r
1891 #define  RCC_CFGR_SWS_PLL                    ((uint32_t)0x00000008)        /*!< PLL used as system clock */\r
1892 \r
1893 /*!< HPRE configuration */\r
1894 #define  RCC_CFGR_HPRE                       ((uint32_t)0x000000F0)        /*!< HPRE[3:0] bits (AHB prescaler) */\r
1895 #define  RCC_CFGR_HPRE_0                     ((uint32_t)0x00000010)        /*!< Bit 0 */\r
1896 #define  RCC_CFGR_HPRE_1                     ((uint32_t)0x00000020)        /*!< Bit 1 */\r
1897 #define  RCC_CFGR_HPRE_2                     ((uint32_t)0x00000040)        /*!< Bit 2 */\r
1898 #define  RCC_CFGR_HPRE_3                     ((uint32_t)0x00000080)        /*!< Bit 3 */\r
1899 \r
1900 #define  RCC_CFGR_HPRE_DIV1                  ((uint32_t)0x00000000)        /*!< SYSCLK not divided */\r
1901 #define  RCC_CFGR_HPRE_DIV2                  ((uint32_t)0x00000080)        /*!< SYSCLK divided by 2 */\r
1902 #define  RCC_CFGR_HPRE_DIV4                  ((uint32_t)0x00000090)        /*!< SYSCLK divided by 4 */\r
1903 #define  RCC_CFGR_HPRE_DIV8                  ((uint32_t)0x000000A0)        /*!< SYSCLK divided by 8 */\r
1904 #define  RCC_CFGR_HPRE_DIV16                 ((uint32_t)0x000000B0)        /*!< SYSCLK divided by 16 */\r
1905 #define  RCC_CFGR_HPRE_DIV64                 ((uint32_t)0x000000C0)        /*!< SYSCLK divided by 64 */\r
1906 #define  RCC_CFGR_HPRE_DIV128                ((uint32_t)0x000000D0)        /*!< SYSCLK divided by 128 */\r
1907 #define  RCC_CFGR_HPRE_DIV256                ((uint32_t)0x000000E0)        /*!< SYSCLK divided by 256 */\r
1908 #define  RCC_CFGR_HPRE_DIV512                ((uint32_t)0x000000F0)        /*!< SYSCLK divided by 512 */\r
1909 \r
1910 /*!< PPRE configuration */\r
1911 #define  RCC_CFGR_PPRE                       ((uint32_t)0x00000700)        /*!< PRE[2:0] bits (APB prescaler) */\r
1912 #define  RCC_CFGR_PPRE_0                     ((uint32_t)0x00000100)        /*!< Bit 0 */\r
1913 #define  RCC_CFGR_PPRE_1                     ((uint32_t)0x00000200)        /*!< Bit 1 */\r
1914 #define  RCC_CFGR_PPRE_2                     ((uint32_t)0x00000400)        /*!< Bit 2 */\r
1915 \r
1916 #define  RCC_CFGR_PPRE_DIV1                  ((uint32_t)0x00000000)        /*!< HCLK not divided */\r
1917 #define  RCC_CFGR_PPRE_DIV2                  ((uint32_t)0x00000400)        /*!< HCLK divided by 2 */\r
1918 #define  RCC_CFGR_PPRE_DIV4                  ((uint32_t)0x00000500)        /*!< HCLK divided by 4 */\r
1919 #define  RCC_CFGR_PPRE_DIV8                  ((uint32_t)0x00000600)        /*!< HCLK divided by 8 */\r
1920 #define  RCC_CFGR_PPRE_DIV16                 ((uint32_t)0x00000700)        /*!< HCLK divided by 16 */\r
1921 \r
1922 /*!< ADCPPRE configuration */\r
1923 #define  RCC_CFGR_ADCPRE                     ((uint32_t)0x00004000)        /*!< ADCPRE bit (ADC prescaler) */\r
1924 \r
1925 #define  RCC_CFGR_ADCPRE_DIV2                ((uint32_t)0x00000000)        /*!< PCLK divided by 2 */\r
1926 #define  RCC_CFGR_ADCPRE_DIV4                ((uint32_t)0x00004000)        /*!< PCLK divided by 4 */\r
1927 \r
1928 #define  RCC_CFGR_PLLSRC                     ((uint32_t)0x00010000)        /*!< PLL entry clock source */\r
1929 \r
1930 #define  RCC_CFGR_PLLXTPRE                   ((uint32_t)0x00020000)        /*!< HSE divider for PLL entry */\r
1931 \r
1932 /*!< PLLMUL configuration */\r
1933 #define  RCC_CFGR_PLLMULL                    ((uint32_t)0x003C0000)        /*!< PLLMUL[3:0] bits (PLL multiplication factor) */\r
1934 #define  RCC_CFGR_PLLMULL_0                  ((uint32_t)0x00040000)        /*!< Bit 0 */\r
1935 #define  RCC_CFGR_PLLMULL_1                  ((uint32_t)0x00080000)        /*!< Bit 1 */\r
1936 #define  RCC_CFGR_PLLMULL_2                  ((uint32_t)0x00100000)        /*!< Bit 2 */\r
1937 #define  RCC_CFGR_PLLMULL_3                  ((uint32_t)0x00200000)        /*!< Bit 3 */\r
1938 \r
1939 #define  RCC_CFGR_PLLSRC_HSI_Div2            ((uint32_t)0x00000000)        /*!< HSI clock divided by 2 selected as PLL entry clock source */\r
1940 #define  RCC_CFGR_PLLSRC_PREDIV1             ((uint32_t)0x00010000)        /*!< PREDIV1 clock selected as PLL entry clock source */\r
1941 \r
1942 #define  RCC_CFGR_PLLXTPRE_PREDIV1           ((uint32_t)0x00000000)        /*!< PREDIV1 clock not divided for PLL entry */\r
1943 #define  RCC_CFGR_PLLXTPRE_PREDIV1_Div2      ((uint32_t)0x00020000)        /*!< PREDIV1 clock divided by 2 for PLL entry */\r
1944 \r
1945 #define  RCC_CFGR_PLLMULL2                   ((uint32_t)0x00000000)        /*!< PLL input clock*2 */\r
1946 #define  RCC_CFGR_PLLMULL3                   ((uint32_t)0x00040000)        /*!< PLL input clock*3 */\r
1947 #define  RCC_CFGR_PLLMULL4                   ((uint32_t)0x00080000)        /*!< PLL input clock*4 */\r
1948 #define  RCC_CFGR_PLLMULL5                   ((uint32_t)0x000C0000)        /*!< PLL input clock*5 */\r
1949 #define  RCC_CFGR_PLLMULL6                   ((uint32_t)0x00100000)        /*!< PLL input clock*6 */\r
1950 #define  RCC_CFGR_PLLMULL7                   ((uint32_t)0x00140000)        /*!< PLL input clock*7 */\r
1951 #define  RCC_CFGR_PLLMULL8                   ((uint32_t)0x00180000)        /*!< PLL input clock*8 */\r
1952 #define  RCC_CFGR_PLLMULL9                   ((uint32_t)0x001C0000)        /*!< PLL input clock*9 */\r
1953 #define  RCC_CFGR_PLLMULL10                  ((uint32_t)0x00200000)        /*!< PLL input clock10 */\r
1954 #define  RCC_CFGR_PLLMULL11                  ((uint32_t)0x00240000)        /*!< PLL input clock*11 */\r
1955 #define  RCC_CFGR_PLLMULL12                  ((uint32_t)0x00280000)        /*!< PLL input clock*12 */\r
1956 #define  RCC_CFGR_PLLMULL13                  ((uint32_t)0x002C0000)        /*!< PLL input clock*13 */\r
1957 #define  RCC_CFGR_PLLMULL14                  ((uint32_t)0x00300000)        /*!< PLL input clock*14 */\r
1958 #define  RCC_CFGR_PLLMULL15                  ((uint32_t)0x00340000)        /*!< PLL input clock*15 */\r
1959 #define  RCC_CFGR_PLLMULL16                  ((uint32_t)0x00380000)        /*!< PLL input clock*16 */\r
1960 \r
1961 /*!< MCO configuration */\r
1962 #define  RCC_CFGR_MCO                        ((uint32_t)0x07000000)        /*!< MCO[2:0] bits (Microcontroller Clock Output) */\r
1963 #define  RCC_CFGR_MCO_0                      ((uint32_t)0x01000000)        /*!< Bit 0 */\r
1964 #define  RCC_CFGR_MCO_1                      ((uint32_t)0x02000000)        /*!< Bit 1 */\r
1965 #define  RCC_CFGR_MCO_2                      ((uint32_t)0x04000000)        /*!< Bit 2 */\r
1966 \r
1967 #define  RCC_CFGR_MCO_NOCLOCK                ((uint32_t)0x00000000)        /*!< No clock */\r
1968 #define  RCC_CFGR_MCO_HSI14                  ((uint32_t)0x03000000)        /*!< HSI14 clock selected as MCO source */\r
1969 #define  RCC_CFGR_MCO_SYSCLK                 ((uint32_t)0x04000000)        /*!< System clock selected as MCO source */\r
1970 #define  RCC_CFGR_MCO_HSI                    ((uint32_t)0x05000000)        /*!< HSI clock selected as MCO source */\r
1971 #define  RCC_CFGR_MCO_HSE                    ((uint32_t)0x06000000)        /*!< HSE clock selected as MCO source  */\r
1972 #define  RCC_CFGR_MCO_PLL                    ((uint32_t)0x07000000)        /*!< PLL clock divided by 2 selected as MCO source */\r
1973 \r
1974 /*!<******************  Bit definition for RCC_CIR register  ********************/\r
1975 #define  RCC_CIR_LSIRDYF                     ((uint32_t)0x00000001)        /*!< LSI Ready Interrupt flag */\r
1976 #define  RCC_CIR_LSERDYF                     ((uint32_t)0x00000002)        /*!< LSE Ready Interrupt flag */\r
1977 #define  RCC_CIR_HSIRDYF                     ((uint32_t)0x00000004)        /*!< HSI Ready Interrupt flag */\r
1978 #define  RCC_CIR_HSERDYF                     ((uint32_t)0x00000008)        /*!< HSE Ready Interrupt flag */\r
1979 #define  RCC_CIR_PLLRDYF                     ((uint32_t)0x00000010)        /*!< PLL Ready Interrupt flag */\r
1980 #define  RCC_CIR_HSI14RDYF                   ((uint32_t)0x00000020)        /*!< HSI14 Ready Interrupt flag */\r
1981 #define  RCC_CIR_CSSF                        ((uint32_t)0x00000080)        /*!< Clock Security System Interrupt flag */\r
1982 #define  RCC_CIR_LSIRDYIE                    ((uint32_t)0x00000100)        /*!< LSI Ready Interrupt Enable */\r
1983 #define  RCC_CIR_LSERDYIE                    ((uint32_t)0x00000200)        /*!< LSE Ready Interrupt Enable */\r
1984 #define  RCC_CIR_HSIRDYIE                    ((uint32_t)0x00000400)        /*!< HSI Ready Interrupt Enable */\r
1985 #define  RCC_CIR_HSERDYIE                    ((uint32_t)0x00000800)        /*!< HSE Ready Interrupt Enable */\r
1986 #define  RCC_CIR_PLLRDYIE                    ((uint32_t)0x00001000)        /*!< PLL Ready Interrupt Enable */\r
1987 #define  RCC_CIR_HSI14RDYIE                  ((uint32_t)0x00002000)        /*!< HSI14 Ready Interrupt Enable */\r
1988 #define  RCC_CIR_LSIRDYC                     ((uint32_t)0x00010000)        /*!< LSI Ready Interrupt Clear */\r
1989 #define  RCC_CIR_LSERDYC                     ((uint32_t)0x00020000)        /*!< LSE Ready Interrupt Clear */\r
1990 #define  RCC_CIR_HSIRDYC                     ((uint32_t)0x00040000)        /*!< HSI Ready Interrupt Clear */\r
1991 #define  RCC_CIR_HSERDYC                     ((uint32_t)0x00080000)        /*!< HSE Ready Interrupt Clear */\r
1992 #define  RCC_CIR_PLLRDYC                     ((uint32_t)0x00100000)        /*!< PLL Ready Interrupt Clear */\r
1993 #define  RCC_CIR_HSI14RDYC                   ((uint32_t)0x00200000)        /*!< HSI14 Ready Interrupt Clear */\r
1994 #define  RCC_CIR_CSSC                        ((uint32_t)0x00800000)        /*!< Clock Security System Interrupt Clear */\r
1995 \r
1996 /*****************  Bit definition for RCC_APB2RSTR register  *****************/\r
1997 #define  RCC_APB2RSTR_SYSCFGRST              ((uint32_t)0x00000001)        /*!< SYSCFG clock reset */\r
1998 #define  RCC_APB2RSTR_ADC1RST                ((uint32_t)0x00000200)        /*!< ADC1 clock reset */\r
1999 #define  RCC_APB2RSTR_TIM1RST                ((uint32_t)0x00000800)        /*!< TIM1 clock reset */\r
2000 #define  RCC_APB2RSTR_SPI1RST                ((uint32_t)0x00001000)        /*!< SPI1 clock reset */\r
2001 #define  RCC_APB2RSTR_USART1RST              ((uint32_t)0x00004000)        /*!< USART1 clock reset */\r
2002 #define  RCC_APB2RSTR_TIM15RST               ((uint32_t)0x00010000)        /*!< TIM15 clock reset */\r
2003 #define  RCC_APB2RSTR_TIM16RST               ((uint32_t)0x00020000)        /*!< TIM16 clock reset */\r
2004 #define  RCC_APB2RSTR_TIM17RST               ((uint32_t)0x00040000)        /*!< TIM17 clock reset */\r
2005 #define  RCC_APB2RSTR_DBGMCURST              ((uint32_t)0x00400000)        /*!< DBGMCU clock reset */\r
2006 \r
2007 /*****************  Bit definition for RCC_APB1RSTR register  *****************/\r
2008 #define  RCC_APB1RSTR_TIM2RST                ((uint32_t)0x00000001)        /*!< Timer 2 clock reset */\r
2009 #define  RCC_APB1RSTR_TIM3RST                ((uint32_t)0x00000002)        /*!< Timer 3 clock reset */\r
2010 #define  RCC_APB1RSTR_TIM6RST                ((uint32_t)0x00000010)        /*!< Timer 6 clock reset */\r
2011 #define  RCC_APB1RSTR_TIM14RST               ((uint32_t)0x00000100)        /*!< Timer 14 clock reset */\r
2012 #define  RCC_APB1RSTR_WWDGRST                ((uint32_t)0x00000800)        /*!< Window Watchdog clock reset */\r
2013 #define  RCC_APB1RSTR_SPI2RST                ((uint32_t)0x00004000)        /*!< SPI2 clock reset */\r
2014 #define  RCC_APB1RSTR_USART2RST              ((uint32_t)0x00020000)        /*!< USART 2 clock reset */\r
2015 #define  RCC_APB1RSTR_I2C1RST                ((uint32_t)0x00200000)        /*!< I2C 1 clock reset */\r
2016 #define  RCC_APB1RSTR_I2C2RST                ((uint32_t)0x00400000)        /*!< I2C 2 clock reset */\r
2017 #define  RCC_APB1RSTR_PWRRST                 ((uint32_t)0x10000000)        /*!< PWR clock reset */\r
2018 #define  RCC_APB1RSTR_DACRST                 ((uint32_t)0x20000000)        /*!< DAC clock reset */\r
2019 #define  RCC_APB1RSTR_CECRST                 ((uint32_t)0x40000000)        /*!< CEC clock reset */\r
2020 \r
2021 /******************  Bit definition for RCC_AHBENR register  ******************/\r
2022 #define  RCC_AHBENR_DMA1EN                   ((uint32_t)0x00000001)        /*!< DMA1 clock enable */\r
2023 #define  RCC_AHBENR_SRAMEN                   ((uint32_t)0x00000004)        /*!< SRAM interface clock enable */\r
2024 #define  RCC_AHBENR_FLITFEN                  ((uint32_t)0x00000010)        /*!< FLITF clock enable */\r
2025 #define  RCC_AHBENR_CRCEN                    ((uint32_t)0x00000040)        /*!< CRC clock enable */\r
2026 #define  RCC_AHBENR_GPIOAEN                  ((uint32_t)0x00020000)        /*!< GPIOA clock enable */\r
2027 #define  RCC_AHBENR_GPIOBEN                  ((uint32_t)0x00040000)        /*!< GPIOB clock enable */\r
2028 #define  RCC_AHBENR_GPIOCEN                  ((uint32_t)0x00080000)        /*!< GPIOC clock enable */\r
2029 #define  RCC_AHBENR_GPIODEN                  ((uint32_t)0x00100000)        /*!< GPIOD clock enable */\r
2030 #define  RCC_AHBENR_GPIOFEN                  ((uint32_t)0x00400000)        /*!< GPIOF clock enable */\r
2031 #define  RCC_AHBENR_TSEN                     ((uint32_t)0x01000000)        /*!< TS clock enable */\r
2032 \r
2033 /*****************  Bit definition for RCC_APB2ENR register  ******************/\r
2034 #define  RCC_APB2ENR_SYSCFGEN                ((uint32_t)0x00000001)        /*!< SYSCFG clock enable */\r
2035 #define  RCC_APB2ENR_ADC1EN                  ((uint32_t)0x00000200)        /*!< ADC1 clock enable */\r
2036 #define  RCC_APB2ENR_TIM1EN                  ((uint32_t)0x00000800)        /*!< TIM1 clock enable */\r
2037 #define  RCC_APB2ENR_SPI1EN                  ((uint32_t)0x00001000)        /*!< SPI1 clock enable */\r
2038 #define  RCC_APB2ENR_USART1EN                ((uint32_t)0x00004000)        /*!< USART1 clock enable */\r
2039 #define  RCC_APB2ENR_TIM15EN                 ((uint32_t)0x00010000)        /*!< TIM15 clock enable */\r
2040 #define  RCC_APB2ENR_TIM16EN                 ((uint32_t)0x00020000)        /*!< TIM16 clock enable */\r
2041 #define  RCC_APB2ENR_TIM17EN                 ((uint32_t)0x00040000)        /*!< TIM17 clock enable */\r
2042 #define  RCC_APB2ENR_DBGMCUEN                ((uint32_t)0x00400000)        /*!< DBGMCU clock enable */\r
2043 \r
2044 /*****************  Bit definition for RCC_APB1ENR register  ******************/\r
2045 #define  RCC_APB1ENR_TIM2EN                  ((uint32_t)0x00000001)        /*!< Timer 2 clock enable */\r
2046 #define  RCC_APB1ENR_TIM3EN                  ((uint32_t)0x00000002)        /*!< Timer 3 clock enable */\r
2047 #define  RCC_APB1ENR_TIM6EN                  ((uint32_t)0x00000010)        /*!< Timer 6 clock enable */\r
2048 #define  RCC_APB1ENR_TIM14EN                 ((uint32_t)0x00000100)        /*!< Timer 14 clock enable */\r
2049 #define  RCC_APB1ENR_WWDGEN                  ((uint32_t)0x00000800)        /*!< Window Watchdog clock enable */\r
2050 #define  RCC_APB1ENR_SPI2EN                  ((uint32_t)0x00004000)        /*!< SPI2 clock enable */\r
2051 #define  RCC_APB1ENR_USART2EN                ((uint32_t)0x00020000)        /*!< USART2 clock enable */\r
2052 #define  RCC_APB1ENR_I2C1EN                  ((uint32_t)0x00200000)        /*!< I2C1 clock enable */\r
2053 #define  RCC_APB1ENR_I2C2EN                  ((uint32_t)0x00400000)        /*!< I2C2 clock enable */\r
2054 #define  RCC_APB1ENR_PWREN                   ((uint32_t)0x10000000)        /*!< PWR clock enable */\r
2055 #define  RCC_APB1ENR_DACEN                   ((uint32_t)0x20000000)        /*!< DAC clock enable */\r
2056 #define  RCC_APB1ENR_CECEN                   ((uint32_t)0x40000000)        /*!< CEC clock enable */\r
2057 \r
2058 /*******************  Bit definition for RCC_BDCR register  *******************/\r
2059 #define  RCC_BDCR_LSEON                      ((uint32_t)0x00000001)        /*!< External Low Speed oscillator enable */\r
2060 #define  RCC_BDCR_LSERDY                     ((uint32_t)0x00000002)        /*!< External Low Speed oscillator Ready */\r
2061 #define  RCC_BDCR_LSEBYP                     ((uint32_t)0x00000004)        /*!< External Low Speed oscillator Bypass */\r
2062 \r
2063 #define  RCC_BDCR_LSEDRV                     ((uint32_t)0x00000018)        /*!< LSEDRV[1:0] bits (LSE Osc. drive capability) */\r
2064 #define  RCC_BDCR_LSEDRV_0                   ((uint32_t)0x00000008)        /*!< Bit 0 */\r
2065 #define  RCC_BDCR_LSEDRV_1                   ((uint32_t)0x00000010)        /*!< Bit 1 */\r
2066 \r
2067 #define  RCC_BDCR_RTCSEL                     ((uint32_t)0x00000300)        /*!< RTCSEL[1:0] bits (RTC clock source selection) */\r
2068 #define  RCC_BDCR_RTCSEL_0                   ((uint32_t)0x00000100)        /*!< Bit 0 */\r
2069 #define  RCC_BDCR_RTCSEL_1                   ((uint32_t)0x00000200)        /*!< Bit 1 */\r
2070 \r
2071 /*!< RTC congiguration */\r
2072 #define  RCC_BDCR_RTCSEL_NOCLOCK             ((uint32_t)0x00000000)        /*!< No clock */\r
2073 #define  RCC_BDCR_RTCSEL_LSE                 ((uint32_t)0x00000100)        /*!< LSE oscillator clock used as RTC clock */\r
2074 #define  RCC_BDCR_RTCSEL_LSI                 ((uint32_t)0x00000200)        /*!< LSI oscillator clock used as RTC clock */\r
2075 #define  RCC_BDCR_RTCSEL_HSE                 ((uint32_t)0x00000300)        /*!< HSE oscillator clock divided by 128 used as RTC clock */\r
2076 \r
2077 #define  RCC_BDCR_RTCEN                      ((uint32_t)0x00008000)        /*!< RTC clock enable */\r
2078 #define  RCC_BDCR_BDRST                      ((uint32_t)0x00010000)        /*!< Backup domain software reset  */\r
2079 \r
2080 /*******************  Bit definition for RCC_CSR register  ********************/  \r
2081 #define  RCC_CSR_LSION                       ((uint32_t)0x00000001)        /*!< Internal Low Speed oscillator enable */\r
2082 #define  RCC_CSR_LSIRDY                      ((uint32_t)0x00000002)        /*!< Internal Low Speed oscillator Ready */\r
2083 #define  RCC_CSR_RMVF                        ((uint32_t)0x01000000)        /*!< Remove reset flag */\r
2084 #define  RCC_CSR_OBL                         ((uint32_t)0x02000000)        /*!< OBL reset flag */\r
2085 #define  RCC_CSR_PINRSTF                     ((uint32_t)0x04000000)        /*!< PIN reset flag */\r
2086 #define  RCC_CSR_PORRSTF                     ((uint32_t)0x08000000)        /*!< POR/PDR reset flag */\r
2087 #define  RCC_CSR_SFTRSTF                     ((uint32_t)0x10000000)        /*!< Software Reset flag */\r
2088 #define  RCC_CSR_IWDGRSTF                    ((uint32_t)0x20000000)        /*!< Independent Watchdog reset flag */\r
2089 #define  RCC_CSR_WWDGRSTF                    ((uint32_t)0x40000000)        /*!< Window watchdog reset flag */\r
2090 #define  RCC_CSR_LPWRRSTF                    ((uint32_t)0x80000000)        /*!< Low-Power reset flag */\r
2091 \r
2092 /*******************  Bit definition for RCC_AHBRSTR register  ****************/\r
2093 #define  RCC_AHBRSTR_GPIOARST                ((uint32_t)0x00020000)         /*!< GPIOA clock reset */\r
2094 #define  RCC_AHBRSTR_GPIOBRST                ((uint32_t)0x00040000)         /*!< GPIOB clock reset */\r
2095 #define  RCC_AHBRSTR_GPIOCRST                ((uint32_t)0x00080000)         /*!< GPIOC clock reset */\r
2096 #define  RCC_AHBRSTR_GPIODRST                ((uint32_t)0x00010000)         /*!< GPIOD clock reset */\r
2097 #define  RCC_AHBRSTR_GPIOFRST                ((uint32_t)0x00040000)         /*!< GPIOF clock reset */\r
2098 #define  RCC_AHBRSTR_TSRST                   ((uint32_t)0x00100000)         /*!< TS clock reset */\r
2099 \r
2100 /*******************  Bit definition for RCC_CFGR2 register  ******************/\r
2101 /*!< PREDIV1 configuration */\r
2102 #define  RCC_CFGR2_PREDIV1                   ((uint32_t)0x0000000F)        /*!< PREDIV1[3:0] bits */\r
2103 #define  RCC_CFGR2_PREDIV1_0                 ((uint32_t)0x00000001)        /*!< Bit 0 */\r
2104 #define  RCC_CFGR2_PREDIV1_1                 ((uint32_t)0x00000002)        /*!< Bit 1 */\r
2105 #define  RCC_CFGR2_PREDIV1_2                 ((uint32_t)0x00000004)        /*!< Bit 2 */\r
2106 #define  RCC_CFGR2_PREDIV1_3                 ((uint32_t)0x00000008)        /*!< Bit 3 */\r
2107 \r
2108 #define  RCC_CFGR2_PREDIV1_DIV1              ((uint32_t)0x00000000)        /*!< PREDIV1 input clock not divided */\r
2109 #define  RCC_CFGR2_PREDIV1_DIV2              ((uint32_t)0x00000001)        /*!< PREDIV1 input clock divided by 2 */\r
2110 #define  RCC_CFGR2_PREDIV1_DIV3              ((uint32_t)0x00000002)        /*!< PREDIV1 input clock divided by 3 */\r
2111 #define  RCC_CFGR2_PREDIV1_DIV4              ((uint32_t)0x00000003)        /*!< PREDIV1 input clock divided by 4 */\r
2112 #define  RCC_CFGR2_PREDIV1_DIV5              ((uint32_t)0x00000004)        /*!< PREDIV1 input clock divided by 5 */\r
2113 #define  RCC_CFGR2_PREDIV1_DIV6              ((uint32_t)0x00000005)        /*!< PREDIV1 input clock divided by 6 */\r
2114 #define  RCC_CFGR2_PREDIV1_DIV7              ((uint32_t)0x00000006)        /*!< PREDIV1 input clock divided by 7 */\r
2115 #define  RCC_CFGR2_PREDIV1_DIV8              ((uint32_t)0x00000007)        /*!< PREDIV1 input clock divided by 8 */\r
2116 #define  RCC_CFGR2_PREDIV1_DIV9              ((uint32_t)0x00000008)        /*!< PREDIV1 input clock divided by 9 */\r
2117 #define  RCC_CFGR2_PREDIV1_DIV10             ((uint32_t)0x00000009)        /*!< PREDIV1 input clock divided by 10 */\r
2118 #define  RCC_CFGR2_PREDIV1_DIV11             ((uint32_t)0x0000000A)        /*!< PREDIV1 input clock divided by 11 */\r
2119 #define  RCC_CFGR2_PREDIV1_DIV12             ((uint32_t)0x0000000B)        /*!< PREDIV1 input clock divided by 12 */\r
2120 #define  RCC_CFGR2_PREDIV1_DIV13             ((uint32_t)0x0000000C)        /*!< PREDIV1 input clock divided by 13 */\r
2121 #define  RCC_CFGR2_PREDIV1_DIV14             ((uint32_t)0x0000000D)        /*!< PREDIV1 input clock divided by 14 */\r
2122 #define  RCC_CFGR2_PREDIV1_DIV15             ((uint32_t)0x0000000E)        /*!< PREDIV1 input clock divided by 15 */\r
2123 #define  RCC_CFGR2_PREDIV1_DIV16             ((uint32_t)0x0000000F)        /*!< PREDIV1 input clock divided by 16 */\r
2124 \r
2125 /*******************  Bit definition for RCC_CFGR3 register  ******************/\r
2126 /*!< USART1 Clock source selection */\r
2127 #define  RCC_CFGR3_USART1SW                  ((uint32_t)0x00000003)        /*!< USART1SW[1:0] bits */\r
2128 #define  RCC_CFGR3_USART1SW_0                ((uint32_t)0x00000001)        /*!< Bit 0 */\r
2129 #define  RCC_CFGR3_USART1SW_1                ((uint32_t)0x00000002)        /*!< Bit 1 */\r
2130 /*!< I2C1 Clock source selection */\r
2131 #define  RCC_CFGR3_I2C1SW                    ((uint32_t)0x00000010)        /*!< I2C1SW bits */ \r
2132 #define  RCC_CFGR3_CECSW                     ((uint32_t)0x00000040)        /*!< CECSW bits */ \r
2133 #define  RCC_CFGR3_ADCSW                     ((uint32_t)0x00000100)        /*!< ADCSW bits */ \r
2134 \r
2135 /*******************  Bit definition for RCC_CR2 register  ********************/\r
2136 #define  RCC_CR2_HSI14ON                     ((uint32_t)0x00000001)        /*!< Internal High Speed 14MHz clock enable */\r
2137 #define  RCC_CR2_HSI14RDY                    ((uint32_t)0x00000002)        /*!< Internal High Speed 14MHz clock ready flag */\r
2138 #define  RCC_CR2_HSI14DIS                    ((uint32_t)0x00000004)        /*!< Internal High Speed 14MHz clock disable */\r
2139 #define  RCC_CR2_HSI14TRIM                   ((uint32_t)0x000000F8)        /*!< Internal High Speed 14MHz clock trimming */\r
2140 #define  RCC_CR2_HSI14CAL                    ((uint32_t)0x0000FF00)        /*!< Internal High Speed 14MHz clock Calibration */\r
2141 \r
2142 /******************************************************************************/\r
2143 /*                                                                            */\r
2144 /*                           Real-Time Clock (RTC)                            */\r
2145 /*                                                                            */\r
2146 /******************************************************************************/\r
2147 /********************  Bits definition for RTC_TR register  *******************/\r
2148 #define RTC_TR_PM                            ((uint32_t)0x00400000)        /*!<  */\r
2149 #define RTC_TR_HT                            ((uint32_t)0x00300000)        /*!<  */\r
2150 #define RTC_TR_HT_0                          ((uint32_t)0x00100000)        /*!<  */\r
2151 #define RTC_TR_HT_1                          ((uint32_t)0x00200000)        /*!<  */\r
2152 #define RTC_TR_HU                            ((uint32_t)0x000F0000)        /*!<  */\r
2153 #define RTC_TR_HU_0                          ((uint32_t)0x00010000)        /*!<  */\r
2154 #define RTC_TR_HU_1                          ((uint32_t)0x00020000)        /*!<  */\r
2155 #define RTC_TR_HU_2                          ((uint32_t)0x00040000)        /*!<  */\r
2156 #define RTC_TR_HU_3                          ((uint32_t)0x00080000)        /*!<  */\r
2157 #define RTC_TR_MNT                           ((uint32_t)0x00007000)        /*!<  */\r
2158 #define RTC_TR_MNT_0                         ((uint32_t)0x00001000)        /*!<  */\r
2159 #define RTC_TR_MNT_1                         ((uint32_t)0x00002000)        /*!<  */\r
2160 #define RTC_TR_MNT_2                         ((uint32_t)0x00004000)        /*!<  */\r
2161 #define RTC_TR_MNU                           ((uint32_t)0x00000F00)        /*!<  */\r
2162 #define RTC_TR_MNU_0                         ((uint32_t)0x00000100)        /*!<  */\r
2163 #define RTC_TR_MNU_1                         ((uint32_t)0x00000200)        /*!<  */\r
2164 #define RTC_TR_MNU_2                         ((uint32_t)0x00000400)        /*!<  */\r
2165 #define RTC_TR_MNU_3                         ((uint32_t)0x00000800)        /*!<  */\r
2166 #define RTC_TR_ST                            ((uint32_t)0x00000070)        /*!<  */\r
2167 #define RTC_TR_ST_0                          ((uint32_t)0x00000010)        /*!<  */\r
2168 #define RTC_TR_ST_1                          ((uint32_t)0x00000020)        /*!<  */\r
2169 #define RTC_TR_ST_2                          ((uint32_t)0x00000040)        /*!<  */\r
2170 #define RTC_TR_SU                            ((uint32_t)0x0000000F)        /*!<  */\r
2171 #define RTC_TR_SU_0                          ((uint32_t)0x00000001)        /*!<  */\r
2172 #define RTC_TR_SU_1                          ((uint32_t)0x00000002)        /*!<  */\r
2173 #define RTC_TR_SU_2                          ((uint32_t)0x00000004)        /*!<  */\r
2174 #define RTC_TR_SU_3                          ((uint32_t)0x00000008)        /*!<  */\r
2175 \r
2176 /********************  Bits definition for RTC_DR register  *******************/\r
2177 #define RTC_DR_YT                            ((uint32_t)0x00F00000)        /*!<  */\r
2178 #define RTC_DR_YT_0                          ((uint32_t)0x00100000)        /*!<  */\r
2179 #define RTC_DR_YT_1                          ((uint32_t)0x00200000)        /*!<  */\r
2180 #define RTC_DR_YT_2                          ((uint32_t)0x00400000)        /*!<  */\r
2181 #define RTC_DR_YT_3                          ((uint32_t)0x00800000)        /*!<  */\r
2182 #define RTC_DR_YU                            ((uint32_t)0x000F0000)        /*!<  */\r
2183 #define RTC_DR_YU_0                          ((uint32_t)0x00010000)        /*!<  */\r
2184 #define RTC_DR_YU_1                          ((uint32_t)0x00020000)        /*!<  */\r
2185 #define RTC_DR_YU_2                          ((uint32_t)0x00040000)        /*!<  */\r
2186 #define RTC_DR_YU_3                          ((uint32_t)0x00080000)        /*!<  */\r
2187 #define RTC_DR_WDU                           ((uint32_t)0x0000E000)        /*!<  */\r
2188 #define RTC_DR_WDU_0                         ((uint32_t)0x00002000)        /*!<  */\r
2189 #define RTC_DR_WDU_1                         ((uint32_t)0x00004000)        /*!<  */\r
2190 #define RTC_DR_WDU_2                         ((uint32_t)0x00008000)        /*!<  */\r
2191 #define RTC_DR_MT                            ((uint32_t)0x00001000)        /*!<  */\r
2192 #define RTC_DR_MU                            ((uint32_t)0x00000F00)        /*!<  */\r
2193 #define RTC_DR_MU_0                          ((uint32_t)0x00000100)        /*!<  */\r
2194 #define RTC_DR_MU_1                          ((uint32_t)0x00000200)        /*!<  */\r
2195 #define RTC_DR_MU_2                          ((uint32_t)0x00000400)        /*!<  */\r
2196 #define RTC_DR_MU_3                          ((uint32_t)0x00000800)        /*!<  */\r
2197 #define RTC_DR_DT                            ((uint32_t)0x00000030)        /*!<  */\r
2198 #define RTC_DR_DT_0                          ((uint32_t)0x00000010)        /*!<  */\r
2199 #define RTC_DR_DT_1                          ((uint32_t)0x00000020)        /*!<  */\r
2200 #define RTC_DR_DU                            ((uint32_t)0x0000000F)        /*!<  */\r
2201 #define RTC_DR_DU_0                          ((uint32_t)0x00000001)        /*!<  */\r
2202 #define RTC_DR_DU_1                          ((uint32_t)0x00000002)        /*!<  */\r
2203 #define RTC_DR_DU_2                          ((uint32_t)0x00000004)        /*!<  */\r
2204 #define RTC_DR_DU_3                          ((uint32_t)0x00000008)        /*!<  */\r
2205 \r
2206 /********************  Bits definition for RTC_CR register  *******************/\r
2207 #define RTC_CR_COE                           ((uint32_t)0x00800000)        /*!<  */\r
2208 #define RTC_CR_OSEL                          ((uint32_t)0x00600000)        /*!<  */\r
2209 #define RTC_CR_OSEL_0                        ((uint32_t)0x00200000)        /*!<  */\r
2210 #define RTC_CR_OSEL_1                        ((uint32_t)0x00400000)        /*!<  */\r
2211 #define RTC_CR_POL                           ((uint32_t)0x00100000)        /*!<  */\r
2212 #define RTC_CR_CALSEL                        ((uint32_t)0x00080000)        /*!<  */\r
2213 #define RTC_CR_BCK                           ((uint32_t)0x00040000)        /*!<  */\r
2214 #define RTC_CR_SUB1H                         ((uint32_t)0x00020000)        /*!<  */\r
2215 #define RTC_CR_ADD1H                         ((uint32_t)0x00010000)        /*!<  */\r
2216 #define RTC_CR_TSIE                          ((uint32_t)0x00008000)        /*!<  */\r
2217 #define RTC_CR_ALRAIE                        ((uint32_t)0x00001000)        /*!<  */\r
2218 #define RTC_CR_TSE                           ((uint32_t)0x00000800)        /*!<  */\r
2219 #define RTC_CR_ALRAE                         ((uint32_t)0x00000100)        /*!<  */\r
2220 #define RTC_CR_DCE                           ((uint32_t)0x00000080)        /*!<  */\r
2221 #define RTC_CR_FMT                           ((uint32_t)0x00000040)        /*!<  */\r
2222 #define RTC_CR_BYPSHAD                       ((uint32_t)0x00000020)        /*!<  */\r
2223 #define RTC_CR_REFCKON                       ((uint32_t)0x00000010)        /*!<  */\r
2224 #define RTC_CR_TSEDGE                        ((uint32_t)0x00000008)        /*!<  */\r
2225 \r
2226 /********************  Bits definition for RTC_ISR register  ******************/\r
2227 #define RTC_ISR_RECALPF                      ((uint32_t)0x00010000)        /*!<  */\r
2228 #define RTC_ISR_TAMP3F                       ((uint32_t)0x00008000)        /*!<  */\r
2229 #define RTC_ISR_TAMP2F                       ((uint32_t)0x00004000)        /*!<  */\r
2230 #define RTC_ISR_TAMP1F                       ((uint32_t)0x00002000)        /*!<  */\r
2231 #define RTC_ISR_TSOVF                        ((uint32_t)0x00001000)        /*!<  */\r
2232 #define RTC_ISR_TSF                          ((uint32_t)0x00000800)        /*!<  */\r
2233 #define RTC_ISR_ALRAF                        ((uint32_t)0x00000100)        /*!<  */\r
2234 #define RTC_ISR_INIT                         ((uint32_t)0x00000080)        /*!<  */\r
2235 #define RTC_ISR_INITF                        ((uint32_t)0x00000040)        /*!<  */\r
2236 #define RTC_ISR_RSF                          ((uint32_t)0x00000020)        /*!<  */\r
2237 #define RTC_ISR_INITS                        ((uint32_t)0x00000010)        /*!<  */\r
2238 #define RTC_ISR_SHPF                         ((uint32_t)0x00000008)        /*!<  */\r
2239 #define RTC_ISR_ALRAWF                       ((uint32_t)0x00000001)        /*!<  */\r
2240 \r
2241 /********************  Bits definition for RTC_PRER register  *****************/\r
2242 #define RTC_PRER_PREDIV_A                    ((uint32_t)0x007F0000)        /*!<  */\r
2243 #define RTC_PRER_PREDIV_S                    ((uint32_t)0x00007FFF)        /*!<  */\r
2244 \r
2245 /********************  Bits definition for RTC_ALRMAR register  ***************/\r
2246 #define RTC_ALRMAR_MSK4                      ((uint32_t)0x80000000)        /*!<  */\r
2247 #define RTC_ALRMAR_WDSEL                     ((uint32_t)0x40000000)        /*!<  */\r
2248 #define RTC_ALRMAR_DT                        ((uint32_t)0x30000000)        /*!<  */\r
2249 #define RTC_ALRMAR_DT_0                      ((uint32_t)0x10000000)        /*!<  */\r
2250 #define RTC_ALRMAR_DT_1                      ((uint32_t)0x20000000)        /*!<  */\r
2251 #define RTC_ALRMAR_DU                        ((uint32_t)0x0F000000)        /*!<  */\r
2252 #define RTC_ALRMAR_DU_0                      ((uint32_t)0x01000000)        /*!<  */\r
2253 #define RTC_ALRMAR_DU_1                      ((uint32_t)0x02000000)        /*!<  */\r
2254 #define RTC_ALRMAR_DU_2                      ((uint32_t)0x04000000)        /*!<  */\r
2255 #define RTC_ALRMAR_DU_3                      ((uint32_t)0x08000000)        /*!<  */\r
2256 #define RTC_ALRMAR_MSK3                      ((uint32_t)0x00800000)        /*!<  */\r
2257 #define RTC_ALRMAR_PM                        ((uint32_t)0x00400000)        /*!<  */\r
2258 #define RTC_ALRMAR_HT                        ((uint32_t)0x00300000)        /*!<  */\r
2259 #define RTC_ALRMAR_HT_0                      ((uint32_t)0x00100000)        /*!<  */\r
2260 #define RTC_ALRMAR_HT_1                      ((uint32_t)0x00200000)        /*!<  */\r
2261 #define RTC_ALRMAR_HU                        ((uint32_t)0x000F0000)        /*!<  */\r
2262 #define RTC_ALRMAR_HU_0                      ((uint32_t)0x00010000)        /*!<  */\r
2263 #define RTC_ALRMAR_HU_1                      ((uint32_t)0x00020000)        /*!<  */\r
2264 #define RTC_ALRMAR_HU_2                      ((uint32_t)0x00040000)        /*!<  */\r
2265 #define RTC_ALRMAR_HU_3                      ((uint32_t)0x00080000)        /*!<  */\r
2266 #define RTC_ALRMAR_MSK2                      ((uint32_t)0x00008000)        /*!<  */\r
2267 #define RTC_ALRMAR_MNT                       ((uint32_t)0x00007000)        /*!<  */\r
2268 #define RTC_ALRMAR_MNT_0                     ((uint32_t)0x00001000)        /*!<  */\r
2269 #define RTC_ALRMAR_MNT_1                     ((uint32_t)0x00002000)        /*!<  */\r
2270 #define RTC_ALRMAR_MNT_2                     ((uint32_t)0x00004000)        /*!<  */\r
2271 #define RTC_ALRMAR_MNU                       ((uint32_t)0x00000F00)        /*!<  */\r
2272 #define RTC_ALRMAR_MNU_0                     ((uint32_t)0x00000100)        /*!<  */\r
2273 #define RTC_ALRMAR_MNU_1                     ((uint32_t)0x00000200)        /*!<  */\r
2274 #define RTC_ALRMAR_MNU_2                     ((uint32_t)0x00000400)        /*!<  */\r
2275 #define RTC_ALRMAR_MNU_3                     ((uint32_t)0x00000800)        /*!<  */\r
2276 #define RTC_ALRMAR_MSK1                      ((uint32_t)0x00000080)        /*!<  */\r
2277 #define RTC_ALRMAR_ST                        ((uint32_t)0x00000070)        /*!<  */\r
2278 #define RTC_ALRMAR_ST_0                      ((uint32_t)0x00000010)        /*!<  */\r
2279 #define RTC_ALRMAR_ST_1                      ((uint32_t)0x00000020)        /*!<  */\r
2280 #define RTC_ALRMAR_ST_2                      ((uint32_t)0x00000040)        /*!<  */\r
2281 #define RTC_ALRMAR_SU                        ((uint32_t)0x0000000F)        /*!<  */\r
2282 #define RTC_ALRMAR_SU_0                      ((uint32_t)0x00000001)        /*!<  */\r
2283 #define RTC_ALRMAR_SU_1                      ((uint32_t)0x00000002)        /*!<  */\r
2284 #define RTC_ALRMAR_SU_2                      ((uint32_t)0x00000004)        /*!<  */\r
2285 #define RTC_ALRMAR_SU_3                      ((uint32_t)0x00000008)        /*!<  */\r
2286 \r
2287 /********************  Bits definition for RTC_WPR register  ******************/\r
2288 #define RTC_WPR_KEY                          ((uint32_t)0x000000FF)        /*!<  */\r
2289 \r
2290 /********************  Bits definition for RTC_SSR register  ******************/\r
2291 #define RTC_SSR_SS                           ((uint32_t)0x0003FFFF)        /*!<  */\r
2292 \r
2293 /********************  Bits definition for RTC_SHIFTR register  ***************/\r
2294 #define RTC_SHIFTR_SUBFS                     ((uint32_t)0x00007FFF)        /*!<  */\r
2295 #define RTC_SHIFTR_ADD1S                     ((uint32_t)0x80000000)        /*!<  */\r
2296 \r
2297 /********************  Bits definition for RTC_TSTR register  *****************/\r
2298 #define RTC_TSTR_PM                          ((uint32_t)0x00400000)        /*!<  */\r
2299 #define RTC_TSTR_HT                          ((uint32_t)0x00300000)        /*!<  */\r
2300 #define RTC_TSTR_HT_0                        ((uint32_t)0x00100000)        /*!<  */\r
2301 #define RTC_TSTR_HT_1                        ((uint32_t)0x00200000)        /*!<  */\r
2302 #define RTC_TSTR_HU                          ((uint32_t)0x000F0000)        /*!<  */\r
2303 #define RTC_TSTR_HU_0                        ((uint32_t)0x00010000)        /*!<  */\r
2304 #define RTC_TSTR_HU_1                        ((uint32_t)0x00020000)        /*!<  */\r
2305 #define RTC_TSTR_HU_2                        ((uint32_t)0x00040000)        /*!<  */\r
2306 #define RTC_TSTR_HU_3                        ((uint32_t)0x00080000)        /*!<  */\r
2307 #define RTC_TSTR_MNT                         ((uint32_t)0x00007000)        /*!<  */\r
2308 #define RTC_TSTR_MNT_0                       ((uint32_t)0x00001000)        /*!<  */\r
2309 #define RTC_TSTR_MNT_1                       ((uint32_t)0x00002000)        /*!<  */\r
2310 #define RTC_TSTR_MNT_2                       ((uint32_t)0x00004000)        /*!<  */\r
2311 #define RTC_TSTR_MNU                         ((uint32_t)0x00000F00)        /*!<  */\r
2312 #define RTC_TSTR_MNU_0                       ((uint32_t)0x00000100)        /*!<  */\r
2313 #define RTC_TSTR_MNU_1                       ((uint32_t)0x00000200)        /*!<  */\r
2314 #define RTC_TSTR_MNU_2                       ((uint32_t)0x00000400)        /*!<  */\r
2315 #define RTC_TSTR_MNU_3                       ((uint32_t)0x00000800)        /*!<  */\r
2316 #define RTC_TSTR_ST                          ((uint32_t)0x00000070)        /*!<  */\r
2317 #define RTC_TSTR_ST_0                        ((uint32_t)0x00000010)        /*!<  */\r
2318 #define RTC_TSTR_ST_1                        ((uint32_t)0x00000020)        /*!<  */\r
2319 #define RTC_TSTR_ST_2                        ((uint32_t)0x00000040)        /*!<  */\r
2320 #define RTC_TSTR_SU                          ((uint32_t)0x0000000F)        /*!<  */\r
2321 #define RTC_TSTR_SU_0                        ((uint32_t)0x00000001)        /*!<  */\r
2322 #define RTC_TSTR_SU_1                        ((uint32_t)0x00000002)        /*!<  */\r
2323 #define RTC_TSTR_SU_2                        ((uint32_t)0x00000004)        /*!<  */\r
2324 #define RTC_TSTR_SU_3                        ((uint32_t)0x00000008)        /*!<  */\r
2325 \r
2326 /********************  Bits definition for RTC_TSDR register  *****************/\r
2327 #define RTC_TSDR_WDU                         ((uint32_t)0x0000E000)        /*!<  */\r
2328 #define RTC_TSDR_WDU_0                       ((uint32_t)0x00002000)        /*!<  */\r
2329 #define RTC_TSDR_WDU_1                       ((uint32_t)0x00004000)        /*!<  */\r
2330 #define RTC_TSDR_WDU_2                       ((uint32_t)0x00008000)        /*!<  */\r
2331 #define RTC_TSDR_MT                          ((uint32_t)0x00001000)        /*!<  */\r
2332 #define RTC_TSDR_MU                          ((uint32_t)0x00000F00)        /*!<  */\r
2333 #define RTC_TSDR_MU_0                        ((uint32_t)0x00000100)        /*!<  */\r
2334 #define RTC_TSDR_MU_1                        ((uint32_t)0x00000200)        /*!<  */\r
2335 #define RTC_TSDR_MU_2                        ((uint32_t)0x00000400)        /*!<  */\r
2336 #define RTC_TSDR_MU_3                        ((uint32_t)0x00000800)        /*!<  */\r
2337 #define RTC_TSDR_DT                          ((uint32_t)0x00000030)        /*!<  */\r
2338 #define RTC_TSDR_DT_0                        ((uint32_t)0x00000010)        /*!<  */\r
2339 #define RTC_TSDR_DT_1                        ((uint32_t)0x00000020)        /*!<  */\r
2340 #define RTC_TSDR_DU                          ((uint32_t)0x0000000F)        /*!<  */\r
2341 #define RTC_TSDR_DU_0                        ((uint32_t)0x00000001)        /*!<  */\r
2342 #define RTC_TSDR_DU_1                        ((uint32_t)0x00000002)        /*!<  */\r
2343 #define RTC_TSDR_DU_2                        ((uint32_t)0x00000004)        /*!<  */\r
2344 #define RTC_TSDR_DU_3                        ((uint32_t)0x00000008)        /*!<  */\r
2345 \r
2346 /********************  Bits definition for RTC_TSSSR register  ****************/\r
2347 #define RTC_TSSSR_SS                         ((uint32_t)0x0003FFFF)\r
2348 \r
2349 /********************  Bits definition for RTC_CAL register  *****************/\r
2350 #define RTC_CAL_CALP                         ((uint32_t)0x00008000)        /*!<  */\r
2351 #define RTC_CAL_CALW8                        ((uint32_t)0x00004000)        /*!<  */\r
2352 #define RTC_CAL_CALW16                       ((uint32_t)0x00002000)        /*!<  */\r
2353 #define RTC_CAL_CALM                         ((uint32_t)0x000001FF)        /*!<  */\r
2354 #define RTC_CAL_CALM_0                       ((uint32_t)0x00000001)        /*!<  */\r
2355 #define RTC_CAL_CALM_1                       ((uint32_t)0x00000002)        /*!<  */\r
2356 #define RTC_CAL_CALM_2                       ((uint32_t)0x00000004)        /*!<  */\r
2357 #define RTC_CAL_CALM_3                       ((uint32_t)0x00000008)        /*!<  */\r
2358 #define RTC_CAL_CALM_4                       ((uint32_t)0x00000010)        /*!<  */\r
2359 #define RTC_CAL_CALM_5                       ((uint32_t)0x00000020)        /*!<  */\r
2360 #define RTC_CAL_CALM_6                       ((uint32_t)0x00000040)        /*!<  */\r
2361 #define RTC_CAL_CALM_7                       ((uint32_t)0x00000080)        /*!<  */\r
2362 #define RTC_CAL_CALM_8                       ((uint32_t)0x00000100)        /*!<  */\r
2363 \r
2364 /********************  Bits definition for RTC_TAFCR register  ****************/\r
2365 #define RTC_TAFCR_ALARMOUTTYPE               ((uint32_t)0x00040000)        /*!<  */\r
2366 #define RTC_TAFCR_TAMPPUDIS                  ((uint32_t)0x00008000)        /*!<  */\r
2367 #define RTC_TAFCR_TAMPPRCH                   ((uint32_t)0x00006000)        /*!<  */\r
2368 #define RTC_TAFCR_TAMPPRCH_0                 ((uint32_t)0x00002000)        /*!<  */\r
2369 #define RTC_TAFCR_TAMPPRCH_1                 ((uint32_t)0x00004000)        /*!<  */\r
2370 #define RTC_TAFCR_TAMPFLT                    ((uint32_t)0x00001800)        /*!<  */\r
2371 #define RTC_TAFCR_TAMPFLT_0                  ((uint32_t)0x00000800)        /*!<  */\r
2372 #define RTC_TAFCR_TAMPFLT_1                  ((uint32_t)0x00001000)        /*!<  */\r
2373 #define RTC_TAFCR_TAMPFREQ                   ((uint32_t)0x00000700)        /*!<  */\r
2374 #define RTC_TAFCR_TAMPFREQ_0                 ((uint32_t)0x00000100)        /*!<  */\r
2375 #define RTC_TAFCR_TAMPFREQ_1                 ((uint32_t)0x00000200)        /*!<  */\r
2376 #define RTC_TAFCR_TAMPFREQ_2                 ((uint32_t)0x00000400)        /*!<  */\r
2377 #define RTC_TAFCR_TAMPTS                     ((uint32_t)0x00000080)        /*!<  */\r
2378 #define RTC_TAFCR_TAMP3EDGE                  ((uint32_t)0x00000040)        /*!<  */\r
2379 #define RTC_TAFCR_TAMP3E                     ((uint32_t)0x00000020)        /*!<  */\r
2380 #define RTC_TAFCR_TAMP2EDGE                  ((uint32_t)0x00000010)        /*!<  */\r
2381 #define RTC_TAFCR_TAMP2E                     ((uint32_t)0x00000008)        /*!<  */\r
2382 #define RTC_TAFCR_TAMPIE                     ((uint32_t)0x00000004)        /*!<  */\r
2383 #define RTC_TAFCR_TAMP1TRG                   ((uint32_t)0x00000002)        /*!<  */\r
2384 #define RTC_TAFCR_TAMP1E                     ((uint32_t)0x00000001)        /*!<  */\r
2385 \r
2386 /********************  Bits definition for RTC_ALRMASSR register  *************/\r
2387 #define RTC_ALRMASSR_MASKSS                  ((uint32_t)0x0F000000)        /*!<  */\r
2388 #define RTC_ALRMASSR_MASKSS_0                ((uint32_t)0x01000000)        /*!<  */\r
2389 #define RTC_ALRMASSR_MASKSS_1                ((uint32_t)0x02000000)        /*!<  */\r
2390 #define RTC_ALRMASSR_MASKSS_2                ((uint32_t)0x04000000)        /*!<  */\r
2391 #define RTC_ALRMASSR_MASKSS_3                ((uint32_t)0x08000000)        /*!<  */\r
2392 #define RTC_ALRMASSR_SS                      ((uint32_t)0x00007FFF)        /*!<  */\r
2393 \r
2394 /********************  Bits definition for RTC_BKP0R register  ****************/\r
2395 #define RTC_BKP0R                            ((uint32_t)0xFFFFFFFF)        /*!<  */\r
2396 \r
2397 /********************  Bits definition for RTC_BKP1R register  ****************/\r
2398 #define RTC_BKP1R                            ((uint32_t)0xFFFFFFFF)        /*!<  */\r
2399 \r
2400 /********************  Bits definition for RTC_BKP2R register  ****************/\r
2401 #define RTC_BKP2R                            ((uint32_t)0xFFFFFFFF)        /*!<  */\r
2402 \r
2403 /********************  Bits definition for RTC_BKP3R register  ****************/\r
2404 #define RTC_BKP3R                            ((uint32_t)0xFFFFFFFF)        /*!<  */\r
2405 \r
2406 /********************  Bits definition for RTC_BKP4R register  ****************/\r
2407 #define RTC_BKP4R                            ((uint32_t)0xFFFFFFFF)        /*!<  */\r
2408 \r
2409 /******************************************************************************/\r
2410 /*                                                                            */\r
2411 /*                        Serial Peripheral Interface (SPI)                   */\r
2412 /*                                                                            */\r
2413 /******************************************************************************/\r
2414 /*******************  Bit definition for SPI_CR1 register  ********************/\r
2415 #define  SPI_CR1_CPHA                        ((uint16_t)0x0001)            /*!< Clock Phase */\r
2416 #define  SPI_CR1_CPOL                        ((uint16_t)0x0002)            /*!< Clock Polarity */\r
2417 #define  SPI_CR1_MSTR                        ((uint16_t)0x0004)            /*!< Master Selection */\r
2418 #define  SPI_CR1_BR                          ((uint16_t)0x0038)            /*!< BR[2:0] bits (Baud Rate Control) */\r
2419 #define  SPI_CR1_BR_0                        ((uint16_t)0x0008)            /*!< Bit 0 */\r
2420 #define  SPI_CR1_BR_1                        ((uint16_t)0x0010)            /*!< Bit 1 */\r
2421 #define  SPI_CR1_BR_2                        ((uint16_t)0x0020)            /*!< Bit 2 */\r
2422 #define  SPI_CR1_SPE                         ((uint16_t)0x0040)            /*!< SPI Enable */\r
2423 #define  SPI_CR1_LSBFIRST                    ((uint16_t)0x0080)            /*!< Frame Format */\r
2424 #define  SPI_CR1_SSI                         ((uint16_t)0x0100)            /*!< Internal slave select */\r
2425 #define  SPI_CR1_SSM                         ((uint16_t)0x0200)            /*!< Software slave management */\r
2426 #define  SPI_CR1_RXONLY                      ((uint16_t)0x0400)            /*!< Receive only */\r
2427 #define  SPI_CR1_CRCL                        ((uint16_t)0x0800)            /*!< CRC Length */\r
2428 #define  SPI_CR1_CRCNEXT                     ((uint16_t)0x1000)            /*!< Transmit CRC next */\r
2429 #define  SPI_CR1_CRCEN                       ((uint16_t)0x2000)            /*!< Hardware CRC calculation enable */\r
2430 #define  SPI_CR1_BIDIOE                      ((uint16_t)0x4000)            /*!< Output enable in bidirectional mode */\r
2431 #define  SPI_CR1_BIDIMODE                    ((uint16_t)0x8000)            /*!< Bidirectional data mode enable */\r
2432 \r
2433 /*******************  Bit definition for SPI_CR2 register  ********************/\r
2434 #define  SPI_CR2_RXDMAEN                     ((uint16_t)0x0001)            /*!< Rx Buffer DMA Enable */\r
2435 #define  SPI_CR2_TXDMAEN                     ((uint16_t)0x0002)            /*!< Tx Buffer DMA Enable */\r
2436 #define  SPI_CR2_SSOE                        ((uint16_t)0x0004)            /*!< SS Output Enable */\r
2437 #define  SPI_CR2_NSSP                        ((uint16_t)0x0008)            /*!< NSS pulse management Enable */\r
2438 #define  SPI_CR2_FRF                         ((uint16_t)0x0010)            /*!< Frame Format Enable */\r
2439 #define  SPI_CR2_ERRIE                       ((uint16_t)0x0020)            /*!< Error Interrupt Enable */\r
2440 #define  SPI_CR2_RXNEIE                      ((uint16_t)0x0040)            /*!< RX buffer Not Empty Interrupt Enable */\r
2441 #define  SPI_CR2_TXEIE                       ((uint16_t)0x0080)            /*!< Tx buffer Empty Interrupt Enable */\r
2442 #define  SPI_CR2_DS                          ((uint16_t)0x0F00)            /*!< DS[3:0] Data Size */\r
2443 #define  SPI_CR2_DS_0                        ((uint16_t)0x0100)            /*!< Bit 0 */\r
2444 #define  SPI_CR2_DS_1                        ((uint16_t)0x0200)            /*!< Bit 1 */\r
2445 #define  SPI_CR2_DS_2                        ((uint16_t)0x0400)            /*!< Bit 2 */\r
2446 #define  SPI_CR2_DS_3                        ((uint16_t)0x0800)            /*!< Bit 3 */\r
2447 #define  SPI_CR2_FRXTH                       ((uint16_t)0x1000)            /*!< FIFO reception Threshold */\r
2448 #define  SPI_CR2_LDMARX                      ((uint16_t)0x2000)            /*!< Last DMA transfer for reception */\r
2449 #define  SPI_CR2_LDMATX                      ((uint16_t)0x4000)            /*!< Last DMA transfer for transmission */\r
2450 \r
2451 /********************  Bit definition for SPI_SR register  ********************/\r
2452 #define  SPI_SR_RXNE                         ((uint16_t)0x0001)            /*!< Receive buffer Not Empty */\r
2453 #define  SPI_SR_TXE                          ((uint16_t)0x0002)            /*!< Transmit buffer Empty */\r
2454 #define  SPI_SR_CHSIDE                       ((uint16_t)0x0004)            /*!< Channel side */\r
2455 #define  SPI_SR_UDR                          ((uint16_t)0x0008)            /*!< Underrun flag */\r
2456 #define  SPI_SR_CRCERR                       ((uint16_t)0x0010)            /*!< CRC Error flag */\r
2457 #define  SPI_SR_MODF                         ((uint16_t)0x0020)            /*!< Mode fault */\r
2458 #define  SPI_SR_OVR                          ((uint16_t)0x0040)            /*!< Overrun flag */\r
2459 #define  SPI_SR_BSY                          ((uint16_t)0x0080)            /*!< Busy flag */\r
2460 #define  SPI_SR_FRE                          ((uint16_t)0x0100)            /*!< TI frame format error */\r
2461 #define  SPI_SR_FRLVL                        ((uint16_t)0x0600)            /*!< FIFO Reception Level */\r
2462 #define  SPI_SR_FRLVL_0                      ((uint16_t)0x0200)            /*!< Bit 0 */\r
2463 #define  SPI_SR_FRLVL_1                      ((uint16_t)0x0400)            /*!< Bit 1 */\r
2464 #define  SPI_SR_FTLVL                        ((uint16_t)0x1800)            /*!< FIFO Transmission Level */\r
2465 #define  SPI_SR_FTLVL_0                      ((uint16_t)0x0800)            /*!< Bit 0 */\r
2466 #define  SPI_SR_FTLVL_1                      ((uint16_t)0x1000)            /*!< Bit 1 */  \r
2467 \r
2468 /********************  Bit definition for SPI_DR register  ********************/\r
2469 #define  SPI_DR_DR                           ((uint16_t)0xFFFF)            /*!< Data Register */\r
2470 \r
2471 /*******************  Bit definition for SPI_CRCPR register  ******************/\r
2472 #define  SPI_CRCPR_CRCPOLY                   ((uint16_t)0xFFFF)            /*!< CRC polynomial register */\r
2473 \r
2474 /******************  Bit definition for SPI_RXCRCR register  ******************/\r
2475 #define  SPI_RXCRCR_RXCRC                    ((uint16_t)0xFFFF)            /*!< Rx CRC Register */\r
2476 \r
2477 /******************  Bit definition for SPI_TXCRCR register  ******************/\r
2478 #define  SPI_TXCRCR_TXCRC                    ((uint16_t)0xFFFF)            /*!< Tx CRC Register */\r
2479 \r
2480 /******************  Bit definition for SPI_I2SCFGR register  *****************/\r
2481 #define  SPI_I2SCFGR_CHLEN                   ((uint16_t)0x0001)            /*!<Channel length (number of bits per audio channel) */\r
2482 #define  SPI_I2SCFGR_DATLEN                  ((uint16_t)0x0006)            /*!<DATLEN[1:0] bits (Data length to be transferred) */\r
2483 #define  SPI_I2SCFGR_DATLEN_0                ((uint16_t)0x0002)            /*!<Bit 0 */\r
2484 #define  SPI_I2SCFGR_DATLEN_1                ((uint16_t)0x0004)            /*!<Bit 1 */\r
2485 #define  SPI_I2SCFGR_CKPOL                   ((uint16_t)0x0008)            /*!<steady state clock polarity */\r
2486 #define  SPI_I2SCFGR_I2SSTD                  ((uint16_t)0x0030)            /*!<I2SSTD[1:0] bits (I2S standard selection) */\r
2487 #define  SPI_I2SCFGR_I2SSTD_0                ((uint16_t)0x0010)            /*!<Bit 0 */\r
2488 #define  SPI_I2SCFGR_I2SSTD_1                ((uint16_t)0x0020)            /*!<Bit 1 */\r
2489 #define  SPI_I2SCFGR_PCMSYNC                 ((uint16_t)0x0080)            /*!<PCM frame synchronization */\r
2490 #define  SPI_I2SCFGR_I2SCFG                  ((uint16_t)0x0300)            /*!<I2SCFG[1:0] bits (I2S configuration mode) */\r
2491 #define  SPI_I2SCFGR_I2SCFG_0                ((uint16_t)0x0100)            /*!<Bit 0 */\r
2492 #define  SPI_I2SCFGR_I2SCFG_1                ((uint16_t)0x0200)            /*!<Bit 1 */\r
2493 #define  SPI_I2SCFGR_I2SE                    ((uint16_t)0x0400)            /*!<I2S Enable */\r
2494 #define  SPI_I2SCFGR_I2SMOD                  ((uint16_t)0x0800)            /*!<I2S mode selection */\r
2495 \r
2496 /******************  Bit definition for SPI_I2SPR register  *******************/\r
2497 #define  SPI_I2SPR_I2SDIV                    ((uint16_t)0x00FF)            /*!<I2S Linear prescaler */\r
2498 #define  SPI_I2SPR_ODD                       ((uint16_t)0x0100)            /*!<Odd factor for the prescaler */\r
2499 #define  SPI_I2SPR_MCKOE                     ((uint16_t)0x0200)            /*!<Master Clock Output Enable */\r
2500 \r
2501 /******************************************************************************/\r
2502 /*                                                                            */\r
2503 /*                       System Configuration (SYSCFG)                        */\r
2504 /*                                                                            */\r
2505 /******************************************************************************/\r
2506 /*****************  Bit definition for SYSCFG_CFGR1 register  ****************/\r
2507 #define SYSCFG_CFGR1_MEM_MODE               ((uint32_t)0x00000003) /*!< SYSCFG_Memory Remap Config */\r
2508 #define SYSCFG_CFGR1_MEM_MODE_0             ((uint32_t)0x00000001) /*!< SYSCFG_Memory Remap Config Bit 0 */\r
2509 #define SYSCFG_CFGR1_MEM_MODE_1             ((uint32_t)0x00000002) /*!< SYSCFG_Memory Remap Config Bit 1 */\r
2510 #define SYSCFG_CFGR1_ADC_DMA_RMP            ((uint32_t)0x00000100) /*!< ADC DMA remap */\r
2511 #define SYSCFG_CFGR1_USART1TX_DMA_RMP       ((uint32_t)0x00000200) /*!< USART1 TX DMA remap */\r
2512 #define SYSCFG_CFGR1_USART1RX_DMA_RMP       ((uint32_t)0x00000400) /*!< USART1 RX DMA remap */\r
2513 #define SYSCFG_CFGR1_TIM16_DMA_RMP          ((uint32_t)0x00000800) /*!< Timer 16 DMA remap */\r
2514 #define SYSCFG_CFGR1_TIM17_DMA_RMP          ((uint32_t)0x00001000) /*!< Timer 17 DMA remap */\r
2515 #define SYSCFG_CFGR1_I2C_FMP_PB6            ((uint32_t)0x00010000) /*!< I2C PB6 Fast mode plus */\r
2516 #define SYSCFG_CFGR1_I2C_FMP_PB7            ((uint32_t)0x00020000) /*!< I2C PB7 Fast mode plus */\r
2517 #define SYSCFG_CFGR1_I2C_FMP_PB8            ((uint32_t)0x00040000) /*!< I2C PB8 Fast mode plus */\r
2518 #define SYSCFG_CFGR1_I2C_FMP_PB9            ((uint32_t)0x00080000) /*!< I2C PB9 Fast mode plus */\r
2519 \r
2520 /*****************  Bit definition for SYSCFG_EXTICR1 register  ***************/\r
2521 #define SYSCFG_EXTICR1_EXTI0            ((uint16_t)0x000F) /*!< EXTI 0 configuration */\r
2522 #define SYSCFG_EXTICR1_EXTI1            ((uint16_t)0x00F0) /*!< EXTI 1 configuration */\r
2523 #define SYSCFG_EXTICR1_EXTI2            ((uint16_t)0x0F00) /*!< EXTI 2 configuration */\r
2524 #define SYSCFG_EXTICR1_EXTI3            ((uint16_t)0xF000) /*!< EXTI 3 configuration */\r
2525 \r
2526 /** \r
2527   * @brief  EXTI0 configuration  \r
2528   */\r
2529 #define SYSCFG_EXTICR1_EXTI0_PA         ((uint16_t)0x0000) /*!< PA[0] pin */\r
2530 #define SYSCFG_EXTICR1_EXTI0_PB         ((uint16_t)0x0001) /*!< PB[0] pin */\r
2531 #define SYSCFG_EXTICR1_EXTI0_PC         ((uint16_t)0x0002) /*!< PC[0] pin */\r
2532 #define SYSCFG_EXTICR1_EXTI0_PF         ((uint16_t)0x0003) /*!< PF[0] pin */\r
2533 \r
2534 /** \r
2535   * @brief  EXTI1 configuration  \r
2536   */ \r
2537 #define SYSCFG_EXTICR1_EXTI1_PA         ((uint16_t)0x0000) /*!< PA[1] pin */\r
2538 #define SYSCFG_EXTICR1_EXTI1_PB         ((uint16_t)0x0010) /*!< PB[1] pin */\r
2539 #define SYSCFG_EXTICR1_EXTI1_PC         ((uint16_t)0x0020) /*!< PC[1] pin */\r
2540 #define SYSCFG_EXTICR1_EXTI1_PF         ((uint16_t)0x0030) /*!< PF[1] pin */\r
2541 \r
2542 /** \r
2543   * @brief  EXTI2 configuration  \r
2544   */\r
2545 #define SYSCFG_EXTICR1_EXTI2_PA         ((uint16_t)0x0000) /*!< PA[2] pin */\r
2546 #define SYSCFG_EXTICR1_EXTI2_PB         ((uint16_t)0x0100) /*!< PB[2] pin */\r
2547 #define SYSCFG_EXTICR1_EXTI2_PC         ((uint16_t)0x0200) /*!< PC[2] pin */\r
2548 #define SYSCFG_EXTICR1_EXTI2_PD         ((uint16_t)0x0300) /*!< PD[2] pin */\r
2549 \r
2550 /** \r
2551   * @brief  EXTI3 configuration  \r
2552   */\r
2553 #define SYSCFG_EXTICR1_EXTI3_PA         ((uint16_t)0x0000) /*!< PA[3] pin */\r
2554 #define SYSCFG_EXTICR1_EXTI3_PB         ((uint16_t)0x1000) /*!< PB[3] pin */\r
2555 #define SYSCFG_EXTICR1_EXTI3_PC         ((uint16_t)0x2000) /*!< PC[3] pin */\r
2556 \r
2557 /*****************  Bit definition for SYSCFG_EXTICR2 register  *****************/\r
2558 #define SYSCFG_EXTICR2_EXTI4            ((uint16_t)0x000F) /*!< EXTI 4 configuration */\r
2559 #define SYSCFG_EXTICR2_EXTI5            ((uint16_t)0x00F0) /*!< EXTI 5 configuration */\r
2560 #define SYSCFG_EXTICR2_EXTI6            ((uint16_t)0x0F00) /*!< EXTI 6 configuration */\r
2561 #define SYSCFG_EXTICR2_EXTI7            ((uint16_t)0xF000) /*!< EXTI 7 configuration */\r
2562 \r
2563 /** \r
2564   * @brief  EXTI4 configuration  \r
2565   */\r
2566 #define SYSCFG_EXTICR2_EXTI4_PA         ((uint16_t)0x0000) /*!< PA[4] pin */\r
2567 #define SYSCFG_EXTICR2_EXTI4_PB         ((uint16_t)0x0001) /*!< PB[4] pin */\r
2568 #define SYSCFG_EXTICR2_EXTI4_PC         ((uint16_t)0x0002) /*!< PC[4] pin */\r
2569 #define SYSCFG_EXTICR2_EXTI4_PF         ((uint16_t)0x0003) /*!< PF[4] pin */\r
2570 \r
2571 /** \r
2572   * @brief  EXTI5 configuration  \r
2573   */\r
2574 #define SYSCFG_EXTICR2_EXTI5_PA         ((uint16_t)0x0000) /*!< PA[5] pin */\r
2575 #define SYSCFG_EXTICR2_EXTI5_PB         ((uint16_t)0x0010) /*!< PB[5] pin */\r
2576 #define SYSCFG_EXTICR2_EXTI5_PC         ((uint16_t)0x0020) /*!< PC[5] pin */\r
2577 #define SYSCFG_EXTICR2_EXTI5_PF         ((uint16_t)0x0030) /*!< PF[5] pin */\r
2578 \r
2579 /** \r
2580   * @brief  EXTI6 configuration  \r
2581   */\r
2582 #define SYSCFG_EXTICR2_EXTI6_PA         ((uint16_t)0x0000) /*!< PA[6] pin */\r
2583 #define SYSCFG_EXTICR2_EXTI6_PB         ((uint16_t)0x0100) /*!< PB[6] pin */\r
2584 #define SYSCFG_EXTICR2_EXTI6_PC         ((uint16_t)0x0200) /*!< PC[6] pin */\r
2585 #define SYSCFG_EXTICR2_EXTI6_PF         ((uint16_t)0x0300) /*!< PF[6] pin */\r
2586 \r
2587 /** \r
2588   * @brief  EXTI7 configuration  \r
2589   */\r
2590 #define SYSCFG_EXTICR2_EXTI7_PA         ((uint16_t)0x0000) /*!< PA[7] pin */\r
2591 #define SYSCFG_EXTICR2_EXTI7_PB         ((uint16_t)0x1000) /*!< PB[7] pin */\r
2592 #define SYSCFG_EXTICR2_EXTI7_PC         ((uint16_t)0x2000) /*!< PC[7] pin */\r
2593 #define SYSCFG_EXTICR2_EXTI7_PF         ((uint16_t)0x3000) /*!< PF[7] pin */\r
2594 \r
2595 /*****************  Bit definition for SYSCFG_EXTICR3 register  *****************/\r
2596 #define SYSCFG_EXTICR3_EXTI8            ((uint16_t)0x000F) /*!< EXTI 8 configuration */\r
2597 #define SYSCFG_EXTICR3_EXTI9            ((uint16_t)0x00F0) /*!< EXTI 9 configuration */\r
2598 #define SYSCFG_EXTICR3_EXTI10           ((uint16_t)0x0F00) /*!< EXTI 10 configuration */\r
2599 #define SYSCFG_EXTICR3_EXTI11           ((uint16_t)0xF000) /*!< EXTI 11 configuration */\r
2600 \r
2601 /** \r
2602   * @brief  EXTI8 configuration  \r
2603   */\r
2604 #define SYSCFG_EXTICR3_EXTI8_PA         ((uint16_t)0x0000) /*!< PA[8] pin */\r
2605 #define SYSCFG_EXTICR3_EXTI8_PB         ((uint16_t)0x0001) /*!< PB[8] pin */\r
2606 #define SYSCFG_EXTICR3_EXTI8_PC         ((uint16_t)0x0002) /*!< PC[8] pin */\r
2607 \r
2608 /** \r
2609   * @brief  EXTI9 configuration  \r
2610   */\r
2611 #define SYSCFG_EXTICR3_EXTI9_PA         ((uint16_t)0x0000) /*!< PA[9] pin */\r
2612 #define SYSCFG_EXTICR3_EXTI9_PB         ((uint16_t)0x0010) /*!< PB[9] pin */\r
2613 #define SYSCFG_EXTICR3_EXTI9_PC         ((uint16_t)0x0020) /*!< PC[9] pin */\r
2614 \r
2615 /** \r
2616   * @brief  EXTI10 configuration  \r
2617   */\r
2618 #define SYSCFG_EXTICR3_EXTI10_PA        ((uint16_t)0x0000) /*!< PA[10] pin */\r
2619 #define SYSCFG_EXTICR3_EXTI10_PB        ((uint16_t)0x0100) /*!< PB[10] pin */\r
2620 #define SYSCFG_EXTICR3_EXTI10_PC        ((uint16_t)0x0200) /*!< PC[10] pin */\r
2621 \r
2622 /** \r
2623   * @brief  EXTI11 configuration  \r
2624   */\r
2625 #define SYSCFG_EXTICR3_EXTI11_PA        ((uint16_t)0x0000) /*!< PA[11] pin */\r
2626 #define SYSCFG_EXTICR3_EXTI11_PB        ((uint16_t)0x1000) /*!< PB[11] pin */\r
2627 #define SYSCFG_EXTICR3_EXTI11_PC        ((uint16_t)0x2000) /*!< PC[11] pin */\r
2628 \r
2629 /*****************  Bit definition for SYSCFG_EXTICR4 register  *****************/\r
2630 #define SYSCFG_EXTICR4_EXTI12           ((uint16_t)0x000F) /*!< EXTI 12 configuration */\r
2631 #define SYSCFG_EXTICR4_EXTI13           ((uint16_t)0x00F0) /*!< EXTI 13 configuration */\r
2632 #define SYSCFG_EXTICR4_EXTI14           ((uint16_t)0x0F00) /*!< EXTI 14 configuration */\r
2633 #define SYSCFG_EXTICR4_EXTI15           ((uint16_t)0xF000) /*!< EXTI 15 configuration */\r
2634 \r
2635 /** \r
2636   * @brief  EXTI12 configuration  \r
2637   */\r
2638 #define SYSCFG_EXTICR4_EXTI12_PA        ((uint16_t)0x0000) /*!< PA[12] pin */\r
2639 #define SYSCFG_EXTICR4_EXTI12_PB        ((uint16_t)0x0001) /*!< PB[12] pin */\r
2640 #define SYSCFG_EXTICR4_EXTI12_PC        ((uint16_t)0x0002) /*!< PC[12] pin */\r
2641 \r
2642 /** \r
2643   * @brief  EXTI13 configuration  \r
2644   */\r
2645 #define SYSCFG_EXTICR4_EXTI13_PA        ((uint16_t)0x0000) /*!< PA[13] pin */\r
2646 #define SYSCFG_EXTICR4_EXTI13_PB        ((uint16_t)0x0010) /*!< PB[13] pin */\r
2647 #define SYSCFG_EXTICR4_EXTI13_PC        ((uint16_t)0x0020) /*!< PC[13] pin */\r
2648 \r
2649 /** \r
2650   * @brief  EXTI14 configuration  \r
2651   */\r
2652 #define SYSCFG_EXTICR4_EXTI14_PA        ((uint16_t)0x0000) /*!< PA[14] pin */\r
2653 #define SYSCFG_EXTICR4_EXTI14_PB        ((uint16_t)0x0100) /*!< PB[14] pin */\r
2654 #define SYSCFG_EXTICR4_EXTI14_PC        ((uint16_t)0x0200) /*!< PC[14] pin */\r
2655 \r
2656 /** \r
2657   * @brief  EXTI15 configuration  \r
2658   */\r
2659 #define SYSCFG_EXTICR4_EXTI15_PA        ((uint16_t)0x0000) /*!< PA[15] pin */\r
2660 #define SYSCFG_EXTICR4_EXTI15_PB        ((uint16_t)0x1000) /*!< PB[15] pin */\r
2661 #define SYSCFG_EXTICR4_EXTI15_PC        ((uint16_t)0x2000) /*!< PC[15] pin */\r
2662 \r
2663 /*****************  Bit definition for SYSCFG_CFGR2 register  ****************/\r
2664 #define SYSCFG_CFGR2_LOCKUP_LOCK               ((uint32_t)0x00000001) /*!< Enables and locks the PVD connection with Timer1 Break Input and also the PVD_EN and PVDSEL[2:0] bits of the Power Control Interface */\r
2665 #define SYSCFG_CFGR2_SRAM_PARITY_LOCK          ((uint32_t)0x00000002) /*!< Enables and locks the SRAM_PARITY error signal with Break Input of TIMER1 */\r
2666 #define SYSCFG_CFGR2_PVD_LOCK                  ((uint32_t)0x00000004) /*!< Enables and locks the LOCKUP (Hardfault) output of CortexM0 with Break Input of TIMER1 */\r
2667 #define SYSCFG_CFGR2_SRAM_PE                   ((uint32_t)0x00000100) /*!< SRAM Parity error flag */\r
2668 \r
2669 /******************************************************************************/\r
2670 /*                                                                            */\r
2671 /*                               Timers (TIM)                                 */\r
2672 /*                                                                            */\r
2673 /******************************************************************************/\r
2674 /*******************  Bit definition for TIM_CR1 register  ********************/\r
2675 #define  TIM_CR1_CEN                         ((uint16_t)0x0001)            /*!<Counter enable */\r
2676 #define  TIM_CR1_UDIS                        ((uint16_t)0x0002)            /*!<Update disable */\r
2677 #define  TIM_CR1_URS                         ((uint16_t)0x0004)            /*!<Update request source */\r
2678 #define  TIM_CR1_OPM                         ((uint16_t)0x0008)            /*!<One pulse mode */\r
2679 #define  TIM_CR1_DIR                         ((uint16_t)0x0010)            /*!<Direction */\r
2680 \r
2681 #define  TIM_CR1_CMS                         ((uint16_t)0x0060)            /*!<CMS[1:0] bits (Center-aligned mode selection) */\r
2682 #define  TIM_CR1_CMS_0                       ((uint16_t)0x0020)            /*!<Bit 0 */\r
2683 #define  TIM_CR1_CMS_1                       ((uint16_t)0x0040)            /*!<Bit 1 */\r
2684 \r
2685 #define  TIM_CR1_ARPE                        ((uint16_t)0x0080)            /*!<Auto-reload preload enable */\r
2686 \r
2687 #define  TIM_CR1_CKD                         ((uint16_t)0x0300)            /*!<CKD[1:0] bits (clock division) */\r
2688 #define  TIM_CR1_CKD_0                       ((uint16_t)0x0100)            /*!<Bit 0 */\r
2689 #define  TIM_CR1_CKD_1                       ((uint16_t)0x0200)            /*!<Bit 1 */\r
2690 \r
2691 /*******************  Bit definition for TIM_CR2 register  ********************/\r
2692 #define  TIM_CR2_CCPC                        ((uint16_t)0x0001)            /*!<Capture/Compare Preloaded Control */\r
2693 #define  TIM_CR2_CCUS                        ((uint16_t)0x0004)            /*!<Capture/Compare Control Update Selection */\r
2694 #define  TIM_CR2_CCDS                        ((uint16_t)0x0008)            /*!<Capture/Compare DMA Selection */\r
2695 \r
2696 #define  TIM_CR2_MMS                         ((uint16_t)0x0070)            /*!<MMS[2:0] bits (Master Mode Selection) */\r
2697 #define  TIM_CR2_MMS_0                       ((uint16_t)0x0010)            /*!<Bit 0 */\r
2698 #define  TIM_CR2_MMS_1                       ((uint16_t)0x0020)            /*!<Bit 1 */\r
2699 #define  TIM_CR2_MMS_2                       ((uint16_t)0x0040)            /*!<Bit 2 */\r
2700 \r
2701 #define  TIM_CR2_TI1S                        ((uint16_t)0x0080)            /*!<TI1 Selection */\r
2702 #define  TIM_CR2_OIS1                        ((uint16_t)0x0100)            /*!<Output Idle state 1 (OC1 output) */\r
2703 #define  TIM_CR2_OIS1N                       ((uint16_t)0x0200)            /*!<Output Idle state 1 (OC1N output) */\r
2704 #define  TIM_CR2_OIS2                        ((uint16_t)0x0400)            /*!<Output Idle state 2 (OC2 output) */\r
2705 #define  TIM_CR2_OIS2N                       ((uint16_t)0x0800)            /*!<Output Idle state 2 (OC2N output) */\r
2706 #define  TIM_CR2_OIS3                        ((uint16_t)0x1000)            /*!<Output Idle state 3 (OC3 output) */\r
2707 #define  TIM_CR2_OIS3N                       ((uint16_t)0x2000)            /*!<Output Idle state 3 (OC3N output) */\r
2708 #define  TIM_CR2_OIS4                        ((uint16_t)0x4000)            /*!<Output Idle state 4 (OC4 output) */\r
2709 \r
2710 /*******************  Bit definition for TIM_SMCR register  *******************/\r
2711 #define  TIM_SMCR_SMS                        ((uint16_t)0x0007)            /*!<SMS[2:0] bits (Slave mode selection) */\r
2712 #define  TIM_SMCR_SMS_0                      ((uint16_t)0x0001)            /*!<Bit 0 */\r
2713 #define  TIM_SMCR_SMS_1                      ((uint16_t)0x0002)            /*!<Bit 1 */\r
2714 #define  TIM_SMCR_SMS_2                      ((uint16_t)0x0004)            /*!<Bit 2 */\r
2715 \r
2716 #define  TIM_SMCR_OCCS                       ((uint16_t)0x0008)            /*!< OCREF clear selection */\r
2717 \r
2718 #define  TIM_SMCR_TS                         ((uint16_t)0x0070)            /*!<TS[2:0] bits (Trigger selection) */\r
2719 #define  TIM_SMCR_TS_0                       ((uint16_t)0x0010)            /*!<Bit 0 */\r
2720 #define  TIM_SMCR_TS_1                       ((uint16_t)0x0020)            /*!<Bit 1 */\r
2721 #define  TIM_SMCR_TS_2                       ((uint16_t)0x0040)            /*!<Bit 2 */\r
2722 \r
2723 #define  TIM_SMCR_MSM                        ((uint16_t)0x0080)            /*!<Master/slave mode */\r
2724 \r
2725 #define  TIM_SMCR_ETF                        ((uint16_t)0x0F00)            /*!<ETF[3:0] bits (External trigger filter) */\r
2726 #define  TIM_SMCR_ETF_0                      ((uint16_t)0x0100)            /*!<Bit 0 */\r
2727 #define  TIM_SMCR_ETF_1                      ((uint16_t)0x0200)            /*!<Bit 1 */\r
2728 #define  TIM_SMCR_ETF_2                      ((uint16_t)0x0400)            /*!<Bit 2 */\r
2729 #define  TIM_SMCR_ETF_3                      ((uint16_t)0x0800)            /*!<Bit 3 */\r
2730 \r
2731 #define  TIM_SMCR_ETPS                       ((uint16_t)0x3000)            /*!<ETPS[1:0] bits (External trigger prescaler) */\r
2732 #define  TIM_SMCR_ETPS_0                     ((uint16_t)0x1000)            /*!<Bit 0 */\r
2733 #define  TIM_SMCR_ETPS_1                     ((uint16_t)0x2000)            /*!<Bit 1 */\r
2734 \r
2735 #define  TIM_SMCR_ECE                        ((uint16_t)0x4000)            /*!<External clock enable */\r
2736 #define  TIM_SMCR_ETP                        ((uint16_t)0x8000)            /*!<External trigger polarity */\r
2737 \r
2738 /*******************  Bit definition for TIM_DIER register  *******************/\r
2739 #define  TIM_DIER_UIE                        ((uint16_t)0x0001)            /*!<Update interrupt enable */\r
2740 #define  TIM_DIER_CC1IE                      ((uint16_t)0x0002)            /*!<Capture/Compare 1 interrupt enable */\r
2741 #define  TIM_DIER_CC2IE                      ((uint16_t)0x0004)            /*!<Capture/Compare 2 interrupt enable */\r
2742 #define  TIM_DIER_CC3IE                      ((uint16_t)0x0008)            /*!<Capture/Compare 3 interrupt enable */\r
2743 #define  TIM_DIER_CC4IE                      ((uint16_t)0x0010)            /*!<Capture/Compare 4 interrupt enable */\r
2744 #define  TIM_DIER_COMIE                      ((uint16_t)0x0020)            /*!<COM interrupt enable */\r
2745 #define  TIM_DIER_TIE                        ((uint16_t)0x0040)            /*!<Trigger interrupt enable */\r
2746 #define  TIM_DIER_BIE                        ((uint16_t)0x0080)            /*!<Break interrupt enable */\r
2747 #define  TIM_DIER_UDE                        ((uint16_t)0x0100)            /*!<Update DMA request enable */\r
2748 #define  TIM_DIER_CC1DE                      ((uint16_t)0x0200)            /*!<Capture/Compare 1 DMA request enable */\r
2749 #define  TIM_DIER_CC2DE                      ((uint16_t)0x0400)            /*!<Capture/Compare 2 DMA request enable */\r
2750 #define  TIM_DIER_CC3DE                      ((uint16_t)0x0800)            /*!<Capture/Compare 3 DMA request enable */\r
2751 #define  TIM_DIER_CC4DE                      ((uint16_t)0x1000)            /*!<Capture/Compare 4 DMA request enable */\r
2752 #define  TIM_DIER_COMDE                      ((uint16_t)0x2000)            /*!<COM DMA request enable */\r
2753 #define  TIM_DIER_TDE                        ((uint16_t)0x4000)            /*!<Trigger DMA request enable */\r
2754 \r
2755 /********************  Bit definition for TIM_SR register  ********************/\r
2756 #define  TIM_SR_UIF                          ((uint16_t)0x0001)            /*!<Update interrupt Flag */\r
2757 #define  TIM_SR_CC1IF                        ((uint16_t)0x0002)            /*!<Capture/Compare 1 interrupt Flag */\r
2758 #define  TIM_SR_CC2IF                        ((uint16_t)0x0004)            /*!<Capture/Compare 2 interrupt Flag */\r
2759 #define  TIM_SR_CC3IF                        ((uint16_t)0x0008)            /*!<Capture/Compare 3 interrupt Flag */\r
2760 #define  TIM_SR_CC4IF                        ((uint16_t)0x0010)            /*!<Capture/Compare 4 interrupt Flag */\r
2761 #define  TIM_SR_COMIF                        ((uint16_t)0x0020)            /*!<COM interrupt Flag */\r
2762 #define  TIM_SR_TIF                          ((uint16_t)0x0040)            /*!<Trigger interrupt Flag */\r
2763 #define  TIM_SR_BIF                          ((uint16_t)0x0080)            /*!<Break interrupt Flag */\r
2764 #define  TIM_SR_CC1OF                        ((uint16_t)0x0200)            /*!<Capture/Compare 1 Overcapture Flag */\r
2765 #define  TIM_SR_CC2OF                        ((uint16_t)0x0400)            /*!<Capture/Compare 2 Overcapture Flag */\r
2766 #define  TIM_SR_CC3OF                        ((uint16_t)0x0800)            /*!<Capture/Compare 3 Overcapture Flag */\r
2767 #define  TIM_SR_CC4OF                        ((uint16_t)0x1000)            /*!<Capture/Compare 4 Overcapture Flag */\r
2768 \r
2769 /*******************  Bit definition for TIM_EGR register  ********************/\r
2770 #define  TIM_EGR_UG                          ((uint8_t)0x01)               /*!<Update Generation */\r
2771 #define  TIM_EGR_CC1G                        ((uint8_t)0x02)               /*!<Capture/Compare 1 Generation */\r
2772 #define  TIM_EGR_CC2G                        ((uint8_t)0x04)               /*!<Capture/Compare 2 Generation */\r
2773 #define  TIM_EGR_CC3G                        ((uint8_t)0x08)               /*!<Capture/Compare 3 Generation */\r
2774 #define  TIM_EGR_CC4G                        ((uint8_t)0x10)               /*!<Capture/Compare 4 Generation */\r
2775 #define  TIM_EGR_COMG                        ((uint8_t)0x20)               /*!<Capture/Compare Control Update Generation */\r
2776 #define  TIM_EGR_TG                          ((uint8_t)0x40)               /*!<Trigger Generation */\r
2777 #define  TIM_EGR_BG                          ((uint8_t)0x80)               /*!<Break Generation */\r
2778 \r
2779 /******************  Bit definition for TIM_CCMR1 register  *******************/\r
2780 #define  TIM_CCMR1_CC1S                      ((uint16_t)0x0003)            /*!<CC1S[1:0] bits (Capture/Compare 1 Selection) */\r
2781 #define  TIM_CCMR1_CC1S_0                    ((uint16_t)0x0001)            /*!<Bit 0 */\r
2782 #define  TIM_CCMR1_CC1S_1                    ((uint16_t)0x0002)            /*!<Bit 1 */\r
2783 \r
2784 #define  TIM_CCMR1_OC1FE                     ((uint16_t)0x0004)            /*!<Output Compare 1 Fast enable */\r
2785 #define  TIM_CCMR1_OC1PE                     ((uint16_t)0x0008)            /*!<Output Compare 1 Preload enable */\r
2786 \r
2787 #define  TIM_CCMR1_OC1M                      ((uint16_t)0x0070)            /*!<OC1M[2:0] bits (Output Compare 1 Mode) */\r
2788 #define  TIM_CCMR1_OC1M_0                    ((uint16_t)0x0010)            /*!<Bit 0 */\r
2789 #define  TIM_CCMR1_OC1M_1                    ((uint16_t)0x0020)            /*!<Bit 1 */\r
2790 #define  TIM_CCMR1_OC1M_2                    ((uint16_t)0x0040)            /*!<Bit 2 */\r
2791 \r
2792 #define  TIM_CCMR1_OC1CE                     ((uint16_t)0x0080)            /*!<Output Compare 1Clear Enable */\r
2793 \r
2794 #define  TIM_CCMR1_CC2S                      ((uint16_t)0x0300)            /*!<CC2S[1:0] bits (Capture/Compare 2 Selection) */\r
2795 #define  TIM_CCMR1_CC2S_0                    ((uint16_t)0x0100)            /*!<Bit 0 */\r
2796 #define  TIM_CCMR1_CC2S_1                    ((uint16_t)0x0200)            /*!<Bit 1 */\r
2797 \r
2798 #define  TIM_CCMR1_OC2FE                     ((uint16_t)0x0400)            /*!<Output Compare 2 Fast enable */\r
2799 #define  TIM_CCMR1_OC2PE                     ((uint16_t)0x0800)            /*!<Output Compare 2 Preload enable */\r
2800 \r
2801 #define  TIM_CCMR1_OC2M                      ((uint16_t)0x7000)            /*!<OC2M[2:0] bits (Output Compare 2 Mode) */\r
2802 #define  TIM_CCMR1_OC2M_0                    ((uint16_t)0x1000)            /*!<Bit 0 */\r
2803 #define  TIM_CCMR1_OC2M_1                    ((uint16_t)0x2000)            /*!<Bit 1 */\r
2804 #define  TIM_CCMR1_OC2M_2                    ((uint16_t)0x4000)            /*!<Bit 2 */\r
2805 \r
2806 #define  TIM_CCMR1_OC2CE                     ((uint16_t)0x8000)            /*!<Output Compare 2 Clear Enable */\r
2807 \r
2808 /*----------------------------------------------------------------------------*/\r
2809 \r
2810 #define  TIM_CCMR1_IC1PSC                    ((uint16_t)0x000C)            /*!<IC1PSC[1:0] bits (Input Capture 1 Prescaler) */\r
2811 #define  TIM_CCMR1_IC1PSC_0                  ((uint16_t)0x0004)            /*!<Bit 0 */\r
2812 #define  TIM_CCMR1_IC1PSC_1                  ((uint16_t)0x0008)            /*!<Bit 1 */\r
2813 \r
2814 #define  TIM_CCMR1_IC1F                      ((uint16_t)0x00F0)            /*!<IC1F[3:0] bits (Input Capture 1 Filter) */\r
2815 #define  TIM_CCMR1_IC1F_0                    ((uint16_t)0x0010)            /*!<Bit 0 */\r
2816 #define  TIM_CCMR1_IC1F_1                    ((uint16_t)0x0020)            /*!<Bit 1 */\r
2817 #define  TIM_CCMR1_IC1F_2                    ((uint16_t)0x0040)            /*!<Bit 2 */\r
2818 #define  TIM_CCMR1_IC1F_3                    ((uint16_t)0x0080)            /*!<Bit 3 */\r
2819 \r
2820 #define  TIM_CCMR1_IC2PSC                    ((uint16_t)0x0C00)            /*!<IC2PSC[1:0] bits (Input Capture 2 Prescaler) */\r
2821 #define  TIM_CCMR1_IC2PSC_0                  ((uint16_t)0x0400)            /*!<Bit 0 */\r
2822 #define  TIM_CCMR1_IC2PSC_1                  ((uint16_t)0x0800)            /*!<Bit 1 */\r
2823 \r
2824 #define  TIM_CCMR1_IC2F                      ((uint16_t)0xF000)            /*!<IC2F[3:0] bits (Input Capture 2 Filter) */\r
2825 #define  TIM_CCMR1_IC2F_0                    ((uint16_t)0x1000)            /*!<Bit 0 */\r
2826 #define  TIM_CCMR1_IC2F_1                    ((uint16_t)0x2000)            /*!<Bit 1 */\r
2827 #define  TIM_CCMR1_IC2F_2                    ((uint16_t)0x4000)            /*!<Bit 2 */\r
2828 #define  TIM_CCMR1_IC2F_3                    ((uint16_t)0x8000)            /*!<Bit 3 */\r
2829 \r
2830 /******************  Bit definition for TIM_CCMR2 register  *******************/\r
2831 #define  TIM_CCMR2_CC3S                      ((uint16_t)0x0003)            /*!<CC3S[1:0] bits (Capture/Compare 3 Selection) */\r
2832 #define  TIM_CCMR2_CC3S_0                    ((uint16_t)0x0001)            /*!<Bit 0 */\r
2833 #define  TIM_CCMR2_CC3S_1                    ((uint16_t)0x0002)            /*!<Bit 1 */\r
2834 \r
2835 #define  TIM_CCMR2_OC3FE                     ((uint16_t)0x0004)            /*!<Output Compare 3 Fast enable */\r
2836 #define  TIM_CCMR2_OC3PE                     ((uint16_t)0x0008)            /*!<Output Compare 3 Preload enable */\r
2837 \r
2838 #define  TIM_CCMR2_OC3M                      ((uint16_t)0x0070)            /*!<OC3M[2:0] bits (Output Compare 3 Mode) */\r
2839 #define  TIM_CCMR2_OC3M_0                    ((uint16_t)0x0010)            /*!<Bit 0 */\r
2840 #define  TIM_CCMR2_OC3M_1                    ((uint16_t)0x0020)            /*!<Bit 1 */\r
2841 #define  TIM_CCMR2_OC3M_2                    ((uint16_t)0x0040)            /*!<Bit 2 */\r
2842 \r
2843 #define  TIM_CCMR2_OC3CE                     ((uint16_t)0x0080)            /*!<Output Compare 3 Clear Enable */\r
2844 \r
2845 #define  TIM_CCMR2_CC4S                      ((uint16_t)0x0300)            /*!<CC4S[1:0] bits (Capture/Compare 4 Selection) */\r
2846 #define  TIM_CCMR2_CC4S_0                    ((uint16_t)0x0100)            /*!<Bit 0 */\r
2847 #define  TIM_CCMR2_CC4S_1                    ((uint16_t)0x0200)            /*!<Bit 1 */\r
2848 \r
2849 #define  TIM_CCMR2_OC4FE                     ((uint16_t)0x0400)            /*!<Output Compare 4 Fast enable */\r
2850 #define  TIM_CCMR2_OC4PE                     ((uint16_t)0x0800)            /*!<Output Compare 4 Preload enable */\r
2851 \r
2852 #define  TIM_CCMR2_OC4M                      ((uint16_t)0x7000)            /*!<OC4M[2:0] bits (Output Compare 4 Mode) */\r
2853 #define  TIM_CCMR2_OC4M_0                    ((uint16_t)0x1000)            /*!<Bit 0 */\r
2854 #define  TIM_CCMR2_OC4M_1                    ((uint16_t)0x2000)            /*!<Bit 1 */\r
2855 #define  TIM_CCMR2_OC4M_2                    ((uint16_t)0x4000)            /*!<Bit 2 */\r
2856 \r
2857 #define  TIM_CCMR2_OC4CE                     ((uint16_t)0x8000)            /*!<Output Compare 4 Clear Enable */\r
2858 \r
2859 /*----------------------------------------------------------------------------*/\r
2860 \r
2861 #define  TIM_CCMR2_IC3PSC                    ((uint16_t)0x000C)            /*!<IC3PSC[1:0] bits (Input Capture 3 Prescaler) */\r
2862 #define  TIM_CCMR2_IC3PSC_0                  ((uint16_t)0x0004)            /*!<Bit 0 */\r
2863 #define  TIM_CCMR2_IC3PSC_1                  ((uint16_t)0x0008)            /*!<Bit 1 */\r
2864 \r
2865 #define  TIM_CCMR2_IC3F                      ((uint16_t)0x00F0)            /*!<IC3F[3:0] bits (Input Capture 3 Filter) */\r
2866 #define  TIM_CCMR2_IC3F_0                    ((uint16_t)0x0010)            /*!<Bit 0 */\r
2867 #define  TIM_CCMR2_IC3F_1                    ((uint16_t)0x0020)            /*!<Bit 1 */\r
2868 #define  TIM_CCMR2_IC3F_2                    ((uint16_t)0x0040)            /*!<Bit 2 */\r
2869 #define  TIM_CCMR2_IC3F_3                    ((uint16_t)0x0080)            /*!<Bit 3 */\r
2870 \r
2871 #define  TIM_CCMR2_IC4PSC                    ((uint16_t)0x0C00)            /*!<IC4PSC[1:0] bits (Input Capture 4 Prescaler) */\r
2872 #define  TIM_CCMR2_IC4PSC_0                  ((uint16_t)0x0400)            /*!<Bit 0 */\r
2873 #define  TIM_CCMR2_IC4PSC_1                  ((uint16_t)0x0800)            /*!<Bit 1 */\r
2874 \r
2875 #define  TIM_CCMR2_IC4F                      ((uint16_t)0xF000)            /*!<IC4F[3:0] bits (Input Capture 4 Filter) */\r
2876 #define  TIM_CCMR2_IC4F_0                    ((uint16_t)0x1000)            /*!<Bit 0 */\r
2877 #define  TIM_CCMR2_IC4F_1                    ((uint16_t)0x2000)            /*!<Bit 1 */\r
2878 #define  TIM_CCMR2_IC4F_2                    ((uint16_t)0x4000)            /*!<Bit 2 */\r
2879 #define  TIM_CCMR2_IC4F_3                    ((uint16_t)0x8000)            /*!<Bit 3 */\r
2880 \r
2881 /*******************  Bit definition for TIM_CCER register  *******************/\r
2882 #define  TIM_CCER_CC1E                       ((uint16_t)0x0001)            /*!<Capture/Compare 1 output enable */\r
2883 #define  TIM_CCER_CC1P                       ((uint16_t)0x0002)            /*!<Capture/Compare 1 output Polarity */\r
2884 #define  TIM_CCER_CC1NE                      ((uint16_t)0x0004)            /*!<Capture/Compare 1 Complementary output enable */\r
2885 #define  TIM_CCER_CC1NP                      ((uint16_t)0x0008)            /*!<Capture/Compare 1 Complementary output Polarity */\r
2886 #define  TIM_CCER_CC2E                       ((uint16_t)0x0010)            /*!<Capture/Compare 2 output enable */\r
2887 #define  TIM_CCER_CC2P                       ((uint16_t)0x0020)            /*!<Capture/Compare 2 output Polarity */\r
2888 #define  TIM_CCER_CC2NE                      ((uint16_t)0x0040)            /*!<Capture/Compare 2 Complementary output enable */\r
2889 #define  TIM_CCER_CC2NP                      ((uint16_t)0x0080)            /*!<Capture/Compare 2 Complementary output Polarity */\r
2890 #define  TIM_CCER_CC3E                       ((uint16_t)0x0100)            /*!<Capture/Compare 3 output enable */\r
2891 #define  TIM_CCER_CC3P                       ((uint16_t)0x0200)            /*!<Capture/Compare 3 output Polarity */\r
2892 #define  TIM_CCER_CC3NE                      ((uint16_t)0x0400)            /*!<Capture/Compare 3 Complementary output enable */\r
2893 #define  TIM_CCER_CC3NP                      ((uint16_t)0x0800)            /*!<Capture/Compare 3 Complementary output Polarity */\r
2894 #define  TIM_CCER_CC4E                       ((uint16_t)0x1000)            /*!<Capture/Compare 4 output enable */\r
2895 #define  TIM_CCER_CC4P                       ((uint16_t)0x2000)            /*!<Capture/Compare 4 output Polarity */\r
2896 #define  TIM_CCER_CC4NP                      ((uint16_t)0x8000)            /*!<Capture/Compare 4 Complementary output Polarity */\r
2897 \r
2898 /*******************  Bit definition for TIM_CNT register  ********************/\r
2899 #define  TIM_CNT_CNT                         ((uint16_t)0xFFFF)            /*!<Counter Value */\r
2900 \r
2901 /*******************  Bit definition for TIM_PSC register  ********************/\r
2902 #define  TIM_PSC_PSC                         ((uint16_t)0xFFFF)            /*!<Prescaler Value */\r
2903 \r
2904 /*******************  Bit definition for TIM_ARR register  ********************/\r
2905 #define  TIM_ARR_ARR                         ((uint16_t)0xFFFF)            /*!<actual auto-reload Value */\r
2906 \r
2907 /*******************  Bit definition for TIM_RCR register  ********************/\r
2908 #define  TIM_RCR_REP                         ((uint8_t)0xFF)               /*!<Repetition Counter Value */\r
2909 \r
2910 /*******************  Bit definition for TIM_CCR1 register  *******************/\r
2911 #define  TIM_CCR1_CCR1                       ((uint16_t)0xFFFF)            /*!<Capture/Compare 1 Value */\r
2912 \r
2913 /*******************  Bit definition for TIM_CCR2 register  *******************/\r
2914 #define  TIM_CCR2_CCR2                       ((uint16_t)0xFFFF)            /*!<Capture/Compare 2 Value */\r
2915 \r
2916 /*******************  Bit definition for TIM_CCR3 register  *******************/\r
2917 #define  TIM_CCR3_CCR3                       ((uint16_t)0xFFFF)            /*!<Capture/Compare 3 Value */\r
2918 \r
2919 /*******************  Bit definition for TIM_CCR4 register  *******************/\r
2920 #define  TIM_CCR4_CCR4                       ((uint16_t)0xFFFF)            /*!<Capture/Compare 4 Value */\r
2921 \r
2922 /*******************  Bit definition for TIM_BDTR register  *******************/\r
2923 #define  TIM_BDTR_DTG                        ((uint16_t)0x00FF)            /*!<DTG[0:7] bits (Dead-Time Generator set-up) */\r
2924 #define  TIM_BDTR_DTG_0                      ((uint16_t)0x0001)            /*!<Bit 0 */\r
2925 #define  TIM_BDTR_DTG_1                      ((uint16_t)0x0002)            /*!<Bit 1 */\r
2926 #define  TIM_BDTR_DTG_2                      ((uint16_t)0x0004)            /*!<Bit 2 */\r
2927 #define  TIM_BDTR_DTG_3                      ((uint16_t)0x0008)            /*!<Bit 3 */\r
2928 #define  TIM_BDTR_DTG_4                      ((uint16_t)0x0010)            /*!<Bit 4 */\r
2929 #define  TIM_BDTR_DTG_5                      ((uint16_t)0x0020)            /*!<Bit 5 */\r
2930 #define  TIM_BDTR_DTG_6                      ((uint16_t)0x0040)            /*!<Bit 6 */\r
2931 #define  TIM_BDTR_DTG_7                      ((uint16_t)0x0080)            /*!<Bit 7 */\r
2932 \r
2933 #define  TIM_BDTR_LOCK                       ((uint16_t)0x0300)            /*!<LOCK[1:0] bits (Lock Configuration) */\r
2934 #define  TIM_BDTR_LOCK_0                     ((uint16_t)0x0100)            /*!<Bit 0 */\r
2935 #define  TIM_BDTR_LOCK_1                     ((uint16_t)0x0200)            /*!<Bit 1 */\r
2936 \r
2937 #define  TIM_BDTR_OSSI                       ((uint16_t)0x0400)            /*!<Off-State Selection for Idle mode */\r
2938 #define  TIM_BDTR_OSSR                       ((uint16_t)0x0800)            /*!<Off-State Selection for Run mode */\r
2939 #define  TIM_BDTR_BKE                        ((uint16_t)0x1000)            /*!<Break enable */\r
2940 #define  TIM_BDTR_BKP                        ((uint16_t)0x2000)            /*!<Break Polarity */\r
2941 #define  TIM_BDTR_AOE                        ((uint16_t)0x4000)            /*!<Automatic Output enable */\r
2942 #define  TIM_BDTR_MOE                        ((uint16_t)0x8000)            /*!<Main Output enable */\r
2943 \r
2944 /*******************  Bit definition for TIM_DCR register  ********************/\r
2945 #define  TIM_DCR_DBA                         ((uint16_t)0x001F)            /*!<DBA[4:0] bits (DMA Base Address) */\r
2946 #define  TIM_DCR_DBA_0                       ((uint16_t)0x0001)            /*!<Bit 0 */\r
2947 #define  TIM_DCR_DBA_1                       ((uint16_t)0x0002)            /*!<Bit 1 */\r
2948 #define  TIM_DCR_DBA_2                       ((uint16_t)0x0004)            /*!<Bit 2 */\r
2949 #define  TIM_DCR_DBA_3                       ((uint16_t)0x0008)            /*!<Bit 3 */\r
2950 #define  TIM_DCR_DBA_4                       ((uint16_t)0x0010)            /*!<Bit 4 */\r
2951 \r
2952 #define  TIM_DCR_DBL                         ((uint16_t)0x1F00)            /*!<DBL[4:0] bits (DMA Burst Length) */\r
2953 #define  TIM_DCR_DBL_0                       ((uint16_t)0x0100)            /*!<Bit 0 */\r
2954 #define  TIM_DCR_DBL_1                       ((uint16_t)0x0200)            /*!<Bit 1 */\r
2955 #define  TIM_DCR_DBL_2                       ((uint16_t)0x0400)            /*!<Bit 2 */\r
2956 #define  TIM_DCR_DBL_3                       ((uint16_t)0x0800)            /*!<Bit 3 */\r
2957 #define  TIM_DCR_DBL_4                       ((uint16_t)0x1000)            /*!<Bit 4 */\r
2958 \r
2959 /*******************  Bit definition for TIM_DMAR register  *******************/\r
2960 #define  TIM_DMAR_DMAB                       ((uint16_t)0xFFFF)            /*!<DMA register for burst accesses */\r
2961 \r
2962 /*******************  Bit definition for TIM_OR register  *********************/\r
2963 #define TIM14_OR_TI1_RMP                       ((uint16_t)0x00C0)            /*!<TI1_RMP[1:0] bits (TIM14 Input 4 remap) */\r
2964 #define TIM14_OR_TI1_RMP_0                     ((uint16_t)0x0040)            /*!<Bit 0 */\r
2965 #define TIM14_OR_TI1_RMP_1                     ((uint16_t)0x0080)            /*!<Bit 1 */\r
2966 \r
2967 /******************************************************************************/\r
2968 /*                                                                            */\r
2969 /*      Universal Synchronous Asynchronous Receiver Transmitter (USART)       */\r
2970 /*                                                                            */\r
2971 /******************************************************************************/\r
2972 /******************  Bit definition for USART_CR1 register  *******************/\r
2973 #define  USART_CR1_UE                        ((uint32_t)0x00000001)            /*!< USART Enable */\r
2974 #define  USART_CR1_UESM                      ((uint32_t)0x00000002)            /*!< USART Enable in STOP Mode */\r
2975 #define  USART_CR1_RE                        ((uint32_t)0x00000004)            /*!< Receiver Enable */\r
2976 #define  USART_CR1_TE                        ((uint32_t)0x00000008)            /*!< Transmitter Enable */\r
2977 #define  USART_CR1_IDLEIE                    ((uint32_t)0x00000010)            /*!< IDLE Interrupt Enable */\r
2978 #define  USART_CR1_RXNEIE                    ((uint32_t)0x00000020)            /*!< RXNE Interrupt Enable */\r
2979 #define  USART_CR1_TCIE                      ((uint32_t)0x00000040)            /*!< Transmission Complete Interrupt Enable */\r
2980 #define  USART_CR1_TXEIE                     ((uint32_t)0x00000080)            /*!< TXE Interrupt Enable */\r
2981 #define  USART_CR1_PEIE                      ((uint32_t)0x00000100)            /*!< PE Interrupt Enable */\r
2982 #define  USART_CR1_PS                        ((uint32_t)0x00000200)            /*!< Parity Selection */\r
2983 #define  USART_CR1_PCE                       ((uint32_t)0x00000400)            /*!< Parity Control Enable */\r
2984 #define  USART_CR1_WAKE                      ((uint32_t)0x00000800)            /*!< Receiver Wakeup method */\r
2985 #define  USART_CR1_M                         ((uint32_t)0x00001000)            /*!< Word length */\r
2986 #define  USART_CR1_MME                       ((uint32_t)0x00002000)            /*!< Mute Mode Enable */\r
2987 #define  USART_CR1_CMIE                      ((uint32_t)0x00004000)            /*!< Character match interrupt enable */\r
2988 #define  USART_CR1_OVER8                     ((uint32_t)0x00008000)            /*!< Oversampling by 8-bit or 16-bit mode */\r
2989 #define  USART_CR1_DEDT                      ((uint32_t)0x001F0000)            /*!< DEDT[4:0] bits (Driver Enable Deassertion Time) */\r
2990 #define  USART_CR1_DEDT_0                    ((uint32_t)0x00010000)            /*!< Bit 0 */\r
2991 #define  USART_CR1_DEDT_1                    ((uint32_t)0x00020000)            /*!< Bit 1 */\r
2992 #define  USART_CR1_DEDT_2                    ((uint32_t)0x00040000)            /*!< Bit 2 */\r
2993 #define  USART_CR1_DEDT_3                    ((uint32_t)0x00080000)            /*!< Bit 3 */\r
2994 #define  USART_CR1_DEDT_4                    ((uint32_t)0x00100000)            /*!< Bit 4 */\r
2995 #define  USART_CR1_DEAT                      ((uint32_t)0x03E00000)            /*!< DEAT[4:0] bits (Driver Enable Assertion Time) */\r
2996 #define  USART_CR1_DEAT_0                    ((uint32_t)0x00200000)            /*!< Bit 0 */\r
2997 #define  USART_CR1_DEAT_1                    ((uint32_t)0x00400000)            /*!< Bit 1 */\r
2998 #define  USART_CR1_DEAT_2                    ((uint32_t)0x00800000)            /*!< Bit 2 */\r
2999 #define  USART_CR1_DEAT_3                    ((uint32_t)0x01000000)            /*!< Bit 3 */\r
3000 #define  USART_CR1_DEAT_4                    ((uint32_t)0x02000000)            /*!< Bit 4 */\r
3001 #define  USART_CR1_RTOIE                     ((uint32_t)0x04000000)            /*!< Receive Time Out interrupt enable */\r
3002 #define  USART_CR1_EOBIE                     ((uint32_t)0x08000000)            /*!< End of Block interrupt enable */\r
3003 \r
3004 /******************  Bit definition for USART_CR2 register  *******************/\r
3005 #define  USART_CR2_ADDM7                     ((uint32_t)0x00000010)            /*!< 7-bit or 4-bit Address Detection */\r
3006 #define  USART_CR2_LBDL                      ((uint32_t)0x00000020)            /*!< LIN Break Detection Length */\r
3007 #define  USART_CR2_LBDIE                     ((uint32_t)0x00000040)            /*!< LIN Break Detection Interrupt Enable */\r
3008 #define  USART_CR2_LBCL                      ((uint32_t)0x00000100)            /*!< Last Bit Clock pulse */\r
3009 #define  USART_CR2_CPHA                      ((uint32_t)0x00000200)            /*!< Clock Phase */\r
3010 #define  USART_CR2_CPOL                      ((uint32_t)0x00000400)            /*!< Clock Polarity */\r
3011 #define  USART_CR2_CLKEN                     ((uint32_t)0x00000800)            /*!< Clock Enable */\r
3012 #define  USART_CR2_STOP                      ((uint32_t)0x00003000)            /*!< STOP[1:0] bits (STOP bits) */\r
3013 #define  USART_CR2_STOP_0                    ((uint32_t)0x00001000)            /*!< Bit 0 */\r
3014 #define  USART_CR2_STOP_1                    ((uint32_t)0x00002000)            /*!< Bit 1 */\r
3015 #define  USART_CR2_LINEN                     ((uint32_t)0x00004000)            /*!< LIN mode enable */\r
3016 #define  USART_CR2_SWAP                      ((uint32_t)0x00008000)            /*!< SWAP TX/RX pins */\r
3017 #define  USART_CR2_RXINV                     ((uint32_t)0x00010000)            /*!< RX pin active level inversion */\r
3018 #define  USART_CR2_TXINV                     ((uint32_t)0x00020000)            /*!< TX pin active level inversion */\r
3019 #define  USART_CR2_DATAINV                   ((uint32_t)0x00040000)            /*!< Binary data inversion */\r
3020 #define  USART_CR2_MSBFIRST                  ((uint32_t)0x00080000)            /*!< Most Significant Bit First */\r
3021 #define  USART_CR2_ABREN                     ((uint32_t)0x00100000)            /*!< Auto Baud-Rate Enable*/\r
3022 #define  USART_CR2_ABRMODE                   ((uint32_t)0x00600000)            /*!< ABRMOD[1:0] bits (Auto Baud-Rate Mode) */\r
3023 #define  USART_CR2_ABRMODE_0                 ((uint32_t)0x00200000)            /*!< Bit 0 */\r
3024 #define  USART_CR2_ABRMODE_1                 ((uint32_t)0x00400000)            /*!< Bit 1 */\r
3025 #define  USART_CR2_RTOEN                     ((uint32_t)0x00800000)            /*!< Receiver Time-Out enable */\r
3026 #define  USART_CR2_ADD                       ((uint32_t)0xFF000000)            /*!< Address of the USART node */\r
3027 \r
3028 /******************  Bit definition for USART_CR3 register  *******************/\r
3029 #define  USART_CR3_EIE                       ((uint32_t)0x00000001)            /*!< Error Interrupt Enable */\r
3030 #define  USART_CR3_IREN                      ((uint32_t)0x00000002)            /*!< IrDA mode Enable */\r
3031 #define  USART_CR3_IRLP                      ((uint32_t)0x00000004)            /*!< IrDA Low-Power */\r
3032 #define  USART_CR3_HDSEL                     ((uint32_t)0x00000008)            /*!< Half-Duplex Selection */\r
3033 #define  USART_CR3_NACK                      ((uint32_t)0x00000010)            /*!< SmartCard NACK enable */\r
3034 #define  USART_CR3_SCEN                      ((uint32_t)0x00000020)            /*!< SmartCard mode enable */\r
3035 #define  USART_CR3_DMAR                      ((uint32_t)0x00000040)            /*!< DMA Enable Receiver */\r
3036 #define  USART_CR3_DMAT                      ((uint32_t)0x00000080)            /*!< DMA Enable Transmitter */\r
3037 #define  USART_CR3_RTSE                      ((uint32_t)0x00000100)            /*!< RTS Enable */\r
3038 #define  USART_CR3_CTSE                      ((uint32_t)0x00000200)            /*!< CTS Enable */\r
3039 #define  USART_CR3_CTSIE                     ((uint32_t)0x00000400)            /*!< CTS Interrupt Enable */\r
3040 #define  USART_CR3_ONEBIT                    ((uint32_t)0x00000800)            /*!< One sample bit method enable */\r
3041 #define  USART_CR3_OVRDIS                    ((uint32_t)0x00001000)            /*!< Overrun Disable */\r
3042 #define  USART_CR3_DDRE                      ((uint32_t)0x00002000)            /*!< DMA Disable on Reception Error */\r
3043 #define  USART_CR3_DEM                       ((uint32_t)0x00004000)            /*!< Driver Enable Mode */\r
3044 #define  USART_CR3_DEP                       ((uint32_t)0x00008000)            /*!< Driver Enable Polarity Selection */\r
3045 #define  USART_CR3_SCARCNT                   ((uint32_t)0x000E0000)            /*!< SCARCNT[2:0] bits (SmartCard Auto-Retry Count) */\r
3046 #define  USART_CR3_SCARCNT_0                 ((uint32_t)0x00020000)            /*!< Bit 0 */\r
3047 #define  USART_CR3_SCARCNT_1                 ((uint32_t)0x00040000)            /*!< Bit 1 */\r
3048 #define  USART_CR3_SCARCNT_2                 ((uint32_t)0x00080000)            /*!< Bit 2 */\r
3049 #define  USART_CR3_WUS                       ((uint32_t)0x00300000)            /*!< WUS[1:0] bits (Wake UP Interrupt Flag Selection) */\r
3050 #define  USART_CR3_WUS_0                     ((uint32_t)0x00100000)            /*!< Bit 0 */\r
3051 #define  USART_CR3_WUS_1                     ((uint32_t)0x00200000)            /*!< Bit 1 */\r
3052 #define  USART_CR3_WUFIE                     ((uint32_t)0x00400000)            /*!< Wake Up Interrupt Enable */\r
3053 \r
3054 /******************  Bit definition for USART_BRR register  *******************/\r
3055 #define  USART_BRR_DIV_FRACTION              ((uint16_t)0x000F)                /*!< Fraction of USARTDIV */\r
3056 #define  USART_BRR_DIV_MANTISSA              ((uint16_t)0xFFF0)                /*!< Mantissa of USARTDIV */\r
3057 \r
3058 /******************  Bit definition for USART_GTPR register  ******************/\r
3059 #define  USART_GTPR_PSC                      ((uint16_t)0x00FF)                /*!< PSC[7:0] bits (Prescaler value) */\r
3060 #define  USART_GTPR_GT                       ((uint16_t)0xFF00)                /*!< GT[7:0] bits (Guard time value) */\r
3061 \r
3062 \r
3063 /*******************  Bit definition for USART_RTOR register  *****************/\r
3064 #define  USART_RTOR_RTO                      ((uint32_t)0x00FFFFFF)            /*!< Receiver Time Out Value */\r
3065 #define  USART_RTOR_BLEN                     ((uint32_t)0xFF000000)            /*!< Block Length */\r
3066 \r
3067 /*******************  Bit definition for USART_RQR register  ******************/\r
3068 #define  USART_RQR_ABRRQ                    ((uint16_t)0x0001)                /*!< Auto-Baud Rate Request */\r
3069 #define  USART_RQR_SBKRQ                    ((uint16_t)0x0002)                /*!< Send Break Request */\r
3070 #define  USART_RQR_MMRQ                     ((uint16_t)0x0004)                /*!< Mute Mode Request */\r
3071 #define  USART_RQR_RXFRQ                    ((uint16_t)0x0008)                /*!< Receive Data flush Request */\r
3072 #define  USART_RQR_TXFRQ                    ((uint16_t)0x0010)                /*!< Transmit data flush Request */\r
3073 \r
3074 /*******************  Bit definition for USART_ISR register  ******************/\r
3075 #define  USART_ISR_PE                        ((uint32_t)0x00000001)            /*!< Parity Error */\r
3076 #define  USART_ISR_FE                        ((uint32_t)0x00000002)            /*!< Framing Error */\r
3077 #define  USART_ISR_NE                        ((uint32_t)0x00000004)            /*!< Noise detected Flag */\r
3078 #define  USART_ISR_ORE                       ((uint32_t)0x00000008)            /*!< OverRun Error */\r
3079 #define  USART_ISR_IDLE                      ((uint32_t)0x00000010)            /*!< IDLE line detected */\r
3080 #define  USART_ISR_RXNE                      ((uint32_t)0x00000020)            /*!< Read Data Register Not Empty */\r
3081 #define  USART_ISR_TC                        ((uint32_t)0x00000040)            /*!< Transmission Complete */\r
3082 #define  USART_ISR_TXE                       ((uint32_t)0x00000080)            /*!< Transmit Data Register Empty */\r
3083 #define  USART_ISR_LBD                       ((uint32_t)0x00000100)            /*!< LIN Break Detection Flag */\r
3084 #define  USART_ISR_CTSIF                     ((uint32_t)0x00000200)            /*!< CTS interrupt flag */\r
3085 #define  USART_ISR_CTS                       ((uint32_t)0x00000400)            /*!< CTS flag */\r
3086 #define  USART_ISR_RTOF                      ((uint32_t)0x00000800)            /*!< Receiver Time Out */\r
3087 #define  USART_ISR_EOBF                      ((uint32_t)0x00001000)            /*!< End Of Block Flag */\r
3088 #define  USART_ISR_ABRE                      ((uint32_t)0x00004000)            /*!< Auto-Baud Rate Error */\r
3089 #define  USART_ISR_ABRF                      ((uint32_t)0x00008000)            /*!< Auto-Baud Rate Flag */\r
3090 #define  USART_ISR_BUSY                      ((uint32_t)0x00010000)            /*!< Busy Flag */\r
3091 #define  USART_ISR_CMF                       ((uint32_t)0x00020000)            /*!< Character Match Flag */\r
3092 #define  USART_ISR_SBKF                      ((uint32_t)0x00040000)            /*!< Send Break Flag */\r
3093 #define  USART_ISR_RWU                       ((uint32_t)0x00080000)            /*!< Receive Wake Up from mute mode Flag */\r
3094 #define  USART_ISR_WUF                       ((uint32_t)0x00100000)            /*!< Wake Up from stop mode Flag */\r
3095 #define  USART_ISR_TEACK                     ((uint32_t)0x00200000)            /*!< Transmit Enable Acknowledge Flag */\r
3096 #define  USART_ISR_REACK                     ((uint32_t)0x00400000)            /*!< Receive Enable Acknowledge Flag */\r
3097 \r
3098 /*******************  Bit definition for USART_ICR register  ******************/\r
3099 #define  USART_ICR_PECF                      ((uint32_t)0x00000001)            /*!< Parity Error Clear Flag */\r
3100 #define  USART_ICR_FECF                      ((uint32_t)0x00000002)            /*!< Framing Error Clear Flag */\r
3101 #define  USART_ICR_NCF                      ((uint32_t)0x00000004)             /*!< Noise detected Clear Flag */\r
3102 #define  USART_ICR_ORECF                     ((uint32_t)0x00000008)            /*!< OverRun Error Clear Flag */\r
3103 #define  USART_ICR_IDLECF                    ((uint32_t)0x00000010)            /*!< IDLE line detected Clear Flag */\r
3104 #define  USART_ICR_TCCF                      ((uint32_t)0x00000040)            /*!< Transmission Complete Clear Flag */\r
3105 #define  USART_ICR_LBDCF                     ((uint32_t)0x00000100)            /*!< LIN Break Detection Clear Flag */\r
3106 #define  USART_ICR_CTSCF                     ((uint32_t)0x00000200)            /*!< CTS Interrupt Clear Flag */\r
3107 #define  USART_ICR_RTOCF                     ((uint32_t)0x00000800)            /*!< Receiver Time Out Clear Flag */\r
3108 #define  USART_ICR_EOBCF                     ((uint32_t)0x00001000)            /*!< End Of Block Clear Flag */\r
3109 #define  USART_ICR_CMCF                      ((uint32_t)0x00020000)            /*!< Character Match Clear Flag */\r
3110 #define  USART_ICR_WUCF                      ((uint32_t)0x00100000)            /*!< Wake Up from stop mode Clear Flag */\r
3111 \r
3112 /*******************  Bit definition for USART_RDR register  ******************/\r
3113 #define  USART_RDR_RDR                       ((uint16_t)0x01FF)                /*!< RDR[8:0] bits (Receive Data value) */\r
3114 \r
3115 /*******************  Bit definition for USART_TDR register  ******************/\r
3116 #define  USART_TDR_TDR                       ((uint16_t)0x01FF)                /*!< TDR[8:0] bits (Transmit Data value) */\r
3117 \r
3118 /******************************************************************************/\r
3119 /*                                                                            */\r
3120 /*                         Window WATCHDOG (WWDG)                             */\r
3121 /*                                                                            */\r
3122 /******************************************************************************/\r
3123 \r
3124 /*******************  Bit definition for WWDG_CR register  ********************/\r
3125 #define  WWDG_CR_T                           ((uint8_t)0x7F)               /*!< T[6:0] bits (7-Bit counter (MSB to LSB)) */\r
3126 #define  WWDG_CR_T0                          ((uint8_t)0x01)               /*!< Bit 0 */\r
3127 #define  WWDG_CR_T1                          ((uint8_t)0x02)               /*!< Bit 1 */\r
3128 #define  WWDG_CR_T2                          ((uint8_t)0x04)               /*!< Bit 2 */\r
3129 #define  WWDG_CR_T3                          ((uint8_t)0x08)               /*!< Bit 3 */\r
3130 #define  WWDG_CR_T4                          ((uint8_t)0x10)               /*!< Bit 4 */\r
3131 #define  WWDG_CR_T5                          ((uint8_t)0x20)               /*!< Bit 5 */\r
3132 #define  WWDG_CR_T6                          ((uint8_t)0x40)               /*!< Bit 6 */\r
3133 \r
3134 #define  WWDG_CR_WDGA                        ((uint8_t)0x80)               /*!< Activation bit */\r
3135 \r
3136 /*******************  Bit definition for WWDG_CFR register  *******************/\r
3137 #define  WWDG_CFR_W                          ((uint16_t)0x007F)            /*!< W[6:0] bits (7-bit window value) */\r
3138 #define  WWDG_CFR_W0                         ((uint16_t)0x0001)            /*!< Bit 0 */\r
3139 #define  WWDG_CFR_W1                         ((uint16_t)0x0002)            /*!< Bit 1 */\r
3140 #define  WWDG_CFR_W2                         ((uint16_t)0x0004)            /*!< Bit 2 */\r
3141 #define  WWDG_CFR_W3                         ((uint16_t)0x0008)            /*!< Bit 3 */\r
3142 #define  WWDG_CFR_W4                         ((uint16_t)0x0010)            /*!< Bit 4 */\r
3143 #define  WWDG_CFR_W5                         ((uint16_t)0x0020)            /*!< Bit 5 */\r
3144 #define  WWDG_CFR_W6                         ((uint16_t)0x0040)            /*!< Bit 6 */\r
3145 \r
3146 #define  WWDG_CFR_WDGTB                      ((uint16_t)0x0180)            /*!< WDGTB[1:0] bits (Timer Base) */\r
3147 #define  WWDG_CFR_WDGTB0                     ((uint16_t)0x0080)            /*!< Bit 0 */\r
3148 #define  WWDG_CFR_WDGTB1                     ((uint16_t)0x0100)            /*!< Bit 1 */\r
3149 \r
3150 #define  WWDG_CFR_EWI                        ((uint16_t)0x0200)            /*!< Early Wakeup Interrupt */\r
3151 \r
3152 /*******************  Bit definition for WWDG_SR register  ********************/\r
3153 #define  WWDG_SR_EWIF                        ((uint8_t)0x01)               /*!< Early Wakeup Interrupt Flag */\r
3154 \r
3155 /**\r
3156   * @}\r
3157   */\r
3158 \r
3159  /**\r
3160   * @}\r
3161   */ \r
3162 \r
3163 #ifdef USE_STDPERIPH_DRIVER\r
3164   #include "stm32f0xx_conf.h"\r
3165 #endif\r
3166 \r
3167 /** @addtogroup Exported_macro\r
3168   * @{\r
3169   */\r
3170 /**\r
3171   * @}\r
3172   */\r
3173 \r
3174 #ifdef __cplusplus\r
3175 }\r
3176 #endif\r
3177 \r
3178 #endif /* __STM32F0XX_H */\r
3179 \r
3180 /**\r
3181   * @}\r
3182   */\r
3183 \r
3184   /**\r
3185   * @}\r
3186   */\r
3187 \r
3188 /******************* (C) COPYRIGHT 2012 STMicroelectronics *****END OF FILE****/\r