stm32f038xx.h 238 KB

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