stm32f0xx.h 234 KB

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