stm32f030x6.h 227 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385
  1. /**
  2. ******************************************************************************
  3. * @file stm32f030x6.h
  4. * @author MCD Application Team
  5. * @version V2.2.3
  6. * @date 29-January-2016
  7. * @brief CMSIS Cortex-M0 Device Peripheral Access Layer Header File.
  8. * This file contains all the peripheral register's definitions, bits
  9. * definitions and memory mapping for STM32F0xx devices.
  10. *
  11. * This file contains:
  12. * - Data structures and the address mapping for all peripherals
  13. * - Peripheral's registers declarations and bits definition
  14. * - Macros to access peripheral’s registers hardware
  15. *
  16. ******************************************************************************
  17. * @attention
  18. *
  19. * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
  20. *
  21. * Redistribution and use in source and binary forms, with or without modification,
  22. * are permitted provided that the following conditions are met:
  23. * 1. Redistributions of source code must retain the above copyright notice,
  24. * this list of conditions and the following disclaimer.
  25. * 2. Redistributions in binary form must reproduce the above copyright notice,
  26. * this list of conditions and the following disclaimer in the documentation
  27. * and/or other materials provided with the distribution.
  28. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  29. * may be used to endorse or promote products derived from this software
  30. * without specific prior written permission.
  31. *
  32. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  33. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  34. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  35. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  36. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  37. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  38. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  39. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  40. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  41. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  42. *
  43. ******************************************************************************
  44. */
  45. /** @addtogroup CMSIS
  46. * @{
  47. */
  48. /** @addtogroup stm32f030x6
  49. * @{
  50. */
  51. #ifndef __STM32F030x6_H
  52. #define __STM32F030x6_H
  53. #ifdef __cplusplus
  54. extern "C" {
  55. #endif /* __cplusplus */
  56. /** @addtogroup Configuration_section_for_CMSIS
  57. * @{
  58. */
  59. /**
  60. * @brief Configuration of the Cortex-M0 Processor and Core Peripherals
  61. */
  62. #define __CM0_REV 0 /*!< Core Revision r0p0 */
  63. #define __MPU_PRESENT 0 /*!< STM32F0xx do not provide MPU */
  64. #define __NVIC_PRIO_BITS 2 /*!< STM32F0xx uses 2 Bits for the Priority Levels */
  65. #define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */
  66. /**
  67. * @}
  68. */
  69. /** @addtogroup Peripheral_interrupt_number_definition
  70. * @{
  71. */
  72. /**
  73. * @brief STM32F0xx Interrupt Number Definition, according to the selected device
  74. * in @ref Library_configuration_section
  75. */
  76. /*!< Interrupt Number Definition */
  77. typedef enum
  78. {
  79. /****** Cortex-M0 Processor Exceptions Numbers **************************************************************/
  80. NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */
  81. HardFault_IRQn = -13, /*!< 3 Cortex-M0 Hard Fault Interrupt */
  82. SVC_IRQn = -5, /*!< 11 Cortex-M0 SV Call Interrupt */
  83. PendSV_IRQn = -2, /*!< 14 Cortex-M0 Pend SV Interrupt */
  84. SysTick_IRQn = -1, /*!< 15 Cortex-M0 System Tick Interrupt */
  85. /****** STM32F0 specific Interrupt Numbers ******************************************************************/
  86. WWDG_IRQn = 0, /*!< Window WatchDog Interrupt */
  87. RTC_IRQn = 2, /*!< RTC Interrupt through EXTI Lines 17, 19 and 20 */
  88. FLASH_IRQn = 3, /*!< FLASH global Interrupt */
  89. RCC_IRQn = 4, /*!< RCC global Interrupt */
  90. EXTI0_1_IRQn = 5, /*!< EXTI Line 0 and 1 Interrupt */
  91. EXTI2_3_IRQn = 6, /*!< EXTI Line 2 and 3 Interrupt */
  92. EXTI4_15_IRQn = 7, /*!< EXTI Line 4 to 15 Interrupt */
  93. DMA1_Channel1_IRQn = 9, /*!< DMA1 Channel 1 Interrupt */
  94. DMA1_Channel2_3_IRQn = 10, /*!< DMA1 Channel 2 and Channel 3 Interrupt */
  95. DMA1_Channel4_5_IRQn = 11, /*!< DMA1 Channel 4 and Channel 5 Interrupt */
  96. ADC1_IRQn = 12, /*!< ADC1 Interrupt */
  97. TIM1_BRK_UP_TRG_COM_IRQn = 13, /*!< TIM1 Break, Update, Trigger and Commutation Interrupt */
  98. TIM1_CC_IRQn = 14, /*!< TIM1 Capture Compare Interrupt */
  99. TIM3_IRQn = 16, /*!< TIM3 global Interrupt */
  100. TIM14_IRQn = 19, /*!< TIM14 global Interrupt */
  101. TIM16_IRQn = 21, /*!< TIM16 global Interrupt */
  102. TIM17_IRQn = 22, /*!< TIM17 global Interrupt */
  103. I2C1_IRQn = 23, /*!< I2C1 Event Interrupt */
  104. SPI1_IRQn = 25, /*!< SPI1 global Interrupt */
  105. USART1_IRQn = 27 /*!< USART1 global Interrupt */
  106. } IRQn_Type;
  107. /**
  108. * @}
  109. */
  110. #include "core_cm0.h" /* Cortex-M0 processor and core peripherals */
  111. #include "system_stm32f0xx.h" /* STM32F0xx System Header */
  112. #include <stdint.h>
  113. /** @addtogroup Peripheral_registers_structures
  114. * @{
  115. */
  116. /**
  117. * @brief Analog to Digital Converter
  118. */
  119. typedef struct
  120. {
  121. __IO uint32_t ISR; /*!< ADC interrupt and status register, Address offset: 0x00 */
  122. __IO uint32_t IER; /*!< ADC interrupt enable register, Address offset: 0x04 */
  123. __IO uint32_t CR; /*!< ADC control register, Address offset: 0x08 */
  124. __IO uint32_t CFGR1; /*!< ADC configuration register 1, Address offset: 0x0C */
  125. __IO uint32_t CFGR2; /*!< ADC configuration register 2, Address offset: 0x10 */
  126. __IO uint32_t SMPR; /*!< ADC sampling time register, Address offset: 0x14 */
  127. uint32_t RESERVED1; /*!< Reserved, 0x18 */
  128. uint32_t RESERVED2; /*!< Reserved, 0x1C */
  129. __IO uint32_t TR; /*!< ADC analog watchdog 1 threshold register, Address offset: 0x20 */
  130. uint32_t RESERVED3; /*!< Reserved, 0x24 */
  131. __IO uint32_t CHSELR; /*!< ADC group regular sequencer register, Address offset: 0x28 */
  132. uint32_t RESERVED4[5]; /*!< Reserved, 0x2C */
  133. __IO uint32_t DR; /*!< ADC group regular data register, Address offset: 0x40 */
  134. } ADC_TypeDef;
  135. typedef struct
  136. {
  137. __IO uint32_t CCR; /*!< ADC common configuration register, Address offset: ADC1 base address + 0x308 */
  138. } ADC_Common_TypeDef;
  139. /**
  140. * @brief CRC calculation unit
  141. */
  142. typedef struct
  143. {
  144. __IO uint32_t DR; /*!< CRC Data register, Address offset: 0x00 */
  145. __IO uint8_t IDR; /*!< CRC Independent data register, Address offset: 0x04 */
  146. uint8_t RESERVED0; /*!< Reserved, 0x05 */
  147. uint16_t RESERVED1; /*!< Reserved, 0x06 */
  148. __IO uint32_t CR; /*!< CRC Control register, Address offset: 0x08 */
  149. uint32_t RESERVED2; /*!< Reserved, 0x0C */
  150. __IO uint32_t INIT; /*!< Initial CRC value register, Address offset: 0x10 */
  151. __IO uint32_t RESERVED3; /*!< Reserved, 0x14 */
  152. } CRC_TypeDef;
  153. /**
  154. * @brief Debug MCU
  155. */
  156. typedef struct
  157. {
  158. __IO uint32_t IDCODE; /*!< MCU device ID code, Address offset: 0x00 */
  159. __IO uint32_t CR; /*!< Debug MCU configuration register, Address offset: 0x04 */
  160. __IO uint32_t APB1FZ; /*!< Debug MCU APB1 freeze register, Address offset: 0x08 */
  161. __IO uint32_t APB2FZ; /*!< Debug MCU APB2 freeze register, Address offset: 0x0C */
  162. }DBGMCU_TypeDef;
  163. /**
  164. * @brief DMA Controller
  165. */
  166. typedef struct
  167. {
  168. __IO uint32_t CCR; /*!< DMA channel x configuration register */
  169. __IO uint32_t CNDTR; /*!< DMA channel x number of data register */
  170. __IO uint32_t CPAR; /*!< DMA channel x peripheral address register */
  171. __IO uint32_t CMAR; /*!< DMA channel x memory address register */
  172. } DMA_Channel_TypeDef;
  173. typedef struct
  174. {
  175. __IO uint32_t ISR; /*!< DMA interrupt status register, Address offset: 0x00 */
  176. __IO uint32_t IFCR; /*!< DMA interrupt flag clear register, Address offset: 0x04 */
  177. } DMA_TypeDef;
  178. /**
  179. * @brief External Interrupt/Event Controller
  180. */
  181. typedef struct
  182. {
  183. __IO uint32_t IMR; /*!<EXTI Interrupt mask register, Address offset: 0x00 */
  184. __IO uint32_t EMR; /*!<EXTI Event mask register, Address offset: 0x04 */
  185. __IO uint32_t RTSR; /*!<EXTI Rising trigger selection register , Address offset: 0x08 */
  186. __IO uint32_t FTSR; /*!<EXTI Falling trigger selection register, Address offset: 0x0C */
  187. __IO uint32_t SWIER; /*!<EXTI Software interrupt event register, Address offset: 0x10 */
  188. __IO uint32_t PR; /*!<EXTI Pending register, Address offset: 0x14 */
  189. } EXTI_TypeDef;
  190. /**
  191. * @brief FLASH Registers
  192. */
  193. typedef struct
  194. {
  195. __IO uint32_t ACR; /*!<FLASH access control register, Address offset: 0x00 */
  196. __IO uint32_t KEYR; /*!<FLASH key register, Address offset: 0x04 */
  197. __IO uint32_t OPTKEYR; /*!<FLASH OPT key register, Address offset: 0x08 */
  198. __IO uint32_t SR; /*!<FLASH status register, Address offset: 0x0C */
  199. __IO uint32_t CR; /*!<FLASH control register, Address offset: 0x10 */
  200. __IO uint32_t AR; /*!<FLASH address register, Address offset: 0x14 */
  201. __IO uint32_t RESERVED; /*!< Reserved, 0x18 */
  202. __IO uint32_t OBR; /*!<FLASH option bytes register, Address offset: 0x1C */
  203. __IO uint32_t WRPR; /*!<FLASH option bytes register, Address offset: 0x20 */
  204. } FLASH_TypeDef;
  205. /**
  206. * @brief Option Bytes Registers
  207. */
  208. typedef struct
  209. {
  210. __IO uint16_t RDP; /*!< FLASH option byte Read protection, Address offset: 0x00 */
  211. __IO uint16_t USER; /*!< FLASH option byte user options, Address offset: 0x02 */
  212. __IO uint16_t DATA0; /*!< User data byte 0 (stored in FLASH_OBR[23:16]), Address offset: 0x04 */
  213. __IO uint16_t DATA1; /*!< User data byte 1 (stored in FLASH_OBR[31:24]), Address offset: 0x06 */
  214. __IO uint16_t WRP0; /*!< FLASH option byte write protection 0, Address offset: 0x08 */
  215. } OB_TypeDef;
  216. /**
  217. * @brief General Purpose I/O
  218. */
  219. typedef struct
  220. {
  221. __IO uint32_t MODER; /*!< GPIO port mode register, Address offset: 0x00 */
  222. __IO uint32_t OTYPER; /*!< GPIO port output type register, Address offset: 0x04 */
  223. __IO uint32_t OSPEEDR; /*!< GPIO port output speed register, Address offset: 0x08 */
  224. __IO uint32_t PUPDR; /*!< GPIO port pull-up/pull-down register, Address offset: 0x0C */
  225. __IO uint32_t IDR; /*!< GPIO port input data register, Address offset: 0x10 */
  226. __IO uint32_t ODR; /*!< GPIO port output data register, Address offset: 0x14 */
  227. __IO uint32_t BSRR; /*!< GPIO port bit set/reset register, Address offset: 0x1A */
  228. __IO uint32_t LCKR; /*!< GPIO port configuration lock register, Address offset: 0x1C */
  229. __IO uint32_t AFR[2]; /*!< GPIO alternate function low register, Address offset: 0x20-0x24 */
  230. __IO uint32_t BRR; /*!< GPIO bit reset register, Address offset: 0x28 */
  231. } GPIO_TypeDef;
  232. /**
  233. * @brief SysTem Configuration
  234. */
  235. typedef struct
  236. {
  237. __IO uint32_t CFGR1; /*!< SYSCFG configuration register 1, Address offset: 0x00 */
  238. uint32_t RESERVED; /*!< Reserved, 0x04 */
  239. __IO uint32_t EXTICR[4]; /*!< SYSCFG external interrupt configuration register, Address offset: 0x14-0x08 */
  240. __IO uint32_t CFGR2; /*!< SYSCFG configuration register 2, Address offset: 0x18 */
  241. } SYSCFG_TypeDef;
  242. /**
  243. * @brief Inter-integrated Circuit Interface
  244. */
  245. typedef struct
  246. {
  247. __IO uint32_t CR1; /*!< I2C Control register 1, Address offset: 0x00 */
  248. __IO uint32_t CR2; /*!< I2C Control register 2, Address offset: 0x04 */
  249. __IO uint32_t OAR1; /*!< I2C Own address 1 register, Address offset: 0x08 */
  250. __IO uint32_t OAR2; /*!< I2C Own address 2 register, Address offset: 0x0C */
  251. __IO uint32_t TIMINGR; /*!< I2C Timing register, Address offset: 0x10 */
  252. __IO uint32_t TIMEOUTR; /*!< I2C Timeout register, Address offset: 0x14 */
  253. __IO uint32_t ISR; /*!< I2C Interrupt and status register, Address offset: 0x18 */
  254. __IO uint32_t ICR; /*!< I2C Interrupt clear register, Address offset: 0x1C */
  255. __IO uint32_t PECR; /*!< I2C PEC register, Address offset: 0x20 */
  256. __IO uint32_t RXDR; /*!< I2C Receive data register, Address offset: 0x24 */
  257. __IO uint32_t TXDR; /*!< I2C Transmit data register, Address offset: 0x28 */
  258. } I2C_TypeDef;
  259. /**
  260. * @brief Independent WATCHDOG
  261. */
  262. typedef struct
  263. {
  264. __IO uint32_t KR; /*!< IWDG Key register, Address offset: 0x00 */
  265. __IO uint32_t PR; /*!< IWDG Prescaler register, Address offset: 0x04 */
  266. __IO uint32_t RLR; /*!< IWDG Reload register, Address offset: 0x08 */
  267. __IO uint32_t SR; /*!< IWDG Status register, Address offset: 0x0C */
  268. __IO uint32_t WINR; /*!< IWDG Window register, Address offset: 0x10 */
  269. } IWDG_TypeDef;
  270. /**
  271. * @brief Power Control
  272. */
  273. typedef struct
  274. {
  275. __IO uint32_t CR; /*!< PWR power control register, Address offset: 0x00 */
  276. __IO uint32_t CSR; /*!< PWR power control/status register, Address offset: 0x04 */
  277. } PWR_TypeDef;
  278. /**
  279. * @brief Reset and Clock Control
  280. */
  281. typedef struct
  282. {
  283. __IO uint32_t CR; /*!< RCC clock control register, Address offset: 0x00 */
  284. __IO uint32_t CFGR; /*!< RCC clock configuration register, Address offset: 0x04 */
  285. __IO uint32_t CIR; /*!< RCC clock interrupt register, Address offset: 0x08 */
  286. __IO uint32_t APB2RSTR; /*!< RCC APB2 peripheral reset register, Address offset: 0x0C */
  287. __IO uint32_t APB1RSTR; /*!< RCC APB1 peripheral reset register, Address offset: 0x10 */
  288. __IO uint32_t AHBENR; /*!< RCC AHB peripheral clock register, Address offset: 0x14 */
  289. __IO uint32_t APB2ENR; /*!< RCC APB2 peripheral clock enable register, Address offset: 0x18 */
  290. __IO uint32_t APB1ENR; /*!< RCC APB1 peripheral clock enable register, Address offset: 0x1C */
  291. __IO uint32_t BDCR; /*!< RCC Backup domain control register, Address offset: 0x20 */
  292. __IO uint32_t CSR; /*!< RCC clock control & status register, Address offset: 0x24 */
  293. __IO uint32_t AHBRSTR; /*!< RCC AHB peripheral reset register, Address offset: 0x28 */
  294. __IO uint32_t CFGR2; /*!< RCC clock configuration register 2, Address offset: 0x2C */
  295. __IO uint32_t CFGR3; /*!< RCC clock configuration register 3, Address offset: 0x30 */
  296. __IO uint32_t CR2; /*!< RCC clock control register 2, Address offset: 0x34 */
  297. } RCC_TypeDef;
  298. /**
  299. * @brief Real-Time Clock
  300. */
  301. typedef struct
  302. {
  303. __IO uint32_t TR; /*!< RTC time register, Address offset: 0x00 */
  304. __IO uint32_t DR; /*!< RTC date register, Address offset: 0x04 */
  305. __IO uint32_t CR; /*!< RTC control register, Address offset: 0x08 */
  306. __IO uint32_t ISR; /*!< RTC initialization and status register, Address offset: 0x0C */
  307. __IO uint32_t PRER; /*!< RTC prescaler register, Address offset: 0x10 */
  308. uint32_t RESERVED1; /*!< Reserved, Address offset: 0x14 */
  309. uint32_t RESERVED2; /*!< Reserved, Address offset: 0x18 */
  310. __IO uint32_t ALRMAR; /*!< RTC alarm A register, Address offset: 0x1C */
  311. uint32_t RESERVED3; /*!< Reserved, Address offset: 0x20 */
  312. __IO uint32_t WPR; /*!< RTC write protection register, Address offset: 0x24 */
  313. __IO uint32_t SSR; /*!< RTC sub second register, Address offset: 0x28 */
  314. __IO uint32_t SHIFTR; /*!< RTC shift control register, Address offset: 0x2C */
  315. __IO uint32_t TSTR; /*!< RTC time stamp time register, Address offset: 0x30 */
  316. __IO uint32_t TSDR; /*!< RTC time stamp date register, Address offset: 0x34 */
  317. __IO uint32_t TSSSR; /*!< RTC time-stamp sub second register, Address offset: 0x38 */
  318. __IO uint32_t CALR; /*!< RTC calibration register, Address offset: 0x3C */
  319. __IO uint32_t TAFCR; /*!< RTC tamper and alternate function configuration register, Address offset: 0x40 */
  320. __IO uint32_t ALRMASSR; /*!< RTC alarm A sub second register, Address offset: 0x44 */
  321. } RTC_TypeDef;
  322. /**
  323. * @brief Serial Peripheral Interface
  324. */
  325. typedef struct
  326. {
  327. __IO uint32_t CR1; /*!< SPI Control register 1 (not used in I2S mode), Address offset: 0x00 */
  328. __IO uint32_t CR2; /*!< SPI Control register 2, Address offset: 0x04 */
  329. __IO uint32_t SR; /*!< SPI Status register, Address offset: 0x08 */
  330. __IO uint32_t DR; /*!< SPI data register, Address offset: 0x0C */
  331. __IO uint32_t CRCPR; /*!< SPI CRC polynomial register (not used in I2S mode), Address offset: 0x10 */
  332. __IO uint32_t RXCRCR; /*!< SPI Rx CRC register (not used in I2S mode), Address offset: 0x14 */
  333. __IO uint32_t TXCRCR; /*!< SPI Tx CRC register (not used in I2S mode), Address offset: 0x18 */
  334. __IO uint32_t I2SCFGR; /*!< SPI_I2S configuration register, Address offset: 0x1C */
  335. } SPI_TypeDef;
  336. /**
  337. * @brief TIM
  338. */
  339. typedef struct
  340. {
  341. __IO uint32_t CR1; /*!< TIM control register 1, Address offset: 0x00 */
  342. __IO uint32_t CR2; /*!< TIM control register 2, Address offset: 0x04 */
  343. __IO uint32_t SMCR; /*!< TIM slave Mode Control register, Address offset: 0x08 */
  344. __IO uint32_t DIER; /*!< TIM DMA/interrupt enable register, Address offset: 0x0C */
  345. __IO uint32_t SR; /*!< TIM status register, Address offset: 0x10 */
  346. __IO uint32_t EGR; /*!< TIM event generation register, Address offset: 0x14 */
  347. __IO uint32_t CCMR1; /*!< TIM capture/compare mode register 1, Address offset: 0x18 */
  348. __IO uint32_t CCMR2; /*!< TIM capture/compare mode register 2, Address offset: 0x1C */
  349. __IO uint32_t CCER; /*!< TIM capture/compare enable register, Address offset: 0x20 */
  350. __IO uint32_t CNT; /*!< TIM counter register, Address offset: 0x24 */
  351. __IO uint32_t PSC; /*!< TIM prescaler register, Address offset: 0x28 */
  352. __IO uint32_t ARR; /*!< TIM auto-reload register, Address offset: 0x2C */
  353. __IO uint32_t RCR; /*!< TIM repetition counter register, Address offset: 0x30 */
  354. __IO uint32_t CCR1; /*!< TIM capture/compare register 1, Address offset: 0x34 */
  355. __IO uint32_t CCR2; /*!< TIM capture/compare register 2, Address offset: 0x38 */
  356. __IO uint32_t CCR3; /*!< TIM capture/compare register 3, Address offset: 0x3C */
  357. __IO uint32_t CCR4; /*!< TIM capture/compare register 4, Address offset: 0x40 */
  358. __IO uint32_t BDTR; /*!< TIM break and dead-time register, Address offset: 0x44 */
  359. __IO uint32_t DCR; /*!< TIM DMA control register, Address offset: 0x48 */
  360. __IO uint32_t DMAR; /*!< TIM DMA address for full transfer register, Address offset: 0x4C */
  361. __IO uint32_t OR; /*!< TIM option register, Address offset: 0x50 */
  362. } TIM_TypeDef;
  363. /**
  364. * @brief Universal Synchronous Asynchronous Receiver Transmitter
  365. */
  366. typedef struct
  367. {
  368. __IO uint32_t CR1; /*!< USART Control register 1, Address offset: 0x00 */
  369. __IO uint32_t CR2; /*!< USART Control register 2, Address offset: 0x04 */
  370. __IO uint32_t CR3; /*!< USART Control register 3, Address offset: 0x08 */
  371. __IO uint32_t BRR; /*!< USART Baud rate register, Address offset: 0x0C */
  372. __IO uint32_t GTPR; /*!< USART Guard time and prescaler register, Address offset: 0x10 */
  373. __IO uint32_t RTOR; /*!< USART Receiver Time Out register, Address offset: 0x14 */
  374. __IO uint32_t RQR; /*!< USART Request register, Address offset: 0x18 */
  375. __IO uint32_t ISR; /*!< USART Interrupt and status register, Address offset: 0x1C */
  376. __IO uint32_t ICR; /*!< USART Interrupt flag Clear register, Address offset: 0x20 */
  377. __IO uint16_t RDR; /*!< USART Receive Data register, Address offset: 0x24 */
  378. uint16_t RESERVED1; /*!< Reserved, 0x26 */
  379. __IO uint16_t TDR; /*!< USART Transmit Data register, Address offset: 0x28 */
  380. uint16_t RESERVED2; /*!< Reserved, 0x2A */
  381. } USART_TypeDef;
  382. /**
  383. * @brief Window WATCHDOG
  384. */
  385. typedef struct
  386. {
  387. __IO uint32_t CR; /*!< WWDG Control register, Address offset: 0x00 */
  388. __IO uint32_t CFR; /*!< WWDG Configuration register, Address offset: 0x04 */
  389. __IO uint32_t SR; /*!< WWDG Status register, Address offset: 0x08 */
  390. } WWDG_TypeDef;
  391. /**
  392. * @}
  393. */
  394. /** @addtogroup Peripheral_memory_map
  395. * @{
  396. */
  397. #define FLASH_BASE ((uint32_t)0x08000000U) /*!< FLASH base address in the alias region */
  398. #define FLASH_BANK1_END ((uint32_t)0x08007FFFU) /*!< FLASH END address of bank1 */
  399. #define SRAM_BASE ((uint32_t)0x20000000U) /*!< SRAM base address in the alias region */
  400. #define PERIPH_BASE ((uint32_t)0x40000000U) /*!< Peripheral base address in the alias region */
  401. /*!< Peripheral memory map */
  402. #define APBPERIPH_BASE PERIPH_BASE
  403. #define AHBPERIPH_BASE (PERIPH_BASE + 0x00020000)
  404. #define AHB2PERIPH_BASE (PERIPH_BASE + 0x08000000)
  405. /*!< APB peripherals */
  406. #define TIM3_BASE (APBPERIPH_BASE + 0x00000400)
  407. #define TIM14_BASE (APBPERIPH_BASE + 0x00002000)
  408. #define RTC_BASE (APBPERIPH_BASE + 0x00002800)
  409. #define WWDG_BASE (APBPERIPH_BASE + 0x00002C00)
  410. #define IWDG_BASE (APBPERIPH_BASE + 0x00003000)
  411. #define I2C1_BASE (APBPERIPH_BASE + 0x00005400)
  412. #define PWR_BASE (APBPERIPH_BASE + 0x00007000)
  413. #define SYSCFG_BASE (APBPERIPH_BASE + 0x00010000)
  414. #define EXTI_BASE (APBPERIPH_BASE + 0x00010400)
  415. #define ADC1_BASE (APBPERIPH_BASE + 0x00012400)
  416. #define ADC_BASE (APBPERIPH_BASE + 0x00012708)
  417. #define TIM1_BASE (APBPERIPH_BASE + 0x00012C00)
  418. #define SPI1_BASE (APBPERIPH_BASE + 0x00013000)
  419. #define USART1_BASE (APBPERIPH_BASE + 0x00013800)
  420. #define TIM16_BASE (APBPERIPH_BASE + 0x00014400)
  421. #define TIM17_BASE (APBPERIPH_BASE + 0x00014800)
  422. #define DBGMCU_BASE (APBPERIPH_BASE + 0x00015800)
  423. /*!< AHB peripherals */
  424. #define DMA1_BASE (AHBPERIPH_BASE + 0x00000000)
  425. #define DMA1_Channel1_BASE (DMA1_BASE + 0x00000008)
  426. #define DMA1_Channel2_BASE (DMA1_BASE + 0x0000001C)
  427. #define DMA1_Channel3_BASE (DMA1_BASE + 0x00000030)
  428. #define DMA1_Channel4_BASE (DMA1_BASE + 0x00000044)
  429. #define DMA1_Channel5_BASE (DMA1_BASE + 0x00000058)
  430. #define RCC_BASE (AHBPERIPH_BASE + 0x00001000)
  431. #define FLASH_R_BASE (AHBPERIPH_BASE + 0x00002000) /*!< FLASH registers base address */
  432. #define OB_BASE ((uint32_t)0x1FFFF800U) /*!< FLASH Option Bytes base address */
  433. #define FLASHSIZE_BASE ((uint32_t)0x1FFFF7CCU) /*!< FLASH Size register base address */
  434. #define UID_BASE ((uint32_t)0x1FFFF7ACU) /*!< Unique device ID register base address */
  435. #define CRC_BASE (AHBPERIPH_BASE + 0x00003000)
  436. /*!< AHB2 peripherals */
  437. #define GPIOA_BASE (AHB2PERIPH_BASE + 0x00000000)
  438. #define GPIOB_BASE (AHB2PERIPH_BASE + 0x00000400)
  439. #define GPIOC_BASE (AHB2PERIPH_BASE + 0x00000800)
  440. #define GPIOD_BASE (AHB2PERIPH_BASE + 0x00000C00)
  441. #define GPIOF_BASE (AHB2PERIPH_BASE + 0x00001400)
  442. /**
  443. * @}
  444. */
  445. /** @addtogroup Peripheral_declaration
  446. * @{
  447. */
  448. #define TIM3 ((TIM_TypeDef *) TIM3_BASE)
  449. #define TIM14 ((TIM_TypeDef *) TIM14_BASE)
  450. #define RTC ((RTC_TypeDef *) RTC_BASE)
  451. #define WWDG ((WWDG_TypeDef *) WWDG_BASE)
  452. #define IWDG ((IWDG_TypeDef *) IWDG_BASE)
  453. #define I2C1 ((I2C_TypeDef *) I2C1_BASE)
  454. #define PWR ((PWR_TypeDef *) PWR_BASE)
  455. #define SYSCFG ((SYSCFG_TypeDef *) SYSCFG_BASE)
  456. #define EXTI ((EXTI_TypeDef *) EXTI_BASE)
  457. #define ADC1 ((ADC_TypeDef *) ADC1_BASE)
  458. #define ADC1_COMMON ((ADC_Common_TypeDef *) ADC_BASE)
  459. #define ADC ((ADC_Common_TypeDef *) ADC_BASE) /* Kept for legacy purpose */
  460. #define TIM1 ((TIM_TypeDef *) TIM1_BASE)
  461. #define SPI1 ((SPI_TypeDef *) SPI1_BASE)
  462. #define USART1 ((USART_TypeDef *) USART1_BASE)
  463. #define TIM16 ((TIM_TypeDef *) TIM16_BASE)
  464. #define TIM17 ((TIM_TypeDef *) TIM17_BASE)
  465. #define DBGMCU ((DBGMCU_TypeDef *) DBGMCU_BASE)
  466. #define DMA1 ((DMA_TypeDef *) DMA1_BASE)
  467. #define DMA1_Channel1 ((DMA_Channel_TypeDef *) DMA1_Channel1_BASE)
  468. #define DMA1_Channel2 ((DMA_Channel_TypeDef *) DMA1_Channel2_BASE)
  469. #define DMA1_Channel3 ((DMA_Channel_TypeDef *) DMA1_Channel3_BASE)
  470. #define DMA1_Channel4 ((DMA_Channel_TypeDef *) DMA1_Channel4_BASE)
  471. #define DMA1_Channel5 ((DMA_Channel_TypeDef *) DMA1_Channel5_BASE)
  472. #define FLASH ((FLASH_TypeDef *) FLASH_R_BASE)
  473. #define OB ((OB_TypeDef *) OB_BASE)
  474. #define RCC ((RCC_TypeDef *) RCC_BASE)
  475. #define CRC ((CRC_TypeDef *) CRC_BASE)
  476. #define GPIOA ((GPIO_TypeDef *) GPIOA_BASE)
  477. #define GPIOB ((GPIO_TypeDef *) GPIOB_BASE)
  478. #define GPIOC ((GPIO_TypeDef *) GPIOC_BASE)
  479. #define GPIOD ((GPIO_TypeDef *) GPIOD_BASE)
  480. #define GPIOF ((GPIO_TypeDef *) GPIOF_BASE)
  481. /**
  482. * @}
  483. */
  484. /** @addtogroup Exported_constants
  485. * @{
  486. */
  487. /** @addtogroup Peripheral_Registers_Bits_Definition
  488. * @{
  489. */
  490. /******************************************************************************/
  491. /* Peripheral Registers Bits Definition */
  492. /******************************************************************************/
  493. /******************************************************************************/
  494. /* */
  495. /* Analog to Digital Converter (ADC) */
  496. /* */
  497. /******************************************************************************/
  498. /*
  499. * @brief Specific device feature definitions (not present on all devices in the STM32F0 family)
  500. */
  501. /* Note: No specific macro feature on this device */
  502. /******************** Bits definition for ADC_ISR register ******************/
  503. #define ADC_ISR_ADRDY ((uint32_t)0x00000001U) /*!< ADC ready flag */
  504. #define ADC_ISR_EOSMP ((uint32_t)0x00000002U) /*!< ADC group regular end of sampling flag */
  505. #define ADC_ISR_EOC ((uint32_t)0x00000004U) /*!< ADC group regular end of unitary conversion flag */
  506. #define ADC_ISR_EOS ((uint32_t)0x00000008U) /*!< ADC group regular end of sequence conversions flag */
  507. #define ADC_ISR_OVR ((uint32_t)0x00000010U) /*!< ADC group regular overrun flag */
  508. #define ADC_ISR_AWD1 ((uint32_t)0x00000080U) /*!< ADC analog watchdog 1 flag */
  509. /* Legacy defines */
  510. #define ADC_ISR_AWD (ADC_ISR_AWD1)
  511. #define ADC_ISR_EOSEQ (ADC_ISR_EOS)
  512. /******************** Bits definition for ADC_IER register ******************/
  513. #define ADC_IER_ADRDYIE ((uint32_t)0x00000001U) /*!< ADC ready interrupt */
  514. #define ADC_IER_EOSMPIE ((uint32_t)0x00000002U) /*!< ADC group regular end of sampling interrupt */
  515. #define ADC_IER_EOCIE ((uint32_t)0x00000004U) /*!< ADC group regular end of unitary conversion interrupt */
  516. #define ADC_IER_EOSIE ((uint32_t)0x00000008U) /*!< ADC group regular end of sequence conversions interrupt */
  517. #define ADC_IER_OVRIE ((uint32_t)0x00000010U) /*!< ADC group regular overrun interrupt */
  518. #define ADC_IER_AWD1IE ((uint32_t)0x00000080U) /*!< ADC analog watchdog 1 interrupt */
  519. /* Legacy defines */
  520. #define ADC_IER_AWDIE (ADC_IER_AWD1IE)
  521. #define ADC_IER_EOSEQIE (ADC_IER_EOSIE)
  522. /******************** Bits definition for ADC_CR register *******************/
  523. #define ADC_CR_ADEN ((uint32_t)0x00000001U) /*!< ADC enable */
  524. #define ADC_CR_ADDIS ((uint32_t)0x00000002U) /*!< ADC disable */
  525. #define ADC_CR_ADSTART ((uint32_t)0x00000004U) /*!< ADC group regular conversion start */
  526. #define ADC_CR_ADSTP ((uint32_t)0x00000010U) /*!< ADC group regular conversion stop */
  527. #define ADC_CR_ADCAL ((uint32_t)0x80000000U) /*!< ADC calibration */
  528. /******************* Bits definition for ADC_CFGR1 register *****************/
  529. #define ADC_CFGR1_DMAEN ((uint32_t)0x00000001U) /*!< ADC DMA transfer enable */
  530. #define ADC_CFGR1_DMACFG ((uint32_t)0x00000002U) /*!< ADC DMA transfer configuration */
  531. #define ADC_CFGR1_SCANDIR ((uint32_t)0x00000004U) /*!< ADC group regular sequencer scan direction */
  532. #define ADC_CFGR1_RES ((uint32_t)0x00000018U) /*!< ADC data resolution */
  533. #define ADC_CFGR1_RES_0 ((uint32_t)0x00000008U) /*!< bit 0 */
  534. #define ADC_CFGR1_RES_1 ((uint32_t)0x00000010U) /*!< bit 1 */
  535. #define ADC_CFGR1_ALIGN ((uint32_t)0x00000020U) /*!< ADC data alignement */
  536. #define ADC_CFGR1_EXTSEL ((uint32_t)0x000001C0U) /*!< ADC group regular external trigger source */
  537. #define ADC_CFGR1_EXTSEL_0 ((uint32_t)0x00000040U) /*!< bit 0 */
  538. #define ADC_CFGR1_EXTSEL_1 ((uint32_t)0x00000080U) /*!< bit 1 */
  539. #define ADC_CFGR1_EXTSEL_2 ((uint32_t)0x00000100U) /*!< bit 2 */
  540. #define ADC_CFGR1_EXTEN ((uint32_t)0x00000C00U) /*!< ADC group regular external trigger polarity */
  541. #define ADC_CFGR1_EXTEN_0 ((uint32_t)0x00000400U) /*!< bit 0 */
  542. #define ADC_CFGR1_EXTEN_1 ((uint32_t)0x00000800U) /*!< bit 1 */
  543. #define ADC_CFGR1_OVRMOD ((uint32_t)0x00001000U) /*!< ADC group regular overrun configuration */
  544. #define ADC_CFGR1_CONT ((uint32_t)0x00002000U) /*!< ADC group regular continuous conversion mode */
  545. #define ADC_CFGR1_WAIT ((uint32_t)0x00004000U) /*!< ADC low power auto wait */
  546. #define ADC_CFGR1_AUTOFF ((uint32_t)0x00008000U) /*!< ADC low power auto power off */
  547. #define ADC_CFGR1_DISCEN ((uint32_t)0x00010000U) /*!< ADC group regular sequencer discontinuous mode */
  548. #define ADC_CFGR1_AWD1SGL ((uint32_t)0x00400000U) /*!< ADC analog watchdog 1 monitoring a single channel or all channels */
  549. #define ADC_CFGR1_AWD1EN ((uint32_t)0x00800000U) /*!< ADC analog watchdog 1 enable on scope ADC group regular */
  550. #define ADC_CFGR1_AWD1CH ((uint32_t)0x7C000000U) /*!< ADC analog watchdog 1 monitored channel selection */
  551. #define ADC_CFGR1_AWD1CH_0 ((uint32_t)0x04000000U) /*!< bit 0 */
  552. #define ADC_CFGR1_AWD1CH_1 ((uint32_t)0x08000000U) /*!< bit 1 */
  553. #define ADC_CFGR1_AWD1CH_2 ((uint32_t)0x10000000U) /*!< bit 2 */
  554. #define ADC_CFGR1_AWD1CH_3 ((uint32_t)0x20000000U) /*!< bit 3 */
  555. #define ADC_CFGR1_AWD1CH_4 ((uint32_t)0x40000000U) /*!< bit 4 */
  556. /* Legacy defines */
  557. #define ADC_CFGR1_AUTDLY (ADC_CFGR1_WAIT)
  558. #define ADC_CFGR1_AWDSGL (ADC_CFGR1_AWD1SGL)
  559. #define ADC_CFGR1_AWDEN (ADC_CFGR1_AWD1EN)
  560. #define ADC_CFGR1_AWDCH (ADC_CFGR1_AWD1CH)
  561. #define ADC_CFGR1_AWDCH_0 (ADC_CFGR1_AWD1CH_0)
  562. #define ADC_CFGR1_AWDCH_1 (ADC_CFGR1_AWD1CH_1)
  563. #define ADC_CFGR1_AWDCH_2 (ADC_CFGR1_AWD1CH_2)
  564. #define ADC_CFGR1_AWDCH_3 (ADC_CFGR1_AWD1CH_3)
  565. #define ADC_CFGR1_AWDCH_4 (ADC_CFGR1_AWD1CH_4)
  566. /******************* Bits definition for ADC_CFGR2 register *****************/
  567. #define ADC_CFGR2_CKMODE ((uint32_t)0xC0000000U) /*!< ADC clock source and prescaler (prescaler only for clock source synchronous) */
  568. #define ADC_CFGR2_CKMODE_1 ((uint32_t)0x80000000U) /*!< bit 1 */
  569. #define ADC_CFGR2_CKMODE_0 ((uint32_t)0x40000000U) /*!< bit 0 */
  570. /* Legacy defines */
  571. #define ADC_CFGR2_JITOFFDIV4 (ADC_CFGR2_CKMODE_1) /*!< ADC clocked by PCLK div4 */
  572. #define ADC_CFGR2_JITOFFDIV2 (ADC_CFGR2_CKMODE_0) /*!< ADC clocked by PCLK div2 */
  573. /****************** Bit definition for ADC_SMPR register ********************/
  574. #define ADC_SMPR_SMP ((uint32_t)0x00000007U) /*!< ADC group of channels sampling time 2 */
  575. #define ADC_SMPR_SMP_0 ((uint32_t)0x00000001U) /*!< bit 0 */
  576. #define ADC_SMPR_SMP_1 ((uint32_t)0x00000002U) /*!< bit 1 */
  577. #define ADC_SMPR_SMP_2 ((uint32_t)0x00000004U) /*!< bit 2 */
  578. /* Legacy defines */
  579. #define ADC_SMPR1_SMPR (ADC_SMPR_SMP) /*!< SMP[2:0] bits (Sampling time selection) */
  580. #define ADC_SMPR1_SMPR_0 (ADC_SMPR_SMP_0) /*!< bit 0 */
  581. #define ADC_SMPR1_SMPR_1 (ADC_SMPR_SMP_1) /*!< bit 1 */
  582. #define ADC_SMPR1_SMPR_2 (ADC_SMPR_SMP_2) /*!< bit 2 */
  583. /******************* Bit definition for ADC_TR register ********************/
  584. #define ADC_TR1_LT1 ((uint32_t)0x00000FFFU) /*!< ADC analog watchdog 1 threshold low */
  585. #define ADC_TR1_LT1_0 ((uint32_t)0x00000001U) /*!< bit 0 */
  586. #define ADC_TR1_LT1_1 ((uint32_t)0x00000002U) /*!< bit 1 */
  587. #define ADC_TR1_LT1_2 ((uint32_t)0x00000004U) /*!< bit 2 */
  588. #define ADC_TR1_LT1_3 ((uint32_t)0x00000008U) /*!< bit 3 */
  589. #define ADC_TR1_LT1_4 ((uint32_t)0x00000010U) /*!< bit 4 */
  590. #define ADC_TR1_LT1_5 ((uint32_t)0x00000020U) /*!< bit 5 */
  591. #define ADC_TR1_LT1_6 ((uint32_t)0x00000040U) /*!< bit 6 */
  592. #define ADC_TR1_LT1_7 ((uint32_t)0x00000080U) /*!< bit 7 */
  593. #define ADC_TR1_LT1_8 ((uint32_t)0x00000100U) /*!< bit 8 */
  594. #define ADC_TR1_LT1_9 ((uint32_t)0x00000200U) /*!< bit 9 */
  595. #define ADC_TR1_LT1_10 ((uint32_t)0x00000400U) /*!< bit 10 */
  596. #define ADC_TR1_LT1_11 ((uint32_t)0x00000800U) /*!< bit 11 */
  597. #define ADC_TR1_HT1 ((uint32_t)0x0FFF0000U) /*!< ADC Analog watchdog 1 threshold high */
  598. #define ADC_TR1_HT1_0 ((uint32_t)0x00010000U) /*!< bit 0 */
  599. #define ADC_TR1_HT1_1 ((uint32_t)0x00020000U) /*!< bit 1 */
  600. #define ADC_TR1_HT1_2 ((uint32_t)0x00040000U) /*!< bit 2 */
  601. #define ADC_TR1_HT1_3 ((uint32_t)0x00080000U) /*!< bit 3 */
  602. #define ADC_TR1_HT1_4 ((uint32_t)0x00100000U) /*!< bit 4 */
  603. #define ADC_TR1_HT1_5 ((uint32_t)0x00200000U) /*!< bit 5 */
  604. #define ADC_TR1_HT1_6 ((uint32_t)0x00400000U) /*!< bit 6 */
  605. #define ADC_TR1_HT1_7 ((uint32_t)0x00800000U) /*!< bit 7 */
  606. #define ADC_TR1_HT1_8 ((uint32_t)0x01000000U) /*!< bit 8 */
  607. #define ADC_TR1_HT1_9 ((uint32_t)0x02000000U) /*!< bit 9 */
  608. #define ADC_TR1_HT1_10 ((uint32_t)0x04000000U) /*!< bit 10 */
  609. #define ADC_TR1_HT1_11 ((uint32_t)0x08000000U) /*!< bit 11 */
  610. /* Legacy defines */
  611. #define ADC_TR_HT (ADC_TR1_HT1)
  612. #define ADC_TR_LT (ADC_TR1_LT1)
  613. #define ADC_HTR_HT (ADC_TR1_HT1)
  614. #define ADC_LTR_LT (ADC_TR1_LT1)
  615. /****************** Bit definition for ADC_CHSELR register ******************/
  616. #define ADC_CHSELR_CHSEL ((uint32_t)0x0007FFFFU) /*!< ADC group regular sequencer channels, available when ADC_CFGR1_CHSELRMOD is reset */
  617. #define ADC_CHSELR_CHSEL18 ((uint32_t)0x00040000U) /*!< ADC group regular sequencer channel 18, available when ADC_CFGR1_CHSELRMOD is reset */
  618. #define ADC_CHSELR_CHSEL17 ((uint32_t)0x00020000U) /*!< ADC group regular sequencer channel 17, available when ADC_CFGR1_CHSELRMOD is reset */
  619. #define ADC_CHSELR_CHSEL16 ((uint32_t)0x00010000U) /*!< ADC group regular sequencer channel 16, available when ADC_CFGR1_CHSELRMOD is reset */
  620. #define ADC_CHSELR_CHSEL15 ((uint32_t)0x00008000U) /*!< ADC group regular sequencer channel 15, available when ADC_CFGR1_CHSELRMOD is reset */
  621. #define ADC_CHSELR_CHSEL14 ((uint32_t)0x00004000U) /*!< ADC group regular sequencer channel 14, available when ADC_CFGR1_CHSELRMOD is reset */
  622. #define ADC_CHSELR_CHSEL13 ((uint32_t)0x00002000U) /*!< ADC group regular sequencer channel 13, available when ADC_CFGR1_CHSELRMOD is reset */
  623. #define ADC_CHSELR_CHSEL12 ((uint32_t)0x00001000U) /*!< ADC group regular sequencer channel 12, available when ADC_CFGR1_CHSELRMOD is reset */
  624. #define ADC_CHSELR_CHSEL11 ((uint32_t)0x00000800U) /*!< ADC group regular sequencer channel 11, available when ADC_CFGR1_CHSELRMOD is reset */
  625. #define ADC_CHSELR_CHSEL10 ((uint32_t)0x00000400U) /*!< ADC group regular sequencer channel 10, available when ADC_CFGR1_CHSELRMOD is reset */
  626. #define ADC_CHSELR_CHSEL9 ((uint32_t)0x00000200U) /*!< ADC group regular sequencer channel 9, available when ADC_CFGR1_CHSELRMOD is reset */
  627. #define ADC_CHSELR_CHSEL8 ((uint32_t)0x00000100U) /*!< ADC group regular sequencer channel 8, available when ADC_CFGR1_CHSELRMOD is reset */
  628. #define ADC_CHSELR_CHSEL7 ((uint32_t)0x00000080U) /*!< ADC group regular sequencer channel 7, available when ADC_CFGR1_CHSELRMOD is reset */
  629. #define ADC_CHSELR_CHSEL6 ((uint32_t)0x00000040U) /*!< ADC group regular sequencer channel 6, available when ADC_CFGR1_CHSELRMOD is reset */
  630. #define ADC_CHSELR_CHSEL5 ((uint32_t)0x00000020U) /*!< ADC group regular sequencer channel 5, available when ADC_CFGR1_CHSELRMOD is reset */
  631. #define ADC_CHSELR_CHSEL4 ((uint32_t)0x00000010U) /*!< ADC group regular sequencer channel 4, available when ADC_CFGR1_CHSELRMOD is reset */
  632. #define ADC_CHSELR_CHSEL3 ((uint32_t)0x00000008U) /*!< ADC group regular sequencer channel 3, available when ADC_CFGR1_CHSELRMOD is reset */
  633. #define ADC_CHSELR_CHSEL2 ((uint32_t)0x00000004U) /*!< ADC group regular sequencer channel 2, available when ADC_CFGR1_CHSELRMOD is reset */
  634. #define ADC_CHSELR_CHSEL1 ((uint32_t)0x00000002U) /*!< ADC group regular sequencer channel 1, available when ADC_CFGR1_CHSELRMOD is reset */
  635. #define ADC_CHSELR_CHSEL0 ((uint32_t)0x00000001U) /*!< ADC group regular sequencer channel 0, available when ADC_CFGR1_CHSELRMOD is reset */
  636. /******************** Bit definition for ADC_DR register ********************/
  637. #define ADC_DR_DATA ((uint32_t)0x0000FFFFU) /*!< ADC group regular conversion data */
  638. #define ADC_DR_DATA_0 ((uint32_t)0x00000001U) /*!< bit 0 */
  639. #define ADC_DR_DATA_1 ((uint32_t)0x00000002U) /*!< bit 1 */
  640. #define ADC_DR_DATA_2 ((uint32_t)0x00000004U) /*!< bit 2 */
  641. #define ADC_DR_DATA_3 ((uint32_t)0x00000008U) /*!< bit 3 */
  642. #define ADC_DR_DATA_4 ((uint32_t)0x00000010U) /*!< bit 4 */
  643. #define ADC_DR_DATA_5 ((uint32_t)0x00000020U) /*!< bit 5 */
  644. #define ADC_DR_DATA_6 ((uint32_t)0x00000040U) /*!< bit 6 */
  645. #define ADC_DR_DATA_7 ((uint32_t)0x00000080U) /*!< bit 7 */
  646. #define ADC_DR_DATA_8 ((uint32_t)0x00000100U) /*!< bit 8 */
  647. #define ADC_DR_DATA_9 ((uint32_t)0x00000200U) /*!< bit 9 */
  648. #define ADC_DR_DATA_10 ((uint32_t)0x00000400U) /*!< bit 10 */
  649. #define ADC_DR_DATA_11 ((uint32_t)0x00000800U) /*!< bit 11 */
  650. #define ADC_DR_DATA_12 ((uint32_t)0x00001000U) /*!< bit 12 */
  651. #define ADC_DR_DATA_13 ((uint32_t)0x00002000U) /*!< bit 13 */
  652. #define ADC_DR_DATA_14 ((uint32_t)0x00004000U) /*!< bit 14 */
  653. #define ADC_DR_DATA_15 ((uint32_t)0x00008000U) /*!< bit 15 */
  654. /************************* ADC Common registers *****************************/
  655. /******************* Bit definition for ADC_CCR register ********************/
  656. #define ADC_CCR_VREFEN ((uint32_t)0x00400000U) /*!< ADC internal path to VrefInt enable */
  657. #define ADC_CCR_TSEN ((uint32_t)0x00800000U) /*!< ADC internal path to temperature sensor enable */
  658. /******************************************************************************/
  659. /* */
  660. /* CRC calculation unit (CRC) */
  661. /* */
  662. /******************************************************************************/
  663. /******************* Bit definition for CRC_DR register *********************/
  664. #define CRC_DR_DR ((uint32_t)0xFFFFFFFFU) /*!< Data register bits */
  665. /******************* Bit definition for CRC_IDR register ********************/
  666. #define CRC_IDR_IDR ((uint8_t)0xFFU) /*!< General-purpose 8-bit data register bits */
  667. /******************** Bit definition for CRC_CR register ********************/
  668. #define CRC_CR_RESET ((uint32_t)0x00000001U) /*!< RESET the CRC computation unit bit */
  669. #define CRC_CR_REV_IN ((uint32_t)0x00000060U) /*!< REV_IN Reverse Input Data bits */
  670. #define CRC_CR_REV_IN_0 ((uint32_t)0x00000020U) /*!< REV_IN Bit 0 */
  671. #define CRC_CR_REV_IN_1 ((uint32_t)0x00000040U) /*!< REV_IN Bit 1 */
  672. #define CRC_CR_REV_OUT ((uint32_t)0x00000080U) /*!< REV_OUT Reverse Output Data bits */
  673. /******************* Bit definition for CRC_INIT register *******************/
  674. #define CRC_INIT_INIT ((uint32_t)0xFFFFFFFFU) /*!< Initial CRC value bits */
  675. /******************************************************************************/
  676. /* */
  677. /* Debug MCU (DBGMCU) */
  678. /* */
  679. /******************************************************************************/
  680. /**************** Bit definition for DBGMCU_IDCODE register *****************/
  681. #define DBGMCU_IDCODE_DEV_ID ((uint32_t)0x00000FFFU) /*!< Device Identifier */
  682. #define DBGMCU_IDCODE_REV_ID ((uint32_t)0xFFFF0000U) /*!< REV_ID[15:0] bits (Revision Identifier) */
  683. #define DBGMCU_IDCODE_REV_ID_0 ((uint32_t)0x00010000U) /*!< Bit 0 */
  684. #define DBGMCU_IDCODE_REV_ID_1 ((uint32_t)0x00020000U) /*!< Bit 1 */
  685. #define DBGMCU_IDCODE_REV_ID_2 ((uint32_t)0x00040000U) /*!< Bit 2 */
  686. #define DBGMCU_IDCODE_REV_ID_3 ((uint32_t)0x00080000U) /*!< Bit 3 */
  687. #define DBGMCU_IDCODE_REV_ID_4 ((uint32_t)0x00100000U) /*!< Bit 4 */
  688. #define DBGMCU_IDCODE_REV_ID_5 ((uint32_t)0x00200000U) /*!< Bit 5 */
  689. #define DBGMCU_IDCODE_REV_ID_6 ((uint32_t)0x00400000U) /*!< Bit 6 */
  690. #define DBGMCU_IDCODE_REV_ID_7 ((uint32_t)0x00800000U) /*!< Bit 7 */
  691. #define DBGMCU_IDCODE_REV_ID_8 ((uint32_t)0x01000000U) /*!< Bit 8 */
  692. #define DBGMCU_IDCODE_REV_ID_9 ((uint32_t)0x02000000U) /*!< Bit 9 */
  693. #define DBGMCU_IDCODE_REV_ID_10 ((uint32_t)0x04000000U) /*!< Bit 10 */
  694. #define DBGMCU_IDCODE_REV_ID_11 ((uint32_t)0x08000000U) /*!< Bit 11 */
  695. #define DBGMCU_IDCODE_REV_ID_12 ((uint32_t)0x10000000U) /*!< Bit 12 */
  696. #define DBGMCU_IDCODE_REV_ID_13 ((uint32_t)0x20000000U) /*!< Bit 13 */
  697. #define DBGMCU_IDCODE_REV_ID_14 ((uint32_t)0x40000000U) /*!< Bit 14 */
  698. #define DBGMCU_IDCODE_REV_ID_15 ((uint32_t)0x80000000U) /*!< Bit 15 */
  699. /****************** Bit definition for DBGMCU_CR register *******************/
  700. #define DBGMCU_CR_DBG_STOP ((uint32_t)0x00000002U) /*!< Debug Stop Mode */
  701. #define DBGMCU_CR_DBG_STANDBY ((uint32_t)0x00000004U) /*!< Debug Standby mode */
  702. /****************** Bit definition for DBGMCU_APB1_FZ register **************/
  703. #define DBGMCU_APB1_FZ_DBG_TIM3_STOP ((uint32_t)0x00000002U) /*!< TIM3 counter stopped when core is halted */
  704. #define DBGMCU_APB1_FZ_DBG_TIM14_STOP ((uint32_t)0x00000100U) /*!< TIM14 counter stopped when core is halted */
  705. #define DBGMCU_APB1_FZ_DBG_RTC_STOP ((uint32_t)0x00000400U) /*!< RTC Calendar frozen when core is halted */
  706. #define DBGMCU_APB1_FZ_DBG_WWDG_STOP ((uint32_t)0x00000800U) /*!< Debug Window Watchdog stopped when Core is halted */
  707. #define DBGMCU_APB1_FZ_DBG_IWDG_STOP ((uint32_t)0x00001000U) /*!< Debug Independent Watchdog stopped when Core is halted */
  708. #define DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00200000U) /*!< I2C1 SMBUS timeout mode stopped when Core is halted */
  709. /****************** Bit definition for DBGMCU_APB2_FZ register **************/
  710. #define DBGMCU_APB2_FZ_DBG_TIM1_STOP ((uint32_t)0x00000800U) /*!< TIM1 counter stopped when core is halted */
  711. #define DBGMCU_APB2_FZ_DBG_TIM16_STOP ((uint32_t)0x00020000U) /*!< TIM16 counter stopped when core is halted */
  712. #define DBGMCU_APB2_FZ_DBG_TIM17_STOP ((uint32_t)0x00040000U) /*!< TIM17 counter stopped when core is halted */
  713. /******************************************************************************/
  714. /* */
  715. /* DMA Controller (DMA) */
  716. /* */
  717. /******************************************************************************/
  718. /******************* Bit definition for DMA_ISR register ********************/
  719. #define DMA_ISR_GIF1 ((uint32_t)0x00000001U) /*!< Channel 1 Global interrupt flag */
  720. #define DMA_ISR_TCIF1 ((uint32_t)0x00000002U) /*!< Channel 1 Transfer Complete flag */
  721. #define DMA_ISR_HTIF1 ((uint32_t)0x00000004U) /*!< Channel 1 Half Transfer flag */
  722. #define DMA_ISR_TEIF1 ((uint32_t)0x00000008U) /*!< Channel 1 Transfer Error flag */
  723. #define DMA_ISR_GIF2 ((uint32_t)0x00000010U) /*!< Channel 2 Global interrupt flag */
  724. #define DMA_ISR_TCIF2 ((uint32_t)0x00000020U) /*!< Channel 2 Transfer Complete flag */
  725. #define DMA_ISR_HTIF2 ((uint32_t)0x00000040U) /*!< Channel 2 Half Transfer flag */
  726. #define DMA_ISR_TEIF2 ((uint32_t)0x00000080U) /*!< Channel 2 Transfer Error flag */
  727. #define DMA_ISR_GIF3 ((uint32_t)0x00000100U) /*!< Channel 3 Global interrupt flag */
  728. #define DMA_ISR_TCIF3 ((uint32_t)0x00000200U) /*!< Channel 3 Transfer Complete flag */
  729. #define DMA_ISR_HTIF3 ((uint32_t)0x00000400U) /*!< Channel 3 Half Transfer flag */
  730. #define DMA_ISR_TEIF3 ((uint32_t)0x00000800U) /*!< Channel 3 Transfer Error flag */
  731. #define DMA_ISR_GIF4 ((uint32_t)0x00001000U) /*!< Channel 4 Global interrupt flag */
  732. #define DMA_ISR_TCIF4 ((uint32_t)0x00002000U) /*!< Channel 4 Transfer Complete flag */
  733. #define DMA_ISR_HTIF4 ((uint32_t)0x00004000U) /*!< Channel 4 Half Transfer flag */
  734. #define DMA_ISR_TEIF4 ((uint32_t)0x00008000U) /*!< Channel 4 Transfer Error flag */
  735. #define DMA_ISR_GIF5 ((uint32_t)0x00010000U) /*!< Channel 5 Global interrupt flag */
  736. #define DMA_ISR_TCIF5 ((uint32_t)0x00020000U) /*!< Channel 5 Transfer Complete flag */
  737. #define DMA_ISR_HTIF5 ((uint32_t)0x00040000U) /*!< Channel 5 Half Transfer flag */
  738. #define DMA_ISR_TEIF5 ((uint32_t)0x00080000U) /*!< Channel 5 Transfer Error flag */
  739. /******************* Bit definition for DMA_IFCR register *******************/
  740. #define DMA_IFCR_CGIF1 ((uint32_t)0x00000001U) /*!< Channel 1 Global interrupt clear */
  741. #define DMA_IFCR_CTCIF1 ((uint32_t)0x00000002U) /*!< Channel 1 Transfer Complete clear */
  742. #define DMA_IFCR_CHTIF1 ((uint32_t)0x00000004U) /*!< Channel 1 Half Transfer clear */
  743. #define DMA_IFCR_CTEIF1 ((uint32_t)0x00000008U) /*!< Channel 1 Transfer Error clear */
  744. #define DMA_IFCR_CGIF2 ((uint32_t)0x00000010U) /*!< Channel 2 Global interrupt clear */
  745. #define DMA_IFCR_CTCIF2 ((uint32_t)0x00000020U) /*!< Channel 2 Transfer Complete clear */
  746. #define DMA_IFCR_CHTIF2 ((uint32_t)0x00000040U) /*!< Channel 2 Half Transfer clear */
  747. #define DMA_IFCR_CTEIF2 ((uint32_t)0x00000080U) /*!< Channel 2 Transfer Error clear */
  748. #define DMA_IFCR_CGIF3 ((uint32_t)0x00000100U) /*!< Channel 3 Global interrupt clear */
  749. #define DMA_IFCR_CTCIF3 ((uint32_t)0x00000200U) /*!< Channel 3 Transfer Complete clear */
  750. #define DMA_IFCR_CHTIF3 ((uint32_t)0x00000400U) /*!< Channel 3 Half Transfer clear */
  751. #define DMA_IFCR_CTEIF3 ((uint32_t)0x00000800U) /*!< Channel 3 Transfer Error clear */
  752. #define DMA_IFCR_CGIF4 ((uint32_t)0x00001000U) /*!< Channel 4 Global interrupt clear */
  753. #define DMA_IFCR_CTCIF4 ((uint32_t)0x00002000U) /*!< Channel 4 Transfer Complete clear */
  754. #define DMA_IFCR_CHTIF4 ((uint32_t)0x00004000U) /*!< Channel 4 Half Transfer clear */
  755. #define DMA_IFCR_CTEIF4 ((uint32_t)0x00008000U) /*!< Channel 4 Transfer Error clear */
  756. #define DMA_IFCR_CGIF5 ((uint32_t)0x00010000U) /*!< Channel 5 Global interrupt clear */
  757. #define DMA_IFCR_CTCIF5 ((uint32_t)0x00020000U) /*!< Channel 5 Transfer Complete clear */
  758. #define DMA_IFCR_CHTIF5 ((uint32_t)0x00040000U) /*!< Channel 5 Half Transfer clear */
  759. #define DMA_IFCR_CTEIF5 ((uint32_t)0x00080000U) /*!< Channel 5 Transfer Error clear */
  760. /******************* Bit definition for DMA_CCR register ********************/
  761. #define DMA_CCR_EN ((uint32_t)0x00000001U) /*!< Channel enable */
  762. #define DMA_CCR_TCIE ((uint32_t)0x00000002U) /*!< Transfer complete interrupt enable */
  763. #define DMA_CCR_HTIE ((uint32_t)0x00000004U) /*!< Half Transfer interrupt enable */
  764. #define DMA_CCR_TEIE ((uint32_t)0x00000008U) /*!< Transfer error interrupt enable */
  765. #define DMA_CCR_DIR ((uint32_t)0x00000010U) /*!< Data transfer direction */
  766. #define DMA_CCR_CIRC ((uint32_t)0x00000020U) /*!< Circular mode */
  767. #define DMA_CCR_PINC ((uint32_t)0x00000040U) /*!< Peripheral increment mode */
  768. #define DMA_CCR_MINC ((uint32_t)0x00000080U) /*!< Memory increment mode */
  769. #define DMA_CCR_PSIZE ((uint32_t)0x00000300U) /*!< PSIZE[1:0] bits (Peripheral size) */
  770. #define DMA_CCR_PSIZE_0 ((uint32_t)0x00000100U) /*!< Bit 0 */
  771. #define DMA_CCR_PSIZE_1 ((uint32_t)0x00000200U) /*!< Bit 1 */
  772. #define DMA_CCR_MSIZE ((uint32_t)0x00000C00U) /*!< MSIZE[1:0] bits (Memory size) */
  773. #define DMA_CCR_MSIZE_0 ((uint32_t)0x00000400U) /*!< Bit 0 */
  774. #define DMA_CCR_MSIZE_1 ((uint32_t)0x00000800U) /*!< Bit 1 */
  775. #define DMA_CCR_PL ((uint32_t)0x00003000U) /*!< PL[1:0] bits(Channel Priority level)*/
  776. #define DMA_CCR_PL_0 ((uint32_t)0x00001000U) /*!< Bit 0 */
  777. #define DMA_CCR_PL_1 ((uint32_t)0x00002000U) /*!< Bit 1 */
  778. #define DMA_CCR_MEM2MEM ((uint32_t)0x00004000U) /*!< Memory to memory mode */
  779. /****************** Bit definition for DMA_CNDTR register *******************/
  780. #define DMA_CNDTR_NDT ((uint32_t)0x0000FFFFU) /*!< Number of data to Transfer */
  781. /****************** Bit definition for DMA_CPAR register ********************/
  782. #define DMA_CPAR_PA ((uint32_t)0xFFFFFFFFU) /*!< Peripheral Address */
  783. /****************** Bit definition for DMA_CMAR register ********************/
  784. #define DMA_CMAR_MA ((uint32_t)0xFFFFFFFFU) /*!< Memory Address */
  785. /******************************************************************************/
  786. /* */
  787. /* External Interrupt/Event Controller (EXTI) */
  788. /* */
  789. /******************************************************************************/
  790. /******************* Bit definition for EXTI_IMR register *******************/
  791. #define EXTI_IMR_MR0 ((uint32_t)0x00000001U) /*!< Interrupt Mask on line 0 */
  792. #define EXTI_IMR_MR1 ((uint32_t)0x00000002U) /*!< Interrupt Mask on line 1 */
  793. #define EXTI_IMR_MR2 ((uint32_t)0x00000004U) /*!< Interrupt Mask on line 2 */
  794. #define EXTI_IMR_MR3 ((uint32_t)0x00000008U) /*!< Interrupt Mask on line 3 */
  795. #define EXTI_IMR_MR4 ((uint32_t)0x00000010U) /*!< Interrupt Mask on line 4 */
  796. #define EXTI_IMR_MR5 ((uint32_t)0x00000020U) /*!< Interrupt Mask on line 5 */
  797. #define EXTI_IMR_MR6 ((uint32_t)0x00000040U) /*!< Interrupt Mask on line 6 */
  798. #define EXTI_IMR_MR7 ((uint32_t)0x00000080U) /*!< Interrupt Mask on line 7 */
  799. #define EXTI_IMR_MR8 ((uint32_t)0x00000100U) /*!< Interrupt Mask on line 8 */
  800. #define EXTI_IMR_MR9 ((uint32_t)0x00000200U) /*!< Interrupt Mask on line 9 */
  801. #define EXTI_IMR_MR10 ((uint32_t)0x00000400U) /*!< Interrupt Mask on line 10 */
  802. #define EXTI_IMR_MR11 ((uint32_t)0x00000800U) /*!< Interrupt Mask on line 11 */
  803. #define EXTI_IMR_MR12 ((uint32_t)0x00001000U) /*!< Interrupt Mask on line 12 */
  804. #define EXTI_IMR_MR13 ((uint32_t)0x00002000U) /*!< Interrupt Mask on line 13 */
  805. #define EXTI_IMR_MR14 ((uint32_t)0x00004000U) /*!< Interrupt Mask on line 14 */
  806. #define EXTI_IMR_MR15 ((uint32_t)0x00008000U) /*!< Interrupt Mask on line 15 */
  807. #define EXTI_IMR_MR17 ((uint32_t)0x00020000U) /*!< Interrupt Mask on line 17 */
  808. #define EXTI_IMR_MR18 ((uint32_t)0x00040000U) /*!< Interrupt Mask on line 18 */
  809. #define EXTI_IMR_MR19 ((uint32_t)0x00080000U) /*!< Interrupt Mask on line 19 */
  810. #define EXTI_IMR_MR23 ((uint32_t)0x00800000U) /*!< Interrupt Mask on line 23 */
  811. /* References Defines */
  812. #define EXTI_IMR_IM0 EXTI_IMR_MR0
  813. #define EXTI_IMR_IM1 EXTI_IMR_MR1
  814. #define EXTI_IMR_IM2 EXTI_IMR_MR2
  815. #define EXTI_IMR_IM3 EXTI_IMR_MR3
  816. #define EXTI_IMR_IM4 EXTI_IMR_MR4
  817. #define EXTI_IMR_IM5 EXTI_IMR_MR5
  818. #define EXTI_IMR_IM6 EXTI_IMR_MR6
  819. #define EXTI_IMR_IM7 EXTI_IMR_MR7
  820. #define EXTI_IMR_IM8 EXTI_IMR_MR8
  821. #define EXTI_IMR_IM9 EXTI_IMR_MR9
  822. #define EXTI_IMR_IM10 EXTI_IMR_MR10
  823. #define EXTI_IMR_IM11 EXTI_IMR_MR11
  824. #define EXTI_IMR_IM12 EXTI_IMR_MR12
  825. #define EXTI_IMR_IM13 EXTI_IMR_MR13
  826. #define EXTI_IMR_IM14 EXTI_IMR_MR14
  827. #define EXTI_IMR_IM15 EXTI_IMR_MR15
  828. #define EXTI_IMR_IM17 EXTI_IMR_MR17
  829. #define EXTI_IMR_IM18 EXTI_IMR_MR18
  830. #define EXTI_IMR_IM19 EXTI_IMR_MR19
  831. #define EXTI_IMR_IM23 EXTI_IMR_MR23
  832. /****************** Bit definition for EXTI_EMR register ********************/
  833. #define EXTI_EMR_MR0 ((uint32_t)0x00000001U) /*!< Event Mask on line 0 */
  834. #define EXTI_EMR_MR1 ((uint32_t)0x00000002U) /*!< Event Mask on line 1 */
  835. #define EXTI_EMR_MR2 ((uint32_t)0x00000004U) /*!< Event Mask on line 2 */
  836. #define EXTI_EMR_MR3 ((uint32_t)0x00000008U) /*!< Event Mask on line 3 */
  837. #define EXTI_EMR_MR4 ((uint32_t)0x00000010U) /*!< Event Mask on line 4 */
  838. #define EXTI_EMR_MR5 ((uint32_t)0x00000020U) /*!< Event Mask on line 5 */
  839. #define EXTI_EMR_MR6 ((uint32_t)0x00000040U) /*!< Event Mask on line 6 */
  840. #define EXTI_EMR_MR7 ((uint32_t)0x00000080U) /*!< Event Mask on line 7 */
  841. #define EXTI_EMR_MR8 ((uint32_t)0x00000100U) /*!< Event Mask on line 8 */
  842. #define EXTI_EMR_MR9 ((uint32_t)0x00000200U) /*!< Event Mask on line 9 */
  843. #define EXTI_EMR_MR10 ((uint32_t)0x00000400U) /*!< Event Mask on line 10 */
  844. #define EXTI_EMR_MR11 ((uint32_t)0x00000800U) /*!< Event Mask on line 11 */
  845. #define EXTI_EMR_MR12 ((uint32_t)0x00001000U) /*!< Event Mask on line 12 */
  846. #define EXTI_EMR_MR13 ((uint32_t)0x00002000U) /*!< Event Mask on line 13 */
  847. #define EXTI_EMR_MR14 ((uint32_t)0x00004000U) /*!< Event Mask on line 14 */
  848. #define EXTI_EMR_MR15 ((uint32_t)0x00008000U) /*!< Event Mask on line 15 */
  849. #define EXTI_EMR_MR17 ((uint32_t)0x00020000U) /*!< Event Mask on line 17 */
  850. #define EXTI_EMR_MR18 ((uint32_t)0x00040000U) /*!< Event Mask on line 18 */
  851. #define EXTI_EMR_MR19 ((uint32_t)0x00080000U) /*!< Event Mask on line 19 */
  852. #define EXTI_EMR_MR23 ((uint32_t)0x00800000U) /*!< Event Mask on line 23 */
  853. /* References Defines */
  854. #define EXTI_EMR_EM0 EXTI_EMR_MR0
  855. #define EXTI_EMR_EM1 EXTI_EMR_MR1
  856. #define EXTI_EMR_EM2 EXTI_EMR_MR2
  857. #define EXTI_EMR_EM3 EXTI_EMR_MR3
  858. #define EXTI_EMR_EM4 EXTI_EMR_MR4
  859. #define EXTI_EMR_EM5 EXTI_EMR_MR5
  860. #define EXTI_EMR_EM6 EXTI_EMR_MR6
  861. #define EXTI_EMR_EM7 EXTI_EMR_MR7
  862. #define EXTI_EMR_EM8 EXTI_EMR_MR8
  863. #define EXTI_EMR_EM9 EXTI_EMR_MR9
  864. #define EXTI_EMR_EM10 EXTI_EMR_MR10
  865. #define EXTI_EMR_EM11 EXTI_EMR_MR11
  866. #define EXTI_EMR_EM12 EXTI_EMR_MR12
  867. #define EXTI_EMR_EM13 EXTI_EMR_MR13
  868. #define EXTI_EMR_EM14 EXTI_EMR_MR14
  869. #define EXTI_EMR_EM15 EXTI_EMR_MR15
  870. #define EXTI_EMR_EM17 EXTI_EMR_MR17
  871. #define EXTI_EMR_EM18 EXTI_EMR_MR18
  872. #define EXTI_EMR_EM19 EXTI_EMR_MR19
  873. #define EXTI_EMR_EM23 EXTI_EMR_MR23
  874. /******************* Bit definition for EXTI_RTSR register ******************/
  875. #define EXTI_RTSR_TR0 ((uint32_t)0x00000001U) /*!< Rising trigger event configuration bit of line 0 */
  876. #define EXTI_RTSR_TR1 ((uint32_t)0x00000002U) /*!< Rising trigger event configuration bit of line 1 */
  877. #define EXTI_RTSR_TR2 ((uint32_t)0x00000004U) /*!< Rising trigger event configuration bit of line 2 */
  878. #define EXTI_RTSR_TR3 ((uint32_t)0x00000008U) /*!< Rising trigger event configuration bit of line 3 */
  879. #define EXTI_RTSR_TR4 ((uint32_t)0x00000010U) /*!< Rising trigger event configuration bit of line 4 */
  880. #define EXTI_RTSR_TR5 ((uint32_t)0x00000020U) /*!< Rising trigger event configuration bit of line 5 */
  881. #define EXTI_RTSR_TR6 ((uint32_t)0x00000040U) /*!< Rising trigger event configuration bit of line 6 */
  882. #define EXTI_RTSR_TR7 ((uint32_t)0x00000080U) /*!< Rising trigger event configuration bit of line 7 */
  883. #define EXTI_RTSR_TR8 ((uint32_t)0x00000100U) /*!< Rising trigger event configuration bit of line 8 */
  884. #define EXTI_RTSR_TR9 ((uint32_t)0x00000200U) /*!< Rising trigger event configuration bit of line 9 */
  885. #define EXTI_RTSR_TR10 ((uint32_t)0x00000400U) /*!< Rising trigger event configuration bit of line 10 */
  886. #define EXTI_RTSR_TR11 ((uint32_t)0x00000800U) /*!< Rising trigger event configuration bit of line 11 */
  887. #define EXTI_RTSR_TR12 ((uint32_t)0x00001000U) /*!< Rising trigger event configuration bit of line 12 */
  888. #define EXTI_RTSR_TR13 ((uint32_t)0x00002000U) /*!< Rising trigger event configuration bit of line 13 */
  889. #define EXTI_RTSR_TR14 ((uint32_t)0x00004000U) /*!< Rising trigger event configuration bit of line 14 */
  890. #define EXTI_RTSR_TR15 ((uint32_t)0x00008000U) /*!< Rising trigger event configuration bit of line 15 */
  891. #define EXTI_RTSR_TR16 ((uint32_t)0x00010000U) /*!< Rising trigger event configuration bit of line 16 */
  892. #define EXTI_RTSR_TR17 ((uint32_t)0x00020000U) /*!< Rising trigger event configuration bit of line 17 */
  893. #define EXTI_RTSR_TR19 ((uint32_t)0x00080000U) /*!< Rising trigger event configuration bit of line 19 */
  894. /* References Defines */
  895. #define EXTI_RTSR_RT0 EXTI_RTSR_TR0
  896. #define EXTI_RTSR_RT1 EXTI_RTSR_TR1
  897. #define EXTI_RTSR_RT2 EXTI_RTSR_TR2
  898. #define EXTI_RTSR_RT3 EXTI_RTSR_TR3
  899. #define EXTI_RTSR_RT4 EXTI_RTSR_TR4
  900. #define EXTI_RTSR_RT5 EXTI_RTSR_TR5
  901. #define EXTI_RTSR_RT6 EXTI_RTSR_TR6
  902. #define EXTI_RTSR_RT7 EXTI_RTSR_TR7
  903. #define EXTI_RTSR_RT8 EXTI_RTSR_TR8
  904. #define EXTI_RTSR_RT9 EXTI_RTSR_TR9
  905. #define EXTI_RTSR_RT10 EXTI_RTSR_TR10
  906. #define EXTI_RTSR_RT11 EXTI_RTSR_TR11
  907. #define EXTI_RTSR_RT12 EXTI_RTSR_TR12
  908. #define EXTI_RTSR_RT13 EXTI_RTSR_TR13
  909. #define EXTI_RTSR_RT14 EXTI_RTSR_TR14
  910. #define EXTI_RTSR_RT15 EXTI_RTSR_TR15
  911. #define EXTI_RTSR_RT16 EXTI_RTSR_TR16
  912. #define EXTI_RTSR_RT17 EXTI_RTSR_TR17
  913. #define EXTI_RTSR_RT19 EXTI_RTSR_TR19
  914. /******************* Bit definition for EXTI_FTSR register *******************/
  915. #define EXTI_FTSR_TR0 ((uint32_t)0x00000001U) /*!< Falling trigger event configuration bit of line 0 */
  916. #define EXTI_FTSR_TR1 ((uint32_t)0x00000002U) /*!< Falling trigger event configuration bit of line 1 */
  917. #define EXTI_FTSR_TR2 ((uint32_t)0x00000004U) /*!< Falling trigger event configuration bit of line 2 */
  918. #define EXTI_FTSR_TR3 ((uint32_t)0x00000008U) /*!< Falling trigger event configuration bit of line 3 */
  919. #define EXTI_FTSR_TR4 ((uint32_t)0x00000010U) /*!< Falling trigger event configuration bit of line 4 */
  920. #define EXTI_FTSR_TR5 ((uint32_t)0x00000020U) /*!< Falling trigger event configuration bit of line 5 */
  921. #define EXTI_FTSR_TR6 ((uint32_t)0x00000040U) /*!< Falling trigger event configuration bit of line 6 */
  922. #define EXTI_FTSR_TR7 ((uint32_t)0x00000080U) /*!< Falling trigger event configuration bit of line 7 */
  923. #define EXTI_FTSR_TR8 ((uint32_t)0x00000100U) /*!< Falling trigger event configuration bit of line 8 */
  924. #define EXTI_FTSR_TR9 ((uint32_t)0x00000200U) /*!< Falling trigger event configuration bit of line 9 */
  925. #define EXTI_FTSR_TR10 ((uint32_t)0x00000400U) /*!< Falling trigger event configuration bit of line 10 */
  926. #define EXTI_FTSR_TR11 ((uint32_t)0x00000800U) /*!< Falling trigger event configuration bit of line 11 */
  927. #define EXTI_FTSR_TR12 ((uint32_t)0x00001000U) /*!< Falling trigger event configuration bit of line 12 */
  928. #define EXTI_FTSR_TR13 ((uint32_t)0x00002000U) /*!< Falling trigger event configuration bit of line 13 */
  929. #define EXTI_FTSR_TR14 ((uint32_t)0x00004000U) /*!< Falling trigger event configuration bit of line 14 */
  930. #define EXTI_FTSR_TR15 ((uint32_t)0x00008000U) /*!< Falling trigger event configuration bit of line 15 */
  931. #define EXTI_FTSR_TR16 ((uint32_t)0x00010000U) /*!< Falling trigger event configuration bit of line 16 */
  932. #define EXTI_FTSR_TR17 ((uint32_t)0x00020000U) /*!< Falling trigger event configuration bit of line 17 */
  933. #define EXTI_FTSR_TR19 ((uint32_t)0x00080000U) /*!< Falling trigger event configuration bit of line 19 */
  934. /* References Defines */
  935. #define EXTI_FTSR_FT0 EXTI_FTSR_TR0
  936. #define EXTI_FTSR_FT1 EXTI_FTSR_TR1
  937. #define EXTI_FTSR_FT2 EXTI_FTSR_TR2
  938. #define EXTI_FTSR_FT3 EXTI_FTSR_TR3
  939. #define EXTI_FTSR_FT4 EXTI_FTSR_TR4
  940. #define EXTI_FTSR_FT5 EXTI_FTSR_TR5
  941. #define EXTI_FTSR_FT6 EXTI_FTSR_TR6
  942. #define EXTI_FTSR_FT7 EXTI_FTSR_TR7
  943. #define EXTI_FTSR_FT8 EXTI_FTSR_TR8
  944. #define EXTI_FTSR_FT9 EXTI_FTSR_TR9
  945. #define EXTI_FTSR_FT10 EXTI_FTSR_TR10
  946. #define EXTI_FTSR_FT11 EXTI_FTSR_TR11
  947. #define EXTI_FTSR_FT12 EXTI_FTSR_TR12
  948. #define EXTI_FTSR_FT13 EXTI_FTSR_TR13
  949. #define EXTI_FTSR_FT14 EXTI_FTSR_TR14
  950. #define EXTI_FTSR_FT15 EXTI_FTSR_TR15
  951. #define EXTI_FTSR_FT16 EXTI_FTSR_TR16
  952. #define EXTI_FTSR_FT17 EXTI_FTSR_TR17
  953. #define EXTI_FTSR_FT19 EXTI_FTSR_TR19
  954. /******************* Bit definition for EXTI_SWIER register *******************/
  955. #define EXTI_SWIER_SWIER0 ((uint32_t)0x00000001U) /*!< Software Interrupt on line 0 */
  956. #define EXTI_SWIER_SWIER1 ((uint32_t)0x00000002U) /*!< Software Interrupt on line 1 */
  957. #define EXTI_SWIER_SWIER2 ((uint32_t)0x00000004U) /*!< Software Interrupt on line 2 */
  958. #define EXTI_SWIER_SWIER3 ((uint32_t)0x00000008U) /*!< Software Interrupt on line 3 */
  959. #define EXTI_SWIER_SWIER4 ((uint32_t)0x00000010U) /*!< Software Interrupt on line 4 */
  960. #define EXTI_SWIER_SWIER5 ((uint32_t)0x00000020U) /*!< Software Interrupt on line 5 */
  961. #define EXTI_SWIER_SWIER6 ((uint32_t)0x00000040U) /*!< Software Interrupt on line 6 */
  962. #define EXTI_SWIER_SWIER7 ((uint32_t)0x00000080U) /*!< Software Interrupt on line 7 */
  963. #define EXTI_SWIER_SWIER8 ((uint32_t)0x00000100U) /*!< Software Interrupt on line 8 */
  964. #define EXTI_SWIER_SWIER9 ((uint32_t)0x00000200U) /*!< Software Interrupt on line 9 */
  965. #define EXTI_SWIER_SWIER10 ((uint32_t)0x00000400U) /*!< Software Interrupt on line 10 */
  966. #define EXTI_SWIER_SWIER11 ((uint32_t)0x00000800U) /*!< Software Interrupt on line 11 */
  967. #define EXTI_SWIER_SWIER12 ((uint32_t)0x00001000U) /*!< Software Interrupt on line 12 */
  968. #define EXTI_SWIER_SWIER13 ((uint32_t)0x00002000U) /*!< Software Interrupt on line 13 */
  969. #define EXTI_SWIER_SWIER14 ((uint32_t)0x00004000U) /*!< Software Interrupt on line 14 */
  970. #define EXTI_SWIER_SWIER15 ((uint32_t)0x00008000U) /*!< Software Interrupt on line 15 */
  971. #define EXTI_SWIER_SWIER16 ((uint32_t)0x00010000U) /*!< Software Interrupt on line 16 */
  972. #define EXTI_SWIER_SWIER17 ((uint32_t)0x00020000U) /*!< Software Interrupt on line 17 */
  973. #define EXTI_SWIER_SWIER19 ((uint32_t)0x00080000U) /*!< Software Interrupt on line 19 */
  974. /* References Defines */
  975. #define EXTI_SWIER_SWI0 EXTI_SWIER_SWIER0
  976. #define EXTI_SWIER_SWI1 EXTI_SWIER_SWIER1
  977. #define EXTI_SWIER_SWI2 EXTI_SWIER_SWIER2
  978. #define EXTI_SWIER_SWI3 EXTI_SWIER_SWIER3
  979. #define EXTI_SWIER_SWI4 EXTI_SWIER_SWIER4
  980. #define EXTI_SWIER_SWI5 EXTI_SWIER_SWIER5
  981. #define EXTI_SWIER_SWI6 EXTI_SWIER_SWIER6
  982. #define EXTI_SWIER_SWI7 EXTI_SWIER_SWIER7
  983. #define EXTI_SWIER_SWI8 EXTI_SWIER_SWIER8
  984. #define EXTI_SWIER_SWI9 EXTI_SWIER_SWIER9
  985. #define EXTI_SWIER_SWI10 EXTI_SWIER_SWIER10
  986. #define EXTI_SWIER_SWI11 EXTI_SWIER_SWIER11
  987. #define EXTI_SWIER_SWI12 EXTI_SWIER_SWIER12
  988. #define EXTI_SWIER_SWI13 EXTI_SWIER_SWIER13
  989. #define EXTI_SWIER_SWI14 EXTI_SWIER_SWIER14
  990. #define EXTI_SWIER_SWI15 EXTI_SWIER_SWIER15
  991. #define EXTI_SWIER_SWI16 EXTI_SWIER_SWIER16
  992. #define EXTI_SWIER_SWI17 EXTI_SWIER_SWIER17
  993. #define EXTI_SWIER_SWI19 EXTI_SWIER_SWIER19
  994. /****************** Bit definition for EXTI_PR register *********************/
  995. #define EXTI_PR_PR0 ((uint32_t)0x00000001U) /*!< Pending bit 0 */
  996. #define EXTI_PR_PR1 ((uint32_t)0x00000002U) /*!< Pending bit 1 */
  997. #define EXTI_PR_PR2 ((uint32_t)0x00000004U) /*!< Pending bit 2 */
  998. #define EXTI_PR_PR3 ((uint32_t)0x00000008U) /*!< Pending bit 3 */
  999. #define EXTI_PR_PR4 ((uint32_t)0x00000010U) /*!< Pending bit 4 */
  1000. #define EXTI_PR_PR5 ((uint32_t)0x00000020U) /*!< Pending bit 5 */
  1001. #define EXTI_PR_PR6 ((uint32_t)0x00000040U) /*!< Pending bit 6 */
  1002. #define EXTI_PR_PR7 ((uint32_t)0x00000080U) /*!< Pending bit 7 */
  1003. #define EXTI_PR_PR8 ((uint32_t)0x00000100U) /*!< Pending bit 8 */
  1004. #define EXTI_PR_PR9 ((uint32_t)0x00000200U) /*!< Pending bit 9 */
  1005. #define EXTI_PR_PR10 ((uint32_t)0x00000400U) /*!< Pending bit 10 */
  1006. #define EXTI_PR_PR11 ((uint32_t)0x00000800U) /*!< Pending bit 11 */
  1007. #define EXTI_PR_PR12 ((uint32_t)0x00001000U) /*!< Pending bit 12 */
  1008. #define EXTI_PR_PR13 ((uint32_t)0x00002000U) /*!< Pending bit 13 */
  1009. #define EXTI_PR_PR14 ((uint32_t)0x00004000U) /*!< Pending bit 14 */
  1010. #define EXTI_PR_PR15 ((uint32_t)0x00008000U) /*!< Pending bit 15 */
  1011. #define EXTI_PR_PR16 ((uint32_t)0x00010000U) /*!< Pending bit 16 */
  1012. #define EXTI_PR_PR17 ((uint32_t)0x00020000U) /*!< Pending bit 17 */
  1013. #define EXTI_PR_PR19 ((uint32_t)0x00080000U) /*!< Pending bit 19 */
  1014. /* References Defines */
  1015. #define EXTI_PR_PIF0 EXTI_PR_PR0
  1016. #define EXTI_PR_PIF1 EXTI_PR_PR1
  1017. #define EXTI_PR_PIF2 EXTI_PR_PR2
  1018. #define EXTI_PR_PIF3 EXTI_PR_PR3
  1019. #define EXTI_PR_PIF4 EXTI_PR_PR4
  1020. #define EXTI_PR_PIF5 EXTI_PR_PR5
  1021. #define EXTI_PR_PIF6 EXTI_PR_PR6
  1022. #define EXTI_PR_PIF7 EXTI_PR_PR7
  1023. #define EXTI_PR_PIF8 EXTI_PR_PR8
  1024. #define EXTI_PR_PIF9 EXTI_PR_PR9
  1025. #define EXTI_PR_PIF10 EXTI_PR_PR10
  1026. #define EXTI_PR_PIF11 EXTI_PR_PR11
  1027. #define EXTI_PR_PIF12 EXTI_PR_PR12
  1028. #define EXTI_PR_PIF13 EXTI_PR_PR13
  1029. #define EXTI_PR_PIF14 EXTI_PR_PR14
  1030. #define EXTI_PR_PIF15 EXTI_PR_PR15
  1031. #define EXTI_PR_PIF16 EXTI_PR_PR16
  1032. #define EXTI_PR_PIF17 EXTI_PR_PR17
  1033. #define EXTI_PR_PIF19 EXTI_PR_PR19
  1034. /******************************************************************************/
  1035. /* */
  1036. /* FLASH and Option Bytes Registers */
  1037. /* */
  1038. /******************************************************************************/
  1039. /******************* Bit definition for FLASH_ACR register ******************/
  1040. #define FLASH_ACR_LATENCY ((uint32_t)0x00000001U) /*!< LATENCY bit (Latency) */
  1041. #define FLASH_ACR_PRFTBE ((uint32_t)0x00000010U) /*!< Prefetch Buffer Enable */
  1042. #define FLASH_ACR_PRFTBS ((uint32_t)0x00000020U) /*!< Prefetch Buffer Status */
  1043. /****************** Bit definition for FLASH_KEYR register ******************/
  1044. #define FLASH_KEYR_FKEYR ((uint32_t)0xFFFFFFFFU) /*!< FPEC Key */
  1045. /***************** Bit definition for FLASH_OPTKEYR register ****************/
  1046. #define FLASH_OPTKEYR_OPTKEYR ((uint32_t)0xFFFFFFFFU) /*!< Option Byte Key */
  1047. /****************** FLASH Keys **********************************************/
  1048. #define FLASH_KEY1 ((uint32_t)0x45670123U) /*!< Flash program erase key1 */
  1049. #define FLASH_KEY2 ((uint32_t)0xCDEF89ABU) /*!< Flash program erase key2: used with FLASH_PEKEY1
  1050. to unlock the write access to the FPEC. */
  1051. #define FLASH_OPTKEY1 ((uint32_t)0x45670123U) /*!< Flash option key1 */
  1052. #define FLASH_OPTKEY2 ((uint32_t)0xCDEF89ABU) /*!< Flash option key2: used with FLASH_OPTKEY1 to
  1053. unlock the write access to the option byte block */
  1054. /****************** Bit definition for FLASH_SR register *******************/
  1055. #define FLASH_SR_BSY ((uint32_t)0x00000001U) /*!< Busy */
  1056. #define FLASH_SR_PGERR ((uint32_t)0x00000004U) /*!< Programming Error */
  1057. #define FLASH_SR_WRPRTERR ((uint32_t)0x00000010U) /*!< Write Protection Error */
  1058. #define FLASH_SR_EOP ((uint32_t)0x00000020U) /*!< End of operation */
  1059. #define FLASH_SR_WRPERR FLASH_SR_WRPRTERR /*!< Legacy of Write Protection Error */
  1060. /******************* Bit definition for FLASH_CR register *******************/
  1061. #define FLASH_CR_PG ((uint32_t)0x00000001U) /*!< Programming */
  1062. #define FLASH_CR_PER ((uint32_t)0x00000002U) /*!< Page Erase */
  1063. #define FLASH_CR_MER ((uint32_t)0x00000004U) /*!< Mass Erase */
  1064. #define FLASH_CR_OPTPG ((uint32_t)0x00000010U) /*!< Option Byte Programming */
  1065. #define FLASH_CR_OPTER ((uint32_t)0x00000020U) /*!< Option Byte Erase */
  1066. #define FLASH_CR_STRT ((uint32_t)0x00000040U) /*!< Start */
  1067. #define FLASH_CR_LOCK ((uint32_t)0x00000080U) /*!< Lock */
  1068. #define FLASH_CR_OPTWRE ((uint32_t)0x00000200U) /*!< Option Bytes Write Enable */
  1069. #define FLASH_CR_ERRIE ((uint32_t)0x00000400U) /*!< Error Interrupt Enable */
  1070. #define FLASH_CR_EOPIE ((uint32_t)0x00001000U) /*!< End of operation interrupt enable */
  1071. #define FLASH_CR_OBL_LAUNCH ((uint32_t)0x00002000U) /*!< Option Bytes Loader Launch */
  1072. /******************* Bit definition for FLASH_AR register *******************/
  1073. #define FLASH_AR_FAR ((uint32_t)0xFFFFFFFFU) /*!< Flash Address */
  1074. /****************** Bit definition for FLASH_OBR register *******************/
  1075. #define FLASH_OBR_OPTERR ((uint32_t)0x00000001U) /*!< Option Byte Error */
  1076. #define FLASH_OBR_RDPRT1 ((uint32_t)0x00000002U) /*!< Read protection Level 1 */
  1077. #define FLASH_OBR_RDPRT2 ((uint32_t)0x00000004U) /*!< Read protection Level 2 */
  1078. #define FLASH_OBR_USER ((uint32_t)0x00007700U) /*!< User Option Bytes */
  1079. #define FLASH_OBR_IWDG_SW ((uint32_t)0x00000100U) /*!< IWDG SW */
  1080. #define FLASH_OBR_nRST_STOP ((uint32_t)0x00000200U) /*!< nRST_STOP */
  1081. #define FLASH_OBR_nRST_STDBY ((uint32_t)0x00000400U) /*!< nRST_STDBY */
  1082. #define FLASH_OBR_nBOOT1 ((uint32_t)0x00001000U) /*!< nBOOT1 */
  1083. #define FLASH_OBR_VDDA_MONITOR ((uint32_t)0x00002000U) /*!< VDDA power supply supervisor */
  1084. #define FLASH_OBR_RAM_PARITY_CHECK ((uint32_t)0x00004000U) /*!< RAM parity check */
  1085. #define FLASH_OBR_DATA0 ((uint32_t)0x00FF0000U) /*!< Data0 */
  1086. #define FLASH_OBR_DATA1 ((uint32_t)0xFF000000U) /*!< Data1 */
  1087. /* Old BOOT1 bit definition, maintained for legacy purpose */
  1088. #define FLASH_OBR_BOOT1 FLASH_OBR_nBOOT1
  1089. /* Old OBR_VDDA bit definition, maintained for legacy purpose */
  1090. #define FLASH_OBR_VDDA_ANALOG FLASH_OBR_VDDA_MONITOR
  1091. /****************** Bit definition for FLASH_WRPR register ******************/
  1092. #define FLASH_WRPR_WRP ((uint32_t)0x0000FFFFU) /*!< Write Protect */
  1093. /*----------------------------------------------------------------------------*/
  1094. /****************** Bit definition for OB_RDP register **********************/
  1095. #define OB_RDP_RDP ((uint32_t)0x000000FFU) /*!< Read protection option byte */
  1096. #define OB_RDP_nRDP ((uint32_t)0x0000FF00U) /*!< Read protection complemented option byte */
  1097. /****************** Bit definition for OB_USER register *********************/
  1098. #define OB_USER_USER ((uint32_t)0x00FF0000U) /*!< User option byte */
  1099. #define OB_USER_nUSER ((uint32_t)0xFF000000U) /*!< User complemented option byte */
  1100. /****************** Bit definition for OB_WRP0 register *********************/
  1101. #define OB_WRP0_WRP0 ((uint32_t)0x000000FFU) /*!< Flash memory write protection option bytes */
  1102. #define OB_WRP0_nWRP0 ((uint32_t)0x0000FF00U) /*!< Flash memory write protection complemented option bytes */
  1103. /******************************************************************************/
  1104. /* */
  1105. /* General Purpose IOs (GPIO) */
  1106. /* */
  1107. /******************************************************************************/
  1108. /******************* Bit definition for GPIO_MODER register *****************/
  1109. #define GPIO_MODER_MODER0 ((uint32_t)0x00000003U)
  1110. #define GPIO_MODER_MODER0_0 ((uint32_t)0x00000001U)
  1111. #define GPIO_MODER_MODER0_1 ((uint32_t)0x00000002U)
  1112. #define GPIO_MODER_MODER1 ((uint32_t)0x0000000CU)
  1113. #define GPIO_MODER_MODER1_0 ((uint32_t)0x00000004U)
  1114. #define GPIO_MODER_MODER1_1 ((uint32_t)0x00000008U)
  1115. #define GPIO_MODER_MODER2 ((uint32_t)0x00000030U)
  1116. #define GPIO_MODER_MODER2_0 ((uint32_t)0x00000010U)
  1117. #define GPIO_MODER_MODER2_1 ((uint32_t)0x00000020U)
  1118. #define GPIO_MODER_MODER3 ((uint32_t)0x000000C0U)
  1119. #define GPIO_MODER_MODER3_0 ((uint32_t)0x00000040U)
  1120. #define GPIO_MODER_MODER3_1 ((uint32_t)0x00000080U)
  1121. #define GPIO_MODER_MODER4 ((uint32_t)0x00000300U)
  1122. #define GPIO_MODER_MODER4_0 ((uint32_t)0x00000100U)
  1123. #define GPIO_MODER_MODER4_1 ((uint32_t)0x00000200U)
  1124. #define GPIO_MODER_MODER5 ((uint32_t)0x00000C00U)
  1125. #define GPIO_MODER_MODER5_0 ((uint32_t)0x00000400U)
  1126. #define GPIO_MODER_MODER5_1 ((uint32_t)0x00000800U)
  1127. #define GPIO_MODER_MODER6 ((uint32_t)0x00003000U)
  1128. #define GPIO_MODER_MODER6_0 ((uint32_t)0x00001000U)
  1129. #define GPIO_MODER_MODER6_1 ((uint32_t)0x00002000U)
  1130. #define GPIO_MODER_MODER7 ((uint32_t)0x0000C000U)
  1131. #define GPIO_MODER_MODER7_0 ((uint32_t)0x00004000U)
  1132. #define GPIO_MODER_MODER7_1 ((uint32_t)0x00008000U)
  1133. #define GPIO_MODER_MODER8 ((uint32_t)0x00030000U)
  1134. #define GPIO_MODER_MODER8_0 ((uint32_t)0x00010000U)
  1135. #define GPIO_MODER_MODER8_1 ((uint32_t)0x00020000U)
  1136. #define GPIO_MODER_MODER9 ((uint32_t)0x000C0000U)
  1137. #define GPIO_MODER_MODER9_0 ((uint32_t)0x00040000U)
  1138. #define GPIO_MODER_MODER9_1 ((uint32_t)0x00080000U)
  1139. #define GPIO_MODER_MODER10 ((uint32_t)0x00300000U)
  1140. #define GPIO_MODER_MODER10_0 ((uint32_t)0x00100000U)
  1141. #define GPIO_MODER_MODER10_1 ((uint32_t)0x00200000U)
  1142. #define GPIO_MODER_MODER11 ((uint32_t)0x00C00000U)
  1143. #define GPIO_MODER_MODER11_0 ((uint32_t)0x00400000U)
  1144. #define GPIO_MODER_MODER11_1 ((uint32_t)0x00800000U)
  1145. #define GPIO_MODER_MODER12 ((uint32_t)0x03000000U)
  1146. #define GPIO_MODER_MODER12_0 ((uint32_t)0x01000000U)
  1147. #define GPIO_MODER_MODER12_1 ((uint32_t)0x02000000U)
  1148. #define GPIO_MODER_MODER13 ((uint32_t)0x0C000000U)
  1149. #define GPIO_MODER_MODER13_0 ((uint32_t)0x04000000U)
  1150. #define GPIO_MODER_MODER13_1 ((uint32_t)0x08000000U)
  1151. #define GPIO_MODER_MODER14 ((uint32_t)0x30000000U)
  1152. #define GPIO_MODER_MODER14_0 ((uint32_t)0x10000000U)
  1153. #define GPIO_MODER_MODER14_1 ((uint32_t)0x20000000U)
  1154. #define GPIO_MODER_MODER15 ((uint32_t)0xC0000000U)
  1155. #define GPIO_MODER_MODER15_0 ((uint32_t)0x40000000U)
  1156. #define GPIO_MODER_MODER15_1 ((uint32_t)0x80000000U)
  1157. /****************** Bit definition for GPIO_OTYPER register *****************/
  1158. #define GPIO_OTYPER_OT_0 ((uint32_t)0x00000001U)
  1159. #define GPIO_OTYPER_OT_1 ((uint32_t)0x00000002U)
  1160. #define GPIO_OTYPER_OT_2 ((uint32_t)0x00000004U)
  1161. #define GPIO_OTYPER_OT_3 ((uint32_t)0x00000008U)
  1162. #define GPIO_OTYPER_OT_4 ((uint32_t)0x00000010U)
  1163. #define GPIO_OTYPER_OT_5 ((uint32_t)0x00000020U)
  1164. #define GPIO_OTYPER_OT_6 ((uint32_t)0x00000040U)
  1165. #define GPIO_OTYPER_OT_7 ((uint32_t)0x00000080U)
  1166. #define GPIO_OTYPER_OT_8 ((uint32_t)0x00000100U)
  1167. #define GPIO_OTYPER_OT_9 ((uint32_t)0x00000200U)
  1168. #define GPIO_OTYPER_OT_10 ((uint32_t)0x00000400U)
  1169. #define GPIO_OTYPER_OT_11 ((uint32_t)0x00000800U)
  1170. #define GPIO_OTYPER_OT_12 ((uint32_t)0x00001000U)
  1171. #define GPIO_OTYPER_OT_13 ((uint32_t)0x00002000U)
  1172. #define GPIO_OTYPER_OT_14 ((uint32_t)0x00004000U)
  1173. #define GPIO_OTYPER_OT_15 ((uint32_t)0x00008000U)
  1174. /**************** Bit definition for GPIO_OSPEEDR register ******************/
  1175. #define GPIO_OSPEEDR_OSPEEDR0 ((uint32_t)0x00000003U)
  1176. #define GPIO_OSPEEDR_OSPEEDR0_0 ((uint32_t)0x00000001U)
  1177. #define GPIO_OSPEEDR_OSPEEDR0_1 ((uint32_t)0x00000002U)
  1178. #define GPIO_OSPEEDR_OSPEEDR1 ((uint32_t)0x0000000CU)
  1179. #define GPIO_OSPEEDR_OSPEEDR1_0 ((uint32_t)0x00000004U)
  1180. #define GPIO_OSPEEDR_OSPEEDR1_1 ((uint32_t)0x00000008U)
  1181. #define GPIO_OSPEEDR_OSPEEDR2 ((uint32_t)0x00000030U)
  1182. #define GPIO_OSPEEDR_OSPEEDR2_0 ((uint32_t)0x00000010U)
  1183. #define GPIO_OSPEEDR_OSPEEDR2_1 ((uint32_t)0x00000020U)
  1184. #define GPIO_OSPEEDR_OSPEEDR3 ((uint32_t)0x000000C0U)
  1185. #define GPIO_OSPEEDR_OSPEEDR3_0 ((uint32_t)0x00000040U)
  1186. #define GPIO_OSPEEDR_OSPEEDR3_1 ((uint32_t)0x00000080U)
  1187. #define GPIO_OSPEEDR_OSPEEDR4 ((uint32_t)0x00000300U)
  1188. #define GPIO_OSPEEDR_OSPEEDR4_0 ((uint32_t)0x00000100U)
  1189. #define GPIO_OSPEEDR_OSPEEDR4_1 ((uint32_t)0x00000200U)
  1190. #define GPIO_OSPEEDR_OSPEEDR5 ((uint32_t)0x00000C00U)
  1191. #define GPIO_OSPEEDR_OSPEEDR5_0 ((uint32_t)0x00000400U)
  1192. #define GPIO_OSPEEDR_OSPEEDR5_1 ((uint32_t)0x00000800U)
  1193. #define GPIO_OSPEEDR_OSPEEDR6 ((uint32_t)0x00003000U)
  1194. #define GPIO_OSPEEDR_OSPEEDR6_0 ((uint32_t)0x00001000U)
  1195. #define GPIO_OSPEEDR_OSPEEDR6_1 ((uint32_t)0x00002000U)
  1196. #define GPIO_OSPEEDR_OSPEEDR7 ((uint32_t)0x0000C000U)
  1197. #define GPIO_OSPEEDR_OSPEEDR7_0 ((uint32_t)0x00004000U)
  1198. #define GPIO_OSPEEDR_OSPEEDR7_1 ((uint32_t)0x00008000U)
  1199. #define GPIO_OSPEEDR_OSPEEDR8 ((uint32_t)0x00030000U)
  1200. #define GPIO_OSPEEDR_OSPEEDR8_0 ((uint32_t)0x00010000U)
  1201. #define GPIO_OSPEEDR_OSPEEDR8_1 ((uint32_t)0x00020000U)
  1202. #define GPIO_OSPEEDR_OSPEEDR9 ((uint32_t)0x000C0000U)
  1203. #define GPIO_OSPEEDR_OSPEEDR9_0 ((uint32_t)0x00040000U)
  1204. #define GPIO_OSPEEDR_OSPEEDR9_1 ((uint32_t)0x00080000U)
  1205. #define GPIO_OSPEEDR_OSPEEDR10 ((uint32_t)0x00300000U)
  1206. #define GPIO_OSPEEDR_OSPEEDR10_0 ((uint32_t)0x00100000U)
  1207. #define GPIO_OSPEEDR_OSPEEDR10_1 ((uint32_t)0x00200000U)
  1208. #define GPIO_OSPEEDR_OSPEEDR11 ((uint32_t)0x00C00000U)
  1209. #define GPIO_OSPEEDR_OSPEEDR11_0 ((uint32_t)0x00400000U)
  1210. #define GPIO_OSPEEDR_OSPEEDR11_1 ((uint32_t)0x00800000U)
  1211. #define GPIO_OSPEEDR_OSPEEDR12 ((uint32_t)0x03000000U)
  1212. #define GPIO_OSPEEDR_OSPEEDR12_0 ((uint32_t)0x01000000U)
  1213. #define GPIO_OSPEEDR_OSPEEDR12_1 ((uint32_t)0x02000000U)
  1214. #define GPIO_OSPEEDR_OSPEEDR13 ((uint32_t)0x0C000000U)
  1215. #define GPIO_OSPEEDR_OSPEEDR13_0 ((uint32_t)0x04000000U)
  1216. #define GPIO_OSPEEDR_OSPEEDR13_1 ((uint32_t)0x08000000U)
  1217. #define GPIO_OSPEEDR_OSPEEDR14 ((uint32_t)0x30000000U)
  1218. #define GPIO_OSPEEDR_OSPEEDR14_0 ((uint32_t)0x10000000U)
  1219. #define GPIO_OSPEEDR_OSPEEDR14_1 ((uint32_t)0x20000000U)
  1220. #define GPIO_OSPEEDR_OSPEEDR15 ((uint32_t)0xC0000000U)
  1221. #define GPIO_OSPEEDR_OSPEEDR15_0 ((uint32_t)0x40000000U)
  1222. #define GPIO_OSPEEDR_OSPEEDR15_1 ((uint32_t)0x80000000U)
  1223. /* Old Bit definition for GPIO_OSPEEDR register maintained for legacy purpose */
  1224. #define GPIO_OSPEEDER_OSPEEDR0 GPIO_OSPEEDR_OSPEEDR0
  1225. #define GPIO_OSPEEDER_OSPEEDR0_0 GPIO_OSPEEDR_OSPEEDR0_0
  1226. #define GPIO_OSPEEDER_OSPEEDR0_1 GPIO_OSPEEDR_OSPEEDR0_1
  1227. #define GPIO_OSPEEDER_OSPEEDR1 GPIO_OSPEEDR_OSPEEDR1
  1228. #define GPIO_OSPEEDER_OSPEEDR1_0 GPIO_OSPEEDR_OSPEEDR1_0
  1229. #define GPIO_OSPEEDER_OSPEEDR1_1 GPIO_OSPEEDR_OSPEEDR1_1
  1230. #define GPIO_OSPEEDER_OSPEEDR2 GPIO_OSPEEDR_OSPEEDR2
  1231. #define GPIO_OSPEEDER_OSPEEDR2_0 GPIO_OSPEEDR_OSPEEDR2_0
  1232. #define GPIO_OSPEEDER_OSPEEDR2_1 GPIO_OSPEEDR_OSPEEDR2_1
  1233. #define GPIO_OSPEEDER_OSPEEDR3 GPIO_OSPEEDR_OSPEEDR3
  1234. #define GPIO_OSPEEDER_OSPEEDR3_0 GPIO_OSPEEDR_OSPEEDR3_0
  1235. #define GPIO_OSPEEDER_OSPEEDR3_1 GPIO_OSPEEDR_OSPEEDR3_1
  1236. #define GPIO_OSPEEDER_OSPEEDR4 GPIO_OSPEEDR_OSPEEDR4
  1237. #define GPIO_OSPEEDER_OSPEEDR4_0 GPIO_OSPEEDR_OSPEEDR4_0
  1238. #define GPIO_OSPEEDER_OSPEEDR4_1 GPIO_OSPEEDR_OSPEEDR4_1
  1239. #define GPIO_OSPEEDER_OSPEEDR5 GPIO_OSPEEDR_OSPEEDR5
  1240. #define GPIO_OSPEEDER_OSPEEDR5_0 GPIO_OSPEEDR_OSPEEDR5_0
  1241. #define GPIO_OSPEEDER_OSPEEDR5_1 GPIO_OSPEEDR_OSPEEDR5_1
  1242. #define GPIO_OSPEEDER_OSPEEDR6 GPIO_OSPEEDR_OSPEEDR6
  1243. #define GPIO_OSPEEDER_OSPEEDR6_0 GPIO_OSPEEDR_OSPEEDR6_0
  1244. #define GPIO_OSPEEDER_OSPEEDR6_1 GPIO_OSPEEDR_OSPEEDR6_1
  1245. #define GPIO_OSPEEDER_OSPEEDR7 GPIO_OSPEEDR_OSPEEDR7
  1246. #define GPIO_OSPEEDER_OSPEEDR7_0 GPIO_OSPEEDR_OSPEEDR7_0
  1247. #define GPIO_OSPEEDER_OSPEEDR7_1 GPIO_OSPEEDR_OSPEEDR7_1
  1248. #define GPIO_OSPEEDER_OSPEEDR8 GPIO_OSPEEDR_OSPEEDR8
  1249. #define GPIO_OSPEEDER_OSPEEDR8_0 GPIO_OSPEEDR_OSPEEDR8_0
  1250. #define GPIO_OSPEEDER_OSPEEDR8_1 GPIO_OSPEEDR_OSPEEDR8_1
  1251. #define GPIO_OSPEEDER_OSPEEDR9 GPIO_OSPEEDR_OSPEEDR9
  1252. #define GPIO_OSPEEDER_OSPEEDR9_0 GPIO_OSPEEDR_OSPEEDR9_0
  1253. #define GPIO_OSPEEDER_OSPEEDR9_1 GPIO_OSPEEDR_OSPEEDR9_1
  1254. #define GPIO_OSPEEDER_OSPEEDR10 GPIO_OSPEEDR_OSPEEDR10
  1255. #define GPIO_OSPEEDER_OSPEEDR10_0 GPIO_OSPEEDR_OSPEEDR10_0
  1256. #define GPIO_OSPEEDER_OSPEEDR10_1 GPIO_OSPEEDR_OSPEEDR10_1
  1257. #define GPIO_OSPEEDER_OSPEEDR11 GPIO_OSPEEDR_OSPEEDR11
  1258. #define GPIO_OSPEEDER_OSPEEDR11_0 GPIO_OSPEEDR_OSPEEDR11_0
  1259. #define GPIO_OSPEEDER_OSPEEDR11_1 GPIO_OSPEEDR_OSPEEDR11_1
  1260. #define GPIO_OSPEEDER_OSPEEDR12 GPIO_OSPEEDR_OSPEEDR12
  1261. #define GPIO_OSPEEDER_OSPEEDR12_0 GPIO_OSPEEDR_OSPEEDR12_0
  1262. #define GPIO_OSPEEDER_OSPEEDR12_1 GPIO_OSPEEDR_OSPEEDR12_1
  1263. #define GPIO_OSPEEDER_OSPEEDR13 GPIO_OSPEEDR_OSPEEDR13
  1264. #define GPIO_OSPEEDER_OSPEEDR13_0 GPIO_OSPEEDR_OSPEEDR13_0
  1265. #define GPIO_OSPEEDER_OSPEEDR13_1 GPIO_OSPEEDR_OSPEEDR13_1
  1266. #define GPIO_OSPEEDER_OSPEEDR14 GPIO_OSPEEDR_OSPEEDR14
  1267. #define GPIO_OSPEEDER_OSPEEDR14_0 GPIO_OSPEEDR_OSPEEDR14_0
  1268. #define GPIO_OSPEEDER_OSPEEDR14_1 GPIO_OSPEEDR_OSPEEDR14_1
  1269. #define GPIO_OSPEEDER_OSPEEDR15 GPIO_OSPEEDR_OSPEEDR15
  1270. #define GPIO_OSPEEDER_OSPEEDR15_0 GPIO_OSPEEDR_OSPEEDR15_0
  1271. #define GPIO_OSPEEDER_OSPEEDR15_1 GPIO_OSPEEDR_OSPEEDR15_1
  1272. /******************* Bit definition for GPIO_PUPDR register ******************/
  1273. #define GPIO_PUPDR_PUPDR0 ((uint32_t)0x00000003U)
  1274. #define GPIO_PUPDR_PUPDR0_0 ((uint32_t)0x00000001U)
  1275. #define GPIO_PUPDR_PUPDR0_1 ((uint32_t)0x00000002U)
  1276. #define GPIO_PUPDR_PUPDR1 ((uint32_t)0x0000000CU)
  1277. #define GPIO_PUPDR_PUPDR1_0 ((uint32_t)0x00000004U)
  1278. #define GPIO_PUPDR_PUPDR1_1 ((uint32_t)0x00000008U)
  1279. #define GPIO_PUPDR_PUPDR2 ((uint32_t)0x00000030U)
  1280. #define GPIO_PUPDR_PUPDR2_0 ((uint32_t)0x00000010U)
  1281. #define GPIO_PUPDR_PUPDR2_1 ((uint32_t)0x00000020U)
  1282. #define GPIO_PUPDR_PUPDR3 ((uint32_t)0x000000C0U)
  1283. #define GPIO_PUPDR_PUPDR3_0 ((uint32_t)0x00000040U)
  1284. #define GPIO_PUPDR_PUPDR3_1 ((uint32_t)0x00000080U)
  1285. #define GPIO_PUPDR_PUPDR4 ((uint32_t)0x00000300U)
  1286. #define GPIO_PUPDR_PUPDR4_0 ((uint32_t)0x00000100U)
  1287. #define GPIO_PUPDR_PUPDR4_1 ((uint32_t)0x00000200U)
  1288. #define GPIO_PUPDR_PUPDR5 ((uint32_t)0x00000C00U)
  1289. #define GPIO_PUPDR_PUPDR5_0 ((uint32_t)0x00000400U)
  1290. #define GPIO_PUPDR_PUPDR5_1 ((uint32_t)0x00000800U)
  1291. #define GPIO_PUPDR_PUPDR6 ((uint32_t)0x00003000U)
  1292. #define GPIO_PUPDR_PUPDR6_0 ((uint32_t)0x00001000U)
  1293. #define GPIO_PUPDR_PUPDR6_1 ((uint32_t)0x00002000U)
  1294. #define GPIO_PUPDR_PUPDR7 ((uint32_t)0x0000C000U)
  1295. #define GPIO_PUPDR_PUPDR7_0 ((uint32_t)0x00004000U)
  1296. #define GPIO_PUPDR_PUPDR7_1 ((uint32_t)0x00008000U)
  1297. #define GPIO_PUPDR_PUPDR8 ((uint32_t)0x00030000U)
  1298. #define GPIO_PUPDR_PUPDR8_0 ((uint32_t)0x00010000U)
  1299. #define GPIO_PUPDR_PUPDR8_1 ((uint32_t)0x00020000U)
  1300. #define GPIO_PUPDR_PUPDR9 ((uint32_t)0x000C0000U)
  1301. #define GPIO_PUPDR_PUPDR9_0 ((uint32_t)0x00040000U)
  1302. #define GPIO_PUPDR_PUPDR9_1 ((uint32_t)0x00080000U)
  1303. #define GPIO_PUPDR_PUPDR10 ((uint32_t)0x00300000U)
  1304. #define GPIO_PUPDR_PUPDR10_0 ((uint32_t)0x00100000U)
  1305. #define GPIO_PUPDR_PUPDR10_1 ((uint32_t)0x00200000U)
  1306. #define GPIO_PUPDR_PUPDR11 ((uint32_t)0x00C00000U)
  1307. #define GPIO_PUPDR_PUPDR11_0 ((uint32_t)0x00400000U)
  1308. #define GPIO_PUPDR_PUPDR11_1 ((uint32_t)0x00800000U)
  1309. #define GPIO_PUPDR_PUPDR12 ((uint32_t)0x03000000U)
  1310. #define GPIO_PUPDR_PUPDR12_0 ((uint32_t)0x01000000U)
  1311. #define GPIO_PUPDR_PUPDR12_1 ((uint32_t)0x02000000U)
  1312. #define GPIO_PUPDR_PUPDR13 ((uint32_t)0x0C000000U)
  1313. #define GPIO_PUPDR_PUPDR13_0 ((uint32_t)0x04000000U)
  1314. #define GPIO_PUPDR_PUPDR13_1 ((uint32_t)0x08000000U)
  1315. #define GPIO_PUPDR_PUPDR14 ((uint32_t)0x30000000U)
  1316. #define GPIO_PUPDR_PUPDR14_0 ((uint32_t)0x10000000U)
  1317. #define GPIO_PUPDR_PUPDR14_1 ((uint32_t)0x20000000U)
  1318. #define GPIO_PUPDR_PUPDR15 ((uint32_t)0xC0000000U)
  1319. #define GPIO_PUPDR_PUPDR15_0 ((uint32_t)0x40000000U)
  1320. #define GPIO_PUPDR_PUPDR15_1 ((uint32_t)0x80000000U)
  1321. /******************* Bit definition for GPIO_IDR register *******************/
  1322. #define GPIO_IDR_0 ((uint32_t)0x00000001U)
  1323. #define GPIO_IDR_1 ((uint32_t)0x00000002U)
  1324. #define GPIO_IDR_2 ((uint32_t)0x00000004U)
  1325. #define GPIO_IDR_3 ((uint32_t)0x00000008U)
  1326. #define GPIO_IDR_4 ((uint32_t)0x00000010U)
  1327. #define GPIO_IDR_5 ((uint32_t)0x00000020U)
  1328. #define GPIO_IDR_6 ((uint32_t)0x00000040U)
  1329. #define GPIO_IDR_7 ((uint32_t)0x00000080U)
  1330. #define GPIO_IDR_8 ((uint32_t)0x00000100U)
  1331. #define GPIO_IDR_9 ((uint32_t)0x00000200U)
  1332. #define GPIO_IDR_10 ((uint32_t)0x00000400U)
  1333. #define GPIO_IDR_11 ((uint32_t)0x00000800U)
  1334. #define GPIO_IDR_12 ((uint32_t)0x00001000U)
  1335. #define GPIO_IDR_13 ((uint32_t)0x00002000U)
  1336. #define GPIO_IDR_14 ((uint32_t)0x00004000U)
  1337. #define GPIO_IDR_15 ((uint32_t)0x00008000U)
  1338. /****************** Bit definition for GPIO_ODR register ********************/
  1339. #define GPIO_ODR_0 ((uint32_t)0x00000001U)
  1340. #define GPIO_ODR_1 ((uint32_t)0x00000002U)
  1341. #define GPIO_ODR_2 ((uint32_t)0x00000004U)
  1342. #define GPIO_ODR_3 ((uint32_t)0x00000008U)
  1343. #define GPIO_ODR_4 ((uint32_t)0x00000010U)
  1344. #define GPIO_ODR_5 ((uint32_t)0x00000020U)
  1345. #define GPIO_ODR_6 ((uint32_t)0x00000040U)
  1346. #define GPIO_ODR_7 ((uint32_t)0x00000080U)
  1347. #define GPIO_ODR_8 ((uint32_t)0x00000100U)
  1348. #define GPIO_ODR_9 ((uint32_t)0x00000200U)
  1349. #define GPIO_ODR_10 ((uint32_t)0x00000400U)
  1350. #define GPIO_ODR_11 ((uint32_t)0x00000800U)
  1351. #define GPIO_ODR_12 ((uint32_t)0x00001000U)
  1352. #define GPIO_ODR_13 ((uint32_t)0x00002000U)
  1353. #define GPIO_ODR_14 ((uint32_t)0x00004000U)
  1354. #define GPIO_ODR_15 ((uint32_t)0x00008000U)
  1355. /****************** Bit definition for GPIO_BSRR register ********************/
  1356. #define GPIO_BSRR_BS_0 ((uint32_t)0x00000001U)
  1357. #define GPIO_BSRR_BS_1 ((uint32_t)0x00000002U)
  1358. #define GPIO_BSRR_BS_2 ((uint32_t)0x00000004U)
  1359. #define GPIO_BSRR_BS_3 ((uint32_t)0x00000008U)
  1360. #define GPIO_BSRR_BS_4 ((uint32_t)0x00000010U)
  1361. #define GPIO_BSRR_BS_5 ((uint32_t)0x00000020U)
  1362. #define GPIO_BSRR_BS_6 ((uint32_t)0x00000040U)
  1363. #define GPIO_BSRR_BS_7 ((uint32_t)0x00000080U)
  1364. #define GPIO_BSRR_BS_8 ((uint32_t)0x00000100U)
  1365. #define GPIO_BSRR_BS_9 ((uint32_t)0x00000200U)
  1366. #define GPIO_BSRR_BS_10 ((uint32_t)0x00000400U)
  1367. #define GPIO_BSRR_BS_11 ((uint32_t)0x00000800U)
  1368. #define GPIO_BSRR_BS_12 ((uint32_t)0x00001000U)
  1369. #define GPIO_BSRR_BS_13 ((uint32_t)0x00002000U)
  1370. #define GPIO_BSRR_BS_14 ((uint32_t)0x00004000U)
  1371. #define GPIO_BSRR_BS_15 ((uint32_t)0x00008000U)
  1372. #define GPIO_BSRR_BR_0 ((uint32_t)0x00010000U)
  1373. #define GPIO_BSRR_BR_1 ((uint32_t)0x00020000U)
  1374. #define GPIO_BSRR_BR_2 ((uint32_t)0x00040000U)
  1375. #define GPIO_BSRR_BR_3 ((uint32_t)0x00080000U)
  1376. #define GPIO_BSRR_BR_4 ((uint32_t)0x00100000U)
  1377. #define GPIO_BSRR_BR_5 ((uint32_t)0x00200000U)
  1378. #define GPIO_BSRR_BR_6 ((uint32_t)0x00400000U)
  1379. #define GPIO_BSRR_BR_7 ((uint32_t)0x00800000U)
  1380. #define GPIO_BSRR_BR_8 ((uint32_t)0x01000000U)
  1381. #define GPIO_BSRR_BR_9 ((uint32_t)0x02000000U)
  1382. #define GPIO_BSRR_BR_10 ((uint32_t)0x04000000U)
  1383. #define GPIO_BSRR_BR_11 ((uint32_t)0x08000000U)
  1384. #define GPIO_BSRR_BR_12 ((uint32_t)0x10000000U)
  1385. #define GPIO_BSRR_BR_13 ((uint32_t)0x20000000U)
  1386. #define GPIO_BSRR_BR_14 ((uint32_t)0x40000000U)
  1387. #define GPIO_BSRR_BR_15 ((uint32_t)0x80000000U)
  1388. /****************** Bit definition for GPIO_LCKR register ********************/
  1389. #define GPIO_LCKR_LCK0 ((uint32_t)0x00000001U)
  1390. #define GPIO_LCKR_LCK1 ((uint32_t)0x00000002U)
  1391. #define GPIO_LCKR_LCK2 ((uint32_t)0x00000004U)
  1392. #define GPIO_LCKR_LCK3 ((uint32_t)0x00000008U)
  1393. #define GPIO_LCKR_LCK4 ((uint32_t)0x00000010U)
  1394. #define GPIO_LCKR_LCK5 ((uint32_t)0x00000020U)
  1395. #define GPIO_LCKR_LCK6 ((uint32_t)0x00000040U)
  1396. #define GPIO_LCKR_LCK7 ((uint32_t)0x00000080U)
  1397. #define GPIO_LCKR_LCK8 ((uint32_t)0x00000100U)
  1398. #define GPIO_LCKR_LCK9 ((uint32_t)0x00000200U)
  1399. #define GPIO_LCKR_LCK10 ((uint32_t)0x00000400U)
  1400. #define GPIO_LCKR_LCK11 ((uint32_t)0x00000800U)
  1401. #define GPIO_LCKR_LCK12 ((uint32_t)0x00001000U)
  1402. #define GPIO_LCKR_LCK13 ((uint32_t)0x00002000U)
  1403. #define GPIO_LCKR_LCK14 ((uint32_t)0x00004000U)
  1404. #define GPIO_LCKR_LCK15 ((uint32_t)0x00008000U)
  1405. #define GPIO_LCKR_LCKK ((uint32_t)0x00010000U)
  1406. /****************** Bit definition for GPIO_AFRL register ********************/
  1407. #define GPIO_AFRL_AFRL0 ((uint32_t)0x0000000FU)
  1408. #define GPIO_AFRL_AFRL1 ((uint32_t)0x000000F0U)
  1409. #define GPIO_AFRL_AFRL2 ((uint32_t)0x00000F00U)
  1410. #define GPIO_AFRL_AFRL3 ((uint32_t)0x0000F000U)
  1411. #define GPIO_AFRL_AFRL4 ((uint32_t)0x000F0000U)
  1412. #define GPIO_AFRL_AFRL5 ((uint32_t)0x00F00000U)
  1413. #define GPIO_AFRL_AFRL6 ((uint32_t)0x0F000000U)
  1414. #define GPIO_AFRL_AFRL7 ((uint32_t)0xF0000000U)
  1415. /****************** Bit definition for GPIO_AFRH register ********************/
  1416. #define GPIO_AFRH_AFRH0 ((uint32_t)0x0000000FU)
  1417. #define GPIO_AFRH_AFRH1 ((uint32_t)0x000000F0U)
  1418. #define GPIO_AFRH_AFRH2 ((uint32_t)0x00000F00U)
  1419. #define GPIO_AFRH_AFRH3 ((uint32_t)0x0000F000U)
  1420. #define GPIO_AFRH_AFRH4 ((uint32_t)0x000F0000U)
  1421. #define GPIO_AFRH_AFRH5 ((uint32_t)0x00F00000U)
  1422. #define GPIO_AFRH_AFRH6 ((uint32_t)0x0F000000U)
  1423. #define GPIO_AFRH_AFRH7 ((uint32_t)0xF0000000U)
  1424. /****************** Bit definition for GPIO_BRR register *********************/
  1425. #define GPIO_BRR_BR_0 ((uint32_t)0x00000001U)
  1426. #define GPIO_BRR_BR_1 ((uint32_t)0x00000002U)
  1427. #define GPIO_BRR_BR_2 ((uint32_t)0x00000004U)
  1428. #define GPIO_BRR_BR_3 ((uint32_t)0x00000008U)
  1429. #define GPIO_BRR_BR_4 ((uint32_t)0x00000010U)
  1430. #define GPIO_BRR_BR_5 ((uint32_t)0x00000020U)
  1431. #define GPIO_BRR_BR_6 ((uint32_t)0x00000040U)
  1432. #define GPIO_BRR_BR_7 ((uint32_t)0x00000080U)
  1433. #define GPIO_BRR_BR_8 ((uint32_t)0x00000100U)
  1434. #define GPIO_BRR_BR_9 ((uint32_t)0x00000200U)
  1435. #define GPIO_BRR_BR_10 ((uint32_t)0x00000400U)
  1436. #define GPIO_BRR_BR_11 ((uint32_t)0x00000800U)
  1437. #define GPIO_BRR_BR_12 ((uint32_t)0x00001000U)
  1438. #define GPIO_BRR_BR_13 ((uint32_t)0x00002000U)
  1439. #define GPIO_BRR_BR_14 ((uint32_t)0x00004000U)
  1440. #define GPIO_BRR_BR_15 ((uint32_t)0x00008000U)
  1441. /******************************************************************************/
  1442. /* */
  1443. /* Inter-integrated Circuit Interface (I2C) */
  1444. /* */
  1445. /******************************************************************************/
  1446. /******************* Bit definition for I2C_CR1 register *******************/
  1447. #define I2C_CR1_PE ((uint32_t)0x00000001U) /*!< Peripheral enable */
  1448. #define I2C_CR1_TXIE ((uint32_t)0x00000002U) /*!< TX interrupt enable */
  1449. #define I2C_CR1_RXIE ((uint32_t)0x00000004U) /*!< RX interrupt enable */
  1450. #define I2C_CR1_ADDRIE ((uint32_t)0x00000008U) /*!< Address match interrupt enable */
  1451. #define I2C_CR1_NACKIE ((uint32_t)0x00000010U) /*!< NACK received interrupt enable */
  1452. #define I2C_CR1_STOPIE ((uint32_t)0x00000020U) /*!< STOP detection interrupt enable */
  1453. #define I2C_CR1_TCIE ((uint32_t)0x00000040U) /*!< Transfer complete interrupt enable */
  1454. #define I2C_CR1_ERRIE ((uint32_t)0x00000080U) /*!< Errors interrupt enable */
  1455. #define I2C_CR1_DNF ((uint32_t)0x00000F00U) /*!< Digital noise filter */
  1456. #define I2C_CR1_ANFOFF ((uint32_t)0x00001000U) /*!< Analog noise filter OFF */
  1457. #define I2C_CR1_SWRST ((uint32_t)0x00002000U) /*!< Software reset */
  1458. #define I2C_CR1_TXDMAEN ((uint32_t)0x00004000U) /*!< DMA transmission requests enable */
  1459. #define I2C_CR1_RXDMAEN ((uint32_t)0x00008000U) /*!< DMA reception requests enable */
  1460. #define I2C_CR1_SBC ((uint32_t)0x00010000U) /*!< Slave byte control */
  1461. #define I2C_CR1_NOSTRETCH ((uint32_t)0x00020000U) /*!< Clock stretching disable */
  1462. #define I2C_CR1_GCEN ((uint32_t)0x00080000U) /*!< General call enable */
  1463. #define I2C_CR1_SMBHEN ((uint32_t)0x00100000U) /*!< SMBus host address enable */
  1464. #define I2C_CR1_SMBDEN ((uint32_t)0x00200000U) /*!< SMBus device default address enable */
  1465. #define I2C_CR1_ALERTEN ((uint32_t)0x00400000U) /*!< SMBus alert enable */
  1466. #define I2C_CR1_PECEN ((uint32_t)0x00800000U) /*!< PEC enable */
  1467. /****************** Bit definition for I2C_CR2 register ********************/
  1468. #define I2C_CR2_SADD ((uint32_t)0x000003FFU) /*!< Slave address (master mode) */
  1469. #define I2C_CR2_RD_WRN ((uint32_t)0x00000400U) /*!< Transfer direction (master mode) */
  1470. #define I2C_CR2_ADD10 ((uint32_t)0x00000800U) /*!< 10-bit addressing mode (master mode) */
  1471. #define I2C_CR2_HEAD10R ((uint32_t)0x00001000U) /*!< 10-bit address header only read direction (master mode) */
  1472. #define I2C_CR2_START ((uint32_t)0x00002000U) /*!< START generation */
  1473. #define I2C_CR2_STOP ((uint32_t)0x00004000U) /*!< STOP generation (master mode) */
  1474. #define I2C_CR2_NACK ((uint32_t)0x00008000U) /*!< NACK generation (slave mode) */
  1475. #define I2C_CR2_NBYTES ((uint32_t)0x00FF0000U) /*!< Number of bytes */
  1476. #define I2C_CR2_RELOAD ((uint32_t)0x01000000U) /*!< NBYTES reload mode */
  1477. #define I2C_CR2_AUTOEND ((uint32_t)0x02000000U) /*!< Automatic end mode (master mode) */
  1478. #define I2C_CR2_PECBYTE ((uint32_t)0x04000000U) /*!< Packet error checking byte */
  1479. /******************* Bit definition for I2C_OAR1 register ******************/
  1480. #define I2C_OAR1_OA1 ((uint32_t)0x000003FFU) /*!< Interface own address 1 */
  1481. #define I2C_OAR1_OA1MODE ((uint32_t)0x00000400U) /*!< Own address 1 10-bit mode */
  1482. #define I2C_OAR1_OA1EN ((uint32_t)0x00008000U) /*!< Own address 1 enable */
  1483. /******************* Bit definition for I2C_OAR2 register ******************/
  1484. #define I2C_OAR2_OA2 ((uint32_t)0x000000FEU) /*!< Interface own address 2 */
  1485. #define I2C_OAR2_OA2MSK ((uint32_t)0x00000700U) /*!< Own address 2 masks */
  1486. #define I2C_OAR2_OA2NOMASK ((uint32_t)0x00000000U) /*!< No mask */
  1487. #define I2C_OAR2_OA2MASK01 ((uint32_t)0x00000100U) /*!< OA2[1] is masked, Only OA2[7:2] are compared */
  1488. #define I2C_OAR2_OA2MASK02 ((uint32_t)0x00000200U) /*!< OA2[2:1] is masked, Only OA2[7:3] are compared */
  1489. #define I2C_OAR2_OA2MASK03 ((uint32_t)0x00000300U) /*!< OA2[3:1] is masked, Only OA2[7:4] are compared */
  1490. #define I2C_OAR2_OA2MASK04 ((uint32_t)0x00000400U) /*!< OA2[4:1] is masked, Only OA2[7:5] are compared */
  1491. #define I2C_OAR2_OA2MASK05 ((uint32_t)0x00000500U) /*!< OA2[5:1] is masked, Only OA2[7:6] are compared */
  1492. #define I2C_OAR2_OA2MASK06 ((uint32_t)0x00000600U) /*!< OA2[6:1] is masked, Only OA2[7] are compared */
  1493. #define I2C_OAR2_OA2MASK07 ((uint32_t)0x00000700U) /*!< OA2[7:1] is masked, No comparison is done */
  1494. #define I2C_OAR2_OA2EN ((uint32_t)0x00008000U) /*!< Own address 2 enable */
  1495. /******************* Bit definition for I2C_TIMINGR register ****************/
  1496. #define I2C_TIMINGR_SCLL ((uint32_t)0x000000FFU) /*!< SCL low period (master mode) */
  1497. #define I2C_TIMINGR_SCLH ((uint32_t)0x0000FF00U) /*!< SCL high period (master mode) */
  1498. #define I2C_TIMINGR_SDADEL ((uint32_t)0x000F0000U) /*!< Data hold time */
  1499. #define I2C_TIMINGR_SCLDEL ((uint32_t)0x00F00000U) /*!< Data setup time */
  1500. #define I2C_TIMINGR_PRESC ((uint32_t)0xF0000000U) /*!< Timings prescaler */
  1501. /******************* Bit definition for I2C_TIMEOUTR register ****************/
  1502. #define I2C_TIMEOUTR_TIMEOUTA ((uint32_t)0x00000FFFU) /*!< Bus timeout A */
  1503. #define I2C_TIMEOUTR_TIDLE ((uint32_t)0x00001000U) /*!< Idle clock timeout detection */
  1504. #define I2C_TIMEOUTR_TIMOUTEN ((uint32_t)0x00008000U) /*!< Clock timeout enable */
  1505. #define I2C_TIMEOUTR_TIMEOUTB ((uint32_t)0x0FFF0000U) /*!< Bus timeout B*/
  1506. #define I2C_TIMEOUTR_TEXTEN ((uint32_t)0x80000000U) /*!< Extended clock timeout enable */
  1507. /****************** Bit definition for I2C_ISR register ********************/
  1508. #define I2C_ISR_TXE ((uint32_t)0x00000001U) /*!< Transmit data register empty */
  1509. #define I2C_ISR_TXIS ((uint32_t)0x00000002U) /*!< Transmit interrupt status */
  1510. #define I2C_ISR_RXNE ((uint32_t)0x00000004U) /*!< Receive data register not empty */
  1511. #define I2C_ISR_ADDR ((uint32_t)0x00000008U) /*!< Address matched (slave mode)*/
  1512. #define I2C_ISR_NACKF ((uint32_t)0x00000010U) /*!< NACK received flag */
  1513. #define I2C_ISR_STOPF ((uint32_t)0x00000020U) /*!< STOP detection flag */
  1514. #define I2C_ISR_TC ((uint32_t)0x00000040U) /*!< Transfer complete (master mode) */
  1515. #define I2C_ISR_TCR ((uint32_t)0x00000080U) /*!< Transfer complete reload */
  1516. #define I2C_ISR_BERR ((uint32_t)0x00000100U) /*!< Bus error */
  1517. #define I2C_ISR_ARLO ((uint32_t)0x00000200U) /*!< Arbitration lost */
  1518. #define I2C_ISR_OVR ((uint32_t)0x00000400U) /*!< Overrun/Underrun */
  1519. #define I2C_ISR_PECERR ((uint32_t)0x00000800U) /*!< PEC error in reception */
  1520. #define I2C_ISR_TIMEOUT ((uint32_t)0x00001000U) /*!< Timeout or Tlow detection flag */
  1521. #define I2C_ISR_ALERT ((uint32_t)0x00002000U) /*!< SMBus alert */
  1522. #define I2C_ISR_BUSY ((uint32_t)0x00008000U) /*!< Bus busy */
  1523. #define I2C_ISR_DIR ((uint32_t)0x00010000U) /*!< Transfer direction (slave mode) */
  1524. #define I2C_ISR_ADDCODE ((uint32_t)0x00FE0000U) /*!< Address match code (slave mode) */
  1525. /****************** Bit definition for I2C_ICR register ********************/
  1526. #define I2C_ICR_ADDRCF ((uint32_t)0x00000008U) /*!< Address matched clear flag */
  1527. #define I2C_ICR_NACKCF ((uint32_t)0x00000010U) /*!< NACK clear flag */
  1528. #define I2C_ICR_STOPCF ((uint32_t)0x00000020U) /*!< STOP detection clear flag */
  1529. #define I2C_ICR_BERRCF ((uint32_t)0x00000100U) /*!< Bus error clear flag */
  1530. #define I2C_ICR_ARLOCF ((uint32_t)0x00000200U) /*!< Arbitration lost clear flag */
  1531. #define I2C_ICR_OVRCF ((uint32_t)0x00000400U) /*!< Overrun/Underrun clear flag */
  1532. #define I2C_ICR_PECCF ((uint32_t)0x00000800U) /*!< PAC error clear flag */
  1533. #define I2C_ICR_TIMOUTCF ((uint32_t)0x00001000U) /*!< Timeout clear flag */
  1534. #define I2C_ICR_ALERTCF ((uint32_t)0x00002000U) /*!< Alert clear flag */
  1535. /****************** Bit definition for I2C_PECR register *******************/
  1536. #define I2C_PECR_PEC ((uint32_t)0x000000FFU) /*!< PEC register */
  1537. /****************** Bit definition for I2C_RXDR register *********************/
  1538. #define I2C_RXDR_RXDATA ((uint32_t)0x000000FFU) /*!< 8-bit receive data */
  1539. /****************** Bit definition for I2C_TXDR register *******************/
  1540. #define I2C_TXDR_TXDATA ((uint32_t)0x000000FFU) /*!< 8-bit transmit data */
  1541. /*****************************************************************************/
  1542. /* */
  1543. /* Independent WATCHDOG (IWDG) */
  1544. /* */
  1545. /*****************************************************************************/
  1546. /******************* Bit definition for IWDG_KR register *******************/
  1547. #define IWDG_KR_KEY ((uint32_t)0xFFFF) /*!< Key value (write only, read 0000h) */
  1548. /******************* Bit definition for IWDG_PR register *******************/
  1549. #define IWDG_PR_PR ((uint32_t)0x07) /*!< PR[2:0] (Prescaler divider) */
  1550. #define IWDG_PR_PR_0 ((uint32_t)0x01) /*!< Bit 0 */
  1551. #define IWDG_PR_PR_1 ((uint32_t)0x02) /*!< Bit 1 */
  1552. #define IWDG_PR_PR_2 ((uint32_t)0x04) /*!< Bit 2 */
  1553. /******************* Bit definition for IWDG_RLR register ******************/
  1554. #define IWDG_RLR_RL ((uint32_t)0x0FFF) /*!< Watchdog counter reload value */
  1555. /******************* Bit definition for IWDG_SR register *******************/
  1556. #define IWDG_SR_PVU ((uint32_t)0x01) /*!< Watchdog prescaler value update */
  1557. #define IWDG_SR_RVU ((uint32_t)0x02) /*!< Watchdog counter reload value update */
  1558. #define IWDG_SR_WVU ((uint32_t)0x04) /*!< Watchdog counter window value update */
  1559. /******************* Bit definition for IWDG_KR register *******************/
  1560. #define IWDG_WINR_WIN ((uint32_t)0x0FFF) /*!< Watchdog counter window value */
  1561. /*****************************************************************************/
  1562. /* */
  1563. /* Power Control (PWR) */
  1564. /* */
  1565. /*****************************************************************************/
  1566. /* Note: No specific macro feature on this device */
  1567. /******************** Bit definition for PWR_CR register *******************/
  1568. #define PWR_CR_LPDS ((uint32_t)0x00000001U) /*!< Low-power Deepsleep */
  1569. #define PWR_CR_PDDS ((uint32_t)0x00000002U) /*!< Power Down Deepsleep */
  1570. #define PWR_CR_CWUF ((uint32_t)0x00000004U) /*!< Clear Wakeup Flag */
  1571. #define PWR_CR_CSBF ((uint32_t)0x00000008U) /*!< Clear Standby Flag */
  1572. #define PWR_CR_DBP ((uint32_t)0x00000100U) /*!< Disable Backup Domain write protection */
  1573. /******************* Bit definition for PWR_CSR register *******************/
  1574. #define PWR_CSR_WUF ((uint32_t)0x00000001U) /*!< Wakeup Flag */
  1575. #define PWR_CSR_SBF ((uint32_t)0x00000002U) /*!< Standby Flag */
  1576. #define PWR_CSR_EWUP1 ((uint32_t)0x00000100U) /*!< Enable WKUP pin 1 */
  1577. #define PWR_CSR_EWUP2 ((uint32_t)0x00000200U) /*!< Enable WKUP pin 2 */
  1578. /*****************************************************************************/
  1579. /* */
  1580. /* Reset and Clock Control */
  1581. /* */
  1582. /*****************************************************************************/
  1583. /*
  1584. * @brief Specific device feature definitions (not present on all devices in the STM32F0 family)
  1585. */
  1586. /******************** Bit definition for RCC_CR register *******************/
  1587. #define RCC_CR_HSION ((uint32_t)0x00000001U) /*!< Internal High Speed clock enable */
  1588. #define RCC_CR_HSIRDY ((uint32_t)0x00000002U) /*!< Internal High Speed clock ready flag */
  1589. #define RCC_CR_HSITRIM ((uint32_t)0x000000F8U) /*!< Internal High Speed clock trimming */
  1590. #define RCC_CR_HSITRIM_0 ((uint32_t)0x00000008U) /*!<Bit 0 */
  1591. #define RCC_CR_HSITRIM_1 ((uint32_t)0x00000010U) /*!<Bit 1 */
  1592. #define RCC_CR_HSITRIM_2 ((uint32_t)0x00000020U) /*!<Bit 2 */
  1593. #define RCC_CR_HSITRIM_3 ((uint32_t)0x00000040U) /*!<Bit 3 */
  1594. #define RCC_CR_HSITRIM_4 ((uint32_t)0x00000080U) /*!<Bit 4 */
  1595. #define RCC_CR_HSICAL ((uint32_t)0x0000FF00U) /*!< Internal High Speed clock Calibration */
  1596. #define RCC_CR_HSICAL_0 ((uint32_t)0x00000100U) /*!<Bit 0 */
  1597. #define RCC_CR_HSICAL_1 ((uint32_t)0x00000200U) /*!<Bit 1 */
  1598. #define RCC_CR_HSICAL_2 ((uint32_t)0x00000400U) /*!<Bit 2 */
  1599. #define RCC_CR_HSICAL_3 ((uint32_t)0x00000800U) /*!<Bit 3 */
  1600. #define RCC_CR_HSICAL_4 ((uint32_t)0x00001000U) /*!<Bit 4 */
  1601. #define RCC_CR_HSICAL_5 ((uint32_t)0x00002000U) /*!<Bit 5 */
  1602. #define RCC_CR_HSICAL_6 ((uint32_t)0x00004000U) /*!<Bit 6 */
  1603. #define RCC_CR_HSICAL_7 ((uint32_t)0x00008000U) /*!<Bit 7 */
  1604. #define RCC_CR_HSEON ((uint32_t)0x00010000U) /*!< External High Speed clock enable */
  1605. #define RCC_CR_HSERDY ((uint32_t)0x00020000U) /*!< External High Speed clock ready flag */
  1606. #define RCC_CR_HSEBYP ((uint32_t)0x00040000U) /*!< External High Speed clock Bypass */
  1607. #define RCC_CR_CSSON ((uint32_t)0x00080000U) /*!< Clock Security System enable */
  1608. #define RCC_CR_PLLON ((uint32_t)0x01000000U) /*!< PLL enable */
  1609. #define RCC_CR_PLLRDY ((uint32_t)0x02000000U) /*!< PLL clock ready flag */
  1610. /******************** Bit definition for RCC_CFGR register *****************/
  1611. /*!< SW configuration */
  1612. #define RCC_CFGR_SW ((uint32_t)0x00000003U) /*!< SW[1:0] bits (System clock Switch) */
  1613. #define RCC_CFGR_SW_0 ((uint32_t)0x00000001U) /*!< Bit 0 */
  1614. #define RCC_CFGR_SW_1 ((uint32_t)0x00000002U) /*!< Bit 1 */
  1615. #define RCC_CFGR_SW_HSI ((uint32_t)0x00000000U) /*!< HSI selected as system clock */
  1616. #define RCC_CFGR_SW_HSE ((uint32_t)0x00000001U) /*!< HSE selected as system clock */
  1617. #define RCC_CFGR_SW_PLL ((uint32_t)0x00000002U) /*!< PLL selected as system clock */
  1618. /*!< SWS configuration */
  1619. #define RCC_CFGR_SWS ((uint32_t)0x0000000CU) /*!< SWS[1:0] bits (System Clock Switch Status) */
  1620. #define RCC_CFGR_SWS_0 ((uint32_t)0x00000004U) /*!< Bit 0 */
  1621. #define RCC_CFGR_SWS_1 ((uint32_t)0x00000008U) /*!< Bit 1 */
  1622. #define RCC_CFGR_SWS_HSI ((uint32_t)0x00000000U) /*!< HSI oscillator used as system clock */
  1623. #define RCC_CFGR_SWS_HSE ((uint32_t)0x00000004U) /*!< HSE oscillator used as system clock */
  1624. #define RCC_CFGR_SWS_PLL ((uint32_t)0x00000008U) /*!< PLL used as system clock */
  1625. /*!< HPRE configuration */
  1626. #define RCC_CFGR_HPRE ((uint32_t)0x000000F0U) /*!< HPRE[3:0] bits (AHB prescaler) */
  1627. #define RCC_CFGR_HPRE_0 ((uint32_t)0x00000010U) /*!< Bit 0 */
  1628. #define RCC_CFGR_HPRE_1 ((uint32_t)0x00000020U) /*!< Bit 1 */
  1629. #define RCC_CFGR_HPRE_2 ((uint32_t)0x00000040U) /*!< Bit 2 */
  1630. #define RCC_CFGR_HPRE_3 ((uint32_t)0x00000080U) /*!< Bit 3 */
  1631. #define RCC_CFGR_HPRE_DIV1 ((uint32_t)0x00000000U) /*!< SYSCLK not divided */
  1632. #define RCC_CFGR_HPRE_DIV2 ((uint32_t)0x00000080U) /*!< SYSCLK divided by 2 */
  1633. #define RCC_CFGR_HPRE_DIV4 ((uint32_t)0x00000090U) /*!< SYSCLK divided by 4 */
  1634. #define RCC_CFGR_HPRE_DIV8 ((uint32_t)0x000000A0U) /*!< SYSCLK divided by 8 */
  1635. #define RCC_CFGR_HPRE_DIV16 ((uint32_t)0x000000B0U) /*!< SYSCLK divided by 16 */
  1636. #define RCC_CFGR_HPRE_DIV64 ((uint32_t)0x000000C0U) /*!< SYSCLK divided by 64 */
  1637. #define RCC_CFGR_HPRE_DIV128 ((uint32_t)0x000000D0U) /*!< SYSCLK divided by 128 */
  1638. #define RCC_CFGR_HPRE_DIV256 ((uint32_t)0x000000E0U) /*!< SYSCLK divided by 256 */
  1639. #define RCC_CFGR_HPRE_DIV512 ((uint32_t)0x000000F0U) /*!< SYSCLK divided by 512 */
  1640. /*!< PPRE configuration */
  1641. #define RCC_CFGR_PPRE ((uint32_t)0x00000700U) /*!< PRE[2:0] bits (APB prescaler) */
  1642. #define RCC_CFGR_PPRE_0 ((uint32_t)0x00000100U) /*!< Bit 0 */
  1643. #define RCC_CFGR_PPRE_1 ((uint32_t)0x00000200U) /*!< Bit 1 */
  1644. #define RCC_CFGR_PPRE_2 ((uint32_t)0x00000400U) /*!< Bit 2 */
  1645. #define RCC_CFGR_PPRE_DIV1 ((uint32_t)0x00000000U) /*!< HCLK not divided */
  1646. #define RCC_CFGR_PPRE_DIV2 ((uint32_t)0x00000400U) /*!< HCLK divided by 2 */
  1647. #define RCC_CFGR_PPRE_DIV4 ((uint32_t)0x00000500U) /*!< HCLK divided by 4 */
  1648. #define RCC_CFGR_PPRE_DIV8 ((uint32_t)0x00000600U) /*!< HCLK divided by 8 */
  1649. #define RCC_CFGR_PPRE_DIV16 ((uint32_t)0x00000700U) /*!< HCLK divided by 16 */
  1650. /*!< ADCPPRE configuration */
  1651. #define RCC_CFGR_ADCPRE ((uint32_t)0x00004000U) /*!< ADCPRE bit (ADC prescaler) */
  1652. #define RCC_CFGR_ADCPRE_DIV2 ((uint32_t)0x00000000U) /*!< PCLK divided by 2 */
  1653. #define RCC_CFGR_ADCPRE_DIV4 ((uint32_t)0x00004000U) /*!< PCLK divided by 4 */
  1654. #define RCC_CFGR_PLLSRC ((uint32_t)0x00010000U) /*!< PLL entry clock source */
  1655. #define RCC_CFGR_PLLSRC_HSI_DIV2 ((uint32_t)0x00000000U) /*!< HSI clock divided by 2 selected as PLL entry clock source */
  1656. #define RCC_CFGR_PLLSRC_HSE_PREDIV ((uint32_t)0x00010000U) /*!< HSE/PREDIV clock selected as PLL entry clock source */
  1657. #define RCC_CFGR_PLLXTPRE ((uint32_t)0x00020000U) /*!< HSE divider for PLL entry */
  1658. #define RCC_CFGR_PLLXTPRE_HSE_PREDIV_DIV1 ((uint32_t)0x00000000U) /*!< HSE/PREDIV clock not divided for PLL entry */
  1659. #define RCC_CFGR_PLLXTPRE_HSE_PREDIV_DIV2 ((uint32_t)0x00020000U) /*!< HSE/PREDIV clock divided by 2 for PLL entry */
  1660. /*!< PLLMUL configuration */
  1661. #define RCC_CFGR_PLLMUL ((uint32_t)0x003C0000U) /*!< PLLMUL[3:0] bits (PLL multiplication factor) */
  1662. #define RCC_CFGR_PLLMUL_0 ((uint32_t)0x00040000U) /*!< Bit 0 */
  1663. #define RCC_CFGR_PLLMUL_1 ((uint32_t)0x00080000U) /*!< Bit 1 */
  1664. #define RCC_CFGR_PLLMUL_2 ((uint32_t)0x00100000U) /*!< Bit 2 */
  1665. #define RCC_CFGR_PLLMUL_3 ((uint32_t)0x00200000U) /*!< Bit 3 */
  1666. #define RCC_CFGR_PLLMUL2 ((uint32_t)0x00000000U) /*!< PLL input clock*2 */
  1667. #define RCC_CFGR_PLLMUL3 ((uint32_t)0x00040000U) /*!< PLL input clock*3 */
  1668. #define RCC_CFGR_PLLMUL4 ((uint32_t)0x00080000U) /*!< PLL input clock*4 */
  1669. #define RCC_CFGR_PLLMUL5 ((uint32_t)0x000C0000U) /*!< PLL input clock*5 */
  1670. #define RCC_CFGR_PLLMUL6 ((uint32_t)0x00100000U) /*!< PLL input clock*6 */
  1671. #define RCC_CFGR_PLLMUL7 ((uint32_t)0x00140000U) /*!< PLL input clock*7 */
  1672. #define RCC_CFGR_PLLMUL8 ((uint32_t)0x00180000U) /*!< PLL input clock*8 */
  1673. #define RCC_CFGR_PLLMUL9 ((uint32_t)0x001C0000U) /*!< PLL input clock*9 */
  1674. #define RCC_CFGR_PLLMUL10 ((uint32_t)0x00200000U) /*!< PLL input clock10 */
  1675. #define RCC_CFGR_PLLMUL11 ((uint32_t)0x00240000U) /*!< PLL input clock*11 */
  1676. #define RCC_CFGR_PLLMUL12 ((uint32_t)0x00280000U) /*!< PLL input clock*12 */
  1677. #define RCC_CFGR_PLLMUL13 ((uint32_t)0x002C0000U) /*!< PLL input clock*13 */
  1678. #define RCC_CFGR_PLLMUL14 ((uint32_t)0x00300000U) /*!< PLL input clock*14 */
  1679. #define RCC_CFGR_PLLMUL15 ((uint32_t)0x00340000U) /*!< PLL input clock*15 */
  1680. #define RCC_CFGR_PLLMUL16 ((uint32_t)0x00380000U) /*!< PLL input clock*16 */
  1681. /*!< MCO configuration */
  1682. #define RCC_CFGR_MCO ((uint32_t)0x0F000000U) /*!< MCO[3:0] bits (Microcontroller Clock Output) */
  1683. #define RCC_CFGR_MCO_0 ((uint32_t)0x01000000U) /*!< Bit 0 */
  1684. #define RCC_CFGR_MCO_1 ((uint32_t)0x02000000U) /*!< Bit 1 */
  1685. #define RCC_CFGR_MCO_2 ((uint32_t)0x04000000U) /*!< Bit 2 */
  1686. #define RCC_CFGR_MCO_NOCLOCK ((uint32_t)0x00000000U) /*!< No clock */
  1687. #define RCC_CFGR_MCO_HSI14 ((uint32_t)0x01000000U) /*!< HSI14 clock selected as MCO source */
  1688. #define RCC_CFGR_MCO_LSI ((uint32_t)0x02000000U) /*!< LSI clock selected as MCO source */
  1689. #define RCC_CFGR_MCO_LSE ((uint32_t)0x03000000U) /*!< LSE clock selected as MCO source */
  1690. #define RCC_CFGR_MCO_SYSCLK ((uint32_t)0x04000000U) /*!< System clock selected as MCO source */
  1691. #define RCC_CFGR_MCO_HSI ((uint32_t)0x05000000U) /*!< HSI clock selected as MCO source */
  1692. #define RCC_CFGR_MCO_HSE ((uint32_t)0x06000000U) /*!< HSE clock selected as MCO source */
  1693. #define RCC_CFGR_MCO_PLL ((uint32_t)0x07000000U) /*!< PLL clock divided by 2 selected as MCO source */
  1694. /* Reference defines */
  1695. #define RCC_CFGR_MCOSEL RCC_CFGR_MCO
  1696. #define RCC_CFGR_MCOSEL_0 RCC_CFGR_MCO_0
  1697. #define RCC_CFGR_MCOSEL_1 RCC_CFGR_MCO_1
  1698. #define RCC_CFGR_MCOSEL_2 RCC_CFGR_MCO_2
  1699. #define RCC_CFGR_MCOSEL_NOCLOCK RCC_CFGR_MCO_NOCLOCK
  1700. #define RCC_CFGR_MCOSEL_HSI14 RCC_CFGR_MCO_HSI14
  1701. #define RCC_CFGR_MCOSEL_LSI RCC_CFGR_MCO_LSI
  1702. #define RCC_CFGR_MCOSEL_LSE RCC_CFGR_MCO_LSE
  1703. #define RCC_CFGR_MCOSEL_SYSCLK RCC_CFGR_MCO_SYSCLK
  1704. #define RCC_CFGR_MCOSEL_HSI RCC_CFGR_MCO_HSI
  1705. #define RCC_CFGR_MCOSEL_HSE RCC_CFGR_MCO_HSE
  1706. #define RCC_CFGR_MCOSEL_PLL_DIV2 RCC_CFGR_MCO_PLL
  1707. /*!<****************** Bit definition for RCC_CIR register *****************/
  1708. #define RCC_CIR_LSIRDYF ((uint32_t)0x00000001U) /*!< LSI Ready Interrupt flag */
  1709. #define RCC_CIR_LSERDYF ((uint32_t)0x00000002U) /*!< LSE Ready Interrupt flag */
  1710. #define RCC_CIR_HSIRDYF ((uint32_t)0x00000004U) /*!< HSI Ready Interrupt flag */
  1711. #define RCC_CIR_HSERDYF ((uint32_t)0x00000008U) /*!< HSE Ready Interrupt flag */
  1712. #define RCC_CIR_PLLRDYF ((uint32_t)0x00000010U) /*!< PLL Ready Interrupt flag */
  1713. #define RCC_CIR_HSI14RDYF ((uint32_t)0x00000020U) /*!< HSI14 Ready Interrupt flag */
  1714. #define RCC_CIR_CSSF ((uint32_t)0x00000080U) /*!< Clock Security System Interrupt flag */
  1715. #define RCC_CIR_LSIRDYIE ((uint32_t)0x00000100U) /*!< LSI Ready Interrupt Enable */
  1716. #define RCC_CIR_LSERDYIE ((uint32_t)0x00000200U) /*!< LSE Ready Interrupt Enable */
  1717. #define RCC_CIR_HSIRDYIE ((uint32_t)0x00000400U) /*!< HSI Ready Interrupt Enable */
  1718. #define RCC_CIR_HSERDYIE ((uint32_t)0x00000800U) /*!< HSE Ready Interrupt Enable */
  1719. #define RCC_CIR_PLLRDYIE ((uint32_t)0x00001000U) /*!< PLL Ready Interrupt Enable */
  1720. #define RCC_CIR_HSI14RDYIE ((uint32_t)0x00002000U) /*!< HSI14 Ready Interrupt Enable */
  1721. #define RCC_CIR_LSIRDYC ((uint32_t)0x00010000U) /*!< LSI Ready Interrupt Clear */
  1722. #define RCC_CIR_LSERDYC ((uint32_t)0x00020000U) /*!< LSE Ready Interrupt Clear */
  1723. #define RCC_CIR_HSIRDYC ((uint32_t)0x00040000U) /*!< HSI Ready Interrupt Clear */
  1724. #define RCC_CIR_HSERDYC ((uint32_t)0x00080000U) /*!< HSE Ready Interrupt Clear */
  1725. #define RCC_CIR_PLLRDYC ((uint32_t)0x00100000U) /*!< PLL Ready Interrupt Clear */
  1726. #define RCC_CIR_HSI14RDYC ((uint32_t)0x00200000U) /*!< HSI14 Ready Interrupt Clear */
  1727. #define RCC_CIR_CSSC ((uint32_t)0x00800000U) /*!< Clock Security System Interrupt Clear */
  1728. /***************** Bit definition for RCC_APB2RSTR register ****************/
  1729. #define RCC_APB2RSTR_SYSCFGRST ((uint32_t)0x00000001U) /*!< SYSCFG clock reset */
  1730. #define RCC_APB2RSTR_ADCRST ((uint32_t)0x00000200U) /*!< ADC clock reset */
  1731. #define RCC_APB2RSTR_TIM1RST ((uint32_t)0x00000800U) /*!< TIM1 clock reset */
  1732. #define RCC_APB2RSTR_SPI1RST ((uint32_t)0x00001000U) /*!< SPI1 clock reset */
  1733. #define RCC_APB2RSTR_USART1RST ((uint32_t)0x00004000U) /*!< USART1 clock reset */
  1734. #define RCC_APB2RSTR_TIM16RST ((uint32_t)0x00020000U) /*!< TIM16 clock reset */
  1735. #define RCC_APB2RSTR_TIM17RST ((uint32_t)0x00040000U) /*!< TIM17 clock reset */
  1736. #define RCC_APB2RSTR_DBGMCURST ((uint32_t)0x00400000U) /*!< DBGMCU clock reset */
  1737. /*!< Old ADC1 clock reset bit definition maintained for legacy purpose */
  1738. #define RCC_APB2RSTR_ADC1RST RCC_APB2RSTR_ADCRST
  1739. /***************** Bit definition for RCC_APB1RSTR register ****************/
  1740. #define RCC_APB1RSTR_TIM3RST ((uint32_t)0x00000002U) /*!< Timer 3 clock reset */
  1741. #define RCC_APB1RSTR_TIM14RST ((uint32_t)0x00000100U) /*!< Timer 14 clock reset */
  1742. #define RCC_APB1RSTR_WWDGRST ((uint32_t)0x00000800U) /*!< Window Watchdog clock reset */
  1743. #define RCC_APB1RSTR_I2C1RST ((uint32_t)0x00200000U) /*!< I2C 1 clock reset */
  1744. #define RCC_APB1RSTR_PWRRST ((uint32_t)0x10000000U) /*!< PWR clock reset */
  1745. /****************** Bit definition for RCC_AHBENR register *****************/
  1746. #define RCC_AHBENR_DMAEN ((uint32_t)0x00000001U) /*!< DMA1 clock enable */
  1747. #define RCC_AHBENR_SRAMEN ((uint32_t)0x00000004U) /*!< SRAM interface clock enable */
  1748. #define RCC_AHBENR_FLITFEN ((uint32_t)0x00000010U) /*!< FLITF clock enable */
  1749. #define RCC_AHBENR_CRCEN ((uint32_t)0x00000040U) /*!< CRC clock enable */
  1750. #define RCC_AHBENR_GPIOAEN ((uint32_t)0x00020000U) /*!< GPIOA clock enable */
  1751. #define RCC_AHBENR_GPIOBEN ((uint32_t)0x00040000U) /*!< GPIOB clock enable */
  1752. #define RCC_AHBENR_GPIOCEN ((uint32_t)0x00080000U) /*!< GPIOC clock enable */
  1753. #define RCC_AHBENR_GPIODEN ((uint32_t)0x00100000U) /*!< GPIOD clock enable */
  1754. #define RCC_AHBENR_GPIOFEN ((uint32_t)0x00400000U) /*!< GPIOF clock enable */
  1755. /* Old Bit definition maintained for legacy purpose */
  1756. #define RCC_AHBENR_DMA1EN RCC_AHBENR_DMAEN /*!< DMA1 clock enable */
  1757. #define RCC_AHBENR_TSEN RCC_AHBENR_TSCEN /*!< TS clock enable */
  1758. /***************** Bit definition for RCC_APB2ENR register *****************/
  1759. #define RCC_APB2ENR_SYSCFGCOMPEN ((uint32_t)0x00000001U) /*!< SYSCFG and comparator clock enable */
  1760. #define RCC_APB2ENR_ADCEN ((uint32_t)0x00000200U) /*!< ADC1 clock enable */
  1761. #define RCC_APB2ENR_TIM1EN ((uint32_t)0x00000800U) /*!< TIM1 clock enable */
  1762. #define RCC_APB2ENR_SPI1EN ((uint32_t)0x00001000U) /*!< SPI1 clock enable */
  1763. #define RCC_APB2ENR_USART1EN ((uint32_t)0x00004000U) /*!< USART1 clock enable */
  1764. #define RCC_APB2ENR_TIM16EN ((uint32_t)0x00020000U) /*!< TIM16 clock enable */
  1765. #define RCC_APB2ENR_TIM17EN ((uint32_t)0x00040000U) /*!< TIM17 clock enable */
  1766. #define RCC_APB2ENR_DBGMCUEN ((uint32_t)0x00400000U) /*!< DBGMCU clock enable */
  1767. /* Old Bit definition maintained for legacy purpose */
  1768. #define RCC_APB2ENR_SYSCFGEN RCC_APB2ENR_SYSCFGCOMPEN /*!< SYSCFG clock enable */
  1769. #define RCC_APB2ENR_ADC1EN RCC_APB2ENR_ADCEN /*!< ADC1 clock enable */
  1770. /***************** Bit definition for RCC_APB1ENR register *****************/
  1771. #define RCC_APB1ENR_TIM3EN ((uint32_t)0x00000002U) /*!< Timer 3 clock enable */
  1772. #define RCC_APB1ENR_TIM14EN ((uint32_t)0x00000100U) /*!< Timer 14 clock enable */
  1773. #define RCC_APB1ENR_WWDGEN ((uint32_t)0x00000800U) /*!< Window Watchdog clock enable */
  1774. #define RCC_APB1ENR_I2C1EN ((uint32_t)0x00200000U) /*!< I2C1 clock enable */
  1775. #define RCC_APB1ENR_PWREN ((uint32_t)0x10000000U) /*!< PWR clock enable */
  1776. /******************* Bit definition for RCC_BDCR register ******************/
  1777. #define RCC_BDCR_LSEON ((uint32_t)0x00000001U) /*!< External Low Speed oscillator enable */
  1778. #define RCC_BDCR_LSERDY ((uint32_t)0x00000002U) /*!< External Low Speed oscillator Ready */
  1779. #define RCC_BDCR_LSEBYP ((uint32_t)0x00000004U) /*!< External Low Speed oscillator Bypass */
  1780. #define RCC_BDCR_LSEDRV ((uint32_t)0x00000018U) /*!< LSEDRV[1:0] bits (LSE Osc. drive capability) */
  1781. #define RCC_BDCR_LSEDRV_0 ((uint32_t)0x00000008U) /*!< Bit 0 */
  1782. #define RCC_BDCR_LSEDRV_1 ((uint32_t)0x00000010U) /*!< Bit 1 */
  1783. #define RCC_BDCR_RTCSEL ((uint32_t)0x00000300U) /*!< RTCSEL[1:0] bits (RTC clock source selection) */
  1784. #define RCC_BDCR_RTCSEL_0 ((uint32_t)0x00000100U) /*!< Bit 0 */
  1785. #define RCC_BDCR_RTCSEL_1 ((uint32_t)0x00000200U) /*!< Bit 1 */
  1786. /*!< RTC configuration */
  1787. #define RCC_BDCR_RTCSEL_NOCLOCK ((uint32_t)0x00000000U) /*!< No clock */
  1788. #define RCC_BDCR_RTCSEL_LSE ((uint32_t)0x00000100U) /*!< LSE oscillator clock used as RTC clock */
  1789. #define RCC_BDCR_RTCSEL_LSI ((uint32_t)0x00000200U) /*!< LSI oscillator clock used as RTC clock */
  1790. #define RCC_BDCR_RTCSEL_HSE ((uint32_t)0x00000300U) /*!< HSE oscillator clock divided by 128 used as RTC clock */
  1791. #define RCC_BDCR_RTCEN ((uint32_t)0x00008000U) /*!< RTC clock enable */
  1792. #define RCC_BDCR_BDRST ((uint32_t)0x00010000U) /*!< Backup domain software reset */
  1793. /******************* Bit definition for RCC_CSR register *******************/
  1794. #define RCC_CSR_LSION ((uint32_t)0x00000001U) /*!< Internal Low Speed oscillator enable */
  1795. #define RCC_CSR_LSIRDY ((uint32_t)0x00000002U) /*!< Internal Low Speed oscillator Ready */
  1796. #define RCC_CSR_V18PWRRSTF ((uint32_t)0x00800000U) /*!< V1.8 power domain reset flag */
  1797. #define RCC_CSR_RMVF ((uint32_t)0x01000000U) /*!< Remove reset flag */
  1798. #define RCC_CSR_OBLRSTF ((uint32_t)0x02000000U) /*!< OBL reset flag */
  1799. #define RCC_CSR_PINRSTF ((uint32_t)0x04000000U) /*!< PIN reset flag */
  1800. #define RCC_CSR_PORRSTF ((uint32_t)0x08000000U) /*!< POR/PDR reset flag */
  1801. #define RCC_CSR_SFTRSTF ((uint32_t)0x10000000U) /*!< Software Reset flag */
  1802. #define RCC_CSR_IWDGRSTF ((uint32_t)0x20000000U) /*!< Independent Watchdog reset flag */
  1803. #define RCC_CSR_WWDGRSTF ((uint32_t)0x40000000U) /*!< Window watchdog reset flag */
  1804. #define RCC_CSR_LPWRRSTF ((uint32_t)0x80000000U) /*!< Low-Power reset flag */
  1805. /* Old Bit definition maintained for legacy purpose */
  1806. #define RCC_CSR_OBL RCC_CSR_OBLRSTF /*!< OBL reset flag */
  1807. /******************* Bit definition for RCC_AHBRSTR register ***************/
  1808. #define RCC_AHBRSTR_GPIOARST ((uint32_t)0x00020000U) /*!< GPIOA clock reset */
  1809. #define RCC_AHBRSTR_GPIOBRST ((uint32_t)0x00040000U) /*!< GPIOB clock reset */
  1810. #define RCC_AHBRSTR_GPIOCRST ((uint32_t)0x00080000U) /*!< GPIOC clock reset */
  1811. #define RCC_AHBRSTR_GPIODRST ((uint32_t)0x00100000U) /*!< GPIOD clock reset */
  1812. #define RCC_AHBRSTR_GPIOFRST ((uint32_t)0x00400000U) /*!< GPIOF clock reset */
  1813. /******************* Bit definition for RCC_CFGR2 register *****************/
  1814. /*!< PREDIV configuration */
  1815. #define RCC_CFGR2_PREDIV ((uint32_t)0x0000000FU) /*!< PREDIV[3:0] bits */
  1816. #define RCC_CFGR2_PREDIV_0 ((uint32_t)0x00000001U) /*!< Bit 0 */
  1817. #define RCC_CFGR2_PREDIV_1 ((uint32_t)0x00000002U) /*!< Bit 1 */
  1818. #define RCC_CFGR2_PREDIV_2 ((uint32_t)0x00000004U) /*!< Bit 2 */
  1819. #define RCC_CFGR2_PREDIV_3 ((uint32_t)0x00000008U) /*!< Bit 3 */
  1820. #define RCC_CFGR2_PREDIV_DIV1 ((uint32_t)0x00000000U) /*!< PREDIV input clock not divided */
  1821. #define RCC_CFGR2_PREDIV_DIV2 ((uint32_t)0x00000001U) /*!< PREDIV input clock divided by 2 */
  1822. #define RCC_CFGR2_PREDIV_DIV3 ((uint32_t)0x00000002U) /*!< PREDIV input clock divided by 3 */
  1823. #define RCC_CFGR2_PREDIV_DIV4 ((uint32_t)0x00000003U) /*!< PREDIV input clock divided by 4 */
  1824. #define RCC_CFGR2_PREDIV_DIV5 ((uint32_t)0x00000004U) /*!< PREDIV input clock divided by 5 */
  1825. #define RCC_CFGR2_PREDIV_DIV6 ((uint32_t)0x00000005U) /*!< PREDIV input clock divided by 6 */
  1826. #define RCC_CFGR2_PREDIV_DIV7 ((uint32_t)0x00000006U) /*!< PREDIV input clock divided by 7 */
  1827. #define RCC_CFGR2_PREDIV_DIV8 ((uint32_t)0x00000007U) /*!< PREDIV input clock divided by 8 */
  1828. #define RCC_CFGR2_PREDIV_DIV9 ((uint32_t)0x00000008U) /*!< PREDIV input clock divided by 9 */
  1829. #define RCC_CFGR2_PREDIV_DIV10 ((uint32_t)0x00000009U) /*!< PREDIV input clock divided by 10 */
  1830. #define RCC_CFGR2_PREDIV_DIV11 ((uint32_t)0x0000000AU) /*!< PREDIV input clock divided by 11 */
  1831. #define RCC_CFGR2_PREDIV_DIV12 ((uint32_t)0x0000000BU) /*!< PREDIV input clock divided by 12 */
  1832. #define RCC_CFGR2_PREDIV_DIV13 ((uint32_t)0x0000000CU) /*!< PREDIV input clock divided by 13 */
  1833. #define RCC_CFGR2_PREDIV_DIV14 ((uint32_t)0x0000000DU) /*!< PREDIV input clock divided by 14 */
  1834. #define RCC_CFGR2_PREDIV_DIV15 ((uint32_t)0x0000000EU) /*!< PREDIV input clock divided by 15 */
  1835. #define RCC_CFGR2_PREDIV_DIV16 ((uint32_t)0x0000000FU) /*!< PREDIV input clock divided by 16 */
  1836. /******************* Bit definition for RCC_CFGR3 register *****************/
  1837. /*!< USART1 Clock source selection */
  1838. #define RCC_CFGR3_USART1SW ((uint32_t)0x00000003U) /*!< USART1SW[1:0] bits */
  1839. #define RCC_CFGR3_USART1SW_0 ((uint32_t)0x00000001U) /*!< Bit 0 */
  1840. #define RCC_CFGR3_USART1SW_1 ((uint32_t)0x00000002U) /*!< Bit 1 */
  1841. #define RCC_CFGR3_USART1SW_PCLK ((uint32_t)0x00000000U) /*!< PCLK clock used as USART1 clock source */
  1842. #define RCC_CFGR3_USART1SW_SYSCLK ((uint32_t)0x00000001U) /*!< System clock selected as USART1 clock source */
  1843. #define RCC_CFGR3_USART1SW_LSE ((uint32_t)0x00000002U) /*!< LSE oscillator clock used as USART1 clock source */
  1844. #define RCC_CFGR3_USART1SW_HSI ((uint32_t)0x00000003U) /*!< HSI oscillator clock used as USART1 clock source */
  1845. /*!< I2C1 Clock source selection */
  1846. #define RCC_CFGR3_I2C1SW ((uint32_t)0x00000010U) /*!< I2C1SW bits */
  1847. #define RCC_CFGR3_I2C1SW_HSI ((uint32_t)0x00000000U) /*!< HSI oscillator clock used as I2C1 clock source */
  1848. #define RCC_CFGR3_I2C1SW_SYSCLK ((uint32_t)0x00000010U) /*!< System clock selected as I2C1 clock source */
  1849. /******************* Bit definition for RCC_CR2 register *******************/
  1850. #define RCC_CR2_HSI14ON ((uint32_t)0x00000001U) /*!< Internal High Speed 14MHz clock enable */
  1851. #define RCC_CR2_HSI14RDY ((uint32_t)0x00000002U) /*!< Internal High Speed 14MHz clock ready flag */
  1852. #define RCC_CR2_HSI14DIS ((uint32_t)0x00000004U) /*!< Internal High Speed 14MHz clock disable */
  1853. #define RCC_CR2_HSI14TRIM ((uint32_t)0x000000F8U) /*!< Internal High Speed 14MHz clock trimming */
  1854. #define RCC_CR2_HSI14CAL ((uint32_t)0x0000FF00U) /*!< Internal High Speed 14MHz clock Calibration */
  1855. /*****************************************************************************/
  1856. /* */
  1857. /* Real-Time Clock (RTC) */
  1858. /* */
  1859. /*****************************************************************************/
  1860. /*
  1861. * @brief Specific device feature definitions (not present on all devices in the STM32F0 family)
  1862. */
  1863. #define RTC_TAMPER1_SUPPORT /*!< TAMPER 1 feature support */
  1864. /******************** Bits definition for RTC_TR register ******************/
  1865. #define RTC_TR_PM ((uint32_t)0x00400000U)
  1866. #define RTC_TR_HT ((uint32_t)0x00300000U)
  1867. #define RTC_TR_HT_0 ((uint32_t)0x00100000U)
  1868. #define RTC_TR_HT_1 ((uint32_t)0x00200000U)
  1869. #define RTC_TR_HU ((uint32_t)0x000F0000U)
  1870. #define RTC_TR_HU_0 ((uint32_t)0x00010000U)
  1871. #define RTC_TR_HU_1 ((uint32_t)0x00020000U)
  1872. #define RTC_TR_HU_2 ((uint32_t)0x00040000U)
  1873. #define RTC_TR_HU_3 ((uint32_t)0x00080000U)
  1874. #define RTC_TR_MNT ((uint32_t)0x00007000U)
  1875. #define RTC_TR_MNT_0 ((uint32_t)0x00001000U)
  1876. #define RTC_TR_MNT_1 ((uint32_t)0x00002000U)
  1877. #define RTC_TR_MNT_2 ((uint32_t)0x00004000U)
  1878. #define RTC_TR_MNU ((uint32_t)0x00000F00U)
  1879. #define RTC_TR_MNU_0 ((uint32_t)0x00000100U)
  1880. #define RTC_TR_MNU_1 ((uint32_t)0x00000200U)
  1881. #define RTC_TR_MNU_2 ((uint32_t)0x00000400U)
  1882. #define RTC_TR_MNU_3 ((uint32_t)0x00000800U)
  1883. #define RTC_TR_ST ((uint32_t)0x00000070U)
  1884. #define RTC_TR_ST_0 ((uint32_t)0x00000010U)
  1885. #define RTC_TR_ST_1 ((uint32_t)0x00000020U)
  1886. #define RTC_TR_ST_2 ((uint32_t)0x00000040U)
  1887. #define RTC_TR_SU ((uint32_t)0x0000000FU)
  1888. #define RTC_TR_SU_0 ((uint32_t)0x00000001U)
  1889. #define RTC_TR_SU_1 ((uint32_t)0x00000002U)
  1890. #define RTC_TR_SU_2 ((uint32_t)0x00000004U)
  1891. #define RTC_TR_SU_3 ((uint32_t)0x00000008U)
  1892. /******************** Bits definition for RTC_DR register ******************/
  1893. #define RTC_DR_YT ((uint32_t)0x00F00000U)
  1894. #define RTC_DR_YT_0 ((uint32_t)0x00100000U)
  1895. #define RTC_DR_YT_1 ((uint32_t)0x00200000U)
  1896. #define RTC_DR_YT_2 ((uint32_t)0x00400000U)
  1897. #define RTC_DR_YT_3 ((uint32_t)0x00800000U)
  1898. #define RTC_DR_YU ((uint32_t)0x000F0000U)
  1899. #define RTC_DR_YU_0 ((uint32_t)0x00010000U)
  1900. #define RTC_DR_YU_1 ((uint32_t)0x00020000U)
  1901. #define RTC_DR_YU_2 ((uint32_t)0x00040000U)
  1902. #define RTC_DR_YU_3 ((uint32_t)0x00080000U)
  1903. #define RTC_DR_WDU ((uint32_t)0x0000E000U)
  1904. #define RTC_DR_WDU_0 ((uint32_t)0x00002000U)
  1905. #define RTC_DR_WDU_1 ((uint32_t)0x00004000U)
  1906. #define RTC_DR_WDU_2 ((uint32_t)0x00008000U)
  1907. #define RTC_DR_MT ((uint32_t)0x00001000U)
  1908. #define RTC_DR_MU ((uint32_t)0x00000F00U)
  1909. #define RTC_DR_MU_0 ((uint32_t)0x00000100U)
  1910. #define RTC_DR_MU_1 ((uint32_t)0x00000200U)
  1911. #define RTC_DR_MU_2 ((uint32_t)0x00000400U)
  1912. #define RTC_DR_MU_3 ((uint32_t)0x00000800U)
  1913. #define RTC_DR_DT ((uint32_t)0x00000030U)
  1914. #define RTC_DR_DT_0 ((uint32_t)0x00000010U)
  1915. #define RTC_DR_DT_1 ((uint32_t)0x00000020U)
  1916. #define RTC_DR_DU ((uint32_t)0x0000000FU)
  1917. #define RTC_DR_DU_0 ((uint32_t)0x00000001U)
  1918. #define RTC_DR_DU_1 ((uint32_t)0x00000002U)
  1919. #define RTC_DR_DU_2 ((uint32_t)0x00000004U)
  1920. #define RTC_DR_DU_3 ((uint32_t)0x00000008U)
  1921. /******************** Bits definition for RTC_CR register ******************/
  1922. #define RTC_CR_COE ((uint32_t)0x00800000U)
  1923. #define RTC_CR_OSEL ((uint32_t)0x00600000U)
  1924. #define RTC_CR_OSEL_0 ((uint32_t)0x00200000U)
  1925. #define RTC_CR_OSEL_1 ((uint32_t)0x00400000U)
  1926. #define RTC_CR_POL ((uint32_t)0x00100000U)
  1927. #define RTC_CR_COSEL ((uint32_t)0x00080000U)
  1928. #define RTC_CR_BCK ((uint32_t)0x00040000U)
  1929. #define RTC_CR_SUB1H ((uint32_t)0x00020000U)
  1930. #define RTC_CR_ADD1H ((uint32_t)0x00010000U)
  1931. #define RTC_CR_TSIE ((uint32_t)0x00008000U)
  1932. #define RTC_CR_ALRAIE ((uint32_t)0x00001000U)
  1933. #define RTC_CR_TSE ((uint32_t)0x00000800U)
  1934. #define RTC_CR_ALRAE ((uint32_t)0x00000100U)
  1935. #define RTC_CR_FMT ((uint32_t)0x00000040U)
  1936. #define RTC_CR_BYPSHAD ((uint32_t)0x00000020U)
  1937. #define RTC_CR_REFCKON ((uint32_t)0x00000010U)
  1938. #define RTC_CR_TSEDGE ((uint32_t)0x00000008U)
  1939. /******************** Bits definition for RTC_ISR register *****************/
  1940. #define RTC_ISR_RECALPF ((uint32_t)0x00010000U)
  1941. #define RTC_ISR_TAMP2F ((uint32_t)0x00004000U)
  1942. #define RTC_ISR_TAMP1F ((uint32_t)0x00002000U)
  1943. #define RTC_ISR_TSOVF ((uint32_t)0x00001000U)
  1944. #define RTC_ISR_TSF ((uint32_t)0x00000800U)
  1945. #define RTC_ISR_ALRAF ((uint32_t)0x00000100U)
  1946. #define RTC_ISR_INIT ((uint32_t)0x00000080U)
  1947. #define RTC_ISR_INITF ((uint32_t)0x00000040U)
  1948. #define RTC_ISR_RSF ((uint32_t)0x00000020U)
  1949. #define RTC_ISR_INITS ((uint32_t)0x00000010U)
  1950. #define RTC_ISR_SHPF ((uint32_t)0x00000008U)
  1951. #define RTC_ISR_ALRAWF ((uint32_t)0x00000001U)
  1952. /******************** Bits definition for RTC_PRER register ****************/
  1953. #define RTC_PRER_PREDIV_A ((uint32_t)0x007F0000U)
  1954. #define RTC_PRER_PREDIV_S ((uint32_t)0x00007FFFU)
  1955. /******************** Bits definition for RTC_ALRMAR register **************/
  1956. #define RTC_ALRMAR_MSK4 ((uint32_t)0x80000000U)
  1957. #define RTC_ALRMAR_WDSEL ((uint32_t)0x40000000U)
  1958. #define RTC_ALRMAR_DT ((uint32_t)0x30000000U)
  1959. #define RTC_ALRMAR_DT_0 ((uint32_t)0x10000000U)
  1960. #define RTC_ALRMAR_DT_1 ((uint32_t)0x20000000U)
  1961. #define RTC_ALRMAR_DU ((uint32_t)0x0F000000U)
  1962. #define RTC_ALRMAR_DU_0 ((uint32_t)0x01000000U)
  1963. #define RTC_ALRMAR_DU_1 ((uint32_t)0x02000000U)
  1964. #define RTC_ALRMAR_DU_2 ((uint32_t)0x04000000U)
  1965. #define RTC_ALRMAR_DU_3 ((uint32_t)0x08000000U)
  1966. #define RTC_ALRMAR_MSK3 ((uint32_t)0x00800000U)
  1967. #define RTC_ALRMAR_PM ((uint32_t)0x00400000U)
  1968. #define RTC_ALRMAR_HT ((uint32_t)0x00300000U)
  1969. #define RTC_ALRMAR_HT_0 ((uint32_t)0x00100000U)
  1970. #define RTC_ALRMAR_HT_1 ((uint32_t)0x00200000U)
  1971. #define RTC_ALRMAR_HU ((uint32_t)0x000F0000U)
  1972. #define RTC_ALRMAR_HU_0 ((uint32_t)0x00010000U)
  1973. #define RTC_ALRMAR_HU_1 ((uint32_t)0x00020000U)
  1974. #define RTC_ALRMAR_HU_2 ((uint32_t)0x00040000U)
  1975. #define RTC_ALRMAR_HU_3 ((uint32_t)0x00080000U)
  1976. #define RTC_ALRMAR_MSK2 ((uint32_t)0x00008000U)
  1977. #define RTC_ALRMAR_MNT ((uint32_t)0x00007000U)
  1978. #define RTC_ALRMAR_MNT_0 ((uint32_t)0x00001000U)
  1979. #define RTC_ALRMAR_MNT_1 ((uint32_t)0x00002000U)
  1980. #define RTC_ALRMAR_MNT_2 ((uint32_t)0x00004000U)
  1981. #define RTC_ALRMAR_MNU ((uint32_t)0x00000F00U)
  1982. #define RTC_ALRMAR_MNU_0 ((uint32_t)0x00000100U)
  1983. #define RTC_ALRMAR_MNU_1 ((uint32_t)0x00000200U)
  1984. #define RTC_ALRMAR_MNU_2 ((uint32_t)0x00000400U)
  1985. #define RTC_ALRMAR_MNU_3 ((uint32_t)0x00000800U)
  1986. #define RTC_ALRMAR_MSK1 ((uint32_t)0x00000080U)
  1987. #define RTC_ALRMAR_ST ((uint32_t)0x00000070U)
  1988. #define RTC_ALRMAR_ST_0 ((uint32_t)0x00000010U)
  1989. #define RTC_ALRMAR_ST_1 ((uint32_t)0x00000020U)
  1990. #define RTC_ALRMAR_ST_2 ((uint32_t)0x00000040U)
  1991. #define RTC_ALRMAR_SU ((uint32_t)0x0000000FU)
  1992. #define RTC_ALRMAR_SU_0 ((uint32_t)0x00000001U)
  1993. #define RTC_ALRMAR_SU_1 ((uint32_t)0x00000002U)
  1994. #define RTC_ALRMAR_SU_2 ((uint32_t)0x00000004U)
  1995. #define RTC_ALRMAR_SU_3 ((uint32_t)0x00000008U)
  1996. /******************** Bits definition for RTC_WPR register *****************/
  1997. #define RTC_WPR_KEY ((uint32_t)0x000000FFU)
  1998. /******************** Bits definition for RTC_SSR register *****************/
  1999. #define RTC_SSR_SS ((uint32_t)0x0000FFFFU)
  2000. /******************** Bits definition for RTC_SHIFTR register **************/
  2001. #define RTC_SHIFTR_SUBFS ((uint32_t)0x00007FFFU)
  2002. #define RTC_SHIFTR_ADD1S ((uint32_t)0x80000000U)
  2003. /******************** Bits definition for RTC_TSTR register ****************/
  2004. #define RTC_TSTR_PM ((uint32_t)0x00400000U)
  2005. #define RTC_TSTR_HT ((uint32_t)0x00300000U)
  2006. #define RTC_TSTR_HT_0 ((uint32_t)0x00100000U)
  2007. #define RTC_TSTR_HT_1 ((uint32_t)0x00200000U)
  2008. #define RTC_TSTR_HU ((uint32_t)0x000F0000U)
  2009. #define RTC_TSTR_HU_0 ((uint32_t)0x00010000U)
  2010. #define RTC_TSTR_HU_1 ((uint32_t)0x00020000U)
  2011. #define RTC_TSTR_HU_2 ((uint32_t)0x00040000U)
  2012. #define RTC_TSTR_HU_3 ((uint32_t)0x00080000U)
  2013. #define RTC_TSTR_MNT ((uint32_t)0x00007000U)
  2014. #define RTC_TSTR_MNT_0 ((uint32_t)0x00001000U)
  2015. #define RTC_TSTR_MNT_1 ((uint32_t)0x00002000U)
  2016. #define RTC_TSTR_MNT_2 ((uint32_t)0x00004000U)
  2017. #define RTC_TSTR_MNU ((uint32_t)0x00000F00U)
  2018. #define RTC_TSTR_MNU_0 ((uint32_t)0x00000100U)
  2019. #define RTC_TSTR_MNU_1 ((uint32_t)0x00000200U)
  2020. #define RTC_TSTR_MNU_2 ((uint32_t)0x00000400U)
  2021. #define RTC_TSTR_MNU_3 ((uint32_t)0x00000800U)
  2022. #define RTC_TSTR_ST ((uint32_t)0x00000070U)
  2023. #define RTC_TSTR_ST_0 ((uint32_t)0x00000010U)
  2024. #define RTC_TSTR_ST_1 ((uint32_t)0x00000020U)
  2025. #define RTC_TSTR_ST_2 ((uint32_t)0x00000040U)
  2026. #define RTC_TSTR_SU ((uint32_t)0x0000000FU)
  2027. #define RTC_TSTR_SU_0 ((uint32_t)0x00000001U)
  2028. #define RTC_TSTR_SU_1 ((uint32_t)0x00000002U)
  2029. #define RTC_TSTR_SU_2 ((uint32_t)0x00000004U)
  2030. #define RTC_TSTR_SU_3 ((uint32_t)0x00000008U)
  2031. /******************** Bits definition for RTC_TSDR register ****************/
  2032. #define RTC_TSDR_WDU ((uint32_t)0x0000E000U)
  2033. #define RTC_TSDR_WDU_0 ((uint32_t)0x00002000U)
  2034. #define RTC_TSDR_WDU_1 ((uint32_t)0x00004000U)
  2035. #define RTC_TSDR_WDU_2 ((uint32_t)0x00008000U)
  2036. #define RTC_TSDR_MT ((uint32_t)0x00001000U)
  2037. #define RTC_TSDR_MU ((uint32_t)0x00000F00U)
  2038. #define RTC_TSDR_MU_0 ((uint32_t)0x00000100U)
  2039. #define RTC_TSDR_MU_1 ((uint32_t)0x00000200U)
  2040. #define RTC_TSDR_MU_2 ((uint32_t)0x00000400U)
  2041. #define RTC_TSDR_MU_3 ((uint32_t)0x00000800U)
  2042. #define RTC_TSDR_DT ((uint32_t)0x00000030U)
  2043. #define RTC_TSDR_DT_0 ((uint32_t)0x00000010U)
  2044. #define RTC_TSDR_DT_1 ((uint32_t)0x00000020U)
  2045. #define RTC_TSDR_DU ((uint32_t)0x0000000FU)
  2046. #define RTC_TSDR_DU_0 ((uint32_t)0x00000001U)
  2047. #define RTC_TSDR_DU_1 ((uint32_t)0x00000002U)
  2048. #define RTC_TSDR_DU_2 ((uint32_t)0x00000004U)
  2049. #define RTC_TSDR_DU_3 ((uint32_t)0x00000008U)
  2050. /******************** Bits definition for RTC_TSSSR register ***************/
  2051. #define RTC_TSSSR_SS ((uint32_t)0x0000FFFFU)
  2052. /******************** Bits definition for RTC_CALR register ****************/
  2053. #define RTC_CALR_CALP ((uint32_t)0x00008000U)
  2054. #define RTC_CALR_CALW8 ((uint32_t)0x00004000U)
  2055. #define RTC_CALR_CALW16 ((uint32_t)0x00002000U)
  2056. #define RTC_CALR_CALM ((uint32_t)0x000001FFU)
  2057. #define RTC_CALR_CALM_0 ((uint32_t)0x00000001U)
  2058. #define RTC_CALR_CALM_1 ((uint32_t)0x00000002U)
  2059. #define RTC_CALR_CALM_2 ((uint32_t)0x00000004U)
  2060. #define RTC_CALR_CALM_3 ((uint32_t)0x00000008U)
  2061. #define RTC_CALR_CALM_4 ((uint32_t)0x00000010U)
  2062. #define RTC_CALR_CALM_5 ((uint32_t)0x00000020U)
  2063. #define RTC_CALR_CALM_6 ((uint32_t)0x00000040U)
  2064. #define RTC_CALR_CALM_7 ((uint32_t)0x00000080U)
  2065. #define RTC_CALR_CALM_8 ((uint32_t)0x00000100U)
  2066. /******************** Bits definition for RTC_TAFCR register ***************/
  2067. #define RTC_TAFCR_PC15MODE ((uint32_t)0x00800000U)
  2068. #define RTC_TAFCR_PC15VALUE ((uint32_t)0x00400000U)
  2069. #define RTC_TAFCR_PC14MODE ((uint32_t)0x00200000U)
  2070. #define RTC_TAFCR_PC14VALUE ((uint32_t)0x00100000U)
  2071. #define RTC_TAFCR_PC13MODE ((uint32_t)0x00080000U)
  2072. #define RTC_TAFCR_PC13VALUE ((uint32_t)0x00040000U)
  2073. #define RTC_TAFCR_TAMPPUDIS ((uint32_t)0x00008000U)
  2074. #define RTC_TAFCR_TAMPPRCH ((uint32_t)0x00006000U)
  2075. #define RTC_TAFCR_TAMPPRCH_0 ((uint32_t)0x00002000U)
  2076. #define RTC_TAFCR_TAMPPRCH_1 ((uint32_t)0x00004000U)
  2077. #define RTC_TAFCR_TAMPFLT ((uint32_t)0x00001800U)
  2078. #define RTC_TAFCR_TAMPFLT_0 ((uint32_t)0x00000800U)
  2079. #define RTC_TAFCR_TAMPFLT_1 ((uint32_t)0x00001000U)
  2080. #define RTC_TAFCR_TAMPFREQ ((uint32_t)0x00000700U)
  2081. #define RTC_TAFCR_TAMPFREQ_0 ((uint32_t)0x00000100U)
  2082. #define RTC_TAFCR_TAMPFREQ_1 ((uint32_t)0x00000200U)
  2083. #define RTC_TAFCR_TAMPFREQ_2 ((uint32_t)0x00000400U)
  2084. #define RTC_TAFCR_TAMPTS ((uint32_t)0x00000080U)
  2085. #define RTC_TAFCR_TAMP2TRG ((uint32_t)0x00000010U)
  2086. #define RTC_TAFCR_TAMP2E ((uint32_t)0x00000008U)
  2087. #define RTC_TAFCR_TAMPIE ((uint32_t)0x00000004U)
  2088. #define RTC_TAFCR_TAMP1TRG ((uint32_t)0x00000002U)
  2089. #define RTC_TAFCR_TAMP1E ((uint32_t)0x00000001U)
  2090. /* Reference defines */
  2091. #define RTC_TAFCR_ALARMOUTTYPE RTC_TAFCR_PC13VALUE
  2092. /******************** Bits definition for RTC_ALRMASSR register ************/
  2093. #define RTC_ALRMASSR_MASKSS ((uint32_t)0x0F000000U)
  2094. #define RTC_ALRMASSR_MASKSS_0 ((uint32_t)0x01000000U)
  2095. #define RTC_ALRMASSR_MASKSS_1 ((uint32_t)0x02000000U)
  2096. #define RTC_ALRMASSR_MASKSS_2 ((uint32_t)0x04000000U)
  2097. #define RTC_ALRMASSR_MASKSS_3 ((uint32_t)0x08000000U)
  2098. #define RTC_ALRMASSR_SS ((uint32_t)0x00007FFFU)
  2099. /*****************************************************************************/
  2100. /* */
  2101. /* Serial Peripheral Interface (SPI) */
  2102. /* */
  2103. /*****************************************************************************/
  2104. /******************* Bit definition for SPI_CR1 register *******************/
  2105. #define SPI_CR1_CPHA ((uint32_t)0x00000001U) /*!< Clock Phase */
  2106. #define SPI_CR1_CPOL ((uint32_t)0x00000002U) /*!< Clock Polarity */
  2107. #define SPI_CR1_MSTR ((uint32_t)0x00000004U) /*!< Master Selection */
  2108. #define SPI_CR1_BR ((uint32_t)0x00000038U) /*!< BR[2:0] bits (Baud Rate Control) */
  2109. #define SPI_CR1_BR_0 ((uint32_t)0x00000008U) /*!< Bit 0 */
  2110. #define SPI_CR1_BR_1 ((uint32_t)0x00000010U) /*!< Bit 1 */
  2111. #define SPI_CR1_BR_2 ((uint32_t)0x00000020U) /*!< Bit 2 */
  2112. #define SPI_CR1_SPE ((uint32_t)0x00000040U) /*!< SPI Enable */
  2113. #define SPI_CR1_LSBFIRST ((uint32_t)0x00000080U) /*!< Frame Format */
  2114. #define SPI_CR1_SSI ((uint32_t)0x00000100U) /*!< Internal slave select */
  2115. #define SPI_CR1_SSM ((uint32_t)0x00000200U) /*!< Software slave management */
  2116. #define SPI_CR1_RXONLY ((uint32_t)0x00000400U) /*!< Receive only */
  2117. #define SPI_CR1_CRCL ((uint32_t)0x00000800U) /*!< CRC Length */
  2118. #define SPI_CR1_CRCNEXT ((uint32_t)0x00001000U) /*!< Transmit CRC next */
  2119. #define SPI_CR1_CRCEN ((uint32_t)0x00002000U) /*!< Hardware CRC calculation enable */
  2120. #define SPI_CR1_BIDIOE ((uint32_t)0x00004000U) /*!< Output enable in bidirectional mode */
  2121. #define SPI_CR1_BIDIMODE ((uint32_t)0x00008000U) /*!< Bidirectional data mode enable */
  2122. /******************* Bit definition for SPI_CR2 register *******************/
  2123. #define SPI_CR2_RXDMAEN ((uint32_t)0x00000001U) /*!< Rx Buffer DMA Enable */
  2124. #define SPI_CR2_TXDMAEN ((uint32_t)0x00000002U) /*!< Tx Buffer DMA Enable */
  2125. #define SPI_CR2_SSOE ((uint32_t)0x00000004U) /*!< SS Output Enable */
  2126. #define SPI_CR2_NSSP ((uint32_t)0x00000008U) /*!< NSS pulse management Enable */
  2127. #define SPI_CR2_FRF ((uint32_t)0x00000010U) /*!< Frame Format Enable */
  2128. #define SPI_CR2_ERRIE ((uint32_t)0x00000020U) /*!< Error Interrupt Enable */
  2129. #define SPI_CR2_RXNEIE ((uint32_t)0x00000040U) /*!< RX buffer Not Empty Interrupt Enable */
  2130. #define SPI_CR2_TXEIE ((uint32_t)0x00000080U) /*!< Tx buffer Empty Interrupt Enable */
  2131. #define SPI_CR2_DS ((uint32_t)0x00000F00U) /*!< DS[3:0] Data Size */
  2132. #define SPI_CR2_DS_0 ((uint32_t)0x00000100U) /*!< Bit 0 */
  2133. #define SPI_CR2_DS_1 ((uint32_t)0x00000200U) /*!< Bit 1 */
  2134. #define SPI_CR2_DS_2 ((uint32_t)0x00000400U) /*!< Bit 2 */
  2135. #define SPI_CR2_DS_3 ((uint32_t)0x00000800U) /*!< Bit 3 */
  2136. #define SPI_CR2_FRXTH ((uint32_t)0x00001000U) /*!< FIFO reception Threshold */
  2137. #define SPI_CR2_LDMARX ((uint32_t)0x00002000U) /*!< Last DMA transfer for reception */
  2138. #define SPI_CR2_LDMATX ((uint32_t)0x00004000U) /*!< Last DMA transfer for transmission */
  2139. /******************** Bit definition for SPI_SR register *******************/
  2140. #define SPI_SR_RXNE ((uint32_t)0x00000001U) /*!< Receive buffer Not Empty */
  2141. #define SPI_SR_TXE ((uint32_t)0x00000002U) /*!< Transmit buffer Empty */
  2142. #define SPI_SR_CRCERR ((uint32_t)0x00000010U) /*!< CRC Error flag */
  2143. #define SPI_SR_MODF ((uint32_t)0x00000020U) /*!< Mode fault */
  2144. #define SPI_SR_OVR ((uint32_t)0x00000040U) /*!< Overrun flag */
  2145. #define SPI_SR_BSY ((uint32_t)0x00000080U) /*!< Busy flag */
  2146. #define SPI_SR_FRE ((uint32_t)0x00000100U) /*!< TI frame format error */
  2147. #define SPI_SR_FRLVL ((uint32_t)0x00000600U) /*!< FIFO Reception Level */
  2148. #define SPI_SR_FRLVL_0 ((uint32_t)0x00000200U) /*!< Bit 0 */
  2149. #define SPI_SR_FRLVL_1 ((uint32_t)0x00000400U) /*!< Bit 1 */
  2150. #define SPI_SR_FTLVL ((uint32_t)0x00001800U) /*!< FIFO Transmission Level */
  2151. #define SPI_SR_FTLVL_0 ((uint32_t)0x00000800U) /*!< Bit 0 */
  2152. #define SPI_SR_FTLVL_1 ((uint32_t)0x00001000U) /*!< Bit 1 */
  2153. /******************** Bit definition for SPI_DR register *******************/
  2154. #define SPI_DR_DR ((uint32_t)0xFFFFFFFFU) /*!< Data Register */
  2155. /******************* Bit definition for SPI_CRCPR register *****************/
  2156. #define SPI_CRCPR_CRCPOLY ((uint32_t)0xFFFFFFFFU) /*!< CRC polynomial register */
  2157. /****************** Bit definition for SPI_RXCRCR register *****************/
  2158. #define SPI_RXCRCR_RXCRC ((uint32_t)0xFFFFFFFFU) /*!< Rx CRC Register */
  2159. /****************** Bit definition for SPI_TXCRCR register *****************/
  2160. #define SPI_TXCRCR_TXCRC ((uint32_t)0xFFFFFFFFU) /*!< Tx CRC Register */
  2161. /****************** Bit definition for SPI_I2SCFGR register ****************/
  2162. #define SPI_I2SCFGR_CHLEN ((uint32_t)0x00000001U) /*!<Channel length (number of bits per audio channel) */
  2163. #define SPI_I2SCFGR_DATLEN ((uint32_t)0x00000006U) /*!<DATLEN[1:0] bits (Data length to be transferred) */
  2164. #define SPI_I2SCFGR_DATLEN_0 ((uint32_t)0x00000002U) /*!<Bit 0 */
  2165. #define SPI_I2SCFGR_DATLEN_1 ((uint32_t)0x00000004U) /*!<Bit 1 */
  2166. #define SPI_I2SCFGR_CKPOL ((uint32_t)0x00000008U) /*!<steady state clock polarity */
  2167. #define SPI_I2SCFGR_I2SSTD ((uint32_t)0x00000030U) /*!<I2SSTD[1:0] bits (I2S standard selection) */
  2168. #define SPI_I2SCFGR_I2SSTD_0 ((uint32_t)0x00000010U) /*!<Bit 0 */
  2169. #define SPI_I2SCFGR_I2SSTD_1 ((uint32_t)0x00000020U) /*!<Bit 1 */
  2170. #define SPI_I2SCFGR_PCMSYNC ((uint32_t)0x00000080U) /*!<PCM frame synchronization */
  2171. #define SPI_I2SCFGR_I2SCFG ((uint32_t)0x00000300U) /*!<I2SCFG[1:0] bits (I2S configuration mode) */
  2172. #define SPI_I2SCFGR_I2SCFG_0 ((uint32_t)0x00000100U) /*!<Bit 0 */
  2173. #define SPI_I2SCFGR_I2SCFG_1 ((uint32_t)0x00000200U) /*!<Bit 1 */
  2174. #define SPI_I2SCFGR_I2SE ((uint32_t)0x00000400U) /*!<I2S Enable */
  2175. #define SPI_I2SCFGR_I2SMOD ((uint32_t)0x00000800U) /*!<I2S mode selection */
  2176. /****************** Bit definition for SPI_I2SPR register ******************/
  2177. #define SPI_I2SPR_I2SDIV ((uint32_t)0x000000FFU) /*!<I2S Linear prescaler */
  2178. #define SPI_I2SPR_ODD ((uint32_t)0x00000100U) /*!<Odd factor for the prescaler */
  2179. #define SPI_I2SPR_MCKOE ((uint32_t)0x00000200U) /*!<Master Clock Output Enable */
  2180. /*****************************************************************************/
  2181. /* */
  2182. /* System Configuration (SYSCFG) */
  2183. /* */
  2184. /*****************************************************************************/
  2185. /***************** Bit definition for SYSCFG_CFGR1 register ****************/
  2186. #define SYSCFG_CFGR1_MEM_MODE ((uint32_t)0x00000003U) /*!< SYSCFG_Memory Remap Config */
  2187. #define SYSCFG_CFGR1_MEM_MODE_0 ((uint32_t)0x00000001U) /*!< SYSCFG_Memory Remap Config Bit 0 */
  2188. #define SYSCFG_CFGR1_MEM_MODE_1 ((uint32_t)0x00000002U) /*!< SYSCFG_Memory Remap Config Bit 1 */
  2189. #define SYSCFG_CFGR1_DMA_RMP ((uint32_t)0x00001F00U) /*!< DMA remap mask */
  2190. #define SYSCFG_CFGR1_ADC_DMA_RMP ((uint32_t)0x00000100U) /*!< ADC DMA remap */
  2191. #define SYSCFG_CFGR1_USART1TX_DMA_RMP ((uint32_t)0x00000200U) /*!< USART1 TX DMA remap */
  2192. #define SYSCFG_CFGR1_USART1RX_DMA_RMP ((uint32_t)0x00000400U) /*!< USART1 RX DMA remap */
  2193. #define SYSCFG_CFGR1_TIM16_DMA_RMP ((uint32_t)0x00000800U) /*!< Timer 16 DMA remap */
  2194. #define SYSCFG_CFGR1_TIM17_DMA_RMP ((uint32_t)0x00001000U) /*!< Timer 17 DMA remap */
  2195. #define SYSCFG_CFGR1_I2C_FMP_PB6 ((uint32_t)0x00010000U) /*!< I2C PB6 Fast mode plus */
  2196. #define SYSCFG_CFGR1_I2C_FMP_PB7 ((uint32_t)0x00020000U) /*!< I2C PB7 Fast mode plus */
  2197. #define SYSCFG_CFGR1_I2C_FMP_PB8 ((uint32_t)0x00040000U) /*!< I2C PB8 Fast mode plus */
  2198. #define SYSCFG_CFGR1_I2C_FMP_PB9 ((uint32_t)0x00080000U) /*!< I2C PB9 Fast mode plus */
  2199. #define SYSCFG_CFGR1_I2C_FMP_I2C1 ((uint32_t)0x00100000U) /*!< Enable Fast Mode Plus on PB10, PB11, PF6 and PF7 */
  2200. #define SYSCFG_CFGR1_I2C_FMP_PA9 ((uint32_t)0x00400000U) /*!< Enable Fast Mode Plus on PA9 */
  2201. #define SYSCFG_CFGR1_I2C_FMP_PA10 ((uint32_t)0x00800000U) /*!< Enable Fast Mode Plus on PA10 */
  2202. /***************** Bit definition for SYSCFG_EXTICR1 register **************/
  2203. #define SYSCFG_EXTICR1_EXTI0 ((uint32_t)0x0000000FU) /*!< EXTI 0 configuration */
  2204. #define SYSCFG_EXTICR1_EXTI1 ((uint32_t)0x000000F0U) /*!< EXTI 1 configuration */
  2205. #define SYSCFG_EXTICR1_EXTI2 ((uint32_t)0x00000F00U) /*!< EXTI 2 configuration */
  2206. #define SYSCFG_EXTICR1_EXTI3 ((uint32_t)0x0000F000U) /*!< EXTI 3 configuration */
  2207. /**
  2208. * @brief EXTI0 configuration
  2209. */
  2210. #define SYSCFG_EXTICR1_EXTI0_PA ((uint32_t)0x00000000U) /*!< PA[0] pin */
  2211. #define SYSCFG_EXTICR1_EXTI0_PB ((uint32_t)0x00000001U) /*!< PB[0] pin */
  2212. #define SYSCFG_EXTICR1_EXTI0_PC ((uint32_t)0x00000002U) /*!< PC[0] pin */
  2213. #define SYSCFG_EXTICR1_EXTI0_PD ((uint32_t)0x00000003U) /*!< PD[0] pin */
  2214. #define SYSCFG_EXTICR1_EXTI0_PF ((uint32_t)0x00000005U) /*!< PF[0] pin */
  2215. /**
  2216. * @brief EXTI1 configuration
  2217. */
  2218. #define SYSCFG_EXTICR1_EXTI1_PA ((uint32_t)0x00000000U) /*!< PA[1] pin */
  2219. #define SYSCFG_EXTICR1_EXTI1_PB ((uint32_t)0x00000010U) /*!< PB[1] pin */
  2220. #define SYSCFG_EXTICR1_EXTI1_PC ((uint32_t)0x00000020U) /*!< PC[1] pin */
  2221. #define SYSCFG_EXTICR1_EXTI1_PD ((uint32_t)0x00000030U) /*!< PD[1] pin */
  2222. #define SYSCFG_EXTICR1_EXTI1_PF ((uint32_t)0x00000050U) /*!< PF[1] pin */
  2223. /**
  2224. * @brief EXTI2 configuration
  2225. */
  2226. #define SYSCFG_EXTICR1_EXTI2_PA ((uint32_t)0x00000000U) /*!< PA[2] pin */
  2227. #define SYSCFG_EXTICR1_EXTI2_PB ((uint32_t)0x00000100U) /*!< PB[2] pin */
  2228. #define SYSCFG_EXTICR1_EXTI2_PC ((uint32_t)0x00000200U) /*!< PC[2] pin */
  2229. #define SYSCFG_EXTICR1_EXTI2_PD ((uint32_t)0x00000300U) /*!< PD[2] pin */
  2230. #define SYSCFG_EXTICR1_EXTI2_PF ((uint32_t)0x00000500U) /*!< PF[2] pin */
  2231. /**
  2232. * @brief EXTI3 configuration
  2233. */
  2234. #define SYSCFG_EXTICR1_EXTI3_PA ((uint32_t)0x00000000U) /*!< PA[3] pin */
  2235. #define SYSCFG_EXTICR1_EXTI3_PB ((uint32_t)0x00001000U) /*!< PB[3] pin */
  2236. #define SYSCFG_EXTICR1_EXTI3_PC ((uint32_t)0x00002000U) /*!< PC[3] pin */
  2237. #define SYSCFG_EXTICR1_EXTI3_PD ((uint32_t)0x00003000U) /*!< PD[3] pin */
  2238. #define SYSCFG_EXTICR1_EXTI3_PF ((uint32_t)0x00005000U) /*!< PF[3] pin */
  2239. /***************** Bit definition for SYSCFG_EXTICR2 register **************/
  2240. #define SYSCFG_EXTICR2_EXTI4 ((uint32_t)0x0000000FU) /*!< EXTI 4 configuration */
  2241. #define SYSCFG_EXTICR2_EXTI5 ((uint32_t)0x000000F0U) /*!< EXTI 5 configuration */
  2242. #define SYSCFG_EXTICR2_EXTI6 ((uint32_t)0x00000F00U) /*!< EXTI 6 configuration */
  2243. #define SYSCFG_EXTICR2_EXTI7 ((uint32_t)0x0000F000U) /*!< EXTI 7 configuration */
  2244. /**
  2245. * @brief EXTI4 configuration
  2246. */
  2247. #define SYSCFG_EXTICR2_EXTI4_PA ((uint32_t)0x00000000U) /*!< PA[4] pin */
  2248. #define SYSCFG_EXTICR2_EXTI4_PB ((uint32_t)0x00000001U) /*!< PB[4] pin */
  2249. #define SYSCFG_EXTICR2_EXTI4_PC ((uint32_t)0x00000002U) /*!< PC[4] pin */
  2250. #define SYSCFG_EXTICR2_EXTI4_PD ((uint32_t)0x00000003U) /*!< PD[4] pin */
  2251. #define SYSCFG_EXTICR2_EXTI4_PF ((uint32_t)0x00000005U) /*!< PF[4] pin */
  2252. /**
  2253. * @brief EXTI5 configuration
  2254. */
  2255. #define SYSCFG_EXTICR2_EXTI5_PA ((uint32_t)0x00000000U) /*!< PA[5] pin */
  2256. #define SYSCFG_EXTICR2_EXTI5_PB ((uint32_t)0x00000010U) /*!< PB[5] pin */
  2257. #define SYSCFG_EXTICR2_EXTI5_PC ((uint32_t)0x00000020U) /*!< PC[5] pin */
  2258. #define SYSCFG_EXTICR2_EXTI5_PD ((uint32_t)0x00000030U) /*!< PD[5] pin */
  2259. #define SYSCFG_EXTICR2_EXTI5_PF ((uint32_t)0x00000050U) /*!< PF[5] pin */
  2260. /**
  2261. * @brief EXTI6 configuration
  2262. */
  2263. #define SYSCFG_EXTICR2_EXTI6_PA ((uint32_t)0x00000000U) /*!< PA[6] pin */
  2264. #define SYSCFG_EXTICR2_EXTI6_PB ((uint32_t)0x00000100U) /*!< PB[6] pin */
  2265. #define SYSCFG_EXTICR2_EXTI6_PC ((uint32_t)0x00000200U) /*!< PC[6] pin */
  2266. #define SYSCFG_EXTICR2_EXTI6_PD ((uint32_t)0x00000300U) /*!< PD[6] pin */
  2267. #define SYSCFG_EXTICR2_EXTI6_PF ((uint32_t)0x00000500U) /*!< PF[6] pin */
  2268. /**
  2269. * @brief EXTI7 configuration
  2270. */
  2271. #define SYSCFG_EXTICR2_EXTI7_PA ((uint32_t)0x00000000U) /*!< PA[7] pin */
  2272. #define SYSCFG_EXTICR2_EXTI7_PB ((uint32_t)0x00001000U) /*!< PB[7] pin */
  2273. #define SYSCFG_EXTICR2_EXTI7_PC ((uint32_t)0x00002000U) /*!< PC[7] pin */
  2274. #define SYSCFG_EXTICR2_EXTI7_PD ((uint32_t)0x00003000U) /*!< PD[7] pin */
  2275. #define SYSCFG_EXTICR2_EXTI7_PF ((uint32_t)0x00005000U) /*!< PF[7] pin */
  2276. /***************** Bit definition for SYSCFG_EXTICR3 register **************/
  2277. #define SYSCFG_EXTICR3_EXTI8 ((uint32_t)0x0000000FU) /*!< EXTI 8 configuration */
  2278. #define SYSCFG_EXTICR3_EXTI9 ((uint32_t)0x000000F0U) /*!< EXTI 9 configuration */
  2279. #define SYSCFG_EXTICR3_EXTI10 ((uint32_t)0x00000F00U) /*!< EXTI 10 configuration */
  2280. #define SYSCFG_EXTICR3_EXTI11 ((uint32_t)0x0000F000U) /*!< EXTI 11 configuration */
  2281. /**
  2282. * @brief EXTI8 configuration
  2283. */
  2284. #define SYSCFG_EXTICR3_EXTI8_PA ((uint32_t)0x00000000U) /*!< PA[8] pin */
  2285. #define SYSCFG_EXTICR3_EXTI8_PB ((uint32_t)0x00000001U) /*!< PB[8] pin */
  2286. #define SYSCFG_EXTICR3_EXTI8_PC ((uint32_t)0x00000002U) /*!< PC[8] pin */
  2287. #define SYSCFG_EXTICR3_EXTI8_PD ((uint32_t)0x00000003U) /*!< PD[8] pin */
  2288. #define SYSCFG_EXTICR3_EXTI8_PF ((uint32_t)0x00000005U) /*!< PF[8] pin */
  2289. /**
  2290. * @brief EXTI9 configuration
  2291. */
  2292. #define SYSCFG_EXTICR3_EXTI9_PA ((uint32_t)0x00000000U) /*!< PA[9] pin */
  2293. #define SYSCFG_EXTICR3_EXTI9_PB ((uint32_t)0x00000010U) /*!< PB[9] pin */
  2294. #define SYSCFG_EXTICR3_EXTI9_PC ((uint32_t)0x00000020U) /*!< PC[9] pin */
  2295. #define SYSCFG_EXTICR3_EXTI9_PD ((uint32_t)0x00000030U) /*!< PD[9] pin */
  2296. #define SYSCFG_EXTICR3_EXTI9_PF ((uint32_t)0x00000050U) /*!< PF[9] pin */
  2297. /**
  2298. * @brief EXTI10 configuration
  2299. */
  2300. #define SYSCFG_EXTICR3_EXTI10_PA ((uint32_t)0x00000000U) /*!< PA[10] pin */
  2301. #define SYSCFG_EXTICR3_EXTI10_PB ((uint32_t)0x00000100U) /*!< PB[10] pin */
  2302. #define SYSCFG_EXTICR3_EXTI10_PC ((uint32_t)0x00000200U) /*!< PC[10] pin */
  2303. #define SYSCFG_EXTICR3_EXTI10_PD ((uint32_t)0x00000300U) /*!< PD[10] pin */
  2304. #define SYSCFG_EXTICR3_EXTI10_PF ((uint32_t)0x00000500U) /*!< PF[10] pin */
  2305. /**
  2306. * @brief EXTI11 configuration
  2307. */
  2308. #define SYSCFG_EXTICR3_EXTI11_PA ((uint32_t)0x00000000U) /*!< PA[11] pin */
  2309. #define SYSCFG_EXTICR3_EXTI11_PB ((uint32_t)0x00001000U) /*!< PB[11] pin */
  2310. #define SYSCFG_EXTICR3_EXTI11_PC ((uint32_t)0x00002000U) /*!< PC[11] pin */
  2311. #define SYSCFG_EXTICR3_EXTI11_PD ((uint32_t)0x00003000U) /*!< PD[11] pin */
  2312. #define SYSCFG_EXTICR3_EXTI11_PF ((uint32_t)0x00005000U) /*!< PF[11] pin */
  2313. /***************** Bit definition for SYSCFG_EXTICR4 register **************/
  2314. #define SYSCFG_EXTICR4_EXTI12 ((uint32_t)0x0000000FU) /*!< EXTI 12 configuration */
  2315. #define SYSCFG_EXTICR4_EXTI13 ((uint32_t)0x000000F0U) /*!< EXTI 13 configuration */
  2316. #define SYSCFG_EXTICR4_EXTI14 ((uint32_t)0x00000F00U) /*!< EXTI 14 configuration */
  2317. #define SYSCFG_EXTICR4_EXTI15 ((uint32_t)0x0000F000U) /*!< EXTI 15 configuration */
  2318. /**
  2319. * @brief EXTI12 configuration
  2320. */
  2321. #define SYSCFG_EXTICR4_EXTI12_PA ((uint32_t)0x00000000U) /*!< PA[12] pin */
  2322. #define SYSCFG_EXTICR4_EXTI12_PB ((uint32_t)0x00000001U) /*!< PB[12] pin */
  2323. #define SYSCFG_EXTICR4_EXTI12_PC ((uint32_t)0x00000002U) /*!< PC[12] pin */
  2324. #define SYSCFG_EXTICR4_EXTI12_PD ((uint32_t)0x00000003U) /*!< PD[12] pin */
  2325. #define SYSCFG_EXTICR4_EXTI12_PF ((uint32_t)0x00000005U) /*!< PF[12] pin */
  2326. /**
  2327. * @brief EXTI13 configuration
  2328. */
  2329. #define SYSCFG_EXTICR4_EXTI13_PA ((uint32_t)0x00000000U) /*!< PA[13] pin */
  2330. #define SYSCFG_EXTICR4_EXTI13_PB ((uint32_t)0x00000010U) /*!< PB[13] pin */
  2331. #define SYSCFG_EXTICR4_EXTI13_PC ((uint32_t)0x00000020U) /*!< PC[13] pin */
  2332. #define SYSCFG_EXTICR4_EXTI13_PD ((uint32_t)0x00000030U) /*!< PD[13] pin */
  2333. #define SYSCFG_EXTICR4_EXTI13_PF ((uint32_t)0x00000050U) /*!< PF[13] pin */
  2334. /**
  2335. * @brief EXTI14 configuration
  2336. */
  2337. #define SYSCFG_EXTICR4_EXTI14_PA ((uint32_t)0x00000000U) /*!< PA[14] pin */
  2338. #define SYSCFG_EXTICR4_EXTI14_PB ((uint32_t)0x00000100U) /*!< PB[14] pin */
  2339. #define SYSCFG_EXTICR4_EXTI14_PC ((uint32_t)0x00000200U) /*!< PC[14] pin */
  2340. #define SYSCFG_EXTICR4_EXTI14_PD ((uint32_t)0x00000300U) /*!< PD[14] pin */
  2341. #define SYSCFG_EXTICR4_EXTI14_PF ((uint32_t)0x00000500U) /*!< PF[14] pin */
  2342. /**
  2343. * @brief EXTI15 configuration
  2344. */
  2345. #define SYSCFG_EXTICR4_EXTI15_PA ((uint32_t)0x00000000U) /*!< PA[15] pin */
  2346. #define SYSCFG_EXTICR4_EXTI15_PB ((uint32_t)0x00001000U) /*!< PB[15] pin */
  2347. #define SYSCFG_EXTICR4_EXTI15_PC ((uint32_t)0x00002000U) /*!< PC[15] pin */
  2348. #define SYSCFG_EXTICR4_EXTI15_PD ((uint32_t)0x00003000U) /*!< PD[15] pin */
  2349. #define SYSCFG_EXTICR4_EXTI15_PF ((uint32_t)0x00005000U) /*!< PF[15] pin */
  2350. /***************** Bit definition for SYSCFG_CFGR2 register ****************/
  2351. #define SYSCFG_CFGR2_LOCKUP_LOCK ((uint32_t)0x00000001U) /*!< Enables and locks the LOCKUP (Hardfault) output of CortexM0 with Break Input of TIMER1 */
  2352. #define SYSCFG_CFGR2_SRAM_PARITY_LOCK ((uint32_t)0x00000002U) /*!< Enables and locks the SRAM_PARITY error signal with Break Input of TIMER1 */
  2353. #define SYSCFG_CFGR2_SRAM_PEF ((uint32_t)0x00000100U) /*!< SRAM Parity error flag */
  2354. #define SYSCFG_CFGR2_SRAM_PE SYSCFG_CFGR2_SRAM_PEF /*!< SRAM Parity error flag (define maintained for legacy purpose) */
  2355. /*****************************************************************************/
  2356. /* */
  2357. /* Timers (TIM) */
  2358. /* */
  2359. /*****************************************************************************/
  2360. /******************* Bit definition for TIM_CR1 register *******************/
  2361. #define TIM_CR1_CEN ((uint32_t)0x00000001U) /*!<Counter enable */
  2362. #define TIM_CR1_UDIS ((uint32_t)0x00000002U) /*!<Update disable */
  2363. #define TIM_CR1_URS ((uint32_t)0x00000004U) /*!<Update request source */
  2364. #define TIM_CR1_OPM ((uint32_t)0x00000008U) /*!<One pulse mode */
  2365. #define TIM_CR1_DIR ((uint32_t)0x00000010U) /*!<Direction */
  2366. #define TIM_CR1_CMS ((uint32_t)0x00000060U) /*!<CMS[1:0] bits (Center-aligned mode selection) */
  2367. #define TIM_CR1_CMS_0 ((uint32_t)0x00000020U) /*!<Bit 0 */
  2368. #define TIM_CR1_CMS_1 ((uint32_t)0x00000040U) /*!<Bit 1 */
  2369. #define TIM_CR1_ARPE ((uint32_t)0x00000080U) /*!<Auto-reload preload enable */
  2370. #define TIM_CR1_CKD ((uint32_t)0x00000300U) /*!<CKD[1:0] bits (clock division) */
  2371. #define TIM_CR1_CKD_0 ((uint32_t)0x00000100U) /*!<Bit 0 */
  2372. #define TIM_CR1_CKD_1 ((uint32_t)0x00000200U) /*!<Bit 1 */
  2373. /******************* Bit definition for TIM_CR2 register *******************/
  2374. #define TIM_CR2_CCPC ((uint32_t)0x00000001U) /*!<Capture/Compare Preloaded Control */
  2375. #define TIM_CR2_CCUS ((uint32_t)0x00000004U) /*!<Capture/Compare Control Update Selection */
  2376. #define TIM_CR2_CCDS ((uint32_t)0x00000008U) /*!<Capture/Compare DMA Selection */
  2377. #define TIM_CR2_MMS ((uint32_t)0x00000070U) /*!<MMS[2:0] bits (Master Mode Selection) */
  2378. #define TIM_CR2_MMS_0 ((uint32_t)0x00000010U) /*!<Bit 0 */
  2379. #define TIM_CR2_MMS_1 ((uint32_t)0x00000020U) /*!<Bit 1 */
  2380. #define TIM_CR2_MMS_2 ((uint32_t)0x00000040U) /*!<Bit 2 */
  2381. #define TIM_CR2_TI1S ((uint32_t)0x00000080U) /*!<TI1 Selection */
  2382. #define TIM_CR2_OIS1 ((uint32_t)0x00000100U) /*!<Output Idle state 1 (OC1 output) */
  2383. #define TIM_CR2_OIS1N ((uint32_t)0x00000200U) /*!<Output Idle state 1 (OC1N output) */
  2384. #define TIM_CR2_OIS2 ((uint32_t)0x00000400U) /*!<Output Idle state 2 (OC2 output) */
  2385. #define TIM_CR2_OIS2N ((uint32_t)0x00000800U) /*!<Output Idle state 2 (OC2N output) */
  2386. #define TIM_CR2_OIS3 ((uint32_t)0x00001000U) /*!<Output Idle state 3 (OC3 output) */
  2387. #define TIM_CR2_OIS3N ((uint32_t)0x00002000U) /*!<Output Idle state 3 (OC3N output) */
  2388. #define TIM_CR2_OIS4 ((uint32_t)0x00004000U) /*!<Output Idle state 4 (OC4 output) */
  2389. /******************* Bit definition for TIM_SMCR register ******************/
  2390. #define TIM_SMCR_SMS ((uint32_t)0x00000007U) /*!<SMS[2:0] bits (Slave mode selection) */
  2391. #define TIM_SMCR_SMS_0 ((uint32_t)0x00000001U) /*!<Bit 0 */
  2392. #define TIM_SMCR_SMS_1 ((uint32_t)0x00000002U) /*!<Bit 1 */
  2393. #define TIM_SMCR_SMS_2 ((uint32_t)0x00000004U) /*!<Bit 2 */
  2394. #define TIM_SMCR_OCCS ((uint32_t)0x00000008U) /*!< OCREF clear selection */
  2395. #define TIM_SMCR_TS ((uint32_t)0x00000070U) /*!<TS[2:0] bits (Trigger selection) */
  2396. #define TIM_SMCR_TS_0 ((uint32_t)0x00000010U) /*!<Bit 0 */
  2397. #define TIM_SMCR_TS_1 ((uint32_t)0x00000020U) /*!<Bit 1 */
  2398. #define TIM_SMCR_TS_2 ((uint32_t)0x00000040U) /*!<Bit 2 */
  2399. #define TIM_SMCR_MSM ((uint32_t)0x00000080U) /*!<Master/slave mode */
  2400. #define TIM_SMCR_ETF ((uint32_t)0x00000F00U) /*!<ETF[3:0] bits (External trigger filter) */
  2401. #define TIM_SMCR_ETF_0 ((uint32_t)0x00000100U) /*!<Bit 0 */
  2402. #define TIM_SMCR_ETF_1 ((uint32_t)0x00000200U) /*!<Bit 1 */
  2403. #define TIM_SMCR_ETF_2 ((uint32_t)0x00000400U) /*!<Bit 2 */
  2404. #define TIM_SMCR_ETF_3 ((uint32_t)0x00000800U) /*!<Bit 3 */
  2405. #define TIM_SMCR_ETPS ((uint32_t)0x00003000U) /*!<ETPS[1:0] bits (External trigger prescaler) */
  2406. #define TIM_SMCR_ETPS_0 ((uint32_t)0x00001000U) /*!<Bit 0 */
  2407. #define TIM_SMCR_ETPS_1 ((uint32_t)0x00002000U) /*!<Bit 1 */
  2408. #define TIM_SMCR_ECE ((uint32_t)0x00004000U) /*!<External clock enable */
  2409. #define TIM_SMCR_ETP ((uint32_t)0x00008000U) /*!<External trigger polarity */
  2410. /******************* Bit definition for TIM_DIER register ******************/
  2411. #define TIM_DIER_UIE ((uint32_t)0x00000001U) /*!<Update interrupt enable */
  2412. #define TIM_DIER_CC1IE ((uint32_t)0x00000002U) /*!<Capture/Compare 1 interrupt enable */
  2413. #define TIM_DIER_CC2IE ((uint32_t)0x00000004U) /*!<Capture/Compare 2 interrupt enable */
  2414. #define TIM_DIER_CC3IE ((uint32_t)0x00000008U) /*!<Capture/Compare 3 interrupt enable */
  2415. #define TIM_DIER_CC4IE ((uint32_t)0x00000010U) /*!<Capture/Compare 4 interrupt enable */
  2416. #define TIM_DIER_COMIE ((uint32_t)0x00000020U) /*!<COM interrupt enable */
  2417. #define TIM_DIER_TIE ((uint32_t)0x00000040U) /*!<Trigger interrupt enable */
  2418. #define TIM_DIER_BIE ((uint32_t)0x00000080U) /*!<Break interrupt enable */
  2419. #define TIM_DIER_UDE ((uint32_t)0x00000100U) /*!<Update DMA request enable */
  2420. #define TIM_DIER_CC1DE ((uint32_t)0x00000200U) /*!<Capture/Compare 1 DMA request enable */
  2421. #define TIM_DIER_CC2DE ((uint32_t)0x00000400U) /*!<Capture/Compare 2 DMA request enable */
  2422. #define TIM_DIER_CC3DE ((uint32_t)0x00000800U) /*!<Capture/Compare 3 DMA request enable */
  2423. #define TIM_DIER_CC4DE ((uint32_t)0x00001000U) /*!<Capture/Compare 4 DMA request enable */
  2424. #define TIM_DIER_COMDE ((uint32_t)0x00002000U) /*!<COM DMA request enable */
  2425. #define TIM_DIER_TDE ((uint32_t)0x00004000U) /*!<Trigger DMA request enable */
  2426. /******************** Bit definition for TIM_SR register *******************/
  2427. #define TIM_SR_UIF ((uint32_t)0x00000001U) /*!<Update interrupt Flag */
  2428. #define TIM_SR_CC1IF ((uint32_t)0x00000002U) /*!<Capture/Compare 1 interrupt Flag */
  2429. #define TIM_SR_CC2IF ((uint32_t)0x00000004U) /*!<Capture/Compare 2 interrupt Flag */
  2430. #define TIM_SR_CC3IF ((uint32_t)0x00000008U) /*!<Capture/Compare 3 interrupt Flag */
  2431. #define TIM_SR_CC4IF ((uint32_t)0x00000010U) /*!<Capture/Compare 4 interrupt Flag */
  2432. #define TIM_SR_COMIF ((uint32_t)0x00000020U) /*!<COM interrupt Flag */
  2433. #define TIM_SR_TIF ((uint32_t)0x00000040U) /*!<Trigger interrupt Flag */
  2434. #define TIM_SR_BIF ((uint32_t)0x00000080U) /*!<Break interrupt Flag */
  2435. #define TIM_SR_CC1OF ((uint32_t)0x00000200U) /*!<Capture/Compare 1 Overcapture Flag */
  2436. #define TIM_SR_CC2OF ((uint32_t)0x00000400U) /*!<Capture/Compare 2 Overcapture Flag */
  2437. #define TIM_SR_CC3OF ((uint32_t)0x00000800U) /*!<Capture/Compare 3 Overcapture Flag */
  2438. #define TIM_SR_CC4OF ((uint32_t)0x00001000U) /*!<Capture/Compare 4 Overcapture Flag */
  2439. /******************* Bit definition for TIM_EGR register *******************/
  2440. #define TIM_EGR_UG ((uint32_t)0x00000001U) /*!<Update Generation */
  2441. #define TIM_EGR_CC1G ((uint32_t)0x00000002U) /*!<Capture/Compare 1 Generation */
  2442. #define TIM_EGR_CC2G ((uint32_t)0x00000004U) /*!<Capture/Compare 2 Generation */
  2443. #define TIM_EGR_CC3G ((uint32_t)0x00000008U) /*!<Capture/Compare 3 Generation */
  2444. #define TIM_EGR_CC4G ((uint32_t)0x00000010U) /*!<Capture/Compare 4 Generation */
  2445. #define TIM_EGR_COMG ((uint32_t)0x00000020U) /*!<Capture/Compare Control Update Generation */
  2446. #define TIM_EGR_TG ((uint32_t)0x00000040U) /*!<Trigger Generation */
  2447. #define TIM_EGR_BG ((uint32_t)0x00000080U) /*!<Break Generation */
  2448. /****************** Bit definition for TIM_CCMR1 register ******************/
  2449. #define TIM_CCMR1_CC1S ((uint32_t)0x00000003U) /*!<CC1S[1:0] bits (Capture/Compare 1 Selection) */
  2450. #define TIM_CCMR1_CC1S_0 ((uint32_t)0x00000001U) /*!<Bit 0 */
  2451. #define TIM_CCMR1_CC1S_1 ((uint32_t)0x00000002U) /*!<Bit 1 */
  2452. #define TIM_CCMR1_OC1FE ((uint32_t)0x00000004U) /*!<Output Compare 1 Fast enable */
  2453. #define TIM_CCMR1_OC1PE ((uint32_t)0x00000008U) /*!<Output Compare 1 Preload enable */
  2454. #define TIM_CCMR1_OC1M ((uint32_t)0x00000070U) /*!<OC1M[2:0] bits (Output Compare 1 Mode) */
  2455. #define TIM_CCMR1_OC1M_0 ((uint32_t)0x00000010U) /*!<Bit 0 */
  2456. #define TIM_CCMR1_OC1M_1 ((uint32_t)0x00000020U) /*!<Bit 1 */
  2457. #define TIM_CCMR1_OC1M_2 ((uint32_t)0x00000040U) /*!<Bit 2 */
  2458. #define TIM_CCMR1_OC1CE ((uint32_t)0x00000080U) /*!<Output Compare 1Clear Enable */
  2459. #define TIM_CCMR1_CC2S ((uint32_t)0x00000300U) /*!<CC2S[1:0] bits (Capture/Compare 2 Selection) */
  2460. #define TIM_CCMR1_CC2S_0 ((uint32_t)0x00000100U) /*!<Bit 0 */
  2461. #define TIM_CCMR1_CC2S_1 ((uint32_t)0x00000200U) /*!<Bit 1 */
  2462. #define TIM_CCMR1_OC2FE ((uint32_t)0x00000400U) /*!<Output Compare 2 Fast enable */
  2463. #define TIM_CCMR1_OC2PE ((uint32_t)0x00000800U) /*!<Output Compare 2 Preload enable */
  2464. #define TIM_CCMR1_OC2M ((uint32_t)0x00007000U) /*!<OC2M[2:0] bits (Output Compare 2 Mode) */
  2465. #define TIM_CCMR1_OC2M_0 ((uint32_t)0x00001000U) /*!<Bit 0 */
  2466. #define TIM_CCMR1_OC2M_1 ((uint32_t)0x00002000U) /*!<Bit 1 */
  2467. #define TIM_CCMR1_OC2M_2 ((uint32_t)0x00004000U) /*!<Bit 2 */
  2468. #define TIM_CCMR1_OC2CE ((uint32_t)0x00008000U) /*!<Output Compare 2 Clear Enable */
  2469. /*---------------------------------------------------------------------------*/
  2470. #define TIM_CCMR1_IC1PSC ((uint32_t)0x0000000CU) /*!<IC1PSC[1:0] bits (Input Capture 1 Prescaler) */
  2471. #define TIM_CCMR1_IC1PSC_0 ((uint32_t)0x00000004U) /*!<Bit 0 */
  2472. #define TIM_CCMR1_IC1PSC_1 ((uint32_t)0x00000008U) /*!<Bit 1 */
  2473. #define TIM_CCMR1_IC1F ((uint32_t)0x000000F0U) /*!<IC1F[3:0] bits (Input Capture 1 Filter) */
  2474. #define TIM_CCMR1_IC1F_0 ((uint32_t)0x00000010U) /*!<Bit 0 */
  2475. #define TIM_CCMR1_IC1F_1 ((uint32_t)0x00000020U) /*!<Bit 1 */
  2476. #define TIM_CCMR1_IC1F_2 ((uint32_t)0x00000040U) /*!<Bit 2 */
  2477. #define TIM_CCMR1_IC1F_3 ((uint32_t)0x00000080U) /*!<Bit 3 */
  2478. #define TIM_CCMR1_IC2PSC ((uint32_t)0x00000C00U) /*!<IC2PSC[1:0] bits (Input Capture 2 Prescaler) */
  2479. #define TIM_CCMR1_IC2PSC_0 ((uint32_t)0x00000400U) /*!<Bit 0 */
  2480. #define TIM_CCMR1_IC2PSC_1 ((uint32_t)0x00000800U) /*!<Bit 1 */
  2481. #define TIM_CCMR1_IC2F ((uint32_t)0x0000F000U) /*!<IC2F[3:0] bits (Input Capture 2 Filter) */
  2482. #define TIM_CCMR1_IC2F_0 ((uint32_t)0x00001000U) /*!<Bit 0 */
  2483. #define TIM_CCMR1_IC2F_1 ((uint32_t)0x00002000U) /*!<Bit 1 */
  2484. #define TIM_CCMR1_IC2F_2 ((uint32_t)0x00004000U) /*!<Bit 2 */
  2485. #define TIM_CCMR1_IC2F_3 ((uint32_t)0x00008000U) /*!<Bit 3 */
  2486. /****************** Bit definition for TIM_CCMR2 register ******************/
  2487. #define TIM_CCMR2_CC3S ((uint32_t)0x00000003U) /*!<CC3S[1:0] bits (Capture/Compare 3 Selection) */
  2488. #define TIM_CCMR2_CC3S_0 ((uint32_t)0x00000001U) /*!<Bit 0 */
  2489. #define TIM_CCMR2_CC3S_1 ((uint32_t)0x00000002U) /*!<Bit 1 */
  2490. #define TIM_CCMR2_OC3FE ((uint32_t)0x00000004U) /*!<Output Compare 3 Fast enable */
  2491. #define TIM_CCMR2_OC3PE ((uint32_t)0x00000008U) /*!<Output Compare 3 Preload enable */
  2492. #define TIM_CCMR2_OC3M ((uint32_t)0x00000070U) /*!<OC3M[2:0] bits (Output Compare 3 Mode) */
  2493. #define TIM_CCMR2_OC3M_0 ((uint32_t)0x00000010U) /*!<Bit 0 */
  2494. #define TIM_CCMR2_OC3M_1 ((uint32_t)0x00000020U) /*!<Bit 1 */
  2495. #define TIM_CCMR2_OC3M_2 ((uint32_t)0x00000040U) /*!<Bit 2 */
  2496. #define TIM_CCMR2_OC3CE ((uint32_t)0x00000080U) /*!<Output Compare 3 Clear Enable */
  2497. #define TIM_CCMR2_CC4S ((uint32_t)0x00000300U) /*!<CC4S[1:0] bits (Capture/Compare 4 Selection) */
  2498. #define TIM_CCMR2_CC4S_0 ((uint32_t)0x00000100U) /*!<Bit 0 */
  2499. #define TIM_CCMR2_CC4S_1 ((uint32_t)0x00000200U) /*!<Bit 1 */
  2500. #define TIM_CCMR2_OC4FE ((uint32_t)0x00000400U) /*!<Output Compare 4 Fast enable */
  2501. #define TIM_CCMR2_OC4PE ((uint32_t)0x00000800U) /*!<Output Compare 4 Preload enable */
  2502. #define TIM_CCMR2_OC4M ((uint32_t)0x00007000U) /*!<OC4M[2:0] bits (Output Compare 4 Mode) */
  2503. #define TIM_CCMR2_OC4M_0 ((uint32_t)0x00001000U) /*!<Bit 0 */
  2504. #define TIM_CCMR2_OC4M_1 ((uint32_t)0x00002000U) /*!<Bit 1 */
  2505. #define TIM_CCMR2_OC4M_2 ((uint32_t)0x00004000U) /*!<Bit 2 */
  2506. #define TIM_CCMR2_OC4CE ((uint32_t)0x00008000U) /*!<Output Compare 4 Clear Enable */
  2507. /*---------------------------------------------------------------------------*/
  2508. #define TIM_CCMR2_IC3PSC ((uint32_t)0x0000000CU) /*!<IC3PSC[1:0] bits (Input Capture 3 Prescaler) */
  2509. #define TIM_CCMR2_IC3PSC_0 ((uint32_t)0x00000004U) /*!<Bit 0 */
  2510. #define TIM_CCMR2_IC3PSC_1 ((uint32_t)0x00000008U) /*!<Bit 1 */
  2511. #define TIM_CCMR2_IC3F ((uint32_t)0x000000F0U) /*!<IC3F[3:0] bits (Input Capture 3 Filter) */
  2512. #define TIM_CCMR2_IC3F_0 ((uint32_t)0x00000010U) /*!<Bit 0 */
  2513. #define TIM_CCMR2_IC3F_1 ((uint32_t)0x00000020U) /*!<Bit 1 */
  2514. #define TIM_CCMR2_IC3F_2 ((uint32_t)0x00000040U) /*!<Bit 2 */
  2515. #define TIM_CCMR2_IC3F_3 ((uint32_t)0x00000080U) /*!<Bit 3 */
  2516. #define TIM_CCMR2_IC4PSC ((uint32_t)0x00000C00U) /*!<IC4PSC[1:0] bits (Input Capture 4 Prescaler) */
  2517. #define TIM_CCMR2_IC4PSC_0 ((uint32_t)0x00000400U) /*!<Bit 0 */
  2518. #define TIM_CCMR2_IC4PSC_1 ((uint32_t)0x00000800U) /*!<Bit 1 */
  2519. #define TIM_CCMR2_IC4F ((uint32_t)0x0000F000U) /*!<IC4F[3:0] bits (Input Capture 4 Filter) */
  2520. #define TIM_CCMR2_IC4F_0 ((uint32_t)0x00001000U) /*!<Bit 0 */
  2521. #define TIM_CCMR2_IC4F_1 ((uint32_t)0x00002000U) /*!<Bit 1 */
  2522. #define TIM_CCMR2_IC4F_2 ((uint32_t)0x00004000U) /*!<Bit 2 */
  2523. #define TIM_CCMR2_IC4F_3 ((uint32_t)0x00008000U) /*!<Bit 3 */
  2524. /******************* Bit definition for TIM_CCER register ******************/
  2525. #define TIM_CCER_CC1E ((uint32_t)0x00000001U) /*!<Capture/Compare 1 output enable */
  2526. #define TIM_CCER_CC1P ((uint32_t)0x00000002U) /*!<Capture/Compare 1 output Polarity */
  2527. #define TIM_CCER_CC1NE ((uint32_t)0x00000004U) /*!<Capture/Compare 1 Complementary output enable */
  2528. #define TIM_CCER_CC1NP ((uint32_t)0x00000008U) /*!<Capture/Compare 1 Complementary output Polarity */
  2529. #define TIM_CCER_CC2E ((uint32_t)0x00000010U) /*!<Capture/Compare 2 output enable */
  2530. #define TIM_CCER_CC2P ((uint32_t)0x00000020U) /*!<Capture/Compare 2 output Polarity */
  2531. #define TIM_CCER_CC2NE ((uint32_t)0x00000040U) /*!<Capture/Compare 2 Complementary output enable */
  2532. #define TIM_CCER_CC2NP ((uint32_t)0x00000080U) /*!<Capture/Compare 2 Complementary output Polarity */
  2533. #define TIM_CCER_CC3E ((uint32_t)0x00000100U) /*!<Capture/Compare 3 output enable */
  2534. #define TIM_CCER_CC3P ((uint32_t)0x00000200U) /*!<Capture/Compare 3 output Polarity */
  2535. #define TIM_CCER_CC3NE ((uint32_t)0x00000400U) /*!<Capture/Compare 3 Complementary output enable */
  2536. #define TIM_CCER_CC3NP ((uint32_t)0x00000800U) /*!<Capture/Compare 3 Complementary output Polarity */
  2537. #define TIM_CCER_CC4E ((uint32_t)0x00001000U) /*!<Capture/Compare 4 output enable */
  2538. #define TIM_CCER_CC4P ((uint32_t)0x00002000U) /*!<Capture/Compare 4 output Polarity */
  2539. #define TIM_CCER_CC4NP ((uint32_t)0x00008000U) /*!<Capture/Compare 4 Complementary output Polarity */
  2540. /******************* Bit definition for TIM_CNT register *******************/
  2541. #define TIM_CNT_CNT ((uint32_t)0xFFFFFFFFU) /*!<Counter Value */
  2542. /******************* Bit definition for TIM_PSC register *******************/
  2543. #define TIM_PSC_PSC ((uint32_t)0x0000FFFFU) /*!<Prescaler Value */
  2544. /******************* Bit definition for TIM_ARR register *******************/
  2545. #define TIM_ARR_ARR ((uint32_t)0xFFFFFFFFU) /*!<actual auto-reload Value */
  2546. /******************* Bit definition for TIM_RCR register *******************/
  2547. #define TIM_RCR_REP ((uint32_t)0x000000FFU) /*!<Repetition Counter Value */
  2548. /******************* Bit definition for TIM_CCR1 register ******************/
  2549. #define TIM_CCR1_CCR1 ((uint32_t)0x0000FFFFU) /*!<Capture/Compare 1 Value */
  2550. /******************* Bit definition for TIM_CCR2 register ******************/
  2551. #define TIM_CCR2_CCR2 ((uint32_t)0x0000FFFFU) /*!<Capture/Compare 2 Value */
  2552. /******************* Bit definition for TIM_CCR3 register ******************/
  2553. #define TIM_CCR3_CCR3 ((uint32_t)0x0000FFFFU) /*!<Capture/Compare 3 Value */
  2554. /******************* Bit definition for TIM_CCR4 register ******************/
  2555. #define TIM_CCR4_CCR4 ((uint32_t)0x0000FFFFU) /*!<Capture/Compare 4 Value */
  2556. /******************* Bit definition for TIM_BDTR register ******************/
  2557. #define TIM_BDTR_DTG ((uint32_t)0x000000FFU) /*!<DTG[0:7] bits (Dead-Time Generator set-up) */
  2558. #define TIM_BDTR_DTG_0 ((uint32_t)0x00000001U) /*!<Bit 0 */
  2559. #define TIM_BDTR_DTG_1 ((uint32_t)0x00000002U) /*!<Bit 1 */
  2560. #define TIM_BDTR_DTG_2 ((uint32_t)0x00000004U) /*!<Bit 2 */
  2561. #define TIM_BDTR_DTG_3 ((uint32_t)0x00000008U) /*!<Bit 3 */
  2562. #define TIM_BDTR_DTG_4 ((uint32_t)0x00000010U) /*!<Bit 4 */
  2563. #define TIM_BDTR_DTG_5 ((uint32_t)0x00000020U) /*!<Bit 5 */
  2564. #define TIM_BDTR_DTG_6 ((uint32_t)0x00000040U) /*!<Bit 6 */
  2565. #define TIM_BDTR_DTG_7 ((uint32_t)0x00000080U) /*!<Bit 7 */
  2566. #define TIM_BDTR_LOCK ((uint32_t)0x00000300U) /*!<LOCK[1:0] bits (Lock Configuration) */
  2567. #define TIM_BDTR_LOCK_0 ((uint32_t)0x00000100U) /*!<Bit 0 */
  2568. #define TIM_BDTR_LOCK_1 ((uint32_t)0x00000200U) /*!<Bit 1 */
  2569. #define TIM_BDTR_OSSI ((uint32_t)0x00000400U) /*!<Off-State Selection for Idle mode */
  2570. #define TIM_BDTR_OSSR ((uint32_t)0x00000800U) /*!<Off-State Selection for Run mode */
  2571. #define TIM_BDTR_BKE ((uint32_t)0x00001000U) /*!<Break enable */
  2572. #define TIM_BDTR_BKP ((uint32_t)0x00002000U) /*!<Break Polarity */
  2573. #define TIM_BDTR_AOE ((uint32_t)0x00004000U) /*!<Automatic Output enable */
  2574. #define TIM_BDTR_MOE ((uint32_t)0x00008000U) /*!<Main Output enable */
  2575. /******************* Bit definition for TIM_DCR register *******************/
  2576. #define TIM_DCR_DBA ((uint32_t)0x0000001FU) /*!<DBA[4:0] bits (DMA Base Address) */
  2577. #define TIM_DCR_DBA_0 ((uint32_t)0x00000001U) /*!<Bit 0 */
  2578. #define TIM_DCR_DBA_1 ((uint32_t)0x00000002U) /*!<Bit 1 */
  2579. #define TIM_DCR_DBA_2 ((uint32_t)0x00000004U) /*!<Bit 2 */
  2580. #define TIM_DCR_DBA_3 ((uint32_t)0x00000008U) /*!<Bit 3 */
  2581. #define TIM_DCR_DBA_4 ((uint32_t)0x00000010U) /*!<Bit 4 */
  2582. #define TIM_DCR_DBL ((uint32_t)0x00001F00U) /*!<DBL[4:0] bits (DMA Burst Length) */
  2583. #define TIM_DCR_DBL_0 ((uint32_t)0x00000100U) /*!<Bit 0 */
  2584. #define TIM_DCR_DBL_1 ((uint32_t)0x00000200U) /*!<Bit 1 */
  2585. #define TIM_DCR_DBL_2 ((uint32_t)0x00000400U) /*!<Bit 2 */
  2586. #define TIM_DCR_DBL_3 ((uint32_t)0x00000800U) /*!<Bit 3 */
  2587. #define TIM_DCR_DBL_4 ((uint32_t)0x00001000U) /*!<Bit 4 */
  2588. /******************* Bit definition for TIM_DMAR register ******************/
  2589. #define TIM_DMAR_DMAB ((uint32_t)0x0000FFFFU) /*!<DMA register for burst accesses */
  2590. /******************* Bit definition for TIM14_OR register ********************/
  2591. #define TIM14_OR_TI1_RMP ((uint32_t)0x00000003U) /*!<TI1_RMP[1:0] bits (TIM14 Input 4 remap) */
  2592. #define TIM14_OR_TI1_RMP_0 ((uint32_t)0x00000001U) /*!<Bit 0 */
  2593. #define TIM14_OR_TI1_RMP_1 ((uint32_t)0x00000002U) /*!<Bit 1 */
  2594. /******************************************************************************/
  2595. /* */
  2596. /* Universal Synchronous Asynchronous Receiver Transmitter (USART) */
  2597. /* */
  2598. /******************************************************************************/
  2599. /****************** Bit definition for USART_CR1 register *******************/
  2600. #define USART_CR1_UE ((uint32_t)0x00000001U) /*!< USART Enable */
  2601. #define USART_CR1_RE ((uint32_t)0x00000004U) /*!< Receiver Enable */
  2602. #define USART_CR1_TE ((uint32_t)0x00000008U) /*!< Transmitter Enable */
  2603. #define USART_CR1_IDLEIE ((uint32_t)0x00000010U) /*!< IDLE Interrupt Enable */
  2604. #define USART_CR1_RXNEIE ((uint32_t)0x00000020U) /*!< RXNE Interrupt Enable */
  2605. #define USART_CR1_TCIE ((uint32_t)0x00000040U) /*!< Transmission Complete Interrupt Enable */
  2606. #define USART_CR1_TXEIE ((uint32_t)0x00000080U) /*!< TXE Interrupt Enable */
  2607. #define USART_CR1_PEIE ((uint32_t)0x00000100U) /*!< PE Interrupt Enable */
  2608. #define USART_CR1_PS ((uint32_t)0x00000200U) /*!< Parity Selection */
  2609. #define USART_CR1_PCE ((uint32_t)0x00000400U) /*!< Parity Control Enable */
  2610. #define USART_CR1_WAKE ((uint32_t)0x00000800U) /*!< Receiver Wakeup method */
  2611. #define USART_CR1_M ((uint32_t)0x00001000U) /*!< Word Length */
  2612. #define USART_CR1_MME ((uint32_t)0x00002000U) /*!< Mute Mode Enable */
  2613. #define USART_CR1_CMIE ((uint32_t)0x00004000U) /*!< Character match interrupt enable */
  2614. #define USART_CR1_OVER8 ((uint32_t)0x00008000U) /*!< Oversampling by 8-bit or 16-bit mode */
  2615. #define USART_CR1_DEDT ((uint32_t)0x001F0000U) /*!< DEDT[4:0] bits (Driver Enable Deassertion Time) */
  2616. #define USART_CR1_DEDT_0 ((uint32_t)0x00010000U) /*!< Bit 0 */
  2617. #define USART_CR1_DEDT_1 ((uint32_t)0x00020000U) /*!< Bit 1 */
  2618. #define USART_CR1_DEDT_2 ((uint32_t)0x00040000U) /*!< Bit 2 */
  2619. #define USART_CR1_DEDT_3 ((uint32_t)0x00080000U) /*!< Bit 3 */
  2620. #define USART_CR1_DEDT_4 ((uint32_t)0x00100000U) /*!< Bit 4 */
  2621. #define USART_CR1_DEAT ((uint32_t)0x03E00000U) /*!< DEAT[4:0] bits (Driver Enable Assertion Time) */
  2622. #define USART_CR1_DEAT_0 ((uint32_t)0x00200000U) /*!< Bit 0 */
  2623. #define USART_CR1_DEAT_1 ((uint32_t)0x00400000U) /*!< Bit 1 */
  2624. #define USART_CR1_DEAT_2 ((uint32_t)0x00800000U) /*!< Bit 2 */
  2625. #define USART_CR1_DEAT_3 ((uint32_t)0x01000000U) /*!< Bit 3 */
  2626. #define USART_CR1_DEAT_4 ((uint32_t)0x02000000U) /*!< Bit 4 */
  2627. #define USART_CR1_RTOIE ((uint32_t)0x04000000U) /*!< Receive Time Out interrupt enable */
  2628. #define USART_CR1_EOBIE ((uint32_t)0x08000000U) /*!< End of Block interrupt enable */
  2629. /****************** Bit definition for USART_CR2 register *******************/
  2630. #define USART_CR2_ADDM7 ((uint32_t)0x00000010U) /*!< 7-bit or 4-bit Address Detection */
  2631. #define USART_CR2_LBCL ((uint32_t)0x00000100U) /*!< Last Bit Clock pulse */
  2632. #define USART_CR2_CPHA ((uint32_t)0x00000200U) /*!< Clock Phase */
  2633. #define USART_CR2_CPOL ((uint32_t)0x00000400U) /*!< Clock Polarity */
  2634. #define USART_CR2_CLKEN ((uint32_t)0x00000800U) /*!< Clock Enable */
  2635. #define USART_CR2_STOP ((uint32_t)0x00003000U) /*!< STOP[1:0] bits (STOP bits) */
  2636. #define USART_CR2_STOP_0 ((uint32_t)0x00001000U) /*!< Bit 0 */
  2637. #define USART_CR2_STOP_1 ((uint32_t)0x00002000U) /*!< Bit 1 */
  2638. #define USART_CR2_SWAP ((uint32_t)0x00008000U) /*!< SWAP TX/RX pins */
  2639. #define USART_CR2_RXINV ((uint32_t)0x00010000U) /*!< RX pin active level inversion */
  2640. #define USART_CR2_TXINV ((uint32_t)0x00020000U) /*!< TX pin active level inversion */
  2641. #define USART_CR2_DATAINV ((uint32_t)0x00040000U) /*!< Binary data inversion */
  2642. #define USART_CR2_MSBFIRST ((uint32_t)0x00080000U) /*!< Most Significant Bit First */
  2643. #define USART_CR2_ABREN ((uint32_t)0x00100000U) /*!< Auto Baud-Rate Enable*/
  2644. #define USART_CR2_ABRMODE ((uint32_t)0x00600000U) /*!< ABRMOD[1:0] bits (Auto Baud-Rate Mode) */
  2645. #define USART_CR2_ABRMODE_0 ((uint32_t)0x00200000U) /*!< Bit 0 */
  2646. #define USART_CR2_ABRMODE_1 ((uint32_t)0x00400000U) /*!< Bit 1 */
  2647. #define USART_CR2_RTOEN ((uint32_t)0x00800000U) /*!< Receiver Time-Out enable */
  2648. #define USART_CR2_ADD ((uint32_t)0xFF000000U) /*!< Address of the USART node */
  2649. /****************** Bit definition for USART_CR3 register *******************/
  2650. #define USART_CR3_EIE ((uint32_t)0x00000001U) /*!< Error Interrupt Enable */
  2651. #define USART_CR3_HDSEL ((uint32_t)0x00000008U) /*!< Half-Duplex Selection */
  2652. #define USART_CR3_DMAR ((uint32_t)0x00000040U) /*!< DMA Enable Receiver */
  2653. #define USART_CR3_DMAT ((uint32_t)0x00000080U) /*!< DMA Enable Transmitter */
  2654. #define USART_CR3_RTSE ((uint32_t)0x00000100U) /*!< RTS Enable */
  2655. #define USART_CR3_CTSE ((uint32_t)0x00000200U) /*!< CTS Enable */
  2656. #define USART_CR3_CTSIE ((uint32_t)0x00000400U) /*!< CTS Interrupt Enable */
  2657. #define USART_CR3_ONEBIT ((uint32_t)0x00000800U) /*!< One sample bit method enable */
  2658. #define USART_CR3_OVRDIS ((uint32_t)0x00001000U) /*!< Overrun Disable */
  2659. #define USART_CR3_DDRE ((uint32_t)0x00002000U) /*!< DMA Disable on Reception Error */
  2660. #define USART_CR3_DEM ((uint32_t)0x00004000U) /*!< Driver Enable Mode */
  2661. #define USART_CR3_DEP ((uint32_t)0x00008000U) /*!< Driver Enable Polarity Selection */
  2662. /****************** Bit definition for USART_BRR register *******************/
  2663. #define USART_BRR_DIV_FRACTION ((uint32_t)0x0000000FU) /*!< Fraction of USARTDIV */
  2664. #define USART_BRR_DIV_MANTISSA ((uint32_t)0x0000FFF0U) /*!< Mantissa of USARTDIV */
  2665. /****************** Bit definition for USART_GTPR register ******************/
  2666. #define USART_GTPR_PSC ((uint32_t)0x000000FFU) /*!< PSC[7:0] bits (Prescaler value) */
  2667. #define USART_GTPR_GT ((uint32_t)0x0000FF00U) /*!< GT[7:0] bits (Guard time value) */
  2668. /******************* Bit definition for USART_RTOR register *****************/
  2669. #define USART_RTOR_RTO ((uint32_t)0x00FFFFFFU) /*!< Receiver Time Out Value */
  2670. #define USART_RTOR_BLEN ((uint32_t)0xFF000000U) /*!< Block Length */
  2671. /******************* Bit definition for USART_RQR register ******************/
  2672. #define USART_RQR_ABRRQ ((uint32_t)0x00000001U) /*!< Auto-Baud Rate Request */
  2673. #define USART_RQR_SBKRQ ((uint32_t)0x00000002U) /*!< Send Break Request */
  2674. #define USART_RQR_MMRQ ((uint32_t)0x00000004U) /*!< Mute Mode Request */
  2675. #define USART_RQR_RXFRQ ((uint32_t)0x00000008U) /*!< Receive Data flush Request */
  2676. /******************* Bit definition for USART_ISR register ******************/
  2677. #define USART_ISR_PE ((uint32_t)0x00000001U) /*!< Parity Error */
  2678. #define USART_ISR_FE ((uint32_t)0x00000002U) /*!< Framing Error */
  2679. #define USART_ISR_NE ((uint32_t)0x00000004U) /*!< Noise detected Flag */
  2680. #define USART_ISR_ORE ((uint32_t)0x00000008U) /*!< OverRun Error */
  2681. #define USART_ISR_IDLE ((uint32_t)0x00000010U) /*!< IDLE line detected */
  2682. #define USART_ISR_RXNE ((uint32_t)0x00000020U) /*!< Read Data Register Not Empty */
  2683. #define USART_ISR_TC ((uint32_t)0x00000040U) /*!< Transmission Complete */
  2684. #define USART_ISR_TXE ((uint32_t)0x00000080U) /*!< Transmit Data Register Empty */
  2685. #define USART_ISR_CTSIF ((uint32_t)0x00000200U) /*!< CTS interrupt flag */
  2686. #define USART_ISR_CTS ((uint32_t)0x00000400U) /*!< CTS flag */
  2687. #define USART_ISR_RTOF ((uint32_t)0x00000800U) /*!< Receiver Time Out */
  2688. #define USART_ISR_ABRE ((uint32_t)0x00004000U) /*!< Auto-Baud Rate Error */
  2689. #define USART_ISR_ABRF ((uint32_t)0x00008000U) /*!< Auto-Baud Rate Flag */
  2690. #define USART_ISR_BUSY ((uint32_t)0x00010000U) /*!< Busy Flag */
  2691. #define USART_ISR_CMF ((uint32_t)0x00020000U) /*!< Character Match Flag */
  2692. #define USART_ISR_SBKF ((uint32_t)0x00040000U) /*!< Send Break Flag */
  2693. #define USART_ISR_TEACK ((uint32_t)0x00200000U) /*!< Transmit Enable Acknowledge Flag */
  2694. #define USART_ISR_REACK ((uint32_t)0x00400000U) /*!< Receive Enable Acknowledge Flag */
  2695. /******************* Bit definition for USART_ICR register ******************/
  2696. #define USART_ICR_PECF ((uint32_t)0x00000001U) /*!< Parity Error Clear Flag */
  2697. #define USART_ICR_FECF ((uint32_t)0x00000002U) /*!< Framing Error Clear Flag */
  2698. #define USART_ICR_NCF ((uint32_t)0x00000004U) /*!< Noise detected Clear Flag */
  2699. #define USART_ICR_ORECF ((uint32_t)0x00000008U) /*!< OverRun Error Clear Flag */
  2700. #define USART_ICR_IDLECF ((uint32_t)0x00000010U) /*!< IDLE line detected Clear Flag */
  2701. #define USART_ICR_TCCF ((uint32_t)0x00000040U) /*!< Transmission Complete Clear Flag */
  2702. #define USART_ICR_CTSCF ((uint32_t)0x00000200U) /*!< CTS Interrupt Clear Flag */
  2703. #define USART_ICR_RTOCF ((uint32_t)0x00000800U) /*!< Receiver Time Out Clear Flag */
  2704. #define USART_ICR_CMCF ((uint32_t)0x00020000U) /*!< Character Match Clear Flag */
  2705. /******************* Bit definition for USART_RDR register ******************/
  2706. #define USART_RDR_RDR ((uint16_t)0x01FFU) /*!< RDR[8:0] bits (Receive Data value) */
  2707. /******************* Bit definition for USART_TDR register ******************/
  2708. #define USART_TDR_TDR ((uint16_t)0x01FFU) /*!< TDR[8:0] bits (Transmit Data value) */
  2709. /******************************************************************************/
  2710. /* */
  2711. /* Window WATCHDOG (WWDG) */
  2712. /* */
  2713. /******************************************************************************/
  2714. /******************* Bit definition for WWDG_CR register ********************/
  2715. #define WWDG_CR_T ((uint32_t)0x0000007FU) /*!< T[6:0] bits (7-Bit counter (MSB to LSB)) */
  2716. #define WWDG_CR_T_0 ((uint32_t)0x00000001U) /*!< Bit 0 */
  2717. #define WWDG_CR_T_1 ((uint32_t)0x00000002U) /*!< Bit 1 */
  2718. #define WWDG_CR_T_2 ((uint32_t)0x00000004U) /*!< Bit 2 */
  2719. #define WWDG_CR_T_3 ((uint32_t)0x00000008U) /*!< Bit 3 */
  2720. #define WWDG_CR_T_4 ((uint32_t)0x00000010U) /*!< Bit 4 */
  2721. #define WWDG_CR_T_5 ((uint32_t)0x00000020U) /*!< Bit 5 */
  2722. #define WWDG_CR_T_6 ((uint32_t)0x00000040U) /*!< Bit 6 */
  2723. /* Legacy defines */
  2724. #define WWDG_CR_T0 WWDG_CR_T_0
  2725. #define WWDG_CR_T1 WWDG_CR_T_1
  2726. #define WWDG_CR_T2 WWDG_CR_T_2
  2727. #define WWDG_CR_T3 WWDG_CR_T_3
  2728. #define WWDG_CR_T4 WWDG_CR_T_4
  2729. #define WWDG_CR_T5 WWDG_CR_T_5
  2730. #define WWDG_CR_T6 WWDG_CR_T_6
  2731. #define WWDG_CR_WDGA ((uint32_t)0x00000080U) /*!< Activation bit */
  2732. /******************* Bit definition for WWDG_CFR register *******************/
  2733. #define WWDG_CFR_W ((uint32_t)0x0000007FU) /*!< W[6:0] bits (7-bit window value) */
  2734. #define WWDG_CFR_W_0 ((uint32_t)0x00000001U) /*!< Bit 0 */
  2735. #define WWDG_CFR_W_1 ((uint32_t)0x00000002U) /*!< Bit 1 */
  2736. #define WWDG_CFR_W_2 ((uint32_t)0x00000004U) /*!< Bit 2 */
  2737. #define WWDG_CFR_W_3 ((uint32_t)0x00000008U) /*!< Bit 3 */
  2738. #define WWDG_CFR_W_4 ((uint32_t)0x00000010U) /*!< Bit 4 */
  2739. #define WWDG_CFR_W_5 ((uint32_t)0x00000020U) /*!< Bit 5 */
  2740. #define WWDG_CFR_W_6 ((uint32_t)0x00000040U) /*!< Bit 6 */
  2741. /* Legacy defines */
  2742. #define WWDG_CFR_W0 WWDG_CFR_W_0
  2743. #define WWDG_CFR_W1 WWDG_CFR_W_1
  2744. #define WWDG_CFR_W2 WWDG_CFR_W_2
  2745. #define WWDG_CFR_W3 WWDG_CFR_W_3
  2746. #define WWDG_CFR_W4 WWDG_CFR_W_4
  2747. #define WWDG_CFR_W5 WWDG_CFR_W_5
  2748. #define WWDG_CFR_W6 WWDG_CFR_W_6
  2749. #define WWDG_CFR_WDGTB ((uint32_t)0x00000180U) /*!< WDGTB[1:0] bits (Timer Base) */
  2750. #define WWDG_CFR_WDGTB_0 ((uint32_t)0x00000080U) /*!< Bit 0 */
  2751. #define WWDG_CFR_WDGTB_1 ((uint32_t)0x00000100U) /*!< Bit 1 */
  2752. /* Legacy defines */
  2753. #define WWDG_CFR_WDGTB0 WWDG_CFR_WDGTB_0
  2754. #define WWDG_CFR_WDGTB1 WWDG_CFR_WDGTB_1
  2755. #define WWDG_CFR_EWI ((uint32_t)0x00000200U) /*!< Early Wakeup Interrupt */
  2756. /******************* Bit definition for WWDG_SR register ********************/
  2757. #define WWDG_SR_EWIF ((uint32_t)0x00000001U) /*!< Early Wakeup Interrupt Flag */
  2758. /**
  2759. * @}
  2760. */
  2761. /**
  2762. * @}
  2763. */
  2764. /** @addtogroup Exported_macro
  2765. * @{
  2766. */
  2767. /****************************** ADC Instances *********************************/
  2768. #define IS_ADC_ALL_INSTANCE(INSTANCE) ((INSTANCE) == ADC1)
  2769. #define IS_ADC_COMMON_INSTANCE(INSTANCE) ((INSTANCE) == ADC)
  2770. /****************************** CRC Instances *********************************/
  2771. #define IS_CRC_ALL_INSTANCE(INSTANCE) ((INSTANCE) == CRC)
  2772. /******************************* DMA Instances ********************************/
  2773. #define IS_DMA_ALL_INSTANCE(INSTANCE) (((INSTANCE) == DMA1_Channel1) || \
  2774. ((INSTANCE) == DMA1_Channel2) || \
  2775. ((INSTANCE) == DMA1_Channel3) || \
  2776. ((INSTANCE) == DMA1_Channel4) || \
  2777. ((INSTANCE) == DMA1_Channel5))
  2778. /****************************** GPIO Instances ********************************/
  2779. #define IS_GPIO_ALL_INSTANCE(INSTANCE) (((INSTANCE) == GPIOA) || \
  2780. ((INSTANCE) == GPIOB) || \
  2781. ((INSTANCE) == GPIOC) || \
  2782. ((INSTANCE) == GPIOD) || \
  2783. ((INSTANCE) == GPIOF))
  2784. /**************************** GPIO Alternate Function Instances ***************/
  2785. #define IS_GPIO_AF_INSTANCE(INSTANCE) (((INSTANCE) == GPIOA) || \
  2786. ((INSTANCE) == GPIOB))
  2787. /****************************** GPIO Lock Instances ***************************/
  2788. #define IS_GPIO_LOCK_INSTANCE(INSTANCE) (((INSTANCE) == GPIOA) || \
  2789. ((INSTANCE) == GPIOB))
  2790. /****************************** I2C Instances *********************************/
  2791. #define IS_I2C_ALL_INSTANCE(INSTANCE) ((INSTANCE) == I2C1)
  2792. /****************************** IWDG Instances ********************************/
  2793. #define IS_IWDG_ALL_INSTANCE(INSTANCE) ((INSTANCE) == IWDG)
  2794. /****************************** RTC Instances *********************************/
  2795. #define IS_RTC_ALL_INSTANCE(INSTANCE) ((INSTANCE) == RTC)
  2796. /****************************** SMBUS Instances *********************************/
  2797. #define IS_SMBUS_ALL_INSTANCE(INSTANCE) ((INSTANCE) == I2C1)
  2798. /****************************** SPI Instances *********************************/
  2799. #define IS_SPI_ALL_INSTANCE(INSTANCE) ((INSTANCE) == SPI1)
  2800. /****************************** TIM Instances *********************************/
  2801. #define IS_TIM_INSTANCE(INSTANCE)\
  2802. (((INSTANCE) == TIM1) || \
  2803. ((INSTANCE) == TIM3) || \
  2804. ((INSTANCE) == TIM14) || \
  2805. ((INSTANCE) == TIM16) || \
  2806. ((INSTANCE) == TIM17))
  2807. #define IS_TIM_CC1_INSTANCE(INSTANCE)\
  2808. (((INSTANCE) == TIM1) || \
  2809. ((INSTANCE) == TIM3) || \
  2810. ((INSTANCE) == TIM14) || \
  2811. ((INSTANCE) == TIM16) || \
  2812. ((INSTANCE) == TIM17))
  2813. #define IS_TIM_CC2_INSTANCE(INSTANCE)\
  2814. (((INSTANCE) == TIM1) || \
  2815. ((INSTANCE) == TIM3))
  2816. #define IS_TIM_CC3_INSTANCE(INSTANCE)\
  2817. (((INSTANCE) == TIM1) || \
  2818. ((INSTANCE) == TIM3))
  2819. #define IS_TIM_CC4_INSTANCE(INSTANCE)\
  2820. (((INSTANCE) == TIM1) || \
  2821. ((INSTANCE) == TIM3))
  2822. #define IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE(INSTANCE)\
  2823. (((INSTANCE) == TIM1) || \
  2824. ((INSTANCE) == TIM3))
  2825. #define IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(INSTANCE)\
  2826. (((INSTANCE) == TIM1) || \
  2827. ((INSTANCE) == TIM3))
  2828. #define IS_TIM_CLOCKSOURCE_TIX_INSTANCE(INSTANCE)\
  2829. (((INSTANCE) == TIM1) || \
  2830. ((INSTANCE) == TIM3))
  2831. #define IS_TIM_CLOCKSOURCE_ITRX_INSTANCE(INSTANCE)\
  2832. (((INSTANCE) == TIM1) || \
  2833. ((INSTANCE) == TIM3))
  2834. #define IS_TIM_OCXREF_CLEAR_INSTANCE(INSTANCE)\
  2835. (((INSTANCE) == TIM1) || \
  2836. ((INSTANCE) == TIM3))
  2837. #define IS_TIM_ENCODER_INTERFACE_INSTANCE(INSTANCE)\
  2838. (((INSTANCE) == TIM1) || \
  2839. ((INSTANCE) == TIM3))
  2840. #define IS_TIM_HALL_INTERFACE_INSTANCE(INSTANCE)\
  2841. (((INSTANCE) == TIM1))
  2842. #define IS_TIM_XOR_INSTANCE(INSTANCE)\
  2843. (((INSTANCE) == TIM1) || \
  2844. ((INSTANCE) == TIM3))
  2845. #define IS_TIM_MASTER_INSTANCE(INSTANCE)\
  2846. (((INSTANCE) == TIM1) || \
  2847. ((INSTANCE) == TIM3))
  2848. #define IS_TIM_SLAVE_INSTANCE(INSTANCE)\
  2849. (((INSTANCE) == TIM1) || \
  2850. ((INSTANCE) == TIM3))
  2851. #define IS_TIM_32B_COUNTER_INSTANCE(INSTANCE) (0)
  2852. #define IS_TIM_DMABURST_INSTANCE(INSTANCE)\
  2853. (((INSTANCE) == TIM1) || \
  2854. ((INSTANCE) == TIM3) || \
  2855. ((INSTANCE) == TIM16) || \
  2856. ((INSTANCE) == TIM17))
  2857. #define IS_TIM_BREAK_INSTANCE(INSTANCE)\
  2858. (((INSTANCE) == TIM1) || \
  2859. ((INSTANCE) == TIM16) || \
  2860. ((INSTANCE) == TIM17))
  2861. #define IS_TIM_CCX_INSTANCE(INSTANCE, CHANNEL) \
  2862. ((((INSTANCE) == TIM1) && \
  2863. (((CHANNEL) == TIM_CHANNEL_1) || \
  2864. ((CHANNEL) == TIM_CHANNEL_2) || \
  2865. ((CHANNEL) == TIM_CHANNEL_3) || \
  2866. ((CHANNEL) == TIM_CHANNEL_4))) \
  2867. || \
  2868. (((INSTANCE) == TIM3) && \
  2869. (((CHANNEL) == TIM_CHANNEL_1) || \
  2870. ((CHANNEL) == TIM_CHANNEL_2) || \
  2871. ((CHANNEL) == TIM_CHANNEL_3) || \
  2872. ((CHANNEL) == TIM_CHANNEL_4))) \
  2873. || \
  2874. (((INSTANCE) == TIM14) && \
  2875. (((CHANNEL) == TIM_CHANNEL_1))) \
  2876. || \
  2877. (((INSTANCE) == TIM16) && \
  2878. (((CHANNEL) == TIM_CHANNEL_1))) \
  2879. || \
  2880. (((INSTANCE) == TIM17) && \
  2881. (((CHANNEL) == TIM_CHANNEL_1))))
  2882. #define IS_TIM_CCXN_INSTANCE(INSTANCE, CHANNEL) \
  2883. ((((INSTANCE) == TIM1) && \
  2884. (((CHANNEL) == TIM_CHANNEL_1) || \
  2885. ((CHANNEL) == TIM_CHANNEL_2) || \
  2886. ((CHANNEL) == TIM_CHANNEL_3))) \
  2887. || \
  2888. (((INSTANCE) == TIM16) && \
  2889. ((CHANNEL) == TIM_CHANNEL_1)) \
  2890. || \
  2891. (((INSTANCE) == TIM17) && \
  2892. ((CHANNEL) == TIM_CHANNEL_1)))
  2893. #define IS_TIM_COUNTER_MODE_SELECT_INSTANCE(INSTANCE)\
  2894. (((INSTANCE) == TIM1) || \
  2895. ((INSTANCE) == TIM3))
  2896. #define IS_TIM_REPETITION_COUNTER_INSTANCE(INSTANCE)\
  2897. (((INSTANCE) == TIM1) || \
  2898. ((INSTANCE) == TIM16) || \
  2899. ((INSTANCE) == TIM17))
  2900. #define IS_TIM_CLOCK_DIVISION_INSTANCE(INSTANCE)\
  2901. (((INSTANCE) == TIM1) || \
  2902. ((INSTANCE) == TIM3) || \
  2903. ((INSTANCE) == TIM14) || \
  2904. ((INSTANCE) == TIM16) || \
  2905. ((INSTANCE) == TIM17))
  2906. #define IS_TIM_DMA_INSTANCE(INSTANCE)\
  2907. (((INSTANCE) == TIM1) || \
  2908. ((INSTANCE) == TIM3) || \
  2909. ((INSTANCE) == TIM16) || \
  2910. ((INSTANCE) == TIM17))
  2911. #define IS_TIM_DMA_CC_INSTANCE(INSTANCE)\
  2912. (((INSTANCE) == TIM1) || \
  2913. ((INSTANCE) == TIM3) || \
  2914. ((INSTANCE) == TIM16) || \
  2915. ((INSTANCE) == TIM17))
  2916. #define IS_TIM_COMMUTATION_EVENT_INSTANCE(INSTANCE)\
  2917. (((INSTANCE) == TIM1) || \
  2918. ((INSTANCE) == TIM16) || \
  2919. ((INSTANCE) == TIM17))
  2920. #define IS_TIM_REMAP_INSTANCE(INSTANCE)\
  2921. ((INSTANCE) == TIM14)
  2922. /******************** USART Instances : Synchronous mode **********************/
  2923. #define IS_USART_INSTANCE(INSTANCE) ((INSTANCE) == USART1)
  2924. /******************** USART Instances : auto Baud rate detection **************/
  2925. #define IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(INSTANCE) ((INSTANCE) == USART1)
  2926. /******************** UART Instances : Asynchronous mode **********************/
  2927. #define IS_UART_INSTANCE(INSTANCE) ((INSTANCE) == USART1)
  2928. /******************** UART Instances : Half-Duplex mode **********************/
  2929. #define IS_UART_HALFDUPLEX_INSTANCE(INSTANCE) ((INSTANCE) == USART1)
  2930. /****************** UART Instances : Hardware Flow control ********************/
  2931. #define IS_UART_HWFLOW_INSTANCE(INSTANCE) ((INSTANCE) == USART1)
  2932. /****************** UART Instances : Driver enable detection ********************/
  2933. #define IS_UART_DRIVER_ENABLE_INSTANCE(INSTANCE) ((INSTANCE) == USART1)
  2934. /****************************** WWDG Instances ********************************/
  2935. #define IS_WWDG_ALL_INSTANCE(INSTANCE) ((INSTANCE) == WWDG)
  2936. /**
  2937. * @}
  2938. */
  2939. /******************************************************************************/
  2940. /* For a painless codes migration between the STM32F0xx device product */
  2941. /* lines, the aliases defined below are put in place to overcome the */
  2942. /* differences in the interrupt handlers and IRQn definitions. */
  2943. /* No need to update developed interrupt code when moving across */
  2944. /* product lines within the same STM32F0 Family */
  2945. /******************************************************************************/
  2946. /* Aliases for __IRQn */
  2947. #define ADC1_COMP_IRQn ADC1_IRQn
  2948. #define DMA1_Ch1_IRQn DMA1_Channel1_IRQn
  2949. #define DMA1_Ch2_3_DMA2_Ch1_2_IRQn DMA1_Channel2_3_IRQn
  2950. #define DMA1_Channel4_5_6_7_IRQn DMA1_Channel4_5_IRQn
  2951. #define DMA1_Ch4_7_DMA2_Ch3_5_IRQn DMA1_Channel4_5_IRQn
  2952. #define RCC_CRS_IRQn RCC_IRQn
  2953. /* Aliases for __IRQHandler */
  2954. #define ADC1_COMP_IRQHandler ADC1_IRQHandler
  2955. #define DMA1_Ch1_IRQHandler DMA1_Channel1_IRQHandler
  2956. #define DMA1_Ch2_3_DMA2_Ch1_2_IRQHandler DMA1_Channel2_3_IRQHandler
  2957. #define DMA1_Channel4_5_6_7_IRQHandler DMA1_Channel4_5_IRQHandler
  2958. #define DMA1_Ch4_7_DMA2_Ch3_5_IRQHandler DMA1_Channel4_5_IRQHandler
  2959. #define RCC_CRS_IRQHandler RCC_IRQHandler
  2960. #ifdef __cplusplus
  2961. }
  2962. #endif /* __cplusplus */
  2963. #endif /* __STM32F030x6_H */
  2964. /**
  2965. * @}
  2966. */
  2967. /**
  2968. * @}
  2969. */
  2970. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/