stm32f410cx.h 276 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971
  1. /**
  2. ******************************************************************************
  3. * @file stm32f410cx.h
  4. * @author MCD Application Team
  5. * @version V2.4.2
  6. * @date 13-November-2015
  7. * @brief CMSIS STM32F410Cx 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 stm32f410cx
  47. * @{
  48. */
  49. #ifndef __STM32F410Cx_H
  50. #define __STM32F410Cx_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. /*!< PPRE1 configuration */
  1998. #define RCC_CFGR_PPRE1 ((uint32_t)0x00001C00) /*!< PRE1[2:0] bits (APB1 prescaler) */
  1999. #define RCC_CFGR_PPRE1_0 ((uint32_t)0x00000400) /*!< Bit 0 */
  2000. #define RCC_CFGR_PPRE1_1 ((uint32_t)0x00000800) /*!< Bit 1 */
  2001. #define RCC_CFGR_PPRE1_2 ((uint32_t)0x00001000) /*!< Bit 2 */
  2002. #define RCC_CFGR_PPRE1_DIV1 ((uint32_t)0x00000000) /*!< HCLK not divided */
  2003. #define RCC_CFGR_PPRE1_DIV2 ((uint32_t)0x00001000) /*!< HCLK divided by 2 */
  2004. #define RCC_CFGR_PPRE1_DIV4 ((uint32_t)0x00001400) /*!< HCLK divided by 4 */
  2005. #define RCC_CFGR_PPRE1_DIV8 ((uint32_t)0x00001800) /*!< HCLK divided by 8 */
  2006. #define RCC_CFGR_PPRE1_DIV16 ((uint32_t)0x00001C00) /*!< HCLK divided by 16 */
  2007. /*!< PPRE2 configuration */
  2008. #define RCC_CFGR_PPRE2 ((uint32_t)0x0000E000) /*!< PRE2[2:0] bits (APB2 prescaler) */
  2009. #define RCC_CFGR_PPRE2_0 ((uint32_t)0x00002000) /*!< Bit 0 */
  2010. #define RCC_CFGR_PPRE2_1 ((uint32_t)0x00004000) /*!< Bit 1 */
  2011. #define RCC_CFGR_PPRE2_2 ((uint32_t)0x00008000) /*!< Bit 2 */
  2012. #define RCC_CFGR_PPRE2_DIV1 ((uint32_t)0x00000000) /*!< HCLK not divided */
  2013. #define RCC_CFGR_PPRE2_DIV2 ((uint32_t)0x00008000) /*!< HCLK divided by 2 */
  2014. #define RCC_CFGR_PPRE2_DIV4 ((uint32_t)0x0000A000) /*!< HCLK divided by 4 */
  2015. #define RCC_CFGR_PPRE2_DIV8 ((uint32_t)0x0000C000) /*!< HCLK divided by 8 */
  2016. #define RCC_CFGR_PPRE2_DIV16 ((uint32_t)0x0000E000) /*!< HCLK divided by 16 */
  2017. /*!< RTCPRE configuration */
  2018. #define RCC_CFGR_RTCPRE ((uint32_t)0x001F0000)
  2019. #define RCC_CFGR_RTCPRE_0 ((uint32_t)0x00010000)
  2020. #define RCC_CFGR_RTCPRE_1 ((uint32_t)0x00020000)
  2021. #define RCC_CFGR_RTCPRE_2 ((uint32_t)0x00040000)
  2022. #define RCC_CFGR_RTCPRE_3 ((uint32_t)0x00080000)
  2023. #define RCC_CFGR_RTCPRE_4 ((uint32_t)0x00100000)
  2024. /*!< MCO1 configuration */
  2025. #define RCC_CFGR_MCO1 ((uint32_t)0x00600000)
  2026. #define RCC_CFGR_MCO1_0 ((uint32_t)0x00200000)
  2027. #define RCC_CFGR_MCO1_1 ((uint32_t)0x00400000)
  2028. #define RCC_CFGR_MCO1PRE ((uint32_t)0x07000000)
  2029. #define RCC_CFGR_MCO1PRE_0 ((uint32_t)0x01000000)
  2030. #define RCC_CFGR_MCO1PRE_1 ((uint32_t)0x02000000)
  2031. #define RCC_CFGR_MCO1PRE_2 ((uint32_t)0x04000000)
  2032. #define RCC_CFGR_MCO2PRE ((uint32_t)0x38000000)
  2033. #define RCC_CFGR_MCO2PRE_0 ((uint32_t)0x08000000)
  2034. #define RCC_CFGR_MCO2PRE_1 ((uint32_t)0x10000000)
  2035. #define RCC_CFGR_MCO2PRE_2 ((uint32_t)0x20000000)
  2036. #define RCC_CFGR_MCO2 ((uint32_t)0xC0000000)
  2037. #define RCC_CFGR_MCO2_0 ((uint32_t)0x40000000)
  2038. #define RCC_CFGR_MCO2_1 ((uint32_t)0x80000000)
  2039. /******************** Bit definition for RCC_CIR register *******************/
  2040. #define RCC_CIR_LSIRDYF ((uint32_t)0x00000001)
  2041. #define RCC_CIR_LSERDYF ((uint32_t)0x00000002)
  2042. #define RCC_CIR_HSIRDYF ((uint32_t)0x00000004)
  2043. #define RCC_CIR_HSERDYF ((uint32_t)0x00000008)
  2044. #define RCC_CIR_PLLRDYF ((uint32_t)0x00000010)
  2045. #define RCC_CIR_CSSF ((uint32_t)0x00000080)
  2046. #define RCC_CIR_LSIRDYIE ((uint32_t)0x00000100)
  2047. #define RCC_CIR_LSERDYIE ((uint32_t)0x00000200)
  2048. #define RCC_CIR_HSIRDYIE ((uint32_t)0x00000400)
  2049. #define RCC_CIR_HSERDYIE ((uint32_t)0x00000800)
  2050. #define RCC_CIR_PLLRDYIE ((uint32_t)0x00001000)
  2051. #define RCC_CIR_LSIRDYC ((uint32_t)0x00010000)
  2052. #define RCC_CIR_LSERDYC ((uint32_t)0x00020000)
  2053. #define RCC_CIR_HSIRDYC ((uint32_t)0x00040000)
  2054. #define RCC_CIR_HSERDYC ((uint32_t)0x00080000)
  2055. #define RCC_CIR_PLLRDYC ((uint32_t)0x00100000)
  2056. #define RCC_CIR_CSSC ((uint32_t)0x00800000)
  2057. /******************** Bit definition for RCC_AHB1RSTR register **************/
  2058. #define RCC_AHB1RSTR_GPIOARST ((uint32_t)0x00000001)
  2059. #define RCC_AHB1RSTR_GPIOBRST ((uint32_t)0x00000002)
  2060. #define RCC_AHB1RSTR_GPIOCRST ((uint32_t)0x00000004)
  2061. #define RCC_AHB1RSTR_GPIOHRST ((uint32_t)0x00000080)
  2062. #define RCC_AHB1RSTR_CRCRST ((uint32_t)0x00001000)
  2063. #define RCC_AHB1RSTR_DMA1RST ((uint32_t)0x00200000)
  2064. #define RCC_AHB1RSTR_DMA2RST ((uint32_t)0x00400000)
  2065. #define RCC_AHB1RSTR_RNGRST ((uint32_t)0x80000000)
  2066. /******************** Bit definition for RCC_APB1RSTR register **************/
  2067. #define RCC_APB1RSTR_TIM5RST ((uint32_t)0x00000008)
  2068. #define RCC_APB1RSTR_TIM6RST ((uint32_t)0x00000010)
  2069. #define RCC_APB1RSTR_LPTIM1RST ((uint32_t)0x00000200)
  2070. #define RCC_APB1RSTR_WWDGRST ((uint32_t)0x00000800)
  2071. #define RCC_APB1RSTR_SPI2RST ((uint32_t)0x00004000)
  2072. #define RCC_APB1RSTR_USART2RST ((uint32_t)0x00020000)
  2073. #define RCC_APB1RSTR_I2C1RST ((uint32_t)0x00200000)
  2074. #define RCC_APB1RSTR_I2C2RST ((uint32_t)0x00400000)
  2075. #define RCC_APB1RSTR_FMPI2C1RST ((uint32_t)0x01000000)
  2076. #define RCC_APB1RSTR_PWRRST ((uint32_t)0x10000000)
  2077. #define RCC_APB1RSTR_DACRST ((uint32_t)0x20000000)
  2078. /******************** Bit definition for RCC_APB2RSTR register **************/
  2079. #define RCC_APB2RSTR_TIM1RST ((uint32_t)0x00000001)
  2080. #define RCC_APB2RSTR_USART1RST ((uint32_t)0x00000010)
  2081. #define RCC_APB2RSTR_USART6RST ((uint32_t)0x00000020)
  2082. #define RCC_APB2RSTR_ADCRST ((uint32_t)0x00000100)
  2083. #define RCC_APB2RSTR_SPI1RST ((uint32_t)0x00001000)
  2084. #define RCC_APB2RSTR_SYSCFGRST ((uint32_t)0x00004000)
  2085. #define RCC_APB2RSTR_TIM9RST ((uint32_t)0x00010000)
  2086. #define RCC_APB2RSTR_TIM11RST ((uint32_t)0x00040000)
  2087. #define RCC_APB2RSTR_SPI5RST ((uint32_t)0x00100000)
  2088. /******************** Bit definition for RCC_AHB1ENR register ***************/
  2089. #define RCC_AHB1ENR_GPIOAEN ((uint32_t)0x00000001)
  2090. #define RCC_AHB1ENR_GPIOBEN ((uint32_t)0x00000002)
  2091. #define RCC_AHB1ENR_GPIOCEN ((uint32_t)0x00000004)
  2092. #define RCC_AHB1ENR_GPIOHEN ((uint32_t)0x00000080)
  2093. #define RCC_AHB1ENR_CRCEN ((uint32_t)0x00001000)
  2094. #define RCC_AHB1ENR_DMA1EN ((uint32_t)0x00200000)
  2095. #define RCC_AHB1ENR_DMA2EN ((uint32_t)0x00400000)
  2096. #define RCC_AHB1ENR_RNGEN ((uint32_t)0x80000000)
  2097. /******************** Bit definition for RCC_APB1ENR register ***************/
  2098. #define RCC_APB1ENR_TIM5EN ((uint32_t)0x00000008)
  2099. #define RCC_APB1ENR_TIM6EN ((uint32_t)0x00000010)
  2100. #define RCC_APB1ENR_LPTIM1EN ((uint32_t)0x00000200)
  2101. #define RCC_APB1ENR_RTCAPBEN ((uint32_t)0x00000400)
  2102. #define RCC_APB1ENR_WWDGEN ((uint32_t)0x00000800)
  2103. #define RCC_APB1ENR_SPI2EN ((uint32_t)0x00004000)
  2104. #define RCC_APB1ENR_USART2EN ((uint32_t)0x00020000)
  2105. #define RCC_APB1ENR_I2C1EN ((uint32_t)0x00200000)
  2106. #define RCC_APB1ENR_I2C2EN ((uint32_t)0x00400000)
  2107. #define RCC_APB1ENR_FMPI2C1EN ((uint32_t)0x01000000)
  2108. #define RCC_APB1ENR_PWREN ((uint32_t)0x10000000)
  2109. #define RCC_APB1ENR_DACEN ((uint32_t)0x20000000)
  2110. /******************** Bit definition for RCC_APB2ENR register ***************/
  2111. #define RCC_APB2ENR_TIM1EN ((uint32_t)0x00000001)
  2112. #define RCC_APB2ENR_USART1EN ((uint32_t)0x00000010)
  2113. #define RCC_APB2ENR_USART6EN ((uint32_t)0x00000020)
  2114. #define RCC_APB2ENR_ADC1EN ((uint32_t)0x00000100)
  2115. #define RCC_APB2ENR_SPI1EN ((uint32_t)0x00001000)
  2116. #define RCC_APB2ENR_SYSCFGEN ((uint32_t)0x00004000)
  2117. #define RCC_APB2ENR_EXTITEN ((uint32_t)0x00008000)
  2118. #define RCC_APB2ENR_TIM9EN ((uint32_t)0x00010000)
  2119. #define RCC_APB2ENR_TIM11EN ((uint32_t)0x00040000)
  2120. #define RCC_APB2ENR_SPI5EN ((uint32_t)0x00100000)
  2121. /******************** Bit definition for RCC_AHB1LPENR register *************/
  2122. #define RCC_AHB1LPENR_GPIOALPEN ((uint32_t)0x00000001)
  2123. #define RCC_AHB1LPENR_GPIOBLPEN ((uint32_t)0x00000002)
  2124. #define RCC_AHB1LPENR_GPIOCLPEN ((uint32_t)0x00000004)
  2125. #define RCC_AHB1LPENR_GPIOHLPEN ((uint32_t)0x00000080)
  2126. #define RCC_AHB1LPENR_CRCLPEN ((uint32_t)0x00001000)
  2127. #define RCC_AHB1LPENR_FLITFLPEN ((uint32_t)0x00008000)
  2128. #define RCC_AHB1LPENR_SRAM1LPEN ((uint32_t)0x00010000)
  2129. #define RCC_AHB1LPENR_DMA1LPEN ((uint32_t)0x00200000)
  2130. #define RCC_AHB1LPENR_DMA2LPEN ((uint32_t)0x00400000)
  2131. #define RCC_AHB1LPENR_RNGLPEN ((uint32_t)0x80000000)
  2132. /******************** Bit definition for RCC_APB1LPENR register *************/
  2133. #define RCC_APB1LPENR_TIM5LPEN ((uint32_t)0x00000008)
  2134. #define RCC_APB1LPENR_TIM6LPEN ((uint32_t)0x00000010)
  2135. #define RCC_APB1LPENR_LPTIM1LPEN ((uint32_t)0x00000200)
  2136. #define RCC_APB1LPENR_RTCAPBLPEN ((uint32_t)0x00000400)
  2137. #define RCC_APB1LPENR_WWDGLPEN ((uint32_t)0x00000800)
  2138. #define RCC_APB1LPENR_SPI2LPEN ((uint32_t)0x00004000)
  2139. #define RCC_APB1LPENR_USART2LPEN ((uint32_t)0x00020000)
  2140. #define RCC_APB1LPENR_I2C1LPEN ((uint32_t)0x00200000)
  2141. #define RCC_APB1LPENR_I2C2LPEN ((uint32_t)0x00400000)
  2142. #define RCC_APB1LPENR_FMPI2C1LPEN ((uint32_t)0x01000000)
  2143. #define RCC_APB1LPENR_PWRLPEN ((uint32_t)0x10000000)
  2144. #define RCC_APB1LPENR_DACLPEN ((uint32_t)0x20000000)
  2145. /******************** Bit definition for RCC_APB2LPENR register *************/
  2146. #define RCC_APB2LPENR_TIM1LPEN ((uint32_t)0x00000001)
  2147. #define RCC_APB2LPENR_USART1LPEN ((uint32_t)0x00000010)
  2148. #define RCC_APB2LPENR_USART6LPEN ((uint32_t)0x00000020)
  2149. #define RCC_APB2LPENR_ADC1LPEN ((uint32_t)0x00000100)
  2150. #define RCC_APB2LPENR_SPI1LPEN ((uint32_t)0x00001000)
  2151. #define RCC_APB2LPENR_SYSCFGLPEN ((uint32_t)0x00004000)
  2152. #define RCC_APB2LPENR_EXTITLPEN ((uint32_t)0x00008000)
  2153. #define RCC_APB2LPENR_TIM9LPEN ((uint32_t)0x00010000)
  2154. #define RCC_APB2LPENR_TIM11LPEN ((uint32_t)0x00040000)
  2155. #define RCC_APB2LPENR_SPI5LPEN ((uint32_t)0x00100000)
  2156. /******************** Bit definition for RCC_BDCR register ******************/
  2157. #define RCC_BDCR_LSEON ((uint32_t)0x00000001)
  2158. #define RCC_BDCR_LSERDY ((uint32_t)0x00000002)
  2159. #define RCC_BDCR_LSEBYP ((uint32_t)0x00000004)
  2160. #define RCC_BDCR_LSEMOD ((uint32_t)0x00000008)
  2161. #define RCC_BDCR_RTCSEL ((uint32_t)0x00000300)
  2162. #define RCC_BDCR_RTCSEL_0 ((uint32_t)0x00000100)
  2163. #define RCC_BDCR_RTCSEL_1 ((uint32_t)0x00000200)
  2164. #define RCC_BDCR_RTCEN ((uint32_t)0x00008000)
  2165. #define RCC_BDCR_BDRST ((uint32_t)0x00010000)
  2166. /******************** Bit definition for RCC_CSR register *******************/
  2167. #define RCC_CSR_LSION ((uint32_t)0x00000001)
  2168. #define RCC_CSR_LSIRDY ((uint32_t)0x00000002)
  2169. #define RCC_CSR_RMVF ((uint32_t)0x01000000)
  2170. #define RCC_CSR_BORRSTF ((uint32_t)0x02000000)
  2171. #define RCC_CSR_PADRSTF ((uint32_t)0x04000000)
  2172. #define RCC_CSR_PORRSTF ((uint32_t)0x08000000)
  2173. #define RCC_CSR_SFTRSTF ((uint32_t)0x10000000)
  2174. #define RCC_CSR_WDGRSTF ((uint32_t)0x20000000)
  2175. #define RCC_CSR_WWDGRSTF ((uint32_t)0x40000000)
  2176. #define RCC_CSR_LPWRRSTF ((uint32_t)0x80000000)
  2177. /******************** Bit definition for RCC_SSCGR register *****************/
  2178. #define RCC_SSCGR_MODPER ((uint32_t)0x00001FFF)
  2179. #define RCC_SSCGR_INCSTEP ((uint32_t)0x0FFFE000)
  2180. #define RCC_SSCGR_SPREADSEL ((uint32_t)0x40000000)
  2181. #define RCC_SSCGR_SSCGEN ((uint32_t)0x80000000)
  2182. /******************** Bit definition for RCC_DCKCFGR register ***************/
  2183. #define RCC_DCKCFGR_TIMPRE ((uint32_t)0x01000000)
  2184. #define RCC_DCKCFGR_I2SSRC ((uint32_t)0x06000000)
  2185. #define RCC_DCKCFGR_I2SSRC_0 ((uint32_t)0x02000000)
  2186. #define RCC_DCKCFGR_I2SSRC_1 ((uint32_t)0x04000000)
  2187. /******************** Bit definition for RCC_CKGATENR register **************/
  2188. #define RCC_CKGATENR_AHB2APB1_CKEN ((uint32_t)0x00000001)
  2189. #define RCC_CKGATENR_AHB2APB2_CKEN ((uint32_t)0x00000002)
  2190. #define RCC_CKGATENR_CM4DBG_CKEN ((uint32_t)0x00000004)
  2191. #define RCC_CKGATENR_SPARE_CKEN ((uint32_t)0x00000008)
  2192. #define RCC_CKGATENR_SRAM_CKEN ((uint32_t)0x00000010)
  2193. #define RCC_CKGATENR_FLITF_CKEN ((uint32_t)0x00000020)
  2194. #define RCC_CKGATENR_RCC_CKEN ((uint32_t)0x00000040)
  2195. /******************** Bit definition for RCC_DCKCFGR2 register **************/
  2196. #define RCC_DCKCFGR2_FMPI2C1SEL ((uint32_t)0x00C00000)
  2197. #define RCC_DCKCFGR2_FMPI2C1SEL_0 ((uint32_t)0x00400000)
  2198. #define RCC_DCKCFGR2_FMPI2C1SEL_1 ((uint32_t)0x00800000)
  2199. #define RCC_DCKCFGR2_LPTIM1SEL ((uint32_t)0xC0000000)
  2200. #define RCC_DCKCFGR2_LPTIM1SEL_0 ((uint32_t)0x40000000)
  2201. #define RCC_DCKCFGR2_LPTIM1SEL_1 ((uint32_t)0x80000000)
  2202. /******************************************************************************/
  2203. /* */
  2204. /* RNG */
  2205. /* */
  2206. /******************************************************************************/
  2207. /******************** Bits definition for RNG_CR register *******************/
  2208. #define RNG_CR_RNGEN ((uint32_t)0x00000004)
  2209. #define RNG_CR_IE ((uint32_t)0x00000008)
  2210. /******************** Bits definition for RNG_SR register *******************/
  2211. #define RNG_SR_DRDY ((uint32_t)0x00000001)
  2212. #define RNG_SR_CECS ((uint32_t)0x00000002)
  2213. #define RNG_SR_SECS ((uint32_t)0x00000004)
  2214. #define RNG_SR_CEIS ((uint32_t)0x00000020)
  2215. #define RNG_SR_SEIS ((uint32_t)0x00000040)
  2216. /******************************************************************************/
  2217. /* */
  2218. /* Real-Time Clock (RTC) */
  2219. /* */
  2220. /******************************************************************************/
  2221. /******************** Bits definition for RTC_TR register *******************/
  2222. #define RTC_TR_PM ((uint32_t)0x00400000)
  2223. #define RTC_TR_HT ((uint32_t)0x00300000)
  2224. #define RTC_TR_HT_0 ((uint32_t)0x00100000)
  2225. #define RTC_TR_HT_1 ((uint32_t)0x00200000)
  2226. #define RTC_TR_HU ((uint32_t)0x000F0000)
  2227. #define RTC_TR_HU_0 ((uint32_t)0x00010000)
  2228. #define RTC_TR_HU_1 ((uint32_t)0x00020000)
  2229. #define RTC_TR_HU_2 ((uint32_t)0x00040000)
  2230. #define RTC_TR_HU_3 ((uint32_t)0x00080000)
  2231. #define RTC_TR_MNT ((uint32_t)0x00007000)
  2232. #define RTC_TR_MNT_0 ((uint32_t)0x00001000)
  2233. #define RTC_TR_MNT_1 ((uint32_t)0x00002000)
  2234. #define RTC_TR_MNT_2 ((uint32_t)0x00004000)
  2235. #define RTC_TR_MNU ((uint32_t)0x00000F00)
  2236. #define RTC_TR_MNU_0 ((uint32_t)0x00000100)
  2237. #define RTC_TR_MNU_1 ((uint32_t)0x00000200)
  2238. #define RTC_TR_MNU_2 ((uint32_t)0x00000400)
  2239. #define RTC_TR_MNU_3 ((uint32_t)0x00000800)
  2240. #define RTC_TR_ST ((uint32_t)0x00000070)
  2241. #define RTC_TR_ST_0 ((uint32_t)0x00000010)
  2242. #define RTC_TR_ST_1 ((uint32_t)0x00000020)
  2243. #define RTC_TR_ST_2 ((uint32_t)0x00000040)
  2244. #define RTC_TR_SU ((uint32_t)0x0000000F)
  2245. #define RTC_TR_SU_0 ((uint32_t)0x00000001)
  2246. #define RTC_TR_SU_1 ((uint32_t)0x00000002)
  2247. #define RTC_TR_SU_2 ((uint32_t)0x00000004)
  2248. #define RTC_TR_SU_3 ((uint32_t)0x00000008)
  2249. /******************** Bits definition for RTC_DR register *******************/
  2250. #define RTC_DR_YT ((uint32_t)0x00F00000)
  2251. #define RTC_DR_YT_0 ((uint32_t)0x00100000)
  2252. #define RTC_DR_YT_1 ((uint32_t)0x00200000)
  2253. #define RTC_DR_YT_2 ((uint32_t)0x00400000)
  2254. #define RTC_DR_YT_3 ((uint32_t)0x00800000)
  2255. #define RTC_DR_YU ((uint32_t)0x000F0000)
  2256. #define RTC_DR_YU_0 ((uint32_t)0x00010000)
  2257. #define RTC_DR_YU_1 ((uint32_t)0x00020000)
  2258. #define RTC_DR_YU_2 ((uint32_t)0x00040000)
  2259. #define RTC_DR_YU_3 ((uint32_t)0x00080000)
  2260. #define RTC_DR_WDU ((uint32_t)0x0000E000)
  2261. #define RTC_DR_WDU_0 ((uint32_t)0x00002000)
  2262. #define RTC_DR_WDU_1 ((uint32_t)0x00004000)
  2263. #define RTC_DR_WDU_2 ((uint32_t)0x00008000)
  2264. #define RTC_DR_MT ((uint32_t)0x00001000)
  2265. #define RTC_DR_MU ((uint32_t)0x00000F00)
  2266. #define RTC_DR_MU_0 ((uint32_t)0x00000100)
  2267. #define RTC_DR_MU_1 ((uint32_t)0x00000200)
  2268. #define RTC_DR_MU_2 ((uint32_t)0x00000400)
  2269. #define RTC_DR_MU_3 ((uint32_t)0x00000800)
  2270. #define RTC_DR_DT ((uint32_t)0x00000030)
  2271. #define RTC_DR_DT_0 ((uint32_t)0x00000010)
  2272. #define RTC_DR_DT_1 ((uint32_t)0x00000020)
  2273. #define RTC_DR_DU ((uint32_t)0x0000000F)
  2274. #define RTC_DR_DU_0 ((uint32_t)0x00000001)
  2275. #define RTC_DR_DU_1 ((uint32_t)0x00000002)
  2276. #define RTC_DR_DU_2 ((uint32_t)0x00000004)
  2277. #define RTC_DR_DU_3 ((uint32_t)0x00000008)
  2278. /******************** Bits definition for RTC_CR register *******************/
  2279. #define RTC_CR_COE ((uint32_t)0x00800000)
  2280. #define RTC_CR_OSEL ((uint32_t)0x00600000)
  2281. #define RTC_CR_OSEL_0 ((uint32_t)0x00200000)
  2282. #define RTC_CR_OSEL_1 ((uint32_t)0x00400000)
  2283. #define RTC_CR_POL ((uint32_t)0x00100000)
  2284. #define RTC_CR_COSEL ((uint32_t)0x00080000)
  2285. #define RTC_CR_BCK ((uint32_t)0x00040000)
  2286. #define RTC_CR_SUB1H ((uint32_t)0x00020000)
  2287. #define RTC_CR_ADD1H ((uint32_t)0x00010000)
  2288. #define RTC_CR_TSIE ((uint32_t)0x00008000)
  2289. #define RTC_CR_WUTIE ((uint32_t)0x00004000)
  2290. #define RTC_CR_ALRBIE ((uint32_t)0x00002000)
  2291. #define RTC_CR_ALRAIE ((uint32_t)0x00001000)
  2292. #define RTC_CR_TSE ((uint32_t)0x00000800)
  2293. #define RTC_CR_WUTE ((uint32_t)0x00000400)
  2294. #define RTC_CR_ALRBE ((uint32_t)0x00000200)
  2295. #define RTC_CR_ALRAE ((uint32_t)0x00000100)
  2296. #define RTC_CR_DCE ((uint32_t)0x00000080)
  2297. #define RTC_CR_FMT ((uint32_t)0x00000040)
  2298. #define RTC_CR_BYPSHAD ((uint32_t)0x00000020)
  2299. #define RTC_CR_REFCKON ((uint32_t)0x00000010)
  2300. #define RTC_CR_TSEDGE ((uint32_t)0x00000008)
  2301. #define RTC_CR_WUCKSEL ((uint32_t)0x00000007)
  2302. #define RTC_CR_WUCKSEL_0 ((uint32_t)0x00000001)
  2303. #define RTC_CR_WUCKSEL_1 ((uint32_t)0x00000002)
  2304. #define RTC_CR_WUCKSEL_2 ((uint32_t)0x00000004)
  2305. /******************** Bits definition for RTC_ISR register ******************/
  2306. #define RTC_ISR_RECALPF ((uint32_t)0x00010000)
  2307. #define RTC_ISR_TAMP1F ((uint32_t)0x00002000)
  2308. #define RTC_ISR_TAMP2F ((uint32_t)0x00004000)
  2309. #define RTC_ISR_TSOVF ((uint32_t)0x00001000)
  2310. #define RTC_ISR_TSF ((uint32_t)0x00000800)
  2311. #define RTC_ISR_WUTF ((uint32_t)0x00000400)
  2312. #define RTC_ISR_ALRBF ((uint32_t)0x00000200)
  2313. #define RTC_ISR_ALRAF ((uint32_t)0x00000100)
  2314. #define RTC_ISR_INIT ((uint32_t)0x00000080)
  2315. #define RTC_ISR_INITF ((uint32_t)0x00000040)
  2316. #define RTC_ISR_RSF ((uint32_t)0x00000020)
  2317. #define RTC_ISR_INITS ((uint32_t)0x00000010)
  2318. #define RTC_ISR_SHPF ((uint32_t)0x00000008)
  2319. #define RTC_ISR_WUTWF ((uint32_t)0x00000004)
  2320. #define RTC_ISR_ALRBWF ((uint32_t)0x00000002)
  2321. #define RTC_ISR_ALRAWF ((uint32_t)0x00000001)
  2322. /******************** Bits definition for RTC_PRER register *****************/
  2323. #define RTC_PRER_PREDIV_A ((uint32_t)0x007F0000)
  2324. #define RTC_PRER_PREDIV_S ((uint32_t)0x00007FFF)
  2325. /******************** Bits definition for RTC_WUTR register *****************/
  2326. #define RTC_WUTR_WUT ((uint32_t)0x0000FFFF)
  2327. /******************** Bits definition for RTC_CALIBR register ***************/
  2328. #define RTC_CALIBR_DCS ((uint32_t)0x00000080)
  2329. #define RTC_CALIBR_DC ((uint32_t)0x0000001F)
  2330. /******************** Bits definition for RTC_ALRMAR register ***************/
  2331. #define RTC_ALRMAR_MSK4 ((uint32_t)0x80000000)
  2332. #define RTC_ALRMAR_WDSEL ((uint32_t)0x40000000)
  2333. #define RTC_ALRMAR_DT ((uint32_t)0x30000000)
  2334. #define RTC_ALRMAR_DT_0 ((uint32_t)0x10000000)
  2335. #define RTC_ALRMAR_DT_1 ((uint32_t)0x20000000)
  2336. #define RTC_ALRMAR_DU ((uint32_t)0x0F000000)
  2337. #define RTC_ALRMAR_DU_0 ((uint32_t)0x01000000)
  2338. #define RTC_ALRMAR_DU_1 ((uint32_t)0x02000000)
  2339. #define RTC_ALRMAR_DU_2 ((uint32_t)0x04000000)
  2340. #define RTC_ALRMAR_DU_3 ((uint32_t)0x08000000)
  2341. #define RTC_ALRMAR_MSK3 ((uint32_t)0x00800000)
  2342. #define RTC_ALRMAR_PM ((uint32_t)0x00400000)
  2343. #define RTC_ALRMAR_HT ((uint32_t)0x00300000)
  2344. #define RTC_ALRMAR_HT_0 ((uint32_t)0x00100000)
  2345. #define RTC_ALRMAR_HT_1 ((uint32_t)0x00200000)
  2346. #define RTC_ALRMAR_HU ((uint32_t)0x000F0000)
  2347. #define RTC_ALRMAR_HU_0 ((uint32_t)0x00010000)
  2348. #define RTC_ALRMAR_HU_1 ((uint32_t)0x00020000)
  2349. #define RTC_ALRMAR_HU_2 ((uint32_t)0x00040000)
  2350. #define RTC_ALRMAR_HU_3 ((uint32_t)0x00080000)
  2351. #define RTC_ALRMAR_MSK2 ((uint32_t)0x00008000)
  2352. #define RTC_ALRMAR_MNT ((uint32_t)0x00007000)
  2353. #define RTC_ALRMAR_MNT_0 ((uint32_t)0x00001000)
  2354. #define RTC_ALRMAR_MNT_1 ((uint32_t)0x00002000)
  2355. #define RTC_ALRMAR_MNT_2 ((uint32_t)0x00004000)
  2356. #define RTC_ALRMAR_MNU ((uint32_t)0x00000F00)
  2357. #define RTC_ALRMAR_MNU_0 ((uint32_t)0x00000100)
  2358. #define RTC_ALRMAR_MNU_1 ((uint32_t)0x00000200)
  2359. #define RTC_ALRMAR_MNU_2 ((uint32_t)0x00000400)
  2360. #define RTC_ALRMAR_MNU_3 ((uint32_t)0x00000800)
  2361. #define RTC_ALRMAR_MSK1 ((uint32_t)0x00000080)
  2362. #define RTC_ALRMAR_ST ((uint32_t)0x00000070)
  2363. #define RTC_ALRMAR_ST_0 ((uint32_t)0x00000010)
  2364. #define RTC_ALRMAR_ST_1 ((uint32_t)0x00000020)
  2365. #define RTC_ALRMAR_ST_2 ((uint32_t)0x00000040)
  2366. #define RTC_ALRMAR_SU ((uint32_t)0x0000000F)
  2367. #define RTC_ALRMAR_SU_0 ((uint32_t)0x00000001)
  2368. #define RTC_ALRMAR_SU_1 ((uint32_t)0x00000002)
  2369. #define RTC_ALRMAR_SU_2 ((uint32_t)0x00000004)
  2370. #define RTC_ALRMAR_SU_3 ((uint32_t)0x00000008)
  2371. /******************** Bits definition for RTC_ALRMBR register ***************/
  2372. #define RTC_ALRMBR_MSK4 ((uint32_t)0x80000000)
  2373. #define RTC_ALRMBR_WDSEL ((uint32_t)0x40000000)
  2374. #define RTC_ALRMBR_DT ((uint32_t)0x30000000)
  2375. #define RTC_ALRMBR_DT_0 ((uint32_t)0x10000000)
  2376. #define RTC_ALRMBR_DT_1 ((uint32_t)0x20000000)
  2377. #define RTC_ALRMBR_DU ((uint32_t)0x0F000000)
  2378. #define RTC_ALRMBR_DU_0 ((uint32_t)0x01000000)
  2379. #define RTC_ALRMBR_DU_1 ((uint32_t)0x02000000)
  2380. #define RTC_ALRMBR_DU_2 ((uint32_t)0x04000000)
  2381. #define RTC_ALRMBR_DU_3 ((uint32_t)0x08000000)
  2382. #define RTC_ALRMBR_MSK3 ((uint32_t)0x00800000)
  2383. #define RTC_ALRMBR_PM ((uint32_t)0x00400000)
  2384. #define RTC_ALRMBR_HT ((uint32_t)0x00300000)
  2385. #define RTC_ALRMBR_HT_0 ((uint32_t)0x00100000)
  2386. #define RTC_ALRMBR_HT_1 ((uint32_t)0x00200000)
  2387. #define RTC_ALRMBR_HU ((uint32_t)0x000F0000)
  2388. #define RTC_ALRMBR_HU_0 ((uint32_t)0x00010000)
  2389. #define RTC_ALRMBR_HU_1 ((uint32_t)0x00020000)
  2390. #define RTC_ALRMBR_HU_2 ((uint32_t)0x00040000)
  2391. #define RTC_ALRMBR_HU_3 ((uint32_t)0x00080000)
  2392. #define RTC_ALRMBR_MSK2 ((uint32_t)0x00008000)
  2393. #define RTC_ALRMBR_MNT ((uint32_t)0x00007000)
  2394. #define RTC_ALRMBR_MNT_0 ((uint32_t)0x00001000)
  2395. #define RTC_ALRMBR_MNT_1 ((uint32_t)0x00002000)
  2396. #define RTC_ALRMBR_MNT_2 ((uint32_t)0x00004000)
  2397. #define RTC_ALRMBR_MNU ((uint32_t)0x00000F00)
  2398. #define RTC_ALRMBR_MNU_0 ((uint32_t)0x00000100)
  2399. #define RTC_ALRMBR_MNU_1 ((uint32_t)0x00000200)
  2400. #define RTC_ALRMBR_MNU_2 ((uint32_t)0x00000400)
  2401. #define RTC_ALRMBR_MNU_3 ((uint32_t)0x00000800)
  2402. #define RTC_ALRMBR_MSK1 ((uint32_t)0x00000080)
  2403. #define RTC_ALRMBR_ST ((uint32_t)0x00000070)
  2404. #define RTC_ALRMBR_ST_0 ((uint32_t)0x00000010)
  2405. #define RTC_ALRMBR_ST_1 ((uint32_t)0x00000020)
  2406. #define RTC_ALRMBR_ST_2 ((uint32_t)0x00000040)
  2407. #define RTC_ALRMBR_SU ((uint32_t)0x0000000F)
  2408. #define RTC_ALRMBR_SU_0 ((uint32_t)0x00000001)
  2409. #define RTC_ALRMBR_SU_1 ((uint32_t)0x00000002)
  2410. #define RTC_ALRMBR_SU_2 ((uint32_t)0x00000004)
  2411. #define RTC_ALRMBR_SU_3 ((uint32_t)0x00000008)
  2412. /******************** Bits definition for RTC_WPR register ******************/
  2413. #define RTC_WPR_KEY ((uint32_t)0x000000FF)
  2414. /******************** Bits definition for RTC_SSR register ******************/
  2415. #define RTC_SSR_SS ((uint32_t)0x0000FFFF)
  2416. /******************** Bits definition for RTC_SHIFTR register ***************/
  2417. #define RTC_SHIFTR_SUBFS ((uint32_t)0x00007FFF)
  2418. #define RTC_SHIFTR_ADD1S ((uint32_t)0x80000000)
  2419. /******************** Bits definition for RTC_TSTR register *****************/
  2420. #define RTC_TSTR_PM ((uint32_t)0x00400000)
  2421. #define RTC_TSTR_HT ((uint32_t)0x00300000)
  2422. #define RTC_TSTR_HT_0 ((uint32_t)0x00100000)
  2423. #define RTC_TSTR_HT_1 ((uint32_t)0x00200000)
  2424. #define RTC_TSTR_HU ((uint32_t)0x000F0000)
  2425. #define RTC_TSTR_HU_0 ((uint32_t)0x00010000)
  2426. #define RTC_TSTR_HU_1 ((uint32_t)0x00020000)
  2427. #define RTC_TSTR_HU_2 ((uint32_t)0x00040000)
  2428. #define RTC_TSTR_HU_3 ((uint32_t)0x00080000)
  2429. #define RTC_TSTR_MNT ((uint32_t)0x00007000)
  2430. #define RTC_TSTR_MNT_0 ((uint32_t)0x00001000)
  2431. #define RTC_TSTR_MNT_1 ((uint32_t)0x00002000)
  2432. #define RTC_TSTR_MNT_2 ((uint32_t)0x00004000)
  2433. #define RTC_TSTR_MNU ((uint32_t)0x00000F00)
  2434. #define RTC_TSTR_MNU_0 ((uint32_t)0x00000100)
  2435. #define RTC_TSTR_MNU_1 ((uint32_t)0x00000200)
  2436. #define RTC_TSTR_MNU_2 ((uint32_t)0x00000400)
  2437. #define RTC_TSTR_MNU_3 ((uint32_t)0x00000800)
  2438. #define RTC_TSTR_ST ((uint32_t)0x00000070)
  2439. #define RTC_TSTR_ST_0 ((uint32_t)0x00000010)
  2440. #define RTC_TSTR_ST_1 ((uint32_t)0x00000020)
  2441. #define RTC_TSTR_ST_2 ((uint32_t)0x00000040)
  2442. #define RTC_TSTR_SU ((uint32_t)0x0000000F)
  2443. #define RTC_TSTR_SU_0 ((uint32_t)0x00000001)
  2444. #define RTC_TSTR_SU_1 ((uint32_t)0x00000002)
  2445. #define RTC_TSTR_SU_2 ((uint32_t)0x00000004)
  2446. #define RTC_TSTR_SU_3 ((uint32_t)0x00000008)
  2447. /******************** Bits definition for RTC_TSDR register *****************/
  2448. #define RTC_TSDR_WDU ((uint32_t)0x0000E000)
  2449. #define RTC_TSDR_WDU_0 ((uint32_t)0x00002000)
  2450. #define RTC_TSDR_WDU_1 ((uint32_t)0x00004000)
  2451. #define RTC_TSDR_WDU_2 ((uint32_t)0x00008000)
  2452. #define RTC_TSDR_MT ((uint32_t)0x00001000)
  2453. #define RTC_TSDR_MU ((uint32_t)0x00000F00)
  2454. #define RTC_TSDR_MU_0 ((uint32_t)0x00000100)
  2455. #define RTC_TSDR_MU_1 ((uint32_t)0x00000200)
  2456. #define RTC_TSDR_MU_2 ((uint32_t)0x00000400)
  2457. #define RTC_TSDR_MU_3 ((uint32_t)0x00000800)
  2458. #define RTC_TSDR_DT ((uint32_t)0x00000030)
  2459. #define RTC_TSDR_DT_0 ((uint32_t)0x00000010)
  2460. #define RTC_TSDR_DT_1 ((uint32_t)0x00000020)
  2461. #define RTC_TSDR_DU ((uint32_t)0x0000000F)
  2462. #define RTC_TSDR_DU_0 ((uint32_t)0x00000001)
  2463. #define RTC_TSDR_DU_1 ((uint32_t)0x00000002)
  2464. #define RTC_TSDR_DU_2 ((uint32_t)0x00000004)
  2465. #define RTC_TSDR_DU_3 ((uint32_t)0x00000008)
  2466. /******************** Bits definition for RTC_TSSSR register ****************/
  2467. #define RTC_TSSSR_SS ((uint32_t)0x0000FFFF)
  2468. /******************** Bits definition for RTC_CAL register *****************/
  2469. #define RTC_CALR_CALP ((uint32_t)0x00008000)
  2470. #define RTC_CALR_CALW8 ((uint32_t)0x00004000)
  2471. #define RTC_CALR_CALW16 ((uint32_t)0x00002000)
  2472. #define RTC_CALR_CALM ((uint32_t)0x000001FF)
  2473. #define RTC_CALR_CALM_0 ((uint32_t)0x00000001)
  2474. #define RTC_CALR_CALM_1 ((uint32_t)0x00000002)
  2475. #define RTC_CALR_CALM_2 ((uint32_t)0x00000004)
  2476. #define RTC_CALR_CALM_3 ((uint32_t)0x00000008)
  2477. #define RTC_CALR_CALM_4 ((uint32_t)0x00000010)
  2478. #define RTC_CALR_CALM_5 ((uint32_t)0x00000020)
  2479. #define RTC_CALR_CALM_6 ((uint32_t)0x00000040)
  2480. #define RTC_CALR_CALM_7 ((uint32_t)0x00000080)
  2481. #define RTC_CALR_CALM_8 ((uint32_t)0x00000100)
  2482. /******************** Bits definition for RTC_TAFCR register ****************/
  2483. #define RTC_TAFCR_ALARMOUTTYPE ((uint32_t)0x00040000)
  2484. #define RTC_TAFCR_TSINSEL ((uint32_t)0x00020000)
  2485. #define RTC_TAFCR_TAMPINSEL ((uint32_t)0x00010000)
  2486. #define RTC_TAFCR_TAMPPUDIS ((uint32_t)0x00008000)
  2487. #define RTC_TAFCR_TAMPPRCH ((uint32_t)0x00006000)
  2488. #define RTC_TAFCR_TAMPPRCH_0 ((uint32_t)0x00002000)
  2489. #define RTC_TAFCR_TAMPPRCH_1 ((uint32_t)0x00004000)
  2490. #define RTC_TAFCR_TAMPFLT ((uint32_t)0x00001800)
  2491. #define RTC_TAFCR_TAMPFLT_0 ((uint32_t)0x00000800)
  2492. #define RTC_TAFCR_TAMPFLT_1 ((uint32_t)0x00001000)
  2493. #define RTC_TAFCR_TAMPFREQ ((uint32_t)0x00000700)
  2494. #define RTC_TAFCR_TAMPFREQ_0 ((uint32_t)0x00000100)
  2495. #define RTC_TAFCR_TAMPFREQ_1 ((uint32_t)0x00000200)
  2496. #define RTC_TAFCR_TAMPFREQ_2 ((uint32_t)0x00000400)
  2497. #define RTC_TAFCR_TAMPTS ((uint32_t)0x00000080)
  2498. #define RTC_TAFCR_TAMP2TRG ((uint32_t)0x00000010)
  2499. #define RTC_TAFCR_TAMP2E ((uint32_t)0x00000008)
  2500. #define RTC_TAFCR_TAMPIE ((uint32_t)0x00000004)
  2501. #define RTC_TAFCR_TAMP1TRG ((uint32_t)0x00000002)
  2502. #define RTC_TAFCR_TAMP1E ((uint32_t)0x00000001)
  2503. /******************** Bits definition for RTC_ALRMASSR register *************/
  2504. #define RTC_ALRMASSR_MASKSS ((uint32_t)0x0F000000)
  2505. #define RTC_ALRMASSR_MASKSS_0 ((uint32_t)0x01000000)
  2506. #define RTC_ALRMASSR_MASKSS_1 ((uint32_t)0x02000000)
  2507. #define RTC_ALRMASSR_MASKSS_2 ((uint32_t)0x04000000)
  2508. #define RTC_ALRMASSR_MASKSS_3 ((uint32_t)0x08000000)
  2509. #define RTC_ALRMASSR_SS ((uint32_t)0x00007FFF)
  2510. /******************** Bits definition for RTC_ALRMBSSR register *************/
  2511. #define RTC_ALRMBSSR_MASKSS ((uint32_t)0x0F000000)
  2512. #define RTC_ALRMBSSR_MASKSS_0 ((uint32_t)0x01000000)
  2513. #define RTC_ALRMBSSR_MASKSS_1 ((uint32_t)0x02000000)
  2514. #define RTC_ALRMBSSR_MASKSS_2 ((uint32_t)0x04000000)
  2515. #define RTC_ALRMBSSR_MASKSS_3 ((uint32_t)0x08000000)
  2516. #define RTC_ALRMBSSR_SS ((uint32_t)0x00007FFF)
  2517. /******************** Bits definition for RTC_BKP0R register ****************/
  2518. #define RTC_BKP0R ((uint32_t)0xFFFFFFFF)
  2519. /******************** Bits definition for RTC_BKP1R register ****************/
  2520. #define RTC_BKP1R ((uint32_t)0xFFFFFFFF)
  2521. /******************** Bits definition for RTC_BKP2R register ****************/
  2522. #define RTC_BKP2R ((uint32_t)0xFFFFFFFF)
  2523. /******************** Bits definition for RTC_BKP3R register ****************/
  2524. #define RTC_BKP3R ((uint32_t)0xFFFFFFFF)
  2525. /******************** Bits definition for RTC_BKP4R register ****************/
  2526. #define RTC_BKP4R ((uint32_t)0xFFFFFFFF)
  2527. /******************** Bits definition for RTC_BKP5R register ****************/
  2528. #define RTC_BKP5R ((uint32_t)0xFFFFFFFF)
  2529. /******************** Bits definition for RTC_BKP6R register ****************/
  2530. #define RTC_BKP6R ((uint32_t)0xFFFFFFFF)
  2531. /******************** Bits definition for RTC_BKP7R register ****************/
  2532. #define RTC_BKP7R ((uint32_t)0xFFFFFFFF)
  2533. /******************** Bits definition for RTC_BKP8R register ****************/
  2534. #define RTC_BKP8R ((uint32_t)0xFFFFFFFF)
  2535. /******************** Bits definition for RTC_BKP9R register ****************/
  2536. #define RTC_BKP9R ((uint32_t)0xFFFFFFFF)
  2537. /******************** Bits definition for RTC_BKP10R register ***************/
  2538. #define RTC_BKP10R ((uint32_t)0xFFFFFFFF)
  2539. /******************** Bits definition for RTC_BKP11R register ***************/
  2540. #define RTC_BKP11R ((uint32_t)0xFFFFFFFF)
  2541. /******************** Bits definition for RTC_BKP12R register ***************/
  2542. #define RTC_BKP12R ((uint32_t)0xFFFFFFFF)
  2543. /******************** Bits definition for RTC_BKP13R register ***************/
  2544. #define RTC_BKP13R ((uint32_t)0xFFFFFFFF)
  2545. /******************** Bits definition for RTC_BKP14R register ***************/
  2546. #define RTC_BKP14R ((uint32_t)0xFFFFFFFF)
  2547. /******************** Bits definition for RTC_BKP15R register ***************/
  2548. #define RTC_BKP15R ((uint32_t)0xFFFFFFFF)
  2549. /******************** Bits definition for RTC_BKP16R register ***************/
  2550. #define RTC_BKP16R ((uint32_t)0xFFFFFFFF)
  2551. /******************** Bits definition for RTC_BKP17R register ***************/
  2552. #define RTC_BKP17R ((uint32_t)0xFFFFFFFF)
  2553. /******************** Bits definition for RTC_BKP18R register ***************/
  2554. #define RTC_BKP18R ((uint32_t)0xFFFFFFFF)
  2555. /******************** Bits definition for RTC_BKP19R register ***************/
  2556. #define RTC_BKP19R ((uint32_t)0xFFFFFFFF)
  2557. /******************************************************************************/
  2558. /* */
  2559. /* Serial Peripheral Interface */
  2560. /* */
  2561. /******************************************************************************/
  2562. /******************* Bit definition for SPI_CR1 register ********************/
  2563. #define SPI_CR1_CPHA ((uint32_t)0x00000001) /*!<Clock Phase */
  2564. #define SPI_CR1_CPOL ((uint32_t)0x00000002) /*!<Clock Polarity */
  2565. #define SPI_CR1_MSTR ((uint32_t)0x00000004) /*!<Master Selection */
  2566. #define SPI_CR1_BR ((uint32_t)0x00000038) /*!<BR[2:0] bits (Baud Rate Control) */
  2567. #define SPI_CR1_BR_0 ((uint32_t)0x00000008) /*!<Bit 0 */
  2568. #define SPI_CR1_BR_1 ((uint32_t)0x00000010) /*!<Bit 1 */
  2569. #define SPI_CR1_BR_2 ((uint32_t)0x00000020) /*!<Bit 2 */
  2570. #define SPI_CR1_SPE ((uint32_t)0x00000040) /*!<SPI Enable */
  2571. #define SPI_CR1_LSBFIRST ((uint32_t)0x00000080) /*!<Frame Format */
  2572. #define SPI_CR1_SSI ((uint32_t)0x00000100) /*!<Internal slave select */
  2573. #define SPI_CR1_SSM ((uint32_t)0x00000200) /*!<Software slave management */
  2574. #define SPI_CR1_RXONLY ((uint32_t)0x00000400) /*!<Receive only */
  2575. #define SPI_CR1_DFF ((uint32_t)0x00000800) /*!<Data Frame Format */
  2576. #define SPI_CR1_CRCNEXT ((uint32_t)0x00001000) /*!<Transmit CRC next */
  2577. #define SPI_CR1_CRCEN ((uint32_t)0x00002000) /*!<Hardware CRC calculation enable */
  2578. #define SPI_CR1_BIDIOE ((uint32_t)0x00004000) /*!<Output enable in bidirectional mode */
  2579. #define SPI_CR1_BIDIMODE ((uint32_t)0x00008000) /*!<Bidirectional data mode enable */
  2580. /******************* Bit definition for SPI_CR2 register ********************/
  2581. #define SPI_CR2_RXDMAEN ((uint32_t)0x00000001) /*!<Rx Buffer DMA Enable */
  2582. #define SPI_CR2_TXDMAEN ((uint32_t)0x00000002) /*!<Tx Buffer DMA Enable */
  2583. #define SPI_CR2_SSOE ((uint32_t)0x00000004) /*!<SS Output Enable */
  2584. #define SPI_CR2_FRF ((uint32_t)0x00000010) /*!<Frame Format */
  2585. #define SPI_CR2_ERRIE ((uint32_t)0x00000020) /*!<Error Interrupt Enable */
  2586. #define SPI_CR2_RXNEIE ((uint32_t)0x00000040) /*!<RX buffer Not Empty Interrupt Enable */
  2587. #define SPI_CR2_TXEIE ((uint32_t)0x00000080) /*!<Tx buffer Empty Interrupt Enable */
  2588. /******************** Bit definition for SPI_SR register ********************/
  2589. #define SPI_SR_RXNE ((uint32_t)0x00000001) /*!<Receive buffer Not Empty */
  2590. #define SPI_SR_TXE ((uint32_t)0x00000002) /*!<Transmit buffer Empty */
  2591. #define SPI_SR_CHSIDE ((uint32_t)0x00000004) /*!<Channel side */
  2592. #define SPI_SR_UDR ((uint32_t)0x00000008) /*!<Underrun flag */
  2593. #define SPI_SR_CRCERR ((uint32_t)0x00000010) /*!<CRC Error flag */
  2594. #define SPI_SR_MODF ((uint32_t)0x00000020) /*!<Mode fault */
  2595. #define SPI_SR_OVR ((uint32_t)0x00000040) /*!<Overrun flag */
  2596. #define SPI_SR_BSY ((uint32_t)0x00000080) /*!<Busy flag */
  2597. #define SPI_SR_FRE ((uint32_t)0x00000100) /*!<Frame format error flag */
  2598. /******************** Bit definition for SPI_DR register ********************/
  2599. #define SPI_DR_DR ((uint32_t)0x0000FFFF) /*!<Data Register */
  2600. /******************* Bit definition for SPI_CRCPR register ******************/
  2601. #define SPI_CRCPR_CRCPOLY ((uint32_t)0x0000FFFF) /*!<CRC polynomial register */
  2602. /****************** Bit definition for SPI_RXCRCR register ******************/
  2603. #define SPI_RXCRCR_RXCRC ((uint32_t)0x0000FFFF) /*!<Rx CRC Register */
  2604. /****************** Bit definition for SPI_TXCRCR register ******************/
  2605. #define SPI_TXCRCR_TXCRC ((uint32_t)0x0000FFFF) /*!<Tx CRC Register */
  2606. /****************** Bit definition for SPI_I2SCFGR register *****************/
  2607. #define SPI_I2SCFGR_CHLEN ((uint32_t)0x00000001) /*!<Channel length (number of bits per audio channel) */
  2608. #define SPI_I2SCFGR_DATLEN ((uint32_t)0x00000006) /*!<DATLEN[1:0] bits (Data length to be transferred) */
  2609. #define SPI_I2SCFGR_DATLEN_0 ((uint32_t)0x00000002) /*!<Bit 0 */
  2610. #define SPI_I2SCFGR_DATLEN_1 ((uint32_t)0x00000004) /*!<Bit 1 */
  2611. #define SPI_I2SCFGR_CKPOL ((uint32_t)0x00000008) /*!<steady state clock polarity */
  2612. #define SPI_I2SCFGR_I2SSTD ((uint32_t)0x00000030) /*!<I2SSTD[1:0] bits (I2S standard selection) */
  2613. #define SPI_I2SCFGR_I2SSTD_0 ((uint32_t)0x00000010) /*!<Bit 0 */
  2614. #define SPI_I2SCFGR_I2SSTD_1 ((uint32_t)0x00000020) /*!<Bit 1 */
  2615. #define SPI_I2SCFGR_PCMSYNC ((uint32_t)0x00000080) /*!<PCM frame synchronization */
  2616. #define SPI_I2SCFGR_I2SCFG ((uint32_t)0x00000300) /*!<I2SCFG[1:0] bits (I2S configuration mode) */
  2617. #define SPI_I2SCFGR_I2SCFG_0 ((uint32_t)0x00000100) /*!<Bit 0 */
  2618. #define SPI_I2SCFGR_I2SCFG_1 ((uint32_t)0x00000200) /*!<Bit 1 */
  2619. #define SPI_I2SCFGR_I2SE ((uint32_t)0x00000400) /*!<I2S Enable */
  2620. #define SPI_I2SCFGR_I2SMOD ((uint32_t)0x00000800) /*!<I2S mode selection */
  2621. /****************** Bit definition for SPI_I2SPR register *******************/
  2622. #define SPI_I2SPR_I2SDIV ((uint32_t)0x000000FF) /*!<I2S Linear prescaler */
  2623. #define SPI_I2SPR_ODD ((uint32_t)0x00000100) /*!<Odd factor for the prescaler */
  2624. #define SPI_I2SPR_MCKOE ((uint32_t)0x00000200) /*!<Master Clock Output Enable */
  2625. /******************************************************************************/
  2626. /* */
  2627. /* SYSCFG */
  2628. /* */
  2629. /******************************************************************************/
  2630. /****************** Bit definition for SYSCFG_MEMRMP register ***************/
  2631. #define SYSCFG_MEMRMP_MEM_MODE ((uint32_t)0x00000007) /*!< SYSCFG_Memory Remap Config */
  2632. #define SYSCFG_MEMRMP_MEM_MODE_0 ((uint32_t)0x00000001)
  2633. #define SYSCFG_MEMRMP_MEM_MODE_1 ((uint32_t)0x00000002)
  2634. #define SYSCFG_MEMRMP_MEM_MODE_2 ((uint32_t)0x00000004)
  2635. /****************** Bit definition for SYSCFG_PMC register ******************/
  2636. #define SYSCFG_PMC_ADC1DC2 ((uint32_t)0x00010000) /*!< Refer to AN4073 on how to use this bit */
  2637. /***************** Bit definition for SYSCFG_EXTICR1 register ***************/
  2638. #define SYSCFG_EXTICR1_EXTI0 ((uint32_t)0x000F) /*!<EXTI 0 configuration */
  2639. #define SYSCFG_EXTICR1_EXTI1 ((uint32_t)0x00F0) /*!<EXTI 1 configuration */
  2640. #define SYSCFG_EXTICR1_EXTI2 ((uint32_t)0x0F00) /*!<EXTI 2 configuration */
  2641. #define SYSCFG_EXTICR1_EXTI3 ((uint32_t)0xF000) /*!<EXTI 3 configuration */
  2642. /**
  2643. * @brief EXTI0 configuration
  2644. */
  2645. #define SYSCFG_EXTICR1_EXTI0_PA ((uint32_t)0x0000) /*!<PA[0] pin */
  2646. #define SYSCFG_EXTICR1_EXTI0_PB ((uint32_t)0x0001) /*!<PB[0] pin */
  2647. #define SYSCFG_EXTICR1_EXTI0_PC ((uint32_t)0x0002) /*!<PC[0] pin */
  2648. #define SYSCFG_EXTICR1_EXTI0_PH ((uint32_t)0x0007) /*!<PH[0] pin */
  2649. /**
  2650. * @brief EXTI1 configuration
  2651. */
  2652. #define SYSCFG_EXTICR1_EXTI1_PA ((uint32_t)0x0000) /*!<PA[1] pin */
  2653. #define SYSCFG_EXTICR1_EXTI1_PB ((uint32_t)0x0010) /*!<PB[1] pin */
  2654. #define SYSCFG_EXTICR1_EXTI1_PC ((uint32_t)0x0020) /*!<PC[1] pin */
  2655. #define SYSCFG_EXTICR1_EXTI1_PH ((uint32_t)0x0070) /*!<PH[1] pin */
  2656. /**
  2657. * @brief EXTI2 configuration
  2658. */
  2659. #define SYSCFG_EXTICR1_EXTI2_PA ((uint32_t)0x0000) /*!<PA[2] pin */
  2660. #define SYSCFG_EXTICR1_EXTI2_PB ((uint32_t)0x0100) /*!<PB[2] pin */
  2661. #define SYSCFG_EXTICR1_EXTI2_PC ((uint32_t)0x0200) /*!<PC[2] pin */
  2662. #define SYSCFG_EXTICR1_EXTI2_PH ((uint32_t)0x0700) /*!<PH[2] pin */
  2663. /**
  2664. * @brief EXTI3 configuration
  2665. */
  2666. #define SYSCFG_EXTICR1_EXTI3_PA ((uint32_t)0x0000) /*!<PA[3] pin */
  2667. #define SYSCFG_EXTICR1_EXTI3_PB ((uint32_t)0x1000) /*!<PB[3] pin */
  2668. #define SYSCFG_EXTICR1_EXTI3_PC ((uint32_t)0x2000) /*!<PC[3] pin */
  2669. #define SYSCFG_EXTICR1_EXTI3_PH ((uint32_t)0x7000) /*!<PH[3] pin */
  2670. /***************** Bit definition for SYSCFG_EXTICR2 register ***************/
  2671. #define SYSCFG_EXTICR2_EXTI4 ((uint32_t)0x000F) /*!<EXTI 4 configuration */
  2672. #define SYSCFG_EXTICR2_EXTI5 ((uint32_t)0x00F0) /*!<EXTI 5 configuration */
  2673. #define SYSCFG_EXTICR2_EXTI6 ((uint32_t)0x0F00) /*!<EXTI 6 configuration */
  2674. #define SYSCFG_EXTICR2_EXTI7 ((uint32_t)0xF000) /*!<EXTI 7 configuration */
  2675. /**
  2676. * @brief EXTI4 configuration
  2677. */
  2678. #define SYSCFG_EXTICR2_EXTI4_PA ((uint32_t)0x0000) /*!<PA[4] pin */
  2679. #define SYSCFG_EXTICR2_EXTI4_PB ((uint32_t)0x0001) /*!<PB[4] pin */
  2680. #define SYSCFG_EXTICR2_EXTI4_PC ((uint32_t)0x0002) /*!<PC[4] pin */
  2681. #define SYSCFG_EXTICR2_EXTI4_PH ((uint32_t)0x0007) /*!<PH[4] pin */
  2682. /**
  2683. * @brief EXTI5 configuration
  2684. */
  2685. #define SYSCFG_EXTICR2_EXTI5_PA ((uint32_t)0x0000) /*!<PA[5] pin */
  2686. #define SYSCFG_EXTICR2_EXTI5_PB ((uint32_t)0x0010) /*!<PB[5] pin */
  2687. #define SYSCFG_EXTICR2_EXTI5_PC ((uint32_t)0x0020) /*!<PC[5] pin */
  2688. #define SYSCFG_EXTICR2_EXTI5_PH ((uint32_t)0x0070) /*!<PH[5] pin */
  2689. /**
  2690. * @brief EXTI6 configuration
  2691. */
  2692. #define SYSCFG_EXTICR2_EXTI6_PA ((uint32_t)0x0000) /*!<PA[6] pin */
  2693. #define SYSCFG_EXTICR2_EXTI6_PB ((uint32_t)0x0100) /*!<PB[6] pin */
  2694. #define SYSCFG_EXTICR2_EXTI6_PC ((uint32_t)0x0200) /*!<PC[6] pin */
  2695. #define SYSCFG_EXTICR2_EXTI6_PH ((uint32_t)0x0700) /*!<PH[6] pin */
  2696. /**
  2697. * @brief EXTI7 configuration
  2698. */
  2699. #define SYSCFG_EXTICR2_EXTI7_PA ((uint32_t)0x0000) /*!<PA[7] pin */
  2700. #define SYSCFG_EXTICR2_EXTI7_PB ((uint32_t)0x1000) /*!<PB[7] pin */
  2701. #define SYSCFG_EXTICR2_EXTI7_PC ((uint32_t)0x2000) /*!<PC[7] pin */
  2702. #define SYSCFG_EXTICR2_EXTI7_PH ((uint32_t)0x7000) /*!<PH[7] pin */
  2703. /***************** Bit definition for SYSCFG_EXTICR3 register ***************/
  2704. #define SYSCFG_EXTICR3_EXTI8 ((uint32_t)0x000F) /*!<EXTI 8 configuration */
  2705. #define SYSCFG_EXTICR3_EXTI9 ((uint32_t)0x00F0) /*!<EXTI 9 configuration */
  2706. #define SYSCFG_EXTICR3_EXTI10 ((uint32_t)0x0F00) /*!<EXTI 10 configuration */
  2707. #define SYSCFG_EXTICR3_EXTI11 ((uint32_t)0xF000) /*!<EXTI 11 configuration */
  2708. /**
  2709. * @brief EXTI8 configuration
  2710. */
  2711. #define SYSCFG_EXTICR3_EXTI8_PA ((uint32_t)0x0000) /*!<PA[8] pin */
  2712. #define SYSCFG_EXTICR3_EXTI8_PB ((uint32_t)0x0001) /*!<PB[8] pin */
  2713. #define SYSCFG_EXTICR3_EXTI8_PC ((uint32_t)0x0002) /*!<PC[8] pin */
  2714. #define SYSCFG_EXTICR3_EXTI8_PH ((uint32_t)0x0007) /*!<PH[8] pin */
  2715. /**
  2716. * @brief EXTI9 configuration
  2717. */
  2718. #define SYSCFG_EXTICR3_EXTI9_PA ((uint32_t)0x0000) /*!<PA[9] pin */
  2719. #define SYSCFG_EXTICR3_EXTI9_PB ((uint32_t)0x0010) /*!<PB[9] pin */
  2720. #define SYSCFG_EXTICR3_EXTI9_PC ((uint32_t)0x0020) /*!<PC[9] pin */
  2721. #define SYSCFG_EXTICR3_EXTI9_PH ((uint32_t)0x0070) /*!<PH[9] pin */
  2722. /**
  2723. * @brief EXTI10 configuration
  2724. */
  2725. #define SYSCFG_EXTICR3_EXTI10_PA ((uint32_t)0x0000) /*!<PA[10] pin */
  2726. #define SYSCFG_EXTICR3_EXTI10_PB ((uint32_t)0x0100) /*!<PB[10] pin */
  2727. #define SYSCFG_EXTICR3_EXTI10_PC ((uint32_t)0x0200) /*!<PC[10] pin */
  2728. #define SYSCFG_EXTICR3_EXTI10_PH ((uint32_t)0x0700) /*!<PH[10] pin */
  2729. /**
  2730. * @brief EXTI11 configuration
  2731. */
  2732. #define SYSCFG_EXTICR3_EXTI11_PA ((uint32_t)0x0000) /*!<PA[11] pin */
  2733. #define SYSCFG_EXTICR3_EXTI11_PB ((uint32_t)0x1000) /*!<PB[11] pin */
  2734. #define SYSCFG_EXTICR3_EXTI11_PC ((uint32_t)0x2000) /*!<PC[11] pin */
  2735. #define SYSCFG_EXTICR3_EXTI11_PH ((uint32_t)0x7000) /*!<PH[11] pin */
  2736. /***************** Bit definition for SYSCFG_EXTICR4 register ***************/
  2737. #define SYSCFG_EXTICR4_EXTI12 ((uint32_t)0x000F) /*!<EXTI 12 configuration */
  2738. #define SYSCFG_EXTICR4_EXTI13 ((uint32_t)0x00F0) /*!<EXTI 13 configuration */
  2739. #define SYSCFG_EXTICR4_EXTI14 ((uint32_t)0x0F00) /*!<EXTI 14 configuration */
  2740. #define SYSCFG_EXTICR4_EXTI15 ((uint32_t)0xF000) /*!<EXTI 15 configuration */
  2741. /**
  2742. * @brief EXTI12 configuration
  2743. */
  2744. #define SYSCFG_EXTICR4_EXTI12_PA ((uint32_t)0x0000) /*!<PA[12] pin */
  2745. #define SYSCFG_EXTICR4_EXTI12_PB ((uint32_t)0x0001) /*!<PB[12] pin */
  2746. #define SYSCFG_EXTICR4_EXTI12_PC ((uint32_t)0x0002) /*!<PC[12] pin */
  2747. #define SYSCFG_EXTICR4_EXTI12_PH ((uint32_t)0x0007) /*!<PH[12] pin */
  2748. /**
  2749. * @brief EXTI13 configuration
  2750. */
  2751. #define SYSCFG_EXTICR4_EXTI13_PA ((uint32_t)0x0000) /*!<PA[13] pin */
  2752. #define SYSCFG_EXTICR4_EXTI13_PB ((uint32_t)0x0010) /*!<PB[13] pin */
  2753. #define SYSCFG_EXTICR4_EXTI13_PC ((uint32_t)0x0020) /*!<PC[13] pin */
  2754. #define SYSCFG_EXTICR4_EXTI13_PH ((uint32_t)0x0070) /*!<PH[13] pin */
  2755. /**
  2756. * @brief EXTI14 configuration
  2757. */
  2758. #define SYSCFG_EXTICR4_EXTI14_PA ((uint32_t)0x0000) /*!<PA[14] pin */
  2759. #define SYSCFG_EXTICR4_EXTI14_PB ((uint32_t)0x0100) /*!<PB[14] pin */
  2760. #define SYSCFG_EXTICR4_EXTI14_PC ((uint32_t)0x0200) /*!<PC[14] pin */
  2761. #define SYSCFG_EXTICR4_EXTI14_PH ((uint32_t)0x0700) /*!<PH[14] pin */
  2762. /**
  2763. * @brief EXTI15 configuration
  2764. */
  2765. #define SYSCFG_EXTICR4_EXTI15_PA ((uint32_t)0x0000) /*!<PA[15] pin */
  2766. #define SYSCFG_EXTICR4_EXTI15_PB ((uint32_t)0x1000) /*!<PB[15] pin */
  2767. #define SYSCFG_EXTICR4_EXTI15_PC ((uint32_t)0x2000) /*!<PC[15] pin */
  2768. #define SYSCFG_EXTICR4_EXTI15_PH ((uint32_t)0x7000) /*!<PH[15] pin */
  2769. /****************** Bit definition for SYSCFG_CMPCR register ****************/
  2770. #define SYSCFG_CMPCR_CMP_PD ((uint32_t)0x00000001) /*!<Compensation cell ready flag */
  2771. #define SYSCFG_CMPCR_READY ((uint32_t)0x00000100) /*!<Compensation cell power-down */
  2772. /****************** Bit definition for SYSCFG_CFGR register *****************/
  2773. #define SYSCFG_CFGR_FMPI2C1_SCL ((uint32_t)0x00000001) /*!<FM+ drive capability for FMPI2C1_SCL pin */
  2774. #define SYSCFG_CFGR_FMPI2C1_SDA ((uint32_t)0x00000002) /*!<FM+ drive capability for FMPI2C1_SDA pin */
  2775. /****************** Bit definition for SYSCFG_CFGR2 register *****************/
  2776. #define SYSCFG_CFGR2_LOCKUP_LOCK ((uint32_t)0x00000001) /*!<Core Lockup lock */
  2777. #define SYSCFG_CFGR2_PVD_LOCK ((uint32_t)0x00000004) /*!<PVD Lock */
  2778. /******************************************************************************/
  2779. /* */
  2780. /* TIM */
  2781. /* */
  2782. /******************************************************************************/
  2783. /******************* Bit definition for TIM_CR1 register ********************/
  2784. #define TIM_CR1_CEN ((uint32_t)0x0001) /*!<Counter enable */
  2785. #define TIM_CR1_UDIS ((uint32_t)0x0002) /*!<Update disable */
  2786. #define TIM_CR1_URS ((uint32_t)0x0004) /*!<Update request source */
  2787. #define TIM_CR1_OPM ((uint32_t)0x0008) /*!<One pulse mode */
  2788. #define TIM_CR1_DIR ((uint32_t)0x0010) /*!<Direction */
  2789. #define TIM_CR1_CMS ((uint32_t)0x0060) /*!<CMS[1:0] bits (Center-aligned mode selection) */
  2790. #define TIM_CR1_CMS_0 ((uint32_t)0x0020) /*!<Bit 0 */
  2791. #define TIM_CR1_CMS_1 ((uint32_t)0x0040) /*!<Bit 1 */
  2792. #define TIM_CR1_ARPE ((uint32_t)0x0080) /*!<Auto-reload preload enable */
  2793. #define TIM_CR1_CKD ((uint32_t)0x0300) /*!<CKD[1:0] bits (clock division) */
  2794. #define TIM_CR1_CKD_0 ((uint32_t)0x0100) /*!<Bit 0 */
  2795. #define TIM_CR1_CKD_1 ((uint32_t)0x0200) /*!<Bit 1 */
  2796. /******************* Bit definition for TIM_CR2 register ********************/
  2797. #define TIM_CR2_CCPC ((uint32_t)0x0001) /*!<Capture/Compare Preloaded Control */
  2798. #define TIM_CR2_CCUS ((uint32_t)0x0004) /*!<Capture/Compare Control Update Selection */
  2799. #define TIM_CR2_CCDS ((uint32_t)0x0008) /*!<Capture/Compare DMA Selection */
  2800. #define TIM_CR2_MMS ((uint32_t)0x0070) /*!<MMS[2:0] bits (Master Mode Selection) */
  2801. #define TIM_CR2_MMS_0 ((uint32_t)0x0010) /*!<Bit 0 */
  2802. #define TIM_CR2_MMS_1 ((uint32_t)0x0020) /*!<Bit 1 */
  2803. #define TIM_CR2_MMS_2 ((uint32_t)0x0040) /*!<Bit 2 */
  2804. #define TIM_CR2_TI1S ((uint32_t)0x0080) /*!<TI1 Selection */
  2805. #define TIM_CR2_OIS1 ((uint32_t)0x0100) /*!<Output Idle state 1 (OC1 output) */
  2806. #define TIM_CR2_OIS1N ((uint32_t)0x0200) /*!<Output Idle state 1 (OC1N output) */
  2807. #define TIM_CR2_OIS2 ((uint32_t)0x0400) /*!<Output Idle state 2 (OC2 output) */
  2808. #define TIM_CR2_OIS2N ((uint32_t)0x0800) /*!<Output Idle state 2 (OC2N output) */
  2809. #define TIM_CR2_OIS3 ((uint32_t)0x1000) /*!<Output Idle state 3 (OC3 output) */
  2810. #define TIM_CR2_OIS3N ((uint32_t)0x2000) /*!<Output Idle state 3 (OC3N output) */
  2811. #define TIM_CR2_OIS4 ((uint32_t)0x4000) /*!<Output Idle state 4 (OC4 output) */
  2812. /******************* Bit definition for TIM_SMCR register *******************/
  2813. #define TIM_SMCR_SMS ((uint32_t)0x0007) /*!<SMS[2:0] bits (Slave mode selection) */
  2814. #define TIM_SMCR_SMS_0 ((uint32_t)0x0001) /*!<Bit 0 */
  2815. #define TIM_SMCR_SMS_1 ((uint32_t)0x0002) /*!<Bit 1 */
  2816. #define TIM_SMCR_SMS_2 ((uint32_t)0x0004) /*!<Bit 2 */
  2817. #define TIM_SMCR_TS ((uint32_t)0x0070) /*!<TS[2:0] bits (Trigger selection) */
  2818. #define TIM_SMCR_TS_0 ((uint32_t)0x0010) /*!<Bit 0 */
  2819. #define TIM_SMCR_TS_1 ((uint32_t)0x0020) /*!<Bit 1 */
  2820. #define TIM_SMCR_TS_2 ((uint32_t)0x0040) /*!<Bit 2 */
  2821. #define TIM_SMCR_MSM ((uint32_t)0x0080) /*!<Master/slave mode */
  2822. #define TIM_SMCR_ETF ((uint32_t)0x0F00) /*!<ETF[3:0] bits (External trigger filter) */
  2823. #define TIM_SMCR_ETF_0 ((uint32_t)0x0100) /*!<Bit 0 */
  2824. #define TIM_SMCR_ETF_1 ((uint32_t)0x0200) /*!<Bit 1 */
  2825. #define TIM_SMCR_ETF_2 ((uint32_t)0x0400) /*!<Bit 2 */
  2826. #define TIM_SMCR_ETF_3 ((uint32_t)0x0800) /*!<Bit 3 */
  2827. #define TIM_SMCR_ETPS ((uint32_t)0x3000) /*!<ETPS[1:0] bits (External trigger prescaler) */
  2828. #define TIM_SMCR_ETPS_0 ((uint32_t)0x1000) /*!<Bit 0 */
  2829. #define TIM_SMCR_ETPS_1 ((uint32_t)0x2000) /*!<Bit 1 */
  2830. #define TIM_SMCR_ECE ((uint32_t)0x4000) /*!<External clock enable */
  2831. #define TIM_SMCR_ETP ((uint32_t)0x8000) /*!<External trigger polarity */
  2832. /******************* Bit definition for TIM_DIER register *******************/
  2833. #define TIM_DIER_UIE ((uint32_t)0x0001) /*!<Update interrupt enable */
  2834. #define TIM_DIER_CC1IE ((uint32_t)0x0002) /*!<Capture/Compare 1 interrupt enable */
  2835. #define TIM_DIER_CC2IE ((uint32_t)0x0004) /*!<Capture/Compare 2 interrupt enable */
  2836. #define TIM_DIER_CC3IE ((uint32_t)0x0008) /*!<Capture/Compare 3 interrupt enable */
  2837. #define TIM_DIER_CC4IE ((uint32_t)0x0010) /*!<Capture/Compare 4 interrupt enable */
  2838. #define TIM_DIER_COMIE ((uint32_t)0x0020) /*!<COM interrupt enable */
  2839. #define TIM_DIER_TIE ((uint32_t)0x0040) /*!<Trigger interrupt enable */
  2840. #define TIM_DIER_BIE ((uint32_t)0x0080) /*!<Break interrupt enable */
  2841. #define TIM_DIER_UDE ((uint32_t)0x0100) /*!<Update DMA request enable */
  2842. #define TIM_DIER_CC1DE ((uint32_t)0x0200) /*!<Capture/Compare 1 DMA request enable */
  2843. #define TIM_DIER_CC2DE ((uint32_t)0x0400) /*!<Capture/Compare 2 DMA request enable */
  2844. #define TIM_DIER_CC3DE ((uint32_t)0x0800) /*!<Capture/Compare 3 DMA request enable */
  2845. #define TIM_DIER_CC4DE ((uint32_t)0x1000) /*!<Capture/Compare 4 DMA request enable */
  2846. #define TIM_DIER_COMDE ((uint32_t)0x2000) /*!<COM DMA request enable */
  2847. #define TIM_DIER_TDE ((uint32_t)0x4000) /*!<Trigger DMA request enable */
  2848. /******************** Bit definition for TIM_SR register ********************/
  2849. #define TIM_SR_UIF ((uint32_t)0x0001) /*!<Update interrupt Flag */
  2850. #define TIM_SR_CC1IF ((uint32_t)0x0002) /*!<Capture/Compare 1 interrupt Flag */
  2851. #define TIM_SR_CC2IF ((uint32_t)0x0004) /*!<Capture/Compare 2 interrupt Flag */
  2852. #define TIM_SR_CC3IF ((uint32_t)0x0008) /*!<Capture/Compare 3 interrupt Flag */
  2853. #define TIM_SR_CC4IF ((uint32_t)0x0010) /*!<Capture/Compare 4 interrupt Flag */
  2854. #define TIM_SR_COMIF ((uint32_t)0x0020) /*!<COM interrupt Flag */
  2855. #define TIM_SR_TIF ((uint32_t)0x0040) /*!<Trigger interrupt Flag */
  2856. #define TIM_SR_BIF ((uint32_t)0x0080) /*!<Break interrupt Flag */
  2857. #define TIM_SR_CC1OF ((uint32_t)0x0200) /*!<Capture/Compare 1 Overcapture Flag */
  2858. #define TIM_SR_CC2OF ((uint32_t)0x0400) /*!<Capture/Compare 2 Overcapture Flag */
  2859. #define TIM_SR_CC3OF ((uint32_t)0x0800) /*!<Capture/Compare 3 Overcapture Flag */
  2860. #define TIM_SR_CC4OF ((uint32_t)0x1000) /*!<Capture/Compare 4 Overcapture Flag */
  2861. /******************* Bit definition for TIM_EGR register ********************/
  2862. #define TIM_EGR_UG ((uint32_t)0x01) /*!<Update Generation */
  2863. #define TIM_EGR_CC1G ((uint32_t)0x02) /*!<Capture/Compare 1 Generation */
  2864. #define TIM_EGR_CC2G ((uint32_t)0x04) /*!<Capture/Compare 2 Generation */
  2865. #define TIM_EGR_CC3G ((uint32_t)0x08) /*!<Capture/Compare 3 Generation */
  2866. #define TIM_EGR_CC4G ((uint32_t)0x10) /*!<Capture/Compare 4 Generation */
  2867. #define TIM_EGR_COMG ((uint32_t)0x20) /*!<Capture/Compare Control Update Generation */
  2868. #define TIM_EGR_TG ((uint32_t)0x40) /*!<Trigger Generation */
  2869. #define TIM_EGR_BG ((uint32_t)0x80) /*!<Break Generation */
  2870. /****************** Bit definition for TIM_CCMR1 register *******************/
  2871. #define TIM_CCMR1_CC1S ((uint32_t)0x0003) /*!<CC1S[1:0] bits (Capture/Compare 1 Selection) */
  2872. #define TIM_CCMR1_CC1S_0 ((uint32_t)0x0001) /*!<Bit 0 */
  2873. #define TIM_CCMR1_CC1S_1 ((uint32_t)0x0002) /*!<Bit 1 */
  2874. #define TIM_CCMR1_OC1FE ((uint32_t)0x0004) /*!<Output Compare 1 Fast enable */
  2875. #define TIM_CCMR1_OC1PE ((uint32_t)0x0008) /*!<Output Compare 1 Preload enable */
  2876. #define TIM_CCMR1_OC1M ((uint32_t)0x0070) /*!<OC1M[2:0] bits (Output Compare 1 Mode) */
  2877. #define TIM_CCMR1_OC1M_0 ((uint32_t)0x0010) /*!<Bit 0 */
  2878. #define TIM_CCMR1_OC1M_1 ((uint32_t)0x0020) /*!<Bit 1 */
  2879. #define TIM_CCMR1_OC1M_2 ((uint32_t)0x0040) /*!<Bit 2 */
  2880. #define TIM_CCMR1_OC1CE ((uint32_t)0x0080) /*!<Output Compare 1Clear Enable */
  2881. #define TIM_CCMR1_CC2S ((uint32_t)0x0300) /*!<CC2S[1:0] bits (Capture/Compare 2 Selection) */
  2882. #define TIM_CCMR1_CC2S_0 ((uint32_t)0x0100) /*!<Bit 0 */
  2883. #define TIM_CCMR1_CC2S_1 ((uint32_t)0x0200) /*!<Bit 1 */
  2884. #define TIM_CCMR1_OC2FE ((uint32_t)0x0400) /*!<Output Compare 2 Fast enable */
  2885. #define TIM_CCMR1_OC2PE ((uint32_t)0x0800) /*!<Output Compare 2 Preload enable */
  2886. #define TIM_CCMR1_OC2M ((uint32_t)0x7000) /*!<OC2M[2:0] bits (Output Compare 2 Mode) */
  2887. #define TIM_CCMR1_OC2M_0 ((uint32_t)0x1000) /*!<Bit 0 */
  2888. #define TIM_CCMR1_OC2M_1 ((uint32_t)0x2000) /*!<Bit 1 */
  2889. #define TIM_CCMR1_OC2M_2 ((uint32_t)0x4000) /*!<Bit 2 */
  2890. #define TIM_CCMR1_OC2CE ((uint32_t)0x8000) /*!<Output Compare 2 Clear Enable */
  2891. /*----------------------------------------------------------------------------*/
  2892. #define TIM_CCMR1_IC1PSC ((uint32_t)0x000C) /*!<IC1PSC[1:0] bits (Input Capture 1 Prescaler) */
  2893. #define TIM_CCMR1_IC1PSC_0 ((uint32_t)0x0004) /*!<Bit 0 */
  2894. #define TIM_CCMR1_IC1PSC_1 ((uint32_t)0x0008) /*!<Bit 1 */
  2895. #define TIM_CCMR1_IC1F ((uint32_t)0x00F0) /*!<IC1F[3:0] bits (Input Capture 1 Filter) */
  2896. #define TIM_CCMR1_IC1F_0 ((uint32_t)0x0010) /*!<Bit 0 */
  2897. #define TIM_CCMR1_IC1F_1 ((uint32_t)0x0020) /*!<Bit 1 */
  2898. #define TIM_CCMR1_IC1F_2 ((uint32_t)0x0040) /*!<Bit 2 */
  2899. #define TIM_CCMR1_IC1F_3 ((uint32_t)0x0080) /*!<Bit 3 */
  2900. #define TIM_CCMR1_IC2PSC ((uint32_t)0x0C00) /*!<IC2PSC[1:0] bits (Input Capture 2 Prescaler) */
  2901. #define TIM_CCMR1_IC2PSC_0 ((uint32_t)0x0400) /*!<Bit 0 */
  2902. #define TIM_CCMR1_IC2PSC_1 ((uint32_t)0x0800) /*!<Bit 1 */
  2903. #define TIM_CCMR1_IC2F ((uint32_t)0xF000) /*!<IC2F[3:0] bits (Input Capture 2 Filter) */
  2904. #define TIM_CCMR1_IC2F_0 ((uint32_t)0x1000) /*!<Bit 0 */
  2905. #define TIM_CCMR1_IC2F_1 ((uint32_t)0x2000) /*!<Bit 1 */
  2906. #define TIM_CCMR1_IC2F_2 ((uint32_t)0x4000) /*!<Bit 2 */
  2907. #define TIM_CCMR1_IC2F_3 ((uint32_t)0x8000) /*!<Bit 3 */
  2908. /****************** Bit definition for TIM_CCMR2 register *******************/
  2909. #define TIM_CCMR2_CC3S ((uint32_t)0x0003) /*!<CC3S[1:0] bits (Capture/Compare 3 Selection) */
  2910. #define TIM_CCMR2_CC3S_0 ((uint32_t)0x0001) /*!<Bit 0 */
  2911. #define TIM_CCMR2_CC3S_1 ((uint32_t)0x0002) /*!<Bit 1 */
  2912. #define TIM_CCMR2_OC3FE ((uint32_t)0x0004) /*!<Output Compare 3 Fast enable */
  2913. #define TIM_CCMR2_OC3PE ((uint32_t)0x0008) /*!<Output Compare 3 Preload enable */
  2914. #define TIM_CCMR2_OC3M ((uint32_t)0x0070) /*!<OC3M[2:0] bits (Output Compare 3 Mode) */
  2915. #define TIM_CCMR2_OC3M_0 ((uint32_t)0x0010) /*!<Bit 0 */
  2916. #define TIM_CCMR2_OC3M_1 ((uint32_t)0x0020) /*!<Bit 1 */
  2917. #define TIM_CCMR2_OC3M_2 ((uint32_t)0x0040) /*!<Bit 2 */
  2918. #define TIM_CCMR2_OC3CE ((uint32_t)0x0080) /*!<Output Compare 3 Clear Enable */
  2919. #define TIM_CCMR2_CC4S ((uint32_t)0x0300) /*!<CC4S[1:0] bits (Capture/Compare 4 Selection) */
  2920. #define TIM_CCMR2_CC4S_0 ((uint32_t)0x0100) /*!<Bit 0 */
  2921. #define TIM_CCMR2_CC4S_1 ((uint32_t)0x0200) /*!<Bit 1 */
  2922. #define TIM_CCMR2_OC4FE ((uint32_t)0x0400) /*!<Output Compare 4 Fast enable */
  2923. #define TIM_CCMR2_OC4PE ((uint32_t)0x0800) /*!<Output Compare 4 Preload enable */
  2924. #define TIM_CCMR2_OC4M ((uint32_t)0x7000) /*!<OC4M[2:0] bits (Output Compare 4 Mode) */
  2925. #define TIM_CCMR2_OC4M_0 ((uint32_t)0x1000) /*!<Bit 0 */
  2926. #define TIM_CCMR2_OC4M_1 ((uint32_t)0x2000) /*!<Bit 1 */
  2927. #define TIM_CCMR2_OC4M_2 ((uint32_t)0x4000) /*!<Bit 2 */
  2928. #define TIM_CCMR2_OC4CE ((uint32_t)0x8000) /*!<Output Compare 4 Clear Enable */
  2929. /*----------------------------------------------------------------------------*/
  2930. #define TIM_CCMR2_IC3PSC ((uint32_t)0x000C) /*!<IC3PSC[1:0] bits (Input Capture 3 Prescaler) */
  2931. #define TIM_CCMR2_IC3PSC_0 ((uint32_t)0x0004) /*!<Bit 0 */
  2932. #define TIM_CCMR2_IC3PSC_1 ((uint32_t)0x0008) /*!<Bit 1 */
  2933. #define TIM_CCMR2_IC3F ((uint32_t)0x00F0) /*!<IC3F[3:0] bits (Input Capture 3 Filter) */
  2934. #define TIM_CCMR2_IC3F_0 ((uint32_t)0x0010) /*!<Bit 0 */
  2935. #define TIM_CCMR2_IC3F_1 ((uint32_t)0x0020) /*!<Bit 1 */
  2936. #define TIM_CCMR2_IC3F_2 ((uint32_t)0x0040) /*!<Bit 2 */
  2937. #define TIM_CCMR2_IC3F_3 ((uint32_t)0x0080) /*!<Bit 3 */
  2938. #define TIM_CCMR2_IC4PSC ((uint32_t)0x0C00) /*!<IC4PSC[1:0] bits (Input Capture 4 Prescaler) */
  2939. #define TIM_CCMR2_IC4PSC_0 ((uint32_t)0x0400) /*!<Bit 0 */
  2940. #define TIM_CCMR2_IC4PSC_1 ((uint32_t)0x0800) /*!<Bit 1 */
  2941. #define TIM_CCMR2_IC4F ((uint32_t)0xF000) /*!<IC4F[3:0] bits (Input Capture 4 Filter) */
  2942. #define TIM_CCMR2_IC4F_0 ((uint32_t)0x1000) /*!<Bit 0 */
  2943. #define TIM_CCMR2_IC4F_1 ((uint32_t)0x2000) /*!<Bit 1 */
  2944. #define TIM_CCMR2_IC4F_2 ((uint32_t)0x4000) /*!<Bit 2 */
  2945. #define TIM_CCMR2_IC4F_3 ((uint32_t)0x8000) /*!<Bit 3 */
  2946. /******************* Bit definition for TIM_CCER register *******************/
  2947. #define TIM_CCER_CC1E ((uint32_t)0x0001) /*!<Capture/Compare 1 output enable */
  2948. #define TIM_CCER_CC1P ((uint32_t)0x0002) /*!<Capture/Compare 1 output Polarity */
  2949. #define TIM_CCER_CC1NE ((uint32_t)0x0004) /*!<Capture/Compare 1 Complementary output enable */
  2950. #define TIM_CCER_CC1NP ((uint32_t)0x0008) /*!<Capture/Compare 1 Complementary output Polarity */
  2951. #define TIM_CCER_CC2E ((uint32_t)0x0010) /*!<Capture/Compare 2 output enable */
  2952. #define TIM_CCER_CC2P ((uint32_t)0x0020) /*!<Capture/Compare 2 output Polarity */
  2953. #define TIM_CCER_CC2NE ((uint32_t)0x0040) /*!<Capture/Compare 2 Complementary output enable */
  2954. #define TIM_CCER_CC2NP ((uint32_t)0x0080) /*!<Capture/Compare 2 Complementary output Polarity */
  2955. #define TIM_CCER_CC3E ((uint32_t)0x0100) /*!<Capture/Compare 3 output enable */
  2956. #define TIM_CCER_CC3P ((uint32_t)0x0200) /*!<Capture/Compare 3 output Polarity */
  2957. #define TIM_CCER_CC3NE ((uint32_t)0x0400) /*!<Capture/Compare 3 Complementary output enable */
  2958. #define TIM_CCER_CC3NP ((uint32_t)0x0800) /*!<Capture/Compare 3 Complementary output Polarity */
  2959. #define TIM_CCER_CC4E ((uint32_t)0x1000) /*!<Capture/Compare 4 output enable */
  2960. #define TIM_CCER_CC4P ((uint32_t)0x2000) /*!<Capture/Compare 4 output Polarity */
  2961. #define TIM_CCER_CC4NP ((uint32_t)0x8000) /*!<Capture/Compare 4 Complementary output Polarity */
  2962. /******************* Bit definition for TIM_CNT register ********************/
  2963. #define TIM_CNT_CNT ((uint32_t)0xFFFF) /*!<Counter Value */
  2964. /******************* Bit definition for TIM_PSC register ********************/
  2965. #define TIM_PSC_PSC ((uint32_t)0xFFFF) /*!<Prescaler Value */
  2966. /******************* Bit definition for TIM_ARR register ********************/
  2967. #define TIM_ARR_ARR ((uint32_t)0xFFFF) /*!<actual auto-reload Value */
  2968. /******************* Bit definition for TIM_RCR register ********************/
  2969. #define TIM_RCR_REP ((uint32_t)0xFF) /*!<Repetition Counter Value */
  2970. /******************* Bit definition for TIM_CCR1 register *******************/
  2971. #define TIM_CCR1_CCR1 ((uint32_t)0xFFFF) /*!<Capture/Compare 1 Value */
  2972. /******************* Bit definition for TIM_CCR2 register *******************/
  2973. #define TIM_CCR2_CCR2 ((uint32_t)0xFFFF) /*!<Capture/Compare 2 Value */
  2974. /******************* Bit definition for TIM_CCR3 register *******************/
  2975. #define TIM_CCR3_CCR3 ((uint32_t)0xFFFF) /*!<Capture/Compare 3 Value */
  2976. /******************* Bit definition for TIM_CCR4 register *******************/
  2977. #define TIM_CCR4_CCR4 ((uint32_t)0xFFFF) /*!<Capture/Compare 4 Value */
  2978. /******************* Bit definition for TIM_BDTR register *******************/
  2979. #define TIM_BDTR_DTG ((uint32_t)0x00FF) /*!<DTG[0:7] bits (Dead-Time Generator set-up) */
  2980. #define TIM_BDTR_DTG_0 ((uint32_t)0x0001) /*!<Bit 0 */
  2981. #define TIM_BDTR_DTG_1 ((uint32_t)0x0002) /*!<Bit 1 */
  2982. #define TIM_BDTR_DTG_2 ((uint32_t)0x0004) /*!<Bit 2 */
  2983. #define TIM_BDTR_DTG_3 ((uint32_t)0x0008) /*!<Bit 3 */
  2984. #define TIM_BDTR_DTG_4 ((uint32_t)0x0010) /*!<Bit 4 */
  2985. #define TIM_BDTR_DTG_5 ((uint32_t)0x0020) /*!<Bit 5 */
  2986. #define TIM_BDTR_DTG_6 ((uint32_t)0x0040) /*!<Bit 6 */
  2987. #define TIM_BDTR_DTG_7 ((uint32_t)0x0080) /*!<Bit 7 */
  2988. #define TIM_BDTR_LOCK ((uint32_t)0x0300) /*!<LOCK[1:0] bits (Lock Configuration) */
  2989. #define TIM_BDTR_LOCK_0 ((uint32_t)0x0100) /*!<Bit 0 */
  2990. #define TIM_BDTR_LOCK_1 ((uint32_t)0x0200) /*!<Bit 1 */
  2991. #define TIM_BDTR_OSSI ((uint32_t)0x0400) /*!<Off-State Selection for Idle mode */
  2992. #define TIM_BDTR_OSSR ((uint32_t)0x0800) /*!<Off-State Selection for Run mode */
  2993. #define TIM_BDTR_BKE ((uint32_t)0x1000) /*!<Break enable */
  2994. #define TIM_BDTR_BKP ((uint32_t)0x2000) /*!<Break Polarity */
  2995. #define TIM_BDTR_AOE ((uint32_t)0x4000) /*!<Automatic Output enable */
  2996. #define TIM_BDTR_MOE ((uint32_t)0x8000) /*!<Main Output enable */
  2997. /******************* Bit definition for TIM_DCR register ********************/
  2998. #define TIM_DCR_DBA ((uint32_t)0x001F) /*!<DBA[4:0] bits (DMA Base Address) */
  2999. #define TIM_DCR_DBA_0 ((uint32_t)0x0001) /*!<Bit 0 */
  3000. #define TIM_DCR_DBA_1 ((uint32_t)0x0002) /*!<Bit 1 */
  3001. #define TIM_DCR_DBA_2 ((uint32_t)0x0004) /*!<Bit 2 */
  3002. #define TIM_DCR_DBA_3 ((uint32_t)0x0008) /*!<Bit 3 */
  3003. #define TIM_DCR_DBA_4 ((uint32_t)0x0010) /*!<Bit 4 */
  3004. #define TIM_DCR_DBL ((uint32_t)0x1F00) /*!<DBL[4:0] bits (DMA Burst Length) */
  3005. #define TIM_DCR_DBL_0 ((uint32_t)0x0100) /*!<Bit 0 */
  3006. #define TIM_DCR_DBL_1 ((uint32_t)0x0200) /*!<Bit 1 */
  3007. #define TIM_DCR_DBL_2 ((uint32_t)0x0400) /*!<Bit 2 */
  3008. #define TIM_DCR_DBL_3 ((uint32_t)0x0800) /*!<Bit 3 */
  3009. #define TIM_DCR_DBL_4 ((uint32_t)0x1000) /*!<Bit 4 */
  3010. /******************* Bit definition for TIM_DMAR register *******************/
  3011. #define TIM_DMAR_DMAB ((uint32_t)0xFFFF) /*!<DMA register for burst accesses */
  3012. /******************* Bit definition for TIM_OR register *********************/
  3013. #define TIM_OR_TI4_RMP ((uint32_t)0x00C0) /*!<TI4_RMP[1:0] bits (TIM5 Input 4 remap) */
  3014. #define TIM_OR_TI4_RMP_0 ((uint32_t)0x0040) /*!<Bit 0 */
  3015. #define TIM_OR_TI4_RMP_1 ((uint32_t)0x0080) /*!<Bit 1 */
  3016. /******************************************************************************/
  3017. /* */
  3018. /* Low Power Timer (LPTIM) */
  3019. /* */
  3020. /******************************************************************************/
  3021. /****************** Bit definition for LPTIM_ISR register *******************/
  3022. #define LPTIM_ISR_CMPM ((uint32_t)0x00000001) /*!< Compare match */
  3023. #define LPTIM_ISR_ARRM ((uint32_t)0x00000002) /*!< Autoreload match */
  3024. #define LPTIM_ISR_EXTTRIG ((uint32_t)0x00000004) /*!< External trigger edge event */
  3025. #define LPTIM_ISR_CMPOK ((uint32_t)0x00000008) /*!< Compare register update OK */
  3026. #define LPTIM_ISR_ARROK ((uint32_t)0x00000010) /*!< Autoreload register update OK */
  3027. #define LPTIM_ISR_UP ((uint32_t)0x00000020) /*!< Counter direction change down to up */
  3028. #define LPTIM_ISR_DOWN ((uint32_t)0x00000040) /*!< Counter direction change up to down */
  3029. /****************** Bit definition for LPTIM_ICR register *******************/
  3030. #define LPTIM_ICR_CMPMCF ((uint32_t)0x00000001) /*!< Compare match Clear Flag */
  3031. #define LPTIM_ICR_ARRMCF ((uint32_t)0x00000002) /*!< Autoreload match Clear Flag */
  3032. #define LPTIM_ICR_EXTTRIGCF ((uint32_t)0x00000004) /*!< External trigger edge event Clear Flag */
  3033. #define LPTIM_ICR_CMPOKCF ((uint32_t)0x00000008) /*!< Compare register update OK Clear Flag */
  3034. #define LPTIM_ICR_ARROKCF ((uint32_t)0x00000010) /*!< Autoreload register update OK Clear Flag */
  3035. #define LPTIM_ICR_UPCF ((uint32_t)0x00000020) /*!< Counter direction change down to up Clear Flag */
  3036. #define LPTIM_ICR_DOWNCF ((uint32_t)0x00000040) /*!< Counter direction change up to down Clear Flag */
  3037. /****************** Bit definition for LPTIM_IER register ********************/
  3038. #define LPTIM_IER_CMPMIE ((uint32_t)0x00000001) /*!< Compare match Interrupt Enable */
  3039. #define LPTIM_IER_ARRMIE ((uint32_t)0x00000002) /*!< Autoreload match Interrupt Enable */
  3040. #define LPTIM_IER_EXTTRIGIE ((uint32_t)0x00000004) /*!< External trigger edge event Interrupt Enable */
  3041. #define LPTIM_IER_CMPOKIE ((uint32_t)0x00000008) /*!< Compare register update OK Interrupt Enable */
  3042. #define LPTIM_IER_ARROKIE ((uint32_t)0x00000010) /*!< Autoreload register update OK Interrupt Enable */
  3043. #define LPTIM_IER_UPIE ((uint32_t)0x00000020) /*!< Counter direction change down to up Interrupt Enable */
  3044. #define LPTIM_IER_DOWNIE ((uint32_t)0x00000040) /*!< Counter direction change up to down Interrupt Enable */
  3045. /****************** Bit definition for LPTIM_CFGR register *******************/
  3046. #define LPTIM_CFGR_CKSEL ((uint32_t)0x00000001) /*!< Clock selector */
  3047. #define LPTIM_CFGR_CKPOL ((uint32_t)0x00000006) /*!< CKPOL[1:0] bits (Clock polarity) */
  3048. #define LPTIM_CFGR_CKPOL_0 ((uint32_t)0x00000002) /*!< Bit 0 */
  3049. #define LPTIM_CFGR_CKPOL_1 ((uint32_t)0x00000004) /*!< Bit 1 */
  3050. #define LPTIM_CFGR_CKFLT ((uint32_t)0x00000018) /*!< CKFLT[1:0] bits (Configurable digital filter for external clock) */
  3051. #define LPTIM_CFGR_CKFLT_0 ((uint32_t)0x00000008) /*!< Bit 0 */
  3052. #define LPTIM_CFGR_CKFLT_1 ((uint32_t)0x00000010) /*!< Bit 1 */
  3053. #define LPTIM_CFGR_TRGFLT ((uint32_t)0x000000C0) /*!< TRGFLT[1:0] bits (Configurable digital filter for trigger) */
  3054. #define LPTIM_CFGR_TRGFLT_0 ((uint32_t)0x00000040) /*!< Bit 0 */
  3055. #define LPTIM_CFGR_TRGFLT_1 ((uint32_t)0x00000080) /*!< Bit 1 */
  3056. #define LPTIM_CFGR_PRESC ((uint32_t)0x00000E00) /*!< PRESC[2:0] bits (Clock prescaler) */
  3057. #define LPTIM_CFGR_PRESC_0 ((uint32_t)0x00000200) /*!< Bit 0 */
  3058. #define LPTIM_CFGR_PRESC_1 ((uint32_t)0x00000400) /*!< Bit 1 */
  3059. #define LPTIM_CFGR_PRESC_2 ((uint32_t)0x00000800) /*!< Bit 2 */
  3060. #define LPTIM_CFGR_TRIGSEL ((uint32_t)0x0000E000) /*!< TRIGSEL[2:0]] bits (Trigger selector) */
  3061. #define LPTIM_CFGR_TRIGSEL_0 ((uint32_t)0x00002000) /*!< Bit 0 */
  3062. #define LPTIM_CFGR_TRIGSEL_1 ((uint32_t)0x00004000) /*!< Bit 1 */
  3063. #define LPTIM_CFGR_TRIGSEL_2 ((uint32_t)0x00008000) /*!< Bit 2 */
  3064. #define LPTIM_CFGR_TRIGEN ((uint32_t)0x00060000) /*!< TRIGEN[1:0] bits (Trigger enable and polarity) */
  3065. #define LPTIM_CFGR_TRIGEN_0 ((uint32_t)0x00020000) /*!< Bit 0 */
  3066. #define LPTIM_CFGR_TRIGEN_1 ((uint32_t)0x00040000) /*!< Bit 1 */
  3067. #define LPTIM_CFGR_TIMOUT ((uint32_t)0x00080000) /*!< Timout enable */
  3068. #define LPTIM_CFGR_WAVE ((uint32_t)0x00100000) /*!< Waveform shape */
  3069. #define LPTIM_CFGR_WAVPOL ((uint32_t)0x00200000) /*!< Waveform shape polarity */
  3070. #define LPTIM_CFGR_PRELOAD ((uint32_t)0x00400000) /*!< Reg update mode */
  3071. #define LPTIM_CFGR_COUNTMODE ((uint32_t)0x00800000) /*!< Counter mode enable */
  3072. #define LPTIM_CFGR_ENC ((uint32_t)0x01000000) /*!< Encoder mode enable */
  3073. /****************** Bit definition for LPTIM_CR register ********************/
  3074. #define LPTIM_CR_ENABLE ((uint32_t)0x00000001) /*!< LPTIMer enable */
  3075. #define LPTIM_CR_SNGSTRT ((uint32_t)0x00080002) /*!< Timer start in single mode */
  3076. #define LPTIM_CR_CNTSTRT ((uint32_t)0x00000004) /*!< Timer start in continuous mode */
  3077. /****************** Bit definition for LPTIM_CMP register *******************/
  3078. #define LPTIM_CMP_CMP ((uint32_t)0x0000FFFF) /*!< Compare register */
  3079. /****************** Bit definition for LPTIM_ARR register *******************/
  3080. #define LPTIM_ARR_ARR ((uint32_t)0x0000FFFF) /*!< Auto reload register */
  3081. /****************** Bit definition for LPTIM_CNT register *******************/
  3082. #define LPTIM_CNT_CNT ((uint32_t)0x0000FFFF) /*!< Counter register */
  3083. /****************** Bit definition for LPTIM_OR register *******************/
  3084. #define LPTIM_OR_OR ((uint32_t)0x00000003) /*!< LPTIMER[1:0] bits (Remap selection) */
  3085. #define LPTIM_OR_OR_0 ((uint32_t)0x00000001) /*!< Bit 0 */
  3086. #define LPTIM_OR_OR_1 ((uint32_t)0x00000002) /*!< Bit 1 */
  3087. /******************************************************************************/
  3088. /* */
  3089. /* Universal Synchronous Asynchronous Receiver Transmitter */
  3090. /* */
  3091. /******************************************************************************/
  3092. /******************* Bit definition for USART_SR register *******************/
  3093. #define USART_SR_PE ((uint32_t)0x0001) /*!<Parity Error */
  3094. #define USART_SR_FE ((uint32_t)0x0002) /*!<Framing Error */
  3095. #define USART_SR_NE ((uint32_t)0x0004) /*!<Noise Error Flag */
  3096. #define USART_SR_ORE ((uint32_t)0x0008) /*!<OverRun Error */
  3097. #define USART_SR_IDLE ((uint32_t)0x0010) /*!<IDLE line detected */
  3098. #define USART_SR_RXNE ((uint32_t)0x0020) /*!<Read Data Register Not Empty */
  3099. #define USART_SR_TC ((uint32_t)0x0040) /*!<Transmission Complete */
  3100. #define USART_SR_TXE ((uint32_t)0x0080) /*!<Transmit Data Register Empty */
  3101. #define USART_SR_LBD ((uint32_t)0x0100) /*!<LIN Break Detection Flag */
  3102. #define USART_SR_CTS ((uint32_t)0x0200) /*!<CTS Flag */
  3103. /******************* Bit definition for USART_DR register *******************/
  3104. #define USART_DR_DR ((uint32_t)0x01FF) /*!<Data value */
  3105. /****************** Bit definition for USART_BRR register *******************/
  3106. #define USART_BRR_DIV_Fraction ((uint32_t)0x000F) /*!<Fraction of USARTDIV */
  3107. #define USART_BRR_DIV_Mantissa ((uint32_t)0xFFF0) /*!<Mantissa of USARTDIV */
  3108. /****************** Bit definition for USART_CR1 register *******************/
  3109. #define USART_CR1_SBK ((uint32_t)0x0001) /*!<Send Break */
  3110. #define USART_CR1_RWU ((uint32_t)0x0002) /*!<Receiver wakeup */
  3111. #define USART_CR1_RE ((uint32_t)0x0004) /*!<Receiver Enable */
  3112. #define USART_CR1_TE ((uint32_t)0x0008) /*!<Transmitter Enable */
  3113. #define USART_CR1_IDLEIE ((uint32_t)0x0010) /*!<IDLE Interrupt Enable */
  3114. #define USART_CR1_RXNEIE ((uint32_t)0x0020) /*!<RXNE Interrupt Enable */
  3115. #define USART_CR1_TCIE ((uint32_t)0x0040) /*!<Transmission Complete Interrupt Enable */
  3116. #define USART_CR1_TXEIE ((uint32_t)0x0080) /*!<PE Interrupt Enable */
  3117. #define USART_CR1_PEIE ((uint32_t)0x0100) /*!<PE Interrupt Enable */
  3118. #define USART_CR1_PS ((uint32_t)0x0200) /*!<Parity Selection */
  3119. #define USART_CR1_PCE ((uint32_t)0x0400) /*!<Parity Control Enable */
  3120. #define USART_CR1_WAKE ((uint32_t)0x0800) /*!<Wakeup method */
  3121. #define USART_CR1_M ((uint32_t)0x1000) /*!<Word length */
  3122. #define USART_CR1_UE ((uint32_t)0x2000) /*!<USART Enable */
  3123. #define USART_CR1_OVER8 ((uint32_t)0x8000) /*!<USART Oversampling by 8 enable */
  3124. /****************** Bit definition for USART_CR2 register *******************/
  3125. #define USART_CR2_ADD ((uint32_t)0x000F) /*!<Address of the USART node */
  3126. #define USART_CR2_LBDL ((uint32_t)0x0020) /*!<LIN Break Detection Length */
  3127. #define USART_CR2_LBDIE ((uint32_t)0x0040) /*!<LIN Break Detection Interrupt Enable */
  3128. #define USART_CR2_LBCL ((uint32_t)0x0100) /*!<Last Bit Clock pulse */
  3129. #define USART_CR2_CPHA ((uint32_t)0x0200) /*!<Clock Phase */
  3130. #define USART_CR2_CPOL ((uint32_t)0x0400) /*!<Clock Polarity */
  3131. #define USART_CR2_CLKEN ((uint32_t)0x0800) /*!<Clock Enable */
  3132. #define USART_CR2_STOP ((uint32_t)0x3000) /*!<STOP[1:0] bits (STOP bits) */
  3133. #define USART_CR2_STOP_0 ((uint32_t)0x1000) /*!<Bit 0 */
  3134. #define USART_CR2_STOP_1 ((uint32_t)0x2000) /*!<Bit 1 */
  3135. #define USART_CR2_LINEN ((uint32_t)0x4000) /*!<LIN mode enable */
  3136. /****************** Bit definition for USART_CR3 register *******************/
  3137. #define USART_CR3_EIE ((uint32_t)0x0001) /*!<Error Interrupt Enable */
  3138. #define USART_CR3_IREN ((uint32_t)0x0002) /*!<IrDA mode Enable */
  3139. #define USART_CR3_IRLP ((uint32_t)0x0004) /*!<IrDA Low-Power */
  3140. #define USART_CR3_HDSEL ((uint32_t)0x0008) /*!<Half-Duplex Selection */
  3141. #define USART_CR3_NACK ((uint32_t)0x0010) /*!<Smartcard NACK enable */
  3142. #define USART_CR3_SCEN ((uint32_t)0x0020) /*!<Smartcard mode enable */
  3143. #define USART_CR3_DMAR ((uint32_t)0x0040) /*!<DMA Enable Receiver */
  3144. #define USART_CR3_DMAT ((uint32_t)0x0080) /*!<DMA Enable Transmitter */
  3145. #define USART_CR3_RTSE ((uint32_t)0x0100) /*!<RTS Enable */
  3146. #define USART_CR3_CTSE ((uint32_t)0x0200) /*!<CTS Enable */
  3147. #define USART_CR3_CTSIE ((uint32_t)0x0400) /*!<CTS Interrupt Enable */
  3148. #define USART_CR3_ONEBIT ((uint32_t)0x0800) /*!<USART One bit method enable */
  3149. /****************** Bit definition for USART_GTPR register ******************/
  3150. #define USART_GTPR_PSC ((uint32_t)0x00FF) /*!<PSC[7:0] bits (Prescaler value) */
  3151. #define USART_GTPR_PSC_0 ((uint32_t)0x0001) /*!<Bit 0 */
  3152. #define USART_GTPR_PSC_1 ((uint32_t)0x0002) /*!<Bit 1 */
  3153. #define USART_GTPR_PSC_2 ((uint32_t)0x0004) /*!<Bit 2 */
  3154. #define USART_GTPR_PSC_3 ((uint32_t)0x0008) /*!<Bit 3 */
  3155. #define USART_GTPR_PSC_4 ((uint32_t)0x0010) /*!<Bit 4 */
  3156. #define USART_GTPR_PSC_5 ((uint32_t)0x0020) /*!<Bit 5 */
  3157. #define USART_GTPR_PSC_6 ((uint32_t)0x0040) /*!<Bit 6 */
  3158. #define USART_GTPR_PSC_7 ((uint32_t)0x0080) /*!<Bit 7 */
  3159. #define USART_GTPR_GT ((uint32_t)0xFF00) /*!<Guard time value */
  3160. /******************************************************************************/
  3161. /* */
  3162. /* Window WATCHDOG */
  3163. /* */
  3164. /******************************************************************************/
  3165. /******************* Bit definition for WWDG_CR register ********************/
  3166. #define WWDG_CR_T ((uint32_t)0x7F) /*!<T[6:0] bits (7-Bit counter (MSB to LSB)) */
  3167. #define WWDG_CR_T0 ((uint32_t)0x01) /*!<Bit 0 */
  3168. #define WWDG_CR_T1 ((uint32_t)0x02) /*!<Bit 1 */
  3169. #define WWDG_CR_T2 ((uint32_t)0x04) /*!<Bit 2 */
  3170. #define WWDG_CR_T3 ((uint32_t)0x08) /*!<Bit 3 */
  3171. #define WWDG_CR_T4 ((uint32_t)0x10) /*!<Bit 4 */
  3172. #define WWDG_CR_T5 ((uint32_t)0x20) /*!<Bit 5 */
  3173. #define WWDG_CR_T6 ((uint32_t)0x40) /*!<Bit 6 */
  3174. #define WWDG_CR_WDGA ((uint32_t)0x80) /*!<Activation bit */
  3175. /******************* Bit definition for WWDG_CFR register *******************/
  3176. #define WWDG_CFR_W ((uint32_t)0x007F) /*!<W[6:0] bits (7-bit window value) */
  3177. #define WWDG_CFR_W0 ((uint32_t)0x0001) /*!<Bit 0 */
  3178. #define WWDG_CFR_W1 ((uint32_t)0x0002) /*!<Bit 1 */
  3179. #define WWDG_CFR_W2 ((uint32_t)0x0004) /*!<Bit 2 */
  3180. #define WWDG_CFR_W3 ((uint32_t)0x0008) /*!<Bit 3 */
  3181. #define WWDG_CFR_W4 ((uint32_t)0x0010) /*!<Bit 4 */
  3182. #define WWDG_CFR_W5 ((uint32_t)0x0020) /*!<Bit 5 */
  3183. #define WWDG_CFR_W6 ((uint32_t)0x0040) /*!<Bit 6 */
  3184. #define WWDG_CFR_WDGTB ((uint32_t)0x0180) /*!<WDGTB[1:0] bits (Timer Base) */
  3185. #define WWDG_CFR_WDGTB0 ((uint32_t)0x0080) /*!<Bit 0 */
  3186. #define WWDG_CFR_WDGTB1 ((uint32_t)0x0100) /*!<Bit 1 */
  3187. #define WWDG_CFR_EWI ((uint32_t)0x0200) /*!<Early Wakeup Interrupt */
  3188. /******************* Bit definition for WWDG_SR register ********************/
  3189. #define WWDG_SR_EWIF ((uint32_t)0x01) /*!<Early Wakeup Interrupt Flag */
  3190. /******************************************************************************/
  3191. /* */
  3192. /* Digital to Analog Converter */
  3193. /* */
  3194. /******************************************************************************/
  3195. /******************** Bit definition for DAC_CR register ********************/
  3196. #define DAC_CR_EN1 ((uint32_t)0x00000001) /*!<DAC channel1 enable */
  3197. #define DAC_CR_BOFF1 ((uint32_t)0x00000002) /*!<DAC channel1 output buffer disable */
  3198. #define DAC_CR_TEN1 ((uint32_t)0x00000004) /*!<DAC channel1 Trigger enable */
  3199. #define DAC_CR_TSEL1 ((uint32_t)0x00000038) /*!<TSEL1[2:0] (DAC channel1 Trigger selection) */
  3200. #define DAC_CR_TSEL1_0 ((uint32_t)0x00000008) /*!<Bit 0 */
  3201. #define DAC_CR_TSEL1_1 ((uint32_t)0x00000010) /*!<Bit 1 */
  3202. #define DAC_CR_TSEL1_2 ((uint32_t)0x00000020) /*!<Bit 2 */
  3203. #define DAC_CR_WAVE1 ((uint32_t)0x000000C0) /*!<WAVE1[1:0] (DAC channel1 noise/triangle wave generation enable) */
  3204. #define DAC_CR_WAVE1_0 ((uint32_t)0x00000040) /*!<Bit 0 */
  3205. #define DAC_CR_WAVE1_1 ((uint32_t)0x00000080) /*!<Bit 1 */
  3206. #define DAC_CR_MAMP1 ((uint32_t)0x00000F00) /*!<MAMP1[3:0] (DAC channel1 Mask/Amplitude selector) */
  3207. #define DAC_CR_MAMP1_0 ((uint32_t)0x00000100) /*!<Bit 0 */
  3208. #define DAC_CR_MAMP1_1 ((uint32_t)0x00000200) /*!<Bit 1 */
  3209. #define DAC_CR_MAMP1_2 ((uint32_t)0x00000400) /*!<Bit 2 */
  3210. #define DAC_CR_MAMP1_3 ((uint32_t)0x00000800) /*!<Bit 3 */
  3211. #define DAC_CR_DMAEN1 ((uint32_t)0x00001000) /*!<DAC channel1 DMA enable */
  3212. #define DAC_CR_EN2 ((uint32_t)0x00010000) /*!<DAC channel2 enable */
  3213. #define DAC_CR_BOFF2 ((uint32_t)0x00020000) /*!<DAC channel2 output buffer disable */
  3214. #define DAC_CR_TEN2 ((uint32_t)0x00040000) /*!<DAC channel2 Trigger enable */
  3215. #define DAC_CR_TSEL2 ((uint32_t)0x00380000) /*!<TSEL2[2:0] (DAC channel2 Trigger selection) */
  3216. #define DAC_CR_TSEL2_0 ((uint32_t)0x00080000) /*!<Bit 0 */
  3217. #define DAC_CR_TSEL2_1 ((uint32_t)0x00100000) /*!<Bit 1 */
  3218. #define DAC_CR_TSEL2_2 ((uint32_t)0x00200000) /*!<Bit 2 */
  3219. #define DAC_CR_WAVE2 ((uint32_t)0x00C00000) /*!<WAVE2[1:0] (DAC channel2 noise/triangle wave generation enable) */
  3220. #define DAC_CR_WAVE2_0 ((uint32_t)0x00400000) /*!<Bit 0 */
  3221. #define DAC_CR_WAVE2_1 ((uint32_t)0x00800000) /*!<Bit 1 */
  3222. #define DAC_CR_MAMP2 ((uint32_t)0x0F000000) /*!<MAMP2[3:0] (DAC channel2 Mask/Amplitude selector) */
  3223. #define DAC_CR_MAMP2_0 ((uint32_t)0x01000000) /*!<Bit 0 */
  3224. #define DAC_CR_MAMP2_1 ((uint32_t)0x02000000) /*!<Bit 1 */
  3225. #define DAC_CR_MAMP2_2 ((uint32_t)0x04000000) /*!<Bit 2 */
  3226. #define DAC_CR_MAMP2_3 ((uint32_t)0x08000000) /*!<Bit 3 */
  3227. #define DAC_CR_DMAEN2 ((uint32_t)0x10000000) /*!<DAC channel2 DMA enabled */
  3228. /***************** Bit definition for DAC_SWTRIGR register ******************/
  3229. #define DAC_SWTRIGR_SWTRIG1 ((uint32_t)0x01) /*!<DAC channel1 software trigger */
  3230. #define DAC_SWTRIGR_SWTRIG2 ((uint32_t)0x02) /*!<DAC channel2 software trigger */
  3231. /***************** Bit definition for DAC_DHR12R1 register ******************/
  3232. #define DAC_DHR12R1_DACC1DHR ((uint32_t)0x0FFF) /*!<DAC channel1 12-bit Right aligned data */
  3233. /***************** Bit definition for DAC_DHR12L1 register ******************/
  3234. #define DAC_DHR12L1_DACC1DHR ((uint32_t)0xFFF0) /*!<DAC channel1 12-bit Left aligned data */
  3235. /****************** Bit definition for DAC_DHR8R1 register ******************/
  3236. #define DAC_DHR8R1_DACC1DHR ((uint32_t)0xFF) /*!<DAC channel1 8-bit Right aligned data */
  3237. /***************** Bit definition for DAC_DHR12R2 register ******************/
  3238. #define DAC_DHR12R2_DACC2DHR ((uint32_t)0x0FFF) /*!<DAC channel2 12-bit Right aligned data */
  3239. /***************** Bit definition for DAC_DHR12L2 register ******************/
  3240. #define DAC_DHR12L2_DACC2DHR ((uint32_t)0xFFF0) /*!<DAC channel2 12-bit Left aligned data */
  3241. /****************** Bit definition for DAC_DHR8R2 register ******************/
  3242. #define DAC_DHR8R2_DACC2DHR ((uint32_t)0xFF) /*!<DAC channel2 8-bit Right aligned data */
  3243. /***************** Bit definition for DAC_DHR12RD register ******************/
  3244. #define DAC_DHR12RD_DACC1DHR ((uint32_t)0x00000FFF) /*!<DAC channel1 12-bit Right aligned data */
  3245. #define DAC_DHR12RD_DACC2DHR ((uint32_t)0x0FFF0000) /*!<DAC channel2 12-bit Right aligned data */
  3246. /***************** Bit definition for DAC_DHR12LD register ******************/
  3247. #define DAC_DHR12LD_DACC1DHR ((uint32_t)0x0000FFF0) /*!<DAC channel1 12-bit Left aligned data */
  3248. #define DAC_DHR12LD_DACC2DHR ((uint32_t)0xFFF00000) /*!<DAC channel2 12-bit Left aligned data */
  3249. /****************** Bit definition for DAC_DHR8RD register ******************/
  3250. #define DAC_DHR8RD_DACC1DHR ((uint32_t)0x00FF) /*!<DAC channel1 8-bit Right aligned data */
  3251. #define DAC_DHR8RD_DACC2DHR ((uint32_t)0xFF00) /*!<DAC channel2 8-bit Right aligned data */
  3252. /******************* Bit definition for DAC_DOR1 register *******************/
  3253. #define DAC_DOR1_DACC1DOR ((uint32_t)0x0FFF) /*!<DAC channel1 data output */
  3254. /******************* Bit definition for DAC_DOR2 register *******************/
  3255. #define DAC_DOR2_DACC2DOR ((uint32_t)0x0FFF) /*!<DAC channel2 data output */
  3256. /******************** Bit definition for DAC_SR register ********************/
  3257. #define DAC_SR_DMAUDR1 ((uint32_t)0x00002000) /*!<DAC channel1 DMA underrun flag */
  3258. #define DAC_SR_DMAUDR2 ((uint32_t)0x20000000) /*!<DAC channel2 DMA underrun flag */
  3259. /******************************************************************************/
  3260. /* */
  3261. /* DBG */
  3262. /* */
  3263. /******************************************************************************/
  3264. /******************** Bit definition for DBGMCU_IDCODE register *************/
  3265. #define DBGMCU_IDCODE_DEV_ID ((uint32_t)0x00000FFF)
  3266. #define DBGMCU_IDCODE_REV_ID ((uint32_t)0xFFFF0000)
  3267. /******************** Bit definition for DBGMCU_CR register *****************/
  3268. #define DBGMCU_CR_DBG_SLEEP ((uint32_t)0x00000001)
  3269. #define DBGMCU_CR_DBG_STOP ((uint32_t)0x00000002)
  3270. #define DBGMCU_CR_DBG_STANDBY ((uint32_t)0x00000004)
  3271. #define DBGMCU_CR_TRACE_IOEN ((uint32_t)0x00000020)
  3272. #define DBGMCU_CR_TRACE_MODE ((uint32_t)0x000000C0)
  3273. #define DBGMCU_CR_TRACE_MODE_0 ((uint32_t)0x00000040)/*!<Bit 0 */
  3274. #define DBGMCU_CR_TRACE_MODE_1 ((uint32_t)0x00000080)/*!<Bit 1 */
  3275. /******************** Bit definition for DBGMCU_APB1_FZ register ************/
  3276. #define DBGMCU_APB1_FZ_DBG_TIM5_STOP ((uint32_t)0x00000008)
  3277. #define DBGMCU_APB1_FZ_DBG_TIM6_STOP ((uint32_t)0x00000010)
  3278. #define DBGMCU_APB1_FZ_DBG_RTC_STOP ((uint32_t)0x00000400)
  3279. #define DBGMCU_APB1_FZ_DBG_WWDG_STOP ((uint32_t)0x00000800)
  3280. #define DBGMCU_APB1_FZ_DBG_IWDG_STOP ((uint32_t)0x00001000)
  3281. #define DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00200000)
  3282. #define DBGMCU_APB1_FZ_DBG_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00400000)
  3283. #define DBGMCU_APB1_FZ_DBG_CAN1_STOP ((uint32_t)0x02000000)
  3284. #define DBGMCU_APB1_FZ_DBG_CAN2_STOP ((uint32_t)0x04000000)
  3285. /******************** Bit definition for DBGMCU_APB2_FZ register ************/
  3286. #define DBGMCU_APB2_FZ_DBG_TIM1_STOP ((uint32_t)0x00000001)
  3287. #define DBGMCU_APB2_FZ_DBG_TIM9_STOP ((uint32_t)0x00010000)
  3288. #define DBGMCU_APB2_FZ_DBG_TIM11_STOP ((uint32_t)0x00040000)
  3289. /**
  3290. * @}
  3291. */
  3292. /**
  3293. * @}
  3294. */
  3295. /** @addtogroup Exported_macros
  3296. * @{
  3297. */
  3298. /******************************* ADC Instances ********************************/
  3299. #define IS_ADC_ALL_INSTANCE(INSTANCE) ((INSTANCE) == ADC1)
  3300. /******************************* CRC Instances ********************************/
  3301. #define IS_CRC_ALL_INSTANCE(INSTANCE) ((INSTANCE) == CRC)
  3302. /******************************* DAC Instances ********************************/
  3303. #define IS_DAC_ALL_INSTANCE(INSTANCE) ((INSTANCE) == DAC)
  3304. /******************************** DMA Instances *******************************/
  3305. #define IS_DMA_STREAM_ALL_INSTANCE(INSTANCE) (((INSTANCE) == DMA1_Stream0) || \
  3306. ((INSTANCE) == DMA1_Stream1) || \
  3307. ((INSTANCE) == DMA1_Stream2) || \
  3308. ((INSTANCE) == DMA1_Stream3) || \
  3309. ((INSTANCE) == DMA1_Stream4) || \
  3310. ((INSTANCE) == DMA1_Stream5) || \
  3311. ((INSTANCE) == DMA1_Stream6) || \
  3312. ((INSTANCE) == DMA1_Stream7) || \
  3313. ((INSTANCE) == DMA2_Stream0) || \
  3314. ((INSTANCE) == DMA2_Stream1) || \
  3315. ((INSTANCE) == DMA2_Stream2) || \
  3316. ((INSTANCE) == DMA2_Stream3) || \
  3317. ((INSTANCE) == DMA2_Stream4) || \
  3318. ((INSTANCE) == DMA2_Stream5) || \
  3319. ((INSTANCE) == DMA2_Stream6) || \
  3320. ((INSTANCE) == DMA2_Stream7))
  3321. /******************************* GPIO Instances *******************************/
  3322. #define IS_GPIO_ALL_INSTANCE(INSTANCE) (((INSTANCE) == GPIOA) || \
  3323. ((INSTANCE) == GPIOB) || \
  3324. ((INSTANCE) == GPIOC) || \
  3325. ((INSTANCE) == GPIOH))
  3326. /******************************** I2C Instances *******************************/
  3327. #define IS_I2C_ALL_INSTANCE(INSTANCE) (((INSTANCE) == I2C1) || \
  3328. ((INSTANCE) == I2C2))
  3329. /******************************** I2S Instances *******************************/
  3330. #define IS_I2S_ALL_INSTANCE(INSTANCE) (((INSTANCE) == SPI1) || \
  3331. ((INSTANCE) == SPI2) || \
  3332. ((INSTANCE) == SPI5))
  3333. /******************************* LPTIM Instances ******************************/
  3334. #define IS_LPTIM_INSTANCE(__INSTANCE__) ((__INSTANCE__) == LPTIM1)
  3335. /******************************* RNG Instances ********************************/
  3336. #define IS_RNG_ALL_INSTANCE(INSTANCE) ((INSTANCE) == RNG)
  3337. /****************************** RTC Instances *********************************/
  3338. #define IS_RTC_ALL_INSTANCE(INSTANCE) ((INSTANCE) == RTC)
  3339. /******************************** SPI Instances *******************************/
  3340. #define IS_SPI_ALL_INSTANCE(INSTANCE) (((INSTANCE) == SPI1) || \
  3341. ((INSTANCE) == SPI2) || \
  3342. ((INSTANCE) == SPI5))
  3343. /*************************** SPI Extended Instances ***************************/
  3344. #define IS_SPI_ALL_INSTANCE_EXT(INSTANCE) (((INSTANCE) == SPI1) || \
  3345. ((INSTANCE) == SPI2) || \
  3346. ((INSTANCE) == SPI5))
  3347. /****************** TIM Instances : All supported instances *******************/
  3348. #define IS_TIM_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3349. ((INSTANCE) == TIM5) || \
  3350. ((INSTANCE) == TIM6) || \
  3351. ((INSTANCE) == TIM9) || \
  3352. ((INSTANCE) == TIM11))
  3353. /************* TIM Instances : at least 1 capture/compare channel *************/
  3354. #define IS_TIM_CC1_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3355. ((INSTANCE) == TIM5) || \
  3356. ((INSTANCE) == TIM9) || \
  3357. ((INSTANCE) == TIM11))
  3358. /************ TIM Instances : at least 2 capture/compare channels *************/
  3359. #define IS_TIM_CC2_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3360. ((INSTANCE) == TIM5) || \
  3361. ((INSTANCE) == TIM9))
  3362. /************ TIM Instances : at least 3 capture/compare channels *************/
  3363. #define IS_TIM_CC3_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3364. ((INSTANCE) == TIM5))
  3365. /************ TIM Instances : at least 4 capture/compare channels *************/
  3366. #define IS_TIM_CC4_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3367. ((INSTANCE) == TIM5))
  3368. /******************** TIM Instances : Advanced-control timers *****************/
  3369. #define IS_TIM_ADVANCED_INSTANCE(INSTANCE) ((INSTANCE) == TIM1)
  3370. /******************* TIM Instances : Timer input XOR function *****************/
  3371. #define IS_TIM_XOR_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3372. ((INSTANCE) == TIM5))
  3373. /****************** TIM Instances : DMA requests generation (UDE) *************/
  3374. #define IS_TIM_DMA_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3375. ((INSTANCE) == TIM5) || \
  3376. ((INSTANCE) == TIM6))
  3377. /************ TIM Instances : DMA requests generation (CCxDE) *****************/
  3378. #define IS_TIM_DMA_CC_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3379. ((INSTANCE) == TIM5))
  3380. /************ TIM Instances : DMA requests generation (COMDE) *****************/
  3381. #define IS_TIM_CCDMA_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3382. ((INSTANCE) == TIM5))
  3383. /******************** TIM Instances : DMA burst feature ***********************/
  3384. #define IS_TIM_DMABURST_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3385. ((INSTANCE) == TIM5))
  3386. /****** TIM Instances : master mode available (TIMx_CR2.MMS available )********/
  3387. #define IS_TIM_MASTER_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3388. ((INSTANCE) == TIM5) || \
  3389. ((INSTANCE) == TIM6) || \
  3390. ((INSTANCE) == TIM9))
  3391. /*********** TIM Instances : Slave mode available (TIMx_SMCR available )*******/
  3392. #define IS_TIM_SLAVE_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3393. ((INSTANCE) == TIM5) || \
  3394. ((INSTANCE) == TIM9))
  3395. /********************** TIM Instances : 32 bit Counter ************************/
  3396. #define IS_TIM_32B_COUNTER_INSTANCE(INSTANCE)(((INSTANCE) == TIM5))
  3397. /***************** TIM Instances : external trigger input availabe ************/
  3398. #define IS_TIM_ETR_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3399. ((INSTANCE) == TIM5))
  3400. /****************** TIM Instances : remapping capability **********************/
  3401. #define IS_TIM_REMAP_INSTANCE(INSTANCE) (((INSTANCE) == TIM5) || \
  3402. ((INSTANCE) == TIM11))
  3403. /******************* TIM Instances : output(s) available **********************/
  3404. #define IS_TIM_CCX_INSTANCE(INSTANCE, CHANNEL) \
  3405. ((((INSTANCE) == TIM1) && \
  3406. (((CHANNEL) == TIM_CHANNEL_1) || \
  3407. ((CHANNEL) == TIM_CHANNEL_2) || \
  3408. ((CHANNEL) == TIM_CHANNEL_3) || \
  3409. ((CHANNEL) == TIM_CHANNEL_4))) \
  3410. || \
  3411. (((INSTANCE) == TIM5) && \
  3412. (((CHANNEL) == TIM_CHANNEL_1) || \
  3413. ((CHANNEL) == TIM_CHANNEL_2) || \
  3414. ((CHANNEL) == TIM_CHANNEL_3) || \
  3415. ((CHANNEL) == TIM_CHANNEL_4))) \
  3416. || \
  3417. (((INSTANCE) == TIM9) && \
  3418. (((CHANNEL) == TIM_CHANNEL_1) || \
  3419. ((CHANNEL) == TIM_CHANNEL_2))) \
  3420. || \
  3421. (((INSTANCE) == TIM11) && \
  3422. (((CHANNEL) == TIM_CHANNEL_1))))
  3423. /************ TIM Instances : complementary output(s) available ***************/
  3424. #define IS_TIM_CCXN_INSTANCE(INSTANCE, CHANNEL) \
  3425. ((((INSTANCE) == TIM1) && \
  3426. (((CHANNEL) == TIM_CHANNEL_1) || \
  3427. ((CHANNEL) == TIM_CHANNEL_2) || \
  3428. ((CHANNEL) == TIM_CHANNEL_3))))
  3429. /******************** USART Instances : Synchronous mode **********************/
  3430. #define IS_USART_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \
  3431. ((INSTANCE) == USART2) || \
  3432. ((INSTANCE) == USART6))
  3433. /******************** UART Instances : Asynchronous mode **********************/
  3434. #define IS_UART_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \
  3435. ((INSTANCE) == USART2) || \
  3436. ((INSTANCE) == USART6))
  3437. /****************** UART Instances : Hardware Flow control ********************/
  3438. #define IS_UART_HWFLOW_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \
  3439. ((INSTANCE) == USART2))
  3440. /********************* UART Instances : Smard card mode ***********************/
  3441. #define IS_SMARTCARD_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \
  3442. ((INSTANCE) == USART2) || \
  3443. ((INSTANCE) == USART6))
  3444. /*********************** UART Instances : IRDA mode ***************************/
  3445. #define IS_IRDA_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \
  3446. ((INSTANCE) == USART2) || \
  3447. ((INSTANCE) == USART6))
  3448. /****************************** IWDG Instances ********************************/
  3449. #define IS_IWDG_ALL_INSTANCE(INSTANCE) ((INSTANCE) == IWDG)
  3450. /****************************** WWDG Instances ********************************/
  3451. #define IS_WWDG_ALL_INSTANCE(INSTANCE) ((INSTANCE) == WWDG)
  3452. /***************************** FMPI2C Instances *******************************/
  3453. #define IS_FMPI2C_ALL_INSTANCE(__INSTANCE__) ((__INSTANCE__) == FMPI2C1)
  3454. /**
  3455. * @}
  3456. */
  3457. /**
  3458. * @}
  3459. */
  3460. /**
  3461. * @}
  3462. */
  3463. #ifdef __cplusplus
  3464. }
  3465. #endif /* __cplusplus */
  3466. #endif /* __STM32F410Cx_H */
  3467. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/