stm32f051x8.h 286 KB

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