stm32f410rx.h 276 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975
  1. /**
  2. ******************************************************************************
  3. * @file stm32f410rx.h
  4. * @author MCD Application Team
  5. * @version V2.4.2
  6. * @date 13-November-2015
  7. * @brief CMSIS STM32F410Rx Device Peripheral Access Layer Header File.
  8. *
  9. * This file contains:
  10. * - Data structures and the address mapping for all peripherals
  11. * - Peripheral's registers declarations and bits definition
  12. * - Macros to access peripheral’s registers hardware
  13. *
  14. ******************************************************************************
  15. * @attention
  16. *
  17. * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
  18. *
  19. * Redistribution and use in source and binary forms, with or without modification,
  20. * are permitted provided that the following conditions are met:
  21. * 1. Redistributions of source code must retain the above copyright notice,
  22. * this list of conditions and the following disclaimer.
  23. * 2. Redistributions in binary form must reproduce the above copyright notice,
  24. * this list of conditions and the following disclaimer in the documentation
  25. * and/or other materials provided with the distribution.
  26. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  27. * may be used to endorse or promote products derived from this software
  28. * without specific prior written permission.
  29. *
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  31. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  32. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  33. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  34. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  35. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  36. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  37. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  38. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  39. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40. *
  41. ******************************************************************************
  42. */
  43. /** @addtogroup CMSIS
  44. * @{
  45. */
  46. /** @addtogroup stm32f410rx
  47. * @{
  48. */
  49. #ifndef __STM32F410Rx_H
  50. #define __STM32F410Rx_H
  51. #ifdef __cplusplus
  52. extern "C" {
  53. #endif /* __cplusplus */
  54. /** @addtogroup Configuration_section_for_CMSIS
  55. * @{
  56. */
  57. /**
  58. * @brief Configuration of the Cortex-M4 Processor and Core Peripherals
  59. */
  60. #define __CM4_REV 0x0001 /*!< Core revision r0p1 */
  61. #define __MPU_PRESENT 1 /*!< STM32F4XX provides an MPU */
  62. #define __NVIC_PRIO_BITS 4 /*!< STM32F4XX uses 4 Bits for the Priority Levels */
  63. #define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */
  64. #define __FPU_PRESENT 1 /*!< FPU present */
  65. /**
  66. * @}
  67. */
  68. /** @addtogroup Peripheral_interrupt_number_definition
  69. * @{
  70. */
  71. /**
  72. * @brief STM32F4XX Interrupt Number Definition, according to the selected device
  73. * in @ref Library_configuration_section
  74. */
  75. typedef enum
  76. {
  77. /****** Cortex-M4 Processor Exceptions Numbers ****************************************************************/
  78. NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */
  79. MemoryManagement_IRQn = -12, /*!< 4 Cortex-M4 Memory Management Interrupt */
  80. BusFault_IRQn = -11, /*!< 5 Cortex-M4 Bus Fault Interrupt */
  81. UsageFault_IRQn = -10, /*!< 6 Cortex-M4 Usage Fault Interrupt */
  82. SVCall_IRQn = -5, /*!< 11 Cortex-M4 SV Call Interrupt */
  83. DebugMonitor_IRQn = -4, /*!< 12 Cortex-M4 Debug Monitor Interrupt */
  84. PendSV_IRQn = -2, /*!< 14 Cortex-M4 Pend SV Interrupt */
  85. SysTick_IRQn = -1, /*!< 15 Cortex-M4 System Tick Interrupt */
  86. /****** STM32 specific Interrupt Numbers **********************************************************************/
  87. WWDG_IRQn = 0, /*!< Window WatchDog Interrupt */
  88. PVD_IRQn = 1, /*!< PVD through EXTI Line detection Interrupt */
  89. TAMP_STAMP_IRQn = 2, /*!< Tamper and TimeStamp interrupts through the EXTI line */
  90. RTC_WKUP_IRQn = 3, /*!< RTC Wakeup interrupt through the EXTI line */
  91. FLASH_IRQn = 4, /*!< FLASH global Interrupt */
  92. RCC_IRQn = 5, /*!< RCC global Interrupt */
  93. EXTI0_IRQn = 6, /*!< EXTI Line0 Interrupt */
  94. EXTI1_IRQn = 7, /*!< EXTI Line1 Interrupt */
  95. EXTI2_IRQn = 8, /*!< EXTI Line2 Interrupt */
  96. EXTI3_IRQn = 9, /*!< EXTI Line3 Interrupt */
  97. EXTI4_IRQn = 10, /*!< EXTI Line4 Interrupt */
  98. DMA1_Stream0_IRQn = 11, /*!< DMA1 Stream 0 global Interrupt */
  99. DMA1_Stream1_IRQn = 12, /*!< DMA1 Stream 1 global Interrupt */
  100. DMA1_Stream2_IRQn = 13, /*!< DMA1 Stream 2 global Interrupt */
  101. DMA1_Stream3_IRQn = 14, /*!< DMA1 Stream 3 global Interrupt */
  102. DMA1_Stream4_IRQn = 15, /*!< DMA1 Stream 4 global Interrupt */
  103. DMA1_Stream5_IRQn = 16, /*!< DMA1 Stream 5 global Interrupt */
  104. DMA1_Stream6_IRQn = 17, /*!< DMA1 Stream 6 global Interrupt */
  105. ADC_IRQn = 18, /*!< ADC1 global Interrupts */
  106. EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
  107. TIM1_BRK_TIM9_IRQn = 24, /*!< TIM1 Break interrupt and TIM9 global interrupt */
  108. TIM1_UP_IRQn = 25, /*!< TIM1 Update Interrupt */
  109. TIM1_TRG_COM_TIM11_IRQn = 26, /*!< TIM1 Trigger and Commutation Interrupt and TIM11 global interrupt */
  110. TIM1_CC_IRQn = 27, /*!< TIM1 Capture Compare Interrupt */
  111. I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
  112. I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
  113. I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
  114. I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
  115. SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
  116. SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
  117. USART1_IRQn = 37, /*!< USART1 global Interrupt */
  118. USART2_IRQn = 38, /*!< USART2 global Interrupt */
  119. EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
  120. RTC_Alarm_IRQn = 41, /*!< RTC Alarm (A and B) through EXTI Line Interrupt */
  121. DMA1_Stream7_IRQn = 47, /*!< DMA1 Stream7 Interrupt */
  122. TIM5_IRQn = 50, /*!< TIM5 global Interrupt */
  123. TIM6_DAC_IRQn = 54, /*!< TIM6 global Interrupt and DAC Global Interrupt */
  124. DMA2_Stream0_IRQn = 56, /*!< DMA2 Stream 0 global Interrupt */
  125. DMA2_Stream1_IRQn = 57, /*!< DMA2 Stream 1 global Interrupt */
  126. DMA2_Stream2_IRQn = 58, /*!< DMA2 Stream 2 global Interrupt */
  127. DMA2_Stream3_IRQn = 59, /*!< DMA2 Stream 3 global Interrupt */
  128. DMA2_Stream4_IRQn = 60, /*!< DMA2 Stream 4 global Interrupt */
  129. DMA2_Stream5_IRQn = 68, /*!< DMA2 Stream 5 global interrupt */
  130. DMA2_Stream6_IRQn = 69, /*!< DMA2 Stream 6 global interrupt */
  131. DMA2_Stream7_IRQn = 70, /*!< DMA2 Stream 7 global interrupt */
  132. USART6_IRQn = 71, /*!< USART6 global interrupt */
  133. RNG_IRQn = 80, /*!< RNG global Interrupt */
  134. FPU_IRQn = 81, /*!< FPU global interrupt */
  135. SPI5_IRQn = 85, /*!< SPI5 global Interrupt */
  136. FMPI2C1_EV_IRQn = 95, /*!< FMPI2C1 Event Interrupt */
  137. FMPI2C1_ER_IRQn = 96, /*!< FMPI2C1 Error Interrupt */
  138. LPTIM1_IRQn = 97 /*!< LPTIM1 interrupt */
  139. } IRQn_Type;
  140. /**
  141. * @}
  142. */
  143. #include "core_cm4.h" /* Cortex-M4 processor and core peripherals */
  144. #include "system_stm32f4xx.h"
  145. #include <stdint.h>
  146. /** @addtogroup Peripheral_registers_structures
  147. * @{
  148. */
  149. /**
  150. * @brief Analog to Digital Converter
  151. */
  152. typedef struct
  153. {
  154. __IO uint32_t SR; /*!< ADC status register, Address offset: 0x00 */
  155. __IO uint32_t CR1; /*!< ADC control register 1, Address offset: 0x04 */
  156. __IO uint32_t CR2; /*!< ADC control register 2, Address offset: 0x08 */
  157. __IO uint32_t SMPR1; /*!< ADC sample time register 1, Address offset: 0x0C */
  158. __IO uint32_t SMPR2; /*!< ADC sample time register 2, Address offset: 0x10 */
  159. __IO uint32_t JOFR1; /*!< ADC injected channel data offset register 1, Address offset: 0x14 */
  160. __IO uint32_t JOFR2; /*!< ADC injected channel data offset register 2, Address offset: 0x18 */
  161. __IO uint32_t JOFR3; /*!< ADC injected channel data offset register 3, Address offset: 0x1C */
  162. __IO uint32_t JOFR4; /*!< ADC injected channel data offset register 4, Address offset: 0x20 */
  163. __IO uint32_t HTR; /*!< ADC watchdog higher threshold register, Address offset: 0x24 */
  164. __IO uint32_t LTR; /*!< ADC watchdog lower threshold register, Address offset: 0x28 */
  165. __IO uint32_t SQR1; /*!< ADC regular sequence register 1, Address offset: 0x2C */
  166. __IO uint32_t SQR2; /*!< ADC regular sequence register 2, Address offset: 0x30 */
  167. __IO uint32_t SQR3; /*!< ADC regular sequence register 3, Address offset: 0x34 */
  168. __IO uint32_t JSQR; /*!< ADC injected sequence register, Address offset: 0x38*/
  169. __IO uint32_t JDR1; /*!< ADC injected data register 1, Address offset: 0x3C */
  170. __IO uint32_t JDR2; /*!< ADC injected data register 2, Address offset: 0x40 */
  171. __IO uint32_t JDR3; /*!< ADC injected data register 3, Address offset: 0x44 */
  172. __IO uint32_t JDR4; /*!< ADC injected data register 4, Address offset: 0x48 */
  173. __IO uint32_t DR; /*!< ADC regular data register, Address offset: 0x4C */
  174. } ADC_TypeDef;
  175. typedef struct
  176. {
  177. __IO uint32_t CSR; /*!< ADC Common status register, Address offset: ADC1 base address + 0x300 */
  178. __IO uint32_t CCR; /*!< ADC common control register, Address offset: ADC1 base address + 0x304 */
  179. __IO uint32_t CDR; /*!< ADC common regular data register for dual
  180. AND triple modes, Address offset: ADC1 base address + 0x308 */
  181. } ADC_Common_TypeDef;
  182. /**
  183. * @brief CRC calculation unit
  184. */
  185. typedef struct
  186. {
  187. __IO uint32_t DR; /*!< CRC Data register, Address offset: 0x00 */
  188. __IO uint8_t IDR; /*!< CRC Independent data register, Address offset: 0x04 */
  189. uint8_t RESERVED0; /*!< Reserved, 0x05 */
  190. uint16_t RESERVED1; /*!< Reserved, 0x06 */
  191. __IO uint32_t CR; /*!< CRC Control register, Address offset: 0x08 */
  192. } CRC_TypeDef;
  193. /**
  194. * @brief Digital to Analog Converter
  195. */
  196. typedef struct
  197. {
  198. __IO uint32_t CR; /*!< DAC control register, Address offset: 0x00 */
  199. __IO uint32_t SWTRIGR; /*!< DAC software trigger register, Address offset: 0x04 */
  200. __IO uint32_t DHR12R1; /*!< DAC channel1 12-bit right-aligned data holding register, Address offset: 0x08 */
  201. __IO uint32_t DHR12L1; /*!< DAC channel1 12-bit left aligned data holding register, Address offset: 0x0C */
  202. __IO uint32_t DHR8R1; /*!< DAC channel1 8-bit right aligned data holding register, Address offset: 0x10 */
  203. __IO uint32_t DHR12R2; /*!< DAC channel2 12-bit right aligned data holding register, Address offset: 0x14 */
  204. __IO uint32_t DHR12L2; /*!< DAC channel2 12-bit left aligned data holding register, Address offset: 0x18 */
  205. __IO uint32_t DHR8R2; /*!< DAC channel2 8-bit right-aligned data holding register, Address offset: 0x1C */
  206. __IO uint32_t DHR12RD; /*!< Dual DAC 12-bit right-aligned data holding register, Address offset: 0x20 */
  207. __IO uint32_t DHR12LD; /*!< DUAL DAC 12-bit left aligned data holding register, Address offset: 0x24 */
  208. __IO uint32_t DHR8RD; /*!< DUAL DAC 8-bit right aligned data holding register, Address offset: 0x28 */
  209. __IO uint32_t DOR1; /*!< DAC channel1 data output register, Address offset: 0x2C */
  210. __IO uint32_t DOR2; /*!< DAC channel2 data output register, Address offset: 0x30 */
  211. __IO uint32_t SR; /*!< DAC status register, Address offset: 0x34 */
  212. } DAC_TypeDef;
  213. /**
  214. * @brief Debug MCU
  215. */
  216. typedef struct
  217. {
  218. __IO uint32_t IDCODE; /*!< MCU device ID code, Address offset: 0x00 */
  219. __IO uint32_t CR; /*!< Debug MCU configuration register, Address offset: 0x04 */
  220. __IO uint32_t APB1FZ; /*!< Debug MCU APB1 freeze register, Address offset: 0x08 */
  221. __IO uint32_t APB2FZ; /*!< Debug MCU APB2 freeze register, Address offset: 0x0C */
  222. }DBGMCU_TypeDef;
  223. /**
  224. * @brief DMA Controller
  225. */
  226. typedef struct
  227. {
  228. __IO uint32_t CR; /*!< DMA stream x configuration register */
  229. __IO uint32_t NDTR; /*!< DMA stream x number of data register */
  230. __IO uint32_t PAR; /*!< DMA stream x peripheral address register */
  231. __IO uint32_t M0AR; /*!< DMA stream x memory 0 address register */
  232. __IO uint32_t M1AR; /*!< DMA stream x memory 1 address register */
  233. __IO uint32_t FCR; /*!< DMA stream x FIFO control register */
  234. } DMA_Stream_TypeDef;
  235. typedef struct
  236. {
  237. __IO uint32_t LISR; /*!< DMA low interrupt status register, Address offset: 0x00 */
  238. __IO uint32_t HISR; /*!< DMA high interrupt status register, Address offset: 0x04 */
  239. __IO uint32_t LIFCR; /*!< DMA low interrupt flag clear register, Address offset: 0x08 */
  240. __IO uint32_t HIFCR; /*!< DMA high interrupt flag clear register, Address offset: 0x0C */
  241. } DMA_TypeDef;
  242. /**
  243. * @brief External Interrupt/Event Controller
  244. */
  245. typedef struct
  246. {
  247. __IO uint32_t IMR; /*!< EXTI Interrupt mask register, Address offset: 0x00 */
  248. __IO uint32_t EMR; /*!< EXTI Event mask register, Address offset: 0x04 */
  249. __IO uint32_t RTSR; /*!< EXTI Rising trigger selection register, Address offset: 0x08 */
  250. __IO uint32_t FTSR; /*!< EXTI Falling trigger selection register, Address offset: 0x0C */
  251. __IO uint32_t SWIER; /*!< EXTI Software interrupt event register, Address offset: 0x10 */
  252. __IO uint32_t PR; /*!< EXTI Pending register, Address offset: 0x14 */
  253. } EXTI_TypeDef;
  254. /**
  255. * @brief FLASH Registers
  256. */
  257. typedef struct
  258. {
  259. __IO uint32_t ACR; /*!< FLASH access control register, Address offset: 0x00 */
  260. __IO uint32_t KEYR; /*!< FLASH key register, Address offset: 0x04 */
  261. __IO uint32_t OPTKEYR; /*!< FLASH option key register, Address offset: 0x08 */
  262. __IO uint32_t SR; /*!< FLASH status register, Address offset: 0x0C */
  263. __IO uint32_t CR; /*!< FLASH control register, Address offset: 0x10 */
  264. __IO uint32_t OPTCR; /*!< FLASH option control register , Address offset: 0x14 */
  265. __IO uint32_t OPTCR1; /*!< FLASH option control register 1, Address offset: 0x18 */
  266. } FLASH_TypeDef;
  267. /**
  268. * @brief General Purpose I/O
  269. */
  270. typedef struct
  271. {
  272. __IO uint32_t MODER; /*!< GPIO port mode register, Address offset: 0x00 */
  273. __IO uint32_t OTYPER; /*!< GPIO port output type register, Address offset: 0x04 */
  274. __IO uint32_t OSPEEDR; /*!< GPIO port output speed register, Address offset: 0x08 */
  275. __IO uint32_t PUPDR; /*!< GPIO port pull-up/pull-down register, Address offset: 0x0C */
  276. __IO uint32_t IDR; /*!< GPIO port input data register, Address offset: 0x10 */
  277. __IO uint32_t ODR; /*!< GPIO port output data register, Address offset: 0x14 */
  278. __IO uint32_t BSRR; /*!< GPIO port bit set/reset register, Address offset: 0x18 */
  279. __IO uint32_t LCKR; /*!< GPIO port configuration lock register, Address offset: 0x1C */
  280. __IO uint32_t AFR[2]; /*!< GPIO alternate function registers, Address offset: 0x20-0x24 */
  281. } GPIO_TypeDef;
  282. /**
  283. * @brief System configuration controller
  284. */
  285. typedef struct
  286. {
  287. __IO uint32_t MEMRMP; /*!< SYSCFG memory remap register, Address offset: 0x00 */
  288. __IO uint32_t PMC; /*!< SYSCFG peripheral mode configuration register, Address offset: 0x04 */
  289. __IO uint32_t EXTICR[4]; /*!< SYSCFG external interrupt configuration registers, Address offset: 0x08-0x14 */
  290. uint32_t RESERVED; /*!< Reserved, 0x18 */
  291. uint32_t CFGR2; /*!< Reserved, 0x1C */
  292. __IO uint32_t CMPCR; /*!< SYSCFG Compensation cell control register, Address offset: 0x20 */
  293. uint32_t RESERVED1[2]; /*!< Reserved, 0x24-0x28 */
  294. __IO uint32_t CFGR; /*!< SYSCFG Configuration register, Address offset: 0x2C */
  295. } SYSCFG_TypeDef;
  296. /**
  297. * @brief Inter-integrated Circuit Interface
  298. */
  299. typedef struct
  300. {
  301. __IO uint32_t CR1; /*!< I2C Control register 1, Address offset: 0x00 */
  302. __IO uint32_t CR2; /*!< I2C Control register 2, Address offset: 0x04 */
  303. __IO uint32_t OAR1; /*!< I2C Own address register 1, Address offset: 0x08 */
  304. __IO uint32_t OAR2; /*!< I2C Own address register 2, Address offset: 0x0C */
  305. __IO uint32_t DR; /*!< I2C Data register, Address offset: 0x10 */
  306. __IO uint32_t SR1; /*!< I2C Status register 1, Address offset: 0x14 */
  307. __IO uint32_t SR2; /*!< I2C Status register 2, Address offset: 0x18 */
  308. __IO uint32_t CCR; /*!< I2C Clock control register, Address offset: 0x1C */
  309. __IO uint32_t TRISE; /*!< I2C TRISE register, Address offset: 0x20 */
  310. __IO uint32_t FLTR; /*!< I2C FLTR register, Address offset: 0x24 */
  311. } I2C_TypeDef;
  312. /**
  313. * @brief Inter-integrated Circuit Interface
  314. */
  315. typedef struct
  316. {
  317. __IO uint32_t CR1; /*!< FMPI2C Control register 1, Address offset: 0x00 */
  318. __IO uint32_t CR2; /*!< FMPI2C Control register 2, Address offset: 0x04 */
  319. __IO uint32_t OAR1; /*!< FMPI2C Own address 1 register, Address offset: 0x08 */
  320. __IO uint32_t OAR2; /*!< FMPI2C Own address 2 register, Address offset: 0x0C */
  321. __IO uint32_t TIMINGR; /*!< FMPI2C Timing register, Address offset: 0x10 */
  322. __IO uint32_t TIMEOUTR; /*!< FMPI2C Timeout register, Address offset: 0x14 */
  323. __IO uint32_t ISR; /*!< FMPI2C Interrupt and status register, Address offset: 0x18 */
  324. __IO uint32_t ICR; /*!< FMPI2C Interrupt clear register, Address offset: 0x1C */
  325. __IO uint32_t PECR; /*!< FMPI2C PEC register, Address offset: 0x20 */
  326. __IO uint32_t RXDR; /*!< FMPI2C Receive data register, Address offset: 0x24 */
  327. __IO uint32_t TXDR; /*!< FMPI2C Transmit data register, Address offset: 0x28 */
  328. } FMPI2C_TypeDef;
  329. /**
  330. * @brief Independent WATCHDOG
  331. */
  332. typedef struct
  333. {
  334. __IO uint32_t KR; /*!< IWDG Key register, Address offset: 0x00 */
  335. __IO uint32_t PR; /*!< IWDG Prescaler register, Address offset: 0x04 */
  336. __IO uint32_t RLR; /*!< IWDG Reload register, Address offset: 0x08 */
  337. __IO uint32_t SR; /*!< IWDG Status register, Address offset: 0x0C */
  338. } IWDG_TypeDef;
  339. /**
  340. * @brief Power Control
  341. */
  342. typedef struct
  343. {
  344. __IO uint32_t CR; /*!< PWR power control register, Address offset: 0x00 */
  345. __IO uint32_t CSR; /*!< PWR power control/status register, Address offset: 0x04 */
  346. } PWR_TypeDef;
  347. /**
  348. * @brief Reset and Clock Control
  349. */
  350. typedef struct
  351. {
  352. __IO uint32_t CR; /*!< RCC clock control register, Address offset: 0x00 */
  353. __IO uint32_t PLLCFGR; /*!< RCC PLL configuration register, Address offset: 0x04 */
  354. __IO uint32_t CFGR; /*!< RCC clock configuration register, Address offset: 0x08 */
  355. __IO uint32_t CIR; /*!< RCC clock interrupt register, Address offset: 0x0C */
  356. __IO uint32_t AHB1RSTR; /*!< RCC AHB1 peripheral reset register, Address offset: 0x10 */
  357. uint32_t RESERVED0[3]; /*!< Reserved, 0x14-0x1C */
  358. __IO uint32_t APB1RSTR; /*!< RCC APB1 peripheral reset register, Address offset: 0x20 */
  359. __IO uint32_t APB2RSTR; /*!< RCC APB2 peripheral reset register, Address offset: 0x24 */
  360. uint32_t RESERVED1[2]; /*!< Reserved, 0x28-0x2C */
  361. __IO uint32_t AHB1ENR; /*!< RCC AHB1 peripheral clock register, Address offset: 0x30 */
  362. uint32_t RESERVED2[3]; /*!< Reserved, 0x34-0x3C */
  363. __IO uint32_t APB1ENR; /*!< RCC APB1 peripheral clock enable register, Address offset: 0x40 */
  364. __IO uint32_t APB2ENR; /*!< RCC APB2 peripheral clock enable register, Address offset: 0x44 */
  365. uint32_t RESERVED3[2]; /*!< Reserved, 0x48-0x4C */
  366. __IO uint32_t AHB1LPENR; /*!< RCC AHB1 peripheral clock enable in low power mode register, Address offset: 0x50 */
  367. uint32_t RESERVED4[3]; /*!< Reserved, 0x54-0x5C */
  368. __IO uint32_t APB1LPENR; /*!< RCC APB1 peripheral clock enable in low power mode register, Address offset: 0x60 */
  369. __IO uint32_t APB2LPENR; /*!< RCC APB2 peripheral clock enable in low power mode register, Address offset: 0x64 */
  370. uint32_t RESERVED5[2]; /*!< Reserved, 0x68-0x6C */
  371. __IO uint32_t BDCR; /*!< RCC Backup domain control register, Address offset: 0x70 */
  372. __IO uint32_t CSR; /*!< RCC clock control & status register, Address offset: 0x74 */
  373. uint32_t RESERVED6[2]; /*!< Reserved, 0x78-0x7C */
  374. __IO uint32_t SSCGR; /*!< RCC spread spectrum clock generation register, Address offset: 0x80 */
  375. uint32_t RESERVED7[2]; /*!< Reserved, 0x84-0x88 */
  376. __IO uint32_t DCKCFGR; /*!< RCC Dedicated Clocks configuration register, Address offset: 0x8C */
  377. __IO uint32_t CKGATENR; /*!< RCC Clocks Gated ENable Register, Address offset: 0x90 */
  378. __IO uint32_t DCKCFGR2; /*!< RCC Dedicated Clocks configuration register 2, Address offset: 0x94 */
  379. } RCC_TypeDef;
  380. /**
  381. * @brief Real-Time Clock
  382. */
  383. typedef struct
  384. {
  385. __IO uint32_t TR; /*!< RTC time register, Address offset: 0x00 */
  386. __IO uint32_t DR; /*!< RTC date register, Address offset: 0x04 */
  387. __IO uint32_t CR; /*!< RTC control register, Address offset: 0x08 */
  388. __IO uint32_t ISR; /*!< RTC initialization and status register, Address offset: 0x0C */
  389. __IO uint32_t PRER; /*!< RTC prescaler register, Address offset: 0x10 */
  390. __IO uint32_t WUTR; /*!< RTC wakeup timer register, Address offset: 0x14 */
  391. __IO uint32_t CALIBR; /*!< RTC calibration register, Address offset: 0x18 */
  392. __IO uint32_t ALRMAR; /*!< RTC alarm A register, Address offset: 0x1C */
  393. __IO uint32_t ALRMBR; /*!< RTC alarm B register, Address offset: 0x20 */
  394. __IO uint32_t WPR; /*!< RTC write protection register, Address offset: 0x24 */
  395. __IO uint32_t SSR; /*!< RTC sub second register, Address offset: 0x28 */
  396. __IO uint32_t SHIFTR; /*!< RTC shift control register, Address offset: 0x2C */
  397. __IO uint32_t TSTR; /*!< RTC time stamp time register, Address offset: 0x30 */
  398. __IO uint32_t TSDR; /*!< RTC time stamp date register, Address offset: 0x34 */
  399. __IO uint32_t TSSSR; /*!< RTC time-stamp sub second register, Address offset: 0x38 */
  400. __IO uint32_t CALR; /*!< RTC calibration register, Address offset: 0x3C */
  401. __IO uint32_t TAFCR; /*!< RTC tamper and alternate function configuration register, Address offset: 0x40 */
  402. __IO uint32_t ALRMASSR;/*!< RTC alarm A sub second register, Address offset: 0x44 */
  403. __IO uint32_t ALRMBSSR;/*!< RTC alarm B sub second register, Address offset: 0x48 */
  404. uint32_t RESERVED7; /*!< Reserved, 0x4C */
  405. __IO uint32_t BKP0R; /*!< RTC backup register 1, Address offset: 0x50 */
  406. __IO uint32_t BKP1R; /*!< RTC backup register 1, Address offset: 0x54 */
  407. __IO uint32_t BKP2R; /*!< RTC backup register 2, Address offset: 0x58 */
  408. __IO uint32_t BKP3R; /*!< RTC backup register 3, Address offset: 0x5C */
  409. __IO uint32_t BKP4R; /*!< RTC backup register 4, Address offset: 0x60 */
  410. __IO uint32_t BKP5R; /*!< RTC backup register 5, Address offset: 0x64 */
  411. __IO uint32_t BKP6R; /*!< RTC backup register 6, Address offset: 0x68 */
  412. __IO uint32_t BKP7R; /*!< RTC backup register 7, Address offset: 0x6C */
  413. __IO uint32_t BKP8R; /*!< RTC backup register 8, Address offset: 0x70 */
  414. __IO uint32_t BKP9R; /*!< RTC backup register 9, Address offset: 0x74 */
  415. __IO uint32_t BKP10R; /*!< RTC backup register 10, Address offset: 0x78 */
  416. __IO uint32_t BKP11R; /*!< RTC backup register 11, Address offset: 0x7C */
  417. __IO uint32_t BKP12R; /*!< RTC backup register 12, Address offset: 0x80 */
  418. __IO uint32_t BKP13R; /*!< RTC backup register 13, Address offset: 0x84 */
  419. __IO uint32_t BKP14R; /*!< RTC backup register 14, Address offset: 0x88 */
  420. __IO uint32_t BKP15R; /*!< RTC backup register 15, Address offset: 0x8C */
  421. __IO uint32_t BKP16R; /*!< RTC backup register 16, Address offset: 0x90 */
  422. __IO uint32_t BKP17R; /*!< RTC backup register 17, Address offset: 0x94 */
  423. __IO uint32_t BKP18R; /*!< RTC backup register 18, Address offset: 0x98 */
  424. __IO uint32_t BKP19R; /*!< RTC backup register 19, Address offset: 0x9C */
  425. } RTC_TypeDef;
  426. /**
  427. * @brief Serial Peripheral Interface
  428. */
  429. typedef struct
  430. {
  431. __IO uint32_t CR1; /*!< SPI control register 1 (not used in I2S mode), Address offset: 0x00 */
  432. __IO uint32_t CR2; /*!< SPI control register 2, Address offset: 0x04 */
  433. __IO uint32_t SR; /*!< SPI status register, Address offset: 0x08 */
  434. __IO uint32_t DR; /*!< SPI data register, Address offset: 0x0C */
  435. __IO uint32_t CRCPR; /*!< SPI CRC polynomial register (not used in I2S mode), Address offset: 0x10 */
  436. __IO uint32_t RXCRCR; /*!< SPI RX CRC register (not used in I2S mode), Address offset: 0x14 */
  437. __IO uint32_t TXCRCR; /*!< SPI TX CRC register (not used in I2S mode), Address offset: 0x18 */
  438. __IO uint32_t I2SCFGR; /*!< SPI_I2S configuration register, Address offset: 0x1C */
  439. __IO uint32_t I2SPR; /*!< SPI_I2S prescaler register, Address offset: 0x20 */
  440. } SPI_TypeDef;
  441. /**
  442. * @brief TIM
  443. */
  444. typedef struct
  445. {
  446. __IO uint32_t CR1; /*!< TIM control register 1, Address offset: 0x00 */
  447. __IO uint32_t CR2; /*!< TIM control register 2, Address offset: 0x04 */
  448. __IO uint32_t SMCR; /*!< TIM slave mode control register, Address offset: 0x08 */
  449. __IO uint32_t DIER; /*!< TIM DMA/interrupt enable register, Address offset: 0x0C */
  450. __IO uint32_t SR; /*!< TIM status register, Address offset: 0x10 */
  451. __IO uint32_t EGR; /*!< TIM event generation register, Address offset: 0x14 */
  452. __IO uint32_t CCMR1; /*!< TIM capture/compare mode register 1, Address offset: 0x18 */
  453. __IO uint32_t CCMR2; /*!< TIM capture/compare mode register 2, Address offset: 0x1C */
  454. __IO uint32_t CCER; /*!< TIM capture/compare enable register, Address offset: 0x20 */
  455. __IO uint32_t CNT; /*!< TIM counter register, Address offset: 0x24 */
  456. __IO uint32_t PSC; /*!< TIM prescaler, Address offset: 0x28 */
  457. __IO uint32_t ARR; /*!< TIM auto-reload register, Address offset: 0x2C */
  458. __IO uint32_t RCR; /*!< TIM repetition counter register, Address offset: 0x30 */
  459. __IO uint32_t CCR1; /*!< TIM capture/compare register 1, Address offset: 0x34 */
  460. __IO uint32_t CCR2; /*!< TIM capture/compare register 2, Address offset: 0x38 */
  461. __IO uint32_t CCR3; /*!< TIM capture/compare register 3, Address offset: 0x3C */
  462. __IO uint32_t CCR4; /*!< TIM capture/compare register 4, Address offset: 0x40 */
  463. __IO uint32_t BDTR; /*!< TIM break and dead-time register, Address offset: 0x44 */
  464. __IO uint32_t DCR; /*!< TIM DMA control register, Address offset: 0x48 */
  465. __IO uint32_t DMAR; /*!< TIM DMA address for full transfer, Address offset: 0x4C */
  466. __IO uint32_t OR; /*!< TIM option register, Address offset: 0x50 */
  467. } TIM_TypeDef;
  468. /**
  469. * @brief Universal Synchronous Asynchronous Receiver Transmitter
  470. */
  471. typedef struct
  472. {
  473. __IO uint32_t SR; /*!< USART Status register, Address offset: 0x00 */
  474. __IO uint32_t DR; /*!< USART Data register, Address offset: 0x04 */
  475. __IO uint32_t BRR; /*!< USART Baud rate register, Address offset: 0x08 */
  476. __IO uint32_t CR1; /*!< USART Control register 1, Address offset: 0x0C */
  477. __IO uint32_t CR2; /*!< USART Control register 2, Address offset: 0x10 */
  478. __IO uint32_t CR3; /*!< USART Control register 3, Address offset: 0x14 */
  479. __IO uint32_t GTPR; /*!< USART Guard time and prescaler register, Address offset: 0x18 */
  480. } USART_TypeDef;
  481. /**
  482. * @brief Window WATCHDOG
  483. */
  484. typedef struct
  485. {
  486. __IO uint32_t CR; /*!< WWDG Control register, Address offset: 0x00 */
  487. __IO uint32_t CFR; /*!< WWDG Configuration register, Address offset: 0x04 */
  488. __IO uint32_t SR; /*!< WWDG Status register, Address offset: 0x08 */
  489. } WWDG_TypeDef;
  490. /**
  491. * @brief RNG
  492. */
  493. typedef struct
  494. {
  495. __IO uint32_t CR; /*!< RNG control register, Address offset: 0x00 */
  496. __IO uint32_t SR; /*!< RNG status register, Address offset: 0x04 */
  497. __IO uint32_t DR; /*!< RNG data register, Address offset: 0x08 */
  498. } RNG_TypeDef;
  499. /**
  500. * @brief LPTIMER
  501. */
  502. typedef struct
  503. {
  504. __IO uint32_t ISR; /*!< LPTIM Interrupt and Status register, Address offset: 0x00 */
  505. __IO uint32_t ICR; /*!< LPTIM Interrupt Clear register, Address offset: 0x04 */
  506. __IO uint32_t IER; /*!< LPTIM Interrupt Enable register, Address offset: 0x08 */
  507. __IO uint32_t CFGR; /*!< LPTIM Configuration register, Address offset: 0x0C */
  508. __IO uint32_t CR; /*!< LPTIM Control register, Address offset: 0x10 */
  509. __IO uint32_t CMP; /*!< LPTIM Compare register, Address offset: 0x14 */
  510. __IO uint32_t ARR; /*!< LPTIM Autoreload register, Address offset: 0x18 */
  511. __IO uint32_t CNT; /*!< LPTIM Counter register, Address offset: 0x1C */
  512. __IO uint32_t OR; /*!< LPTIM Option register, Address offset: 0x20 */
  513. } LPTIM_TypeDef;
  514. /**
  515. * @brief Peripheral_memory_map
  516. */
  517. #define FLASH_BASE ((uint32_t)0x08000000) /*!< FLASH(up to 1 MB) base address in the alias region */
  518. #define SRAM1_BASE ((uint32_t)0x20000000) /*!< SRAM1(32 KB) base address in the alias region */
  519. #define PERIPH_BASE ((uint32_t)0x40000000) /*!< Peripheral base address in the alias region */
  520. #define SRAM1_BB_BASE ((uint32_t)0x22000000) /*!< SRAM1(32 KB) base address in the bit-band region */
  521. #define PERIPH_BB_BASE ((uint32_t)0x42000000) /*!< Peripheral base address in the bit-band region */
  522. #define FLASH_END ((uint32_t)0x0801FFFF) /*!< FLASH end address */
  523. /* Legacy defines */
  524. #define SRAM_BASE SRAM1_BASE
  525. #define SRAM_BB_BASE SRAM1_BB_BASE
  526. /*!< Peripheral memory map */
  527. #define APB1PERIPH_BASE PERIPH_BASE
  528. #define APB2PERIPH_BASE (PERIPH_BASE + 0x00010000)
  529. #define AHB1PERIPH_BASE (PERIPH_BASE + 0x00020000)
  530. /*!< APB1 peripherals */
  531. #define TIM5_BASE (APB1PERIPH_BASE + 0x0C00)
  532. #define TIM6_BASE (APB1PERIPH_BASE + 0x1000)
  533. #define LPTIM1_BASE (APB1PERIPH_BASE + 0x2400)
  534. #define RTC_BASE (APB1PERIPH_BASE + 0x2800)
  535. #define WWDG_BASE (APB1PERIPH_BASE + 0x2C00)
  536. #define IWDG_BASE (APB1PERIPH_BASE + 0x3000)
  537. #define I2S2ext_BASE (APB1PERIPH_BASE + 0x3400)
  538. #define SPI2_BASE (APB1PERIPH_BASE + 0x3800)
  539. #define USART2_BASE (APB1PERIPH_BASE + 0x4400)
  540. #define I2C1_BASE (APB1PERIPH_BASE + 0x5400)
  541. #define I2C2_BASE (APB1PERIPH_BASE + 0x5800)
  542. #define FMPI2C1_BASE (APB1PERIPH_BASE + 0x6000)
  543. #define PWR_BASE (APB1PERIPH_BASE + 0x7000)
  544. #define DAC_BASE (APB1PERIPH_BASE + 0x7400)
  545. /*!< APB2 peripherals */
  546. #define TIM1_BASE (APB2PERIPH_BASE + 0x0000)
  547. #define USART1_BASE (APB2PERIPH_BASE + 0x1000)
  548. #define USART6_BASE (APB2PERIPH_BASE + 0x1400)
  549. #define ADC1_BASE (APB2PERIPH_BASE + 0x2000)
  550. #define ADC_BASE (APB2PERIPH_BASE + 0x2300)
  551. #define SPI1_BASE (APB2PERIPH_BASE + 0x3000)
  552. #define SYSCFG_BASE (APB2PERIPH_BASE + 0x3800)
  553. #define EXTI_BASE (APB2PERIPH_BASE + 0x3C00)
  554. #define TIM9_BASE (APB2PERIPH_BASE + 0x4000)
  555. #define TIM11_BASE (APB2PERIPH_BASE + 0x4800)
  556. #define SPI5_BASE (APB2PERIPH_BASE + 0x5000)
  557. /*!< AHB1 peripherals */
  558. #define GPIOA_BASE (AHB1PERIPH_BASE + 0x0000)
  559. #define GPIOB_BASE (AHB1PERIPH_BASE + 0x0400)
  560. #define GPIOC_BASE (AHB1PERIPH_BASE + 0x0800)
  561. #define GPIOH_BASE (AHB1PERIPH_BASE + 0x1C00)
  562. #define CRC_BASE (AHB1PERIPH_BASE + 0x3000)
  563. #define RCC_BASE (AHB1PERIPH_BASE + 0x3800)
  564. #define FLASH_R_BASE (AHB1PERIPH_BASE + 0x3C00)
  565. #define DMA1_BASE (AHB1PERIPH_BASE + 0x6000)
  566. #define DMA1_Stream0_BASE (DMA1_BASE + 0x010)
  567. #define DMA1_Stream1_BASE (DMA1_BASE + 0x028)
  568. #define DMA1_Stream2_BASE (DMA1_BASE + 0x040)
  569. #define DMA1_Stream3_BASE (DMA1_BASE + 0x058)
  570. #define DMA1_Stream4_BASE (DMA1_BASE + 0x070)
  571. #define DMA1_Stream5_BASE (DMA1_BASE + 0x088)
  572. #define DMA1_Stream6_BASE (DMA1_BASE + 0x0A0)
  573. #define DMA1_Stream7_BASE (DMA1_BASE + 0x0B8)
  574. #define DMA2_BASE (AHB1PERIPH_BASE + 0x6400)
  575. #define DMA2_Stream0_BASE (DMA2_BASE + 0x010)
  576. #define DMA2_Stream1_BASE (DMA2_BASE + 0x028)
  577. #define DMA2_Stream2_BASE (DMA2_BASE + 0x040)
  578. #define DMA2_Stream3_BASE (DMA2_BASE + 0x058)
  579. #define DMA2_Stream4_BASE (DMA2_BASE + 0x070)
  580. #define DMA2_Stream5_BASE (DMA2_BASE + 0x088)
  581. #define DMA2_Stream6_BASE (DMA2_BASE + 0x0A0)
  582. #define DMA2_Stream7_BASE (DMA2_BASE + 0x0B8)
  583. #define RNG_BASE (PERIPH_BASE + 0x80000)
  584. /* Debug MCU registers base address */
  585. #define DBGMCU_BASE ((uint32_t )0xE0042000)
  586. /**
  587. * @}
  588. */
  589. /** @addtogroup Peripheral_declaration
  590. * @{
  591. */
  592. #define TIM5 ((TIM_TypeDef *) TIM5_BASE)
  593. #define TIM6 ((TIM_TypeDef *) TIM6_BASE)
  594. #define RTC ((RTC_TypeDef *) RTC_BASE)
  595. #define WWDG ((WWDG_TypeDef *) WWDG_BASE)
  596. #define IWDG ((IWDG_TypeDef *) IWDG_BASE)
  597. #define SPI2 ((SPI_TypeDef *) SPI2_BASE)
  598. #define USART2 ((USART_TypeDef *) USART2_BASE)
  599. #define I2C1 ((I2C_TypeDef *) I2C1_BASE)
  600. #define I2C2 ((I2C_TypeDef *) I2C2_BASE)
  601. #define FMPI2C1 ((FMPI2C_TypeDef *) FMPI2C1_BASE)
  602. #define LPTIM1 ((LPTIM_TypeDef *) LPTIM1_BASE)
  603. #define PWR ((PWR_TypeDef *) PWR_BASE)
  604. #define DAC ((DAC_TypeDef *) DAC_BASE)
  605. #define TIM1 ((TIM_TypeDef *) TIM1_BASE)
  606. #define USART1 ((USART_TypeDef *) USART1_BASE)
  607. #define USART6 ((USART_TypeDef *) USART6_BASE)
  608. #define ADC ((ADC_Common_TypeDef *) ADC_BASE)
  609. #define ADC1 ((ADC_TypeDef *) ADC1_BASE)
  610. #define SPI1 ((SPI_TypeDef *) SPI1_BASE)
  611. #define SYSCFG ((SYSCFG_TypeDef *) SYSCFG_BASE)
  612. #define EXTI ((EXTI_TypeDef *) EXTI_BASE)
  613. #define TIM9 ((TIM_TypeDef *) TIM9_BASE)
  614. #define TIM11 ((TIM_TypeDef *) TIM11_BASE)
  615. #define SPI5 ((SPI_TypeDef *) SPI5_BASE)
  616. #define GPIOA ((GPIO_TypeDef *) GPIOA_BASE)
  617. #define GPIOB ((GPIO_TypeDef *) GPIOB_BASE)
  618. #define GPIOC ((GPIO_TypeDef *) GPIOC_BASE)
  619. #define GPIOH ((GPIO_TypeDef *) GPIOH_BASE)
  620. #define CRC ((CRC_TypeDef *) CRC_BASE)
  621. #define RCC ((RCC_TypeDef *) RCC_BASE)
  622. #define FLASH ((FLASH_TypeDef *) FLASH_R_BASE)
  623. #define DMA1 ((DMA_TypeDef *) DMA1_BASE)
  624. #define DMA1_Stream0 ((DMA_Stream_TypeDef *) DMA1_Stream0_BASE)
  625. #define DMA1_Stream1 ((DMA_Stream_TypeDef *) DMA1_Stream1_BASE)
  626. #define DMA1_Stream2 ((DMA_Stream_TypeDef *) DMA1_Stream2_BASE)
  627. #define DMA1_Stream3 ((DMA_Stream_TypeDef *) DMA1_Stream3_BASE)
  628. #define DMA1_Stream4 ((DMA_Stream_TypeDef *) DMA1_Stream4_BASE)
  629. #define DMA1_Stream5 ((DMA_Stream_TypeDef *) DMA1_Stream5_BASE)
  630. #define DMA1_Stream6 ((DMA_Stream_TypeDef *) DMA1_Stream6_BASE)
  631. #define DMA1_Stream7 ((DMA_Stream_TypeDef *) DMA1_Stream7_BASE)
  632. #define DMA2 ((DMA_TypeDef *) DMA2_BASE)
  633. #define DMA2_Stream0 ((DMA_Stream_TypeDef *) DMA2_Stream0_BASE)
  634. #define DMA2_Stream1 ((DMA_Stream_TypeDef *) DMA2_Stream1_BASE)
  635. #define DMA2_Stream2 ((DMA_Stream_TypeDef *) DMA2_Stream2_BASE)
  636. #define DMA2_Stream3 ((DMA_Stream_TypeDef *) DMA2_Stream3_BASE)
  637. #define DMA2_Stream4 ((DMA_Stream_TypeDef *) DMA2_Stream4_BASE)
  638. #define DMA2_Stream5 ((DMA_Stream_TypeDef *) DMA2_Stream5_BASE)
  639. #define DMA2_Stream6 ((DMA_Stream_TypeDef *) DMA2_Stream6_BASE)
  640. #define DMA2_Stream7 ((DMA_Stream_TypeDef *) DMA2_Stream7_BASE)
  641. #define RNG ((RNG_TypeDef *) RNG_BASE)
  642. #define DBGMCU ((DBGMCU_TypeDef *) DBGMCU_BASE)
  643. /**
  644. * @}
  645. */
  646. /** @addtogroup Exported_constants
  647. * @{
  648. */
  649. /** @addtogroup Peripheral_Registers_Bits_Definition
  650. * @{
  651. */
  652. /******************************************************************************/
  653. /* Peripheral Registers_Bits_Definition */
  654. /******************************************************************************/
  655. /******************************************************************************/
  656. /* */
  657. /* Analog to Digital Converter */
  658. /* */
  659. /******************************************************************************/
  660. /******************** Bit definition for ADC_SR register ********************/
  661. #define ADC_SR_AWD ((uint32_t)0x00000001) /*!<Analog watchdog flag */
  662. #define ADC_SR_EOC ((uint32_t)0x00000002) /*!<End of conversion */
  663. #define ADC_SR_JEOC ((uint32_t)0x00000004) /*!<Injected channel end of conversion */
  664. #define ADC_SR_JSTRT ((uint32_t)0x00000008) /*!<Injected channel Start flag */
  665. #define ADC_SR_STRT ((uint32_t)0x00000010) /*!<Regular channel Start flag */
  666. #define ADC_SR_OVR ((uint32_t)0x00000020) /*!<Overrun flag */
  667. /******************* Bit definition for ADC_CR1 register ********************/
  668. #define ADC_CR1_AWDCH ((uint32_t)0x0000001F) /*!<AWDCH[4:0] bits (Analog watchdog channel select bits) */
  669. #define ADC_CR1_AWDCH_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  670. #define ADC_CR1_AWDCH_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  671. #define ADC_CR1_AWDCH_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  672. #define ADC_CR1_AWDCH_3 ((uint32_t)0x00000008) /*!<Bit 3 */
  673. #define ADC_CR1_AWDCH_4 ((uint32_t)0x00000010) /*!<Bit 4 */
  674. #define ADC_CR1_EOCIE ((uint32_t)0x00000020) /*!<Interrupt enable for EOC */
  675. #define ADC_CR1_AWDIE ((uint32_t)0x00000040) /*!<AAnalog Watchdog interrupt enable */
  676. #define ADC_CR1_JEOCIE ((uint32_t)0x00000080) /*!<Interrupt enable for injected channels */
  677. #define ADC_CR1_SCAN ((uint32_t)0x00000100) /*!<Scan mode */
  678. #define ADC_CR1_AWDSGL ((uint32_t)0x00000200) /*!<Enable the watchdog on a single channel in scan mode */
  679. #define ADC_CR1_JAUTO ((uint32_t)0x00000400) /*!<Automatic injected group conversion */
  680. #define ADC_CR1_DISCEN ((uint32_t)0x00000800) /*!<Discontinuous mode on regular channels */
  681. #define ADC_CR1_JDISCEN ((uint32_t)0x00001000) /*!<Discontinuous mode on injected channels */
  682. #define ADC_CR1_DISCNUM ((uint32_t)0x0000E000) /*!<DISCNUM[2:0] bits (Discontinuous mode channel count) */
  683. #define ADC_CR1_DISCNUM_0 ((uint32_t)0x00002000) /*!<Bit 0 */
  684. #define ADC_CR1_DISCNUM_1 ((uint32_t)0x00004000) /*!<Bit 1 */
  685. #define ADC_CR1_DISCNUM_2 ((uint32_t)0x00008000) /*!<Bit 2 */
  686. #define ADC_CR1_JAWDEN ((uint32_t)0x00400000) /*!<Analog watchdog enable on injected channels */
  687. #define ADC_CR1_AWDEN ((uint32_t)0x00800000) /*!<Analog watchdog enable on regular channels */
  688. #define ADC_CR1_RES ((uint32_t)0x03000000) /*!<RES[2:0] bits (Resolution) */
  689. #define ADC_CR1_RES_0 ((uint32_t)0x01000000) /*!<Bit 0 */
  690. #define ADC_CR1_RES_1 ((uint32_t)0x02000000) /*!<Bit 1 */
  691. #define ADC_CR1_OVRIE ((uint32_t)0x04000000) /*!<overrun interrupt enable */
  692. /******************* Bit definition for ADC_CR2 register ********************/
  693. #define ADC_CR2_ADON ((uint32_t)0x00000001) /*!<A/D Converter ON / OFF */
  694. #define ADC_CR2_CONT ((uint32_t)0x00000002) /*!<Continuous Conversion */
  695. #define ADC_CR2_DMA ((uint32_t)0x00000100) /*!<Direct Memory access mode */
  696. #define ADC_CR2_DDS ((uint32_t)0x00000200) /*!<DMA disable selection (Single ADC) */
  697. #define ADC_CR2_EOCS ((uint32_t)0x00000400) /*!<End of conversion selection */
  698. #define ADC_CR2_ALIGN ((uint32_t)0x00000800) /*!<Data Alignment */
  699. #define ADC_CR2_JEXTSEL ((uint32_t)0x000F0000) /*!<JEXTSEL[3:0] bits (External event select for injected group) */
  700. #define ADC_CR2_JEXTSEL_0 ((uint32_t)0x00010000) /*!<Bit 0 */
  701. #define ADC_CR2_JEXTSEL_1 ((uint32_t)0x00020000) /*!<Bit 1 */
  702. #define ADC_CR2_JEXTSEL_2 ((uint32_t)0x00040000) /*!<Bit 2 */
  703. #define ADC_CR2_JEXTSEL_3 ((uint32_t)0x00080000) /*!<Bit 3 */
  704. #define ADC_CR2_JEXTEN ((uint32_t)0x00300000) /*!<JEXTEN[1:0] bits (External Trigger Conversion mode for injected channelsp) */
  705. #define ADC_CR2_JEXTEN_0 ((uint32_t)0x00100000) /*!<Bit 0 */
  706. #define ADC_CR2_JEXTEN_1 ((uint32_t)0x00200000) /*!<Bit 1 */
  707. #define ADC_CR2_JSWSTART ((uint32_t)0x00400000) /*!<Start Conversion of injected channels */
  708. #define ADC_CR2_EXTSEL ((uint32_t)0x0F000000) /*!<EXTSEL[3:0] bits (External Event Select for regular group) */
  709. #define ADC_CR2_EXTSEL_0 ((uint32_t)0x01000000) /*!<Bit 0 */
  710. #define ADC_CR2_EXTSEL_1 ((uint32_t)0x02000000) /*!<Bit 1 */
  711. #define ADC_CR2_EXTSEL_2 ((uint32_t)0x04000000) /*!<Bit 2 */
  712. #define ADC_CR2_EXTSEL_3 ((uint32_t)0x08000000) /*!<Bit 3 */
  713. #define ADC_CR2_EXTEN ((uint32_t)0x30000000) /*!<EXTEN[1:0] bits (External Trigger Conversion mode for regular channelsp) */
  714. #define ADC_CR2_EXTEN_0 ((uint32_t)0x10000000) /*!<Bit 0 */
  715. #define ADC_CR2_EXTEN_1 ((uint32_t)0x20000000) /*!<Bit 1 */
  716. #define ADC_CR2_SWSTART ((uint32_t)0x40000000) /*!<Start Conversion of regular channels */
  717. /****************** Bit definition for ADC_SMPR1 register *******************/
  718. #define ADC_SMPR1_SMP10 ((uint32_t)0x00000007) /*!<SMP10[2:0] bits (Channel 10 Sample time selection) */
  719. #define ADC_SMPR1_SMP10_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  720. #define ADC_SMPR1_SMP10_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  721. #define ADC_SMPR1_SMP10_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  722. #define ADC_SMPR1_SMP11 ((uint32_t)0x00000038) /*!<SMP11[2:0] bits (Channel 11 Sample time selection) */
  723. #define ADC_SMPR1_SMP11_0 ((uint32_t)0x00000008) /*!<Bit 0 */
  724. #define ADC_SMPR1_SMP11_1 ((uint32_t)0x00000010) /*!<Bit 1 */
  725. #define ADC_SMPR1_SMP11_2 ((uint32_t)0x00000020) /*!<Bit 2 */
  726. #define ADC_SMPR1_SMP12 ((uint32_t)0x000001C0) /*!<SMP12[2:0] bits (Channel 12 Sample time selection) */
  727. #define ADC_SMPR1_SMP12_0 ((uint32_t)0x00000040) /*!<Bit 0 */
  728. #define ADC_SMPR1_SMP12_1 ((uint32_t)0x00000080) /*!<Bit 1 */
  729. #define ADC_SMPR1_SMP12_2 ((uint32_t)0x00000100) /*!<Bit 2 */
  730. #define ADC_SMPR1_SMP13 ((uint32_t)0x00000E00) /*!<SMP13[2:0] bits (Channel 13 Sample time selection) */
  731. #define ADC_SMPR1_SMP13_0 ((uint32_t)0x00000200) /*!<Bit 0 */
  732. #define ADC_SMPR1_SMP13_1 ((uint32_t)0x00000400) /*!<Bit 1 */
  733. #define ADC_SMPR1_SMP13_2 ((uint32_t)0x00000800) /*!<Bit 2 */
  734. #define ADC_SMPR1_SMP14 ((uint32_t)0x00007000) /*!<SMP14[2:0] bits (Channel 14 Sample time selection) */
  735. #define ADC_SMPR1_SMP14_0 ((uint32_t)0x00001000) /*!<Bit 0 */
  736. #define ADC_SMPR1_SMP14_1 ((uint32_t)0x00002000) /*!<Bit 1 */
  737. #define ADC_SMPR1_SMP14_2 ((uint32_t)0x00004000) /*!<Bit 2 */
  738. #define ADC_SMPR1_SMP15 ((uint32_t)0x00038000) /*!<SMP15[2:0] bits (Channel 15 Sample time selection) */
  739. #define ADC_SMPR1_SMP15_0 ((uint32_t)0x00008000) /*!<Bit 0 */
  740. #define ADC_SMPR1_SMP15_1 ((uint32_t)0x00010000) /*!<Bit 1 */
  741. #define ADC_SMPR1_SMP15_2 ((uint32_t)0x00020000) /*!<Bit 2 */
  742. #define ADC_SMPR1_SMP16 ((uint32_t)0x001C0000) /*!<SMP16[2:0] bits (Channel 16 Sample time selection) */
  743. #define ADC_SMPR1_SMP16_0 ((uint32_t)0x00040000) /*!<Bit 0 */
  744. #define ADC_SMPR1_SMP16_1 ((uint32_t)0x00080000) /*!<Bit 1 */
  745. #define ADC_SMPR1_SMP16_2 ((uint32_t)0x00100000) /*!<Bit 2 */
  746. #define ADC_SMPR1_SMP17 ((uint32_t)0x00E00000) /*!<SMP17[2:0] bits (Channel 17 Sample time selection) */
  747. #define ADC_SMPR1_SMP17_0 ((uint32_t)0x00200000) /*!<Bit 0 */
  748. #define ADC_SMPR1_SMP17_1 ((uint32_t)0x00400000) /*!<Bit 1 */
  749. #define ADC_SMPR1_SMP17_2 ((uint32_t)0x00800000) /*!<Bit 2 */
  750. #define ADC_SMPR1_SMP18 ((uint32_t)0x07000000) /*!<SMP18[2:0] bits (Channel 18 Sample time selection) */
  751. #define ADC_SMPR1_SMP18_0 ((uint32_t)0x01000000) /*!<Bit 0 */
  752. #define ADC_SMPR1_SMP18_1 ((uint32_t)0x02000000) /*!<Bit 1 */
  753. #define ADC_SMPR1_SMP18_2 ((uint32_t)0x04000000) /*!<Bit 2 */
  754. /****************** Bit definition for ADC_SMPR2 register *******************/
  755. #define ADC_SMPR2_SMP0 ((uint32_t)0x00000007) /*!<SMP0[2:0] bits (Channel 0 Sample time selection) */
  756. #define ADC_SMPR2_SMP0_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  757. #define ADC_SMPR2_SMP0_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  758. #define ADC_SMPR2_SMP0_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  759. #define ADC_SMPR2_SMP1 ((uint32_t)0x00000038) /*!<SMP1[2:0] bits (Channel 1 Sample time selection) */
  760. #define ADC_SMPR2_SMP1_0 ((uint32_t)0x00000008) /*!<Bit 0 */
  761. #define ADC_SMPR2_SMP1_1 ((uint32_t)0x00000010) /*!<Bit 1 */
  762. #define ADC_SMPR2_SMP1_2 ((uint32_t)0x00000020) /*!<Bit 2 */
  763. #define ADC_SMPR2_SMP2 ((uint32_t)0x000001C0) /*!<SMP2[2:0] bits (Channel 2 Sample time selection) */
  764. #define ADC_SMPR2_SMP2_0 ((uint32_t)0x00000040) /*!<Bit 0 */
  765. #define ADC_SMPR2_SMP2_1 ((uint32_t)0x00000080) /*!<Bit 1 */
  766. #define ADC_SMPR2_SMP2_2 ((uint32_t)0x00000100) /*!<Bit 2 */
  767. #define ADC_SMPR2_SMP3 ((uint32_t)0x00000E00) /*!<SMP3[2:0] bits (Channel 3 Sample time selection) */
  768. #define ADC_SMPR2_SMP3_0 ((uint32_t)0x00000200) /*!<Bit 0 */
  769. #define ADC_SMPR2_SMP3_1 ((uint32_t)0x00000400) /*!<Bit 1 */
  770. #define ADC_SMPR2_SMP3_2 ((uint32_t)0x00000800) /*!<Bit 2 */
  771. #define ADC_SMPR2_SMP4 ((uint32_t)0x00007000) /*!<SMP4[2:0] bits (Channel 4 Sample time selection) */
  772. #define ADC_SMPR2_SMP4_0 ((uint32_t)0x00001000) /*!<Bit 0 */
  773. #define ADC_SMPR2_SMP4_1 ((uint32_t)0x00002000) /*!<Bit 1 */
  774. #define ADC_SMPR2_SMP4_2 ((uint32_t)0x00004000) /*!<Bit 2 */
  775. #define ADC_SMPR2_SMP5 ((uint32_t)0x00038000) /*!<SMP5[2:0] bits (Channel 5 Sample time selection) */
  776. #define ADC_SMPR2_SMP5_0 ((uint32_t)0x00008000) /*!<Bit 0 */
  777. #define ADC_SMPR2_SMP5_1 ((uint32_t)0x00010000) /*!<Bit 1 */
  778. #define ADC_SMPR2_SMP5_2 ((uint32_t)0x00020000) /*!<Bit 2 */
  779. #define ADC_SMPR2_SMP6 ((uint32_t)0x001C0000) /*!<SMP6[2:0] bits (Channel 6 Sample time selection) */
  780. #define ADC_SMPR2_SMP6_0 ((uint32_t)0x00040000) /*!<Bit 0 */
  781. #define ADC_SMPR2_SMP6_1 ((uint32_t)0x00080000) /*!<Bit 1 */
  782. #define ADC_SMPR2_SMP6_2 ((uint32_t)0x00100000) /*!<Bit 2 */
  783. #define ADC_SMPR2_SMP7 ((uint32_t)0x00E00000) /*!<SMP7[2:0] bits (Channel 7 Sample time selection) */
  784. #define ADC_SMPR2_SMP7_0 ((uint32_t)0x00200000) /*!<Bit 0 */
  785. #define ADC_SMPR2_SMP7_1 ((uint32_t)0x00400000) /*!<Bit 1 */
  786. #define ADC_SMPR2_SMP7_2 ((uint32_t)0x00800000) /*!<Bit 2 */
  787. #define ADC_SMPR2_SMP8 ((uint32_t)0x07000000) /*!<SMP8[2:0] bits (Channel 8 Sample time selection) */
  788. #define ADC_SMPR2_SMP8_0 ((uint32_t)0x01000000) /*!<Bit 0 */
  789. #define ADC_SMPR2_SMP8_1 ((uint32_t)0x02000000) /*!<Bit 1 */
  790. #define ADC_SMPR2_SMP8_2 ((uint32_t)0x04000000) /*!<Bit 2 */
  791. #define ADC_SMPR2_SMP9 ((uint32_t)0x38000000) /*!<SMP9[2:0] bits (Channel 9 Sample time selection) */
  792. #define ADC_SMPR2_SMP9_0 ((uint32_t)0x08000000) /*!<Bit 0 */
  793. #define ADC_SMPR2_SMP9_1 ((uint32_t)0x10000000) /*!<Bit 1 */
  794. #define ADC_SMPR2_SMP9_2 ((uint32_t)0x20000000) /*!<Bit 2 */
  795. /****************** Bit definition for ADC_JOFR1 register *******************/
  796. #define ADC_JOFR1_JOFFSET1 ((uint32_t)0x0FFF) /*!<Data offset for injected channel 1 */
  797. /****************** Bit definition for ADC_JOFR2 register *******************/
  798. #define ADC_JOFR2_JOFFSET2 ((uint32_t)0x0FFF) /*!<Data offset for injected channel 2 */
  799. /****************** Bit definition for ADC_JOFR3 register *******************/
  800. #define ADC_JOFR3_JOFFSET3 ((uint32_t)0x0FFF) /*!<Data offset for injected channel 3 */
  801. /****************** Bit definition for ADC_JOFR4 register *******************/
  802. #define ADC_JOFR4_JOFFSET4 ((uint32_t)0x0FFF) /*!<Data offset for injected channel 4 */
  803. /******************* Bit definition for ADC_HTR register ********************/
  804. #define ADC_HTR_HT ((uint32_t)0x0FFF) /*!<Analog watchdog high threshold */
  805. /******************* Bit definition for ADC_LTR register ********************/
  806. #define ADC_LTR_LT ((uint32_t)0x0FFF) /*!<Analog watchdog low threshold */
  807. /******************* Bit definition for ADC_SQR1 register *******************/
  808. #define ADC_SQR1_SQ13 ((uint32_t)0x0000001F) /*!<SQ13[4:0] bits (13th conversion in regular sequence) */
  809. #define ADC_SQR1_SQ13_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  810. #define ADC_SQR1_SQ13_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  811. #define ADC_SQR1_SQ13_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  812. #define ADC_SQR1_SQ13_3 ((uint32_t)0x00000008) /*!<Bit 3 */
  813. #define ADC_SQR1_SQ13_4 ((uint32_t)0x00000010) /*!<Bit 4 */
  814. #define ADC_SQR1_SQ14 ((uint32_t)0x000003E0) /*!<SQ14[4:0] bits (14th conversion in regular sequence) */
  815. #define ADC_SQR1_SQ14_0 ((uint32_t)0x00000020) /*!<Bit 0 */
  816. #define ADC_SQR1_SQ14_1 ((uint32_t)0x00000040) /*!<Bit 1 */
  817. #define ADC_SQR1_SQ14_2 ((uint32_t)0x00000080) /*!<Bit 2 */
  818. #define ADC_SQR1_SQ14_3 ((uint32_t)0x00000100) /*!<Bit 3 */
  819. #define ADC_SQR1_SQ14_4 ((uint32_t)0x00000200) /*!<Bit 4 */
  820. #define ADC_SQR1_SQ15 ((uint32_t)0x00007C00) /*!<SQ15[4:0] bits (15th conversion in regular sequence) */
  821. #define ADC_SQR1_SQ15_0 ((uint32_t)0x00000400) /*!<Bit 0 */
  822. #define ADC_SQR1_SQ15_1 ((uint32_t)0x00000800) /*!<Bit 1 */
  823. #define ADC_SQR1_SQ15_2 ((uint32_t)0x00001000) /*!<Bit 2 */
  824. #define ADC_SQR1_SQ15_3 ((uint32_t)0x00002000) /*!<Bit 3 */
  825. #define ADC_SQR1_SQ15_4 ((uint32_t)0x00004000) /*!<Bit 4 */
  826. #define ADC_SQR1_SQ16 ((uint32_t)0x000F8000) /*!<SQ16[4:0] bits (16th conversion in regular sequence) */
  827. #define ADC_SQR1_SQ16_0 ((uint32_t)0x00008000) /*!<Bit 0 */
  828. #define ADC_SQR1_SQ16_1 ((uint32_t)0x00010000) /*!<Bit 1 */
  829. #define ADC_SQR1_SQ16_2 ((uint32_t)0x00020000) /*!<Bit 2 */
  830. #define ADC_SQR1_SQ16_3 ((uint32_t)0x00040000) /*!<Bit 3 */
  831. #define ADC_SQR1_SQ16_4 ((uint32_t)0x00080000) /*!<Bit 4 */
  832. #define ADC_SQR1_L ((uint32_t)0x00F00000) /*!<L[3:0] bits (Regular channel sequence length) */
  833. #define ADC_SQR1_L_0 ((uint32_t)0x00100000) /*!<Bit 0 */
  834. #define ADC_SQR1_L_1 ((uint32_t)0x00200000) /*!<Bit 1 */
  835. #define ADC_SQR1_L_2 ((uint32_t)0x00400000) /*!<Bit 2 */
  836. #define ADC_SQR1_L_3 ((uint32_t)0x00800000) /*!<Bit 3 */
  837. /******************* Bit definition for ADC_SQR2 register *******************/
  838. #define ADC_SQR2_SQ7 ((uint32_t)0x0000001F) /*!<SQ7[4:0] bits (7th conversion in regular sequence) */
  839. #define ADC_SQR2_SQ7_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  840. #define ADC_SQR2_SQ7_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  841. #define ADC_SQR2_SQ7_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  842. #define ADC_SQR2_SQ7_3 ((uint32_t)0x00000008) /*!<Bit 3 */
  843. #define ADC_SQR2_SQ7_4 ((uint32_t)0x00000010) /*!<Bit 4 */
  844. #define ADC_SQR2_SQ8 ((uint32_t)0x000003E0) /*!<SQ8[4:0] bits (8th conversion in regular sequence) */
  845. #define ADC_SQR2_SQ8_0 ((uint32_t)0x00000020) /*!<Bit 0 */
  846. #define ADC_SQR2_SQ8_1 ((uint32_t)0x00000040) /*!<Bit 1 */
  847. #define ADC_SQR2_SQ8_2 ((uint32_t)0x00000080) /*!<Bit 2 */
  848. #define ADC_SQR2_SQ8_3 ((uint32_t)0x00000100) /*!<Bit 3 */
  849. #define ADC_SQR2_SQ8_4 ((uint32_t)0x00000200) /*!<Bit 4 */
  850. #define ADC_SQR2_SQ9 ((uint32_t)0x00007C00) /*!<SQ9[4:0] bits (9th conversion in regular sequence) */
  851. #define ADC_SQR2_SQ9_0 ((uint32_t)0x00000400) /*!<Bit 0 */
  852. #define ADC_SQR2_SQ9_1 ((uint32_t)0x00000800) /*!<Bit 1 */
  853. #define ADC_SQR2_SQ9_2 ((uint32_t)0x00001000) /*!<Bit 2 */
  854. #define ADC_SQR2_SQ9_3 ((uint32_t)0x00002000) /*!<Bit 3 */
  855. #define ADC_SQR2_SQ9_4 ((uint32_t)0x00004000) /*!<Bit 4 */
  856. #define ADC_SQR2_SQ10 ((uint32_t)0x000F8000) /*!<SQ10[4:0] bits (10th conversion in regular sequence) */
  857. #define ADC_SQR2_SQ10_0 ((uint32_t)0x00008000) /*!<Bit 0 */
  858. #define ADC_SQR2_SQ10_1 ((uint32_t)0x00010000) /*!<Bit 1 */
  859. #define ADC_SQR2_SQ10_2 ((uint32_t)0x00020000) /*!<Bit 2 */
  860. #define ADC_SQR2_SQ10_3 ((uint32_t)0x00040000) /*!<Bit 3 */
  861. #define ADC_SQR2_SQ10_4 ((uint32_t)0x00080000) /*!<Bit 4 */
  862. #define ADC_SQR2_SQ11 ((uint32_t)0x01F00000) /*!<SQ11[4:0] bits (11th conversion in regular sequence) */
  863. #define ADC_SQR2_SQ11_0 ((uint32_t)0x00100000) /*!<Bit 0 */
  864. #define ADC_SQR2_SQ11_1 ((uint32_t)0x00200000) /*!<Bit 1 */
  865. #define ADC_SQR2_SQ11_2 ((uint32_t)0x00400000) /*!<Bit 2 */
  866. #define ADC_SQR2_SQ11_3 ((uint32_t)0x00800000) /*!<Bit 3 */
  867. #define ADC_SQR2_SQ11_4 ((uint32_t)0x01000000) /*!<Bit 4 */
  868. #define ADC_SQR2_SQ12 ((uint32_t)0x3E000000) /*!<SQ12[4:0] bits (12th conversion in regular sequence) */
  869. #define ADC_SQR2_SQ12_0 ((uint32_t)0x02000000) /*!<Bit 0 */
  870. #define ADC_SQR2_SQ12_1 ((uint32_t)0x04000000) /*!<Bit 1 */
  871. #define ADC_SQR2_SQ12_2 ((uint32_t)0x08000000) /*!<Bit 2 */
  872. #define ADC_SQR2_SQ12_3 ((uint32_t)0x10000000) /*!<Bit 3 */
  873. #define ADC_SQR2_SQ12_4 ((uint32_t)0x20000000) /*!<Bit 4 */
  874. /******************* Bit definition for ADC_SQR3 register *******************/
  875. #define ADC_SQR3_SQ1 ((uint32_t)0x0000001F) /*!<SQ1[4:0] bits (1st conversion in regular sequence) */
  876. #define ADC_SQR3_SQ1_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  877. #define ADC_SQR3_SQ1_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  878. #define ADC_SQR3_SQ1_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  879. #define ADC_SQR3_SQ1_3 ((uint32_t)0x00000008) /*!<Bit 3 */
  880. #define ADC_SQR3_SQ1_4 ((uint32_t)0x00000010) /*!<Bit 4 */
  881. #define ADC_SQR3_SQ2 ((uint32_t)0x000003E0) /*!<SQ2[4:0] bits (2nd conversion in regular sequence) */
  882. #define ADC_SQR3_SQ2_0 ((uint32_t)0x00000020) /*!<Bit 0 */
  883. #define ADC_SQR3_SQ2_1 ((uint32_t)0x00000040) /*!<Bit 1 */
  884. #define ADC_SQR3_SQ2_2 ((uint32_t)0x00000080) /*!<Bit 2 */
  885. #define ADC_SQR3_SQ2_3 ((uint32_t)0x00000100) /*!<Bit 3 */
  886. #define ADC_SQR3_SQ2_4 ((uint32_t)0x00000200) /*!<Bit 4 */
  887. #define ADC_SQR3_SQ3 ((uint32_t)0x00007C00) /*!<SQ3[4:0] bits (3rd conversion in regular sequence) */
  888. #define ADC_SQR3_SQ3_0 ((uint32_t)0x00000400) /*!<Bit 0 */
  889. #define ADC_SQR3_SQ3_1 ((uint32_t)0x00000800) /*!<Bit 1 */
  890. #define ADC_SQR3_SQ3_2 ((uint32_t)0x00001000) /*!<Bit 2 */
  891. #define ADC_SQR3_SQ3_3 ((uint32_t)0x00002000) /*!<Bit 3 */
  892. #define ADC_SQR3_SQ3_4 ((uint32_t)0x00004000) /*!<Bit 4 */
  893. #define ADC_SQR3_SQ4 ((uint32_t)0x000F8000) /*!<SQ4[4:0] bits (4th conversion in regular sequence) */
  894. #define ADC_SQR3_SQ4_0 ((uint32_t)0x00008000) /*!<Bit 0 */
  895. #define ADC_SQR3_SQ4_1 ((uint32_t)0x00010000) /*!<Bit 1 */
  896. #define ADC_SQR3_SQ4_2 ((uint32_t)0x00020000) /*!<Bit 2 */
  897. #define ADC_SQR3_SQ4_3 ((uint32_t)0x00040000) /*!<Bit 3 */
  898. #define ADC_SQR3_SQ4_4 ((uint32_t)0x00080000) /*!<Bit 4 */
  899. #define ADC_SQR3_SQ5 ((uint32_t)0x01F00000) /*!<SQ5[4:0] bits (5th conversion in regular sequence) */
  900. #define ADC_SQR3_SQ5_0 ((uint32_t)0x00100000) /*!<Bit 0 */
  901. #define ADC_SQR3_SQ5_1 ((uint32_t)0x00200000) /*!<Bit 1 */
  902. #define ADC_SQR3_SQ5_2 ((uint32_t)0x00400000) /*!<Bit 2 */
  903. #define ADC_SQR3_SQ5_3 ((uint32_t)0x00800000) /*!<Bit 3 */
  904. #define ADC_SQR3_SQ5_4 ((uint32_t)0x01000000) /*!<Bit 4 */
  905. #define ADC_SQR3_SQ6 ((uint32_t)0x3E000000) /*!<SQ6[4:0] bits (6th conversion in regular sequence) */
  906. #define ADC_SQR3_SQ6_0 ((uint32_t)0x02000000) /*!<Bit 0 */
  907. #define ADC_SQR3_SQ6_1 ((uint32_t)0x04000000) /*!<Bit 1 */
  908. #define ADC_SQR3_SQ6_2 ((uint32_t)0x08000000) /*!<Bit 2 */
  909. #define ADC_SQR3_SQ6_3 ((uint32_t)0x10000000) /*!<Bit 3 */
  910. #define ADC_SQR3_SQ6_4 ((uint32_t)0x20000000) /*!<Bit 4 */
  911. /******************* Bit definition for ADC_JSQR register *******************/
  912. #define ADC_JSQR_JSQ1 ((uint32_t)0x0000001F) /*!<JSQ1[4:0] bits (1st conversion in injected sequence) */
  913. #define ADC_JSQR_JSQ1_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  914. #define ADC_JSQR_JSQ1_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  915. #define ADC_JSQR_JSQ1_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  916. #define ADC_JSQR_JSQ1_3 ((uint32_t)0x00000008) /*!<Bit 3 */
  917. #define ADC_JSQR_JSQ1_4 ((uint32_t)0x00000010) /*!<Bit 4 */
  918. #define ADC_JSQR_JSQ2 ((uint32_t)0x000003E0) /*!<JSQ2[4:0] bits (2nd conversion in injected sequence) */
  919. #define ADC_JSQR_JSQ2_0 ((uint32_t)0x00000020) /*!<Bit 0 */
  920. #define ADC_JSQR_JSQ2_1 ((uint32_t)0x00000040) /*!<Bit 1 */
  921. #define ADC_JSQR_JSQ2_2 ((uint32_t)0x00000080) /*!<Bit 2 */
  922. #define ADC_JSQR_JSQ2_3 ((uint32_t)0x00000100) /*!<Bit 3 */
  923. #define ADC_JSQR_JSQ2_4 ((uint32_t)0x00000200) /*!<Bit 4 */
  924. #define ADC_JSQR_JSQ3 ((uint32_t)0x00007C00) /*!<JSQ3[4:0] bits (3rd conversion in injected sequence) */
  925. #define ADC_JSQR_JSQ3_0 ((uint32_t)0x00000400) /*!<Bit 0 */
  926. #define ADC_JSQR_JSQ3_1 ((uint32_t)0x00000800) /*!<Bit 1 */
  927. #define ADC_JSQR_JSQ3_2 ((uint32_t)0x00001000) /*!<Bit 2 */
  928. #define ADC_JSQR_JSQ3_3 ((uint32_t)0x00002000) /*!<Bit 3 */
  929. #define ADC_JSQR_JSQ3_4 ((uint32_t)0x00004000) /*!<Bit 4 */
  930. #define ADC_JSQR_JSQ4 ((uint32_t)0x000F8000) /*!<JSQ4[4:0] bits (4th conversion in injected sequence) */
  931. #define ADC_JSQR_JSQ4_0 ((uint32_t)0x00008000) /*!<Bit 0 */
  932. #define ADC_JSQR_JSQ4_1 ((uint32_t)0x00010000) /*!<Bit 1 */
  933. #define ADC_JSQR_JSQ4_2 ((uint32_t)0x00020000) /*!<Bit 2 */
  934. #define ADC_JSQR_JSQ4_3 ((uint32_t)0x00040000) /*!<Bit 3 */
  935. #define ADC_JSQR_JSQ4_4 ((uint32_t)0x00080000) /*!<Bit 4 */
  936. #define ADC_JSQR_JL ((uint32_t)0x00300000) /*!<JL[1:0] bits (Injected Sequence length) */
  937. #define ADC_JSQR_JL_0 ((uint32_t)0x00100000) /*!<Bit 0 */
  938. #define ADC_JSQR_JL_1 ((uint32_t)0x00200000) /*!<Bit 1 */
  939. /******************* Bit definition for ADC_JDR1 register *******************/
  940. #define ADC_JDR1_JDATA ((uint32_t)0xFFFF) /*!<Injected data */
  941. /******************* Bit definition for ADC_JDR2 register *******************/
  942. #define ADC_JDR2_JDATA ((uint32_t)0xFFFF) /*!<Injected data */
  943. /******************* Bit definition for ADC_JDR3 register *******************/
  944. #define ADC_JDR3_JDATA ((uint32_t)0xFFFF) /*!<Injected data */
  945. /******************* Bit definition for ADC_JDR4 register *******************/
  946. #define ADC_JDR4_JDATA ((uint32_t)0xFFFF) /*!<Injected data */
  947. /******************** Bit definition for ADC_DR register ********************/
  948. #define ADC_DR_DATA ((uint32_t)0x0000FFFF) /*!<Regular data */
  949. #define ADC_DR_ADC2DATA ((uint32_t)0xFFFF0000) /*!<ADC2 data */
  950. /******************* Bit definition for ADC_CSR register ********************/
  951. #define ADC_CSR_AWD1 ((uint32_t)0x00000001) /*!<ADC1 Analog watchdog flag */
  952. #define ADC_CSR_EOC1 ((uint32_t)0x00000002) /*!<ADC1 End of conversion */
  953. #define ADC_CSR_JEOC1 ((uint32_t)0x00000004) /*!<ADC1 Injected channel end of conversion */
  954. #define ADC_CSR_JSTRT1 ((uint32_t)0x00000008) /*!<ADC1 Injected channel Start flag */
  955. #define ADC_CSR_STRT1 ((uint32_t)0x00000010) /*!<ADC1 Regular channel Start flag */
  956. #define ADC_CSR_DOVR1 ((uint32_t)0x00000020) /*!<ADC1 DMA overrun flag */
  957. #define ADC_CSR_AWD2 ((uint32_t)0x00000100) /*!<ADC2 Analog watchdog flag */
  958. #define ADC_CSR_EOC2 ((uint32_t)0x00000200) /*!<ADC2 End of conversion */
  959. #define ADC_CSR_JEOC2 ((uint32_t)0x00000400) /*!<ADC2 Injected channel end of conversion */
  960. #define ADC_CSR_JSTRT2 ((uint32_t)0x00000800) /*!<ADC2 Injected channel Start flag */
  961. #define ADC_CSR_STRT2 ((uint32_t)0x00001000) /*!<ADC2 Regular channel Start flag */
  962. #define ADC_CSR_DOVR2 ((uint32_t)0x00002000) /*!<ADC2 DMA overrun flag */
  963. #define ADC_CSR_AWD3 ((uint32_t)0x00010000) /*!<ADC3 Analog watchdog flag */
  964. #define ADC_CSR_EOC3 ((uint32_t)0x00020000) /*!<ADC3 End of conversion */
  965. #define ADC_CSR_JEOC3 ((uint32_t)0x00040000) /*!<ADC3 Injected channel end of conversion */
  966. #define ADC_CSR_JSTRT3 ((uint32_t)0x00080000) /*!<ADC3 Injected channel Start flag */
  967. #define ADC_CSR_STRT3 ((uint32_t)0x00100000) /*!<ADC3 Regular channel Start flag */
  968. #define ADC_CSR_DOVR3 ((uint32_t)0x00200000) /*!<ADC3 DMA overrun flag */
  969. /******************* Bit definition for ADC_CCR register ********************/
  970. #define ADC_CCR_MULTI ((uint32_t)0x0000001F) /*!<MULTI[4:0] bits (Multi-ADC mode selection) */
  971. #define ADC_CCR_MULTI_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  972. #define ADC_CCR_MULTI_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  973. #define ADC_CCR_MULTI_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  974. #define ADC_CCR_MULTI_3 ((uint32_t)0x00000008) /*!<Bit 3 */
  975. #define ADC_CCR_MULTI_4 ((uint32_t)0x00000010) /*!<Bit 4 */
  976. #define ADC_CCR_DELAY ((uint32_t)0x00000F00) /*!<DELAY[3:0] bits (Delay between 2 sampling phases) */
  977. #define ADC_CCR_DELAY_0 ((uint32_t)0x00000100) /*!<Bit 0 */
  978. #define ADC_CCR_DELAY_1 ((uint32_t)0x00000200) /*!<Bit 1 */
  979. #define ADC_CCR_DELAY_2 ((uint32_t)0x00000400) /*!<Bit 2 */
  980. #define ADC_CCR_DELAY_3 ((uint32_t)0x00000800) /*!<Bit 3 */
  981. #define ADC_CCR_DDS ((uint32_t)0x00002000) /*!<DMA disable selection (Multi-ADC mode) */
  982. #define ADC_CCR_DMA ((uint32_t)0x0000C000) /*!<DMA[1:0] bits (Direct Memory Access mode for multimode) */
  983. #define ADC_CCR_DMA_0 ((uint32_t)0x00004000) /*!<Bit 0 */
  984. #define ADC_CCR_DMA_1 ((uint32_t)0x00008000) /*!<Bit 1 */
  985. #define ADC_CCR_ADCPRE ((uint32_t)0x00030000) /*!<ADCPRE[1:0] bits (ADC prescaler) */
  986. #define ADC_CCR_ADCPRE_0 ((uint32_t)0x00010000) /*!<Bit 0 */
  987. #define ADC_CCR_ADCPRE_1 ((uint32_t)0x00020000) /*!<Bit 1 */
  988. #define ADC_CCR_VBATE ((uint32_t)0x00400000) /*!<VBAT Enable */
  989. #define ADC_CCR_TSVREFE ((uint32_t)0x00800000) /*!<Temperature Sensor and VREFINT Enable */
  990. /******************* Bit definition for ADC_CDR register ********************/
  991. #define ADC_CDR_DATA1 ((uint32_t)0x0000FFFF) /*!<1st data of a pair of regular conversions */
  992. #define ADC_CDR_DATA2 ((uint32_t)0xFFFF0000) /*!<2nd data of a pair of regular conversions */
  993. /******************************************************************************/
  994. /* */
  995. /* CRC calculation unit */
  996. /* */
  997. /******************************************************************************/
  998. /******************* Bit definition for CRC_DR register *********************/
  999. #define CRC_DR_DR ((uint32_t)0xFFFFFFFF) /*!< Data register bits */
  1000. /******************* Bit definition for CRC_IDR register ********************/
  1001. #define CRC_IDR_IDR ((uint32_t)0xFF) /*!< General-purpose 8-bit data register bits */
  1002. /******************** Bit definition for CRC_CR register ********************/
  1003. #define CRC_CR_RESET ((uint32_t)0x01) /*!< RESET bit */
  1004. /******************************************************************************/
  1005. /* */
  1006. /* Debug MCU */
  1007. /* */
  1008. /******************************************************************************/
  1009. /******************************************************************************/
  1010. /* */
  1011. /* DMA Controller */
  1012. /* */
  1013. /******************************************************************************/
  1014. /******************** Bits definition for DMA_SxCR register *****************/
  1015. #define DMA_SxCR_CHSEL ((uint32_t)0x0E000000)
  1016. #define DMA_SxCR_CHSEL_0 ((uint32_t)0x02000000)
  1017. #define DMA_SxCR_CHSEL_1 ((uint32_t)0x04000000)
  1018. #define DMA_SxCR_CHSEL_2 ((uint32_t)0x08000000)
  1019. #define DMA_SxCR_MBURST ((uint32_t)0x01800000)
  1020. #define DMA_SxCR_MBURST_0 ((uint32_t)0x00800000)
  1021. #define DMA_SxCR_MBURST_1 ((uint32_t)0x01000000)
  1022. #define DMA_SxCR_PBURST ((uint32_t)0x00600000)
  1023. #define DMA_SxCR_PBURST_0 ((uint32_t)0x00200000)
  1024. #define DMA_SxCR_PBURST_1 ((uint32_t)0x00400000)
  1025. #define DMA_SxCR_ACK ((uint32_t)0x00100000)
  1026. #define DMA_SxCR_CT ((uint32_t)0x00080000)
  1027. #define DMA_SxCR_DBM ((uint32_t)0x00040000)
  1028. #define DMA_SxCR_PL ((uint32_t)0x00030000)
  1029. #define DMA_SxCR_PL_0 ((uint32_t)0x00010000)
  1030. #define DMA_SxCR_PL_1 ((uint32_t)0x00020000)
  1031. #define DMA_SxCR_PINCOS ((uint32_t)0x00008000)
  1032. #define DMA_SxCR_MSIZE ((uint32_t)0x00006000)
  1033. #define DMA_SxCR_MSIZE_0 ((uint32_t)0x00002000)
  1034. #define DMA_SxCR_MSIZE_1 ((uint32_t)0x00004000)
  1035. #define DMA_SxCR_PSIZE ((uint32_t)0x00001800)
  1036. #define DMA_SxCR_PSIZE_0 ((uint32_t)0x00000800)
  1037. #define DMA_SxCR_PSIZE_1 ((uint32_t)0x00001000)
  1038. #define DMA_SxCR_MINC ((uint32_t)0x00000400)
  1039. #define DMA_SxCR_PINC ((uint32_t)0x00000200)
  1040. #define DMA_SxCR_CIRC ((uint32_t)0x00000100)
  1041. #define DMA_SxCR_DIR ((uint32_t)0x000000C0)
  1042. #define DMA_SxCR_DIR_0 ((uint32_t)0x00000040)
  1043. #define DMA_SxCR_DIR_1 ((uint32_t)0x00000080)
  1044. #define DMA_SxCR_PFCTRL ((uint32_t)0x00000020)
  1045. #define DMA_SxCR_TCIE ((uint32_t)0x00000010)
  1046. #define DMA_SxCR_HTIE ((uint32_t)0x00000008)
  1047. #define DMA_SxCR_TEIE ((uint32_t)0x00000004)
  1048. #define DMA_SxCR_DMEIE ((uint32_t)0x00000002)
  1049. #define DMA_SxCR_EN ((uint32_t)0x00000001)
  1050. /******************** Bits definition for DMA_SxCNDTR register **************/
  1051. #define DMA_SxNDT ((uint32_t)0x0000FFFF)
  1052. #define DMA_SxNDT_0 ((uint32_t)0x00000001)
  1053. #define DMA_SxNDT_1 ((uint32_t)0x00000002)
  1054. #define DMA_SxNDT_2 ((uint32_t)0x00000004)
  1055. #define DMA_SxNDT_3 ((uint32_t)0x00000008)
  1056. #define DMA_SxNDT_4 ((uint32_t)0x00000010)
  1057. #define DMA_SxNDT_5 ((uint32_t)0x00000020)
  1058. #define DMA_SxNDT_6 ((uint32_t)0x00000040)
  1059. #define DMA_SxNDT_7 ((uint32_t)0x00000080)
  1060. #define DMA_SxNDT_8 ((uint32_t)0x00000100)
  1061. #define DMA_SxNDT_9 ((uint32_t)0x00000200)
  1062. #define DMA_SxNDT_10 ((uint32_t)0x00000400)
  1063. #define DMA_SxNDT_11 ((uint32_t)0x00000800)
  1064. #define DMA_SxNDT_12 ((uint32_t)0x00001000)
  1065. #define DMA_SxNDT_13 ((uint32_t)0x00002000)
  1066. #define DMA_SxNDT_14 ((uint32_t)0x00004000)
  1067. #define DMA_SxNDT_15 ((uint32_t)0x00008000)
  1068. /******************** Bits definition for DMA_SxFCR register ****************/
  1069. #define DMA_SxFCR_FEIE ((uint32_t)0x00000080)
  1070. #define DMA_SxFCR_FS ((uint32_t)0x00000038)
  1071. #define DMA_SxFCR_FS_0 ((uint32_t)0x00000008)
  1072. #define DMA_SxFCR_FS_1 ((uint32_t)0x00000010)
  1073. #define DMA_SxFCR_FS_2 ((uint32_t)0x00000020)
  1074. #define DMA_SxFCR_DMDIS ((uint32_t)0x00000004)
  1075. #define DMA_SxFCR_FTH ((uint32_t)0x00000003)
  1076. #define DMA_SxFCR_FTH_0 ((uint32_t)0x00000001)
  1077. #define DMA_SxFCR_FTH_1 ((uint32_t)0x00000002)
  1078. /******************** Bits definition for DMA_LISR register *****************/
  1079. #define DMA_LISR_TCIF3 ((uint32_t)0x08000000)
  1080. #define DMA_LISR_HTIF3 ((uint32_t)0x04000000)
  1081. #define DMA_LISR_TEIF3 ((uint32_t)0x02000000)
  1082. #define DMA_LISR_DMEIF3 ((uint32_t)0x01000000)
  1083. #define DMA_LISR_FEIF3 ((uint32_t)0x00400000)
  1084. #define DMA_LISR_TCIF2 ((uint32_t)0x00200000)
  1085. #define DMA_LISR_HTIF2 ((uint32_t)0x00100000)
  1086. #define DMA_LISR_TEIF2 ((uint32_t)0x00080000)
  1087. #define DMA_LISR_DMEIF2 ((uint32_t)0x00040000)
  1088. #define DMA_LISR_FEIF2 ((uint32_t)0x00010000)
  1089. #define DMA_LISR_TCIF1 ((uint32_t)0x00000800)
  1090. #define DMA_LISR_HTIF1 ((uint32_t)0x00000400)
  1091. #define DMA_LISR_TEIF1 ((uint32_t)0x00000200)
  1092. #define DMA_LISR_DMEIF1 ((uint32_t)0x00000100)
  1093. #define DMA_LISR_FEIF1 ((uint32_t)0x00000040)
  1094. #define DMA_LISR_TCIF0 ((uint32_t)0x00000020)
  1095. #define DMA_LISR_HTIF0 ((uint32_t)0x00000010)
  1096. #define DMA_LISR_TEIF0 ((uint32_t)0x00000008)
  1097. #define DMA_LISR_DMEIF0 ((uint32_t)0x00000004)
  1098. #define DMA_LISR_FEIF0 ((uint32_t)0x00000001)
  1099. /******************** Bits definition for DMA_HISR register *****************/
  1100. #define DMA_HISR_TCIF7 ((uint32_t)0x08000000)
  1101. #define DMA_HISR_HTIF7 ((uint32_t)0x04000000)
  1102. #define DMA_HISR_TEIF7 ((uint32_t)0x02000000)
  1103. #define DMA_HISR_DMEIF7 ((uint32_t)0x01000000)
  1104. #define DMA_HISR_FEIF7 ((uint32_t)0x00400000)
  1105. #define DMA_HISR_TCIF6 ((uint32_t)0x00200000)
  1106. #define DMA_HISR_HTIF6 ((uint32_t)0x00100000)
  1107. #define DMA_HISR_TEIF6 ((uint32_t)0x00080000)
  1108. #define DMA_HISR_DMEIF6 ((uint32_t)0x00040000)
  1109. #define DMA_HISR_FEIF6 ((uint32_t)0x00010000)
  1110. #define DMA_HISR_TCIF5 ((uint32_t)0x00000800)
  1111. #define DMA_HISR_HTIF5 ((uint32_t)0x00000400)
  1112. #define DMA_HISR_TEIF5 ((uint32_t)0x00000200)
  1113. #define DMA_HISR_DMEIF5 ((uint32_t)0x00000100)
  1114. #define DMA_HISR_FEIF5 ((uint32_t)0x00000040)
  1115. #define DMA_HISR_TCIF4 ((uint32_t)0x00000020)
  1116. #define DMA_HISR_HTIF4 ((uint32_t)0x00000010)
  1117. #define DMA_HISR_TEIF4 ((uint32_t)0x00000008)
  1118. #define DMA_HISR_DMEIF4 ((uint32_t)0x00000004)
  1119. #define DMA_HISR_FEIF4 ((uint32_t)0x00000001)
  1120. /******************** Bits definition for DMA_LIFCR register ****************/
  1121. #define DMA_LIFCR_CTCIF3 ((uint32_t)0x08000000)
  1122. #define DMA_LIFCR_CHTIF3 ((uint32_t)0x04000000)
  1123. #define DMA_LIFCR_CTEIF3 ((uint32_t)0x02000000)
  1124. #define DMA_LIFCR_CDMEIF3 ((uint32_t)0x01000000)
  1125. #define DMA_LIFCR_CFEIF3 ((uint32_t)0x00400000)
  1126. #define DMA_LIFCR_CTCIF2 ((uint32_t)0x00200000)
  1127. #define DMA_LIFCR_CHTIF2 ((uint32_t)0x00100000)
  1128. #define DMA_LIFCR_CTEIF2 ((uint32_t)0x00080000)
  1129. #define DMA_LIFCR_CDMEIF2 ((uint32_t)0x00040000)
  1130. #define DMA_LIFCR_CFEIF2 ((uint32_t)0x00010000)
  1131. #define DMA_LIFCR_CTCIF1 ((uint32_t)0x00000800)
  1132. #define DMA_LIFCR_CHTIF1 ((uint32_t)0x00000400)
  1133. #define DMA_LIFCR_CTEIF1 ((uint32_t)0x00000200)
  1134. #define DMA_LIFCR_CDMEIF1 ((uint32_t)0x00000100)
  1135. #define DMA_LIFCR_CFEIF1 ((uint32_t)0x00000040)
  1136. #define DMA_LIFCR_CTCIF0 ((uint32_t)0x00000020)
  1137. #define DMA_LIFCR_CHTIF0 ((uint32_t)0x00000010)
  1138. #define DMA_LIFCR_CTEIF0 ((uint32_t)0x00000008)
  1139. #define DMA_LIFCR_CDMEIF0 ((uint32_t)0x00000004)
  1140. #define DMA_LIFCR_CFEIF0 ((uint32_t)0x00000001)
  1141. /******************** Bits definition for DMA_HIFCR register ****************/
  1142. #define DMA_HIFCR_CTCIF7 ((uint32_t)0x08000000)
  1143. #define DMA_HIFCR_CHTIF7 ((uint32_t)0x04000000)
  1144. #define DMA_HIFCR_CTEIF7 ((uint32_t)0x02000000)
  1145. #define DMA_HIFCR_CDMEIF7 ((uint32_t)0x01000000)
  1146. #define DMA_HIFCR_CFEIF7 ((uint32_t)0x00400000)
  1147. #define DMA_HIFCR_CTCIF6 ((uint32_t)0x00200000)
  1148. #define DMA_HIFCR_CHTIF6 ((uint32_t)0x00100000)
  1149. #define DMA_HIFCR_CTEIF6 ((uint32_t)0x00080000)
  1150. #define DMA_HIFCR_CDMEIF6 ((uint32_t)0x00040000)
  1151. #define DMA_HIFCR_CFEIF6 ((uint32_t)0x00010000)
  1152. #define DMA_HIFCR_CTCIF5 ((uint32_t)0x00000800)
  1153. #define DMA_HIFCR_CHTIF5 ((uint32_t)0x00000400)
  1154. #define DMA_HIFCR_CTEIF5 ((uint32_t)0x00000200)
  1155. #define DMA_HIFCR_CDMEIF5 ((uint32_t)0x00000100)
  1156. #define DMA_HIFCR_CFEIF5 ((uint32_t)0x00000040)
  1157. #define DMA_HIFCR_CTCIF4 ((uint32_t)0x00000020)
  1158. #define DMA_HIFCR_CHTIF4 ((uint32_t)0x00000010)
  1159. #define DMA_HIFCR_CTEIF4 ((uint32_t)0x00000008)
  1160. #define DMA_HIFCR_CDMEIF4 ((uint32_t)0x00000004)
  1161. #define DMA_HIFCR_CFEIF4 ((uint32_t)0x00000001)
  1162. /******************************************************************************/
  1163. /* */
  1164. /* External Interrupt/Event Controller */
  1165. /* */
  1166. /******************************************************************************/
  1167. /******************* Bit definition for EXTI_IMR register *******************/
  1168. #define EXTI_IMR_MR0 ((uint32_t)0x00000001) /*!< Interrupt Mask on line 0 */
  1169. #define EXTI_IMR_MR1 ((uint32_t)0x00000002) /*!< Interrupt Mask on line 1 */
  1170. #define EXTI_IMR_MR2 ((uint32_t)0x00000004) /*!< Interrupt Mask on line 2 */
  1171. #define EXTI_IMR_MR3 ((uint32_t)0x00000008) /*!< Interrupt Mask on line 3 */
  1172. #define EXTI_IMR_MR4 ((uint32_t)0x00000010) /*!< Interrupt Mask on line 4 */
  1173. #define EXTI_IMR_MR5 ((uint32_t)0x00000020) /*!< Interrupt Mask on line 5 */
  1174. #define EXTI_IMR_MR6 ((uint32_t)0x00000040) /*!< Interrupt Mask on line 6 */
  1175. #define EXTI_IMR_MR7 ((uint32_t)0x00000080) /*!< Interrupt Mask on line 7 */
  1176. #define EXTI_IMR_MR8 ((uint32_t)0x00000100) /*!< Interrupt Mask on line 8 */
  1177. #define EXTI_IMR_MR9 ((uint32_t)0x00000200) /*!< Interrupt Mask on line 9 */
  1178. #define EXTI_IMR_MR10 ((uint32_t)0x00000400) /*!< Interrupt Mask on line 10 */
  1179. #define EXTI_IMR_MR11 ((uint32_t)0x00000800) /*!< Interrupt Mask on line 11 */
  1180. #define EXTI_IMR_MR12 ((uint32_t)0x00001000) /*!< Interrupt Mask on line 12 */
  1181. #define EXTI_IMR_MR13 ((uint32_t)0x00002000) /*!< Interrupt Mask on line 13 */
  1182. #define EXTI_IMR_MR14 ((uint32_t)0x00004000) /*!< Interrupt Mask on line 14 */
  1183. #define EXTI_IMR_MR15 ((uint32_t)0x00008000) /*!< Interrupt Mask on line 15 */
  1184. #define EXTI_IMR_MR16 ((uint32_t)0x00010000) /*!< Interrupt Mask on line 16 */
  1185. #define EXTI_IMR_MR17 ((uint32_t)0x00020000) /*!< Interrupt Mask on line 17 */
  1186. #define EXTI_IMR_MR18 ((uint32_t)0x00040000) /*!< Interrupt Mask on line 18 */
  1187. #define EXTI_IMR_MR19 ((uint32_t)0x00080000) /*!< Interrupt Mask on line 19 */
  1188. #define EXTI_IMR_MR20 ((uint32_t)0x00100000) /*!< Interrupt Mask on line 20 */
  1189. #define EXTI_IMR_MR21 ((uint32_t)0x00200000) /*!< Interrupt Mask on line 21 */
  1190. #define EXTI_IMR_MR22 ((uint32_t)0x00400000) /*!< Interrupt Mask on line 22 */
  1191. #define EXTI_IMR_MR23 ((uint32_t)0x00800000) /*!< Interrupt Mask on line 23 */
  1192. /******************* Bit definition for EXTI_EMR register *******************/
  1193. #define EXTI_EMR_MR0 ((uint32_t)0x00000001) /*!< Event Mask on line 0 */
  1194. #define EXTI_EMR_MR1 ((uint32_t)0x00000002) /*!< Event Mask on line 1 */
  1195. #define EXTI_EMR_MR2 ((uint32_t)0x00000004) /*!< Event Mask on line 2 */
  1196. #define EXTI_EMR_MR3 ((uint32_t)0x00000008) /*!< Event Mask on line 3 */
  1197. #define EXTI_EMR_MR4 ((uint32_t)0x00000010) /*!< Event Mask on line 4 */
  1198. #define EXTI_EMR_MR5 ((uint32_t)0x00000020) /*!< Event Mask on line 5 */
  1199. #define EXTI_EMR_MR6 ((uint32_t)0x00000040) /*!< Event Mask on line 6 */
  1200. #define EXTI_EMR_MR7 ((uint32_t)0x00000080) /*!< Event Mask on line 7 */
  1201. #define EXTI_EMR_MR8 ((uint32_t)0x00000100) /*!< Event Mask on line 8 */
  1202. #define EXTI_EMR_MR9 ((uint32_t)0x00000200) /*!< Event Mask on line 9 */
  1203. #define EXTI_EMR_MR10 ((uint32_t)0x00000400) /*!< Event Mask on line 10 */
  1204. #define EXTI_EMR_MR11 ((uint32_t)0x00000800) /*!< Event Mask on line 11 */
  1205. #define EXTI_EMR_MR12 ((uint32_t)0x00001000) /*!< Event Mask on line 12 */
  1206. #define EXTI_EMR_MR13 ((uint32_t)0x00002000) /*!< Event Mask on line 13 */
  1207. #define EXTI_EMR_MR14 ((uint32_t)0x00004000) /*!< Event Mask on line 14 */
  1208. #define EXTI_EMR_MR15 ((uint32_t)0x00008000) /*!< Event Mask on line 15 */
  1209. #define EXTI_EMR_MR16 ((uint32_t)0x00010000) /*!< Event Mask on line 16 */
  1210. #define EXTI_EMR_MR17 ((uint32_t)0x00020000) /*!< Event Mask on line 17 */
  1211. #define EXTI_EMR_MR18 ((uint32_t)0x00040000) /*!< Event Mask on line 18 */
  1212. #define EXTI_EMR_MR19 ((uint32_t)0x00080000) /*!< Event Mask on line 19 */
  1213. #define EXTI_EMR_MR20 ((uint32_t)0x00100000) /*!< Event Mask on line 20 */
  1214. #define EXTI_EMR_MR21 ((uint32_t)0x00200000) /*!< Event Mask on line 21 */
  1215. #define EXTI_EMR_MR22 ((uint32_t)0x00400000) /*!< Event Mask on line 22 */
  1216. #define EXTI_EMR_MR23 ((uint32_t)0x00800000) /*!< Event Mask on line 23 */
  1217. /****************** Bit definition for EXTI_RTSR register *******************/
  1218. #define EXTI_RTSR_TR0 ((uint32_t)0x00000001) /*!< Rising trigger event configuration bit of line 0 */
  1219. #define EXTI_RTSR_TR1 ((uint32_t)0x00000002) /*!< Rising trigger event configuration bit of line 1 */
  1220. #define EXTI_RTSR_TR2 ((uint32_t)0x00000004) /*!< Rising trigger event configuration bit of line 2 */
  1221. #define EXTI_RTSR_TR3 ((uint32_t)0x00000008) /*!< Rising trigger event configuration bit of line 3 */
  1222. #define EXTI_RTSR_TR4 ((uint32_t)0x00000010) /*!< Rising trigger event configuration bit of line 4 */
  1223. #define EXTI_RTSR_TR5 ((uint32_t)0x00000020) /*!< Rising trigger event configuration bit of line 5 */
  1224. #define EXTI_RTSR_TR6 ((uint32_t)0x00000040) /*!< Rising trigger event configuration bit of line 6 */
  1225. #define EXTI_RTSR_TR7 ((uint32_t)0x00000080) /*!< Rising trigger event configuration bit of line 7 */
  1226. #define EXTI_RTSR_TR8 ((uint32_t)0x00000100) /*!< Rising trigger event configuration bit of line 8 */
  1227. #define EXTI_RTSR_TR9 ((uint32_t)0x00000200) /*!< Rising trigger event configuration bit of line 9 */
  1228. #define EXTI_RTSR_TR10 ((uint32_t)0x00000400) /*!< Rising trigger event configuration bit of line 10 */
  1229. #define EXTI_RTSR_TR11 ((uint32_t)0x00000800) /*!< Rising trigger event configuration bit of line 11 */
  1230. #define EXTI_RTSR_TR12 ((uint32_t)0x00001000) /*!< Rising trigger event configuration bit of line 12 */
  1231. #define EXTI_RTSR_TR13 ((uint32_t)0x00002000) /*!< Rising trigger event configuration bit of line 13 */
  1232. #define EXTI_RTSR_TR14 ((uint32_t)0x00004000) /*!< Rising trigger event configuration bit of line 14 */
  1233. #define EXTI_RTSR_TR15 ((uint32_t)0x00008000) /*!< Rising trigger event configuration bit of line 15 */
  1234. #define EXTI_RTSR_TR16 ((uint32_t)0x00010000) /*!< Rising trigger event configuration bit of line 16 */
  1235. #define EXTI_RTSR_TR17 ((uint32_t)0x00020000) /*!< Rising trigger event configuration bit of line 17 */
  1236. #define EXTI_RTSR_TR18 ((uint32_t)0x00040000) /*!< Rising trigger event configuration bit of line 18 */
  1237. #define EXTI_RTSR_TR19 ((uint32_t)0x00080000) /*!< Rising trigger event configuration bit of line 19 */
  1238. #define EXTI_RTSR_TR20 ((uint32_t)0x00100000) /*!< Rising trigger event configuration bit of line 20 */
  1239. #define EXTI_RTSR_TR21 ((uint32_t)0x00200000) /*!< Rising trigger event configuration bit of line 21 */
  1240. #define EXTI_RTSR_TR22 ((uint32_t)0x00400000) /*!< Rising trigger event configuration bit of line 22 */
  1241. #define EXTI_RTSR_TR23 ((uint32_t)0x00800000) /*!< Rising trigger event configuration bit of line 23 */
  1242. /****************** Bit definition for EXTI_FTSR register *******************/
  1243. #define EXTI_FTSR_TR0 ((uint32_t)0x00000001) /*!< Falling trigger event configuration bit of line 0 */
  1244. #define EXTI_FTSR_TR1 ((uint32_t)0x00000002) /*!< Falling trigger event configuration bit of line 1 */
  1245. #define EXTI_FTSR_TR2 ((uint32_t)0x00000004) /*!< Falling trigger event configuration bit of line 2 */
  1246. #define EXTI_FTSR_TR3 ((uint32_t)0x00000008) /*!< Falling trigger event configuration bit of line 3 */
  1247. #define EXTI_FTSR_TR4 ((uint32_t)0x00000010) /*!< Falling trigger event configuration bit of line 4 */
  1248. #define EXTI_FTSR_TR5 ((uint32_t)0x00000020) /*!< Falling trigger event configuration bit of line 5 */
  1249. #define EXTI_FTSR_TR6 ((uint32_t)0x00000040) /*!< Falling trigger event configuration bit of line 6 */
  1250. #define EXTI_FTSR_TR7 ((uint32_t)0x00000080) /*!< Falling trigger event configuration bit of line 7 */
  1251. #define EXTI_FTSR_TR8 ((uint32_t)0x00000100) /*!< Falling trigger event configuration bit of line 8 */
  1252. #define EXTI_FTSR_TR9 ((uint32_t)0x00000200) /*!< Falling trigger event configuration bit of line 9 */
  1253. #define EXTI_FTSR_TR10 ((uint32_t)0x00000400) /*!< Falling trigger event configuration bit of line 10 */
  1254. #define EXTI_FTSR_TR11 ((uint32_t)0x00000800) /*!< Falling trigger event configuration bit of line 11 */
  1255. #define EXTI_FTSR_TR12 ((uint32_t)0x00001000) /*!< Falling trigger event configuration bit of line 12 */
  1256. #define EXTI_FTSR_TR13 ((uint32_t)0x00002000) /*!< Falling trigger event configuration bit of line 13 */
  1257. #define EXTI_FTSR_TR14 ((uint32_t)0x00004000) /*!< Falling trigger event configuration bit of line 14 */
  1258. #define EXTI_FTSR_TR15 ((uint32_t)0x00008000) /*!< Falling trigger event configuration bit of line 15 */
  1259. #define EXTI_FTSR_TR16 ((uint32_t)0x00010000) /*!< Falling trigger event configuration bit of line 16 */
  1260. #define EXTI_FTSR_TR17 ((uint32_t)0x00020000) /*!< Falling trigger event configuration bit of line 17 */
  1261. #define EXTI_FTSR_TR18 ((uint32_t)0x00040000) /*!< Falling trigger event configuration bit of line 18 */
  1262. #define EXTI_FTSR_TR19 ((uint32_t)0x00080000) /*!< Falling trigger event configuration bit of line 19 */
  1263. #define EXTI_FTSR_TR20 ((uint32_t)0x00100000) /*!< Falling trigger event configuration bit of line 20 */
  1264. #define EXTI_FTSR_TR21 ((uint32_t)0x00200000) /*!< Falling trigger event configuration bit of line 21 */
  1265. #define EXTI_FTSR_TR22 ((uint32_t)0x00400000) /*!< Falling trigger event configuration bit of line 22 */
  1266. #define EXTI_FTSR_TR23 ((uint32_t)0x00800000) /*!< Falling trigger event configuration bit of line 23 */
  1267. /****************** Bit definition for EXTI_SWIER register ******************/
  1268. #define EXTI_SWIER_SWIER0 ((uint32_t)0x00000001) /*!< Software Interrupt on line 0 */
  1269. #define EXTI_SWIER_SWIER1 ((uint32_t)0x00000002) /*!< Software Interrupt on line 1 */
  1270. #define EXTI_SWIER_SWIER2 ((uint32_t)0x00000004) /*!< Software Interrupt on line 2 */
  1271. #define EXTI_SWIER_SWIER3 ((uint32_t)0x00000008) /*!< Software Interrupt on line 3 */
  1272. #define EXTI_SWIER_SWIER4 ((uint32_t)0x00000010) /*!< Software Interrupt on line 4 */
  1273. #define EXTI_SWIER_SWIER5 ((uint32_t)0x00000020) /*!< Software Interrupt on line 5 */
  1274. #define EXTI_SWIER_SWIER6 ((uint32_t)0x00000040) /*!< Software Interrupt on line 6 */
  1275. #define EXTI_SWIER_SWIER7 ((uint32_t)0x00000080) /*!< Software Interrupt on line 7 */
  1276. #define EXTI_SWIER_SWIER8 ((uint32_t)0x00000100) /*!< Software Interrupt on line 8 */
  1277. #define EXTI_SWIER_SWIER9 ((uint32_t)0x00000200) /*!< Software Interrupt on line 9 */
  1278. #define EXTI_SWIER_SWIER10 ((uint32_t)0x00000400) /*!< Software Interrupt on line 10 */
  1279. #define EXTI_SWIER_SWIER11 ((uint32_t)0x00000800) /*!< Software Interrupt on line 11 */
  1280. #define EXTI_SWIER_SWIER12 ((uint32_t)0x00001000) /*!< Software Interrupt on line 12 */
  1281. #define EXTI_SWIER_SWIER13 ((uint32_t)0x00002000) /*!< Software Interrupt on line 13 */
  1282. #define EXTI_SWIER_SWIER14 ((uint32_t)0x00004000) /*!< Software Interrupt on line 14 */
  1283. #define EXTI_SWIER_SWIER15 ((uint32_t)0x00008000) /*!< Software Interrupt on line 15 */
  1284. #define EXTI_SWIER_SWIER16 ((uint32_t)0x00010000) /*!< Software Interrupt on line 16 */
  1285. #define EXTI_SWIER_SWIER17 ((uint32_t)0x00020000) /*!< Software Interrupt on line 17 */
  1286. #define EXTI_SWIER_SWIER18 ((uint32_t)0x00040000) /*!< Software Interrupt on line 18 */
  1287. #define EXTI_SWIER_SWIER19 ((uint32_t)0x00080000) /*!< Software Interrupt on line 19 */
  1288. #define EXTI_SWIER_SWIER20 ((uint32_t)0x00100000) /*!< Software Interrupt on line 20 */
  1289. #define EXTI_SWIER_SWIER21 ((uint32_t)0x00200000) /*!< Software Interrupt on line 21 */
  1290. #define EXTI_SWIER_SWIER22 ((uint32_t)0x00400000) /*!< Software Interrupt on line 22 */
  1291. #define EXTI_SWIER_SWIER23 ((uint32_t)0x00800000) /*!< Software Interrupt on line 23 */
  1292. /******************* Bit definition for EXTI_PR register ********************/
  1293. #define EXTI_PR_PR0 ((uint32_t)0x00000001) /*!< Pending bit for line 0 */
  1294. #define EXTI_PR_PR1 ((uint32_t)0x00000002) /*!< Pending bit for line 1 */
  1295. #define EXTI_PR_PR2 ((uint32_t)0x00000004) /*!< Pending bit for line 2 */
  1296. #define EXTI_PR_PR3 ((uint32_t)0x00000008) /*!< Pending bit for line 3 */
  1297. #define EXTI_PR_PR4 ((uint32_t)0x00000010) /*!< Pending bit for line 4 */
  1298. #define EXTI_PR_PR5 ((uint32_t)0x00000020) /*!< Pending bit for line 5 */
  1299. #define EXTI_PR_PR6 ((uint32_t)0x00000040) /*!< Pending bit for line 6 */
  1300. #define EXTI_PR_PR7 ((uint32_t)0x00000080) /*!< Pending bit for line 7 */
  1301. #define EXTI_PR_PR8 ((uint32_t)0x00000100) /*!< Pending bit for line 8 */
  1302. #define EXTI_PR_PR9 ((uint32_t)0x00000200) /*!< Pending bit for line 9 */
  1303. #define EXTI_PR_PR10 ((uint32_t)0x00000400) /*!< Pending bit for line 10 */
  1304. #define EXTI_PR_PR11 ((uint32_t)0x00000800) /*!< Pending bit for line 11 */
  1305. #define EXTI_PR_PR12 ((uint32_t)0x00001000) /*!< Pending bit for line 12 */
  1306. #define EXTI_PR_PR13 ((uint32_t)0x00002000) /*!< Pending bit for line 13 */
  1307. #define EXTI_PR_PR14 ((uint32_t)0x00004000) /*!< Pending bit for line 14 */
  1308. #define EXTI_PR_PR15 ((uint32_t)0x00008000) /*!< Pending bit for line 15 */
  1309. #define EXTI_PR_PR16 ((uint32_t)0x00010000) /*!< Pending bit for line 16 */
  1310. #define EXTI_PR_PR17 ((uint32_t)0x00020000) /*!< Pending bit for line 17 */
  1311. #define EXTI_PR_PR18 ((uint32_t)0x00040000) /*!< Pending bit for line 18 */
  1312. #define EXTI_PR_PR19 ((uint32_t)0x00080000) /*!< Pending bit for line 19 */
  1313. #define EXTI_PR_PR20 ((uint32_t)0x00100000) /*!< Pending bit for line 20 */
  1314. #define EXTI_PR_PR21 ((uint32_t)0x00200000) /*!< Pending bit for line 21 */
  1315. #define EXTI_PR_PR22 ((uint32_t)0x00400000) /*!< Pending bit for line 22 */
  1316. #define EXTI_PR_PR23 ((uint32_t)0x00800000) /*!< Pending bit for line 23 */
  1317. /******************************************************************************/
  1318. /* */
  1319. /* FLASH */
  1320. /* */
  1321. /******************************************************************************/
  1322. /******************* Bits definition for FLASH_ACR register *****************/
  1323. #define FLASH_ACR_LATENCY ((uint32_t)0x0000000F)
  1324. #define FLASH_ACR_LATENCY_0WS ((uint32_t)0x00000000)
  1325. #define FLASH_ACR_LATENCY_1WS ((uint32_t)0x00000001)
  1326. #define FLASH_ACR_LATENCY_2WS ((uint32_t)0x00000002)
  1327. #define FLASH_ACR_LATENCY_3WS ((uint32_t)0x00000003)
  1328. #define FLASH_ACR_LATENCY_4WS ((uint32_t)0x00000004)
  1329. #define FLASH_ACR_LATENCY_5WS ((uint32_t)0x00000005)
  1330. #define FLASH_ACR_LATENCY_6WS ((uint32_t)0x00000006)
  1331. #define FLASH_ACR_LATENCY_7WS ((uint32_t)0x00000007)
  1332. #define FLASH_ACR_PRFTEN ((uint32_t)0x00000100)
  1333. #define FLASH_ACR_ICEN ((uint32_t)0x00000200)
  1334. #define FLASH_ACR_DCEN ((uint32_t)0x00000400)
  1335. #define FLASH_ACR_ICRST ((uint32_t)0x00000800)
  1336. #define FLASH_ACR_DCRST ((uint32_t)0x00001000)
  1337. #define FLASH_ACR_BYTE0_ADDRESS ((uint32_t)0x40023C00)
  1338. #define FLASH_ACR_BYTE2_ADDRESS ((uint32_t)0x40023C03)
  1339. /******************* Bits definition for FLASH_SR register ******************/
  1340. #define FLASH_SR_EOP ((uint32_t)0x00000001)
  1341. #define FLASH_SR_SOP ((uint32_t)0x00000002)
  1342. #define FLASH_SR_WRPERR ((uint32_t)0x00000010)
  1343. #define FLASH_SR_PGAERR ((uint32_t)0x00000020)
  1344. #define FLASH_SR_PGPERR ((uint32_t)0x00000040)
  1345. #define FLASH_SR_PGSERR ((uint32_t)0x00000080)
  1346. #define FLASH_SR_BSY ((uint32_t)0x00010000)
  1347. /******************* Bits definition for FLASH_CR register ******************/
  1348. #define FLASH_CR_PG ((uint32_t)0x00000001)
  1349. #define FLASH_CR_SER ((uint32_t)0x00000002)
  1350. #define FLASH_CR_MER ((uint32_t)0x00000004)
  1351. #define FLASH_CR_SNB ((uint32_t)0x000000F8)
  1352. #define FLASH_CR_SNB_0 ((uint32_t)0x00000008)
  1353. #define FLASH_CR_SNB_1 ((uint32_t)0x00000010)
  1354. #define FLASH_CR_SNB_2 ((uint32_t)0x00000020)
  1355. #define FLASH_CR_SNB_3 ((uint32_t)0x00000040)
  1356. #define FLASH_CR_SNB_4 ((uint32_t)0x00000080)
  1357. #define FLASH_CR_PSIZE ((uint32_t)0x00000300)
  1358. #define FLASH_CR_PSIZE_0 ((uint32_t)0x00000100)
  1359. #define FLASH_CR_PSIZE_1 ((uint32_t)0x00000200)
  1360. #define FLASH_CR_STRT ((uint32_t)0x00010000)
  1361. #define FLASH_CR_EOPIE ((uint32_t)0x01000000)
  1362. #define FLASH_CR_LOCK ((uint32_t)0x80000000)
  1363. /******************* Bits definition for FLASH_OPTCR register ***************/
  1364. #define FLASH_OPTCR_OPTLOCK ((uint32_t)0x00000001)
  1365. #define FLASH_OPTCR_OPTSTRT ((uint32_t)0x00000002)
  1366. #define FLASH_OPTCR_BOR_LEV_0 ((uint32_t)0x00000004)
  1367. #define FLASH_OPTCR_BOR_LEV_1 ((uint32_t)0x00000008)
  1368. #define FLASH_OPTCR_BOR_LEV ((uint32_t)0x0000000C)
  1369. #define FLASH_OPTCR_WDG_SW ((uint32_t)0x00000020)
  1370. #define FLASH_OPTCR_nRST_STOP ((uint32_t)0x00000040)
  1371. #define FLASH_OPTCR_nRST_STDBY ((uint32_t)0x00000080)
  1372. #define FLASH_OPTCR_RDP ((uint32_t)0x0000FF00)
  1373. #define FLASH_OPTCR_RDP_0 ((uint32_t)0x00000100)
  1374. #define FLASH_OPTCR_RDP_1 ((uint32_t)0x00000200)
  1375. #define FLASH_OPTCR_RDP_2 ((uint32_t)0x00000400)
  1376. #define FLASH_OPTCR_RDP_3 ((uint32_t)0x00000800)
  1377. #define FLASH_OPTCR_RDP_4 ((uint32_t)0x00001000)
  1378. #define FLASH_OPTCR_RDP_5 ((uint32_t)0x00002000)
  1379. #define FLASH_OPTCR_RDP_6 ((uint32_t)0x00004000)
  1380. #define FLASH_OPTCR_RDP_7 ((uint32_t)0x00008000)
  1381. #define FLASH_OPTCR_nWRP ((uint32_t)0x0FFF0000)
  1382. #define FLASH_OPTCR_nWRP_0 ((uint32_t)0x00010000)
  1383. #define FLASH_OPTCR_nWRP_1 ((uint32_t)0x00020000)
  1384. #define FLASH_OPTCR_nWRP_2 ((uint32_t)0x00040000)
  1385. #define FLASH_OPTCR_nWRP_3 ((uint32_t)0x00080000)
  1386. #define FLASH_OPTCR_nWRP_4 ((uint32_t)0x00100000)
  1387. #define FLASH_OPTCR_nWRP_5 ((uint32_t)0x00200000)
  1388. #define FLASH_OPTCR_nWRP_6 ((uint32_t)0x00400000)
  1389. #define FLASH_OPTCR_nWRP_7 ((uint32_t)0x00800000)
  1390. #define FLASH_OPTCR_nWRP_8 ((uint32_t)0x01000000)
  1391. #define FLASH_OPTCR_nWRP_9 ((uint32_t)0x02000000)
  1392. #define FLASH_OPTCR_nWRP_10 ((uint32_t)0x04000000)
  1393. #define FLASH_OPTCR_nWRP_11 ((uint32_t)0x08000000)
  1394. /****************** Bits definition for FLASH_OPTCR1 register ***************/
  1395. #define FLASH_OPTCR1_nWRP ((uint32_t)0x0FFF0000)
  1396. #define FLASH_OPTCR1_nWRP_0 ((uint32_t)0x00010000)
  1397. #define FLASH_OPTCR1_nWRP_1 ((uint32_t)0x00020000)
  1398. #define FLASH_OPTCR1_nWRP_2 ((uint32_t)0x00040000)
  1399. #define FLASH_OPTCR1_nWRP_3 ((uint32_t)0x00080000)
  1400. #define FLASH_OPTCR1_nWRP_4 ((uint32_t)0x00100000)
  1401. #define FLASH_OPTCR1_nWRP_5 ((uint32_t)0x00200000)
  1402. #define FLASH_OPTCR1_nWRP_6 ((uint32_t)0x00400000)
  1403. #define FLASH_OPTCR1_nWRP_7 ((uint32_t)0x00800000)
  1404. #define FLASH_OPTCR1_nWRP_8 ((uint32_t)0x01000000)
  1405. #define FLASH_OPTCR1_nWRP_9 ((uint32_t)0x02000000)
  1406. #define FLASH_OPTCR1_nWRP_10 ((uint32_t)0x04000000)
  1407. #define FLASH_OPTCR1_nWRP_11 ((uint32_t)0x08000000)
  1408. /******************************************************************************/
  1409. /* */
  1410. /* General Purpose I/O */
  1411. /* */
  1412. /******************************************************************************/
  1413. /****************** Bits definition for GPIO_MODER register *****************/
  1414. #define GPIO_MODER_MODER0 ((uint32_t)0x00000003)
  1415. #define GPIO_MODER_MODER0_0 ((uint32_t)0x00000001)
  1416. #define GPIO_MODER_MODER0_1 ((uint32_t)0x00000002)
  1417. #define GPIO_MODER_MODER1 ((uint32_t)0x0000000C)
  1418. #define GPIO_MODER_MODER1_0 ((uint32_t)0x00000004)
  1419. #define GPIO_MODER_MODER1_1 ((uint32_t)0x00000008)
  1420. #define GPIO_MODER_MODER2 ((uint32_t)0x00000030)
  1421. #define GPIO_MODER_MODER2_0 ((uint32_t)0x00000010)
  1422. #define GPIO_MODER_MODER2_1 ((uint32_t)0x00000020)
  1423. #define GPIO_MODER_MODER3 ((uint32_t)0x000000C0)
  1424. #define GPIO_MODER_MODER3_0 ((uint32_t)0x00000040)
  1425. #define GPIO_MODER_MODER3_1 ((uint32_t)0x00000080)
  1426. #define GPIO_MODER_MODER4 ((uint32_t)0x00000300)
  1427. #define GPIO_MODER_MODER4_0 ((uint32_t)0x00000100)
  1428. #define GPIO_MODER_MODER4_1 ((uint32_t)0x00000200)
  1429. #define GPIO_MODER_MODER5 ((uint32_t)0x00000C00)
  1430. #define GPIO_MODER_MODER5_0 ((uint32_t)0x00000400)
  1431. #define GPIO_MODER_MODER5_1 ((uint32_t)0x00000800)
  1432. #define GPIO_MODER_MODER6 ((uint32_t)0x00003000)
  1433. #define GPIO_MODER_MODER6_0 ((uint32_t)0x00001000)
  1434. #define GPIO_MODER_MODER6_1 ((uint32_t)0x00002000)
  1435. #define GPIO_MODER_MODER7 ((uint32_t)0x0000C000)
  1436. #define GPIO_MODER_MODER7_0 ((uint32_t)0x00004000)
  1437. #define GPIO_MODER_MODER7_1 ((uint32_t)0x00008000)
  1438. #define GPIO_MODER_MODER8 ((uint32_t)0x00030000)
  1439. #define GPIO_MODER_MODER8_0 ((uint32_t)0x00010000)
  1440. #define GPIO_MODER_MODER8_1 ((uint32_t)0x00020000)
  1441. #define GPIO_MODER_MODER9 ((uint32_t)0x000C0000)
  1442. #define GPIO_MODER_MODER9_0 ((uint32_t)0x00040000)
  1443. #define GPIO_MODER_MODER9_1 ((uint32_t)0x00080000)
  1444. #define GPIO_MODER_MODER10 ((uint32_t)0x00300000)
  1445. #define GPIO_MODER_MODER10_0 ((uint32_t)0x00100000)
  1446. #define GPIO_MODER_MODER10_1 ((uint32_t)0x00200000)
  1447. #define GPIO_MODER_MODER11 ((uint32_t)0x00C00000)
  1448. #define GPIO_MODER_MODER11_0 ((uint32_t)0x00400000)
  1449. #define GPIO_MODER_MODER11_1 ((uint32_t)0x00800000)
  1450. #define GPIO_MODER_MODER12 ((uint32_t)0x03000000)
  1451. #define GPIO_MODER_MODER12_0 ((uint32_t)0x01000000)
  1452. #define GPIO_MODER_MODER12_1 ((uint32_t)0x02000000)
  1453. #define GPIO_MODER_MODER13 ((uint32_t)0x0C000000)
  1454. #define GPIO_MODER_MODER13_0 ((uint32_t)0x04000000)
  1455. #define GPIO_MODER_MODER13_1 ((uint32_t)0x08000000)
  1456. #define GPIO_MODER_MODER14 ((uint32_t)0x30000000)
  1457. #define GPIO_MODER_MODER14_0 ((uint32_t)0x10000000)
  1458. #define GPIO_MODER_MODER14_1 ((uint32_t)0x20000000)
  1459. #define GPIO_MODER_MODER15 ((uint32_t)0xC0000000)
  1460. #define GPIO_MODER_MODER15_0 ((uint32_t)0x40000000)
  1461. #define GPIO_MODER_MODER15_1 ((uint32_t)0x80000000)
  1462. /****************** Bits definition for GPIO_OTYPER register ****************/
  1463. #define GPIO_OTYPER_OT_0 ((uint32_t)0x00000001)
  1464. #define GPIO_OTYPER_OT_1 ((uint32_t)0x00000002)
  1465. #define GPIO_OTYPER_OT_2 ((uint32_t)0x00000004)
  1466. #define GPIO_OTYPER_OT_3 ((uint32_t)0x00000008)
  1467. #define GPIO_OTYPER_OT_4 ((uint32_t)0x00000010)
  1468. #define GPIO_OTYPER_OT_5 ((uint32_t)0x00000020)
  1469. #define GPIO_OTYPER_OT_6 ((uint32_t)0x00000040)
  1470. #define GPIO_OTYPER_OT_7 ((uint32_t)0x00000080)
  1471. #define GPIO_OTYPER_OT_8 ((uint32_t)0x00000100)
  1472. #define GPIO_OTYPER_OT_9 ((uint32_t)0x00000200)
  1473. #define GPIO_OTYPER_OT_10 ((uint32_t)0x00000400)
  1474. #define GPIO_OTYPER_OT_11 ((uint32_t)0x00000800)
  1475. #define GPIO_OTYPER_OT_12 ((uint32_t)0x00001000)
  1476. #define GPIO_OTYPER_OT_13 ((uint32_t)0x00002000)
  1477. #define GPIO_OTYPER_OT_14 ((uint32_t)0x00004000)
  1478. #define GPIO_OTYPER_OT_15 ((uint32_t)0x00008000)
  1479. /****************** Bits definition for GPIO_OSPEEDR register ***************/
  1480. #define GPIO_OSPEEDER_OSPEEDR0 ((uint32_t)0x00000003)
  1481. #define GPIO_OSPEEDER_OSPEEDR0_0 ((uint32_t)0x00000001)
  1482. #define GPIO_OSPEEDER_OSPEEDR0_1 ((uint32_t)0x00000002)
  1483. #define GPIO_OSPEEDER_OSPEEDR1 ((uint32_t)0x0000000C)
  1484. #define GPIO_OSPEEDER_OSPEEDR1_0 ((uint32_t)0x00000004)
  1485. #define GPIO_OSPEEDER_OSPEEDR1_1 ((uint32_t)0x00000008)
  1486. #define GPIO_OSPEEDER_OSPEEDR2 ((uint32_t)0x00000030)
  1487. #define GPIO_OSPEEDER_OSPEEDR2_0 ((uint32_t)0x00000010)
  1488. #define GPIO_OSPEEDER_OSPEEDR2_1 ((uint32_t)0x00000020)
  1489. #define GPIO_OSPEEDER_OSPEEDR3 ((uint32_t)0x000000C0)
  1490. #define GPIO_OSPEEDER_OSPEEDR3_0 ((uint32_t)0x00000040)
  1491. #define GPIO_OSPEEDER_OSPEEDR3_1 ((uint32_t)0x00000080)
  1492. #define GPIO_OSPEEDER_OSPEEDR4 ((uint32_t)0x00000300)
  1493. #define GPIO_OSPEEDER_OSPEEDR4_0 ((uint32_t)0x00000100)
  1494. #define GPIO_OSPEEDER_OSPEEDR4_1 ((uint32_t)0x00000200)
  1495. #define GPIO_OSPEEDER_OSPEEDR5 ((uint32_t)0x00000C00)
  1496. #define GPIO_OSPEEDER_OSPEEDR5_0 ((uint32_t)0x00000400)
  1497. #define GPIO_OSPEEDER_OSPEEDR5_1 ((uint32_t)0x00000800)
  1498. #define GPIO_OSPEEDER_OSPEEDR6 ((uint32_t)0x00003000)
  1499. #define GPIO_OSPEEDER_OSPEEDR6_0 ((uint32_t)0x00001000)
  1500. #define GPIO_OSPEEDER_OSPEEDR6_1 ((uint32_t)0x00002000)
  1501. #define GPIO_OSPEEDER_OSPEEDR7 ((uint32_t)0x0000C000)
  1502. #define GPIO_OSPEEDER_OSPEEDR7_0 ((uint32_t)0x00004000)
  1503. #define GPIO_OSPEEDER_OSPEEDR7_1 ((uint32_t)0x00008000)
  1504. #define GPIO_OSPEEDER_OSPEEDR8 ((uint32_t)0x00030000)
  1505. #define GPIO_OSPEEDER_OSPEEDR8_0 ((uint32_t)0x00010000)
  1506. #define GPIO_OSPEEDER_OSPEEDR8_1 ((uint32_t)0x00020000)
  1507. #define GPIO_OSPEEDER_OSPEEDR9 ((uint32_t)0x000C0000)
  1508. #define GPIO_OSPEEDER_OSPEEDR9_0 ((uint32_t)0x00040000)
  1509. #define GPIO_OSPEEDER_OSPEEDR9_1 ((uint32_t)0x00080000)
  1510. #define GPIO_OSPEEDER_OSPEEDR10 ((uint32_t)0x00300000)
  1511. #define GPIO_OSPEEDER_OSPEEDR10_0 ((uint32_t)0x00100000)
  1512. #define GPIO_OSPEEDER_OSPEEDR10_1 ((uint32_t)0x00200000)
  1513. #define GPIO_OSPEEDER_OSPEEDR11 ((uint32_t)0x00C00000)
  1514. #define GPIO_OSPEEDER_OSPEEDR11_0 ((uint32_t)0x00400000)
  1515. #define GPIO_OSPEEDER_OSPEEDR11_1 ((uint32_t)0x00800000)
  1516. #define GPIO_OSPEEDER_OSPEEDR12 ((uint32_t)0x03000000)
  1517. #define GPIO_OSPEEDER_OSPEEDR12_0 ((uint32_t)0x01000000)
  1518. #define GPIO_OSPEEDER_OSPEEDR12_1 ((uint32_t)0x02000000)
  1519. #define GPIO_OSPEEDER_OSPEEDR13 ((uint32_t)0x0C000000)
  1520. #define GPIO_OSPEEDER_OSPEEDR13_0 ((uint32_t)0x04000000)
  1521. #define GPIO_OSPEEDER_OSPEEDR13_1 ((uint32_t)0x08000000)
  1522. #define GPIO_OSPEEDER_OSPEEDR14 ((uint32_t)0x30000000)
  1523. #define GPIO_OSPEEDER_OSPEEDR14_0 ((uint32_t)0x10000000)
  1524. #define GPIO_OSPEEDER_OSPEEDR14_1 ((uint32_t)0x20000000)
  1525. #define GPIO_OSPEEDER_OSPEEDR15 ((uint32_t)0xC0000000)
  1526. #define GPIO_OSPEEDER_OSPEEDR15_0 ((uint32_t)0x40000000)
  1527. #define GPIO_OSPEEDER_OSPEEDR15_1 ((uint32_t)0x80000000)
  1528. /****************** Bits definition for GPIO_PUPDR register *****************/
  1529. #define GPIO_PUPDR_PUPDR0 ((uint32_t)0x00000003)
  1530. #define GPIO_PUPDR_PUPDR0_0 ((uint32_t)0x00000001)
  1531. #define GPIO_PUPDR_PUPDR0_1 ((uint32_t)0x00000002)
  1532. #define GPIO_PUPDR_PUPDR1 ((uint32_t)0x0000000C)
  1533. #define GPIO_PUPDR_PUPDR1_0 ((uint32_t)0x00000004)
  1534. #define GPIO_PUPDR_PUPDR1_1 ((uint32_t)0x00000008)
  1535. #define GPIO_PUPDR_PUPDR2 ((uint32_t)0x00000030)
  1536. #define GPIO_PUPDR_PUPDR2_0 ((uint32_t)0x00000010)
  1537. #define GPIO_PUPDR_PUPDR2_1 ((uint32_t)0x00000020)
  1538. #define GPIO_PUPDR_PUPDR3 ((uint32_t)0x000000C0)
  1539. #define GPIO_PUPDR_PUPDR3_0 ((uint32_t)0x00000040)
  1540. #define GPIO_PUPDR_PUPDR3_1 ((uint32_t)0x00000080)
  1541. #define GPIO_PUPDR_PUPDR4 ((uint32_t)0x00000300)
  1542. #define GPIO_PUPDR_PUPDR4_0 ((uint32_t)0x00000100)
  1543. #define GPIO_PUPDR_PUPDR4_1 ((uint32_t)0x00000200)
  1544. #define GPIO_PUPDR_PUPDR5 ((uint32_t)0x00000C00)
  1545. #define GPIO_PUPDR_PUPDR5_0 ((uint32_t)0x00000400)
  1546. #define GPIO_PUPDR_PUPDR5_1 ((uint32_t)0x00000800)
  1547. #define GPIO_PUPDR_PUPDR6 ((uint32_t)0x00003000)
  1548. #define GPIO_PUPDR_PUPDR6_0 ((uint32_t)0x00001000)
  1549. #define GPIO_PUPDR_PUPDR6_1 ((uint32_t)0x00002000)
  1550. #define GPIO_PUPDR_PUPDR7 ((uint32_t)0x0000C000)
  1551. #define GPIO_PUPDR_PUPDR7_0 ((uint32_t)0x00004000)
  1552. #define GPIO_PUPDR_PUPDR7_1 ((uint32_t)0x00008000)
  1553. #define GPIO_PUPDR_PUPDR8 ((uint32_t)0x00030000)
  1554. #define GPIO_PUPDR_PUPDR8_0 ((uint32_t)0x00010000)
  1555. #define GPIO_PUPDR_PUPDR8_1 ((uint32_t)0x00020000)
  1556. #define GPIO_PUPDR_PUPDR9 ((uint32_t)0x000C0000)
  1557. #define GPIO_PUPDR_PUPDR9_0 ((uint32_t)0x00040000)
  1558. #define GPIO_PUPDR_PUPDR9_1 ((uint32_t)0x00080000)
  1559. #define GPIO_PUPDR_PUPDR10 ((uint32_t)0x00300000)
  1560. #define GPIO_PUPDR_PUPDR10_0 ((uint32_t)0x00100000)
  1561. #define GPIO_PUPDR_PUPDR10_1 ((uint32_t)0x00200000)
  1562. #define GPIO_PUPDR_PUPDR11 ((uint32_t)0x00C00000)
  1563. #define GPIO_PUPDR_PUPDR11_0 ((uint32_t)0x00400000)
  1564. #define GPIO_PUPDR_PUPDR11_1 ((uint32_t)0x00800000)
  1565. #define GPIO_PUPDR_PUPDR12 ((uint32_t)0x03000000)
  1566. #define GPIO_PUPDR_PUPDR12_0 ((uint32_t)0x01000000)
  1567. #define GPIO_PUPDR_PUPDR12_1 ((uint32_t)0x02000000)
  1568. #define GPIO_PUPDR_PUPDR13 ((uint32_t)0x0C000000)
  1569. #define GPIO_PUPDR_PUPDR13_0 ((uint32_t)0x04000000)
  1570. #define GPIO_PUPDR_PUPDR13_1 ((uint32_t)0x08000000)
  1571. #define GPIO_PUPDR_PUPDR14 ((uint32_t)0x30000000)
  1572. #define GPIO_PUPDR_PUPDR14_0 ((uint32_t)0x10000000)
  1573. #define GPIO_PUPDR_PUPDR14_1 ((uint32_t)0x20000000)
  1574. #define GPIO_PUPDR_PUPDR15 ((uint32_t)0xC0000000)
  1575. #define GPIO_PUPDR_PUPDR15_0 ((uint32_t)0x40000000)
  1576. #define GPIO_PUPDR_PUPDR15_1 ((uint32_t)0x80000000)
  1577. /****************** Bits definition for GPIO_IDR register *******************/
  1578. #define GPIO_IDR_IDR_0 ((uint32_t)0x00000001)
  1579. #define GPIO_IDR_IDR_1 ((uint32_t)0x00000002)
  1580. #define GPIO_IDR_IDR_2 ((uint32_t)0x00000004)
  1581. #define GPIO_IDR_IDR_3 ((uint32_t)0x00000008)
  1582. #define GPIO_IDR_IDR_4 ((uint32_t)0x00000010)
  1583. #define GPIO_IDR_IDR_5 ((uint32_t)0x00000020)
  1584. #define GPIO_IDR_IDR_6 ((uint32_t)0x00000040)
  1585. #define GPIO_IDR_IDR_7 ((uint32_t)0x00000080)
  1586. #define GPIO_IDR_IDR_8 ((uint32_t)0x00000100)
  1587. #define GPIO_IDR_IDR_9 ((uint32_t)0x00000200)
  1588. #define GPIO_IDR_IDR_10 ((uint32_t)0x00000400)
  1589. #define GPIO_IDR_IDR_11 ((uint32_t)0x00000800)
  1590. #define GPIO_IDR_IDR_12 ((uint32_t)0x00001000)
  1591. #define GPIO_IDR_IDR_13 ((uint32_t)0x00002000)
  1592. #define GPIO_IDR_IDR_14 ((uint32_t)0x00004000)
  1593. #define GPIO_IDR_IDR_15 ((uint32_t)0x00008000)
  1594. /****************** Bits definition for GPIO_ODR register *******************/
  1595. #define GPIO_ODR_ODR_0 ((uint32_t)0x00000001)
  1596. #define GPIO_ODR_ODR_1 ((uint32_t)0x00000002)
  1597. #define GPIO_ODR_ODR_2 ((uint32_t)0x00000004)
  1598. #define GPIO_ODR_ODR_3 ((uint32_t)0x00000008)
  1599. #define GPIO_ODR_ODR_4 ((uint32_t)0x00000010)
  1600. #define GPIO_ODR_ODR_5 ((uint32_t)0x00000020)
  1601. #define GPIO_ODR_ODR_6 ((uint32_t)0x00000040)
  1602. #define GPIO_ODR_ODR_7 ((uint32_t)0x00000080)
  1603. #define GPIO_ODR_ODR_8 ((uint32_t)0x00000100)
  1604. #define GPIO_ODR_ODR_9 ((uint32_t)0x00000200)
  1605. #define GPIO_ODR_ODR_10 ((uint32_t)0x00000400)
  1606. #define GPIO_ODR_ODR_11 ((uint32_t)0x00000800)
  1607. #define GPIO_ODR_ODR_12 ((uint32_t)0x00001000)
  1608. #define GPIO_ODR_ODR_13 ((uint32_t)0x00002000)
  1609. #define GPIO_ODR_ODR_14 ((uint32_t)0x00004000)
  1610. #define GPIO_ODR_ODR_15 ((uint32_t)0x00008000)
  1611. /****************** Bits definition for GPIO_BSRR register ******************/
  1612. #define GPIO_BSRR_BS_0 ((uint32_t)0x00000001)
  1613. #define GPIO_BSRR_BS_1 ((uint32_t)0x00000002)
  1614. #define GPIO_BSRR_BS_2 ((uint32_t)0x00000004)
  1615. #define GPIO_BSRR_BS_3 ((uint32_t)0x00000008)
  1616. #define GPIO_BSRR_BS_4 ((uint32_t)0x00000010)
  1617. #define GPIO_BSRR_BS_5 ((uint32_t)0x00000020)
  1618. #define GPIO_BSRR_BS_6 ((uint32_t)0x00000040)
  1619. #define GPIO_BSRR_BS_7 ((uint32_t)0x00000080)
  1620. #define GPIO_BSRR_BS_8 ((uint32_t)0x00000100)
  1621. #define GPIO_BSRR_BS_9 ((uint32_t)0x00000200)
  1622. #define GPIO_BSRR_BS_10 ((uint32_t)0x00000400)
  1623. #define GPIO_BSRR_BS_11 ((uint32_t)0x00000800)
  1624. #define GPIO_BSRR_BS_12 ((uint32_t)0x00001000)
  1625. #define GPIO_BSRR_BS_13 ((uint32_t)0x00002000)
  1626. #define GPIO_BSRR_BS_14 ((uint32_t)0x00004000)
  1627. #define GPIO_BSRR_BS_15 ((uint32_t)0x00008000)
  1628. #define GPIO_BSRR_BR_0 ((uint32_t)0x00010000)
  1629. #define GPIO_BSRR_BR_1 ((uint32_t)0x00020000)
  1630. #define GPIO_BSRR_BR_2 ((uint32_t)0x00040000)
  1631. #define GPIO_BSRR_BR_3 ((uint32_t)0x00080000)
  1632. #define GPIO_BSRR_BR_4 ((uint32_t)0x00100000)
  1633. #define GPIO_BSRR_BR_5 ((uint32_t)0x00200000)
  1634. #define GPIO_BSRR_BR_6 ((uint32_t)0x00400000)
  1635. #define GPIO_BSRR_BR_7 ((uint32_t)0x00800000)
  1636. #define GPIO_BSRR_BR_8 ((uint32_t)0x01000000)
  1637. #define GPIO_BSRR_BR_9 ((uint32_t)0x02000000)
  1638. #define GPIO_BSRR_BR_10 ((uint32_t)0x04000000)
  1639. #define GPIO_BSRR_BR_11 ((uint32_t)0x08000000)
  1640. #define GPIO_BSRR_BR_12 ((uint32_t)0x10000000)
  1641. #define GPIO_BSRR_BR_13 ((uint32_t)0x20000000)
  1642. #define GPIO_BSRR_BR_14 ((uint32_t)0x40000000)
  1643. #define GPIO_BSRR_BR_15 ((uint32_t)0x80000000)
  1644. /****************** Bit definition for GPIO_LCKR register *********************/
  1645. #define GPIO_LCKR_LCK0 ((uint32_t)0x00000001)
  1646. #define GPIO_LCKR_LCK1 ((uint32_t)0x00000002)
  1647. #define GPIO_LCKR_LCK2 ((uint32_t)0x00000004)
  1648. #define GPIO_LCKR_LCK3 ((uint32_t)0x00000008)
  1649. #define GPIO_LCKR_LCK4 ((uint32_t)0x00000010)
  1650. #define GPIO_LCKR_LCK5 ((uint32_t)0x00000020)
  1651. #define GPIO_LCKR_LCK6 ((uint32_t)0x00000040)
  1652. #define GPIO_LCKR_LCK7 ((uint32_t)0x00000080)
  1653. #define GPIO_LCKR_LCK8 ((uint32_t)0x00000100)
  1654. #define GPIO_LCKR_LCK9 ((uint32_t)0x00000200)
  1655. #define GPIO_LCKR_LCK10 ((uint32_t)0x00000400)
  1656. #define GPIO_LCKR_LCK11 ((uint32_t)0x00000800)
  1657. #define GPIO_LCKR_LCK12 ((uint32_t)0x00001000)
  1658. #define GPIO_LCKR_LCK13 ((uint32_t)0x00002000)
  1659. #define GPIO_LCKR_LCK14 ((uint32_t)0x00004000)
  1660. #define GPIO_LCKR_LCK15 ((uint32_t)0x00008000)
  1661. #define GPIO_LCKR_LCKK ((uint32_t)0x00010000)
  1662. /******************************************************************************/
  1663. /* */
  1664. /* Inter-integrated Circuit Interface */
  1665. /* */
  1666. /******************************************************************************/
  1667. /******************* Bit definition for I2C_CR1 register ********************/
  1668. #define I2C_CR1_PE ((uint32_t)0x00000001) /*!<Peripheral Enable */
  1669. #define I2C_CR1_SMBUS ((uint32_t)0x00000002) /*!<SMBus Mode */
  1670. #define I2C_CR1_SMBTYPE ((uint32_t)0x00000008) /*!<SMBus Type */
  1671. #define I2C_CR1_ENARP ((uint32_t)0x00000010) /*!<ARP Enable */
  1672. #define I2C_CR1_ENPEC ((uint32_t)0x00000020) /*!<PEC Enable */
  1673. #define I2C_CR1_ENGC ((uint32_t)0x00000040) /*!<General Call Enable */
  1674. #define I2C_CR1_NOSTRETCH ((uint32_t)0x00000080) /*!<Clock Stretching Disable (Slave mode) */
  1675. #define I2C_CR1_START ((uint32_t)0x00000100) /*!<Start Generation */
  1676. #define I2C_CR1_STOP ((uint32_t)0x00000200) /*!<Stop Generation */
  1677. #define I2C_CR1_ACK ((uint32_t)0x00000400) /*!<Acknowledge Enable */
  1678. #define I2C_CR1_POS ((uint32_t)0x00000800) /*!<Acknowledge/PEC Position (for data reception) */
  1679. #define I2C_CR1_PEC ((uint32_t)0x00001000) /*!<Packet Error Checking */
  1680. #define I2C_CR1_ALERT ((uint32_t)0x00002000) /*!<SMBus Alert */
  1681. #define I2C_CR1_SWRST ((uint32_t)0x00008000) /*!<Software Reset */
  1682. /******************* Bit definition for I2C_CR2 register ********************/
  1683. #define I2C_CR2_FREQ ((uint32_t)0x0000003F) /*!<FREQ[5:0] bits (Peripheral Clock Frequency) */
  1684. #define I2C_CR2_FREQ_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  1685. #define I2C_CR2_FREQ_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  1686. #define I2C_CR2_FREQ_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  1687. #define I2C_CR2_FREQ_3 ((uint32_t)0x00000008) /*!<Bit 3 */
  1688. #define I2C_CR2_FREQ_4 ((uint32_t)0x00000010) /*!<Bit 4 */
  1689. #define I2C_CR2_FREQ_5 ((uint32_t)0x00000020) /*!<Bit 5 */
  1690. #define I2C_CR2_ITERREN ((uint32_t)0x00000100) /*!<Error Interrupt Enable */
  1691. #define I2C_CR2_ITEVTEN ((uint32_t)0x00000200) /*!<Event Interrupt Enable */
  1692. #define I2C_CR2_ITBUFEN ((uint32_t)0x00000400) /*!<Buffer Interrupt Enable */
  1693. #define I2C_CR2_DMAEN ((uint32_t)0x00000800) /*!<DMA Requests Enable */
  1694. #define I2C_CR2_LAST ((uint32_t)0x00001000) /*!<DMA Last Transfer */
  1695. /******************* Bit definition for I2C_OAR1 register *******************/
  1696. #define I2C_OAR1_ADD1_7 ((uint32_t)0x000000FE) /*!<Interface Address */
  1697. #define I2C_OAR1_ADD8_9 ((uint32_t)0x00000300) /*!<Interface Address */
  1698. #define I2C_OAR1_ADD0 ((uint32_t)0x00000001) /*!<Bit 0 */
  1699. #define I2C_OAR1_ADD1 ((uint32_t)0x00000002) /*!<Bit 1 */
  1700. #define I2C_OAR1_ADD2 ((uint32_t)0x00000004) /*!<Bit 2 */
  1701. #define I2C_OAR1_ADD3 ((uint32_t)0x00000008) /*!<Bit 3 */
  1702. #define I2C_OAR1_ADD4 ((uint32_t)0x00000010) /*!<Bit 4 */
  1703. #define I2C_OAR1_ADD5 ((uint32_t)0x00000020) /*!<Bit 5 */
  1704. #define I2C_OAR1_ADD6 ((uint32_t)0x00000040) /*!<Bit 6 */
  1705. #define I2C_OAR1_ADD7 ((uint32_t)0x00000080) /*!<Bit 7 */
  1706. #define I2C_OAR1_ADD8 ((uint32_t)0x00000100) /*!<Bit 8 */
  1707. #define I2C_OAR1_ADD9 ((uint32_t)0x00000200) /*!<Bit 9 */
  1708. #define I2C_OAR1_ADDMODE ((uint32_t)0x00008000) /*!<Addressing Mode (Slave mode) */
  1709. /******************* Bit definition for I2C_OAR2 register *******************/
  1710. #define I2C_OAR2_ENDUAL ((uint32_t)0x00000001) /*!<Dual addressing mode enable */
  1711. #define I2C_OAR2_ADD2 ((uint32_t)0x000000FE) /*!<Interface address */
  1712. /******************** Bit definition for I2C_DR register ********************/
  1713. #define I2C_DR_DR ((uint32_t)0x000000FF) /*!<8-bit Data Register */
  1714. /******************* Bit definition for I2C_SR1 register ********************/
  1715. #define I2C_SR1_SB ((uint32_t)0x00000001) /*!<Start Bit (Master mode) */
  1716. #define I2C_SR1_ADDR ((uint32_t)0x00000002) /*!<Address sent (master mode)/matched (slave mode) */
  1717. #define I2C_SR1_BTF ((uint32_t)0x00000004) /*!<Byte Transfer Finished */
  1718. #define I2C_SR1_ADD10 ((uint32_t)0x00000008) /*!<10-bit header sent (Master mode) */
  1719. #define I2C_SR1_STOPF ((uint32_t)0x00000010) /*!<Stop detection (Slave mode) */
  1720. #define I2C_SR1_RXNE ((uint32_t)0x00000040) /*!<Data Register not Empty (receivers) */
  1721. #define I2C_SR1_TXE ((uint32_t)0x00000080) /*!<Data Register Empty (transmitters) */
  1722. #define I2C_SR1_BERR ((uint32_t)0x00000100) /*!<Bus Error */
  1723. #define I2C_SR1_ARLO ((uint32_t)0x00000200) /*!<Arbitration Lost (master mode) */
  1724. #define I2C_SR1_AF ((uint32_t)0x00000400) /*!<Acknowledge Failure */
  1725. #define I2C_SR1_OVR ((uint32_t)0x00000800) /*!<Overrun/Underrun */
  1726. #define I2C_SR1_PECERR ((uint32_t)0x00001000) /*!<PEC Error in reception */
  1727. #define I2C_SR1_TIMEOUT ((uint32_t)0x00004000) /*!<Timeout or Tlow Error */
  1728. #define I2C_SR1_SMBALERT ((uint32_t)0x00008000) /*!<SMBus Alert */
  1729. /******************* Bit definition for I2C_SR2 register ********************/
  1730. #define I2C_SR2_MSL ((uint32_t)0x00000001) /*!<Master/Slave */
  1731. #define I2C_SR2_BUSY ((uint32_t)0x00000002) /*!<Bus Busy */
  1732. #define I2C_SR2_TRA ((uint32_t)0x00000004) /*!<Transmitter/Receiver */
  1733. #define I2C_SR2_GENCALL ((uint32_t)0x00000010) /*!<General Call Address (Slave mode) */
  1734. #define I2C_SR2_SMBDEFAULT ((uint32_t)0x00000020) /*!<SMBus Device Default Address (Slave mode) */
  1735. #define I2C_SR2_SMBHOST ((uint32_t)0x00000040) /*!<SMBus Host Header (Slave mode) */
  1736. #define I2C_SR2_DUALF ((uint32_t)0x00000080) /*!<Dual Flag (Slave mode) */
  1737. #define I2C_SR2_PEC ((uint32_t)0x0000FF00) /*!<Packet Error Checking Register */
  1738. /******************* Bit definition for I2C_CCR register ********************/
  1739. #define I2C_CCR_CCR ((uint32_t)0x00000FFF) /*!<Clock Control Register in Fast/Standard mode (Master mode) */
  1740. #define I2C_CCR_DUTY ((uint32_t)0x00004000) /*!<Fast Mode Duty Cycle */
  1741. #define I2C_CCR_FS ((uint32_t)0x00008000) /*!<I2C Master Mode Selection */
  1742. /****************** Bit definition for I2C_TRISE register *******************/
  1743. #define I2C_TRISE_TRISE ((uint32_t)0x0000003F) /*!<Maximum Rise Time in Fast/Standard mode (Master mode) */
  1744. /****************** Bit definition for I2C_FLTR register *******************/
  1745. #define I2C_FLTR_DNF ((uint32_t)0x0000000F) /*!<Digital Noise Filter */
  1746. #define I2C_FLTR_ANOFF ((uint32_t)0x00000010) /*!<Analog Noise Filter OFF */
  1747. /******************************************************************************/
  1748. /* */
  1749. /* Fast Mode Plus Inter-integrated Circuit Interface (I2C) */
  1750. /* */
  1751. /******************************************************************************/
  1752. /******************* Bit definition for I2C_CR1 register *******************/
  1753. #define FMPI2C_CR1_PE ((uint32_t)0x00000001) /*!< Peripheral enable */
  1754. #define FMPI2C_CR1_TXIE ((uint32_t)0x00000002) /*!< TX interrupt enable */
  1755. #define FMPI2C_CR1_RXIE ((uint32_t)0x00000004) /*!< RX interrupt enable */
  1756. #define FMPI2C_CR1_ADDRIE ((uint32_t)0x00000008) /*!< Address match interrupt enable */
  1757. #define FMPI2C_CR1_NACKIE ((uint32_t)0x00000010) /*!< NACK received interrupt enable */
  1758. #define FMPI2C_CR1_STOPIE ((uint32_t)0x00000020) /*!< STOP detection interrupt enable */
  1759. #define FMPI2C_CR1_TCIE ((uint32_t)0x00000040) /*!< Transfer complete interrupt enable */
  1760. #define FMPI2C_CR1_ERRIE ((uint32_t)0x00000080) /*!< Errors interrupt enable */
  1761. #define FMPI2C_CR1_DFN ((uint32_t)0x00000F00) /*!< Digital noise filter */
  1762. #define FMPI2C_CR1_ANFOFF ((uint32_t)0x00001000) /*!< Analog noise filter OFF */
  1763. #define FMPI2C_CR1_SWRST ((uint32_t)0x00002000) /*!< Software reset */
  1764. #define FMPI2C_CR1_TXDMAEN ((uint32_t)0x00004000) /*!< DMA transmission requests enable */
  1765. #define FMPI2C_CR1_RXDMAEN ((uint32_t)0x00008000) /*!< DMA reception requests enable */
  1766. #define FMPI2C_CR1_SBC ((uint32_t)0x00010000) /*!< Slave byte control */
  1767. #define FMPI2C_CR1_NOSTRETCH ((uint32_t)0x00020000) /*!< Clock stretching disable */
  1768. #define FMPI2C_CR1_WUPEN ((uint32_t)0x00040000) /*!< Wakeup from STOP enable */
  1769. #define FMPI2C_CR1_GCEN ((uint32_t)0x00080000) /*!< General call enable */
  1770. #define FMPI2C_CR1_SMBHEN ((uint32_t)0x00100000) /*!< SMBus host address enable */
  1771. #define FMPI2C_CR1_SMBDEN ((uint32_t)0x00200000) /*!< SMBus device default address enable */
  1772. #define FMPI2C_CR1_ALERTEN ((uint32_t)0x00400000) /*!< SMBus alert enable */
  1773. #define FMPI2C_CR1_PECEN ((uint32_t)0x00800000) /*!< PEC enable */
  1774. /****************** Bit definition for I2C_CR2 register ********************/
  1775. #define FMPI2C_CR2_SADD ((uint32_t)0x000003FF) /*!< Slave address (master mode) */
  1776. #define FMPI2C_CR2_RD_WRN ((uint32_t)0x00000400) /*!< Transfer direction (master mode) */
  1777. #define FMPI2C_CR2_ADD10 ((uint32_t)0x00000800) /*!< 10-bit addressing mode (master mode) */
  1778. #define FMPI2C_CR2_HEAD10R ((uint32_t)0x00001000) /*!< 10-bit address header only read direction (master mode) */
  1779. #define FMPI2C_CR2_START ((uint32_t)0x00002000) /*!< START generation */
  1780. #define FMPI2C_CR2_STOP ((uint32_t)0x00004000) /*!< STOP generation (master mode) */
  1781. #define FMPI2C_CR2_NACK ((uint32_t)0x00008000) /*!< NACK generation (slave mode) */
  1782. #define FMPI2C_CR2_NBYTES ((uint32_t)0x00FF0000) /*!< Number of bytes */
  1783. #define FMPI2C_CR2_RELOAD ((uint32_t)0x01000000) /*!< NBYTES reload mode */
  1784. #define FMPI2C_CR2_AUTOEND ((uint32_t)0x02000000) /*!< Automatic end mode (master mode) */
  1785. #define FMPI2C_CR2_PECBYTE ((uint32_t)0x04000000) /*!< Packet error checking byte */
  1786. /******************* Bit definition for I2C_OAR1 register ******************/
  1787. #define FMPI2C_OAR1_OA1 ((uint32_t)0x000003FF) /*!< Interface own address 1 */
  1788. #define FMPI2C_OAR1_OA1MODE ((uint32_t)0x00000400) /*!< Own address 1 10-bit mode */
  1789. #define FMPI2C_OAR1_OA1EN ((uint32_t)0x00008000) /*!< Own address 1 enable */
  1790. /******************* Bit definition for I2C_OAR2 register ******************/
  1791. #define FMPI2C_OAR2_OA2 ((uint32_t)0x000000FE) /*!< Interface own address 2 */
  1792. #define FMPI2C_OAR2_OA2MSK ((uint32_t)0x00000700) /*!< Own address 2 masks */
  1793. #define FMPI2C_OAR2_OA2EN ((uint32_t)0x00008000) /*!< Own address 2 enable */
  1794. /******************* Bit definition for I2C_TIMINGR register *******************/
  1795. #define FMPI2C_TIMINGR_SCLL ((uint32_t)0x000000FF) /*!< SCL low period (master mode) */
  1796. #define FMPI2C_TIMINGR_SCLH ((uint32_t)0x0000FF00) /*!< SCL high period (master mode) */
  1797. #define FMPI2C_TIMINGR_SDADEL ((uint32_t)0x000F0000) /*!< Data hold time */
  1798. #define FMPI2C_TIMINGR_SCLDEL ((uint32_t)0x00F00000) /*!< Data setup time */
  1799. #define FMPI2C_TIMINGR_PRESC ((uint32_t)0xF0000000) /*!< Timings prescaler */
  1800. /******************* Bit definition for I2C_TIMEOUTR register *******************/
  1801. #define FMPI2C_TIMEOUTR_TIMEOUTA ((uint32_t)0x00000FFF) /*!< Bus timeout A */
  1802. #define FMPI2C_TIMEOUTR_TIDLE ((uint32_t)0x00001000) /*!< Idle clock timeout detection */
  1803. #define FMPI2C_TIMEOUTR_TIMOUTEN ((uint32_t)0x00008000) /*!< Clock timeout enable */
  1804. #define FMPI2C_TIMEOUTR_TIMEOUTB ((uint32_t)0x0FFF0000) /*!< Bus timeout B */
  1805. #define FMPI2C_TIMEOUTR_TEXTEN ((uint32_t)0x80000000) /*!< Extended clock timeout enable */
  1806. /****************** Bit definition for I2C_ISR register *********************/
  1807. #define FMPI2C_ISR_TXE ((uint32_t)0x00000001) /*!< Transmit data register empty */
  1808. #define FMPI2C_ISR_TXIS ((uint32_t)0x00000002) /*!< Transmit interrupt status */
  1809. #define FMPI2C_ISR_RXNE ((uint32_t)0x00000004) /*!< Receive data register not empty */
  1810. #define FMPI2C_ISR_ADDR ((uint32_t)0x00000008) /*!< Address matched (slave mode) */
  1811. #define FMPI2C_ISR_NACKF ((uint32_t)0x00000010) /*!< NACK received flag */
  1812. #define FMPI2C_ISR_STOPF ((uint32_t)0x00000020) /*!< STOP detection flag */
  1813. #define FMPI2C_ISR_TC ((uint32_t)0x00000040) /*!< Transfer complete (master mode) */
  1814. #define FMPI2C_ISR_TCR ((uint32_t)0x00000080) /*!< Transfer complete reload */
  1815. #define FMPI2C_ISR_BERR ((uint32_t)0x00000100) /*!< Bus error */
  1816. #define FMPI2C_ISR_ARLO ((uint32_t)0x00000200) /*!< Arbitration lost */
  1817. #define FMPI2C_ISR_OVR ((uint32_t)0x00000400) /*!< Overrun/Underrun */
  1818. #define FMPI2C_ISR_PECERR ((uint32_t)0x00000800) /*!< PEC error in reception */
  1819. #define FMPI2C_ISR_TIMEOUT ((uint32_t)0x00001000) /*!< Timeout or Tlow detection flag */
  1820. #define FMPI2C_ISR_ALERT ((uint32_t)0x00002000) /*!< SMBus alert */
  1821. #define FMPI2C_ISR_BUSY ((uint32_t)0x00008000) /*!< Bus busy */
  1822. #define FMPI2C_ISR_DIR ((uint32_t)0x00010000) /*!< Transfer direction (slave mode) */
  1823. #define FMPI2C_ISR_ADDCODE ((uint32_t)0x00FE0000) /*!< Address match code (slave mode) */
  1824. /****************** Bit definition for I2C_ICR register *********************/
  1825. #define FMPI2C_ICR_ADDRCF ((uint32_t)0x00000008) /*!< Address matched clear flag */
  1826. #define FMPI2C_ICR_NACKCF ((uint32_t)0x00000010) /*!< NACK clear flag */
  1827. #define FMPI2C_ICR_STOPCF ((uint32_t)0x00000020) /*!< STOP detection clear flag */
  1828. #define FMPI2C_ICR_BERRCF ((uint32_t)0x00000100) /*!< Bus error clear flag */
  1829. #define FMPI2C_ICR_ARLOCF ((uint32_t)0x00000200) /*!< Arbitration lost clear flag */
  1830. #define FMPI2C_ICR_OVRCF ((uint32_t)0x00000400) /*!< Overrun/Underrun clear flag */
  1831. #define FMPI2C_ICR_PECCF ((uint32_t)0x00000800) /*!< PAC error clear flag */
  1832. #define FMPI2C_ICR_TIMOUTCF ((uint32_t)0x00001000) /*!< Timeout clear flag */
  1833. #define FMPI2C_ICR_ALERTCF ((uint32_t)0x00002000) /*!< Alert clear flag */
  1834. /****************** Bit definition for I2C_PECR register *********************/
  1835. #define FMPI2C_PECR_PEC ((uint32_t)0x000000FF) /*!< PEC register */
  1836. /****************** Bit definition for I2C_RXDR register *********************/
  1837. #define FMPI2C_RXDR_RXDATA ((uint32_t)0x000000FF) /*!< 8-bit receive data */
  1838. /****************** Bit definition for I2C_TXDR register *********************/
  1839. #define FMPI2C_TXDR_TXDATA ((uint32_t)0x000000FF) /*!< 8-bit transmit data */
  1840. /******************************************************************************/
  1841. /* */
  1842. /* Independent WATCHDOG */
  1843. /* */
  1844. /******************************************************************************/
  1845. /******************* Bit definition for IWDG_KR register ********************/
  1846. #define IWDG_KR_KEY ((uint32_t)0xFFFF) /*!<Key value (write only, read 0000h) */
  1847. /******************* Bit definition for IWDG_PR register ********************/
  1848. #define IWDG_PR_PR ((uint32_t)0x07) /*!<PR[2:0] (Prescaler divider) */
  1849. #define IWDG_PR_PR_0 ((uint32_t)0x01) /*!<Bit 0 */
  1850. #define IWDG_PR_PR_1 ((uint32_t)0x02) /*!<Bit 1 */
  1851. #define IWDG_PR_PR_2 ((uint32_t)0x04) /*!<Bit 2 */
  1852. /******************* Bit definition for IWDG_RLR register *******************/
  1853. #define IWDG_RLR_RL ((uint32_t)0x0FFF) /*!<Watchdog counter reload value */
  1854. /******************* Bit definition for IWDG_SR register ********************/
  1855. #define IWDG_SR_PVU ((uint32_t)0x01) /*!<Watchdog prescaler value update */
  1856. #define IWDG_SR_RVU ((uint32_t)0x02) /*!<Watchdog counter reload value update */
  1857. /******************************************************************************/
  1858. /* */
  1859. /* Power Control */
  1860. /* */
  1861. /******************************************************************************/
  1862. /******************** Bit definition for PWR_CR register ********************/
  1863. #define PWR_CR_LPDS ((uint32_t)0x00000001) /*!< Low-Power Deepsleep */
  1864. #define PWR_CR_PDDS ((uint32_t)0x00000002) /*!< Power Down Deepsleep */
  1865. #define PWR_CR_CWUF ((uint32_t)0x00000004) /*!< Clear Wakeup Flag */
  1866. #define PWR_CR_CSBF ((uint32_t)0x00000008) /*!< Clear Standby Flag */
  1867. #define PWR_CR_PVDE ((uint32_t)0x00000010) /*!< Power Voltage Detector Enable */
  1868. #define PWR_CR_PLS ((uint32_t)0x000000E0) /*!< PLS[2:0] bits (PVD Level Selection) */
  1869. #define PWR_CR_PLS_0 ((uint32_t)0x00000020) /*!< Bit 0 */
  1870. #define PWR_CR_PLS_1 ((uint32_t)0x00000040) /*!< Bit 1 */
  1871. #define PWR_CR_PLS_2 ((uint32_t)0x00000080) /*!< Bit 2 */
  1872. /*!< PVD level configuration */
  1873. #define PWR_CR_PLS_LEV0 ((uint32_t)0x00000000) /*!< PVD level 0 */
  1874. #define PWR_CR_PLS_LEV1 ((uint32_t)0x00000020) /*!< PVD level 1 */
  1875. #define PWR_CR_PLS_LEV2 ((uint32_t)0x00000040) /*!< PVD level 2 */
  1876. #define PWR_CR_PLS_LEV3 ((uint32_t)0x00000060) /*!< PVD level 3 */
  1877. #define PWR_CR_PLS_LEV4 ((uint32_t)0x00000080) /*!< PVD level 4 */
  1878. #define PWR_CR_PLS_LEV5 ((uint32_t)0x000000A0) /*!< PVD level 5 */
  1879. #define PWR_CR_PLS_LEV6 ((uint32_t)0x000000C0) /*!< PVD level 6 */
  1880. #define PWR_CR_PLS_LEV7 ((uint32_t)0x000000E0) /*!< PVD level 7 */
  1881. #define PWR_CR_DBP ((uint32_t)0x00000100) /*!< Disable Backup Domain write protection */
  1882. #define PWR_CR_FPDS ((uint32_t)0x00000200) /*!< Flash power down in Stop mode */
  1883. #define PWR_CR_LPLVDS ((uint32_t)0x00000400) /*!< Low Power Regulator Low Voltage in Deep Sleep mode */
  1884. #define PWR_CR_MRLVDS ((uint32_t)0x00000800) /*!< Main Regulator Low Voltage in Deep Sleep mode */
  1885. #define PWR_CR_ADCDC1 ((uint32_t)0x00002000) /*!< Refer to AN4073 on how to use this bit */
  1886. #define PWR_CR_VOS ((uint32_t)0x0000C000) /*!< VOS[1:0] bits (Regulator voltage scaling output selection) */
  1887. #define PWR_CR_VOS_0 ((uint32_t)0x00004000) /*!< Bit 0 */
  1888. #define PWR_CR_VOS_1 ((uint32_t)0x00008000) /*!< Bit 1 */
  1889. #define PWR_CR_FMSSR ((uint32_t)0x00100000) /*!< Flash Memory Sleep System Run */
  1890. #define PWR_CR_FISSR ((uint32_t)0x00200000) /*!< Flash Interface Stop while System Run */
  1891. /* Legacy define */
  1892. #define PWR_CR_PMODE PWR_CR_VOS
  1893. /******************* Bit definition for PWR_CSR register ********************/
  1894. #define PWR_CSR_WUF ((uint32_t)0x00000001) /*!< Wakeup Flag */
  1895. #define PWR_CSR_SBF ((uint32_t)0x00000002) /*!< Standby Flag */
  1896. #define PWR_CSR_PVDO ((uint32_t)0x00000004) /*!< PVD Output */
  1897. #define PWR_CSR_BRR ((uint32_t)0x00000008) /*!< Backup regulator ready */
  1898. #define PWR_CSR_EWUP ((uint32_t)0x00000100) /*!< Enable WKUP pin */
  1899. #define PWR_CSR_BRE ((uint32_t)0x00000200) /*!< Backup regulator enable */
  1900. #define PWR_CSR_VOSRDY ((uint32_t)0x00004000) /*!< Regulator voltage scaling output selection ready */
  1901. /* Legacy define */
  1902. #define PWR_CSR_REGRDY PWR_CSR_VOSRDY
  1903. /******************************************************************************/
  1904. /* */
  1905. /* Reset and Clock Control */
  1906. /* */
  1907. /******************************************************************************/
  1908. /******************** Bit definition for RCC_CR register ********************/
  1909. #define RCC_CR_HSION ((uint32_t)0x00000001)
  1910. #define RCC_CR_HSIRDY ((uint32_t)0x00000002)
  1911. #define RCC_CR_HSITRIM ((uint32_t)0x000000F8)
  1912. #define RCC_CR_HSITRIM_0 ((uint32_t)0x00000008)/*!<Bit 0 */
  1913. #define RCC_CR_HSITRIM_1 ((uint32_t)0x00000010)/*!<Bit 1 */
  1914. #define RCC_CR_HSITRIM_2 ((uint32_t)0x00000020)/*!<Bit 2 */
  1915. #define RCC_CR_HSITRIM_3 ((uint32_t)0x00000040)/*!<Bit 3 */
  1916. #define RCC_CR_HSITRIM_4 ((uint32_t)0x00000080)/*!<Bit 4 */
  1917. #define RCC_CR_HSICAL ((uint32_t)0x0000FF00)
  1918. #define RCC_CR_HSICAL_0 ((uint32_t)0x00000100)/*!<Bit 0 */
  1919. #define RCC_CR_HSICAL_1 ((uint32_t)0x00000200)/*!<Bit 1 */
  1920. #define RCC_CR_HSICAL_2 ((uint32_t)0x00000400)/*!<Bit 2 */
  1921. #define RCC_CR_HSICAL_3 ((uint32_t)0x00000800)/*!<Bit 3 */
  1922. #define RCC_CR_HSICAL_4 ((uint32_t)0x00001000)/*!<Bit 4 */
  1923. #define RCC_CR_HSICAL_5 ((uint32_t)0x00002000)/*!<Bit 5 */
  1924. #define RCC_CR_HSICAL_6 ((uint32_t)0x00004000)/*!<Bit 6 */
  1925. #define RCC_CR_HSICAL_7 ((uint32_t)0x00008000)/*!<Bit 7 */
  1926. #define RCC_CR_HSEON ((uint32_t)0x00010000)
  1927. #define RCC_CR_HSERDY ((uint32_t)0x00020000)
  1928. #define RCC_CR_HSEBYP ((uint32_t)0x00040000)
  1929. #define RCC_CR_CSSON ((uint32_t)0x00080000)
  1930. #define RCC_CR_PLLON ((uint32_t)0x01000000)
  1931. #define RCC_CR_PLLRDY ((uint32_t)0x02000000)
  1932. /******************** Bit definition for RCC_PLLCFGR register ***************/
  1933. #define RCC_PLLCFGR_PLLM ((uint32_t)0x0000003F)
  1934. #define RCC_PLLCFGR_PLLM_0 ((uint32_t)0x00000001)
  1935. #define RCC_PLLCFGR_PLLM_1 ((uint32_t)0x00000002)
  1936. #define RCC_PLLCFGR_PLLM_2 ((uint32_t)0x00000004)
  1937. #define RCC_PLLCFGR_PLLM_3 ((uint32_t)0x00000008)
  1938. #define RCC_PLLCFGR_PLLM_4 ((uint32_t)0x00000010)
  1939. #define RCC_PLLCFGR_PLLM_5 ((uint32_t)0x00000020)
  1940. #define RCC_PLLCFGR_PLLN ((uint32_t)0x00007FC0)
  1941. #define RCC_PLLCFGR_PLLN_0 ((uint32_t)0x00000040)
  1942. #define RCC_PLLCFGR_PLLN_1 ((uint32_t)0x00000080)
  1943. #define RCC_PLLCFGR_PLLN_2 ((uint32_t)0x00000100)
  1944. #define RCC_PLLCFGR_PLLN_3 ((uint32_t)0x00000200)
  1945. #define RCC_PLLCFGR_PLLN_4 ((uint32_t)0x00000400)
  1946. #define RCC_PLLCFGR_PLLN_5 ((uint32_t)0x00000800)
  1947. #define RCC_PLLCFGR_PLLN_6 ((uint32_t)0x00001000)
  1948. #define RCC_PLLCFGR_PLLN_7 ((uint32_t)0x00002000)
  1949. #define RCC_PLLCFGR_PLLN_8 ((uint32_t)0x00004000)
  1950. #define RCC_PLLCFGR_PLLP ((uint32_t)0x00030000)
  1951. #define RCC_PLLCFGR_PLLP_0 ((uint32_t)0x00010000)
  1952. #define RCC_PLLCFGR_PLLP_1 ((uint32_t)0x00020000)
  1953. #define RCC_PLLCFGR_PLLSRC ((uint32_t)0x00400000)
  1954. #define RCC_PLLCFGR_PLLSRC_HSE ((uint32_t)0x00400000)
  1955. #define RCC_PLLCFGR_PLLSRC_HSI ((uint32_t)0x00000000)
  1956. #define RCC_PLLCFGR_PLLQ ((uint32_t)0x0F000000)
  1957. #define RCC_PLLCFGR_PLLQ_0 ((uint32_t)0x01000000)
  1958. #define RCC_PLLCFGR_PLLQ_1 ((uint32_t)0x02000000)
  1959. #define RCC_PLLCFGR_PLLQ_2 ((uint32_t)0x04000000)
  1960. #define RCC_PLLCFGR_PLLQ_3 ((uint32_t)0x08000000)
  1961. #define RCC_PLLCFGR_PLLR ((uint32_t)0x70000000)
  1962. #define RCC_PLLCFGR_PLLR_0 ((uint32_t)0x10000000)
  1963. #define RCC_PLLCFGR_PLLR_1 ((uint32_t)0x20000000)
  1964. #define RCC_PLLCFGR_PLLR_2 ((uint32_t)0x40000000)
  1965. /******************** Bit definition for RCC_CFGR register ******************/
  1966. /*!< SW configuration */
  1967. #define RCC_CFGR_SW ((uint32_t)0x00000003) /*!< SW[1:0] bits (System clock Switch) */
  1968. #define RCC_CFGR_SW_0 ((uint32_t)0x00000001) /*!< Bit 0 */
  1969. #define RCC_CFGR_SW_1 ((uint32_t)0x00000002) /*!< Bit 1 */
  1970. #define RCC_CFGR_SW_HSI ((uint32_t)0x00000000) /*!< HSI selected as system clock */
  1971. #define RCC_CFGR_SW_HSE ((uint32_t)0x00000001) /*!< HSE selected as system clock */
  1972. #define RCC_CFGR_SW_PLL ((uint32_t)0x00000002) /*!< PLL selected as system clock */
  1973. /*!< SWS configuration */
  1974. #define RCC_CFGR_SWS ((uint32_t)0x0000000C) /*!< SWS[1:0] bits (System Clock Switch Status) */
  1975. #define RCC_CFGR_SWS_0 ((uint32_t)0x00000004) /*!< Bit 0 */
  1976. #define RCC_CFGR_SWS_1 ((uint32_t)0x00000008) /*!< Bit 1 */
  1977. #define RCC_CFGR_SWS_HSI ((uint32_t)0x00000000) /*!< HSI oscillator used as system clock */
  1978. #define RCC_CFGR_SWS_HSE ((uint32_t)0x00000004) /*!< HSE oscillator used as system clock */
  1979. #define RCC_CFGR_SWS_PLL ((uint32_t)0x00000008) /*!< PLL used as system clock */
  1980. /*!< HPRE configuration */
  1981. #define RCC_CFGR_HPRE ((uint32_t)0x000000F0) /*!< HPRE[3:0] bits (AHB prescaler) */
  1982. #define RCC_CFGR_HPRE_0 ((uint32_t)0x00000010) /*!< Bit 0 */
  1983. #define RCC_CFGR_HPRE_1 ((uint32_t)0x00000020) /*!< Bit 1 */
  1984. #define RCC_CFGR_HPRE_2 ((uint32_t)0x00000040) /*!< Bit 2 */
  1985. #define RCC_CFGR_HPRE_3 ((uint32_t)0x00000080) /*!< Bit 3 */
  1986. #define RCC_CFGR_HPRE_DIV1 ((uint32_t)0x00000000) /*!< SYSCLK not divided */
  1987. #define RCC_CFGR_HPRE_DIV2 ((uint32_t)0x00000080) /*!< SYSCLK divided by 2 */
  1988. #define RCC_CFGR_HPRE_DIV4 ((uint32_t)0x00000090) /*!< SYSCLK divided by 4 */
  1989. #define RCC_CFGR_HPRE_DIV8 ((uint32_t)0x000000A0) /*!< SYSCLK divided by 8 */
  1990. #define RCC_CFGR_HPRE_DIV16 ((uint32_t)0x000000B0) /*!< SYSCLK divided by 16 */
  1991. #define RCC_CFGR_HPRE_DIV64 ((uint32_t)0x000000C0) /*!< SYSCLK divided by 64 */
  1992. #define RCC_CFGR_HPRE_DIV128 ((uint32_t)0x000000D0) /*!< SYSCLK divided by 128 */
  1993. #define RCC_CFGR_HPRE_DIV256 ((uint32_t)0x000000E0) /*!< SYSCLK divided by 256 */
  1994. #define RCC_CFGR_HPRE_DIV512 ((uint32_t)0x000000F0) /*!< SYSCLK divided by 512 */
  1995. /*!< MCO1EN configuration */
  1996. #define RCC_CFGR_MCO1EN ((uint32_t)0x00000100) /*!< MCO1EN bit */
  1997. /*!< MCO2EN configuration */
  1998. #define RCC_CFGR_MCO2EN ((uint32_t)0x00000200) /*!< MCO2EN bit */
  1999. /*!< PPRE1 configuration */
  2000. #define RCC_CFGR_PPRE1 ((uint32_t)0x00001C00) /*!< PRE1[2:0] bits (APB1 prescaler) */
  2001. #define RCC_CFGR_PPRE1_0 ((uint32_t)0x00000400) /*!< Bit 0 */
  2002. #define RCC_CFGR_PPRE1_1 ((uint32_t)0x00000800) /*!< Bit 1 */
  2003. #define RCC_CFGR_PPRE1_2 ((uint32_t)0x00001000) /*!< Bit 2 */
  2004. #define RCC_CFGR_PPRE1_DIV1 ((uint32_t)0x00000000) /*!< HCLK not divided */
  2005. #define RCC_CFGR_PPRE1_DIV2 ((uint32_t)0x00001000) /*!< HCLK divided by 2 */
  2006. #define RCC_CFGR_PPRE1_DIV4 ((uint32_t)0x00001400) /*!< HCLK divided by 4 */
  2007. #define RCC_CFGR_PPRE1_DIV8 ((uint32_t)0x00001800) /*!< HCLK divided by 8 */
  2008. #define RCC_CFGR_PPRE1_DIV16 ((uint32_t)0x00001C00) /*!< HCLK divided by 16 */
  2009. /*!< PPRE2 configuration */
  2010. #define RCC_CFGR_PPRE2 ((uint32_t)0x0000E000) /*!< PRE2[2:0] bits (APB2 prescaler) */
  2011. #define RCC_CFGR_PPRE2_0 ((uint32_t)0x00002000) /*!< Bit 0 */
  2012. #define RCC_CFGR_PPRE2_1 ((uint32_t)0x00004000) /*!< Bit 1 */
  2013. #define RCC_CFGR_PPRE2_2 ((uint32_t)0x00008000) /*!< Bit 2 */
  2014. #define RCC_CFGR_PPRE2_DIV1 ((uint32_t)0x00000000) /*!< HCLK not divided */
  2015. #define RCC_CFGR_PPRE2_DIV2 ((uint32_t)0x00008000) /*!< HCLK divided by 2 */
  2016. #define RCC_CFGR_PPRE2_DIV4 ((uint32_t)0x0000A000) /*!< HCLK divided by 4 */
  2017. #define RCC_CFGR_PPRE2_DIV8 ((uint32_t)0x0000C000) /*!< HCLK divided by 8 */
  2018. #define RCC_CFGR_PPRE2_DIV16 ((uint32_t)0x0000E000) /*!< HCLK divided by 16 */
  2019. /*!< RTCPRE configuration */
  2020. #define RCC_CFGR_RTCPRE ((uint32_t)0x001F0000)
  2021. #define RCC_CFGR_RTCPRE_0 ((uint32_t)0x00010000)
  2022. #define RCC_CFGR_RTCPRE_1 ((uint32_t)0x00020000)
  2023. #define RCC_CFGR_RTCPRE_2 ((uint32_t)0x00040000)
  2024. #define RCC_CFGR_RTCPRE_3 ((uint32_t)0x00080000)
  2025. #define RCC_CFGR_RTCPRE_4 ((uint32_t)0x00100000)
  2026. /*!< MCO1 configuration */
  2027. #define RCC_CFGR_MCO1 ((uint32_t)0x00600000)
  2028. #define RCC_CFGR_MCO1_0 ((uint32_t)0x00200000)
  2029. #define RCC_CFGR_MCO1_1 ((uint32_t)0x00400000)
  2030. #define RCC_CFGR_MCO1PRE ((uint32_t)0x07000000)
  2031. #define RCC_CFGR_MCO1PRE_0 ((uint32_t)0x01000000)
  2032. #define RCC_CFGR_MCO1PRE_1 ((uint32_t)0x02000000)
  2033. #define RCC_CFGR_MCO1PRE_2 ((uint32_t)0x04000000)
  2034. #define RCC_CFGR_MCO2PRE ((uint32_t)0x38000000)
  2035. #define RCC_CFGR_MCO2PRE_0 ((uint32_t)0x08000000)
  2036. #define RCC_CFGR_MCO2PRE_1 ((uint32_t)0x10000000)
  2037. #define RCC_CFGR_MCO2PRE_2 ((uint32_t)0x20000000)
  2038. #define RCC_CFGR_MCO2 ((uint32_t)0xC0000000)
  2039. #define RCC_CFGR_MCO2_0 ((uint32_t)0x40000000)
  2040. #define RCC_CFGR_MCO2_1 ((uint32_t)0x80000000)
  2041. /******************** Bit definition for RCC_CIR register *******************/
  2042. #define RCC_CIR_LSIRDYF ((uint32_t)0x00000001)
  2043. #define RCC_CIR_LSERDYF ((uint32_t)0x00000002)
  2044. #define RCC_CIR_HSIRDYF ((uint32_t)0x00000004)
  2045. #define RCC_CIR_HSERDYF ((uint32_t)0x00000008)
  2046. #define RCC_CIR_PLLRDYF ((uint32_t)0x00000010)
  2047. #define RCC_CIR_CSSF ((uint32_t)0x00000080)
  2048. #define RCC_CIR_LSIRDYIE ((uint32_t)0x00000100)
  2049. #define RCC_CIR_LSERDYIE ((uint32_t)0x00000200)
  2050. #define RCC_CIR_HSIRDYIE ((uint32_t)0x00000400)
  2051. #define RCC_CIR_HSERDYIE ((uint32_t)0x00000800)
  2052. #define RCC_CIR_PLLRDYIE ((uint32_t)0x00001000)
  2053. #define RCC_CIR_LSIRDYC ((uint32_t)0x00010000)
  2054. #define RCC_CIR_LSERDYC ((uint32_t)0x00020000)
  2055. #define RCC_CIR_HSIRDYC ((uint32_t)0x00040000)
  2056. #define RCC_CIR_HSERDYC ((uint32_t)0x00080000)
  2057. #define RCC_CIR_PLLRDYC ((uint32_t)0x00100000)
  2058. #define RCC_CIR_CSSC ((uint32_t)0x00800000)
  2059. /******************** Bit definition for RCC_AHB1RSTR register **************/
  2060. #define RCC_AHB1RSTR_GPIOARST ((uint32_t)0x00000001)
  2061. #define RCC_AHB1RSTR_GPIOBRST ((uint32_t)0x00000002)
  2062. #define RCC_AHB1RSTR_GPIOCRST ((uint32_t)0x00000004)
  2063. #define RCC_AHB1RSTR_GPIOHRST ((uint32_t)0x00000080)
  2064. #define RCC_AHB1RSTR_CRCRST ((uint32_t)0x00001000)
  2065. #define RCC_AHB1RSTR_DMA1RST ((uint32_t)0x00200000)
  2066. #define RCC_AHB1RSTR_DMA2RST ((uint32_t)0x00400000)
  2067. #define RCC_AHB1RSTR_RNGRST ((uint32_t)0x80000000)
  2068. /******************** Bit definition for RCC_APB1RSTR register **************/
  2069. #define RCC_APB1RSTR_TIM5RST ((uint32_t)0x00000008)
  2070. #define RCC_APB1RSTR_TIM6RST ((uint32_t)0x00000010)
  2071. #define RCC_APB1RSTR_LPTIM1RST ((uint32_t)0x00000200)
  2072. #define RCC_APB1RSTR_WWDGRST ((uint32_t)0x00000800)
  2073. #define RCC_APB1RSTR_SPI2RST ((uint32_t)0x00004000)
  2074. #define RCC_APB1RSTR_USART2RST ((uint32_t)0x00020000)
  2075. #define RCC_APB1RSTR_I2C1RST ((uint32_t)0x00200000)
  2076. #define RCC_APB1RSTR_I2C2RST ((uint32_t)0x00400000)
  2077. #define RCC_APB1RSTR_FMPI2C1RST ((uint32_t)0x01000000)
  2078. #define RCC_APB1RSTR_PWRRST ((uint32_t)0x10000000)
  2079. #define RCC_APB1RSTR_DACRST ((uint32_t)0x20000000)
  2080. /******************** Bit definition for RCC_APB2RSTR register **************/
  2081. #define RCC_APB2RSTR_TIM1RST ((uint32_t)0x00000001)
  2082. #define RCC_APB2RSTR_USART1RST ((uint32_t)0x00000010)
  2083. #define RCC_APB2RSTR_USART6RST ((uint32_t)0x00000020)
  2084. #define RCC_APB2RSTR_ADCRST ((uint32_t)0x00000100)
  2085. #define RCC_APB2RSTR_SPI1RST ((uint32_t)0x00001000)
  2086. #define RCC_APB2RSTR_SYSCFGRST ((uint32_t)0x00004000)
  2087. #define RCC_APB2RSTR_TIM9RST ((uint32_t)0x00010000)
  2088. #define RCC_APB2RSTR_TIM11RST ((uint32_t)0x00040000)
  2089. #define RCC_APB2RSTR_SPI5RST ((uint32_t)0x00100000)
  2090. /******************** Bit definition for RCC_AHB1ENR register ***************/
  2091. #define RCC_AHB1ENR_GPIOAEN ((uint32_t)0x00000001)
  2092. #define RCC_AHB1ENR_GPIOBEN ((uint32_t)0x00000002)
  2093. #define RCC_AHB1ENR_GPIOCEN ((uint32_t)0x00000004)
  2094. #define RCC_AHB1ENR_GPIOHEN ((uint32_t)0x00000080)
  2095. #define RCC_AHB1ENR_CRCEN ((uint32_t)0x00001000)
  2096. #define RCC_AHB1ENR_DMA1EN ((uint32_t)0x00200000)
  2097. #define RCC_AHB1ENR_DMA2EN ((uint32_t)0x00400000)
  2098. #define RCC_AHB1ENR_RNGEN ((uint32_t)0x80000000)
  2099. /******************** Bit definition for RCC_APB1ENR register ***************/
  2100. #define RCC_APB1ENR_TIM5EN ((uint32_t)0x00000008)
  2101. #define RCC_APB1ENR_TIM6EN ((uint32_t)0x00000010)
  2102. #define RCC_APB1ENR_LPTIM1EN ((uint32_t)0x00000200)
  2103. #define RCC_APB1ENR_RTCAPBEN ((uint32_t)0x00000400)
  2104. #define RCC_APB1ENR_WWDGEN ((uint32_t)0x00000800)
  2105. #define RCC_APB1ENR_SPI2EN ((uint32_t)0x00004000)
  2106. #define RCC_APB1ENR_USART2EN ((uint32_t)0x00020000)
  2107. #define RCC_APB1ENR_I2C1EN ((uint32_t)0x00200000)
  2108. #define RCC_APB1ENR_I2C2EN ((uint32_t)0x00400000)
  2109. #define RCC_APB1ENR_FMPI2C1EN ((uint32_t)0x01000000)
  2110. #define RCC_APB1ENR_PWREN ((uint32_t)0x10000000)
  2111. #define RCC_APB1ENR_DACEN ((uint32_t)0x20000000)
  2112. /******************** Bit definition for RCC_APB2ENR register ***************/
  2113. #define RCC_APB2ENR_TIM1EN ((uint32_t)0x00000001)
  2114. #define RCC_APB2ENR_USART1EN ((uint32_t)0x00000010)
  2115. #define RCC_APB2ENR_USART6EN ((uint32_t)0x00000020)
  2116. #define RCC_APB2ENR_ADC1EN ((uint32_t)0x00000100)
  2117. #define RCC_APB2ENR_SPI1EN ((uint32_t)0x00001000)
  2118. #define RCC_APB2ENR_SYSCFGEN ((uint32_t)0x00004000)
  2119. #define RCC_APB2ENR_EXTITEN ((uint32_t)0x00008000)
  2120. #define RCC_APB2ENR_TIM9EN ((uint32_t)0x00010000)
  2121. #define RCC_APB2ENR_TIM11EN ((uint32_t)0x00040000)
  2122. #define RCC_APB2ENR_SPI5EN ((uint32_t)0x00100000)
  2123. /******************** Bit definition for RCC_AHB1LPENR register *************/
  2124. #define RCC_AHB1LPENR_GPIOALPEN ((uint32_t)0x00000001)
  2125. #define RCC_AHB1LPENR_GPIOBLPEN ((uint32_t)0x00000002)
  2126. #define RCC_AHB1LPENR_GPIOCLPEN ((uint32_t)0x00000004)
  2127. #define RCC_AHB1LPENR_GPIOHLPEN ((uint32_t)0x00000080)
  2128. #define RCC_AHB1LPENR_CRCLPEN ((uint32_t)0x00001000)
  2129. #define RCC_AHB1LPENR_FLITFLPEN ((uint32_t)0x00008000)
  2130. #define RCC_AHB1LPENR_SRAM1LPEN ((uint32_t)0x00010000)
  2131. #define RCC_AHB1LPENR_DMA1LPEN ((uint32_t)0x00200000)
  2132. #define RCC_AHB1LPENR_DMA2LPEN ((uint32_t)0x00400000)
  2133. #define RCC_AHB1LPENR_RNGLPEN ((uint32_t)0x80000000)
  2134. /******************** Bit definition for RCC_APB1LPENR register *************/
  2135. #define RCC_APB1LPENR_TIM5LPEN ((uint32_t)0x00000008)
  2136. #define RCC_APB1LPENR_TIM6LPEN ((uint32_t)0x00000010)
  2137. #define RCC_APB1LPENR_LPTIM1LPEN ((uint32_t)0x00000200)
  2138. #define RCC_APB1LPENR_RTCAPBLPEN ((uint32_t)0x00000400)
  2139. #define RCC_APB1LPENR_WWDGLPEN ((uint32_t)0x00000800)
  2140. #define RCC_APB1LPENR_SPI2LPEN ((uint32_t)0x00004000)
  2141. #define RCC_APB1LPENR_USART2LPEN ((uint32_t)0x00020000)
  2142. #define RCC_APB1LPENR_I2C1LPEN ((uint32_t)0x00200000)
  2143. #define RCC_APB1LPENR_I2C2LPEN ((uint32_t)0x00400000)
  2144. #define RCC_APB1LPENR_FMPI2C1LPEN ((uint32_t)0x01000000)
  2145. #define RCC_APB1LPENR_PWRLPEN ((uint32_t)0x10000000)
  2146. #define RCC_APB1LPENR_DACLPEN ((uint32_t)0x20000000)
  2147. /******************** Bit definition for RCC_APB2LPENR register *************/
  2148. #define RCC_APB2LPENR_TIM1LPEN ((uint32_t)0x00000001)
  2149. #define RCC_APB2LPENR_USART1LPEN ((uint32_t)0x00000010)
  2150. #define RCC_APB2LPENR_USART6LPEN ((uint32_t)0x00000020)
  2151. #define RCC_APB2LPENR_ADC1LPEN ((uint32_t)0x00000100)
  2152. #define RCC_APB2LPENR_SPI1LPEN ((uint32_t)0x00001000)
  2153. #define RCC_APB2LPENR_SYSCFGLPEN ((uint32_t)0x00004000)
  2154. #define RCC_APB2LPENR_EXTITLPEN ((uint32_t)0x00008000)
  2155. #define RCC_APB2LPENR_TIM9LPEN ((uint32_t)0x00010000)
  2156. #define RCC_APB2LPENR_TIM11LPEN ((uint32_t)0x00040000)
  2157. #define RCC_APB2LPENR_SPI5LPEN ((uint32_t)0x00100000)
  2158. /******************** Bit definition for RCC_BDCR register ******************/
  2159. #define RCC_BDCR_LSEON ((uint32_t)0x00000001)
  2160. #define RCC_BDCR_LSERDY ((uint32_t)0x00000002)
  2161. #define RCC_BDCR_LSEBYP ((uint32_t)0x00000004)
  2162. #define RCC_BDCR_LSEMOD ((uint32_t)0x00000008)
  2163. #define RCC_BDCR_RTCSEL ((uint32_t)0x00000300)
  2164. #define RCC_BDCR_RTCSEL_0 ((uint32_t)0x00000100)
  2165. #define RCC_BDCR_RTCSEL_1 ((uint32_t)0x00000200)
  2166. #define RCC_BDCR_RTCEN ((uint32_t)0x00008000)
  2167. #define RCC_BDCR_BDRST ((uint32_t)0x00010000)
  2168. /******************** Bit definition for RCC_CSR register *******************/
  2169. #define RCC_CSR_LSION ((uint32_t)0x00000001)
  2170. #define RCC_CSR_LSIRDY ((uint32_t)0x00000002)
  2171. #define RCC_CSR_RMVF ((uint32_t)0x01000000)
  2172. #define RCC_CSR_BORRSTF ((uint32_t)0x02000000)
  2173. #define RCC_CSR_PADRSTF ((uint32_t)0x04000000)
  2174. #define RCC_CSR_PORRSTF ((uint32_t)0x08000000)
  2175. #define RCC_CSR_SFTRSTF ((uint32_t)0x10000000)
  2176. #define RCC_CSR_WDGRSTF ((uint32_t)0x20000000)
  2177. #define RCC_CSR_WWDGRSTF ((uint32_t)0x40000000)
  2178. #define RCC_CSR_LPWRRSTF ((uint32_t)0x80000000)
  2179. /******************** Bit definition for RCC_SSCGR register *****************/
  2180. #define RCC_SSCGR_MODPER ((uint32_t)0x00001FFF)
  2181. #define RCC_SSCGR_INCSTEP ((uint32_t)0x0FFFE000)
  2182. #define RCC_SSCGR_SPREADSEL ((uint32_t)0x40000000)
  2183. #define RCC_SSCGR_SSCGEN ((uint32_t)0x80000000)
  2184. /******************** Bit definition for RCC_DCKCFGR register ***************/
  2185. #define RCC_DCKCFGR_TIMPRE ((uint32_t)0x01000000)
  2186. #define RCC_DCKCFGR_I2SSRC ((uint32_t)0x06000000)
  2187. #define RCC_DCKCFGR_I2SSRC_0 ((uint32_t)0x02000000)
  2188. #define RCC_DCKCFGR_I2SSRC_1 ((uint32_t)0x04000000)
  2189. /******************** Bit definition for RCC_CKGATENR register **************/
  2190. #define RCC_CKGATENR_AHB2APB1_CKEN ((uint32_t)0x00000001)
  2191. #define RCC_CKGATENR_AHB2APB2_CKEN ((uint32_t)0x00000002)
  2192. #define RCC_CKGATENR_CM4DBG_CKEN ((uint32_t)0x00000004)
  2193. #define RCC_CKGATENR_SPARE_CKEN ((uint32_t)0x00000008)
  2194. #define RCC_CKGATENR_SRAM_CKEN ((uint32_t)0x00000010)
  2195. #define RCC_CKGATENR_FLITF_CKEN ((uint32_t)0x00000020)
  2196. #define RCC_CKGATENR_RCC_CKEN ((uint32_t)0x00000040)
  2197. /******************** Bit definition for RCC_DCKCFGR2 register **************/
  2198. #define RCC_DCKCFGR2_FMPI2C1SEL ((uint32_t)0x00C00000)
  2199. #define RCC_DCKCFGR2_FMPI2C1SEL_0 ((uint32_t)0x00400000)
  2200. #define RCC_DCKCFGR2_FMPI2C1SEL_1 ((uint32_t)0x00800000)
  2201. #define RCC_DCKCFGR2_LPTIM1SEL ((uint32_t)0xC0000000)
  2202. #define RCC_DCKCFGR2_LPTIM1SEL_0 ((uint32_t)0x40000000)
  2203. #define RCC_DCKCFGR2_LPTIM1SEL_1 ((uint32_t)0x80000000)
  2204. /******************************************************************************/
  2205. /* */
  2206. /* RNG */
  2207. /* */
  2208. /******************************************************************************/
  2209. /******************** Bits definition for RNG_CR register *******************/
  2210. #define RNG_CR_RNGEN ((uint32_t)0x00000004)
  2211. #define RNG_CR_IE ((uint32_t)0x00000008)
  2212. /******************** Bits definition for RNG_SR register *******************/
  2213. #define RNG_SR_DRDY ((uint32_t)0x00000001)
  2214. #define RNG_SR_CECS ((uint32_t)0x00000002)
  2215. #define RNG_SR_SECS ((uint32_t)0x00000004)
  2216. #define RNG_SR_CEIS ((uint32_t)0x00000020)
  2217. #define RNG_SR_SEIS ((uint32_t)0x00000040)
  2218. /******************************************************************************/
  2219. /* */
  2220. /* Real-Time Clock (RTC) */
  2221. /* */
  2222. /******************************************************************************/
  2223. /******************** Bits definition for RTC_TR register *******************/
  2224. #define RTC_TR_PM ((uint32_t)0x00400000)
  2225. #define RTC_TR_HT ((uint32_t)0x00300000)
  2226. #define RTC_TR_HT_0 ((uint32_t)0x00100000)
  2227. #define RTC_TR_HT_1 ((uint32_t)0x00200000)
  2228. #define RTC_TR_HU ((uint32_t)0x000F0000)
  2229. #define RTC_TR_HU_0 ((uint32_t)0x00010000)
  2230. #define RTC_TR_HU_1 ((uint32_t)0x00020000)
  2231. #define RTC_TR_HU_2 ((uint32_t)0x00040000)
  2232. #define RTC_TR_HU_3 ((uint32_t)0x00080000)
  2233. #define RTC_TR_MNT ((uint32_t)0x00007000)
  2234. #define RTC_TR_MNT_0 ((uint32_t)0x00001000)
  2235. #define RTC_TR_MNT_1 ((uint32_t)0x00002000)
  2236. #define RTC_TR_MNT_2 ((uint32_t)0x00004000)
  2237. #define RTC_TR_MNU ((uint32_t)0x00000F00)
  2238. #define RTC_TR_MNU_0 ((uint32_t)0x00000100)
  2239. #define RTC_TR_MNU_1 ((uint32_t)0x00000200)
  2240. #define RTC_TR_MNU_2 ((uint32_t)0x00000400)
  2241. #define RTC_TR_MNU_3 ((uint32_t)0x00000800)
  2242. #define RTC_TR_ST ((uint32_t)0x00000070)
  2243. #define RTC_TR_ST_0 ((uint32_t)0x00000010)
  2244. #define RTC_TR_ST_1 ((uint32_t)0x00000020)
  2245. #define RTC_TR_ST_2 ((uint32_t)0x00000040)
  2246. #define RTC_TR_SU ((uint32_t)0x0000000F)
  2247. #define RTC_TR_SU_0 ((uint32_t)0x00000001)
  2248. #define RTC_TR_SU_1 ((uint32_t)0x00000002)
  2249. #define RTC_TR_SU_2 ((uint32_t)0x00000004)
  2250. #define RTC_TR_SU_3 ((uint32_t)0x00000008)
  2251. /******************** Bits definition for RTC_DR register *******************/
  2252. #define RTC_DR_YT ((uint32_t)0x00F00000)
  2253. #define RTC_DR_YT_0 ((uint32_t)0x00100000)
  2254. #define RTC_DR_YT_1 ((uint32_t)0x00200000)
  2255. #define RTC_DR_YT_2 ((uint32_t)0x00400000)
  2256. #define RTC_DR_YT_3 ((uint32_t)0x00800000)
  2257. #define RTC_DR_YU ((uint32_t)0x000F0000)
  2258. #define RTC_DR_YU_0 ((uint32_t)0x00010000)
  2259. #define RTC_DR_YU_1 ((uint32_t)0x00020000)
  2260. #define RTC_DR_YU_2 ((uint32_t)0x00040000)
  2261. #define RTC_DR_YU_3 ((uint32_t)0x00080000)
  2262. #define RTC_DR_WDU ((uint32_t)0x0000E000)
  2263. #define RTC_DR_WDU_0 ((uint32_t)0x00002000)
  2264. #define RTC_DR_WDU_1 ((uint32_t)0x00004000)
  2265. #define RTC_DR_WDU_2 ((uint32_t)0x00008000)
  2266. #define RTC_DR_MT ((uint32_t)0x00001000)
  2267. #define RTC_DR_MU ((uint32_t)0x00000F00)
  2268. #define RTC_DR_MU_0 ((uint32_t)0x00000100)
  2269. #define RTC_DR_MU_1 ((uint32_t)0x00000200)
  2270. #define RTC_DR_MU_2 ((uint32_t)0x00000400)
  2271. #define RTC_DR_MU_3 ((uint32_t)0x00000800)
  2272. #define RTC_DR_DT ((uint32_t)0x00000030)
  2273. #define RTC_DR_DT_0 ((uint32_t)0x00000010)
  2274. #define RTC_DR_DT_1 ((uint32_t)0x00000020)
  2275. #define RTC_DR_DU ((uint32_t)0x0000000F)
  2276. #define RTC_DR_DU_0 ((uint32_t)0x00000001)
  2277. #define RTC_DR_DU_1 ((uint32_t)0x00000002)
  2278. #define RTC_DR_DU_2 ((uint32_t)0x00000004)
  2279. #define RTC_DR_DU_3 ((uint32_t)0x00000008)
  2280. /******************** Bits definition for RTC_CR register *******************/
  2281. #define RTC_CR_COE ((uint32_t)0x00800000)
  2282. #define RTC_CR_OSEL ((uint32_t)0x00600000)
  2283. #define RTC_CR_OSEL_0 ((uint32_t)0x00200000)
  2284. #define RTC_CR_OSEL_1 ((uint32_t)0x00400000)
  2285. #define RTC_CR_POL ((uint32_t)0x00100000)
  2286. #define RTC_CR_COSEL ((uint32_t)0x00080000)
  2287. #define RTC_CR_BCK ((uint32_t)0x00040000)
  2288. #define RTC_CR_SUB1H ((uint32_t)0x00020000)
  2289. #define RTC_CR_ADD1H ((uint32_t)0x00010000)
  2290. #define RTC_CR_TSIE ((uint32_t)0x00008000)
  2291. #define RTC_CR_WUTIE ((uint32_t)0x00004000)
  2292. #define RTC_CR_ALRBIE ((uint32_t)0x00002000)
  2293. #define RTC_CR_ALRAIE ((uint32_t)0x00001000)
  2294. #define RTC_CR_TSE ((uint32_t)0x00000800)
  2295. #define RTC_CR_WUTE ((uint32_t)0x00000400)
  2296. #define RTC_CR_ALRBE ((uint32_t)0x00000200)
  2297. #define RTC_CR_ALRAE ((uint32_t)0x00000100)
  2298. #define RTC_CR_DCE ((uint32_t)0x00000080)
  2299. #define RTC_CR_FMT ((uint32_t)0x00000040)
  2300. #define RTC_CR_BYPSHAD ((uint32_t)0x00000020)
  2301. #define RTC_CR_REFCKON ((uint32_t)0x00000010)
  2302. #define RTC_CR_TSEDGE ((uint32_t)0x00000008)
  2303. #define RTC_CR_WUCKSEL ((uint32_t)0x00000007)
  2304. #define RTC_CR_WUCKSEL_0 ((uint32_t)0x00000001)
  2305. #define RTC_CR_WUCKSEL_1 ((uint32_t)0x00000002)
  2306. #define RTC_CR_WUCKSEL_2 ((uint32_t)0x00000004)
  2307. /******************** Bits definition for RTC_ISR register ******************/
  2308. #define RTC_ISR_RECALPF ((uint32_t)0x00010000)
  2309. #define RTC_ISR_TAMP1F ((uint32_t)0x00002000)
  2310. #define RTC_ISR_TAMP2F ((uint32_t)0x00004000)
  2311. #define RTC_ISR_TSOVF ((uint32_t)0x00001000)
  2312. #define RTC_ISR_TSF ((uint32_t)0x00000800)
  2313. #define RTC_ISR_WUTF ((uint32_t)0x00000400)
  2314. #define RTC_ISR_ALRBF ((uint32_t)0x00000200)
  2315. #define RTC_ISR_ALRAF ((uint32_t)0x00000100)
  2316. #define RTC_ISR_INIT ((uint32_t)0x00000080)
  2317. #define RTC_ISR_INITF ((uint32_t)0x00000040)
  2318. #define RTC_ISR_RSF ((uint32_t)0x00000020)
  2319. #define RTC_ISR_INITS ((uint32_t)0x00000010)
  2320. #define RTC_ISR_SHPF ((uint32_t)0x00000008)
  2321. #define RTC_ISR_WUTWF ((uint32_t)0x00000004)
  2322. #define RTC_ISR_ALRBWF ((uint32_t)0x00000002)
  2323. #define RTC_ISR_ALRAWF ((uint32_t)0x00000001)
  2324. /******************** Bits definition for RTC_PRER register *****************/
  2325. #define RTC_PRER_PREDIV_A ((uint32_t)0x007F0000)
  2326. #define RTC_PRER_PREDIV_S ((uint32_t)0x00007FFF)
  2327. /******************** Bits definition for RTC_WUTR register *****************/
  2328. #define RTC_WUTR_WUT ((uint32_t)0x0000FFFF)
  2329. /******************** Bits definition for RTC_CALIBR register ***************/
  2330. #define RTC_CALIBR_DCS ((uint32_t)0x00000080)
  2331. #define RTC_CALIBR_DC ((uint32_t)0x0000001F)
  2332. /******************** Bits definition for RTC_ALRMAR register ***************/
  2333. #define RTC_ALRMAR_MSK4 ((uint32_t)0x80000000)
  2334. #define RTC_ALRMAR_WDSEL ((uint32_t)0x40000000)
  2335. #define RTC_ALRMAR_DT ((uint32_t)0x30000000)
  2336. #define RTC_ALRMAR_DT_0 ((uint32_t)0x10000000)
  2337. #define RTC_ALRMAR_DT_1 ((uint32_t)0x20000000)
  2338. #define RTC_ALRMAR_DU ((uint32_t)0x0F000000)
  2339. #define RTC_ALRMAR_DU_0 ((uint32_t)0x01000000)
  2340. #define RTC_ALRMAR_DU_1 ((uint32_t)0x02000000)
  2341. #define RTC_ALRMAR_DU_2 ((uint32_t)0x04000000)
  2342. #define RTC_ALRMAR_DU_3 ((uint32_t)0x08000000)
  2343. #define RTC_ALRMAR_MSK3 ((uint32_t)0x00800000)
  2344. #define RTC_ALRMAR_PM ((uint32_t)0x00400000)
  2345. #define RTC_ALRMAR_HT ((uint32_t)0x00300000)
  2346. #define RTC_ALRMAR_HT_0 ((uint32_t)0x00100000)
  2347. #define RTC_ALRMAR_HT_1 ((uint32_t)0x00200000)
  2348. #define RTC_ALRMAR_HU ((uint32_t)0x000F0000)
  2349. #define RTC_ALRMAR_HU_0 ((uint32_t)0x00010000)
  2350. #define RTC_ALRMAR_HU_1 ((uint32_t)0x00020000)
  2351. #define RTC_ALRMAR_HU_2 ((uint32_t)0x00040000)
  2352. #define RTC_ALRMAR_HU_3 ((uint32_t)0x00080000)
  2353. #define RTC_ALRMAR_MSK2 ((uint32_t)0x00008000)
  2354. #define RTC_ALRMAR_MNT ((uint32_t)0x00007000)
  2355. #define RTC_ALRMAR_MNT_0 ((uint32_t)0x00001000)
  2356. #define RTC_ALRMAR_MNT_1 ((uint32_t)0x00002000)
  2357. #define RTC_ALRMAR_MNT_2 ((uint32_t)0x00004000)
  2358. #define RTC_ALRMAR_MNU ((uint32_t)0x00000F00)
  2359. #define RTC_ALRMAR_MNU_0 ((uint32_t)0x00000100)
  2360. #define RTC_ALRMAR_MNU_1 ((uint32_t)0x00000200)
  2361. #define RTC_ALRMAR_MNU_2 ((uint32_t)0x00000400)
  2362. #define RTC_ALRMAR_MNU_3 ((uint32_t)0x00000800)
  2363. #define RTC_ALRMAR_MSK1 ((uint32_t)0x00000080)
  2364. #define RTC_ALRMAR_ST ((uint32_t)0x00000070)
  2365. #define RTC_ALRMAR_ST_0 ((uint32_t)0x00000010)
  2366. #define RTC_ALRMAR_ST_1 ((uint32_t)0x00000020)
  2367. #define RTC_ALRMAR_ST_2 ((uint32_t)0x00000040)
  2368. #define RTC_ALRMAR_SU ((uint32_t)0x0000000F)
  2369. #define RTC_ALRMAR_SU_0 ((uint32_t)0x00000001)
  2370. #define RTC_ALRMAR_SU_1 ((uint32_t)0x00000002)
  2371. #define RTC_ALRMAR_SU_2 ((uint32_t)0x00000004)
  2372. #define RTC_ALRMAR_SU_3 ((uint32_t)0x00000008)
  2373. /******************** Bits definition for RTC_ALRMBR register ***************/
  2374. #define RTC_ALRMBR_MSK4 ((uint32_t)0x80000000)
  2375. #define RTC_ALRMBR_WDSEL ((uint32_t)0x40000000)
  2376. #define RTC_ALRMBR_DT ((uint32_t)0x30000000)
  2377. #define RTC_ALRMBR_DT_0 ((uint32_t)0x10000000)
  2378. #define RTC_ALRMBR_DT_1 ((uint32_t)0x20000000)
  2379. #define RTC_ALRMBR_DU ((uint32_t)0x0F000000)
  2380. #define RTC_ALRMBR_DU_0 ((uint32_t)0x01000000)
  2381. #define RTC_ALRMBR_DU_1 ((uint32_t)0x02000000)
  2382. #define RTC_ALRMBR_DU_2 ((uint32_t)0x04000000)
  2383. #define RTC_ALRMBR_DU_3 ((uint32_t)0x08000000)
  2384. #define RTC_ALRMBR_MSK3 ((uint32_t)0x00800000)
  2385. #define RTC_ALRMBR_PM ((uint32_t)0x00400000)
  2386. #define RTC_ALRMBR_HT ((uint32_t)0x00300000)
  2387. #define RTC_ALRMBR_HT_0 ((uint32_t)0x00100000)
  2388. #define RTC_ALRMBR_HT_1 ((uint32_t)0x00200000)
  2389. #define RTC_ALRMBR_HU ((uint32_t)0x000F0000)
  2390. #define RTC_ALRMBR_HU_0 ((uint32_t)0x00010000)
  2391. #define RTC_ALRMBR_HU_1 ((uint32_t)0x00020000)
  2392. #define RTC_ALRMBR_HU_2 ((uint32_t)0x00040000)
  2393. #define RTC_ALRMBR_HU_3 ((uint32_t)0x00080000)
  2394. #define RTC_ALRMBR_MSK2 ((uint32_t)0x00008000)
  2395. #define RTC_ALRMBR_MNT ((uint32_t)0x00007000)
  2396. #define RTC_ALRMBR_MNT_0 ((uint32_t)0x00001000)
  2397. #define RTC_ALRMBR_MNT_1 ((uint32_t)0x00002000)
  2398. #define RTC_ALRMBR_MNT_2 ((uint32_t)0x00004000)
  2399. #define RTC_ALRMBR_MNU ((uint32_t)0x00000F00)
  2400. #define RTC_ALRMBR_MNU_0 ((uint32_t)0x00000100)
  2401. #define RTC_ALRMBR_MNU_1 ((uint32_t)0x00000200)
  2402. #define RTC_ALRMBR_MNU_2 ((uint32_t)0x00000400)
  2403. #define RTC_ALRMBR_MNU_3 ((uint32_t)0x00000800)
  2404. #define RTC_ALRMBR_MSK1 ((uint32_t)0x00000080)
  2405. #define RTC_ALRMBR_ST ((uint32_t)0x00000070)
  2406. #define RTC_ALRMBR_ST_0 ((uint32_t)0x00000010)
  2407. #define RTC_ALRMBR_ST_1 ((uint32_t)0x00000020)
  2408. #define RTC_ALRMBR_ST_2 ((uint32_t)0x00000040)
  2409. #define RTC_ALRMBR_SU ((uint32_t)0x0000000F)
  2410. #define RTC_ALRMBR_SU_0 ((uint32_t)0x00000001)
  2411. #define RTC_ALRMBR_SU_1 ((uint32_t)0x00000002)
  2412. #define RTC_ALRMBR_SU_2 ((uint32_t)0x00000004)
  2413. #define RTC_ALRMBR_SU_3 ((uint32_t)0x00000008)
  2414. /******************** Bits definition for RTC_WPR register ******************/
  2415. #define RTC_WPR_KEY ((uint32_t)0x000000FF)
  2416. /******************** Bits definition for RTC_SSR register ******************/
  2417. #define RTC_SSR_SS ((uint32_t)0x0000FFFF)
  2418. /******************** Bits definition for RTC_SHIFTR register ***************/
  2419. #define RTC_SHIFTR_SUBFS ((uint32_t)0x00007FFF)
  2420. #define RTC_SHIFTR_ADD1S ((uint32_t)0x80000000)
  2421. /******************** Bits definition for RTC_TSTR register *****************/
  2422. #define RTC_TSTR_PM ((uint32_t)0x00400000)
  2423. #define RTC_TSTR_HT ((uint32_t)0x00300000)
  2424. #define RTC_TSTR_HT_0 ((uint32_t)0x00100000)
  2425. #define RTC_TSTR_HT_1 ((uint32_t)0x00200000)
  2426. #define RTC_TSTR_HU ((uint32_t)0x000F0000)
  2427. #define RTC_TSTR_HU_0 ((uint32_t)0x00010000)
  2428. #define RTC_TSTR_HU_1 ((uint32_t)0x00020000)
  2429. #define RTC_TSTR_HU_2 ((uint32_t)0x00040000)
  2430. #define RTC_TSTR_HU_3 ((uint32_t)0x00080000)
  2431. #define RTC_TSTR_MNT ((uint32_t)0x00007000)
  2432. #define RTC_TSTR_MNT_0 ((uint32_t)0x00001000)
  2433. #define RTC_TSTR_MNT_1 ((uint32_t)0x00002000)
  2434. #define RTC_TSTR_MNT_2 ((uint32_t)0x00004000)
  2435. #define RTC_TSTR_MNU ((uint32_t)0x00000F00)
  2436. #define RTC_TSTR_MNU_0 ((uint32_t)0x00000100)
  2437. #define RTC_TSTR_MNU_1 ((uint32_t)0x00000200)
  2438. #define RTC_TSTR_MNU_2 ((uint32_t)0x00000400)
  2439. #define RTC_TSTR_MNU_3 ((uint32_t)0x00000800)
  2440. #define RTC_TSTR_ST ((uint32_t)0x00000070)
  2441. #define RTC_TSTR_ST_0 ((uint32_t)0x00000010)
  2442. #define RTC_TSTR_ST_1 ((uint32_t)0x00000020)
  2443. #define RTC_TSTR_ST_2 ((uint32_t)0x00000040)
  2444. #define RTC_TSTR_SU ((uint32_t)0x0000000F)
  2445. #define RTC_TSTR_SU_0 ((uint32_t)0x00000001)
  2446. #define RTC_TSTR_SU_1 ((uint32_t)0x00000002)
  2447. #define RTC_TSTR_SU_2 ((uint32_t)0x00000004)
  2448. #define RTC_TSTR_SU_3 ((uint32_t)0x00000008)
  2449. /******************** Bits definition for RTC_TSDR register *****************/
  2450. #define RTC_TSDR_WDU ((uint32_t)0x0000E000)
  2451. #define RTC_TSDR_WDU_0 ((uint32_t)0x00002000)
  2452. #define RTC_TSDR_WDU_1 ((uint32_t)0x00004000)
  2453. #define RTC_TSDR_WDU_2 ((uint32_t)0x00008000)
  2454. #define RTC_TSDR_MT ((uint32_t)0x00001000)
  2455. #define RTC_TSDR_MU ((uint32_t)0x00000F00)
  2456. #define RTC_TSDR_MU_0 ((uint32_t)0x00000100)
  2457. #define RTC_TSDR_MU_1 ((uint32_t)0x00000200)
  2458. #define RTC_TSDR_MU_2 ((uint32_t)0x00000400)
  2459. #define RTC_TSDR_MU_3 ((uint32_t)0x00000800)
  2460. #define RTC_TSDR_DT ((uint32_t)0x00000030)
  2461. #define RTC_TSDR_DT_0 ((uint32_t)0x00000010)
  2462. #define RTC_TSDR_DT_1 ((uint32_t)0x00000020)
  2463. #define RTC_TSDR_DU ((uint32_t)0x0000000F)
  2464. #define RTC_TSDR_DU_0 ((uint32_t)0x00000001)
  2465. #define RTC_TSDR_DU_1 ((uint32_t)0x00000002)
  2466. #define RTC_TSDR_DU_2 ((uint32_t)0x00000004)
  2467. #define RTC_TSDR_DU_3 ((uint32_t)0x00000008)
  2468. /******************** Bits definition for RTC_TSSSR register ****************/
  2469. #define RTC_TSSSR_SS ((uint32_t)0x0000FFFF)
  2470. /******************** Bits definition for RTC_CAL register *****************/
  2471. #define RTC_CALR_CALP ((uint32_t)0x00008000)
  2472. #define RTC_CALR_CALW8 ((uint32_t)0x00004000)
  2473. #define RTC_CALR_CALW16 ((uint32_t)0x00002000)
  2474. #define RTC_CALR_CALM ((uint32_t)0x000001FF)
  2475. #define RTC_CALR_CALM_0 ((uint32_t)0x00000001)
  2476. #define RTC_CALR_CALM_1 ((uint32_t)0x00000002)
  2477. #define RTC_CALR_CALM_2 ((uint32_t)0x00000004)
  2478. #define RTC_CALR_CALM_3 ((uint32_t)0x00000008)
  2479. #define RTC_CALR_CALM_4 ((uint32_t)0x00000010)
  2480. #define RTC_CALR_CALM_5 ((uint32_t)0x00000020)
  2481. #define RTC_CALR_CALM_6 ((uint32_t)0x00000040)
  2482. #define RTC_CALR_CALM_7 ((uint32_t)0x00000080)
  2483. #define RTC_CALR_CALM_8 ((uint32_t)0x00000100)
  2484. /******************** Bits definition for RTC_TAFCR register ****************/
  2485. #define RTC_TAFCR_ALARMOUTTYPE ((uint32_t)0x00040000)
  2486. #define RTC_TAFCR_TSINSEL ((uint32_t)0x00020000)
  2487. #define RTC_TAFCR_TAMPINSEL ((uint32_t)0x00010000)
  2488. #define RTC_TAFCR_TAMPPUDIS ((uint32_t)0x00008000)
  2489. #define RTC_TAFCR_TAMPPRCH ((uint32_t)0x00006000)
  2490. #define RTC_TAFCR_TAMPPRCH_0 ((uint32_t)0x00002000)
  2491. #define RTC_TAFCR_TAMPPRCH_1 ((uint32_t)0x00004000)
  2492. #define RTC_TAFCR_TAMPFLT ((uint32_t)0x00001800)
  2493. #define RTC_TAFCR_TAMPFLT_0 ((uint32_t)0x00000800)
  2494. #define RTC_TAFCR_TAMPFLT_1 ((uint32_t)0x00001000)
  2495. #define RTC_TAFCR_TAMPFREQ ((uint32_t)0x00000700)
  2496. #define RTC_TAFCR_TAMPFREQ_0 ((uint32_t)0x00000100)
  2497. #define RTC_TAFCR_TAMPFREQ_1 ((uint32_t)0x00000200)
  2498. #define RTC_TAFCR_TAMPFREQ_2 ((uint32_t)0x00000400)
  2499. #define RTC_TAFCR_TAMPTS ((uint32_t)0x00000080)
  2500. #define RTC_TAFCR_TAMP2TRG ((uint32_t)0x00000010)
  2501. #define RTC_TAFCR_TAMP2E ((uint32_t)0x00000008)
  2502. #define RTC_TAFCR_TAMPIE ((uint32_t)0x00000004)
  2503. #define RTC_TAFCR_TAMP1TRG ((uint32_t)0x00000002)
  2504. #define RTC_TAFCR_TAMP1E ((uint32_t)0x00000001)
  2505. /******************** Bits definition for RTC_ALRMASSR register *************/
  2506. #define RTC_ALRMASSR_MASKSS ((uint32_t)0x0F000000)
  2507. #define RTC_ALRMASSR_MASKSS_0 ((uint32_t)0x01000000)
  2508. #define RTC_ALRMASSR_MASKSS_1 ((uint32_t)0x02000000)
  2509. #define RTC_ALRMASSR_MASKSS_2 ((uint32_t)0x04000000)
  2510. #define RTC_ALRMASSR_MASKSS_3 ((uint32_t)0x08000000)
  2511. #define RTC_ALRMASSR_SS ((uint32_t)0x00007FFF)
  2512. /******************** Bits definition for RTC_ALRMBSSR register *************/
  2513. #define RTC_ALRMBSSR_MASKSS ((uint32_t)0x0F000000)
  2514. #define RTC_ALRMBSSR_MASKSS_0 ((uint32_t)0x01000000)
  2515. #define RTC_ALRMBSSR_MASKSS_1 ((uint32_t)0x02000000)
  2516. #define RTC_ALRMBSSR_MASKSS_2 ((uint32_t)0x04000000)
  2517. #define RTC_ALRMBSSR_MASKSS_3 ((uint32_t)0x08000000)
  2518. #define RTC_ALRMBSSR_SS ((uint32_t)0x00007FFF)
  2519. /******************** Bits definition for RTC_BKP0R register ****************/
  2520. #define RTC_BKP0R ((uint32_t)0xFFFFFFFF)
  2521. /******************** Bits definition for RTC_BKP1R register ****************/
  2522. #define RTC_BKP1R ((uint32_t)0xFFFFFFFF)
  2523. /******************** Bits definition for RTC_BKP2R register ****************/
  2524. #define RTC_BKP2R ((uint32_t)0xFFFFFFFF)
  2525. /******************** Bits definition for RTC_BKP3R register ****************/
  2526. #define RTC_BKP3R ((uint32_t)0xFFFFFFFF)
  2527. /******************** Bits definition for RTC_BKP4R register ****************/
  2528. #define RTC_BKP4R ((uint32_t)0xFFFFFFFF)
  2529. /******************** Bits definition for RTC_BKP5R register ****************/
  2530. #define RTC_BKP5R ((uint32_t)0xFFFFFFFF)
  2531. /******************** Bits definition for RTC_BKP6R register ****************/
  2532. #define RTC_BKP6R ((uint32_t)0xFFFFFFFF)
  2533. /******************** Bits definition for RTC_BKP7R register ****************/
  2534. #define RTC_BKP7R ((uint32_t)0xFFFFFFFF)
  2535. /******************** Bits definition for RTC_BKP8R register ****************/
  2536. #define RTC_BKP8R ((uint32_t)0xFFFFFFFF)
  2537. /******************** Bits definition for RTC_BKP9R register ****************/
  2538. #define RTC_BKP9R ((uint32_t)0xFFFFFFFF)
  2539. /******************** Bits definition for RTC_BKP10R register ***************/
  2540. #define RTC_BKP10R ((uint32_t)0xFFFFFFFF)
  2541. /******************** Bits definition for RTC_BKP11R register ***************/
  2542. #define RTC_BKP11R ((uint32_t)0xFFFFFFFF)
  2543. /******************** Bits definition for RTC_BKP12R register ***************/
  2544. #define RTC_BKP12R ((uint32_t)0xFFFFFFFF)
  2545. /******************** Bits definition for RTC_BKP13R register ***************/
  2546. #define RTC_BKP13R ((uint32_t)0xFFFFFFFF)
  2547. /******************** Bits definition for RTC_BKP14R register ***************/
  2548. #define RTC_BKP14R ((uint32_t)0xFFFFFFFF)
  2549. /******************** Bits definition for RTC_BKP15R register ***************/
  2550. #define RTC_BKP15R ((uint32_t)0xFFFFFFFF)
  2551. /******************** Bits definition for RTC_BKP16R register ***************/
  2552. #define RTC_BKP16R ((uint32_t)0xFFFFFFFF)
  2553. /******************** Bits definition for RTC_BKP17R register ***************/
  2554. #define RTC_BKP17R ((uint32_t)0xFFFFFFFF)
  2555. /******************** Bits definition for RTC_BKP18R register ***************/
  2556. #define RTC_BKP18R ((uint32_t)0xFFFFFFFF)
  2557. /******************** Bits definition for RTC_BKP19R register ***************/
  2558. #define RTC_BKP19R ((uint32_t)0xFFFFFFFF)
  2559. /******************************************************************************/
  2560. /* */
  2561. /* Serial Peripheral Interface */
  2562. /* */
  2563. /******************************************************************************/
  2564. /******************* Bit definition for SPI_CR1 register ********************/
  2565. #define SPI_CR1_CPHA ((uint32_t)0x00000001) /*!<Clock Phase */
  2566. #define SPI_CR1_CPOL ((uint32_t)0x00000002) /*!<Clock Polarity */
  2567. #define SPI_CR1_MSTR ((uint32_t)0x00000004) /*!<Master Selection */
  2568. #define SPI_CR1_BR ((uint32_t)0x00000038) /*!<BR[2:0] bits (Baud Rate Control) */
  2569. #define SPI_CR1_BR_0 ((uint32_t)0x00000008) /*!<Bit 0 */
  2570. #define SPI_CR1_BR_1 ((uint32_t)0x00000010) /*!<Bit 1 */
  2571. #define SPI_CR1_BR_2 ((uint32_t)0x00000020) /*!<Bit 2 */
  2572. #define SPI_CR1_SPE ((uint32_t)0x00000040) /*!<SPI Enable */
  2573. #define SPI_CR1_LSBFIRST ((uint32_t)0x00000080) /*!<Frame Format */
  2574. #define SPI_CR1_SSI ((uint32_t)0x00000100) /*!<Internal slave select */
  2575. #define SPI_CR1_SSM ((uint32_t)0x00000200) /*!<Software slave management */
  2576. #define SPI_CR1_RXONLY ((uint32_t)0x00000400) /*!<Receive only */
  2577. #define SPI_CR1_DFF ((uint32_t)0x00000800) /*!<Data Frame Format */
  2578. #define SPI_CR1_CRCNEXT ((uint32_t)0x00001000) /*!<Transmit CRC next */
  2579. #define SPI_CR1_CRCEN ((uint32_t)0x00002000) /*!<Hardware CRC calculation enable */
  2580. #define SPI_CR1_BIDIOE ((uint32_t)0x00004000) /*!<Output enable in bidirectional mode */
  2581. #define SPI_CR1_BIDIMODE ((uint32_t)0x00008000) /*!<Bidirectional data mode enable */
  2582. /******************* Bit definition for SPI_CR2 register ********************/
  2583. #define SPI_CR2_RXDMAEN ((uint32_t)0x00000001) /*!<Rx Buffer DMA Enable */
  2584. #define SPI_CR2_TXDMAEN ((uint32_t)0x00000002) /*!<Tx Buffer DMA Enable */
  2585. #define SPI_CR2_SSOE ((uint32_t)0x00000004) /*!<SS Output Enable */
  2586. #define SPI_CR2_FRF ((uint32_t)0x00000010) /*!<Frame Format */
  2587. #define SPI_CR2_ERRIE ((uint32_t)0x00000020) /*!<Error Interrupt Enable */
  2588. #define SPI_CR2_RXNEIE ((uint32_t)0x00000040) /*!<RX buffer Not Empty Interrupt Enable */
  2589. #define SPI_CR2_TXEIE ((uint32_t)0x00000080) /*!<Tx buffer Empty Interrupt Enable */
  2590. /******************** Bit definition for SPI_SR register ********************/
  2591. #define SPI_SR_RXNE ((uint32_t)0x00000001) /*!<Receive buffer Not Empty */
  2592. #define SPI_SR_TXE ((uint32_t)0x00000002) /*!<Transmit buffer Empty */
  2593. #define SPI_SR_CHSIDE ((uint32_t)0x00000004) /*!<Channel side */
  2594. #define SPI_SR_UDR ((uint32_t)0x00000008) /*!<Underrun flag */
  2595. #define SPI_SR_CRCERR ((uint32_t)0x00000010) /*!<CRC Error flag */
  2596. #define SPI_SR_MODF ((uint32_t)0x00000020) /*!<Mode fault */
  2597. #define SPI_SR_OVR ((uint32_t)0x00000040) /*!<Overrun flag */
  2598. #define SPI_SR_BSY ((uint32_t)0x00000080) /*!<Busy flag */
  2599. #define SPI_SR_FRE ((uint32_t)0x00000100) /*!<Frame format error flag */
  2600. /******************** Bit definition for SPI_DR register ********************/
  2601. #define SPI_DR_DR ((uint32_t)0x0000FFFF) /*!<Data Register */
  2602. /******************* Bit definition for SPI_CRCPR register ******************/
  2603. #define SPI_CRCPR_CRCPOLY ((uint32_t)0x0000FFFF) /*!<CRC polynomial register */
  2604. /****************** Bit definition for SPI_RXCRCR register ******************/
  2605. #define SPI_RXCRCR_RXCRC ((uint32_t)0x0000FFFF) /*!<Rx CRC Register */
  2606. /****************** Bit definition for SPI_TXCRCR register ******************/
  2607. #define SPI_TXCRCR_TXCRC ((uint32_t)0x0000FFFF) /*!<Tx CRC Register */
  2608. /****************** Bit definition for SPI_I2SCFGR register *****************/
  2609. #define SPI_I2SCFGR_CHLEN ((uint32_t)0x00000001) /*!<Channel length (number of bits per audio channel) */
  2610. #define SPI_I2SCFGR_DATLEN ((uint32_t)0x00000006) /*!<DATLEN[1:0] bits (Data length to be transferred) */
  2611. #define SPI_I2SCFGR_DATLEN_0 ((uint32_t)0x00000002) /*!<Bit 0 */
  2612. #define SPI_I2SCFGR_DATLEN_1 ((uint32_t)0x00000004) /*!<Bit 1 */
  2613. #define SPI_I2SCFGR_CKPOL ((uint32_t)0x00000008) /*!<steady state clock polarity */
  2614. #define SPI_I2SCFGR_I2SSTD ((uint32_t)0x00000030) /*!<I2SSTD[1:0] bits (I2S standard selection) */
  2615. #define SPI_I2SCFGR_I2SSTD_0 ((uint32_t)0x00000010) /*!<Bit 0 */
  2616. #define SPI_I2SCFGR_I2SSTD_1 ((uint32_t)0x00000020) /*!<Bit 1 */
  2617. #define SPI_I2SCFGR_PCMSYNC ((uint32_t)0x00000080) /*!<PCM frame synchronization */
  2618. #define SPI_I2SCFGR_I2SCFG ((uint32_t)0x00000300) /*!<I2SCFG[1:0] bits (I2S configuration mode) */
  2619. #define SPI_I2SCFGR_I2SCFG_0 ((uint32_t)0x00000100) /*!<Bit 0 */
  2620. #define SPI_I2SCFGR_I2SCFG_1 ((uint32_t)0x00000200) /*!<Bit 1 */
  2621. #define SPI_I2SCFGR_I2SE ((uint32_t)0x00000400) /*!<I2S Enable */
  2622. #define SPI_I2SCFGR_I2SMOD ((uint32_t)0x00000800) /*!<I2S mode selection */
  2623. /****************** Bit definition for SPI_I2SPR register *******************/
  2624. #define SPI_I2SPR_I2SDIV ((uint32_t)0x000000FF) /*!<I2S Linear prescaler */
  2625. #define SPI_I2SPR_ODD ((uint32_t)0x00000100) /*!<Odd factor for the prescaler */
  2626. #define SPI_I2SPR_MCKOE ((uint32_t)0x00000200) /*!<Master Clock Output Enable */
  2627. /******************************************************************************/
  2628. /* */
  2629. /* SYSCFG */
  2630. /* */
  2631. /******************************************************************************/
  2632. /****************** Bit definition for SYSCFG_MEMRMP register ***************/
  2633. #define SYSCFG_MEMRMP_MEM_MODE ((uint32_t)0x00000007) /*!< SYSCFG_Memory Remap Config */
  2634. #define SYSCFG_MEMRMP_MEM_MODE_0 ((uint32_t)0x00000001)
  2635. #define SYSCFG_MEMRMP_MEM_MODE_1 ((uint32_t)0x00000002)
  2636. #define SYSCFG_MEMRMP_MEM_MODE_2 ((uint32_t)0x00000004)
  2637. /****************** Bit definition for SYSCFG_PMC register ******************/
  2638. #define SYSCFG_PMC_ADC1DC2 ((uint32_t)0x00010000) /*!< Refer to AN4073 on how to use this bit */
  2639. /***************** Bit definition for SYSCFG_EXTICR1 register ***************/
  2640. #define SYSCFG_EXTICR1_EXTI0 ((uint32_t)0x000F) /*!<EXTI 0 configuration */
  2641. #define SYSCFG_EXTICR1_EXTI1 ((uint32_t)0x00F0) /*!<EXTI 1 configuration */
  2642. #define SYSCFG_EXTICR1_EXTI2 ((uint32_t)0x0F00) /*!<EXTI 2 configuration */
  2643. #define SYSCFG_EXTICR1_EXTI3 ((uint32_t)0xF000) /*!<EXTI 3 configuration */
  2644. /**
  2645. * @brief EXTI0 configuration
  2646. */
  2647. #define SYSCFG_EXTICR1_EXTI0_PA ((uint32_t)0x0000) /*!<PA[0] pin */
  2648. #define SYSCFG_EXTICR1_EXTI0_PB ((uint32_t)0x0001) /*!<PB[0] pin */
  2649. #define SYSCFG_EXTICR1_EXTI0_PC ((uint32_t)0x0002) /*!<PC[0] pin */
  2650. #define SYSCFG_EXTICR1_EXTI0_PH ((uint32_t)0x0007) /*!<PH[0] pin */
  2651. /**
  2652. * @brief EXTI1 configuration
  2653. */
  2654. #define SYSCFG_EXTICR1_EXTI1_PA ((uint32_t)0x0000) /*!<PA[1] pin */
  2655. #define SYSCFG_EXTICR1_EXTI1_PB ((uint32_t)0x0010) /*!<PB[1] pin */
  2656. #define SYSCFG_EXTICR1_EXTI1_PC ((uint32_t)0x0020) /*!<PC[1] pin */
  2657. #define SYSCFG_EXTICR1_EXTI1_PH ((uint32_t)0x0070) /*!<PH[1] pin */
  2658. /**
  2659. * @brief EXTI2 configuration
  2660. */
  2661. #define SYSCFG_EXTICR1_EXTI2_PA ((uint32_t)0x0000) /*!<PA[2] pin */
  2662. #define SYSCFG_EXTICR1_EXTI2_PB ((uint32_t)0x0100) /*!<PB[2] pin */
  2663. #define SYSCFG_EXTICR1_EXTI2_PC ((uint32_t)0x0200) /*!<PC[2] pin */
  2664. #define SYSCFG_EXTICR1_EXTI2_PH ((uint32_t)0x0700) /*!<PH[2] pin */
  2665. /**
  2666. * @brief EXTI3 configuration
  2667. */
  2668. #define SYSCFG_EXTICR1_EXTI3_PA ((uint32_t)0x0000) /*!<PA[3] pin */
  2669. #define SYSCFG_EXTICR1_EXTI3_PB ((uint32_t)0x1000) /*!<PB[3] pin */
  2670. #define SYSCFG_EXTICR1_EXTI3_PC ((uint32_t)0x2000) /*!<PC[3] pin */
  2671. #define SYSCFG_EXTICR1_EXTI3_PH ((uint32_t)0x7000) /*!<PH[3] pin */
  2672. /***************** Bit definition for SYSCFG_EXTICR2 register ***************/
  2673. #define SYSCFG_EXTICR2_EXTI4 ((uint32_t)0x000F) /*!<EXTI 4 configuration */
  2674. #define SYSCFG_EXTICR2_EXTI5 ((uint32_t)0x00F0) /*!<EXTI 5 configuration */
  2675. #define SYSCFG_EXTICR2_EXTI6 ((uint32_t)0x0F00) /*!<EXTI 6 configuration */
  2676. #define SYSCFG_EXTICR2_EXTI7 ((uint32_t)0xF000) /*!<EXTI 7 configuration */
  2677. /**
  2678. * @brief EXTI4 configuration
  2679. */
  2680. #define SYSCFG_EXTICR2_EXTI4_PA ((uint32_t)0x0000) /*!<PA[4] pin */
  2681. #define SYSCFG_EXTICR2_EXTI4_PB ((uint32_t)0x0001) /*!<PB[4] pin */
  2682. #define SYSCFG_EXTICR2_EXTI4_PC ((uint32_t)0x0002) /*!<PC[4] pin */
  2683. #define SYSCFG_EXTICR2_EXTI4_PH ((uint32_t)0x0007) /*!<PH[4] pin */
  2684. /**
  2685. * @brief EXTI5 configuration
  2686. */
  2687. #define SYSCFG_EXTICR2_EXTI5_PA ((uint32_t)0x0000) /*!<PA[5] pin */
  2688. #define SYSCFG_EXTICR2_EXTI5_PB ((uint32_t)0x0010) /*!<PB[5] pin */
  2689. #define SYSCFG_EXTICR2_EXTI5_PC ((uint32_t)0x0020) /*!<PC[5] pin */
  2690. #define SYSCFG_EXTICR2_EXTI5_PH ((uint32_t)0x0070) /*!<PH[5] pin */
  2691. /**
  2692. * @brief EXTI6 configuration
  2693. */
  2694. #define SYSCFG_EXTICR2_EXTI6_PA ((uint32_t)0x0000) /*!<PA[6] pin */
  2695. #define SYSCFG_EXTICR2_EXTI6_PB ((uint32_t)0x0100) /*!<PB[6] pin */
  2696. #define SYSCFG_EXTICR2_EXTI6_PC ((uint32_t)0x0200) /*!<PC[6] pin */
  2697. #define SYSCFG_EXTICR2_EXTI6_PH ((uint32_t)0x0700) /*!<PH[6] pin */
  2698. /**
  2699. * @brief EXTI7 configuration
  2700. */
  2701. #define SYSCFG_EXTICR2_EXTI7_PA ((uint32_t)0x0000) /*!<PA[7] pin */
  2702. #define SYSCFG_EXTICR2_EXTI7_PB ((uint32_t)0x1000) /*!<PB[7] pin */
  2703. #define SYSCFG_EXTICR2_EXTI7_PC ((uint32_t)0x2000) /*!<PC[7] pin */
  2704. #define SYSCFG_EXTICR2_EXTI7_PH ((uint32_t)0x7000) /*!<PH[7] pin */
  2705. /***************** Bit definition for SYSCFG_EXTICR3 register ***************/
  2706. #define SYSCFG_EXTICR3_EXTI8 ((uint32_t)0x000F) /*!<EXTI 8 configuration */
  2707. #define SYSCFG_EXTICR3_EXTI9 ((uint32_t)0x00F0) /*!<EXTI 9 configuration */
  2708. #define SYSCFG_EXTICR3_EXTI10 ((uint32_t)0x0F00) /*!<EXTI 10 configuration */
  2709. #define SYSCFG_EXTICR3_EXTI11 ((uint32_t)0xF000) /*!<EXTI 11 configuration */
  2710. /**
  2711. * @brief EXTI8 configuration
  2712. */
  2713. #define SYSCFG_EXTICR3_EXTI8_PA ((uint32_t)0x0000) /*!<PA[8] pin */
  2714. #define SYSCFG_EXTICR3_EXTI8_PB ((uint32_t)0x0001) /*!<PB[8] pin */
  2715. #define SYSCFG_EXTICR3_EXTI8_PC ((uint32_t)0x0002) /*!<PC[8] pin */
  2716. #define SYSCFG_EXTICR3_EXTI8_PH ((uint32_t)0x0007) /*!<PH[8] pin */
  2717. /**
  2718. * @brief EXTI9 configuration
  2719. */
  2720. #define SYSCFG_EXTICR3_EXTI9_PA ((uint32_t)0x0000) /*!<PA[9] pin */
  2721. #define SYSCFG_EXTICR3_EXTI9_PB ((uint32_t)0x0010) /*!<PB[9] pin */
  2722. #define SYSCFG_EXTICR3_EXTI9_PC ((uint32_t)0x0020) /*!<PC[9] pin */
  2723. #define SYSCFG_EXTICR3_EXTI9_PH ((uint32_t)0x0070) /*!<PH[9] pin */
  2724. /**
  2725. * @brief EXTI10 configuration
  2726. */
  2727. #define SYSCFG_EXTICR3_EXTI10_PA ((uint32_t)0x0000) /*!<PA[10] pin */
  2728. #define SYSCFG_EXTICR3_EXTI10_PB ((uint32_t)0x0100) /*!<PB[10] pin */
  2729. #define SYSCFG_EXTICR3_EXTI10_PC ((uint32_t)0x0200) /*!<PC[10] pin */
  2730. #define SYSCFG_EXTICR3_EXTI10_PH ((uint32_t)0x0700) /*!<PH[10] pin */
  2731. /**
  2732. * @brief EXTI11 configuration
  2733. */
  2734. #define SYSCFG_EXTICR3_EXTI11_PA ((uint32_t)0x0000) /*!<PA[11] pin */
  2735. #define SYSCFG_EXTICR3_EXTI11_PB ((uint32_t)0x1000) /*!<PB[11] pin */
  2736. #define SYSCFG_EXTICR3_EXTI11_PC ((uint32_t)0x2000) /*!<PC[11] pin */
  2737. #define SYSCFG_EXTICR3_EXTI11_PH ((uint32_t)0x7000) /*!<PH[11] pin */
  2738. /***************** Bit definition for SYSCFG_EXTICR4 register ***************/
  2739. #define SYSCFG_EXTICR4_EXTI12 ((uint32_t)0x000F) /*!<EXTI 12 configuration */
  2740. #define SYSCFG_EXTICR4_EXTI13 ((uint32_t)0x00F0) /*!<EXTI 13 configuration */
  2741. #define SYSCFG_EXTICR4_EXTI14 ((uint32_t)0x0F00) /*!<EXTI 14 configuration */
  2742. #define SYSCFG_EXTICR4_EXTI15 ((uint32_t)0xF000) /*!<EXTI 15 configuration */
  2743. /**
  2744. * @brief EXTI12 configuration
  2745. */
  2746. #define SYSCFG_EXTICR4_EXTI12_PA ((uint32_t)0x0000) /*!<PA[12] pin */
  2747. #define SYSCFG_EXTICR4_EXTI12_PB ((uint32_t)0x0001) /*!<PB[12] pin */
  2748. #define SYSCFG_EXTICR4_EXTI12_PC ((uint32_t)0x0002) /*!<PC[12] pin */
  2749. #define SYSCFG_EXTICR4_EXTI12_PH ((uint32_t)0x0007) /*!<PH[12] pin */
  2750. /**
  2751. * @brief EXTI13 configuration
  2752. */
  2753. #define SYSCFG_EXTICR4_EXTI13_PA ((uint32_t)0x0000) /*!<PA[13] pin */
  2754. #define SYSCFG_EXTICR4_EXTI13_PB ((uint32_t)0x0010) /*!<PB[13] pin */
  2755. #define SYSCFG_EXTICR4_EXTI13_PC ((uint32_t)0x0020) /*!<PC[13] pin */
  2756. #define SYSCFG_EXTICR4_EXTI13_PH ((uint32_t)0x0070) /*!<PH[13] pin */
  2757. /**
  2758. * @brief EXTI14 configuration
  2759. */
  2760. #define SYSCFG_EXTICR4_EXTI14_PA ((uint32_t)0x0000) /*!<PA[14] pin */
  2761. #define SYSCFG_EXTICR4_EXTI14_PB ((uint32_t)0x0100) /*!<PB[14] pin */
  2762. #define SYSCFG_EXTICR4_EXTI14_PC ((uint32_t)0x0200) /*!<PC[14] pin */
  2763. #define SYSCFG_EXTICR4_EXTI14_PH ((uint32_t)0x0700) /*!<PH[14] pin */
  2764. /**
  2765. * @brief EXTI15 configuration
  2766. */
  2767. #define SYSCFG_EXTICR4_EXTI15_PA ((uint32_t)0x0000) /*!<PA[15] pin */
  2768. #define SYSCFG_EXTICR4_EXTI15_PB ((uint32_t)0x1000) /*!<PB[15] pin */
  2769. #define SYSCFG_EXTICR4_EXTI15_PC ((uint32_t)0x2000) /*!<PC[15] pin */
  2770. #define SYSCFG_EXTICR4_EXTI15_PH ((uint32_t)0x7000) /*!<PH[15] pin */
  2771. /****************** Bit definition for SYSCFG_CMPCR register ****************/
  2772. #define SYSCFG_CMPCR_CMP_PD ((uint32_t)0x00000001) /*!<Compensation cell ready flag */
  2773. #define SYSCFG_CMPCR_READY ((uint32_t)0x00000100) /*!<Compensation cell power-down */
  2774. /****************** Bit definition for SYSCFG_CFGR register *****************/
  2775. #define SYSCFG_CFGR_FMPI2C1_SCL ((uint32_t)0x00000001) /*!<FM+ drive capability for FMPI2C1_SCL pin */
  2776. #define SYSCFG_CFGR_FMPI2C1_SDA ((uint32_t)0x00000002) /*!<FM+ drive capability for FMPI2C1_SDA pin */
  2777. /****************** Bit definition for SYSCFG_CFGR2 register *****************/
  2778. #define SYSCFG_CFGR2_LOCKUP_LOCK ((uint32_t)0x00000001) /*!<Core Lockup lock */
  2779. #define SYSCFG_CFGR2_PVD_LOCK ((uint32_t)0x00000004) /*!<PVD Lock */
  2780. /******************************************************************************/
  2781. /* */
  2782. /* TIM */
  2783. /* */
  2784. /******************************************************************************/
  2785. /******************* Bit definition for TIM_CR1 register ********************/
  2786. #define TIM_CR1_CEN ((uint32_t)0x0001) /*!<Counter enable */
  2787. #define TIM_CR1_UDIS ((uint32_t)0x0002) /*!<Update disable */
  2788. #define TIM_CR1_URS ((uint32_t)0x0004) /*!<Update request source */
  2789. #define TIM_CR1_OPM ((uint32_t)0x0008) /*!<One pulse mode */
  2790. #define TIM_CR1_DIR ((uint32_t)0x0010) /*!<Direction */
  2791. #define TIM_CR1_CMS ((uint32_t)0x0060) /*!<CMS[1:0] bits (Center-aligned mode selection) */
  2792. #define TIM_CR1_CMS_0 ((uint32_t)0x0020) /*!<Bit 0 */
  2793. #define TIM_CR1_CMS_1 ((uint32_t)0x0040) /*!<Bit 1 */
  2794. #define TIM_CR1_ARPE ((uint32_t)0x0080) /*!<Auto-reload preload enable */
  2795. #define TIM_CR1_CKD ((uint32_t)0x0300) /*!<CKD[1:0] bits (clock division) */
  2796. #define TIM_CR1_CKD_0 ((uint32_t)0x0100) /*!<Bit 0 */
  2797. #define TIM_CR1_CKD_1 ((uint32_t)0x0200) /*!<Bit 1 */
  2798. /******************* Bit definition for TIM_CR2 register ********************/
  2799. #define TIM_CR2_CCPC ((uint32_t)0x0001) /*!<Capture/Compare Preloaded Control */
  2800. #define TIM_CR2_CCUS ((uint32_t)0x0004) /*!<Capture/Compare Control Update Selection */
  2801. #define TIM_CR2_CCDS ((uint32_t)0x0008) /*!<Capture/Compare DMA Selection */
  2802. #define TIM_CR2_MMS ((uint32_t)0x0070) /*!<MMS[2:0] bits (Master Mode Selection) */
  2803. #define TIM_CR2_MMS_0 ((uint32_t)0x0010) /*!<Bit 0 */
  2804. #define TIM_CR2_MMS_1 ((uint32_t)0x0020) /*!<Bit 1 */
  2805. #define TIM_CR2_MMS_2 ((uint32_t)0x0040) /*!<Bit 2 */
  2806. #define TIM_CR2_TI1S ((uint32_t)0x0080) /*!<TI1 Selection */
  2807. #define TIM_CR2_OIS1 ((uint32_t)0x0100) /*!<Output Idle state 1 (OC1 output) */
  2808. #define TIM_CR2_OIS1N ((uint32_t)0x0200) /*!<Output Idle state 1 (OC1N output) */
  2809. #define TIM_CR2_OIS2 ((uint32_t)0x0400) /*!<Output Idle state 2 (OC2 output) */
  2810. #define TIM_CR2_OIS2N ((uint32_t)0x0800) /*!<Output Idle state 2 (OC2N output) */
  2811. #define TIM_CR2_OIS3 ((uint32_t)0x1000) /*!<Output Idle state 3 (OC3 output) */
  2812. #define TIM_CR2_OIS3N ((uint32_t)0x2000) /*!<Output Idle state 3 (OC3N output) */
  2813. #define TIM_CR2_OIS4 ((uint32_t)0x4000) /*!<Output Idle state 4 (OC4 output) */
  2814. /******************* Bit definition for TIM_SMCR register *******************/
  2815. #define TIM_SMCR_SMS ((uint32_t)0x0007) /*!<SMS[2:0] bits (Slave mode selection) */
  2816. #define TIM_SMCR_SMS_0 ((uint32_t)0x0001) /*!<Bit 0 */
  2817. #define TIM_SMCR_SMS_1 ((uint32_t)0x0002) /*!<Bit 1 */
  2818. #define TIM_SMCR_SMS_2 ((uint32_t)0x0004) /*!<Bit 2 */
  2819. #define TIM_SMCR_TS ((uint32_t)0x0070) /*!<TS[2:0] bits (Trigger selection) */
  2820. #define TIM_SMCR_TS_0 ((uint32_t)0x0010) /*!<Bit 0 */
  2821. #define TIM_SMCR_TS_1 ((uint32_t)0x0020) /*!<Bit 1 */
  2822. #define TIM_SMCR_TS_2 ((uint32_t)0x0040) /*!<Bit 2 */
  2823. #define TIM_SMCR_MSM ((uint32_t)0x0080) /*!<Master/slave mode */
  2824. #define TIM_SMCR_ETF ((uint32_t)0x0F00) /*!<ETF[3:0] bits (External trigger filter) */
  2825. #define TIM_SMCR_ETF_0 ((uint32_t)0x0100) /*!<Bit 0 */
  2826. #define TIM_SMCR_ETF_1 ((uint32_t)0x0200) /*!<Bit 1 */
  2827. #define TIM_SMCR_ETF_2 ((uint32_t)0x0400) /*!<Bit 2 */
  2828. #define TIM_SMCR_ETF_3 ((uint32_t)0x0800) /*!<Bit 3 */
  2829. #define TIM_SMCR_ETPS ((uint32_t)0x3000) /*!<ETPS[1:0] bits (External trigger prescaler) */
  2830. #define TIM_SMCR_ETPS_0 ((uint32_t)0x1000) /*!<Bit 0 */
  2831. #define TIM_SMCR_ETPS_1 ((uint32_t)0x2000) /*!<Bit 1 */
  2832. #define TIM_SMCR_ECE ((uint32_t)0x4000) /*!<External clock enable */
  2833. #define TIM_SMCR_ETP ((uint32_t)0x8000) /*!<External trigger polarity */
  2834. /******************* Bit definition for TIM_DIER register *******************/
  2835. #define TIM_DIER_UIE ((uint32_t)0x0001) /*!<Update interrupt enable */
  2836. #define TIM_DIER_CC1IE ((uint32_t)0x0002) /*!<Capture/Compare 1 interrupt enable */
  2837. #define TIM_DIER_CC2IE ((uint32_t)0x0004) /*!<Capture/Compare 2 interrupt enable */
  2838. #define TIM_DIER_CC3IE ((uint32_t)0x0008) /*!<Capture/Compare 3 interrupt enable */
  2839. #define TIM_DIER_CC4IE ((uint32_t)0x0010) /*!<Capture/Compare 4 interrupt enable */
  2840. #define TIM_DIER_COMIE ((uint32_t)0x0020) /*!<COM interrupt enable */
  2841. #define TIM_DIER_TIE ((uint32_t)0x0040) /*!<Trigger interrupt enable */
  2842. #define TIM_DIER_BIE ((uint32_t)0x0080) /*!<Break interrupt enable */
  2843. #define TIM_DIER_UDE ((uint32_t)0x0100) /*!<Update DMA request enable */
  2844. #define TIM_DIER_CC1DE ((uint32_t)0x0200) /*!<Capture/Compare 1 DMA request enable */
  2845. #define TIM_DIER_CC2DE ((uint32_t)0x0400) /*!<Capture/Compare 2 DMA request enable */
  2846. #define TIM_DIER_CC3DE ((uint32_t)0x0800) /*!<Capture/Compare 3 DMA request enable */
  2847. #define TIM_DIER_CC4DE ((uint32_t)0x1000) /*!<Capture/Compare 4 DMA request enable */
  2848. #define TIM_DIER_COMDE ((uint32_t)0x2000) /*!<COM DMA request enable */
  2849. #define TIM_DIER_TDE ((uint32_t)0x4000) /*!<Trigger DMA request enable */
  2850. /******************** Bit definition for TIM_SR register ********************/
  2851. #define TIM_SR_UIF ((uint32_t)0x0001) /*!<Update interrupt Flag */
  2852. #define TIM_SR_CC1IF ((uint32_t)0x0002) /*!<Capture/Compare 1 interrupt Flag */
  2853. #define TIM_SR_CC2IF ((uint32_t)0x0004) /*!<Capture/Compare 2 interrupt Flag */
  2854. #define TIM_SR_CC3IF ((uint32_t)0x0008) /*!<Capture/Compare 3 interrupt Flag */
  2855. #define TIM_SR_CC4IF ((uint32_t)0x0010) /*!<Capture/Compare 4 interrupt Flag */
  2856. #define TIM_SR_COMIF ((uint32_t)0x0020) /*!<COM interrupt Flag */
  2857. #define TIM_SR_TIF ((uint32_t)0x0040) /*!<Trigger interrupt Flag */
  2858. #define TIM_SR_BIF ((uint32_t)0x0080) /*!<Break interrupt Flag */
  2859. #define TIM_SR_CC1OF ((uint32_t)0x0200) /*!<Capture/Compare 1 Overcapture Flag */
  2860. #define TIM_SR_CC2OF ((uint32_t)0x0400) /*!<Capture/Compare 2 Overcapture Flag */
  2861. #define TIM_SR_CC3OF ((uint32_t)0x0800) /*!<Capture/Compare 3 Overcapture Flag */
  2862. #define TIM_SR_CC4OF ((uint32_t)0x1000) /*!<Capture/Compare 4 Overcapture Flag */
  2863. /******************* Bit definition for TIM_EGR register ********************/
  2864. #define TIM_EGR_UG ((uint32_t)0x01) /*!<Update Generation */
  2865. #define TIM_EGR_CC1G ((uint32_t)0x02) /*!<Capture/Compare 1 Generation */
  2866. #define TIM_EGR_CC2G ((uint32_t)0x04) /*!<Capture/Compare 2 Generation */
  2867. #define TIM_EGR_CC3G ((uint32_t)0x08) /*!<Capture/Compare 3 Generation */
  2868. #define TIM_EGR_CC4G ((uint32_t)0x10) /*!<Capture/Compare 4 Generation */
  2869. #define TIM_EGR_COMG ((uint32_t)0x20) /*!<Capture/Compare Control Update Generation */
  2870. #define TIM_EGR_TG ((uint32_t)0x40) /*!<Trigger Generation */
  2871. #define TIM_EGR_BG ((uint32_t)0x80) /*!<Break Generation */
  2872. /****************** Bit definition for TIM_CCMR1 register *******************/
  2873. #define TIM_CCMR1_CC1S ((uint32_t)0x0003) /*!<CC1S[1:0] bits (Capture/Compare 1 Selection) */
  2874. #define TIM_CCMR1_CC1S_0 ((uint32_t)0x0001) /*!<Bit 0 */
  2875. #define TIM_CCMR1_CC1S_1 ((uint32_t)0x0002) /*!<Bit 1 */
  2876. #define TIM_CCMR1_OC1FE ((uint32_t)0x0004) /*!<Output Compare 1 Fast enable */
  2877. #define TIM_CCMR1_OC1PE ((uint32_t)0x0008) /*!<Output Compare 1 Preload enable */
  2878. #define TIM_CCMR1_OC1M ((uint32_t)0x0070) /*!<OC1M[2:0] bits (Output Compare 1 Mode) */
  2879. #define TIM_CCMR1_OC1M_0 ((uint32_t)0x0010) /*!<Bit 0 */
  2880. #define TIM_CCMR1_OC1M_1 ((uint32_t)0x0020) /*!<Bit 1 */
  2881. #define TIM_CCMR1_OC1M_2 ((uint32_t)0x0040) /*!<Bit 2 */
  2882. #define TIM_CCMR1_OC1CE ((uint32_t)0x0080) /*!<Output Compare 1Clear Enable */
  2883. #define TIM_CCMR1_CC2S ((uint32_t)0x0300) /*!<CC2S[1:0] bits (Capture/Compare 2 Selection) */
  2884. #define TIM_CCMR1_CC2S_0 ((uint32_t)0x0100) /*!<Bit 0 */
  2885. #define TIM_CCMR1_CC2S_1 ((uint32_t)0x0200) /*!<Bit 1 */
  2886. #define TIM_CCMR1_OC2FE ((uint32_t)0x0400) /*!<Output Compare 2 Fast enable */
  2887. #define TIM_CCMR1_OC2PE ((uint32_t)0x0800) /*!<Output Compare 2 Preload enable */
  2888. #define TIM_CCMR1_OC2M ((uint32_t)0x7000) /*!<OC2M[2:0] bits (Output Compare 2 Mode) */
  2889. #define TIM_CCMR1_OC2M_0 ((uint32_t)0x1000) /*!<Bit 0 */
  2890. #define TIM_CCMR1_OC2M_1 ((uint32_t)0x2000) /*!<Bit 1 */
  2891. #define TIM_CCMR1_OC2M_2 ((uint32_t)0x4000) /*!<Bit 2 */
  2892. #define TIM_CCMR1_OC2CE ((uint32_t)0x8000) /*!<Output Compare 2 Clear Enable */
  2893. /*----------------------------------------------------------------------------*/
  2894. #define TIM_CCMR1_IC1PSC ((uint32_t)0x000C) /*!<IC1PSC[1:0] bits (Input Capture 1 Prescaler) */
  2895. #define TIM_CCMR1_IC1PSC_0 ((uint32_t)0x0004) /*!<Bit 0 */
  2896. #define TIM_CCMR1_IC1PSC_1 ((uint32_t)0x0008) /*!<Bit 1 */
  2897. #define TIM_CCMR1_IC1F ((uint32_t)0x00F0) /*!<IC1F[3:0] bits (Input Capture 1 Filter) */
  2898. #define TIM_CCMR1_IC1F_0 ((uint32_t)0x0010) /*!<Bit 0 */
  2899. #define TIM_CCMR1_IC1F_1 ((uint32_t)0x0020) /*!<Bit 1 */
  2900. #define TIM_CCMR1_IC1F_2 ((uint32_t)0x0040) /*!<Bit 2 */
  2901. #define TIM_CCMR1_IC1F_3 ((uint32_t)0x0080) /*!<Bit 3 */
  2902. #define TIM_CCMR1_IC2PSC ((uint32_t)0x0C00) /*!<IC2PSC[1:0] bits (Input Capture 2 Prescaler) */
  2903. #define TIM_CCMR1_IC2PSC_0 ((uint32_t)0x0400) /*!<Bit 0 */
  2904. #define TIM_CCMR1_IC2PSC_1 ((uint32_t)0x0800) /*!<Bit 1 */
  2905. #define TIM_CCMR1_IC2F ((uint32_t)0xF000) /*!<IC2F[3:0] bits (Input Capture 2 Filter) */
  2906. #define TIM_CCMR1_IC2F_0 ((uint32_t)0x1000) /*!<Bit 0 */
  2907. #define TIM_CCMR1_IC2F_1 ((uint32_t)0x2000) /*!<Bit 1 */
  2908. #define TIM_CCMR1_IC2F_2 ((uint32_t)0x4000) /*!<Bit 2 */
  2909. #define TIM_CCMR1_IC2F_3 ((uint32_t)0x8000) /*!<Bit 3 */
  2910. /****************** Bit definition for TIM_CCMR2 register *******************/
  2911. #define TIM_CCMR2_CC3S ((uint32_t)0x0003) /*!<CC3S[1:0] bits (Capture/Compare 3 Selection) */
  2912. #define TIM_CCMR2_CC3S_0 ((uint32_t)0x0001) /*!<Bit 0 */
  2913. #define TIM_CCMR2_CC3S_1 ((uint32_t)0x0002) /*!<Bit 1 */
  2914. #define TIM_CCMR2_OC3FE ((uint32_t)0x0004) /*!<Output Compare 3 Fast enable */
  2915. #define TIM_CCMR2_OC3PE ((uint32_t)0x0008) /*!<Output Compare 3 Preload enable */
  2916. #define TIM_CCMR2_OC3M ((uint32_t)0x0070) /*!<OC3M[2:0] bits (Output Compare 3 Mode) */
  2917. #define TIM_CCMR2_OC3M_0 ((uint32_t)0x0010) /*!<Bit 0 */
  2918. #define TIM_CCMR2_OC3M_1 ((uint32_t)0x0020) /*!<Bit 1 */
  2919. #define TIM_CCMR2_OC3M_2 ((uint32_t)0x0040) /*!<Bit 2 */
  2920. #define TIM_CCMR2_OC3CE ((uint32_t)0x0080) /*!<Output Compare 3 Clear Enable */
  2921. #define TIM_CCMR2_CC4S ((uint32_t)0x0300) /*!<CC4S[1:0] bits (Capture/Compare 4 Selection) */
  2922. #define TIM_CCMR2_CC4S_0 ((uint32_t)0x0100) /*!<Bit 0 */
  2923. #define TIM_CCMR2_CC4S_1 ((uint32_t)0x0200) /*!<Bit 1 */
  2924. #define TIM_CCMR2_OC4FE ((uint32_t)0x0400) /*!<Output Compare 4 Fast enable */
  2925. #define TIM_CCMR2_OC4PE ((uint32_t)0x0800) /*!<Output Compare 4 Preload enable */
  2926. #define TIM_CCMR2_OC4M ((uint32_t)0x7000) /*!<OC4M[2:0] bits (Output Compare 4 Mode) */
  2927. #define TIM_CCMR2_OC4M_0 ((uint32_t)0x1000) /*!<Bit 0 */
  2928. #define TIM_CCMR2_OC4M_1 ((uint32_t)0x2000) /*!<Bit 1 */
  2929. #define TIM_CCMR2_OC4M_2 ((uint32_t)0x4000) /*!<Bit 2 */
  2930. #define TIM_CCMR2_OC4CE ((uint32_t)0x8000) /*!<Output Compare 4 Clear Enable */
  2931. /*----------------------------------------------------------------------------*/
  2932. #define TIM_CCMR2_IC3PSC ((uint32_t)0x000C) /*!<IC3PSC[1:0] bits (Input Capture 3 Prescaler) */
  2933. #define TIM_CCMR2_IC3PSC_0 ((uint32_t)0x0004) /*!<Bit 0 */
  2934. #define TIM_CCMR2_IC3PSC_1 ((uint32_t)0x0008) /*!<Bit 1 */
  2935. #define TIM_CCMR2_IC3F ((uint32_t)0x00F0) /*!<IC3F[3:0] bits (Input Capture 3 Filter) */
  2936. #define TIM_CCMR2_IC3F_0 ((uint32_t)0x0010) /*!<Bit 0 */
  2937. #define TIM_CCMR2_IC3F_1 ((uint32_t)0x0020) /*!<Bit 1 */
  2938. #define TIM_CCMR2_IC3F_2 ((uint32_t)0x0040) /*!<Bit 2 */
  2939. #define TIM_CCMR2_IC3F_3 ((uint32_t)0x0080) /*!<Bit 3 */
  2940. #define TIM_CCMR2_IC4PSC ((uint32_t)0x0C00) /*!<IC4PSC[1:0] bits (Input Capture 4 Prescaler) */
  2941. #define TIM_CCMR2_IC4PSC_0 ((uint32_t)0x0400) /*!<Bit 0 */
  2942. #define TIM_CCMR2_IC4PSC_1 ((uint32_t)0x0800) /*!<Bit 1 */
  2943. #define TIM_CCMR2_IC4F ((uint32_t)0xF000) /*!<IC4F[3:0] bits (Input Capture 4 Filter) */
  2944. #define TIM_CCMR2_IC4F_0 ((uint32_t)0x1000) /*!<Bit 0 */
  2945. #define TIM_CCMR2_IC4F_1 ((uint32_t)0x2000) /*!<Bit 1 */
  2946. #define TIM_CCMR2_IC4F_2 ((uint32_t)0x4000) /*!<Bit 2 */
  2947. #define TIM_CCMR2_IC4F_3 ((uint32_t)0x8000) /*!<Bit 3 */
  2948. /******************* Bit definition for TIM_CCER register *******************/
  2949. #define TIM_CCER_CC1E ((uint32_t)0x0001) /*!<Capture/Compare 1 output enable */
  2950. #define TIM_CCER_CC1P ((uint32_t)0x0002) /*!<Capture/Compare 1 output Polarity */
  2951. #define TIM_CCER_CC1NE ((uint32_t)0x0004) /*!<Capture/Compare 1 Complementary output enable */
  2952. #define TIM_CCER_CC1NP ((uint32_t)0x0008) /*!<Capture/Compare 1 Complementary output Polarity */
  2953. #define TIM_CCER_CC2E ((uint32_t)0x0010) /*!<Capture/Compare 2 output enable */
  2954. #define TIM_CCER_CC2P ((uint32_t)0x0020) /*!<Capture/Compare 2 output Polarity */
  2955. #define TIM_CCER_CC2NE ((uint32_t)0x0040) /*!<Capture/Compare 2 Complementary output enable */
  2956. #define TIM_CCER_CC2NP ((uint32_t)0x0080) /*!<Capture/Compare 2 Complementary output Polarity */
  2957. #define TIM_CCER_CC3E ((uint32_t)0x0100) /*!<Capture/Compare 3 output enable */
  2958. #define TIM_CCER_CC3P ((uint32_t)0x0200) /*!<Capture/Compare 3 output Polarity */
  2959. #define TIM_CCER_CC3NE ((uint32_t)0x0400) /*!<Capture/Compare 3 Complementary output enable */
  2960. #define TIM_CCER_CC3NP ((uint32_t)0x0800) /*!<Capture/Compare 3 Complementary output Polarity */
  2961. #define TIM_CCER_CC4E ((uint32_t)0x1000) /*!<Capture/Compare 4 output enable */
  2962. #define TIM_CCER_CC4P ((uint32_t)0x2000) /*!<Capture/Compare 4 output Polarity */
  2963. #define TIM_CCER_CC4NP ((uint32_t)0x8000) /*!<Capture/Compare 4 Complementary output Polarity */
  2964. /******************* Bit definition for TIM_CNT register ********************/
  2965. #define TIM_CNT_CNT ((uint32_t)0xFFFF) /*!<Counter Value */
  2966. /******************* Bit definition for TIM_PSC register ********************/
  2967. #define TIM_PSC_PSC ((uint32_t)0xFFFF) /*!<Prescaler Value */
  2968. /******************* Bit definition for TIM_ARR register ********************/
  2969. #define TIM_ARR_ARR ((uint32_t)0xFFFF) /*!<actual auto-reload Value */
  2970. /******************* Bit definition for TIM_RCR register ********************/
  2971. #define TIM_RCR_REP ((uint32_t)0xFF) /*!<Repetition Counter Value */
  2972. /******************* Bit definition for TIM_CCR1 register *******************/
  2973. #define TIM_CCR1_CCR1 ((uint32_t)0xFFFF) /*!<Capture/Compare 1 Value */
  2974. /******************* Bit definition for TIM_CCR2 register *******************/
  2975. #define TIM_CCR2_CCR2 ((uint32_t)0xFFFF) /*!<Capture/Compare 2 Value */
  2976. /******************* Bit definition for TIM_CCR3 register *******************/
  2977. #define TIM_CCR3_CCR3 ((uint32_t)0xFFFF) /*!<Capture/Compare 3 Value */
  2978. /******************* Bit definition for TIM_CCR4 register *******************/
  2979. #define TIM_CCR4_CCR4 ((uint32_t)0xFFFF) /*!<Capture/Compare 4 Value */
  2980. /******************* Bit definition for TIM_BDTR register *******************/
  2981. #define TIM_BDTR_DTG ((uint32_t)0x00FF) /*!<DTG[0:7] bits (Dead-Time Generator set-up) */
  2982. #define TIM_BDTR_DTG_0 ((uint32_t)0x0001) /*!<Bit 0 */
  2983. #define TIM_BDTR_DTG_1 ((uint32_t)0x0002) /*!<Bit 1 */
  2984. #define TIM_BDTR_DTG_2 ((uint32_t)0x0004) /*!<Bit 2 */
  2985. #define TIM_BDTR_DTG_3 ((uint32_t)0x0008) /*!<Bit 3 */
  2986. #define TIM_BDTR_DTG_4 ((uint32_t)0x0010) /*!<Bit 4 */
  2987. #define TIM_BDTR_DTG_5 ((uint32_t)0x0020) /*!<Bit 5 */
  2988. #define TIM_BDTR_DTG_6 ((uint32_t)0x0040) /*!<Bit 6 */
  2989. #define TIM_BDTR_DTG_7 ((uint32_t)0x0080) /*!<Bit 7 */
  2990. #define TIM_BDTR_LOCK ((uint32_t)0x0300) /*!<LOCK[1:0] bits (Lock Configuration) */
  2991. #define TIM_BDTR_LOCK_0 ((uint32_t)0x0100) /*!<Bit 0 */
  2992. #define TIM_BDTR_LOCK_1 ((uint32_t)0x0200) /*!<Bit 1 */
  2993. #define TIM_BDTR_OSSI ((uint32_t)0x0400) /*!<Off-State Selection for Idle mode */
  2994. #define TIM_BDTR_OSSR ((uint32_t)0x0800) /*!<Off-State Selection for Run mode */
  2995. #define TIM_BDTR_BKE ((uint32_t)0x1000) /*!<Break enable */
  2996. #define TIM_BDTR_BKP ((uint32_t)0x2000) /*!<Break Polarity */
  2997. #define TIM_BDTR_AOE ((uint32_t)0x4000) /*!<Automatic Output enable */
  2998. #define TIM_BDTR_MOE ((uint32_t)0x8000) /*!<Main Output enable */
  2999. /******************* Bit definition for TIM_DCR register ********************/
  3000. #define TIM_DCR_DBA ((uint32_t)0x001F) /*!<DBA[4:0] bits (DMA Base Address) */
  3001. #define TIM_DCR_DBA_0 ((uint32_t)0x0001) /*!<Bit 0 */
  3002. #define TIM_DCR_DBA_1 ((uint32_t)0x0002) /*!<Bit 1 */
  3003. #define TIM_DCR_DBA_2 ((uint32_t)0x0004) /*!<Bit 2 */
  3004. #define TIM_DCR_DBA_3 ((uint32_t)0x0008) /*!<Bit 3 */
  3005. #define TIM_DCR_DBA_4 ((uint32_t)0x0010) /*!<Bit 4 */
  3006. #define TIM_DCR_DBL ((uint32_t)0x1F00) /*!<DBL[4:0] bits (DMA Burst Length) */
  3007. #define TIM_DCR_DBL_0 ((uint32_t)0x0100) /*!<Bit 0 */
  3008. #define TIM_DCR_DBL_1 ((uint32_t)0x0200) /*!<Bit 1 */
  3009. #define TIM_DCR_DBL_2 ((uint32_t)0x0400) /*!<Bit 2 */
  3010. #define TIM_DCR_DBL_3 ((uint32_t)0x0800) /*!<Bit 3 */
  3011. #define TIM_DCR_DBL_4 ((uint32_t)0x1000) /*!<Bit 4 */
  3012. /******************* Bit definition for TIM_DMAR register *******************/
  3013. #define TIM_DMAR_DMAB ((uint32_t)0xFFFF) /*!<DMA register for burst accesses */
  3014. /******************* Bit definition for TIM_OR register *********************/
  3015. #define TIM_OR_TI4_RMP ((uint32_t)0x00C0) /*!<TI4_RMP[1:0] bits (TIM5 Input 4 remap) */
  3016. #define TIM_OR_TI4_RMP_0 ((uint32_t)0x0040) /*!<Bit 0 */
  3017. #define TIM_OR_TI4_RMP_1 ((uint32_t)0x0080) /*!<Bit 1 */
  3018. /******************************************************************************/
  3019. /* */
  3020. /* Low Power Timer (LPTIM) */
  3021. /* */
  3022. /******************************************************************************/
  3023. /****************** Bit definition for LPTIM_ISR register *******************/
  3024. #define LPTIM_ISR_CMPM ((uint32_t)0x00000001) /*!< Compare match */
  3025. #define LPTIM_ISR_ARRM ((uint32_t)0x00000002) /*!< Autoreload match */
  3026. #define LPTIM_ISR_EXTTRIG ((uint32_t)0x00000004) /*!< External trigger edge event */
  3027. #define LPTIM_ISR_CMPOK ((uint32_t)0x00000008) /*!< Compare register update OK */
  3028. #define LPTIM_ISR_ARROK ((uint32_t)0x00000010) /*!< Autoreload register update OK */
  3029. #define LPTIM_ISR_UP ((uint32_t)0x00000020) /*!< Counter direction change down to up */
  3030. #define LPTIM_ISR_DOWN ((uint32_t)0x00000040) /*!< Counter direction change up to down */
  3031. /****************** Bit definition for LPTIM_ICR register *******************/
  3032. #define LPTIM_ICR_CMPMCF ((uint32_t)0x00000001) /*!< Compare match Clear Flag */
  3033. #define LPTIM_ICR_ARRMCF ((uint32_t)0x00000002) /*!< Autoreload match Clear Flag */
  3034. #define LPTIM_ICR_EXTTRIGCF ((uint32_t)0x00000004) /*!< External trigger edge event Clear Flag */
  3035. #define LPTIM_ICR_CMPOKCF ((uint32_t)0x00000008) /*!< Compare register update OK Clear Flag */
  3036. #define LPTIM_ICR_ARROKCF ((uint32_t)0x00000010) /*!< Autoreload register update OK Clear Flag */
  3037. #define LPTIM_ICR_UPCF ((uint32_t)0x00000020) /*!< Counter direction change down to up Clear Flag */
  3038. #define LPTIM_ICR_DOWNCF ((uint32_t)0x00000040) /*!< Counter direction change up to down Clear Flag */
  3039. /****************** Bit definition for LPTIM_IER register ********************/
  3040. #define LPTIM_IER_CMPMIE ((uint32_t)0x00000001) /*!< Compare match Interrupt Enable */
  3041. #define LPTIM_IER_ARRMIE ((uint32_t)0x00000002) /*!< Autoreload match Interrupt Enable */
  3042. #define LPTIM_IER_EXTTRIGIE ((uint32_t)0x00000004) /*!< External trigger edge event Interrupt Enable */
  3043. #define LPTIM_IER_CMPOKIE ((uint32_t)0x00000008) /*!< Compare register update OK Interrupt Enable */
  3044. #define LPTIM_IER_ARROKIE ((uint32_t)0x00000010) /*!< Autoreload register update OK Interrupt Enable */
  3045. #define LPTIM_IER_UPIE ((uint32_t)0x00000020) /*!< Counter direction change down to up Interrupt Enable */
  3046. #define LPTIM_IER_DOWNIE ((uint32_t)0x00000040) /*!< Counter direction change up to down Interrupt Enable */
  3047. /****************** Bit definition for LPTIM_CFGR register *******************/
  3048. #define LPTIM_CFGR_CKSEL ((uint32_t)0x00000001) /*!< Clock selector */
  3049. #define LPTIM_CFGR_CKPOL ((uint32_t)0x00000006) /*!< CKPOL[1:0] bits (Clock polarity) */
  3050. #define LPTIM_CFGR_CKPOL_0 ((uint32_t)0x00000002) /*!< Bit 0 */
  3051. #define LPTIM_CFGR_CKPOL_1 ((uint32_t)0x00000004) /*!< Bit 1 */
  3052. #define LPTIM_CFGR_CKFLT ((uint32_t)0x00000018) /*!< CKFLT[1:0] bits (Configurable digital filter for external clock) */
  3053. #define LPTIM_CFGR_CKFLT_0 ((uint32_t)0x00000008) /*!< Bit 0 */
  3054. #define LPTIM_CFGR_CKFLT_1 ((uint32_t)0x00000010) /*!< Bit 1 */
  3055. #define LPTIM_CFGR_TRGFLT ((uint32_t)0x000000C0) /*!< TRGFLT[1:0] bits (Configurable digital filter for trigger) */
  3056. #define LPTIM_CFGR_TRGFLT_0 ((uint32_t)0x00000040) /*!< Bit 0 */
  3057. #define LPTIM_CFGR_TRGFLT_1 ((uint32_t)0x00000080) /*!< Bit 1 */
  3058. #define LPTIM_CFGR_PRESC ((uint32_t)0x00000E00) /*!< PRESC[2:0] bits (Clock prescaler) */
  3059. #define LPTIM_CFGR_PRESC_0 ((uint32_t)0x00000200) /*!< Bit 0 */
  3060. #define LPTIM_CFGR_PRESC_1 ((uint32_t)0x00000400) /*!< Bit 1 */
  3061. #define LPTIM_CFGR_PRESC_2 ((uint32_t)0x00000800) /*!< Bit 2 */
  3062. #define LPTIM_CFGR_TRIGSEL ((uint32_t)0x0000E000) /*!< TRIGSEL[2:0]] bits (Trigger selector) */
  3063. #define LPTIM_CFGR_TRIGSEL_0 ((uint32_t)0x00002000) /*!< Bit 0 */
  3064. #define LPTIM_CFGR_TRIGSEL_1 ((uint32_t)0x00004000) /*!< Bit 1 */
  3065. #define LPTIM_CFGR_TRIGSEL_2 ((uint32_t)0x00008000) /*!< Bit 2 */
  3066. #define LPTIM_CFGR_TRIGEN ((uint32_t)0x00060000) /*!< TRIGEN[1:0] bits (Trigger enable and polarity) */
  3067. #define LPTIM_CFGR_TRIGEN_0 ((uint32_t)0x00020000) /*!< Bit 0 */
  3068. #define LPTIM_CFGR_TRIGEN_1 ((uint32_t)0x00040000) /*!< Bit 1 */
  3069. #define LPTIM_CFGR_TIMOUT ((uint32_t)0x00080000) /*!< Timout enable */
  3070. #define LPTIM_CFGR_WAVE ((uint32_t)0x00100000) /*!< Waveform shape */
  3071. #define LPTIM_CFGR_WAVPOL ((uint32_t)0x00200000) /*!< Waveform shape polarity */
  3072. #define LPTIM_CFGR_PRELOAD ((uint32_t)0x00400000) /*!< Reg update mode */
  3073. #define LPTIM_CFGR_COUNTMODE ((uint32_t)0x00800000) /*!< Counter mode enable */
  3074. #define LPTIM_CFGR_ENC ((uint32_t)0x01000000) /*!< Encoder mode enable */
  3075. /****************** Bit definition for LPTIM_CR register ********************/
  3076. #define LPTIM_CR_ENABLE ((uint32_t)0x00000001) /*!< LPTIMer enable */
  3077. #define LPTIM_CR_SNGSTRT ((uint32_t)0x00080002) /*!< Timer start in single mode */
  3078. #define LPTIM_CR_CNTSTRT ((uint32_t)0x00000004) /*!< Timer start in continuous mode */
  3079. /****************** Bit definition for LPTIM_CMP register *******************/
  3080. #define LPTIM_CMP_CMP ((uint32_t)0x0000FFFF) /*!< Compare register */
  3081. /****************** Bit definition for LPTIM_ARR register *******************/
  3082. #define LPTIM_ARR_ARR ((uint32_t)0x0000FFFF) /*!< Auto reload register */
  3083. /****************** Bit definition for LPTIM_CNT register *******************/
  3084. #define LPTIM_CNT_CNT ((uint32_t)0x0000FFFF) /*!< Counter register */
  3085. /****************** Bit definition for LPTIM_OR register *******************/
  3086. #define LPTIM_OR_OR ((uint32_t)0x00000003) /*!< LPTIMER[1:0] bits (Remap selection) */
  3087. #define LPTIM_OR_OR_0 ((uint32_t)0x00000001) /*!< Bit 0 */
  3088. #define LPTIM_OR_OR_1 ((uint32_t)0x00000002) /*!< Bit 1 */
  3089. /******************************************************************************/
  3090. /* */
  3091. /* Universal Synchronous Asynchronous Receiver Transmitter */
  3092. /* */
  3093. /******************************************************************************/
  3094. /******************* Bit definition for USART_SR register *******************/
  3095. #define USART_SR_PE ((uint32_t)0x0001) /*!<Parity Error */
  3096. #define USART_SR_FE ((uint32_t)0x0002) /*!<Framing Error */
  3097. #define USART_SR_NE ((uint32_t)0x0004) /*!<Noise Error Flag */
  3098. #define USART_SR_ORE ((uint32_t)0x0008) /*!<OverRun Error */
  3099. #define USART_SR_IDLE ((uint32_t)0x0010) /*!<IDLE line detected */
  3100. #define USART_SR_RXNE ((uint32_t)0x0020) /*!<Read Data Register Not Empty */
  3101. #define USART_SR_TC ((uint32_t)0x0040) /*!<Transmission Complete */
  3102. #define USART_SR_TXE ((uint32_t)0x0080) /*!<Transmit Data Register Empty */
  3103. #define USART_SR_LBD ((uint32_t)0x0100) /*!<LIN Break Detection Flag */
  3104. #define USART_SR_CTS ((uint32_t)0x0200) /*!<CTS Flag */
  3105. /******************* Bit definition for USART_DR register *******************/
  3106. #define USART_DR_DR ((uint32_t)0x01FF) /*!<Data value */
  3107. /****************** Bit definition for USART_BRR register *******************/
  3108. #define USART_BRR_DIV_Fraction ((uint32_t)0x000F) /*!<Fraction of USARTDIV */
  3109. #define USART_BRR_DIV_Mantissa ((uint32_t)0xFFF0) /*!<Mantissa of USARTDIV */
  3110. /****************** Bit definition for USART_CR1 register *******************/
  3111. #define USART_CR1_SBK ((uint32_t)0x0001) /*!<Send Break */
  3112. #define USART_CR1_RWU ((uint32_t)0x0002) /*!<Receiver wakeup */
  3113. #define USART_CR1_RE ((uint32_t)0x0004) /*!<Receiver Enable */
  3114. #define USART_CR1_TE ((uint32_t)0x0008) /*!<Transmitter Enable */
  3115. #define USART_CR1_IDLEIE ((uint32_t)0x0010) /*!<IDLE Interrupt Enable */
  3116. #define USART_CR1_RXNEIE ((uint32_t)0x0020) /*!<RXNE Interrupt Enable */
  3117. #define USART_CR1_TCIE ((uint32_t)0x0040) /*!<Transmission Complete Interrupt Enable */
  3118. #define USART_CR1_TXEIE ((uint32_t)0x0080) /*!<PE Interrupt Enable */
  3119. #define USART_CR1_PEIE ((uint32_t)0x0100) /*!<PE Interrupt Enable */
  3120. #define USART_CR1_PS ((uint32_t)0x0200) /*!<Parity Selection */
  3121. #define USART_CR1_PCE ((uint32_t)0x0400) /*!<Parity Control Enable */
  3122. #define USART_CR1_WAKE ((uint32_t)0x0800) /*!<Wakeup method */
  3123. #define USART_CR1_M ((uint32_t)0x1000) /*!<Word length */
  3124. #define USART_CR1_UE ((uint32_t)0x2000) /*!<USART Enable */
  3125. #define USART_CR1_OVER8 ((uint32_t)0x8000) /*!<USART Oversampling by 8 enable */
  3126. /****************** Bit definition for USART_CR2 register *******************/
  3127. #define USART_CR2_ADD ((uint32_t)0x000F) /*!<Address of the USART node */
  3128. #define USART_CR2_LBDL ((uint32_t)0x0020) /*!<LIN Break Detection Length */
  3129. #define USART_CR2_LBDIE ((uint32_t)0x0040) /*!<LIN Break Detection Interrupt Enable */
  3130. #define USART_CR2_LBCL ((uint32_t)0x0100) /*!<Last Bit Clock pulse */
  3131. #define USART_CR2_CPHA ((uint32_t)0x0200) /*!<Clock Phase */
  3132. #define USART_CR2_CPOL ((uint32_t)0x0400) /*!<Clock Polarity */
  3133. #define USART_CR2_CLKEN ((uint32_t)0x0800) /*!<Clock Enable */
  3134. #define USART_CR2_STOP ((uint32_t)0x3000) /*!<STOP[1:0] bits (STOP bits) */
  3135. #define USART_CR2_STOP_0 ((uint32_t)0x1000) /*!<Bit 0 */
  3136. #define USART_CR2_STOP_1 ((uint32_t)0x2000) /*!<Bit 1 */
  3137. #define USART_CR2_LINEN ((uint32_t)0x4000) /*!<LIN mode enable */
  3138. /****************** Bit definition for USART_CR3 register *******************/
  3139. #define USART_CR3_EIE ((uint32_t)0x0001) /*!<Error Interrupt Enable */
  3140. #define USART_CR3_IREN ((uint32_t)0x0002) /*!<IrDA mode Enable */
  3141. #define USART_CR3_IRLP ((uint32_t)0x0004) /*!<IrDA Low-Power */
  3142. #define USART_CR3_HDSEL ((uint32_t)0x0008) /*!<Half-Duplex Selection */
  3143. #define USART_CR3_NACK ((uint32_t)0x0010) /*!<Smartcard NACK enable */
  3144. #define USART_CR3_SCEN ((uint32_t)0x0020) /*!<Smartcard mode enable */
  3145. #define USART_CR3_DMAR ((uint32_t)0x0040) /*!<DMA Enable Receiver */
  3146. #define USART_CR3_DMAT ((uint32_t)0x0080) /*!<DMA Enable Transmitter */
  3147. #define USART_CR3_RTSE ((uint32_t)0x0100) /*!<RTS Enable */
  3148. #define USART_CR3_CTSE ((uint32_t)0x0200) /*!<CTS Enable */
  3149. #define USART_CR3_CTSIE ((uint32_t)0x0400) /*!<CTS Interrupt Enable */
  3150. #define USART_CR3_ONEBIT ((uint32_t)0x0800) /*!<USART One bit method enable */
  3151. /****************** Bit definition for USART_GTPR register ******************/
  3152. #define USART_GTPR_PSC ((uint32_t)0x00FF) /*!<PSC[7:0] bits (Prescaler value) */
  3153. #define USART_GTPR_PSC_0 ((uint32_t)0x0001) /*!<Bit 0 */
  3154. #define USART_GTPR_PSC_1 ((uint32_t)0x0002) /*!<Bit 1 */
  3155. #define USART_GTPR_PSC_2 ((uint32_t)0x0004) /*!<Bit 2 */
  3156. #define USART_GTPR_PSC_3 ((uint32_t)0x0008) /*!<Bit 3 */
  3157. #define USART_GTPR_PSC_4 ((uint32_t)0x0010) /*!<Bit 4 */
  3158. #define USART_GTPR_PSC_5 ((uint32_t)0x0020) /*!<Bit 5 */
  3159. #define USART_GTPR_PSC_6 ((uint32_t)0x0040) /*!<Bit 6 */
  3160. #define USART_GTPR_PSC_7 ((uint32_t)0x0080) /*!<Bit 7 */
  3161. #define USART_GTPR_GT ((uint32_t)0xFF00) /*!<Guard time value */
  3162. /******************************************************************************/
  3163. /* */
  3164. /* Window WATCHDOG */
  3165. /* */
  3166. /******************************************************************************/
  3167. /******************* Bit definition for WWDG_CR register ********************/
  3168. #define WWDG_CR_T ((uint32_t)0x7F) /*!<T[6:0] bits (7-Bit counter (MSB to LSB)) */
  3169. #define WWDG_CR_T0 ((uint32_t)0x01) /*!<Bit 0 */
  3170. #define WWDG_CR_T1 ((uint32_t)0x02) /*!<Bit 1 */
  3171. #define WWDG_CR_T2 ((uint32_t)0x04) /*!<Bit 2 */
  3172. #define WWDG_CR_T3 ((uint32_t)0x08) /*!<Bit 3 */
  3173. #define WWDG_CR_T4 ((uint32_t)0x10) /*!<Bit 4 */
  3174. #define WWDG_CR_T5 ((uint32_t)0x20) /*!<Bit 5 */
  3175. #define WWDG_CR_T6 ((uint32_t)0x40) /*!<Bit 6 */
  3176. #define WWDG_CR_WDGA ((uint32_t)0x80) /*!<Activation bit */
  3177. /******************* Bit definition for WWDG_CFR register *******************/
  3178. #define WWDG_CFR_W ((uint32_t)0x007F) /*!<W[6:0] bits (7-bit window value) */
  3179. #define WWDG_CFR_W0 ((uint32_t)0x0001) /*!<Bit 0 */
  3180. #define WWDG_CFR_W1 ((uint32_t)0x0002) /*!<Bit 1 */
  3181. #define WWDG_CFR_W2 ((uint32_t)0x0004) /*!<Bit 2 */
  3182. #define WWDG_CFR_W3 ((uint32_t)0x0008) /*!<Bit 3 */
  3183. #define WWDG_CFR_W4 ((uint32_t)0x0010) /*!<Bit 4 */
  3184. #define WWDG_CFR_W5 ((uint32_t)0x0020) /*!<Bit 5 */
  3185. #define WWDG_CFR_W6 ((uint32_t)0x0040) /*!<Bit 6 */
  3186. #define WWDG_CFR_WDGTB ((uint32_t)0x0180) /*!<WDGTB[1:0] bits (Timer Base) */
  3187. #define WWDG_CFR_WDGTB0 ((uint32_t)0x0080) /*!<Bit 0 */
  3188. #define WWDG_CFR_WDGTB1 ((uint32_t)0x0100) /*!<Bit 1 */
  3189. #define WWDG_CFR_EWI ((uint32_t)0x0200) /*!<Early Wakeup Interrupt */
  3190. /******************* Bit definition for WWDG_SR register ********************/
  3191. #define WWDG_SR_EWIF ((uint32_t)0x01) /*!<Early Wakeup Interrupt Flag */
  3192. /******************************************************************************/
  3193. /* */
  3194. /* Digital to Analog Converter */
  3195. /* */
  3196. /******************************************************************************/
  3197. /******************** Bit definition for DAC_CR register ********************/
  3198. #define DAC_CR_EN1 ((uint32_t)0x00000001) /*!<DAC channel1 enable */
  3199. #define DAC_CR_BOFF1 ((uint32_t)0x00000002) /*!<DAC channel1 output buffer disable */
  3200. #define DAC_CR_TEN1 ((uint32_t)0x00000004) /*!<DAC channel1 Trigger enable */
  3201. #define DAC_CR_TSEL1 ((uint32_t)0x00000038) /*!<TSEL1[2:0] (DAC channel1 Trigger selection) */
  3202. #define DAC_CR_TSEL1_0 ((uint32_t)0x00000008) /*!<Bit 0 */
  3203. #define DAC_CR_TSEL1_1 ((uint32_t)0x00000010) /*!<Bit 1 */
  3204. #define DAC_CR_TSEL1_2 ((uint32_t)0x00000020) /*!<Bit 2 */
  3205. #define DAC_CR_WAVE1 ((uint32_t)0x000000C0) /*!<WAVE1[1:0] (DAC channel1 noise/triangle wave generation enable) */
  3206. #define DAC_CR_WAVE1_0 ((uint32_t)0x00000040) /*!<Bit 0 */
  3207. #define DAC_CR_WAVE1_1 ((uint32_t)0x00000080) /*!<Bit 1 */
  3208. #define DAC_CR_MAMP1 ((uint32_t)0x00000F00) /*!<MAMP1[3:0] (DAC channel1 Mask/Amplitude selector) */
  3209. #define DAC_CR_MAMP1_0 ((uint32_t)0x00000100) /*!<Bit 0 */
  3210. #define DAC_CR_MAMP1_1 ((uint32_t)0x00000200) /*!<Bit 1 */
  3211. #define DAC_CR_MAMP1_2 ((uint32_t)0x00000400) /*!<Bit 2 */
  3212. #define DAC_CR_MAMP1_3 ((uint32_t)0x00000800) /*!<Bit 3 */
  3213. #define DAC_CR_DMAEN1 ((uint32_t)0x00001000) /*!<DAC channel1 DMA enable */
  3214. #define DAC_CR_EN2 ((uint32_t)0x00010000) /*!<DAC channel2 enable */
  3215. #define DAC_CR_BOFF2 ((uint32_t)0x00020000) /*!<DAC channel2 output buffer disable */
  3216. #define DAC_CR_TEN2 ((uint32_t)0x00040000) /*!<DAC channel2 Trigger enable */
  3217. #define DAC_CR_TSEL2 ((uint32_t)0x00380000) /*!<TSEL2[2:0] (DAC channel2 Trigger selection) */
  3218. #define DAC_CR_TSEL2_0 ((uint32_t)0x00080000) /*!<Bit 0 */
  3219. #define DAC_CR_TSEL2_1 ((uint32_t)0x00100000) /*!<Bit 1 */
  3220. #define DAC_CR_TSEL2_2 ((uint32_t)0x00200000) /*!<Bit 2 */
  3221. #define DAC_CR_WAVE2 ((uint32_t)0x00C00000) /*!<WAVE2[1:0] (DAC channel2 noise/triangle wave generation enable) */
  3222. #define DAC_CR_WAVE2_0 ((uint32_t)0x00400000) /*!<Bit 0 */
  3223. #define DAC_CR_WAVE2_1 ((uint32_t)0x00800000) /*!<Bit 1 */
  3224. #define DAC_CR_MAMP2 ((uint32_t)0x0F000000) /*!<MAMP2[3:0] (DAC channel2 Mask/Amplitude selector) */
  3225. #define DAC_CR_MAMP2_0 ((uint32_t)0x01000000) /*!<Bit 0 */
  3226. #define DAC_CR_MAMP2_1 ((uint32_t)0x02000000) /*!<Bit 1 */
  3227. #define DAC_CR_MAMP2_2 ((uint32_t)0x04000000) /*!<Bit 2 */
  3228. #define DAC_CR_MAMP2_3 ((uint32_t)0x08000000) /*!<Bit 3 */
  3229. #define DAC_CR_DMAEN2 ((uint32_t)0x10000000) /*!<DAC channel2 DMA enabled */
  3230. /***************** Bit definition for DAC_SWTRIGR register ******************/
  3231. #define DAC_SWTRIGR_SWTRIG1 ((uint32_t)0x01) /*!<DAC channel1 software trigger */
  3232. #define DAC_SWTRIGR_SWTRIG2 ((uint32_t)0x02) /*!<DAC channel2 software trigger */
  3233. /***************** Bit definition for DAC_DHR12R1 register ******************/
  3234. #define DAC_DHR12R1_DACC1DHR ((uint32_t)0x0FFF) /*!<DAC channel1 12-bit Right aligned data */
  3235. /***************** Bit definition for DAC_DHR12L1 register ******************/
  3236. #define DAC_DHR12L1_DACC1DHR ((uint32_t)0xFFF0) /*!<DAC channel1 12-bit Left aligned data */
  3237. /****************** Bit definition for DAC_DHR8R1 register ******************/
  3238. #define DAC_DHR8R1_DACC1DHR ((uint32_t)0xFF) /*!<DAC channel1 8-bit Right aligned data */
  3239. /***************** Bit definition for DAC_DHR12R2 register ******************/
  3240. #define DAC_DHR12R2_DACC2DHR ((uint32_t)0x0FFF) /*!<DAC channel2 12-bit Right aligned data */
  3241. /***************** Bit definition for DAC_DHR12L2 register ******************/
  3242. #define DAC_DHR12L2_DACC2DHR ((uint32_t)0xFFF0) /*!<DAC channel2 12-bit Left aligned data */
  3243. /****************** Bit definition for DAC_DHR8R2 register ******************/
  3244. #define DAC_DHR8R2_DACC2DHR ((uint32_t)0xFF) /*!<DAC channel2 8-bit Right aligned data */
  3245. /***************** Bit definition for DAC_DHR12RD register ******************/
  3246. #define DAC_DHR12RD_DACC1DHR ((uint32_t)0x00000FFF) /*!<DAC channel1 12-bit Right aligned data */
  3247. #define DAC_DHR12RD_DACC2DHR ((uint32_t)0x0FFF0000) /*!<DAC channel2 12-bit Right aligned data */
  3248. /***************** Bit definition for DAC_DHR12LD register ******************/
  3249. #define DAC_DHR12LD_DACC1DHR ((uint32_t)0x0000FFF0) /*!<DAC channel1 12-bit Left aligned data */
  3250. #define DAC_DHR12LD_DACC2DHR ((uint32_t)0xFFF00000) /*!<DAC channel2 12-bit Left aligned data */
  3251. /****************** Bit definition for DAC_DHR8RD register ******************/
  3252. #define DAC_DHR8RD_DACC1DHR ((uint32_t)0x00FF) /*!<DAC channel1 8-bit Right aligned data */
  3253. #define DAC_DHR8RD_DACC2DHR ((uint32_t)0xFF00) /*!<DAC channel2 8-bit Right aligned data */
  3254. /******************* Bit definition for DAC_DOR1 register *******************/
  3255. #define DAC_DOR1_DACC1DOR ((uint32_t)0x0FFF) /*!<DAC channel1 data output */
  3256. /******************* Bit definition for DAC_DOR2 register *******************/
  3257. #define DAC_DOR2_DACC2DOR ((uint32_t)0x0FFF) /*!<DAC channel2 data output */
  3258. /******************** Bit definition for DAC_SR register ********************/
  3259. #define DAC_SR_DMAUDR1 ((uint32_t)0x00002000) /*!<DAC channel1 DMA underrun flag */
  3260. #define DAC_SR_DMAUDR2 ((uint32_t)0x20000000) /*!<DAC channel2 DMA underrun flag */
  3261. /******************************************************************************/
  3262. /* */
  3263. /* DBG */
  3264. /* */
  3265. /******************************************************************************/
  3266. /******************** Bit definition for DBGMCU_IDCODE register *************/
  3267. #define DBGMCU_IDCODE_DEV_ID ((uint32_t)0x00000FFF)
  3268. #define DBGMCU_IDCODE_REV_ID ((uint32_t)0xFFFF0000)
  3269. /******************** Bit definition for DBGMCU_CR register *****************/
  3270. #define DBGMCU_CR_DBG_SLEEP ((uint32_t)0x00000001)
  3271. #define DBGMCU_CR_DBG_STOP ((uint32_t)0x00000002)
  3272. #define DBGMCU_CR_DBG_STANDBY ((uint32_t)0x00000004)
  3273. #define DBGMCU_CR_TRACE_IOEN ((uint32_t)0x00000020)
  3274. #define DBGMCU_CR_TRACE_MODE ((uint32_t)0x000000C0)
  3275. #define DBGMCU_CR_TRACE_MODE_0 ((uint32_t)0x00000040)/*!<Bit 0 */
  3276. #define DBGMCU_CR_TRACE_MODE_1 ((uint32_t)0x00000080)/*!<Bit 1 */
  3277. /******************** Bit definition for DBGMCU_APB1_FZ register ************/
  3278. #define DBGMCU_APB1_FZ_DBG_TIM5_STOP ((uint32_t)0x00000008)
  3279. #define DBGMCU_APB1_FZ_DBG_TIM6_STOP ((uint32_t)0x00000010)
  3280. #define DBGMCU_APB1_FZ_DBG_RTC_STOP ((uint32_t)0x00000400)
  3281. #define DBGMCU_APB1_FZ_DBG_WWDG_STOP ((uint32_t)0x00000800)
  3282. #define DBGMCU_APB1_FZ_DBG_IWDG_STOP ((uint32_t)0x00001000)
  3283. #define DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00200000)
  3284. #define DBGMCU_APB1_FZ_DBG_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00400000)
  3285. #define DBGMCU_APB1_FZ_DBG_CAN1_STOP ((uint32_t)0x02000000)
  3286. #define DBGMCU_APB1_FZ_DBG_CAN2_STOP ((uint32_t)0x04000000)
  3287. /******************** Bit definition for DBGMCU_APB2_FZ register ************/
  3288. #define DBGMCU_APB2_FZ_DBG_TIM1_STOP ((uint32_t)0x00000001)
  3289. #define DBGMCU_APB2_FZ_DBG_TIM9_STOP ((uint32_t)0x00010000)
  3290. #define DBGMCU_APB2_FZ_DBG_TIM11_STOP ((uint32_t)0x00040000)
  3291. /**
  3292. * @}
  3293. */
  3294. /**
  3295. * @}
  3296. */
  3297. /** @addtogroup Exported_macros
  3298. * @{
  3299. */
  3300. /******************************* ADC Instances ********************************/
  3301. #define IS_ADC_ALL_INSTANCE(INSTANCE) ((INSTANCE) == ADC1)
  3302. /******************************* CRC Instances ********************************/
  3303. #define IS_CRC_ALL_INSTANCE(INSTANCE) ((INSTANCE) == CRC)
  3304. /******************************* DAC Instances ********************************/
  3305. #define IS_DAC_ALL_INSTANCE(INSTANCE) ((INSTANCE) == DAC)
  3306. /******************************** DMA Instances *******************************/
  3307. #define IS_DMA_STREAM_ALL_INSTANCE(INSTANCE) (((INSTANCE) == DMA1_Stream0) || \
  3308. ((INSTANCE) == DMA1_Stream1) || \
  3309. ((INSTANCE) == DMA1_Stream2) || \
  3310. ((INSTANCE) == DMA1_Stream3) || \
  3311. ((INSTANCE) == DMA1_Stream4) || \
  3312. ((INSTANCE) == DMA1_Stream5) || \
  3313. ((INSTANCE) == DMA1_Stream6) || \
  3314. ((INSTANCE) == DMA1_Stream7) || \
  3315. ((INSTANCE) == DMA2_Stream0) || \
  3316. ((INSTANCE) == DMA2_Stream1) || \
  3317. ((INSTANCE) == DMA2_Stream2) || \
  3318. ((INSTANCE) == DMA2_Stream3) || \
  3319. ((INSTANCE) == DMA2_Stream4) || \
  3320. ((INSTANCE) == DMA2_Stream5) || \
  3321. ((INSTANCE) == DMA2_Stream6) || \
  3322. ((INSTANCE) == DMA2_Stream7))
  3323. /******************************* GPIO Instances *******************************/
  3324. #define IS_GPIO_ALL_INSTANCE(INSTANCE) (((INSTANCE) == GPIOA) || \
  3325. ((INSTANCE) == GPIOB) || \
  3326. ((INSTANCE) == GPIOC) || \
  3327. ((INSTANCE) == GPIOH))
  3328. /******************************** I2C Instances *******************************/
  3329. #define IS_I2C_ALL_INSTANCE(INSTANCE) (((INSTANCE) == I2C1) || \
  3330. ((INSTANCE) == I2C2))
  3331. /******************************** I2S Instances *******************************/
  3332. #define IS_I2S_ALL_INSTANCE(INSTANCE) (((INSTANCE) == SPI1) || \
  3333. ((INSTANCE) == SPI2) || \
  3334. ((INSTANCE) == SPI5))
  3335. /******************************* LPTIM Instances ******************************/
  3336. #define IS_LPTIM_INSTANCE(__INSTANCE__) ((__INSTANCE__) == LPTIM1)
  3337. /******************************* RNG Instances ********************************/
  3338. #define IS_RNG_ALL_INSTANCE(INSTANCE) ((INSTANCE) == RNG)
  3339. /****************************** RTC Instances *********************************/
  3340. #define IS_RTC_ALL_INSTANCE(INSTANCE) ((INSTANCE) == RTC)
  3341. /******************************** SPI Instances *******************************/
  3342. #define IS_SPI_ALL_INSTANCE(INSTANCE) (((INSTANCE) == SPI1) || \
  3343. ((INSTANCE) == SPI2) || \
  3344. ((INSTANCE) == SPI5))
  3345. /*************************** SPI Extended Instances ***************************/
  3346. #define IS_SPI_ALL_INSTANCE_EXT(INSTANCE) (((INSTANCE) == SPI1) || \
  3347. ((INSTANCE) == SPI2) || \
  3348. ((INSTANCE) == SPI5))
  3349. /****************** TIM Instances : All supported instances *******************/
  3350. #define IS_TIM_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3351. ((INSTANCE) == TIM5) || \
  3352. ((INSTANCE) == TIM6) || \
  3353. ((INSTANCE) == TIM9) || \
  3354. ((INSTANCE) == TIM11))
  3355. /************* TIM Instances : at least 1 capture/compare channel *************/
  3356. #define IS_TIM_CC1_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3357. ((INSTANCE) == TIM5) || \
  3358. ((INSTANCE) == TIM9) || \
  3359. ((INSTANCE) == TIM11))
  3360. /************ TIM Instances : at least 2 capture/compare channels *************/
  3361. #define IS_TIM_CC2_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3362. ((INSTANCE) == TIM5) || \
  3363. ((INSTANCE) == TIM9))
  3364. /************ TIM Instances : at least 3 capture/compare channels *************/
  3365. #define IS_TIM_CC3_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3366. ((INSTANCE) == TIM5))
  3367. /************ TIM Instances : at least 4 capture/compare channels *************/
  3368. #define IS_TIM_CC4_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3369. ((INSTANCE) == TIM5))
  3370. /******************** TIM Instances : Advanced-control timers *****************/
  3371. #define IS_TIM_ADVANCED_INSTANCE(INSTANCE) ((INSTANCE) == TIM1)
  3372. /******************* TIM Instances : Timer input XOR function *****************/
  3373. #define IS_TIM_XOR_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3374. ((INSTANCE) == TIM5))
  3375. /****************** TIM Instances : DMA requests generation (UDE) *************/
  3376. #define IS_TIM_DMA_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3377. ((INSTANCE) == TIM5) || \
  3378. ((INSTANCE) == TIM6))
  3379. /************ TIM Instances : DMA requests generation (CCxDE) *****************/
  3380. #define IS_TIM_DMA_CC_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3381. ((INSTANCE) == TIM5))
  3382. /************ TIM Instances : DMA requests generation (COMDE) *****************/
  3383. #define IS_TIM_CCDMA_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3384. ((INSTANCE) == TIM5))
  3385. /******************** TIM Instances : DMA burst feature ***********************/
  3386. #define IS_TIM_DMABURST_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3387. ((INSTANCE) == TIM5))
  3388. /****** TIM Instances : master mode available (TIMx_CR2.MMS available )********/
  3389. #define IS_TIM_MASTER_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3390. ((INSTANCE) == TIM5) || \
  3391. ((INSTANCE) == TIM6) || \
  3392. ((INSTANCE) == TIM9))
  3393. /*********** TIM Instances : Slave mode available (TIMx_SMCR available )*******/
  3394. #define IS_TIM_SLAVE_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3395. ((INSTANCE) == TIM5) || \
  3396. ((INSTANCE) == TIM9))
  3397. /********************** TIM Instances : 32 bit Counter ************************/
  3398. #define IS_TIM_32B_COUNTER_INSTANCE(INSTANCE)(((INSTANCE) == TIM5))
  3399. /***************** TIM Instances : external trigger input availabe ************/
  3400. #define IS_TIM_ETR_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3401. ((INSTANCE) == TIM5))
  3402. /****************** TIM Instances : remapping capability **********************/
  3403. #define IS_TIM_REMAP_INSTANCE(INSTANCE) (((INSTANCE) == TIM5) || \
  3404. ((INSTANCE) == TIM11))
  3405. /******************* TIM Instances : output(s) available **********************/
  3406. #define IS_TIM_CCX_INSTANCE(INSTANCE, CHANNEL) \
  3407. ((((INSTANCE) == TIM1) && \
  3408. (((CHANNEL) == TIM_CHANNEL_1) || \
  3409. ((CHANNEL) == TIM_CHANNEL_2) || \
  3410. ((CHANNEL) == TIM_CHANNEL_3) || \
  3411. ((CHANNEL) == TIM_CHANNEL_4))) \
  3412. || \
  3413. (((INSTANCE) == TIM5) && \
  3414. (((CHANNEL) == TIM_CHANNEL_1) || \
  3415. ((CHANNEL) == TIM_CHANNEL_2) || \
  3416. ((CHANNEL) == TIM_CHANNEL_3) || \
  3417. ((CHANNEL) == TIM_CHANNEL_4))) \
  3418. || \
  3419. (((INSTANCE) == TIM9) && \
  3420. (((CHANNEL) == TIM_CHANNEL_1) || \
  3421. ((CHANNEL) == TIM_CHANNEL_2))) \
  3422. || \
  3423. (((INSTANCE) == TIM11) && \
  3424. (((CHANNEL) == TIM_CHANNEL_1))))
  3425. /************ TIM Instances : complementary output(s) available ***************/
  3426. #define IS_TIM_CCXN_INSTANCE(INSTANCE, CHANNEL) \
  3427. ((((INSTANCE) == TIM1) && \
  3428. (((CHANNEL) == TIM_CHANNEL_1) || \
  3429. ((CHANNEL) == TIM_CHANNEL_2) || \
  3430. ((CHANNEL) == TIM_CHANNEL_3))))
  3431. /******************** USART Instances : Synchronous mode **********************/
  3432. #define IS_USART_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \
  3433. ((INSTANCE) == USART2) || \
  3434. ((INSTANCE) == USART6))
  3435. /******************** UART Instances : Asynchronous mode **********************/
  3436. #define IS_UART_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \
  3437. ((INSTANCE) == USART2) || \
  3438. ((INSTANCE) == USART6))
  3439. /****************** UART Instances : Hardware Flow control ********************/
  3440. #define IS_UART_HWFLOW_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \
  3441. ((INSTANCE) == USART2) || \
  3442. ((INSTANCE) == USART6))
  3443. /********************* UART Instances : Smard card mode ***********************/
  3444. #define IS_SMARTCARD_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \
  3445. ((INSTANCE) == USART2) || \
  3446. ((INSTANCE) == USART6))
  3447. /*********************** UART Instances : IRDA mode ***************************/
  3448. #define IS_IRDA_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \
  3449. ((INSTANCE) == USART2) || \
  3450. ((INSTANCE) == USART6))
  3451. /****************************** IWDG Instances ********************************/
  3452. #define IS_IWDG_ALL_INSTANCE(INSTANCE) ((INSTANCE) == IWDG)
  3453. /****************************** WWDG Instances ********************************/
  3454. #define IS_WWDG_ALL_INSTANCE(INSTANCE) ((INSTANCE) == WWDG)
  3455. /***************************** FMPI2C Instances *******************************/
  3456. #define IS_FMPI2C_ALL_INSTANCE(__INSTANCE__) ((__INSTANCE__) == FMPI2C1)
  3457. /**
  3458. * @}
  3459. */
  3460. /**
  3461. * @}
  3462. */
  3463. /**
  3464. * @}
  3465. */
  3466. #ifdef __cplusplus
  3467. }
  3468. #endif /* __cplusplus */
  3469. #endif /* __STM32F410Rx_H */
  3470. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/