stm32g4xx_ll_rtc.h 192 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570
  1. /**
  2. ******************************************************************************
  3. * @file stm32g4xx_ll_rtc.h
  4. * @author MCD Application Team
  5. * @brief Header file of RTC LL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2019 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file
  13. * in the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. /* Define to prevent recursive inclusion -------------------------------------*/
  19. #ifndef STM32G4xx_LL_RTC_H
  20. #define STM32G4xx_LL_RTC_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32g4xx.h"
  26. /** @addtogroup STM32G4xx_LL_Driver
  27. * @{
  28. */
  29. #if defined(RTC)
  30. /** @defgroup RTC_LL RTC
  31. * @{
  32. */
  33. /* Private types -------------------------------------------------------------*/
  34. /* Private variables ---------------------------------------------------------*/
  35. /* Private constants ---------------------------------------------------------*/
  36. /** @defgroup RTC_LL_Private_Constants RTC Private Constants
  37. * @{
  38. */
  39. /* Masks Definition */
  40. #define RTC_LL_INIT_MASK 0xFFFFFFFFU
  41. #define RTC_LL_RSF_MASK 0xFFFFFF5FU
  42. /* Write protection defines */
  43. #define RTC_WRITE_PROTECTION_DISABLE (uint8_t)0xFF
  44. #define RTC_WRITE_PROTECTION_ENABLE_1 (uint8_t)0xCA
  45. #define RTC_WRITE_PROTECTION_ENABLE_2 (uint8_t)0x53
  46. /* Defines used to combine date & time */
  47. #define RTC_OFFSET_WEEKDAY 24U
  48. #define RTC_OFFSET_DAY 16U
  49. #define RTC_OFFSET_MONTH 8U
  50. #define RTC_OFFSET_HOUR 16U
  51. #define RTC_OFFSET_MINUTE 8U
  52. /**
  53. * @}
  54. */
  55. /* Private macros ------------------------------------------------------------*/
  56. #if defined(USE_FULL_LL_DRIVER)
  57. /** @defgroup RTC_LL_Private_Macros RTC Private Macros
  58. * @{
  59. */
  60. /**
  61. * @}
  62. */
  63. #endif /*USE_FULL_LL_DRIVER*/
  64. #if !defined (UNUSED)
  65. #define UNUSED(x) ((void)(x))
  66. #endif
  67. /* Exported types ------------------------------------------------------------*/
  68. #if defined(USE_FULL_LL_DRIVER)
  69. /** @defgroup RTC_LL_ES_INIT RTC Exported Init structure
  70. * @{
  71. */
  72. /**
  73. * @brief RTC Init structures definition
  74. */
  75. typedef struct
  76. {
  77. uint32_t HourFormat; /*!< Specifies the RTC Hours Format.
  78. This parameter can be a value of @ref RTC_LL_EC_HOURFORMAT
  79. This feature can be modified afterwards using unitary function
  80. @ref LL_RTC_SetHourFormat(). */
  81. uint32_t AsynchPrescaler; /*!< Specifies the RTC Asynchronous Predivider value.
  82. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F
  83. This feature can be modified afterwards using unitary function
  84. @ref LL_RTC_SetAsynchPrescaler(). */
  85. uint32_t SynchPrescaler; /*!< Specifies the RTC Synchronous Predivider value.
  86. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFF
  87. This feature can be modified afterwards using unitary function
  88. @ref LL_RTC_SetSynchPrescaler(). */
  89. } LL_RTC_InitTypeDef;
  90. /**
  91. * @brief RTC Time structure definition
  92. */
  93. typedef struct
  94. {
  95. uint32_t TimeFormat; /*!< Specifies the RTC AM/PM Time.
  96. This parameter can be a value of @ref RTC_LL_EC_TIME_FORMAT
  97. This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetFormat(). */
  98. uint8_t Hours; /*!< Specifies the RTC Time Hours.
  99. This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the @ref LL_RTC_TIME_FORMAT_PM is selected.
  100. This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the @ref LL_RTC_TIME_FORMAT_AM_OR_24 is selected.
  101. This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetHour(). */
  102. uint8_t Minutes; /*!< Specifies the RTC Time Minutes.
  103. This parameter must be a number between Min_Data = 0 and Max_Data = 59
  104. This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetMinute(). */
  105. uint8_t Seconds; /*!< Specifies the RTC Time Seconds.
  106. This parameter must be a number between Min_Data = 0 and Max_Data = 59
  107. This feature can be modified afterwards using unitary function @ref LL_RTC_TIME_SetSecond(). */
  108. } LL_RTC_TimeTypeDef;
  109. /**
  110. * @brief RTC Date structure definition
  111. */
  112. typedef struct
  113. {
  114. uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay.
  115. This parameter can be a value of @ref RTC_LL_EC_WEEKDAY
  116. This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetWeekDay(). */
  117. uint8_t Month; /*!< Specifies the RTC Date Month.
  118. This parameter can be a value of @ref RTC_LL_EC_MONTH
  119. This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetMonth(). */
  120. uint8_t Day; /*!< Specifies the RTC Date Day.
  121. This parameter must be a number between Min_Data = 1 and Max_Data = 31
  122. This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetDay(). */
  123. uint8_t Year; /*!< Specifies the RTC Date Year.
  124. This parameter must be a number between Min_Data = 0 and Max_Data = 99
  125. This feature can be modified afterwards using unitary function @ref LL_RTC_DATE_SetYear(). */
  126. } LL_RTC_DateTypeDef;
  127. /**
  128. * @brief RTC Alarm structure definition
  129. */
  130. typedef struct
  131. {
  132. LL_RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members. */
  133. uint32_t AlarmMask; /*!< Specifies the RTC Alarm Masks.
  134. This parameter can be a value of @ref RTC_LL_EC_ALMA_MASK for ALARM A or @ref RTC_LL_EC_ALMB_MASK for ALARM B.
  135. This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetMask() for ALARM A
  136. or @ref LL_RTC_ALMB_SetMask() for ALARM B
  137. */
  138. uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on day or WeekDay.
  139. This parameter can be a value of @ref RTC_LL_EC_ALMA_WEEKDAY_SELECTION for ALARM A or @ref RTC_LL_EC_ALMB_WEEKDAY_SELECTION for ALARM B
  140. This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_EnableWeekday() or @ref LL_RTC_ALMA_DisableWeekday()
  141. for ALARM A or @ref LL_RTC_ALMB_EnableWeekday() or @ref LL_RTC_ALMB_DisableWeekday() for ALARM B
  142. */
  143. uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Day/WeekDay.
  144. If AlarmDateWeekDaySel set to day, this parameter must be a number between Min_Data = 1 and Max_Data = 31.
  145. This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetDay()
  146. for ALARM A or @ref LL_RTC_ALMB_SetDay() for ALARM B.
  147. If AlarmDateWeekDaySel set to Weekday, this parameter can be a value of @ref RTC_LL_EC_WEEKDAY.
  148. This feature can be modified afterwards using unitary function @ref LL_RTC_ALMA_SetWeekDay()
  149. for ALARM A or @ref LL_RTC_ALMB_SetWeekDay() for ALARM B.
  150. */
  151. } LL_RTC_AlarmTypeDef;
  152. /**
  153. * @}
  154. */
  155. #endif /* USE_FULL_LL_DRIVER */
  156. /* Exported constants --------------------------------------------------------*/
  157. /** @defgroup RTC_LL_Exported_Constants RTC Exported Constants
  158. * @{
  159. */
  160. #if defined(USE_FULL_LL_DRIVER)
  161. /** @defgroup RTC_LL_EC_FORMAT FORMAT
  162. * @{
  163. */
  164. #define LL_RTC_FORMAT_BIN 0x00000000U /*!< Binary data format */
  165. #define LL_RTC_FORMAT_BCD 0x00000001U /*!< BCD data format */
  166. /**
  167. * @}
  168. */
  169. /** @defgroup RTC_LL_EC_ALMA_WEEKDAY_SELECTION RTC Alarm A Date WeekDay
  170. * @{
  171. */
  172. #define LL_RTC_ALMA_DATEWEEKDAYSEL_DATE 0x00000000U /*!< Alarm A Date is selected */
  173. #define LL_RTC_ALMA_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMAR_WDSEL /*!< Alarm A WeekDay is selected */
  174. /**
  175. * @}
  176. */
  177. /** @defgroup RTC_LL_EC_ALMB_WEEKDAY_SELECTION RTC Alarm B Date WeekDay
  178. * @{
  179. */
  180. #define LL_RTC_ALMB_DATEWEEKDAYSEL_DATE 0x00000000U /*!< Alarm B Date is selected */
  181. #define LL_RTC_ALMB_DATEWEEKDAYSEL_WEEKDAY RTC_ALRMBR_WDSEL /*!< Alarm B WeekDay is selected */
  182. /**
  183. * @}
  184. */
  185. #endif /* USE_FULL_LL_DRIVER */
  186. /** @defgroup RTC_LL_EC_GET_FLAG Get Flags Defines
  187. * @brief Flags defines which can be used with LL_RTC_ReadReg function
  188. * @{
  189. */
  190. #define LL_RTC_SCR_ITSF RTC_SCR_CITSF
  191. #define LL_RTC_SCR_TSOVF RTC_SCR_CTSOVF
  192. #define LL_RTC_SCR_TSF RTC_SCR_CTSF
  193. #define LL_RTC_SCR_WUTF RTC_SCR_CWUTF
  194. #define LL_RTC_SCR_ALRBF RTC_SCR_CALRBF
  195. #define LL_RTC_CSR_ALRAF RTC_SCR_CALRAF
  196. #define LL_RTC_ICSR_RECALPF RTC_ICSR_RECALPF
  197. #define LL_RTC_ICSR_INITF RTC_ICSR_INITF
  198. #define LL_RTC_ICSR_RSF RTC_ICSR_RSF
  199. #define LL_RTC_ICSR_INITS RTC_ICSR_INITS
  200. #define LL_RTC_ICSR_SHPF RTC_ICSR_SHPF
  201. #define LL_RTC_ICSR_WUTWF RTC_ICSR_WUTWF
  202. #define LL_RTC_ICSR_ALRBWF RTC_ICSR_ALRBWF
  203. #define LL_RTC_ICSR_ALRAWF RTC_ICSR_ALRAWF
  204. /**
  205. * @}
  206. */
  207. /** @defgroup RTC_LL_EC_IT IT Defines
  208. * @brief IT defines which can be used with LL_RTC_ReadReg and LL_RTC_WriteReg functions
  209. * @{
  210. */
  211. #define LL_RTC_CR_TSIE RTC_CR_TSIE
  212. #define LL_RTC_CR_WUTIE RTC_CR_WUTIE
  213. #define LL_RTC_CR_ALRBIE RTC_CR_ALRBIE
  214. #define LL_RTC_CR_ALRAIE RTC_CR_ALRAIE
  215. /**
  216. * @}
  217. */
  218. /** @defgroup RTC_LL_EC_WEEKDAY WEEK DAY
  219. * @{
  220. */
  221. #define LL_RTC_WEEKDAY_MONDAY (uint8_t)0x01 /*!< Monday */
  222. #define LL_RTC_WEEKDAY_TUESDAY (uint8_t)0x02 /*!< Tuesday */
  223. #define LL_RTC_WEEKDAY_WEDNESDAY (uint8_t)0x03 /*!< Wednesday */
  224. #define LL_RTC_WEEKDAY_THURSDAY (uint8_t)0x04 /*!< Thrusday */
  225. #define LL_RTC_WEEKDAY_FRIDAY (uint8_t)0x05 /*!< Friday */
  226. #define LL_RTC_WEEKDAY_SATURDAY (uint8_t)0x06 /*!< Saturday */
  227. #define LL_RTC_WEEKDAY_SUNDAY (uint8_t)0x07 /*!< Sunday */
  228. /**
  229. * @}
  230. */
  231. /** @defgroup RTC_LL_EC_MONTH MONTH
  232. * @{
  233. */
  234. #define LL_RTC_MONTH_JANUARY (uint8_t)0x01 /*!< January */
  235. #define LL_RTC_MONTH_FEBRUARY (uint8_t)0x02 /*!< February */
  236. #define LL_RTC_MONTH_MARCH (uint8_t)0x03 /*!< March */
  237. #define LL_RTC_MONTH_APRIL (uint8_t)0x04 /*!< April */
  238. #define LL_RTC_MONTH_MAY (uint8_t)0x05 /*!< May */
  239. #define LL_RTC_MONTH_JUNE (uint8_t)0x06 /*!< June */
  240. #define LL_RTC_MONTH_JULY (uint8_t)0x07 /*!< July */
  241. #define LL_RTC_MONTH_AUGUST (uint8_t)0x08 /*!< August */
  242. #define LL_RTC_MONTH_SEPTEMBER (uint8_t)0x09 /*!< September */
  243. #define LL_RTC_MONTH_OCTOBER (uint8_t)0x10 /*!< October */
  244. #define LL_RTC_MONTH_NOVEMBER (uint8_t)0x11 /*!< November */
  245. #define LL_RTC_MONTH_DECEMBER (uint8_t)0x12 /*!< December */
  246. /**
  247. * @}
  248. */
  249. /** @defgroup RTC_LL_EC_HOURFORMAT HOUR FORMAT
  250. * @{
  251. */
  252. #define LL_RTC_HOURFORMAT_24HOUR 0x00000000U /*!< 24 hour/day format */
  253. #define LL_RTC_HOURFORMAT_AMPM RTC_CR_FMT /*!< AM/PM hour format */
  254. /**
  255. * @}
  256. */
  257. /** @defgroup RTC_LL_EC_ALARMOUT ALARM OUTPUT
  258. * @{
  259. */
  260. #define LL_RTC_ALARMOUT_DISABLE 0x00000000U /*!< Output disabled */
  261. #define LL_RTC_ALARMOUT_ALMA RTC_CR_OSEL_0 /*!< Alarm A output enabled */
  262. #define LL_RTC_ALARMOUT_ALMB RTC_CR_OSEL_1 /*!< Alarm B output enabled */
  263. #define LL_RTC_ALARMOUT_WAKEUP RTC_CR_OSEL /*!< Wakeup output enabled */
  264. /**
  265. * @}
  266. */
  267. /** @defgroup RTC_LL_EC_ALARM_OUTPUTTYPE ALARM OUTPUT TYPE
  268. * @{
  269. */
  270. #define LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN RTC_CR_TAMPALRM_TYPE /*!< RTC_ALARM is open-drain output */
  271. #define LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL 0x00000000U /*!< RTC_ALARM is push-pull output */
  272. /**
  273. * @}
  274. */
  275. /** @defgroup RTC_LL_EC_OUTPUTPOLARITY_PIN OUTPUT POLARITY PIN
  276. * @{
  277. */
  278. #define LL_RTC_OUTPUTPOLARITY_PIN_HIGH 0x00000000U /*!< Pin is high when ALRAF/ALRBF/WUTF is asserted (depending on OSEL)*/
  279. #define LL_RTC_OUTPUTPOLARITY_PIN_LOW RTC_CR_POL /*!< Pin is low when ALRAF/ALRBF/WUTF is asserted (depending on OSEL) */
  280. /**
  281. * @}
  282. */
  283. /** @defgroup RTC_LL_EC_TIME_FORMAT TIME FORMAT
  284. * @{
  285. */
  286. #define LL_RTC_TIME_FORMAT_AM_OR_24 0x00000000U /*!< AM or 24-hour format */
  287. #define LL_RTC_TIME_FORMAT_PM RTC_TR_PM /*!< PM */
  288. /**
  289. * @}
  290. */
  291. /** @defgroup RTC_LL_EC_SHIFT_SECOND SHIFT SECOND
  292. * @{
  293. */
  294. #define LL_RTC_SHIFT_SECOND_DELAY 0x00000000U /* Delay (seconds) = SUBFS / (PREDIV_S + 1) */
  295. #define LL_RTC_SHIFT_SECOND_ADVANCE RTC_SHIFTR_ADD1S /* Advance (seconds) = (1 - (SUBFS / (PREDIV_S + 1))) */
  296. /**
  297. * @}
  298. */
  299. /** @defgroup RTC_LL_EC_ALMA_MASK ALARMA MASK
  300. * @{
  301. */
  302. #define LL_RTC_ALMA_MASK_NONE 0x00000000U /*!< No masks applied on Alarm A*/
  303. #define LL_RTC_ALMA_MASK_DATEWEEKDAY RTC_ALRMAR_MSK4 /*!< Date/day do not care in Alarm A comparison */
  304. #define LL_RTC_ALMA_MASK_HOURS RTC_ALRMAR_MSK3 /*!< Hours do not care in Alarm A comparison */
  305. #define LL_RTC_ALMA_MASK_MINUTES RTC_ALRMAR_MSK2 /*!< Minutes do not care in Alarm A comparison */
  306. #define LL_RTC_ALMA_MASK_SECONDS RTC_ALRMAR_MSK1 /*!< Seconds do not care in Alarm A comparison */
  307. #define LL_RTC_ALMA_MASK_ALL (RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1) /*!< Masks all */
  308. /**
  309. * @}
  310. */
  311. /** @defgroup RTC_LL_EC_ALMA_TIME_FORMAT ALARMA TIME FORMAT
  312. * @{
  313. */
  314. #define LL_RTC_ALMA_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */
  315. #define LL_RTC_ALMA_TIME_FORMAT_PM RTC_ALRMAR_PM /*!< PM */
  316. /**
  317. * @}
  318. */
  319. /** @defgroup RTC_LL_EC_ALMB_MASK ALARMB MASK
  320. * @{
  321. */
  322. #define LL_RTC_ALMB_MASK_NONE 0x00000000U /*!< No masks applied on Alarm B*/
  323. #define LL_RTC_ALMB_MASK_DATEWEEKDAY RTC_ALRMBR_MSK4 /*!< Date/day do not care in Alarm B comparison */
  324. #define LL_RTC_ALMB_MASK_HOURS RTC_ALRMBR_MSK3 /*!< Hours do not care in Alarm B comparison */
  325. #define LL_RTC_ALMB_MASK_MINUTES RTC_ALRMBR_MSK2 /*!< Minutes do not care in Alarm B comparison */
  326. #define LL_RTC_ALMB_MASK_SECONDS RTC_ALRMBR_MSK1 /*!< Seconds do not care in Alarm B comparison */
  327. #define LL_RTC_ALMB_MASK_ALL (RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1) /*!< Masks all */
  328. /**
  329. * @}
  330. */
  331. /** @defgroup RTC_LL_EC_ALMB_TIME_FORMAT ALARMB TIME FORMAT
  332. * @{
  333. */
  334. #define LL_RTC_ALMB_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */
  335. #define LL_RTC_ALMB_TIME_FORMAT_PM RTC_ALRMBR_PM /*!< PM */
  336. /**
  337. * @}
  338. */
  339. /** @defgroup RTC_LL_EC_TIMESTAMP_EDGE TIMESTAMP EDGE
  340. * @{
  341. */
  342. #define LL_RTC_TIMESTAMP_EDGE_RISING 0x00000000U /*!< RTC_TS input rising edge generates a time-stamp event */
  343. #define LL_RTC_TIMESTAMP_EDGE_FALLING RTC_CR_TSEDGE /*!< RTC_TS input falling edge generates a time-stamp even */
  344. /**
  345. * @}
  346. */
  347. /** @defgroup RTC_LL_EC_TS_TIME_FORMAT TIMESTAMP TIME FORMAT
  348. * @{
  349. */
  350. #define LL_RTC_TS_TIME_FORMAT_AM 0x00000000U /*!< AM or 24-hour format */
  351. #define LL_RTC_TS_TIME_FORMAT_PM RTC_TSTR_PM /*!< PM */
  352. /**
  353. * @}
  354. */
  355. /** @defgroup RTC_LL_EC_TAMPER TAMPER
  356. * @{
  357. */
  358. #define LL_RTC_TAMPER_1 TAMP_CR1_TAMP1E /*!< Tamper 1 input detection */
  359. #define LL_RTC_TAMPER_2 TAMP_CR1_TAMP2E /*!< Tamper 2 input detection */
  360. #if (RTC_TAMP_NB == 3)
  361. #define LL_RTC_TAMPER_3 TAMP_CR1_TAMP3E /*!< Tamper 3 input detection */
  362. #elif (RTC_TAMP_NB == 8)
  363. #define LL_RTC_TAMPER_3 TAMP_CR1_TAMP3E /*!< Tamper 3 input detection */
  364. #define LL_RTC_TAMPER_3 TAMP_CR1_TAMP3E /*!< Tamper 3 input detection */
  365. #define LL_RTC_TAMPER_4 TAMP_CR1_TAMP4E /*!< Tamper 4 input detection */
  366. #define LL_RTC_TAMPER_5 TAMP_CR1_TAMP5E /*!< Tamper 5 input detection */
  367. #define LL_RTC_TAMPER_6 TAMP_CR1_TAMP6E /*!< Tamper 6 input detection */
  368. #define LL_RTC_TAMPER_7 TAMP_CR1_TAMP7E /*!< Tamper 7 input detection */
  369. #define LL_RTC_TAMPER_8 TAMP_CR1_TAMP8E /*!< Tamper 8 input detection */
  370. #else
  371. #warning "RTC_TAMP_NB is not correct"
  372. #endif /* (RTC_TAMP_NB) */
  373. /**
  374. * @}
  375. */
  376. /** @defgroup RTC_LL_EC_TAMPER_MASK TAMPER MASK
  377. * @{
  378. */
  379. #define LL_RTC_TAMPER_MASK_TAMPER1 TAMP_CR2_TAMP1MSK /*!< Tamper 1 event generates a trigger event. TAMP1F is masked and internally cleared by hardware.The backup registers are not erased */
  380. #define LL_RTC_TAMPER_MASK_TAMPER2 TAMP_CR2_TAMP2MSK /*!< Tamper 2 event generates a trigger event. TAMP2F is masked and internally cleared by hardware. The backup registers are not erased. */
  381. #if (RTC_TAMP_NB == 3)
  382. #define LL_RTC_TAMPER_MASK_TAMPER3 TAMP_CR2_TAMP3MSK /*!< Tamper 3 event generates a trigger event. TAMP2F is masked and internally cleared by hardware. The backup registers are not erased. */
  383. #elif (RTC_TAMP_NB == 8)
  384. #define LL_RTC_TAMPER_MASK_TAMPER3 TAMP_CR2_TAMP3MSK /*!< Tamper 3 event generates a trigger event. TAMP2F is masked and internally cleared by hardware. The backup registers are not erased. */
  385. #define LL_RTC_TAMPER_MASK_TAMPER4 TAMP_CR2_TAMP4MSK /*!< Tamper 4 event generates a trigger event. TAMP1F is masked and internally cleared by hardware.The backup registers are not erased */
  386. #define LL_RTC_TAMPER_MASK_TAMPER5 TAMP_CR2_TAMP5MSK /*!< Tamper 5 event generates a trigger event. TAMP2F is masked and internally cleared by hardware. The backup registers are not erased. */
  387. #define LL_RTC_TAMPER_MASK_TAMPER6 TAMP_CR2_TAMP6MSK /*!< Tamper 6 event generates a trigger event. TAMP1F is masked and internally cleared by hardware.The backup registers are not erased */
  388. #define LL_RTC_TAMPER_MASK_TAMPER7 TAMP_CR2_TAMP7MSK /*!< Tamper 7 event generates a trigger event. TAMP2F is masked and internally cleared by hardware. The backup registers are not erased. */
  389. #define LL_RTC_TAMPER_MASK_TAMPER8 TAMP_CR2_TAMP8MSK /*!< Tamper 8 event generates a trigger event. TAMP2F is masked and internally cleared by hardware. The backup registers are not erased. */
  390. #else
  391. #warning "RTC_TAMP_NB is not correct"
  392. #endif /* (RTC_TAMP_NB) */
  393. /**
  394. * @}
  395. */
  396. /** @defgroup RTC_LL_EC_TAMPER_NOERASE TAMPER NO ERASE
  397. * @{
  398. */
  399. #define LL_RTC_TAMPER_NOERASE_TAMPER1 TAMP_CR2_TAMP1NOERASE /*!< Tamper 1 event does not erase the backup registers. */
  400. #define LL_RTC_TAMPER_NOERASE_TAMPER2 TAMP_CR2_TAMP2NOERASE /*!< Tamper 2 event does not erase the backup registers. */
  401. #if (RTC_TAMP_NB == 3)
  402. #define LL_RTC_TAMPER_NOERASE_TAMPER3 TAMP_CR2_TAMP3NOERASE /*!< Tamper 3 event does not erase the backup registers. */
  403. #elif (RTC_TAMP_NB == 8)
  404. #define LL_RTC_TAMPER_NOERASE_TAMPER3 TAMP_CR2_TAMP3NOERASE /*!< Tamper 3 event does not erase the backup registers. */
  405. #define LL_RTC_TAMPER_NOERASE_TAMPER4 TAMP_CR2_TAMP4NOERASE /*!< Tamper 4 event does not erase the backup registers. */
  406. #define LL_RTC_TAMPER_NOERASE_TAMPER5 TAMP_CR2_TAMP5NOERASE /*!< Tamper 5 event does not erase the backup registers. */
  407. #define LL_RTC_TAMPER_NOERASE_TAMPER6 TAMP_CR2_TAMP6NOERASE /*!< Tamper 6 event does not erase the backup registers. */
  408. #define LL_RTC_TAMPER_NOERASE_TAMPER7 TAMP_CR2_TAMP7NOERASE /*!< Tamper 7 event does not erase the backup registers. */
  409. #define LL_RTC_TAMPER_NOERASE_TAMPER8 TAMP_CR2_TAMP8NOERASE /*!< Tamper 8 event does not erase the backup registers. */
  410. #else
  411. #warning "RTC_TAMP_NB is not correct"
  412. #endif /* (RTC_TAMP_NB) */
  413. /**
  414. * @}
  415. */
  416. /** @defgroup RTC_LL_EC_TAMPER_DURATION TAMPER DURATION
  417. * @{
  418. */
  419. #define LL_RTC_TAMPER_DURATION_1RTCCLK 0x00000000U /*!< Tamper pins are pre-charged before sampling during 1 RTCCLK cycle */
  420. #define LL_RTC_TAMPER_DURATION_2RTCCLK TAMP_FLTCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before sampling during 2 RTCCLK cycles */
  421. #define LL_RTC_TAMPER_DURATION_4RTCCLK TAMP_FLTCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before sampling during 4 RTCCLK cycles */
  422. #define LL_RTC_TAMPER_DURATION_8RTCCLK TAMP_FLTCR_TAMPPRCH /*!< Tamper pins are pre-charged before sampling during 8 RTCCLK cycles */
  423. /**
  424. * @}
  425. */
  426. /** @defgroup RTC_LL_EC_TAMPER_FILTER TAMPER FILTER
  427. * @{
  428. */
  429. #define LL_RTC_TAMPER_FILTER_DISABLE 0x00000000U /*!< Tamper filter is disabled */
  430. #define LL_RTC_TAMPER_FILTER_2SAMPLE TAMP_FLTCR_TAMPFLT_0 /*!< Tamper is activated after 2 consecutive samples at the active level */
  431. #define LL_RTC_TAMPER_FILTER_4SAMPLE TAMP_FLTCR_TAMPFLT_1 /*!< Tamper is activated after 4 consecutive samples at the active level */
  432. #define LL_RTC_TAMPER_FILTER_8SAMPLE TAMP_FLTCR_TAMPFLT /*!< Tamper is activated after 8 consecutive samples at the active level. */
  433. /**
  434. * @}
  435. */
  436. /** @defgroup RTC_LL_EC_TAMPER_SAMPLFREQDIV TAMPER SAMPLING FREQUENCY DIVIDER
  437. * @{
  438. */
  439. #define LL_RTC_TAMPER_SAMPLFREQDIV_32768 0x00000000U /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 32768 */
  440. #define LL_RTC_TAMPER_SAMPLFREQDIV_16384 TAMP_FLTCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 16384 */
  441. #define LL_RTC_TAMPER_SAMPLFREQDIV_8192 TAMP_FLTCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 8192 */
  442. #define LL_RTC_TAMPER_SAMPLFREQDIV_4096 (TAMP_FLTCR_TAMPFREQ_1 | TAMP_FLTCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 4096 */
  443. #define LL_RTC_TAMPER_SAMPLFREQDIV_2048 TAMP_FLTCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 2048 */
  444. #define LL_RTC_TAMPER_SAMPLFREQDIV_1024 (TAMP_FLTCR_TAMPFREQ_2 | TAMP_FLTCR_TAMPFREQ_0) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 1024 */
  445. #define LL_RTC_TAMPER_SAMPLFREQDIV_512 (TAMP_FLTCR_TAMPFREQ_2 | TAMP_FLTCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 512 */
  446. #define LL_RTC_TAMPER_SAMPLFREQDIV_256 TAMP_FLTCR_TAMPFREQ /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 256 */
  447. /**
  448. * @}
  449. */
  450. /** @defgroup RTC_LL_EC_TAMPER_ACTIVELEVEL TAMPER ACTIVE LEVEL
  451. * @{
  452. */
  453. #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP1 TAMP_CR2_TAMP1TRG /*!< Tamper 1 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
  454. #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP2 TAMP_CR2_TAMP2TRG /*!< Tamper 2 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
  455. #if (RTC_TAMP_NB == 3)
  456. #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP3 TAMP_CR2_TAMP3TRG /*!< Tamper 3 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
  457. #elif (RTC_TAMP_NB == 8)
  458. #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP3 TAMP_CR2_TAMP3TRG /*!< Tamper 3 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
  459. #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP4 TAMP_CR2_TAMP4TRG /*!< Tamper 4 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
  460. #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP5 TAMP_CR2_TAMP5TRG /*!< Tamper 5 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
  461. #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP6 TAMP_CR2_TAMP6TRG /*!< Tamper 6 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
  462. #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP7 TAMP_CR2_TAMP7TRG /*!< Tamper 7 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
  463. #define LL_RTC_TAMPER_ACTIVELEVEL_TAMP8 TAMP_CR2_TAMP8TRG /*!< Tamper 8 input falling edge (if TAMPFLT = 00) or staying high (if TAMPFLT != 00) triggers a tamper detection event */
  464. #endif /* (RTC_TAMP_NB) */
  465. /**
  466. * @}
  467. */
  468. /** @defgroup RTC_LL_EC_INTERNAL INTERNAL TAMPER
  469. * @{
  470. */
  471. #define LL_RTC_TAMPER_ITAMP1 TAMP_CR1_ITAMP1E /*!< Internal tamper 1: RTC supply voltage monitoring */
  472. #if defined (RTC_TAMP_INT_2_SUPPORT)
  473. #define LL_RTC_TAMPER_ITAMP2 TAMP_CR1_ITAMP2E /*!< Internal tamper 2: temperature monitoring */
  474. #endif /* RTC_TAMP_INT_2_SUPPORT */
  475. #define LL_RTC_TAMPER_ITAMP3 TAMP_CR1_ITAMP3E /*!< Internal tamper 3: LSE monitoring */
  476. #define LL_RTC_TAMPER_ITAMP4 TAMP_CR1_ITAMP4E /*!< Internal tamper 4: HSE monitoring */
  477. #define LL_RTC_TAMPER_ITAMP5 TAMP_CR1_ITAMP5E /*!< Internal tamper 5: RTC calendar overflow */
  478. #if defined (RTC_TAMP_INT_6_SUPPORT)
  479. #define LL_RTC_TAMPER_ITAMP6 TAMP_CR1_ITAMP6E /*!< Internal tamper 6: Test mode entry */
  480. #endif /* RTC_TAMP_INT_6_SUPPORT */
  481. #if defined (RTC_TAMP_INT_7_SUPPORT)
  482. #define LL_RTC_TAMPER_ITAMP7 TAMP_CR1_ITAMP7E /*!< Internal tamper 7: Readout protection level decrease */
  483. #endif /* RTC_TAMP_INT_7_SUPPORT */
  484. #if defined (RTC_TAMP_INT_8_SUPPORT)
  485. #define LL_RTC_TAMPER_ITAMP8 TAMP_CR1_ITAMP8E /*!< Internal tamper 8: Monotonic counter overflow */
  486. #endif /* RTC_TAMP_INT_8_SUPPORT */
  487. /**
  488. * @}
  489. */
  490. /** @defgroup RTC_LL_EC_BKP BACKUP
  491. * @{
  492. */
  493. #define LL_RTC_BKP_NUMBER RTC_BACKUP_NB
  494. #if (LL_RTC_BKP_NUMBER == 5)
  495. #define LL_RTC_BKP_DR0 0x00U
  496. #define LL_RTC_BKP_DR1 0x01U
  497. #define LL_RTC_BKP_DR2 0x02U
  498. #define LL_RTC_BKP_DR3 0x03U
  499. #define LL_RTC_BKP_DR4 0x04U
  500. #elif (LL_RTC_BKP_NUMBER == 16)
  501. #define LL_RTC_BKP_DR0 0x00U
  502. #define LL_RTC_BKP_DR1 0x01U
  503. #define LL_RTC_BKP_DR2 0x02U
  504. #define LL_RTC_BKP_DR3 0x03U
  505. #define LL_RTC_BKP_DR4 0x04U
  506. #define LL_RTC_BKP_DR5 0x05U
  507. #define LL_RTC_BKP_DR6 0x06U
  508. #define LL_RTC_BKP_DR7 0x07U
  509. #define LL_RTC_BKP_DR8 0x08U
  510. #define LL_RTC_BKP_DR9 0x09U
  511. #define LL_RTC_BKP_DR10 0x0AU
  512. #define LL_RTC_BKP_DR11 0x0BU
  513. #define LL_RTC_BKP_DR12 0x0CU
  514. #define LL_RTC_BKP_DR13 0x0DU
  515. #define LL_RTC_BKP_DR14 0x0EU
  516. #define LL_RTC_BKP_DR15 0x0FU
  517. #elif (LL_RTC_BKP_NUMBER == 32)
  518. #define LL_RTC_BKP_DR0 0x00U
  519. #define LL_RTC_BKP_DR1 0x01U
  520. #define LL_RTC_BKP_DR2 0x02U
  521. #define LL_RTC_BKP_DR3 0x03U
  522. #define LL_RTC_BKP_DR4 0x04U
  523. #define LL_RTC_BKP_DR5 0x05U
  524. #define LL_RTC_BKP_DR6 0x06U
  525. #define LL_RTC_BKP_DR7 0x07U
  526. #define LL_RTC_BKP_DR8 0x08U
  527. #define LL_RTC_BKP_DR9 0x09U
  528. #define LL_RTC_BKP_DR10 0x0AU
  529. #define LL_RTC_BKP_DR11 0x0BU
  530. #define LL_RTC_BKP_DR12 0x0CU
  531. #define LL_RTC_BKP_DR13 0x0DU
  532. #define LL_RTC_BKP_DR14 0x0EU
  533. #define LL_RTC_BKP_DR15 0x0FU
  534. #define LL_RTC_BKP_DR16 0x10U
  535. #define LL_RTC_BKP_DR17 0x11U
  536. #define LL_RTC_BKP_DR18 0x12U
  537. #define LL_RTC_BKP_DR19 0x13U
  538. #define LL_RTC_BKP_DR20 0x14U
  539. #define LL_RTC_BKP_DR21 0x15U
  540. #define LL_RTC_BKP_DR22 0x16U
  541. #define LL_RTC_BKP_DR23 0x17U
  542. #define LL_RTC_BKP_DR24 0x18U
  543. #define LL_RTC_BKP_DR25 0x19U
  544. #define LL_RTC_BKP_DR26 0x1AU
  545. #define LL_RTC_BKP_DR27 0x1BU
  546. #define LL_RTC_BKP_DR28 0x1CU
  547. #define LL_RTC_BKP_DR29 0x1DU
  548. #define LL_RTC_BKP_DR30 0x1EU
  549. #define LL_RTC_BKP_DR31 0x1FU
  550. #else
  551. #error "no LL Backup Registers Definition"
  552. #endif /* (LL_RTC_BKP_NUMBER) */
  553. /**
  554. * @}
  555. */
  556. /** @defgroup RTC_LL_EC_WAKEUPCLOCK_DIV WAKEUP CLOCK DIV
  557. * @{
  558. */
  559. #define LL_RTC_WAKEUPCLOCK_DIV_16 0x00000000U /*!< RTC/16 clock is selected */
  560. #define LL_RTC_WAKEUPCLOCK_DIV_8 RTC_CR_WUCKSEL_0 /*!< RTC/8 clock is selected */
  561. #define LL_RTC_WAKEUPCLOCK_DIV_4 RTC_CR_WUCKSEL_1 /*!< RTC/4 clock is selected */
  562. #define LL_RTC_WAKEUPCLOCK_DIV_2 (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_0) /*!< RTC/2 clock is selected */
  563. #define LL_RTC_WAKEUPCLOCK_CKSPRE RTC_CR_WUCKSEL_2 /*!< ck_spre (usually 1 Hz) clock is selected */
  564. #define LL_RTC_WAKEUPCLOCK_CKSPRE_WUT (RTC_CR_WUCKSEL_2 | RTC_CR_WUCKSEL_1) /*!< ck_spre (usually 1 Hz) clock is selected and 2exp16 is added to the WUT counter value*/
  565. /**
  566. * @}
  567. */
  568. /** @defgroup RTC_LL_EC_CALIB_OUTPUT Calibration output
  569. * @{
  570. */
  571. #define LL_RTC_CALIB_OUTPUT_NONE 0x00000000U /*!< Calibration output disabled */
  572. #define LL_RTC_CALIB_OUTPUT_1HZ (RTC_CR_COE | RTC_CR_COSEL) /*!< Calibration output is 1 Hz */
  573. #define LL_RTC_CALIB_OUTPUT_512HZ RTC_CR_COE /*!< Calibration output is 512 Hz */
  574. /**
  575. * @}
  576. */
  577. /** @defgroup RTC_LL_EC_CALIB_INSERTPULSE Calibration pulse insertion
  578. * @{
  579. */
  580. #define LL_RTC_CALIB_INSERTPULSE_NONE 0x00000000U /*!< No RTCCLK pulses are added */
  581. #define LL_RTC_CALIB_INSERTPULSE_SET RTC_CALR_CALP /*!< One RTCCLK pulse is effectively inserted every 2exp11 pulses (frequency increased by 488.5 ppm) */
  582. /**
  583. * @}
  584. */
  585. /** @defgroup RTC_LL_EC_CALIB_PERIOD Calibration period
  586. * @{
  587. */
  588. #define LL_RTC_CALIB_PERIOD_32SEC 0x00000000U /*!< Use a 32-second calibration cycle period */
  589. #define LL_RTC_CALIB_PERIOD_16SEC RTC_CALR_CALW16 /*!< Use a 16-second calibration cycle period */
  590. #define LL_RTC_CALIB_PERIOD_8SEC RTC_CALR_CALW8 /*!< Use a 8-second calibration cycle period */
  591. /**
  592. * @}
  593. */
  594. /**
  595. * @}
  596. */
  597. /* Exported macro ------------------------------------------------------------*/
  598. /** @defgroup RTC_LL_EM_Convert Convert helper Macros
  599. * @{
  600. */
  601. /**
  602. * @brief Helper macro to convert a value from 2 digit decimal format to BCD format
  603. * @param __VALUE__ Byte to be converted
  604. * @retval Converted byte
  605. */
  606. #define __LL_RTC_CONVERT_BIN2BCD(__VALUE__) (uint8_t)((((__VALUE__) / 10U) << 4U) | ((__VALUE__) % 10U))
  607. /**
  608. * @brief Helper macro to convert a value from BCD format to 2 digit decimal format
  609. * @param __VALUE__ BCD value to be converted
  610. * @retval Converted byte
  611. */
  612. #define __LL_RTC_CONVERT_BCD2BIN(__VALUE__) ((uint8_t)((((uint8_t)((__VALUE__) & (uint8_t)0xF0U) >> (uint8_t)0x4U) * 10U) + ((__VALUE__) & (uint8_t)0x0FU)))
  613. /**
  614. * @}
  615. */
  616. /** @defgroup RTC_LL_EM_Date Date helper Macros
  617. * @{
  618. */
  619. /**
  620. * @brief Helper macro to retrieve weekday.
  621. * @param __RTC_DATE__ Date returned by @ref LL_RTC_DATE_Get function.
  622. * @retval Returned value can be one of the following values:
  623. * @arg @ref LL_RTC_WEEKDAY_MONDAY
  624. * @arg @ref LL_RTC_WEEKDAY_TUESDAY
  625. * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
  626. * @arg @ref LL_RTC_WEEKDAY_THURSDAY
  627. * @arg @ref LL_RTC_WEEKDAY_FRIDAY
  628. * @arg @ref LL_RTC_WEEKDAY_SATURDAY
  629. * @arg @ref LL_RTC_WEEKDAY_SUNDAY
  630. */
  631. #define __LL_RTC_GET_WEEKDAY(__RTC_DATE__) (((__RTC_DATE__) >> RTC_OFFSET_WEEKDAY) & 0x000000FFU)
  632. /**
  633. * @brief Helper macro to retrieve Year in BCD format
  634. * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get
  635. * @retval Year in BCD format (0x00 . . . 0x99)
  636. */
  637. #define __LL_RTC_GET_YEAR(__RTC_DATE__) ((__RTC_DATE__) & 0x000000FFU)
  638. /**
  639. * @brief Helper macro to retrieve Month in BCD format
  640. * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get
  641. * @retval Returned value can be one of the following values:
  642. * @arg @ref LL_RTC_MONTH_JANUARY
  643. * @arg @ref LL_RTC_MONTH_FEBRUARY
  644. * @arg @ref LL_RTC_MONTH_MARCH
  645. * @arg @ref LL_RTC_MONTH_APRIL
  646. * @arg @ref LL_RTC_MONTH_MAY
  647. * @arg @ref LL_RTC_MONTH_JUNE
  648. * @arg @ref LL_RTC_MONTH_JULY
  649. * @arg @ref LL_RTC_MONTH_AUGUST
  650. * @arg @ref LL_RTC_MONTH_SEPTEMBER
  651. * @arg @ref LL_RTC_MONTH_OCTOBER
  652. * @arg @ref LL_RTC_MONTH_NOVEMBER
  653. * @arg @ref LL_RTC_MONTH_DECEMBER
  654. */
  655. #define __LL_RTC_GET_MONTH(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_MONTH) & 0x000000FFU)
  656. /**
  657. * @brief Helper macro to retrieve Day in BCD format
  658. * @param __RTC_DATE__ Value returned by @ref LL_RTC_DATE_Get
  659. * @retval Day in BCD format (0x01 . . . 0x31)
  660. */
  661. #define __LL_RTC_GET_DAY(__RTC_DATE__) (((__RTC_DATE__) >>RTC_OFFSET_DAY) & 0x000000FFU)
  662. /**
  663. * @}
  664. */
  665. /** @defgroup RTC_LL_EM_Time Time helper Macros
  666. * @{
  667. */
  668. /**
  669. * @brief Helper macro to retrieve hour in BCD format
  670. * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
  671. * @retval Hours in BCD format (0x01. . .0x12 or between Min_Data=0x00 and Max_Data=0x23)
  672. */
  673. #define __LL_RTC_GET_HOUR(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_HOUR) & 0x000000FFU)
  674. /**
  675. * @brief Helper macro to retrieve minute in BCD format
  676. * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
  677. * @retval Minutes in BCD format (0x00. . .0x59)
  678. */
  679. #define __LL_RTC_GET_MINUTE(__RTC_TIME__) (((__RTC_TIME__) >> RTC_OFFSET_MINUTE) & 0x000000FFU)
  680. /**
  681. * @brief Helper macro to retrieve second in BCD format
  682. * @param __RTC_TIME__ RTC time returned by @ref LL_RTC_TIME_Get function
  683. * @retval Seconds in format (0x00. . .0x59)
  684. */
  685. #define __LL_RTC_GET_SECOND(__RTC_TIME__) ((__RTC_TIME__) & 0x000000FFU)
  686. /**
  687. * @}
  688. */
  689. /**
  690. * @}
  691. */
  692. /* Exported functions --------------------------------------------------------*/
  693. /** @defgroup RTC_LL_Exported_Functions RTC Exported Functions
  694. * @{
  695. */
  696. /** @defgroup RTC_LL_EF_Configuration Configuration
  697. * @{
  698. */
  699. /**
  700. * @brief Set Hours format (24 hour/day or AM/PM hour format)
  701. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  702. * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
  703. * @rmtoll RTC_CR FMT LL_RTC_SetHourFormat
  704. * @param RTCx RTC Instance
  705. * @param HourFormat This parameter can be one of the following values:
  706. * @arg @ref LL_RTC_HOURFORMAT_24HOUR
  707. * @arg @ref LL_RTC_HOURFORMAT_AMPM
  708. * @retval None
  709. */
  710. __STATIC_INLINE void LL_RTC_SetHourFormat(RTC_TypeDef *RTCx, uint32_t HourFormat)
  711. {
  712. MODIFY_REG(RTCx->CR, RTC_CR_FMT, HourFormat);
  713. }
  714. /**
  715. * @brief Get Hours format (24 hour/day or AM/PM hour format)
  716. * @rmtoll RTC_CR FMT LL_RTC_GetHourFormat
  717. * @param RTCx RTC Instance
  718. * @retval Returned value can be one of the following values:
  719. * @arg @ref LL_RTC_HOURFORMAT_24HOUR
  720. * @arg @ref LL_RTC_HOURFORMAT_AMPM
  721. */
  722. __STATIC_INLINE uint32_t LL_RTC_GetHourFormat(RTC_TypeDef *RTCx)
  723. {
  724. return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_FMT));
  725. }
  726. /**
  727. * @brief Select the flag to be routed to RTC_ALARM output
  728. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  729. * @rmtoll RTC_CR OSEL LL_RTC_SetAlarmOutEvent
  730. * @param RTCx RTC Instance
  731. * @param AlarmOutput This parameter can be one of the following values:
  732. * @arg @ref LL_RTC_ALARMOUT_DISABLE
  733. * @arg @ref LL_RTC_ALARMOUT_ALMA
  734. * @arg @ref LL_RTC_ALARMOUT_ALMB
  735. * @arg @ref LL_RTC_ALARMOUT_WAKEUP
  736. * @retval None
  737. */
  738. __STATIC_INLINE void LL_RTC_SetAlarmOutEvent(RTC_TypeDef *RTCx, uint32_t AlarmOutput)
  739. {
  740. MODIFY_REG(RTCx->CR, RTC_CR_OSEL, AlarmOutput);
  741. }
  742. /**
  743. * @brief Get the flag to be routed to RTC_ALARM output
  744. * @rmtoll RTC_CR OSEL LL_RTC_GetAlarmOutEvent
  745. * @param RTCx RTC Instance
  746. * @retval Returned value can be one of the following values:
  747. * @arg @ref LL_RTC_ALARMOUT_DISABLE
  748. * @arg @ref LL_RTC_ALARMOUT_ALMA
  749. * @arg @ref LL_RTC_ALARMOUT_ALMB
  750. * @arg @ref LL_RTC_ALARMOUT_WAKEUP
  751. */
  752. __STATIC_INLINE uint32_t LL_RTC_GetAlarmOutEvent(RTC_TypeDef *RTCx)
  753. {
  754. return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_OSEL));
  755. }
  756. /**
  757. * @brief Set RTC_ALARM output type (ALARM in push-pull or open-drain output)
  758. * @rmtoll RTC_CR TAMPALRM_TYPE LL_RTC_SetAlarmOutputType
  759. * @param RTCx RTC Instance
  760. * @param Output This parameter can be one of the following values:
  761. * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN
  762. * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL
  763. * @retval None
  764. */
  765. __STATIC_INLINE void LL_RTC_SetAlarmOutputType(RTC_TypeDef *RTCx, uint32_t Output)
  766. {
  767. MODIFY_REG(RTCx->CR, RTC_CR_TAMPALRM_TYPE, Output);
  768. }
  769. /**
  770. * @brief Get RTC_ALARM output type (ALARM in push-pull or open-drain output)
  771. * @rmtoll RTC_CR TAMPALRM_TYPE LL_RTC_SetAlarmOutputType
  772. * @param RTCx RTC Instance
  773. * @retval Returned value can be one of the following values:
  774. * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_OPENDRAIN
  775. * @arg @ref LL_RTC_ALARM_OUTPUTTYPE_PUSHPULL
  776. */
  777. __STATIC_INLINE uint32_t LL_RTC_GetAlarmOutputType(RTC_TypeDef *RTCx)
  778. {
  779. return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_TAMPALRM_TYPE));
  780. }
  781. /**
  782. * @brief Enable initialization mode
  783. * @note Initialization mode is used to program time and date register (RTC_TR and RTC_DR)
  784. * and prescaler register (RTC_PRER).
  785. * Counters are stopped and start counting from the new value when INIT is reset.
  786. * @rmtoll RTC_ICSR INIT LL_RTC_EnableInitMode
  787. * @param RTCx RTC Instance
  788. * @retval None
  789. */
  790. __STATIC_INLINE void LL_RTC_EnableInitMode(RTC_TypeDef *RTCx)
  791. {
  792. /* Set the Initialization mode */
  793. WRITE_REG(RTCx->ICSR, RTC_LL_INIT_MASK);
  794. }
  795. /**
  796. * @brief Disable initialization mode (Free running mode)
  797. * @rmtoll RTC_ICSR INIT LL_RTC_DisableInitMode
  798. * @param RTCx RTC Instance
  799. * @retval None
  800. */
  801. __STATIC_INLINE void LL_RTC_DisableInitMode(RTC_TypeDef *RTCx)
  802. {
  803. /* Exit Initialization mode */
  804. WRITE_REG(RTCx->ICSR, (uint32_t)~RTC_ICSR_INIT);
  805. }
  806. /**
  807. * @brief Set Output polarity (pin is low when ALRAF/ALRBF/WUTF is asserted)
  808. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  809. * @rmtoll RTC_CR POL LL_RTC_SetOutputPolarity
  810. * @param RTCx RTC Instance
  811. * @param Polarity This parameter can be one of the following values:
  812. * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH
  813. * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW
  814. * @retval None
  815. */
  816. __STATIC_INLINE void LL_RTC_SetOutputPolarity(RTC_TypeDef *RTCx, uint32_t Polarity)
  817. {
  818. MODIFY_REG(RTCx->CR, RTC_CR_POL, Polarity);
  819. }
  820. /**
  821. * @brief Get Output polarity
  822. * @rmtoll RTC_CR POL LL_RTC_GetOutputPolarity
  823. * @param RTCx RTC Instance
  824. * @retval Returned value can be one of the following values:
  825. * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_HIGH
  826. * @arg @ref LL_RTC_OUTPUTPOLARITY_PIN_LOW
  827. */
  828. __STATIC_INLINE uint32_t LL_RTC_GetOutputPolarity(RTC_TypeDef *RTCx)
  829. {
  830. return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_POL));
  831. }
  832. /**
  833. * @brief Enable Bypass the shadow registers
  834. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  835. * @rmtoll RTC_CR BYPSHAD LL_RTC_EnableShadowRegBypass
  836. * @param RTCx RTC Instance
  837. * @retval None
  838. */
  839. __STATIC_INLINE void LL_RTC_EnableShadowRegBypass(RTC_TypeDef *RTCx)
  840. {
  841. SET_BIT(RTCx->CR, RTC_CR_BYPSHAD);
  842. }
  843. /**
  844. * @brief Disable Bypass the shadow registers
  845. * @rmtoll RTC_CR BYPSHAD LL_RTC_DisableShadowRegBypass
  846. * @param RTCx RTC Instance
  847. * @retval None
  848. */
  849. __STATIC_INLINE void LL_RTC_DisableShadowRegBypass(RTC_TypeDef *RTCx)
  850. {
  851. CLEAR_BIT(RTCx->CR, RTC_CR_BYPSHAD);
  852. }
  853. /**
  854. * @brief Check if Shadow registers bypass is enabled or not.
  855. * @rmtoll RTC_CR BYPSHAD LL_RTC_IsShadowRegBypassEnabled
  856. * @param RTCx RTC Instance
  857. * @retval State of bit (1 or 0).
  858. */
  859. __STATIC_INLINE uint32_t LL_RTC_IsShadowRegBypassEnabled(RTC_TypeDef *RTCx)
  860. {
  861. return ((READ_BIT(RTCx->CR, RTC_CR_BYPSHAD) == (RTC_CR_BYPSHAD)) ? 1U : 0U);
  862. }
  863. /**
  864. * @brief Enable RTC_REFIN reference clock detection (50 or 60 Hz)
  865. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  866. * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
  867. * @rmtoll RTC_CR REFCKON LL_RTC_EnableRefClock
  868. * @param RTCx RTC Instance
  869. * @retval None
  870. */
  871. __STATIC_INLINE void LL_RTC_EnableRefClock(RTC_TypeDef *RTCx)
  872. {
  873. SET_BIT(RTCx->CR, RTC_CR_REFCKON);
  874. }
  875. /**
  876. * @brief Disable RTC_REFIN reference clock detection (50 or 60 Hz)
  877. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  878. * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
  879. * @rmtoll RTC_CR REFCKON LL_RTC_DisableRefClock
  880. * @param RTCx RTC Instance
  881. * @retval None
  882. */
  883. __STATIC_INLINE void LL_RTC_DisableRefClock(RTC_TypeDef *RTCx)
  884. {
  885. CLEAR_BIT(RTCx->CR, RTC_CR_REFCKON);
  886. }
  887. /**
  888. * @brief Set Asynchronous prescaler factor
  889. * @rmtoll RTC_PRER PREDIV_A LL_RTC_SetAsynchPrescaler
  890. * @param RTCx RTC Instance
  891. * @param AsynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7F
  892. * @retval None
  893. */
  894. __STATIC_INLINE void LL_RTC_SetAsynchPrescaler(RTC_TypeDef *RTCx, uint32_t AsynchPrescaler)
  895. {
  896. MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_A, AsynchPrescaler << RTC_PRER_PREDIV_A_Pos);
  897. }
  898. /**
  899. * @brief Set Synchronous prescaler factor
  900. * @rmtoll RTC_PRER PREDIV_S LL_RTC_SetSynchPrescaler
  901. * @param RTCx RTC Instance
  902. * @param SynchPrescaler Value between Min_Data = 0 and Max_Data = 0x7FFF
  903. * @retval None
  904. */
  905. __STATIC_INLINE void LL_RTC_SetSynchPrescaler(RTC_TypeDef *RTCx, uint32_t SynchPrescaler)
  906. {
  907. MODIFY_REG(RTCx->PRER, RTC_PRER_PREDIV_S, SynchPrescaler);
  908. }
  909. /**
  910. * @brief Get Asynchronous prescaler factor
  911. * @rmtoll RTC_PRER PREDIV_A LL_RTC_GetAsynchPrescaler
  912. * @param RTCx RTC Instance
  913. * @retval Value between Min_Data = 0 and Max_Data = 0x7F
  914. */
  915. __STATIC_INLINE uint32_t LL_RTC_GetAsynchPrescaler(RTC_TypeDef *RTCx)
  916. {
  917. return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_A) >> RTC_PRER_PREDIV_A_Pos);
  918. }
  919. /**
  920. * @brief Get Synchronous prescaler factor
  921. * @rmtoll RTC_PRER PREDIV_S LL_RTC_GetSynchPrescaler
  922. * @param RTCx RTC Instance
  923. * @retval Value between Min_Data = 0 and Max_Data = 0x7FFF
  924. */
  925. __STATIC_INLINE uint32_t LL_RTC_GetSynchPrescaler(RTC_TypeDef *RTCx)
  926. {
  927. return (uint32_t)(READ_BIT(RTCx->PRER, RTC_PRER_PREDIV_S));
  928. }
  929. /**
  930. * @brief Enable the write protection for RTC registers.
  931. * @rmtoll RTC_WPR KEY LL_RTC_EnableWriteProtection
  932. * @param RTCx RTC Instance
  933. * @retval None
  934. */
  935. __STATIC_INLINE void LL_RTC_EnableWriteProtection(RTC_TypeDef *RTCx)
  936. {
  937. WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_DISABLE);
  938. }
  939. /**
  940. * @brief Disable the write protection for RTC registers.
  941. * @rmtoll RTC_WPR KEY LL_RTC_DisableWriteProtection
  942. * @param RTCx RTC Instance
  943. * @retval None
  944. */
  945. __STATIC_INLINE void LL_RTC_DisableWriteProtection(RTC_TypeDef *RTCx)
  946. {
  947. WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_1);
  948. WRITE_REG(RTCx->WPR, RTC_WRITE_PROTECTION_ENABLE_2);
  949. }
  950. /**
  951. * @brief Enable tamper output.
  952. * @note When the tamper output is enabled, all external and internal tamper flags
  953. * are ORed and routed to the TAMPALRM output.
  954. * @rmtoll RTC_CR TAMPOE LL_RTC_EnableTamperOutput
  955. * @param RTCx RTC Instance
  956. * @retval None
  957. */
  958. __STATIC_INLINE void LL_RTC_EnableTamperOutput(RTC_TypeDef *RTCx)
  959. {
  960. SET_BIT(RTCx->CR, RTC_CR_TAMPOE);
  961. }
  962. /**
  963. * @brief Disable tamper output.
  964. * @rmtoll RTC_CR TAMPOE LL_RTC_DisableTamperOutput
  965. * @param RTCx RTC Instance
  966. * @retval None
  967. */
  968. __STATIC_INLINE void LL_RTC_DisableTamperOutput(RTC_TypeDef *RTCx)
  969. {
  970. CLEAR_BIT(RTCx->CR, RTC_CR_TAMPOE);
  971. }
  972. /**
  973. * @brief Check if tamper output is enabled or not.
  974. * @rmtoll RTC_CR TAMPOE LL_RTC_IsTamperOutputEnabled
  975. * @param RTCx RTC Instance
  976. * @retval State of bit (1 or 0).
  977. */
  978. __STATIC_INLINE uint32_t LL_RTC_IsTamperOutputEnabled(RTC_TypeDef *RTCx)
  979. {
  980. return ((READ_BIT(RTCx->CR, RTC_CR_TAMPOE) == (RTC_CR_TAMPOE)) ? 1U : 0U);
  981. }
  982. /**
  983. * @brief Enable internal pull-up in output mode.
  984. * @rmtoll RTC_CR TAMPALRM_PU LL_RTC_EnableAlarmPullUp
  985. * @param RTCx RTC Instance
  986. * @retval None
  987. */
  988. __STATIC_INLINE void LL_RTC_EnableAlarmPullUp(RTC_TypeDef *RTCx)
  989. {
  990. SET_BIT(RTCx->CR, RTC_CR_TAMPALRM_PU);
  991. }
  992. /**
  993. * @brief Disable internal pull-up in output mode.
  994. * @rmtoll RTC_CR TAMPALRM_PU LL_RTC_EnableAlarmPullUp
  995. * @param RTCx RTC Instance
  996. * @retval None
  997. */
  998. __STATIC_INLINE void LL_RTC_DisableAlarmPullUp(RTC_TypeDef *RTCx)
  999. {
  1000. CLEAR_BIT(RTCx->CR, RTC_CR_TAMPALRM_PU);
  1001. }
  1002. /**
  1003. * @brief Check if internal pull-up in output mode is enabled or not.
  1004. * @rmtoll RTC_CR TAMPALRM_PU LL_RTC_IsAlarmPullUpEnabled
  1005. * @param RTCx RTC Instance
  1006. * @retval State of bit (1 or 0).
  1007. */
  1008. __STATIC_INLINE uint32_t LL_RTC_IsAlarmPullUpEnabled(RTC_TypeDef *RTCx)
  1009. {
  1010. return ((READ_BIT(RTCx->CR, RTC_CR_TAMPALRM_PU) == (RTC_CR_TAMPALRM_PU)) ? 1U : 0U);
  1011. }
  1012. /**
  1013. * @brief Enable RTC_OUT2 output
  1014. * @note RTC_OUT2 mapping depends on both OSEL (@ref LL_RTC_SetAlarmOutEvent)
  1015. * and COE (@ref LL_RTC_CAL_SetOutputFreq) settings.
  1016. * @note RTC_OUT2 is not available ins VBAT mode.
  1017. * @rmtoll RTC_CR OUT2EN LL_RTC_EnableOutput2
  1018. * @param RTCx RTC Instance
  1019. * @retval None
  1020. */
  1021. __STATIC_INLINE void LL_RTC_EnableOutput2(RTC_TypeDef *RTCx)
  1022. {
  1023. SET_BIT(RTCx->CR, RTC_CR_OUT2EN);
  1024. }
  1025. /**
  1026. * @brief Disable RTC_OUT2 output
  1027. * @rmtoll RTC_CR OUT2EN LL_RTC_DisableOutput2
  1028. * @param RTCx RTC Instance
  1029. * @retval None
  1030. */
  1031. __STATIC_INLINE void LL_RTC_DisableOutput2(RTC_TypeDef *RTCx)
  1032. {
  1033. CLEAR_BIT(RTCx->CR, RTC_CR_OUT2EN);
  1034. }
  1035. /**
  1036. * @brief Check if RTC_OUT2 output is enabled or not.
  1037. * @rmtoll RTC_CR OUT2EN LL_RTC_IsOutput2Enabled
  1038. * @param RTCx RTC Instance
  1039. * @retval State of bit (1 or 0).
  1040. */
  1041. __STATIC_INLINE uint32_t LL_RTC_IsOutput2Enabled(RTC_TypeDef *RTCx)
  1042. {
  1043. return ((READ_BIT(RTCx->CR, RTC_CR_OUT2EN) == (RTC_CR_OUT2EN)) ? 1U : 0U);
  1044. }
  1045. /**
  1046. * @}
  1047. */
  1048. /** @defgroup RTC_LL_EF_Time Time
  1049. * @{
  1050. */
  1051. /**
  1052. * @brief Set time format (AM/24-hour or PM notation)
  1053. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  1054. * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
  1055. * @rmtoll RTC_TR PM LL_RTC_TIME_SetFormat
  1056. * @param RTCx RTC Instance
  1057. * @param TimeFormat This parameter can be one of the following values:
  1058. * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
  1059. * @arg @ref LL_RTC_TIME_FORMAT_PM
  1060. * @retval None
  1061. */
  1062. __STATIC_INLINE void LL_RTC_TIME_SetFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
  1063. {
  1064. MODIFY_REG(RTCx->TR, RTC_TR_PM, TimeFormat);
  1065. }
  1066. /**
  1067. * @brief Get time format (AM or PM notation)
  1068. * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
  1069. * before reading this bit
  1070. * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
  1071. * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
  1072. * @rmtoll RTC_TR PM LL_RTC_TIME_GetFormat
  1073. * @param RTCx RTC Instance
  1074. * @retval Returned value can be one of the following values:
  1075. * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
  1076. * @arg @ref LL_RTC_TIME_FORMAT_PM
  1077. */
  1078. __STATIC_INLINE uint32_t LL_RTC_TIME_GetFormat(RTC_TypeDef *RTCx)
  1079. {
  1080. return (uint32_t)(READ_BIT(RTCx->TR, RTC_TR_PM));
  1081. }
  1082. /**
  1083. * @brief Set Hours in BCD format
  1084. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  1085. * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
  1086. * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert hour from binary to BCD format
  1087. * @rmtoll RTC_TR HT LL_RTC_TIME_SetHour\n
  1088. * RTC_TR HU LL_RTC_TIME_SetHour
  1089. * @param RTCx RTC Instance
  1090. * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
  1091. * @retval None
  1092. */
  1093. __STATIC_INLINE void LL_RTC_TIME_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
  1094. {
  1095. MODIFY_REG(RTCx->TR, (RTC_TR_HT | RTC_TR_HU),
  1096. (((Hours & 0xF0U) << (RTC_TR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_TR_HU_Pos)));
  1097. }
  1098. /**
  1099. * @brief Get Hours in BCD format
  1100. * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
  1101. * before reading this bit
  1102. * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
  1103. * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
  1104. * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert hour from BCD to
  1105. * Binary format
  1106. * @rmtoll RTC_TR HT LL_RTC_TIME_GetHour\n
  1107. * RTC_TR HU LL_RTC_TIME_GetHour
  1108. * @param RTCx RTC Instance
  1109. * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
  1110. */
  1111. __STATIC_INLINE uint32_t LL_RTC_TIME_GetHour(RTC_TypeDef *RTCx)
  1112. {
  1113. return (uint32_t)((READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU))) >> RTC_TR_HU_Pos);
  1114. }
  1115. /**
  1116. * @brief Set Minutes in BCD format
  1117. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  1118. * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
  1119. * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
  1120. * @rmtoll RTC_TR MNT LL_RTC_TIME_SetMinute\n
  1121. * RTC_TR MNU LL_RTC_TIME_SetMinute
  1122. * @param RTCx RTC Instance
  1123. * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
  1124. * @retval None
  1125. */
  1126. __STATIC_INLINE void LL_RTC_TIME_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
  1127. {
  1128. MODIFY_REG(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU),
  1129. (((Minutes & 0xF0U) << (RTC_TR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_TR_MNU_Pos)));
  1130. }
  1131. /**
  1132. * @brief Get Minutes in BCD format
  1133. * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
  1134. * before reading this bit
  1135. * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
  1136. * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
  1137. * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert minute from BCD
  1138. * to Binary format
  1139. * @rmtoll RTC_TR MNT LL_RTC_TIME_GetMinute\n
  1140. * RTC_TR MNU LL_RTC_TIME_GetMinute
  1141. * @param RTCx RTC Instance
  1142. * @retval Value between Min_Data=0x00 and Max_Data=0x59
  1143. */
  1144. __STATIC_INLINE uint32_t LL_RTC_TIME_GetMinute(RTC_TypeDef *RTCx)
  1145. {
  1146. return (uint32_t)(READ_BIT(RTCx->TR, (RTC_TR_MNT | RTC_TR_MNU)) >> RTC_TR_MNU_Pos);
  1147. }
  1148. /**
  1149. * @brief Set Seconds in BCD format
  1150. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  1151. * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
  1152. * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
  1153. * @rmtoll RTC_TR ST LL_RTC_TIME_SetSecond\n
  1154. * RTC_TR SU LL_RTC_TIME_SetSecond
  1155. * @param RTCx RTC Instance
  1156. * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
  1157. * @retval None
  1158. */
  1159. __STATIC_INLINE void LL_RTC_TIME_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
  1160. {
  1161. MODIFY_REG(RTCx->TR, (RTC_TR_ST | RTC_TR_SU),
  1162. (((Seconds & 0xF0U) << (RTC_TR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_TR_SU_Pos)));
  1163. }
  1164. /**
  1165. * @brief Get Seconds in BCD format
  1166. * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
  1167. * before reading this bit
  1168. * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
  1169. * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
  1170. * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD
  1171. * to Binary format
  1172. * @rmtoll RTC_TR ST LL_RTC_TIME_GetSecond\n
  1173. * RTC_TR SU LL_RTC_TIME_GetSecond
  1174. * @param RTCx RTC Instance
  1175. * @retval Value between Min_Data=0x00 and Max_Data=0x59
  1176. */
  1177. __STATIC_INLINE uint32_t LL_RTC_TIME_GetSecond(RTC_TypeDef *RTCx)
  1178. {
  1179. return (uint32_t)(READ_BIT(RTCx->TR, (RTC_TR_ST | RTC_TR_SU)) >> RTC_TR_SU_Pos);
  1180. }
  1181. /**
  1182. * @brief Set time (hour, minute and second) in BCD format
  1183. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  1184. * @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function)
  1185. * @note TimeFormat and Hours should follow the same format
  1186. * @rmtoll RTC_TR PM LL_RTC_TIME_Config\n
  1187. * RTC_TR HT LL_RTC_TIME_Config\n
  1188. * RTC_TR HU LL_RTC_TIME_Config\n
  1189. * RTC_TR MNT LL_RTC_TIME_Config\n
  1190. * RTC_TR MNU LL_RTC_TIME_Config\n
  1191. * RTC_TR ST LL_RTC_TIME_Config\n
  1192. * RTC_TR SU LL_RTC_TIME_Config
  1193. * @param RTCx RTC Instance
  1194. * @param Format12_24 This parameter can be one of the following values:
  1195. * @arg @ref LL_RTC_TIME_FORMAT_AM_OR_24
  1196. * @arg @ref LL_RTC_TIME_FORMAT_PM
  1197. * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
  1198. * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
  1199. * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
  1200. * @retval None
  1201. */
  1202. __STATIC_INLINE void LL_RTC_TIME_Config(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes,
  1203. uint32_t Seconds)
  1204. {
  1205. uint32_t temp;
  1206. temp = Format12_24 | \
  1207. (((Hours & 0xF0U) << (RTC_TR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_TR_HU_Pos)) | \
  1208. (((Minutes & 0xF0U) << (RTC_TR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_TR_MNU_Pos)) | \
  1209. (((Seconds & 0xF0U) << (RTC_TR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_TR_SU_Pos));
  1210. MODIFY_REG(RTCx->TR, (RTC_TR_PM | RTC_TR_HT | RTC_TR_HU | RTC_TR_MNT | RTC_TR_MNU | RTC_TR_ST | RTC_TR_SU), temp);
  1211. }
  1212. /**
  1213. * @brief Get time (hour, minute and second) in BCD format
  1214. * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
  1215. * before reading this bit
  1216. * @note Read either RTC_SSR or RTC_TR locks the values in the higher-order calendar
  1217. * shadow registers until RTC_DR is read (LL_RTC_ReadReg(RTC, DR)).
  1218. * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
  1219. * are available to get independently each parameter.
  1220. * @rmtoll RTC_TR HT LL_RTC_TIME_Get\n
  1221. * RTC_TR HU LL_RTC_TIME_Get\n
  1222. * RTC_TR MNT LL_RTC_TIME_Get\n
  1223. * RTC_TR MNU LL_RTC_TIME_Get\n
  1224. * RTC_TR ST LL_RTC_TIME_Get\n
  1225. * RTC_TR SU LL_RTC_TIME_Get
  1226. * @param RTCx RTC Instance
  1227. * @retval Combination of hours, minutes and seconds (Format: 0x00HHMMSS).
  1228. */
  1229. __STATIC_INLINE uint32_t LL_RTC_TIME_Get(RTC_TypeDef *RTCx)
  1230. {
  1231. uint32_t temp;
  1232. temp = READ_BIT(RTCx->TR, (RTC_TR_HT | RTC_TR_HU | RTC_TR_MNT | RTC_TR_MNU | RTC_TR_ST | RTC_TR_SU));
  1233. return (uint32_t)((((((temp & RTC_TR_HT) >> RTC_TR_HT_Pos) << 4U) | ((temp & RTC_TR_HU) >> RTC_TR_HU_Pos)) << RTC_OFFSET_HOUR) | \
  1234. (((((temp & RTC_TR_MNT) >> RTC_TR_MNT_Pos) << 4U) | ((temp & RTC_TR_MNU) >> RTC_TR_MNU_Pos)) << RTC_OFFSET_MINUTE) | \
  1235. ((((temp & RTC_TR_ST) >> RTC_TR_ST_Pos) << 4U) | ((temp & RTC_TR_SU) >> RTC_TR_SU_Pos)));
  1236. }
  1237. /**
  1238. * @brief Memorize whether the daylight saving time change has been performed
  1239. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  1240. * @rmtoll RTC_CR BKP LL_RTC_TIME_EnableDayLightStore
  1241. * @param RTCx RTC Instance
  1242. * @retval None
  1243. */
  1244. __STATIC_INLINE void LL_RTC_TIME_EnableDayLightStore(RTC_TypeDef *RTCx)
  1245. {
  1246. SET_BIT(RTCx->CR, RTC_CR_BKP);
  1247. }
  1248. /**
  1249. * @brief Disable memorization whether the daylight saving time change has been performed.
  1250. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  1251. * @rmtoll RTC_CR BKP LL_RTC_TIME_DisableDayLightStore
  1252. * @param RTCx RTC Instance
  1253. * @retval None
  1254. */
  1255. __STATIC_INLINE void LL_RTC_TIME_DisableDayLightStore(RTC_TypeDef *RTCx)
  1256. {
  1257. CLEAR_BIT(RTCx->CR, RTC_CR_BKP);
  1258. }
  1259. /**
  1260. * @brief Check if RTC Day Light Saving stored operation has been enabled or not
  1261. * @rmtoll RTC_CR BKP LL_RTC_TIME_IsDayLightStoreEnabled
  1262. * @param RTCx RTC Instance
  1263. * @retval State of bit (1 or 0).
  1264. */
  1265. __STATIC_INLINE uint32_t LL_RTC_TIME_IsDayLightStoreEnabled(RTC_TypeDef *RTCx)
  1266. {
  1267. return ((READ_BIT(RTCx->CR, RTC_CR_BKP) == (RTC_CR_BKP)) ? 1U : 0U);
  1268. }
  1269. /**
  1270. * @brief Subtract 1 hour (winter time change)
  1271. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  1272. * @rmtoll RTC_CR SUB1H LL_RTC_TIME_DecHour
  1273. * @param RTCx RTC Instance
  1274. * @retval None
  1275. */
  1276. __STATIC_INLINE void LL_RTC_TIME_DecHour(RTC_TypeDef *RTCx)
  1277. {
  1278. SET_BIT(RTCx->CR, RTC_CR_SUB1H);
  1279. }
  1280. /**
  1281. * @brief Add 1 hour (summer time change)
  1282. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  1283. * @rmtoll RTC_CR ADD1H LL_RTC_TIME_IncHour
  1284. * @param RTCx RTC Instance
  1285. * @retval None
  1286. */
  1287. __STATIC_INLINE void LL_RTC_TIME_IncHour(RTC_TypeDef *RTCx)
  1288. {
  1289. SET_BIT(RTCx->CR, RTC_CR_ADD1H);
  1290. }
  1291. /**
  1292. * @brief Get Sub second value in the synchronous prescaler counter.
  1293. * @note You can use both SubSeconds value and SecondFraction (PREDIV_S through
  1294. * LL_RTC_GetSynchPrescaler function) terms returned to convert Calendar
  1295. * SubSeconds value in second fraction ratio with time unit following
  1296. * generic formula:
  1297. * ==> Seconds fraction ratio * time_unit= [(SecondFraction-SubSeconds)/(SecondFraction+1)] * time_unit
  1298. * This conversion can be performed only if no shift operation is pending
  1299. * (ie. SHFP=0) when PREDIV_S >= SS.
  1300. * @rmtoll RTC_SSR SS LL_RTC_TIME_GetSubSecond
  1301. * @param RTCx RTC Instance
  1302. * @retval Sub second value (number between 0 and 65535)
  1303. */
  1304. __STATIC_INLINE uint32_t LL_RTC_TIME_GetSubSecond(RTC_TypeDef *RTCx)
  1305. {
  1306. return (uint32_t)(READ_BIT(RTCx->SSR, RTC_SSR_SS));
  1307. }
  1308. /**
  1309. * @brief Synchronize to a remote clock with a high degree of precision.
  1310. * @note This operation effectively subtracts from (delays) or advance the clock of a fraction of a second.
  1311. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  1312. * @note When REFCKON is set, firmware must not write to Shift control register.
  1313. * @rmtoll RTC_SHIFTR ADD1S LL_RTC_TIME_Synchronize\n
  1314. * RTC_SHIFTR SUBFS LL_RTC_TIME_Synchronize
  1315. * @param RTCx RTC Instance
  1316. * @param ShiftSecond This parameter can be one of the following values:
  1317. * @arg @ref LL_RTC_SHIFT_SECOND_DELAY
  1318. * @arg @ref LL_RTC_SHIFT_SECOND_ADVANCE
  1319. * @param Fraction Number of Seconds Fractions (any value from 0 to 0x7FFF)
  1320. * @retval None
  1321. */
  1322. __STATIC_INLINE void LL_RTC_TIME_Synchronize(RTC_TypeDef *RTCx, uint32_t ShiftSecond, uint32_t Fraction)
  1323. {
  1324. WRITE_REG(RTCx->SHIFTR, (ShiftSecond | Fraction));
  1325. }
  1326. /**
  1327. * @}
  1328. */
  1329. /** @defgroup RTC_LL_EF_Date Date
  1330. * @{
  1331. */
  1332. /**
  1333. * @brief Set Year in BCD format
  1334. * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Year from binary to BCD format
  1335. * @rmtoll RTC_DR YT LL_RTC_DATE_SetYear\n
  1336. * RTC_DR YU LL_RTC_DATE_SetYear
  1337. * @param RTCx RTC Instance
  1338. * @param Year Value between Min_Data=0x00 and Max_Data=0x99
  1339. * @retval None
  1340. */
  1341. __STATIC_INLINE void LL_RTC_DATE_SetYear(RTC_TypeDef *RTCx, uint32_t Year)
  1342. {
  1343. MODIFY_REG(RTCx->DR, (RTC_DR_YT | RTC_DR_YU),
  1344. (((Year & 0xF0U) << (RTC_DR_YT_Pos - 4U)) | ((Year & 0x0FU) << RTC_DR_YU_Pos)));
  1345. }
  1346. /**
  1347. * @brief Get Year in BCD format
  1348. * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
  1349. * before reading this bit
  1350. * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Year from BCD to Binary format
  1351. * @rmtoll RTC_DR YT LL_RTC_DATE_GetYear\n
  1352. * RTC_DR YU LL_RTC_DATE_GetYear
  1353. * @param RTCx RTC Instance
  1354. * @retval Value between Min_Data=0x00 and Max_Data=0x99
  1355. */
  1356. __STATIC_INLINE uint32_t LL_RTC_DATE_GetYear(RTC_TypeDef *RTCx)
  1357. {
  1358. return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_YT | RTC_DR_YU))) >> RTC_DR_YU_Pos);
  1359. }
  1360. /**
  1361. * @brief Set Week day
  1362. * @rmtoll RTC_DR WDU LL_RTC_DATE_SetWeekDay
  1363. * @param RTCx RTC Instance
  1364. * @param WeekDay This parameter can be one of the following values:
  1365. * @arg @ref LL_RTC_WEEKDAY_MONDAY
  1366. * @arg @ref LL_RTC_WEEKDAY_TUESDAY
  1367. * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
  1368. * @arg @ref LL_RTC_WEEKDAY_THURSDAY
  1369. * @arg @ref LL_RTC_WEEKDAY_FRIDAY
  1370. * @arg @ref LL_RTC_WEEKDAY_SATURDAY
  1371. * @arg @ref LL_RTC_WEEKDAY_SUNDAY
  1372. * @retval None
  1373. */
  1374. __STATIC_INLINE void LL_RTC_DATE_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
  1375. {
  1376. MODIFY_REG(RTCx->DR, RTC_DR_WDU, WeekDay << RTC_DR_WDU_Pos);
  1377. }
  1378. /**
  1379. * @brief Get Week day
  1380. * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
  1381. * before reading this bit
  1382. * @rmtoll RTC_DR WDU LL_RTC_DATE_GetWeekDay
  1383. * @param RTCx RTC Instance
  1384. * @retval Returned value can be one of the following values:
  1385. * @arg @ref LL_RTC_WEEKDAY_MONDAY
  1386. * @arg @ref LL_RTC_WEEKDAY_TUESDAY
  1387. * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
  1388. * @arg @ref LL_RTC_WEEKDAY_THURSDAY
  1389. * @arg @ref LL_RTC_WEEKDAY_FRIDAY
  1390. * @arg @ref LL_RTC_WEEKDAY_SATURDAY
  1391. * @arg @ref LL_RTC_WEEKDAY_SUNDAY
  1392. */
  1393. __STATIC_INLINE uint32_t LL_RTC_DATE_GetWeekDay(RTC_TypeDef *RTCx)
  1394. {
  1395. return (uint32_t)(READ_BIT(RTCx->DR, RTC_DR_WDU) >> RTC_DR_WDU_Pos);
  1396. }
  1397. /**
  1398. * @brief Set Month in BCD format
  1399. * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Month from binary to BCD format
  1400. * @rmtoll RTC_DR MT LL_RTC_DATE_SetMonth\n
  1401. * RTC_DR MU LL_RTC_DATE_SetMonth
  1402. * @param RTCx RTC Instance
  1403. * @param Month This parameter can be one of the following values:
  1404. * @arg @ref LL_RTC_MONTH_JANUARY
  1405. * @arg @ref LL_RTC_MONTH_FEBRUARY
  1406. * @arg @ref LL_RTC_MONTH_MARCH
  1407. * @arg @ref LL_RTC_MONTH_APRIL
  1408. * @arg @ref LL_RTC_MONTH_MAY
  1409. * @arg @ref LL_RTC_MONTH_JUNE
  1410. * @arg @ref LL_RTC_MONTH_JULY
  1411. * @arg @ref LL_RTC_MONTH_AUGUST
  1412. * @arg @ref LL_RTC_MONTH_SEPTEMBER
  1413. * @arg @ref LL_RTC_MONTH_OCTOBER
  1414. * @arg @ref LL_RTC_MONTH_NOVEMBER
  1415. * @arg @ref LL_RTC_MONTH_DECEMBER
  1416. * @retval None
  1417. */
  1418. __STATIC_INLINE void LL_RTC_DATE_SetMonth(RTC_TypeDef *RTCx, uint32_t Month)
  1419. {
  1420. MODIFY_REG(RTCx->DR, (RTC_DR_MT | RTC_DR_MU),
  1421. (((Month & 0xF0U) << (RTC_DR_MT_Pos - 4U)) | ((Month & 0x0FU) << RTC_DR_MU_Pos)));
  1422. }
  1423. /**
  1424. * @brief Get Month in BCD format
  1425. * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
  1426. * before reading this bit
  1427. * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format
  1428. * @rmtoll RTC_DR MT LL_RTC_DATE_GetMonth\n
  1429. * RTC_DR MU LL_RTC_DATE_GetMonth
  1430. * @param RTCx RTC Instance
  1431. * @retval Returned value can be one of the following values:
  1432. * @arg @ref LL_RTC_MONTH_JANUARY
  1433. * @arg @ref LL_RTC_MONTH_FEBRUARY
  1434. * @arg @ref LL_RTC_MONTH_MARCH
  1435. * @arg @ref LL_RTC_MONTH_APRIL
  1436. * @arg @ref LL_RTC_MONTH_MAY
  1437. * @arg @ref LL_RTC_MONTH_JUNE
  1438. * @arg @ref LL_RTC_MONTH_JULY
  1439. * @arg @ref LL_RTC_MONTH_AUGUST
  1440. * @arg @ref LL_RTC_MONTH_SEPTEMBER
  1441. * @arg @ref LL_RTC_MONTH_OCTOBER
  1442. * @arg @ref LL_RTC_MONTH_NOVEMBER
  1443. * @arg @ref LL_RTC_MONTH_DECEMBER
  1444. */
  1445. __STATIC_INLINE uint32_t LL_RTC_DATE_GetMonth(RTC_TypeDef *RTCx)
  1446. {
  1447. return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_MT | RTC_DR_MU))) >> RTC_DR_MU_Pos);
  1448. }
  1449. /**
  1450. * @brief Set Day in BCD format
  1451. * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
  1452. * @rmtoll RTC_DR DT LL_RTC_DATE_SetDay\n
  1453. * RTC_DR DU LL_RTC_DATE_SetDay
  1454. * @param RTCx RTC Instance
  1455. * @param Day Value between Min_Data=0x01 and Max_Data=0x31
  1456. * @retval None
  1457. */
  1458. __STATIC_INLINE void LL_RTC_DATE_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
  1459. {
  1460. MODIFY_REG(RTCx->DR, (RTC_DR_DT | RTC_DR_DU),
  1461. (((Day & 0xF0U) << (RTC_DR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_DR_DU_Pos)));
  1462. }
  1463. /**
  1464. * @brief Get Day in BCD format
  1465. * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
  1466. * before reading this bit
  1467. * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
  1468. * @rmtoll RTC_DR DT LL_RTC_DATE_GetDay\n
  1469. * RTC_DR DU LL_RTC_DATE_GetDay
  1470. * @param RTCx RTC Instance
  1471. * @retval Value between Min_Data=0x01 and Max_Data=0x31
  1472. */
  1473. __STATIC_INLINE uint32_t LL_RTC_DATE_GetDay(RTC_TypeDef *RTCx)
  1474. {
  1475. return (uint32_t)((READ_BIT(RTCx->DR, (RTC_DR_DT | RTC_DR_DU))) >> RTC_DR_DU_Pos);
  1476. }
  1477. /**
  1478. * @brief Set date (WeekDay, Day, Month and Year) in BCD format
  1479. * @rmtoll RTC_DR WDU LL_RTC_DATE_Config\n
  1480. * RTC_DR MT LL_RTC_DATE_Config\n
  1481. * RTC_DR MU LL_RTC_DATE_Config\n
  1482. * RTC_DR DT LL_RTC_DATE_Config\n
  1483. * RTC_DR DU LL_RTC_DATE_Config\n
  1484. * RTC_DR YT LL_RTC_DATE_Config\n
  1485. * RTC_DR YU LL_RTC_DATE_Config
  1486. * @param RTCx RTC Instance
  1487. * @param WeekDay This parameter can be one of the following values:
  1488. * @arg @ref LL_RTC_WEEKDAY_MONDAY
  1489. * @arg @ref LL_RTC_WEEKDAY_TUESDAY
  1490. * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
  1491. * @arg @ref LL_RTC_WEEKDAY_THURSDAY
  1492. * @arg @ref LL_RTC_WEEKDAY_FRIDAY
  1493. * @arg @ref LL_RTC_WEEKDAY_SATURDAY
  1494. * @arg @ref LL_RTC_WEEKDAY_SUNDAY
  1495. * @param Day Value between Min_Data=0x01 and Max_Data=0x31
  1496. * @param Month This parameter can be one of the following values:
  1497. * @arg @ref LL_RTC_MONTH_JANUARY
  1498. * @arg @ref LL_RTC_MONTH_FEBRUARY
  1499. * @arg @ref LL_RTC_MONTH_MARCH
  1500. * @arg @ref LL_RTC_MONTH_APRIL
  1501. * @arg @ref LL_RTC_MONTH_MAY
  1502. * @arg @ref LL_RTC_MONTH_JUNE
  1503. * @arg @ref LL_RTC_MONTH_JULY
  1504. * @arg @ref LL_RTC_MONTH_AUGUST
  1505. * @arg @ref LL_RTC_MONTH_SEPTEMBER
  1506. * @arg @ref LL_RTC_MONTH_OCTOBER
  1507. * @arg @ref LL_RTC_MONTH_NOVEMBER
  1508. * @arg @ref LL_RTC_MONTH_DECEMBER
  1509. * @param Year Value between Min_Data=0x00 and Max_Data=0x99
  1510. * @retval None
  1511. */
  1512. __STATIC_INLINE void LL_RTC_DATE_Config(RTC_TypeDef *RTCx, uint32_t WeekDay, uint32_t Day, uint32_t Month,
  1513. uint32_t Year)
  1514. {
  1515. uint32_t temp;
  1516. temp = (WeekDay << RTC_DR_WDU_Pos) | \
  1517. (((Year & 0xF0U) << (RTC_DR_YT_Pos - 4U)) | ((Year & 0x0FU) << RTC_DR_YU_Pos)) | \
  1518. (((Month & 0xF0U) << (RTC_DR_MT_Pos - 4U)) | ((Month & 0x0FU) << RTC_DR_MU_Pos)) | \
  1519. (((Day & 0xF0U) << (RTC_DR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_DR_DU_Pos));
  1520. MODIFY_REG(RTCx->DR, (RTC_DR_WDU | RTC_DR_MT | RTC_DR_MU | RTC_DR_DT | RTC_DR_DU | RTC_DR_YT | RTC_DR_YU), temp);
  1521. }
  1522. /**
  1523. * @brief Get date (WeekDay, Day, Month and Year) in BCD format
  1524. * @note if RTC shadow registers are not bypassed (BYPSHAD=0), need to check if RSF flag is set
  1525. * before reading this bit
  1526. * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_YEAR, __LL_RTC_GET_MONTH,
  1527. * and __LL_RTC_GET_DAY are available to get independently each parameter.
  1528. * @rmtoll RTC_DR WDU LL_RTC_DATE_Get\n
  1529. * RTC_DR MT LL_RTC_DATE_Get\n
  1530. * RTC_DR MU LL_RTC_DATE_Get\n
  1531. * RTC_DR DT LL_RTC_DATE_Get\n
  1532. * RTC_DR DU LL_RTC_DATE_Get\n
  1533. * RTC_DR YT LL_RTC_DATE_Get\n
  1534. * RTC_DR YU LL_RTC_DATE_Get
  1535. * @param RTCx RTC Instance
  1536. * @retval Combination of WeekDay, Day, Month and Year (Format: 0xWWDDMMYY).
  1537. */
  1538. __STATIC_INLINE uint32_t LL_RTC_DATE_Get(RTC_TypeDef *RTCx)
  1539. {
  1540. uint32_t temp;
  1541. temp = READ_BIT(RTCx->DR, (RTC_DR_WDU | RTC_DR_MT | RTC_DR_MU | RTC_DR_DT | RTC_DR_DU | RTC_DR_YT | RTC_DR_YU));
  1542. return (uint32_t)((((temp & RTC_DR_WDU) >> RTC_DR_WDU_Pos) << RTC_OFFSET_WEEKDAY) | \
  1543. (((((temp & RTC_DR_DT) >> RTC_DR_DT_Pos) << 4U) | ((temp & RTC_DR_DU) >> RTC_DR_DU_Pos)) << RTC_OFFSET_DAY) | \
  1544. (((((temp & RTC_DR_MT) >> RTC_DR_MT_Pos) << 4U) | ((temp & RTC_DR_MU) >> RTC_DR_MU_Pos)) << RTC_OFFSET_MONTH) | \
  1545. ((((temp & RTC_DR_YT) >> RTC_DR_YT_Pos) << 4U) | ((temp & RTC_DR_YU) >> RTC_DR_YU_Pos)));
  1546. }
  1547. /**
  1548. * @}
  1549. */
  1550. /** @defgroup RTC_LL_EF_ALARMA ALARMA
  1551. * @{
  1552. */
  1553. /**
  1554. * @brief Enable Alarm A
  1555. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  1556. * @rmtoll RTC_CR ALRAE LL_RTC_ALMA_Enable
  1557. * @param RTCx RTC Instance
  1558. * @retval None
  1559. */
  1560. __STATIC_INLINE void LL_RTC_ALMA_Enable(RTC_TypeDef *RTCx)
  1561. {
  1562. SET_BIT(RTCx->CR, RTC_CR_ALRAE);
  1563. }
  1564. /**
  1565. * @brief Disable Alarm A
  1566. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  1567. * @rmtoll RTC_CR ALRAE LL_RTC_ALMA_Disable
  1568. * @param RTCx RTC Instance
  1569. * @retval None
  1570. */
  1571. __STATIC_INLINE void LL_RTC_ALMA_Disable(RTC_TypeDef *RTCx)
  1572. {
  1573. CLEAR_BIT(RTCx->CR, RTC_CR_ALRAE);
  1574. }
  1575. /**
  1576. * @brief Specify the Alarm A masks.
  1577. * @rmtoll RTC_ALRMAR MSK4 LL_RTC_ALMA_SetMask\n
  1578. * RTC_ALRMAR MSK3 LL_RTC_ALMA_SetMask\n
  1579. * RTC_ALRMAR MSK2 LL_RTC_ALMA_SetMask\n
  1580. * RTC_ALRMAR MSK1 LL_RTC_ALMA_SetMask
  1581. * @param RTCx RTC Instance
  1582. * @param Mask This parameter can be a combination of the following values:
  1583. * @arg @ref LL_RTC_ALMA_MASK_NONE
  1584. * @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY
  1585. * @arg @ref LL_RTC_ALMA_MASK_HOURS
  1586. * @arg @ref LL_RTC_ALMA_MASK_MINUTES
  1587. * @arg @ref LL_RTC_ALMA_MASK_SECONDS
  1588. * @arg @ref LL_RTC_ALMA_MASK_ALL
  1589. * @retval None
  1590. */
  1591. __STATIC_INLINE void LL_RTC_ALMA_SetMask(RTC_TypeDef *RTCx, uint32_t Mask)
  1592. {
  1593. MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1, Mask);
  1594. }
  1595. /**
  1596. * @brief Get the Alarm A masks.
  1597. * @rmtoll RTC_ALRMAR MSK4 LL_RTC_ALMA_GetMask\n
  1598. * RTC_ALRMAR MSK3 LL_RTC_ALMA_GetMask\n
  1599. * RTC_ALRMAR MSK2 LL_RTC_ALMA_GetMask\n
  1600. * RTC_ALRMAR MSK1 LL_RTC_ALMA_GetMask
  1601. * @param RTCx RTC Instance
  1602. * @retval Returned value can be can be a combination of the following values:
  1603. * @arg @ref LL_RTC_ALMA_MASK_NONE
  1604. * @arg @ref LL_RTC_ALMA_MASK_DATEWEEKDAY
  1605. * @arg @ref LL_RTC_ALMA_MASK_HOURS
  1606. * @arg @ref LL_RTC_ALMA_MASK_MINUTES
  1607. * @arg @ref LL_RTC_ALMA_MASK_SECONDS
  1608. * @arg @ref LL_RTC_ALMA_MASK_ALL
  1609. */
  1610. __STATIC_INLINE uint32_t LL_RTC_ALMA_GetMask(RTC_TypeDef *RTCx)
  1611. {
  1612. return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_MSK4 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK1));
  1613. }
  1614. /**
  1615. * @brief Enable AlarmA Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care)
  1616. * @rmtoll RTC_ALRMAR WDSEL LL_RTC_ALMA_EnableWeekday
  1617. * @param RTCx RTC Instance
  1618. * @retval None
  1619. */
  1620. __STATIC_INLINE void LL_RTC_ALMA_EnableWeekday(RTC_TypeDef *RTCx)
  1621. {
  1622. SET_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL);
  1623. }
  1624. /**
  1625. * @brief Disable AlarmA Week day selection (DU[3:0] represents the date )
  1626. * @rmtoll RTC_ALRMAR WDSEL LL_RTC_ALMA_DisableWeekday
  1627. * @param RTCx RTC Instance
  1628. * @retval None
  1629. */
  1630. __STATIC_INLINE void LL_RTC_ALMA_DisableWeekday(RTC_TypeDef *RTCx)
  1631. {
  1632. CLEAR_BIT(RTCx->ALRMAR, RTC_ALRMAR_WDSEL);
  1633. }
  1634. /**
  1635. * @brief Set ALARM A Day in BCD format
  1636. * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
  1637. * @rmtoll RTC_ALRMAR DT LL_RTC_ALMA_SetDay\n
  1638. * RTC_ALRMAR DU LL_RTC_ALMA_SetDay
  1639. * @param RTCx RTC Instance
  1640. * @param Day Value between Min_Data=0x01 and Max_Data=0x31
  1641. * @retval None
  1642. */
  1643. __STATIC_INLINE void LL_RTC_ALMA_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
  1644. {
  1645. MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU),
  1646. (((Day & 0xF0U) << (RTC_ALRMAR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMAR_DU_Pos)));
  1647. }
  1648. /**
  1649. * @brief Get ALARM A Day in BCD format
  1650. * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
  1651. * @rmtoll RTC_ALRMAR DT LL_RTC_ALMA_GetDay\n
  1652. * RTC_ALRMAR DU LL_RTC_ALMA_GetDay
  1653. * @param RTCx RTC Instance
  1654. * @retval Value between Min_Data=0x01 and Max_Data=0x31
  1655. */
  1656. __STATIC_INLINE uint32_t LL_RTC_ALMA_GetDay(RTC_TypeDef *RTCx)
  1657. {
  1658. return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_DT | RTC_ALRMAR_DU))) >> RTC_ALRMAR_DU_Pos);
  1659. }
  1660. /**
  1661. * @brief Set ALARM A Weekday
  1662. * @rmtoll RTC_ALRMAR DU LL_RTC_ALMA_SetWeekDay
  1663. * @param RTCx RTC Instance
  1664. * @param WeekDay This parameter can be one of the following values:
  1665. * @arg @ref LL_RTC_WEEKDAY_MONDAY
  1666. * @arg @ref LL_RTC_WEEKDAY_TUESDAY
  1667. * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
  1668. * @arg @ref LL_RTC_WEEKDAY_THURSDAY
  1669. * @arg @ref LL_RTC_WEEKDAY_FRIDAY
  1670. * @arg @ref LL_RTC_WEEKDAY_SATURDAY
  1671. * @arg @ref LL_RTC_WEEKDAY_SUNDAY
  1672. * @retval None
  1673. */
  1674. __STATIC_INLINE void LL_RTC_ALMA_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
  1675. {
  1676. MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_DU, WeekDay << RTC_ALRMAR_DU_Pos);
  1677. }
  1678. /**
  1679. * @brief Get ALARM A Weekday
  1680. * @rmtoll RTC_ALRMAR DU LL_RTC_ALMA_GetWeekDay
  1681. * @param RTCx RTC Instance
  1682. * @retval Returned value can be one of the following values:
  1683. * @arg @ref LL_RTC_WEEKDAY_MONDAY
  1684. * @arg @ref LL_RTC_WEEKDAY_TUESDAY
  1685. * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
  1686. * @arg @ref LL_RTC_WEEKDAY_THURSDAY
  1687. * @arg @ref LL_RTC_WEEKDAY_FRIDAY
  1688. * @arg @ref LL_RTC_WEEKDAY_SATURDAY
  1689. * @arg @ref LL_RTC_WEEKDAY_SUNDAY
  1690. */
  1691. __STATIC_INLINE uint32_t LL_RTC_ALMA_GetWeekDay(RTC_TypeDef *RTCx)
  1692. {
  1693. return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_DU) >> RTC_ALRMAR_DU_Pos);
  1694. }
  1695. /**
  1696. * @brief Set Alarm A time format (AM/24-hour or PM notation)
  1697. * @rmtoll RTC_ALRMAR PM LL_RTC_ALMA_SetTimeFormat
  1698. * @param RTCx RTC Instance
  1699. * @param TimeFormat This parameter can be one of the following values:
  1700. * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
  1701. * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
  1702. * @retval None
  1703. */
  1704. __STATIC_INLINE void LL_RTC_ALMA_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
  1705. {
  1706. MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_PM, TimeFormat);
  1707. }
  1708. /**
  1709. * @brief Get Alarm A time format (AM or PM notation)
  1710. * @rmtoll RTC_ALRMAR PM LL_RTC_ALMA_GetTimeFormat
  1711. * @param RTCx RTC Instance
  1712. * @retval Returned value can be one of the following values:
  1713. * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
  1714. * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
  1715. */
  1716. __STATIC_INLINE uint32_t LL_RTC_ALMA_GetTimeFormat(RTC_TypeDef *RTCx)
  1717. {
  1718. return (uint32_t)(READ_BIT(RTCx->ALRMAR, RTC_ALRMAR_PM));
  1719. }
  1720. /**
  1721. * @brief Set ALARM A Hours in BCD format
  1722. * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format
  1723. * @rmtoll RTC_ALRMAR HT LL_RTC_ALMA_SetHour\n
  1724. * RTC_ALRMAR HU LL_RTC_ALMA_SetHour
  1725. * @param RTCx RTC Instance
  1726. * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
  1727. * @retval None
  1728. */
  1729. __STATIC_INLINE void LL_RTC_ALMA_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
  1730. {
  1731. MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU),
  1732. (((Hours & 0xF0U) << (RTC_ALRMAR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMAR_HU_Pos)));
  1733. }
  1734. /**
  1735. * @brief Get ALARM A Hours in BCD format
  1736. * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
  1737. * @rmtoll RTC_ALRMAR HT LL_RTC_ALMA_GetHour\n
  1738. * RTC_ALRMAR HU LL_RTC_ALMA_GetHour
  1739. * @param RTCx RTC Instance
  1740. * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
  1741. */
  1742. __STATIC_INLINE uint32_t LL_RTC_ALMA_GetHour(RTC_TypeDef *RTCx)
  1743. {
  1744. return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_HT | RTC_ALRMAR_HU))) >> RTC_ALRMAR_HU_Pos);
  1745. }
  1746. /**
  1747. * @brief Set ALARM A Minutes in BCD format
  1748. * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
  1749. * @rmtoll RTC_ALRMAR MNT LL_RTC_ALMA_SetMinute\n
  1750. * RTC_ALRMAR MNU LL_RTC_ALMA_SetMinute
  1751. * @param RTCx RTC Instance
  1752. * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
  1753. * @retval None
  1754. */
  1755. __STATIC_INLINE void LL_RTC_ALMA_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
  1756. {
  1757. MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU),
  1758. (((Minutes & 0xF0U) << (RTC_ALRMAR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMAR_MNU_Pos)));
  1759. }
  1760. /**
  1761. * @brief Get ALARM A Minutes in BCD format
  1762. * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
  1763. * @rmtoll RTC_ALRMAR MNT LL_RTC_ALMA_GetMinute\n
  1764. * RTC_ALRMAR MNU LL_RTC_ALMA_GetMinute
  1765. * @param RTCx RTC Instance
  1766. * @retval Value between Min_Data=0x00 and Max_Data=0x59
  1767. */
  1768. __STATIC_INLINE uint32_t LL_RTC_ALMA_GetMinute(RTC_TypeDef *RTCx)
  1769. {
  1770. return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU))) >> RTC_ALRMAR_MNU_Pos);
  1771. }
  1772. /**
  1773. * @brief Set ALARM A Seconds in BCD format
  1774. * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
  1775. * @rmtoll RTC_ALRMAR ST LL_RTC_ALMA_SetSecond\n
  1776. * RTC_ALRMAR SU LL_RTC_ALMA_SetSecond
  1777. * @param RTCx RTC Instance
  1778. * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
  1779. * @retval None
  1780. */
  1781. __STATIC_INLINE void LL_RTC_ALMA_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
  1782. {
  1783. MODIFY_REG(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU),
  1784. (((Seconds & 0xF0U) << (RTC_ALRMAR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMAR_SU_Pos)));
  1785. }
  1786. /**
  1787. * @brief Get ALARM A Seconds in BCD format
  1788. * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
  1789. * @rmtoll RTC_ALRMAR ST LL_RTC_ALMA_GetSecond\n
  1790. * RTC_ALRMAR SU LL_RTC_ALMA_GetSecond
  1791. * @param RTCx RTC Instance
  1792. * @retval Value between Min_Data=0x00 and Max_Data=0x59
  1793. */
  1794. __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSecond(RTC_TypeDef *RTCx)
  1795. {
  1796. return (uint32_t)((READ_BIT(RTCx->ALRMAR, (RTC_ALRMAR_ST | RTC_ALRMAR_SU))) >> RTC_ALRMAR_SU_Pos);
  1797. }
  1798. /**
  1799. * @brief Set Alarm A Time (hour, minute and second) in BCD format
  1800. * @rmtoll RTC_ALRMAR PM LL_RTC_ALMA_ConfigTime\n
  1801. * RTC_ALRMAR HT LL_RTC_ALMA_ConfigTime\n
  1802. * RTC_ALRMAR HU LL_RTC_ALMA_ConfigTime\n
  1803. * RTC_ALRMAR MNT LL_RTC_ALMA_ConfigTime\n
  1804. * RTC_ALRMAR MNU LL_RTC_ALMA_ConfigTime\n
  1805. * RTC_ALRMAR ST LL_RTC_ALMA_ConfigTime\n
  1806. * RTC_ALRMAR SU LL_RTC_ALMA_ConfigTime
  1807. * @param RTCx RTC Instance
  1808. * @param Format12_24 This parameter can be one of the following values:
  1809. * @arg @ref LL_RTC_ALMA_TIME_FORMAT_AM
  1810. * @arg @ref LL_RTC_ALMA_TIME_FORMAT_PM
  1811. * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
  1812. * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
  1813. * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
  1814. * @retval None
  1815. */
  1816. __STATIC_INLINE void LL_RTC_ALMA_ConfigTime(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes,
  1817. uint32_t Seconds)
  1818. {
  1819. uint32_t temp;
  1820. temp = Format12_24 | (((Hours & 0xF0U) << (RTC_ALRMAR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMAR_HU_Pos)) | \
  1821. (((Minutes & 0xF0U) << (RTC_ALRMAR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMAR_MNU_Pos)) | \
  1822. (((Seconds & 0xF0U) << (RTC_ALRMAR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMAR_SU_Pos));
  1823. MODIFY_REG(RTCx->ALRMAR, RTC_ALRMAR_PM | RTC_ALRMAR_HT | RTC_ALRMAR_HU | RTC_ALRMAR_MNT | RTC_ALRMAR_MNU | RTC_ALRMAR_ST
  1824. | RTC_ALRMAR_SU, temp);
  1825. }
  1826. /**
  1827. * @brief Get Alarm B Time (hour, minute and second) in BCD format
  1828. * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
  1829. * are available to get independently each parameter.
  1830. * @rmtoll RTC_ALRMAR HT LL_RTC_ALMA_GetTime\n
  1831. * RTC_ALRMAR HU LL_RTC_ALMA_GetTime\n
  1832. * RTC_ALRMAR MNT LL_RTC_ALMA_GetTime\n
  1833. * RTC_ALRMAR MNU LL_RTC_ALMA_GetTime\n
  1834. * RTC_ALRMAR ST LL_RTC_ALMA_GetTime\n
  1835. * RTC_ALRMAR SU LL_RTC_ALMA_GetTime
  1836. * @param RTCx RTC Instance
  1837. * @retval Combination of hours, minutes and seconds.
  1838. */
  1839. __STATIC_INLINE uint32_t LL_RTC_ALMA_GetTime(RTC_TypeDef *RTCx)
  1840. {
  1841. return (uint32_t)((LL_RTC_ALMA_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_ALMA_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMA_GetSecond(RTCx));
  1842. }
  1843. /**
  1844. * @brief Set Alarm A Mask the most-significant bits starting at this bit
  1845. * @note This register can be written only when ALRAE is reset in RTC_CR register,
  1846. * or in initialization mode.
  1847. * @rmtoll RTC_ALRMASSR MASKSS LL_RTC_ALMA_SetSubSecondMask
  1848. * @param RTCx RTC Instance
  1849. * @param Mask Value between Min_Data=0x00 and Max_Data=0xF
  1850. * @retval None
  1851. */
  1852. __STATIC_INLINE void LL_RTC_ALMA_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask)
  1853. {
  1854. MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS, Mask << RTC_ALRMASSR_MASKSS_Pos);
  1855. }
  1856. /**
  1857. * @brief Get Alarm A Mask the most-significant bits starting at this bit
  1858. * @rmtoll RTC_ALRMASSR MASKSS LL_RTC_ALMA_GetSubSecondMask
  1859. * @param RTCx RTC Instance
  1860. * @retval Value between Min_Data=0x00 and Max_Data=0xF
  1861. */
  1862. __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecondMask(RTC_TypeDef *RTCx)
  1863. {
  1864. return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_MASKSS) >> RTC_ALRMASSR_MASKSS_Pos);
  1865. }
  1866. /**
  1867. * @brief Set Alarm A Sub seconds value
  1868. * @rmtoll RCT_ALRMASSR SS LL_RTC_ALMA_SetSubSecond
  1869. * @param RTCx RTC Instance
  1870. * @param Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF
  1871. * @retval None
  1872. */
  1873. __STATIC_INLINE void LL_RTC_ALMA_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond)
  1874. {
  1875. MODIFY_REG(RTCx->ALRMASSR, RTC_ALRMASSR_SS, Subsecond);
  1876. }
  1877. /**
  1878. * @brief Get Alarm A Sub seconds value
  1879. * @rmtoll RCT_ALRMASSR SS LL_RTC_ALMA_GetSubSecond
  1880. * @param RTCx RTC Instance
  1881. * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF
  1882. */
  1883. __STATIC_INLINE uint32_t LL_RTC_ALMA_GetSubSecond(RTC_TypeDef *RTCx)
  1884. {
  1885. return (uint32_t)(READ_BIT(RTCx->ALRMASSR, RTC_ALRMASSR_SS));
  1886. }
  1887. /**
  1888. * @}
  1889. */
  1890. /** @defgroup RTC_LL_EF_ALARMB ALARMB
  1891. * @{
  1892. */
  1893. /**
  1894. * @brief Enable Alarm B
  1895. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  1896. * @rmtoll RTC_CR ALRBE LL_RTC_ALMB_Enable
  1897. * @param RTCx RTC Instance
  1898. * @retval None
  1899. */
  1900. __STATIC_INLINE void LL_RTC_ALMB_Enable(RTC_TypeDef *RTCx)
  1901. {
  1902. SET_BIT(RTCx->CR, RTC_CR_ALRBE);
  1903. }
  1904. /**
  1905. * @brief Disable Alarm B
  1906. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  1907. * @rmtoll RTC_CR ALRBE LL_RTC_ALMB_Disable
  1908. * @param RTCx RTC Instance
  1909. * @retval None
  1910. */
  1911. __STATIC_INLINE void LL_RTC_ALMB_Disable(RTC_TypeDef *RTCx)
  1912. {
  1913. CLEAR_BIT(RTCx->CR, RTC_CR_ALRBE);
  1914. }
  1915. /**
  1916. * @brief Specify the Alarm B masks.
  1917. * @rmtoll RTC_ALRMBR MSK4 LL_RTC_ALMB_SetMask\n
  1918. * RTC_ALRMBR MSK3 LL_RTC_ALMB_SetMask\n
  1919. * RTC_ALRMBR MSK2 LL_RTC_ALMB_SetMask\n
  1920. * RTC_ALRMBR MSK1 LL_RTC_ALMB_SetMask
  1921. * @param RTCx RTC Instance
  1922. * @param Mask This parameter can be a combination of the following values:
  1923. * @arg @ref LL_RTC_ALMB_MASK_NONE
  1924. * @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY
  1925. * @arg @ref LL_RTC_ALMB_MASK_HOURS
  1926. * @arg @ref LL_RTC_ALMB_MASK_MINUTES
  1927. * @arg @ref LL_RTC_ALMB_MASK_SECONDS
  1928. * @arg @ref LL_RTC_ALMB_MASK_ALL
  1929. * @retval None
  1930. */
  1931. __STATIC_INLINE void LL_RTC_ALMB_SetMask(RTC_TypeDef *RTCx, uint32_t Mask)
  1932. {
  1933. MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1, Mask);
  1934. }
  1935. /**
  1936. * @brief Get the Alarm B masks.
  1937. * @rmtoll RTC_ALRMBR MSK4 LL_RTC_ALMB_GetMask\n
  1938. * RTC_ALRMBR MSK3 LL_RTC_ALMB_GetMask\n
  1939. * RTC_ALRMBR MSK2 LL_RTC_ALMB_GetMask\n
  1940. * RTC_ALRMBR MSK1 LL_RTC_ALMB_GetMask
  1941. * @param RTCx RTC Instance
  1942. * @retval Returned value can be can be a combination of the following values:
  1943. * @arg @ref LL_RTC_ALMB_MASK_NONE
  1944. * @arg @ref LL_RTC_ALMB_MASK_DATEWEEKDAY
  1945. * @arg @ref LL_RTC_ALMB_MASK_HOURS
  1946. * @arg @ref LL_RTC_ALMB_MASK_MINUTES
  1947. * @arg @ref LL_RTC_ALMB_MASK_SECONDS
  1948. * @arg @ref LL_RTC_ALMB_MASK_ALL
  1949. */
  1950. __STATIC_INLINE uint32_t LL_RTC_ALMB_GetMask(RTC_TypeDef *RTCx)
  1951. {
  1952. return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_MSK4 | RTC_ALRMBR_MSK3 | RTC_ALRMBR_MSK2 | RTC_ALRMBR_MSK1));
  1953. }
  1954. /**
  1955. * @brief Enable AlarmB Week day selection (DU[3:0] represents the week day. DT[1:0] is do not care)
  1956. * @rmtoll RTC_ALRMBR WDSEL LL_RTC_ALMB_EnableWeekday
  1957. * @param RTCx RTC Instance
  1958. * @retval None
  1959. */
  1960. __STATIC_INLINE void LL_RTC_ALMB_EnableWeekday(RTC_TypeDef *RTCx)
  1961. {
  1962. SET_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL);
  1963. }
  1964. /**
  1965. * @brief Disable AlarmB Week day selection (DU[3:0] represents the date )
  1966. * @rmtoll RTC_ALRMBR WDSEL LL_RTC_ALMB_DisableWeekday
  1967. * @param RTCx RTC Instance
  1968. * @retval None
  1969. */
  1970. __STATIC_INLINE void LL_RTC_ALMB_DisableWeekday(RTC_TypeDef *RTCx)
  1971. {
  1972. CLEAR_BIT(RTCx->ALRMBR, RTC_ALRMBR_WDSEL);
  1973. }
  1974. /**
  1975. * @brief Set ALARM B Day in BCD format
  1976. * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Day from binary to BCD format
  1977. * @rmtoll RTC_ALRMBR DT LL_RTC_ALMB_SetDay\n
  1978. * RTC_ALRMBR DU LL_RTC_ALMB_SetDay
  1979. * @param RTCx RTC Instance
  1980. * @param Day Value between Min_Data=0x01 and Max_Data=0x31
  1981. * @retval None
  1982. */
  1983. __STATIC_INLINE void LL_RTC_ALMB_SetDay(RTC_TypeDef *RTCx, uint32_t Day)
  1984. {
  1985. MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU),
  1986. (((Day & 0xF0U) << (RTC_ALRMBR_DT_Pos - 4U)) | ((Day & 0x0FU) << RTC_ALRMBR_DU_Pos)));
  1987. }
  1988. /**
  1989. * @brief Get ALARM B Day in BCD format
  1990. * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
  1991. * @rmtoll RTC_ALRMBR DT LL_RTC_ALMB_GetDay\n
  1992. * RTC_ALRMBR DU LL_RTC_ALMB_GetDay
  1993. * @param RTCx RTC Instance
  1994. * @retval Value between Min_Data=0x01 and Max_Data=0x31
  1995. */
  1996. __STATIC_INLINE uint32_t LL_RTC_ALMB_GetDay(RTC_TypeDef *RTCx)
  1997. {
  1998. return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_DT | RTC_ALRMBR_DU))) >> RTC_ALRMBR_DU_Pos);
  1999. }
  2000. /**
  2001. * @brief Set ALARM B Weekday
  2002. * @rmtoll RTC_ALRMBR DU LL_RTC_ALMB_SetWeekDay
  2003. * @param RTCx RTC Instance
  2004. * @param WeekDay This parameter can be one of the following values:
  2005. * @arg @ref LL_RTC_WEEKDAY_MONDAY
  2006. * @arg @ref LL_RTC_WEEKDAY_TUESDAY
  2007. * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
  2008. * @arg @ref LL_RTC_WEEKDAY_THURSDAY
  2009. * @arg @ref LL_RTC_WEEKDAY_FRIDAY
  2010. * @arg @ref LL_RTC_WEEKDAY_SATURDAY
  2011. * @arg @ref LL_RTC_WEEKDAY_SUNDAY
  2012. * @retval None
  2013. */
  2014. __STATIC_INLINE void LL_RTC_ALMB_SetWeekDay(RTC_TypeDef *RTCx, uint32_t WeekDay)
  2015. {
  2016. MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_DU, WeekDay << RTC_ALRMBR_DU_Pos);
  2017. }
  2018. /**
  2019. * @brief Get ALARM B Weekday
  2020. * @rmtoll RTC_ALRMBR DU LL_RTC_ALMB_GetWeekDay
  2021. * @param RTCx RTC Instance
  2022. * @retval Returned value can be one of the following values:
  2023. * @arg @ref LL_RTC_WEEKDAY_MONDAY
  2024. * @arg @ref LL_RTC_WEEKDAY_TUESDAY
  2025. * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
  2026. * @arg @ref LL_RTC_WEEKDAY_THURSDAY
  2027. * @arg @ref LL_RTC_WEEKDAY_FRIDAY
  2028. * @arg @ref LL_RTC_WEEKDAY_SATURDAY
  2029. * @arg @ref LL_RTC_WEEKDAY_SUNDAY
  2030. */
  2031. __STATIC_INLINE uint32_t LL_RTC_ALMB_GetWeekDay(RTC_TypeDef *RTCx)
  2032. {
  2033. return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_DU) >> RTC_ALRMBR_DU_Pos);
  2034. }
  2035. /**
  2036. * @brief Set ALARM B time format (AM/24-hour or PM notation)
  2037. * @rmtoll RTC_ALRMBR PM LL_RTC_ALMB_SetTimeFormat
  2038. * @param RTCx RTC Instance
  2039. * @param TimeFormat This parameter can be one of the following values:
  2040. * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
  2041. * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
  2042. * @retval None
  2043. */
  2044. __STATIC_INLINE void LL_RTC_ALMB_SetTimeFormat(RTC_TypeDef *RTCx, uint32_t TimeFormat)
  2045. {
  2046. MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_PM, TimeFormat);
  2047. }
  2048. /**
  2049. * @brief Get ALARM B time format (AM or PM notation)
  2050. * @rmtoll RTC_ALRMBR PM LL_RTC_ALMB_GetTimeFormat
  2051. * @param RTCx RTC Instance
  2052. * @retval Returned value can be one of the following values:
  2053. * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
  2054. * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
  2055. */
  2056. __STATIC_INLINE uint32_t LL_RTC_ALMB_GetTimeFormat(RTC_TypeDef *RTCx)
  2057. {
  2058. return (uint32_t)(READ_BIT(RTCx->ALRMBR, RTC_ALRMBR_PM));
  2059. }
  2060. /**
  2061. * @brief Set ALARM B Hours in BCD format
  2062. * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Hours from binary to BCD format
  2063. * @rmtoll RTC_ALRMBR HT LL_RTC_ALMB_SetHour\n
  2064. * RTC_ALRMBR HU LL_RTC_ALMB_SetHour
  2065. * @param RTCx RTC Instance
  2066. * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
  2067. * @retval None
  2068. */
  2069. __STATIC_INLINE void LL_RTC_ALMB_SetHour(RTC_TypeDef *RTCx, uint32_t Hours)
  2070. {
  2071. MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU),
  2072. (((Hours & 0xF0U) << (RTC_ALRMBR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMBR_HU_Pos)));
  2073. }
  2074. /**
  2075. * @brief Get ALARM B Hours in BCD format
  2076. * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
  2077. * @rmtoll RTC_ALRMBR HT LL_RTC_ALMB_GetHour\n
  2078. * RTC_ALRMBR HU LL_RTC_ALMB_GetHour
  2079. * @param RTCx RTC Instance
  2080. * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
  2081. */
  2082. __STATIC_INLINE uint32_t LL_RTC_ALMB_GetHour(RTC_TypeDef *RTCx)
  2083. {
  2084. return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_HT | RTC_ALRMBR_HU))) >> RTC_ALRMBR_HU_Pos);
  2085. }
  2086. /**
  2087. * @brief Set ALARM B Minutes in BCD format
  2088. * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Minutes from binary to BCD format
  2089. * @rmtoll RTC_ALRMBR MNT LL_RTC_ALMB_SetMinute\n
  2090. * RTC_ALRMBR MNU LL_RTC_ALMB_SetMinute
  2091. * @param RTCx RTC Instance
  2092. * @param Minutes between Min_Data=0x00 and Max_Data=0x59
  2093. * @retval None
  2094. */
  2095. __STATIC_INLINE void LL_RTC_ALMB_SetMinute(RTC_TypeDef *RTCx, uint32_t Minutes)
  2096. {
  2097. MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU),
  2098. (((Minutes & 0xF0U) << (RTC_ALRMBR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMBR_MNU_Pos)));
  2099. }
  2100. /**
  2101. * @brief Get ALARM B Minutes in BCD format
  2102. * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
  2103. * @rmtoll RTC_ALRMBR MNT LL_RTC_ALMB_GetMinute\n
  2104. * RTC_ALRMBR MNU LL_RTC_ALMB_GetMinute
  2105. * @param RTCx RTC Instance
  2106. * @retval Value between Min_Data=0x00 and Max_Data=0x59
  2107. */
  2108. __STATIC_INLINE uint32_t LL_RTC_ALMB_GetMinute(RTC_TypeDef *RTCx)
  2109. {
  2110. return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_MNT | RTC_ALRMBR_MNU))) >> RTC_ALRMBR_MNU_Pos);
  2111. }
  2112. /**
  2113. * @brief Set ALARM B Seconds in BCD format
  2114. * @note helper macro __LL_RTC_CONVERT_BIN2BCD is available to convert Seconds from binary to BCD format
  2115. * @rmtoll RTC_ALRMBR ST LL_RTC_ALMB_SetSecond\n
  2116. * RTC_ALRMBR SU LL_RTC_ALMB_SetSecond
  2117. * @param RTCx RTC Instance
  2118. * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
  2119. * @retval None
  2120. */
  2121. __STATIC_INLINE void LL_RTC_ALMB_SetSecond(RTC_TypeDef *RTCx, uint32_t Seconds)
  2122. {
  2123. MODIFY_REG(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU),
  2124. (((Seconds & 0xF0U) << (RTC_ALRMBR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMBR_SU_Pos)));
  2125. }
  2126. /**
  2127. * @brief Get ALARM B Seconds in BCD format
  2128. * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
  2129. * @rmtoll RTC_ALRMBR ST LL_RTC_ALMB_GetSecond\n
  2130. * RTC_ALRMBR SU LL_RTC_ALMB_GetSecond
  2131. * @param RTCx RTC Instance
  2132. * @retval Value between Min_Data=0x00 and Max_Data=0x59
  2133. */
  2134. __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSecond(RTC_TypeDef *RTCx)
  2135. {
  2136. return (uint32_t)((READ_BIT(RTCx->ALRMBR, (RTC_ALRMBR_ST | RTC_ALRMBR_SU))) >> RTC_ALRMBR_SU_Pos);
  2137. }
  2138. /**
  2139. * @brief Set Alarm B Time (hour, minute and second) in BCD format
  2140. * @rmtoll RTC_ALRMBR PM LL_RTC_ALMB_ConfigTime\n
  2141. * RTC_ALRMBR HT LL_RTC_ALMB_ConfigTime\n
  2142. * RTC_ALRMBR HU LL_RTC_ALMB_ConfigTime\n
  2143. * RTC_ALRMBR MNT LL_RTC_ALMB_ConfigTime\n
  2144. * RTC_ALRMBR MNU LL_RTC_ALMB_ConfigTime\n
  2145. * RTC_ALRMBR ST LL_RTC_ALMB_ConfigTime\n
  2146. * RTC_ALRMBR SU LL_RTC_ALMB_ConfigTime
  2147. * @param RTCx RTC Instance
  2148. * @param Format12_24 This parameter can be one of the following values:
  2149. * @arg @ref LL_RTC_ALMB_TIME_FORMAT_AM
  2150. * @arg @ref LL_RTC_ALMB_TIME_FORMAT_PM
  2151. * @param Hours Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
  2152. * @param Minutes Value between Min_Data=0x00 and Max_Data=0x59
  2153. * @param Seconds Value between Min_Data=0x00 and Max_Data=0x59
  2154. * @retval None
  2155. */
  2156. __STATIC_INLINE void LL_RTC_ALMB_ConfigTime(RTC_TypeDef *RTCx, uint32_t Format12_24, uint32_t Hours, uint32_t Minutes,
  2157. uint32_t Seconds)
  2158. {
  2159. uint32_t temp;
  2160. temp = Format12_24 | (((Hours & 0xF0U) << (RTC_ALRMBR_HT_Pos - 4U)) | ((Hours & 0x0FU) << RTC_ALRMBR_HU_Pos)) | \
  2161. (((Minutes & 0xF0U) << (RTC_ALRMBR_MNT_Pos - 4U)) | ((Minutes & 0x0FU) << RTC_ALRMBR_MNU_Pos)) | \
  2162. (((Seconds & 0xF0U) << (RTC_ALRMBR_ST_Pos - 4U)) | ((Seconds & 0x0FU) << RTC_ALRMBR_SU_Pos));
  2163. MODIFY_REG(RTCx->ALRMBR, RTC_ALRMBR_PM | RTC_ALRMBR_HT | RTC_ALRMBR_HU | RTC_ALRMBR_MNT | RTC_ALRMBR_MNU | RTC_ALRMBR_ST
  2164. | RTC_ALRMBR_SU, temp);
  2165. }
  2166. /**
  2167. * @brief Get Alarm B Time (hour, minute and second) in BCD format
  2168. * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
  2169. * are available to get independently each parameter.
  2170. * @rmtoll RTC_ALRMBR HT LL_RTC_ALMB_GetTime\n
  2171. * RTC_ALRMBR HU LL_RTC_ALMB_GetTime\n
  2172. * RTC_ALRMBR MNT LL_RTC_ALMB_GetTime\n
  2173. * RTC_ALRMBR MNU LL_RTC_ALMB_GetTime\n
  2174. * RTC_ALRMBR ST LL_RTC_ALMB_GetTime\n
  2175. * RTC_ALRMBR SU LL_RTC_ALMB_GetTime
  2176. * @param RTCx RTC Instance
  2177. * @retval Combination of hours, minutes and seconds.
  2178. */
  2179. __STATIC_INLINE uint32_t LL_RTC_ALMB_GetTime(RTC_TypeDef *RTCx)
  2180. {
  2181. return (uint32_t)((LL_RTC_ALMB_GetHour(RTCx) << RTC_OFFSET_HOUR) | (LL_RTC_ALMB_GetMinute(RTCx) << RTC_OFFSET_MINUTE) | LL_RTC_ALMB_GetSecond(RTCx));
  2182. }
  2183. /**
  2184. * @brief Set Alarm B Mask the most-significant bits starting at this bit
  2185. * @note This register can be written only when ALRBE is reset in RTC_CR register,
  2186. * or in initialization mode.
  2187. * @rmtoll RTC_ALRMBSSR MASKSS LL_RTC_ALMB_SetSubSecondMask
  2188. * @param RTCx RTC Instance
  2189. * @param Mask Value between Min_Data=0x00 and Max_Data=0xF
  2190. * @retval None
  2191. */
  2192. __STATIC_INLINE void LL_RTC_ALMB_SetSubSecondMask(RTC_TypeDef *RTCx, uint32_t Mask)
  2193. {
  2194. MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS, Mask << RTC_ALRMBSSR_MASKSS_Pos);
  2195. }
  2196. /**
  2197. * @brief Get Alarm B Mask the most-significant bits starting at this bit
  2198. * @rmtoll RTC_ALRMBSSR MASKSS LL_RTC_ALMB_GetSubSecondMask
  2199. * @param RTCx RTC Instance
  2200. * @retval Value between Min_Data=0x00 and Max_Data=0xF
  2201. */
  2202. __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecondMask(RTC_TypeDef *RTCx)
  2203. {
  2204. return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_MASKSS) >> RTC_ALRMBSSR_MASKSS_Pos);
  2205. }
  2206. /**
  2207. * @brief Set Alarm B Sub seconds value
  2208. * @rmtoll RTC_ALRMBSSR SS LL_RTC_ALMB_SetSubSecond
  2209. * @param RTCx RTC Instance
  2210. * @param Subsecond Value between Min_Data=0x00 and Max_Data=0x7FFF
  2211. * @retval None
  2212. */
  2213. __STATIC_INLINE void LL_RTC_ALMB_SetSubSecond(RTC_TypeDef *RTCx, uint32_t Subsecond)
  2214. {
  2215. MODIFY_REG(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS, Subsecond);
  2216. }
  2217. /**
  2218. * @brief Get Alarm B Sub seconds value
  2219. * @rmtoll RTC_ALRMBSSR SS LL_RTC_ALMB_GetSubSecond
  2220. * @param RTCx RTC Instance
  2221. * @retval Value between Min_Data=0x00 and Max_Data=0x7FFF
  2222. */
  2223. __STATIC_INLINE uint32_t LL_RTC_ALMB_GetSubSecond(RTC_TypeDef *RTCx)
  2224. {
  2225. return (uint32_t)(READ_BIT(RTCx->ALRMBSSR, RTC_ALRMBSSR_SS));
  2226. }
  2227. /**
  2228. * @}
  2229. */
  2230. /** @defgroup RTC_LL_EF_Timestamp Timestamp
  2231. * @{
  2232. */
  2233. /**
  2234. * @brief Enable internal event timestamp
  2235. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  2236. * @rmtoll RTC_CR ITSE LL_RTC_TS_EnableInternalEvent
  2237. * @param RTCx RTC Instance
  2238. * @retval None
  2239. */
  2240. __STATIC_INLINE void LL_RTC_TS_EnableInternalEvent(RTC_TypeDef *RTCx)
  2241. {
  2242. SET_BIT(RTCx->CR, RTC_CR_ITSE);
  2243. }
  2244. /**
  2245. * @brief Disable internal event timestamp
  2246. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  2247. * @rmtoll RTC_CR ITSE LL_RTC_TS_DisableInternalEvent
  2248. * @param RTCx RTC Instance
  2249. * @retval None
  2250. */
  2251. __STATIC_INLINE void LL_RTC_TS_DisableInternalEvent(RTC_TypeDef *RTCx)
  2252. {
  2253. CLEAR_BIT(RTCx->CR, RTC_CR_ITSE);
  2254. }
  2255. /**
  2256. * @brief Enable Timestamp
  2257. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  2258. * @rmtoll RTC_CR ITSE LL_RTC_TS_Enable
  2259. * @param RTCx RTC Instance
  2260. * @retval None
  2261. */
  2262. __STATIC_INLINE void LL_RTC_TS_Enable(RTC_TypeDef *RTCx)
  2263. {
  2264. SET_BIT(RTCx->CR, RTC_CR_TSE);
  2265. }
  2266. /**
  2267. * @brief Disable Timestamp
  2268. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  2269. * @rmtoll RTC_CR ITSE LL_RTC_TS_Disable
  2270. * @param RTCx RTC Instance
  2271. * @retval None
  2272. */
  2273. __STATIC_INLINE void LL_RTC_TS_Disable(RTC_TypeDef *RTCx)
  2274. {
  2275. CLEAR_BIT(RTCx->CR, RTC_CR_TSE);
  2276. }
  2277. /**
  2278. * @brief Set Time-stamp event active edge
  2279. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  2280. * @note TSE must be reset when TSEDGE is changed to avoid unwanted TSF setting
  2281. * @rmtoll RTC_CR ITSEDGE LL_RTC_TS_SetActiveEdge
  2282. * @param RTCx RTC Instance
  2283. * @param Edge This parameter can be one of the following values:
  2284. * @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING
  2285. * @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING
  2286. * @retval None
  2287. */
  2288. __STATIC_INLINE void LL_RTC_TS_SetActiveEdge(RTC_TypeDef *RTCx, uint32_t Edge)
  2289. {
  2290. MODIFY_REG(RTCx->CR, RTC_CR_TSEDGE, Edge);
  2291. }
  2292. /**
  2293. * @brief Get Time-stamp event active edge
  2294. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  2295. * @rmtoll RTC_CR ITSEDGE LL_RTC_TS_GetActiveEdge
  2296. * @param RTCx RTC Instance
  2297. * @retval Returned value can be one of the following values:
  2298. * @arg @ref LL_RTC_TIMESTAMP_EDGE_RISING
  2299. * @arg @ref LL_RTC_TIMESTAMP_EDGE_FALLING
  2300. */
  2301. __STATIC_INLINE uint32_t LL_RTC_TS_GetActiveEdge(RTC_TypeDef *RTCx)
  2302. {
  2303. return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_TSEDGE));
  2304. }
  2305. /**
  2306. * @brief Get Timestamp AM/PM notation (AM or 24-hour format)
  2307. * @rmtoll RTC_TSTR PM LL_RTC_TS_GetTimeFormat
  2308. * @param RTCx RTC Instance
  2309. * @retval Returned value can be one of the following values:
  2310. * @arg @ref LL_RTC_TS_TIME_FORMAT_AM
  2311. * @arg @ref LL_RTC_TS_TIME_FORMAT_PM
  2312. */
  2313. __STATIC_INLINE uint32_t LL_RTC_TS_GetTimeFormat(RTC_TypeDef *RTCx)
  2314. {
  2315. return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_PM));
  2316. }
  2317. /**
  2318. * @brief Get Timestamp Hours in BCD format
  2319. * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Hours from BCD to Binary format
  2320. * @rmtoll RTC_TSTR HT LL_RTC_TS_GetHour\n
  2321. * RTC_TSTR HU LL_RTC_TS_GetHour
  2322. * @param RTCx RTC Instance
  2323. * @retval Value between Min_Data=0x01 and Max_Data=0x12 or between Min_Data=0x00 and Max_Data=0x23
  2324. */
  2325. __STATIC_INLINE uint32_t LL_RTC_TS_GetHour(RTC_TypeDef *RTCx)
  2326. {
  2327. return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_HT | RTC_TSTR_HU) >> RTC_TSTR_HU_Pos);
  2328. }
  2329. /**
  2330. * @brief Get Timestamp Minutes in BCD format
  2331. * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Minutes from BCD to Binary format
  2332. * @rmtoll RTC_TSTR MNT LL_RTC_TS_GetMinute\n
  2333. * RTC_TSTR HU LL_RTC_TS_GetMinute
  2334. * @param RTCx RTC Instance
  2335. * @retval Value between Min_Data=0x00 and Max_Data=0x59
  2336. */
  2337. __STATIC_INLINE uint32_t LL_RTC_TS_GetMinute(RTC_TypeDef *RTCx)
  2338. {
  2339. return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_MNT | RTC_TSTR_MNU) >> RTC_TSTR_MNU_Pos);
  2340. }
  2341. /**
  2342. * @brief Get Timestamp Seconds in BCD format
  2343. * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Seconds from BCD to Binary format
  2344. * @rmtoll RTC_TSTR ST LL_RTC_TS_GetSecond\n
  2345. * RTC_TSTR HU LL_RTC_TS_GetSecond
  2346. * @param RTCx RTC Instance
  2347. * @retval Value between Min_Data=0x00 and Max_Data=0x59
  2348. */
  2349. __STATIC_INLINE uint32_t LL_RTC_TS_GetSecond(RTC_TypeDef *RTCx)
  2350. {
  2351. return (uint32_t)(READ_BIT(RTCx->TSTR, RTC_TSTR_ST | RTC_TSTR_SU));
  2352. }
  2353. /**
  2354. * @brief Get Timestamp time (hour, minute and second) in BCD format
  2355. * @note helper macros __LL_RTC_GET_HOUR, __LL_RTC_GET_MINUTE and __LL_RTC_GET_SECOND
  2356. * are available to get independently each parameter.
  2357. * @rmtoll RTC_TSTR HT LL_RTC_TS_GetTime\n
  2358. * RTC_TSTR HU LL_RTC_TS_GetTime\n
  2359. * RTC_TSTR MNT LL_RTC_TS_GetTime\n
  2360. * RTC_TSTR MNU LL_RTC_TS_GetTime\n
  2361. * RTC_TSTR ST LL_RTC_TS_GetTime\n
  2362. * RTC_TSTR SU LL_RTC_TS_GetTime
  2363. * @param RTCx RTC Instance
  2364. * @retval Combination of hours, minutes and seconds.
  2365. */
  2366. __STATIC_INLINE uint32_t LL_RTC_TS_GetTime(RTC_TypeDef *RTCx)
  2367. {
  2368. return (uint32_t)(READ_BIT(RTCx->TSTR,
  2369. RTC_TSTR_HT | RTC_TSTR_HU | RTC_TSTR_MNT | RTC_TSTR_MNU | RTC_TSTR_ST | RTC_TSTR_SU));
  2370. }
  2371. /**
  2372. * @brief Get Timestamp Week day
  2373. * @rmtoll RTC_TSDR WDU LL_RTC_TS_GetWeekDay
  2374. * @param RTCx RTC Instance
  2375. * @retval Returned value can be one of the following values:
  2376. * @arg @ref LL_RTC_WEEKDAY_MONDAY
  2377. * @arg @ref LL_RTC_WEEKDAY_TUESDAY
  2378. * @arg @ref LL_RTC_WEEKDAY_WEDNESDAY
  2379. * @arg @ref LL_RTC_WEEKDAY_THURSDAY
  2380. * @arg @ref LL_RTC_WEEKDAY_FRIDAY
  2381. * @arg @ref LL_RTC_WEEKDAY_SATURDAY
  2382. * @arg @ref LL_RTC_WEEKDAY_SUNDAY
  2383. */
  2384. __STATIC_INLINE uint32_t LL_RTC_TS_GetWeekDay(RTC_TypeDef *RTCx)
  2385. {
  2386. return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU) >> RTC_TSDR_WDU_Pos);
  2387. }
  2388. /**
  2389. * @brief Get Timestamp Month in BCD format
  2390. * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Month from BCD to Binary format
  2391. * @rmtoll RTC_TSDR MT LL_RTC_TS_GetMonth\n
  2392. * RTC_TSDR MU LL_RTC_TS_GetMonth
  2393. * @param RTCx RTC Instance
  2394. * @retval Returned value can be one of the following values:
  2395. * @arg @ref LL_RTC_MONTH_JANUARY
  2396. * @arg @ref LL_RTC_MONTH_FEBRUARY
  2397. * @arg @ref LL_RTC_MONTH_MARCH
  2398. * @arg @ref LL_RTC_MONTH_APRIL
  2399. * @arg @ref LL_RTC_MONTH_MAY
  2400. * @arg @ref LL_RTC_MONTH_JUNE
  2401. * @arg @ref LL_RTC_MONTH_JULY
  2402. * @arg @ref LL_RTC_MONTH_AUGUST
  2403. * @arg @ref LL_RTC_MONTH_SEPTEMBER
  2404. * @arg @ref LL_RTC_MONTH_OCTOBER
  2405. * @arg @ref LL_RTC_MONTH_NOVEMBER
  2406. * @arg @ref LL_RTC_MONTH_DECEMBER
  2407. */
  2408. __STATIC_INLINE uint32_t LL_RTC_TS_GetMonth(RTC_TypeDef *RTCx)
  2409. {
  2410. return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_MT | RTC_TSDR_MU) >> RTC_TSDR_MU_Pos);
  2411. }
  2412. /**
  2413. * @brief Get Timestamp Day in BCD format
  2414. * @note helper macro __LL_RTC_CONVERT_BCD2BIN is available to convert Day from BCD to Binary format
  2415. * @rmtoll RTC_TSDR DT LL_RTC_TS_GetDay\n
  2416. * RTC_TSDR DU LL_RTC_TS_GetDay
  2417. * @param RTCx RTC Instance
  2418. * @retval Value between Min_Data=0x01 and Max_Data=0x31
  2419. */
  2420. __STATIC_INLINE uint32_t LL_RTC_TS_GetDay(RTC_TypeDef *RTCx)
  2421. {
  2422. return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_DT | RTC_TSDR_DU));
  2423. }
  2424. /**
  2425. * @brief Get Timestamp date (WeekDay, Day and Month) in BCD format
  2426. * @note helper macros __LL_RTC_GET_WEEKDAY, __LL_RTC_GET_MONTH,
  2427. * and __LL_RTC_GET_DAY are available to get independently each parameter.
  2428. * @rmtoll RTC_TSDR WDU LL_RTC_TS_GetDate\n
  2429. * RTC_TSDR MT LL_RTC_TS_GetDate\n
  2430. * RTC_TSDR MU LL_RTC_TS_GetDate\n
  2431. * RTC_TSDR DT LL_RTC_TS_GetDate\n
  2432. * RTC_TSDR DU LL_RTC_TS_GetDate
  2433. * @param RTCx RTC Instance
  2434. * @retval Combination of Weekday, Day and Month
  2435. */
  2436. __STATIC_INLINE uint32_t LL_RTC_TS_GetDate(RTC_TypeDef *RTCx)
  2437. {
  2438. return (uint32_t)(READ_BIT(RTCx->TSDR, RTC_TSDR_WDU | RTC_TSDR_MT | RTC_TSDR_MU | RTC_TSDR_DT | RTC_TSDR_DU));
  2439. }
  2440. /**
  2441. * @brief Get time-stamp sub second value
  2442. * @rmtoll RTC_TSDR SS LL_RTC_TS_GetSubSecond
  2443. * @param RTCx RTC Instance
  2444. * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF
  2445. */
  2446. __STATIC_INLINE uint32_t LL_RTC_TS_GetSubSecond(RTC_TypeDef *RTCx)
  2447. {
  2448. return (uint32_t)(READ_BIT(RTCx->TSSSR, RTC_TSSSR_SS));
  2449. }
  2450. /**
  2451. * @brief Activate timestamp on tamper detection event
  2452. * @rmtoll RTC_CR TAMPTS LL_RTC_TS_EnableOnTamper
  2453. * @param RTCx RTC Instance
  2454. * @retval None
  2455. */
  2456. __STATIC_INLINE void LL_RTC_TS_EnableOnTamper(RTC_TypeDef *RTCx)
  2457. {
  2458. SET_BIT(RTCx->CR, RTC_CR_TAMPTS);
  2459. }
  2460. /**
  2461. * @brief Disable timestamp on tamper detection event
  2462. * @rmtoll RTC_CR TAMPTS LL_RTC_TS_DisableOnTamper
  2463. * @param RTCx RTC Instance
  2464. * @retval None
  2465. */
  2466. __STATIC_INLINE void LL_RTC_TS_DisableOnTamper(RTC_TypeDef *RTCx)
  2467. {
  2468. CLEAR_BIT(RTCx->CR, RTC_CR_TAMPTS);
  2469. }
  2470. /**
  2471. * @}
  2472. */
  2473. /** @defgroup RTC_LL_EF_Tamper Tamper
  2474. * @{
  2475. */
  2476. /**
  2477. * @brief Enable TAMPx input detection
  2478. * @rmtoll TAMP_CR1 TAMP1E LL_RTC_TAMPER_Enable\n
  2479. * TAMP_CR1 TAMP2E... LL_RTC_TAMPER_Enable
  2480. * @param RTCx RTC Instance
  2481. * @param Tamper This parameter can be a combination of the following values:
  2482. * @arg @ref LL_RTC_TAMPER_1
  2483. * @arg @ref LL_RTC_TAMPER_2
  2484. *
  2485. * @retval None
  2486. */
  2487. __STATIC_INLINE void LL_RTC_TAMPER_Enable(RTC_TypeDef *RTCx, uint32_t Tamper)
  2488. {
  2489. UNUSED(RTCx);
  2490. SET_BIT(TAMP->CR1, Tamper);
  2491. }
  2492. /**
  2493. * @brief Clear TAMPx input detection
  2494. * @rmtoll TAMP_CR1 TAMP1E LL_RTC_TAMPER_Disable\n
  2495. * TAMP_CR1 TAMP2E... LL_RTC_TAMPER_Disable
  2496. * @param RTCx RTC Instance
  2497. * @param Tamper This parameter can be a combination of the following values:
  2498. * @arg @ref LL_RTC_TAMPER_1
  2499. * @arg @ref LL_RTC_TAMPER_2
  2500. *
  2501. * @retval None
  2502. */
  2503. __STATIC_INLINE void LL_RTC_TAMPER_Disable(RTC_TypeDef *RTCx, uint32_t Tamper)
  2504. {
  2505. UNUSED(RTCx);
  2506. CLEAR_BIT(TAMP->CR1, Tamper);
  2507. }
  2508. /**
  2509. * @brief Enable Tamper mask flag
  2510. * @note Associated Tamper IT must not enabled when tamper mask is set.
  2511. * @rmtoll TAMP_CR2 TAMP1MF LL_RTC_TAMPER_EnableMask\n
  2512. * TAMP_CR2 TAMP2MF... LL_RTC_TAMPER_EnableMask
  2513. * @param RTCx RTC Instance
  2514. * @param Mask This parameter can be a combination of the following values:
  2515. * @arg @ref LL_RTC_TAMPER_MASK_TAMPER1
  2516. * @arg @ref LL_RTC_TAMPER_MASK_TAMPER2
  2517. *
  2518. * @retval None
  2519. */
  2520. __STATIC_INLINE void LL_RTC_TAMPER_EnableMask(RTC_TypeDef *RTCx, uint32_t Mask)
  2521. {
  2522. UNUSED(RTCx);
  2523. SET_BIT(TAMP->CR2, Mask);
  2524. }
  2525. /**
  2526. * @brief Disable Tamper mask flag
  2527. * @rmtoll TAMP_CR2 TAMP1MF LL_RTC_TAMPER_DisableMask\n
  2528. * TAMP_CR2 TAMP2MF... LL_RTC_TAMPER_DisableMask
  2529. * @param RTCx RTC Instance
  2530. * @param Mask This parameter can be a combination of the following values:
  2531. * @arg @ref LL_RTC_TAMPER_MASK_TAMPER1
  2532. * @arg @ref LL_RTC_TAMPER_MASK_TAMPER2
  2533. *
  2534. * @retval None
  2535. */
  2536. __STATIC_INLINE void LL_RTC_TAMPER_DisableMask(RTC_TypeDef *RTCx, uint32_t Mask)
  2537. {
  2538. UNUSED(RTCx);
  2539. CLEAR_BIT(TAMP->CR2, Mask);
  2540. }
  2541. /**
  2542. * @brief Enable backup register erase after Tamper event detection
  2543. * @rmtoll TAMP_CR2 TAMP1NOERASE LL_RTC_TAMPER_EnableEraseBKP\n
  2544. * TAMP_CR2 TAMP2NOERASE... LL_RTC_TAMPER_EnableEraseBKP
  2545. * @param RTCx RTC Instance
  2546. * @param Tamper This parameter can be a combination of the following values:
  2547. * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER1
  2548. * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER2
  2549. *
  2550. * @retval None
  2551. */
  2552. __STATIC_INLINE void LL_RTC_TAMPER_EnableEraseBKP(RTC_TypeDef *RTCx, uint32_t Tamper)
  2553. {
  2554. UNUSED(RTCx);
  2555. CLEAR_BIT(TAMP->CR2, Tamper);
  2556. }
  2557. /**
  2558. * @brief Disable backup register erase after Tamper event detection
  2559. * @rmtoll TAMP_CR2 TAMP1NOERASE LL_RTC_TAMPER_DisableEraseBKP\n
  2560. * TAMP_CR2 TAMP2NOERASE... LL_RTC_TAMPER_DisableEraseBKP
  2561. * @param RTCx RTC Instance
  2562. * @param Tamper This parameter can be a combination of the following values:
  2563. * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER1
  2564. * @arg @ref LL_RTC_TAMPER_NOERASE_TAMPER2
  2565. *
  2566. * @retval None
  2567. */
  2568. __STATIC_INLINE void LL_RTC_TAMPER_DisableEraseBKP(RTC_TypeDef *RTCx, uint32_t Tamper)
  2569. {
  2570. UNUSED(RTCx);
  2571. SET_BIT(TAMP->CR2, Tamper);
  2572. }
  2573. /**
  2574. * @brief Disable RTC_TAMPx pull-up disable (Disable precharge of RTC_TAMPx pins)
  2575. * @rmtoll TAMP_FLTCR TAMPPUDIS LL_RTC_TAMPER_DisablePullUp
  2576. * @param RTCx RTC Instance
  2577. * @retval None
  2578. */
  2579. __STATIC_INLINE void LL_RTC_TAMPER_DisablePullUp(RTC_TypeDef *RTCx)
  2580. {
  2581. UNUSED(RTCx);
  2582. SET_BIT(TAMP->FLTCR, TAMP_FLTCR_TAMPPUDIS);
  2583. }
  2584. /**
  2585. * @brief Enable RTC_TAMPx pull-up disable ( Precharge RTC_TAMPx pins before sampling)
  2586. * @rmtoll TAMP_FLTCR TAMPPUDIS LL_RTC_TAMPER_EnablePullUp
  2587. * @param RTCx RTC Instance
  2588. * @retval None
  2589. */
  2590. __STATIC_INLINE void LL_RTC_TAMPER_EnablePullUp(RTC_TypeDef *RTCx)
  2591. {
  2592. UNUSED(RTCx);
  2593. CLEAR_BIT(TAMP->FLTCR, TAMP_FLTCR_TAMPPUDIS);
  2594. }
  2595. /**
  2596. * @brief Set RTC_TAMPx precharge duration
  2597. * @rmtoll TAMP_FLTCR TAMPPRCH LL_RTC_TAMPER_SetPrecharge
  2598. * @param RTCx RTC Instance
  2599. * @param Duration This parameter can be one of the following values:
  2600. * @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK
  2601. * @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK
  2602. * @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK
  2603. * @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK
  2604. * @retval None
  2605. */
  2606. __STATIC_INLINE void LL_RTC_TAMPER_SetPrecharge(RTC_TypeDef *RTCx, uint32_t Duration)
  2607. {
  2608. UNUSED(RTCx);
  2609. MODIFY_REG(TAMP->FLTCR, TAMP_FLTCR_TAMPPRCH, Duration);
  2610. }
  2611. /**
  2612. * @brief Get RTC_TAMPx precharge duration
  2613. * @rmtoll TAMP_FLTCR TAMPPRCH LL_RTC_TAMPER_GetPrecharge
  2614. * @param RTCx RTC Instance
  2615. * @retval Returned value can be one of the following values:
  2616. * @arg @ref LL_RTC_TAMPER_DURATION_1RTCCLK
  2617. * @arg @ref LL_RTC_TAMPER_DURATION_2RTCCLK
  2618. * @arg @ref LL_RTC_TAMPER_DURATION_4RTCCLK
  2619. * @arg @ref LL_RTC_TAMPER_DURATION_8RTCCLK
  2620. */
  2621. __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetPrecharge(RTC_TypeDef *RTCx)
  2622. {
  2623. UNUSED(RTCx);
  2624. return (uint32_t)(READ_BIT(TAMP->FLTCR, TAMP_FLTCR_TAMPPRCH));
  2625. }
  2626. /**
  2627. * @brief Set RTC_TAMPx filter count
  2628. * @rmtoll TAMP_FLTCR TAMPFLT LL_RTC_TAMPER_SetFilterCount
  2629. * @param RTCx RTC Instance
  2630. * @param FilterCount This parameter can be one of the following values:
  2631. * @arg @ref LL_RTC_TAMPER_FILTER_DISABLE
  2632. * @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE
  2633. * @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE
  2634. * @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE
  2635. * @retval None
  2636. */
  2637. __STATIC_INLINE void LL_RTC_TAMPER_SetFilterCount(RTC_TypeDef *RTCx, uint32_t FilterCount)
  2638. {
  2639. UNUSED(RTCx);
  2640. MODIFY_REG(TAMP->FLTCR, TAMP_FLTCR_TAMPFLT, FilterCount);
  2641. }
  2642. /**
  2643. * @brief Get RTC_TAMPx filter count
  2644. * @rmtoll TAMP_FLTCR TAMPFLT LL_RTC_TAMPER_GetFilterCount
  2645. * @param RTCx RTC Instance
  2646. * @retval Returned value can be one of the following values:
  2647. * @arg @ref LL_RTC_TAMPER_FILTER_DISABLE
  2648. * @arg @ref LL_RTC_TAMPER_FILTER_2SAMPLE
  2649. * @arg @ref LL_RTC_TAMPER_FILTER_4SAMPLE
  2650. * @arg @ref LL_RTC_TAMPER_FILTER_8SAMPLE
  2651. */
  2652. __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetFilterCount(RTC_TypeDef *RTCx)
  2653. {
  2654. UNUSED(RTCx);
  2655. return (uint32_t)(READ_BIT(TAMP->FLTCR, TAMP_FLTCR_TAMPFLT));
  2656. }
  2657. /**
  2658. * @brief Set Tamper sampling frequency
  2659. * @rmtoll TAMP_FLTCR TAMPFREQ LL_RTC_TAMPER_SetSamplingFreq
  2660. * @param RTCx RTC Instance
  2661. * @param SamplingFreq This parameter can be one of the following values:
  2662. * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768
  2663. * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384
  2664. * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192
  2665. * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096
  2666. * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048
  2667. * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024
  2668. * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512
  2669. * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256
  2670. * @retval None
  2671. */
  2672. __STATIC_INLINE void LL_RTC_TAMPER_SetSamplingFreq(RTC_TypeDef *RTCx, uint32_t SamplingFreq)
  2673. {
  2674. UNUSED(RTCx);
  2675. MODIFY_REG(TAMP->FLTCR, TAMP_FLTCR_TAMPFREQ, SamplingFreq);
  2676. }
  2677. /**
  2678. * @brief Get Tamper sampling frequency
  2679. * @rmtoll TAMP_FLTCR TAMPFREQ LL_RTC_TAMPER_GetSamplingFreq
  2680. * @param RTCx RTC Instance
  2681. * @retval Returned value can be one of the following values:
  2682. * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_32768
  2683. * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_16384
  2684. * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_8192
  2685. * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_4096
  2686. * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_2048
  2687. * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_1024
  2688. * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_512
  2689. * @arg @ref LL_RTC_TAMPER_SAMPLFREQDIV_256
  2690. */
  2691. __STATIC_INLINE uint32_t LL_RTC_TAMPER_GetSamplingFreq(RTC_TypeDef *RTCx)
  2692. {
  2693. UNUSED(RTCx);
  2694. return (uint32_t)(READ_BIT(TAMP->FLTCR, TAMP_FLTCR_TAMPFREQ));
  2695. }
  2696. /**
  2697. * @brief Enable Active level for Tamper input
  2698. * @rmtoll TAMP_CR2 TAMP1TRG LL_RTC_TAMPER_EnableActiveLevel\n
  2699. * TAMP_CR2 TAMP2TRG... LL_RTC_TAMPER_EnableActiveLevel
  2700. * @param RTCx RTC Instance
  2701. * @param Tamper This parameter can be a combination of the following values:
  2702. * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1
  2703. * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2
  2704. *
  2705. * @retval None
  2706. */
  2707. __STATIC_INLINE void LL_RTC_TAMPER_EnableActiveLevel(RTC_TypeDef *RTCx, uint32_t Tamper)
  2708. {
  2709. UNUSED(RTCx);
  2710. SET_BIT(TAMP->CR2, Tamper);
  2711. }
  2712. /**
  2713. * @brief Disable Active level for Tamper input
  2714. * @rmtoll TAMP_CR2 TAMP1TRG LL_RTC_TAMPER_DisableActiveLevel\n
  2715. * TAMP_CR2 TAMP2TRG... LL_RTC_TAMPER_DisableActiveLevel
  2716. * @param RTCx RTC Instance
  2717. * @param Tamper This parameter can be a combination of the following values:
  2718. * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP1
  2719. * @arg @ref LL_RTC_TAMPER_ACTIVELEVEL_TAMP2
  2720. *
  2721. * @retval None
  2722. */
  2723. __STATIC_INLINE void LL_RTC_TAMPER_DisableActiveLevel(RTC_TypeDef *RTCx, uint32_t Tamper)
  2724. {
  2725. UNUSED(RTCx);
  2726. CLEAR_BIT(TAMP->CR2, Tamper);
  2727. }
  2728. /**
  2729. * @}
  2730. */
  2731. /** @defgroup RTC_LL_EF_Internal_Tamper Internal Tamper
  2732. * @{
  2733. */
  2734. /**
  2735. * @brief Enable internal tamper detection.
  2736. * @rmtoll TAMP_CR1 ITAMP1E LL_RTC_TAMPER_ITAMP_Enable\n
  2737. * TAMP_CR1 ITAMP3E LL_RTC_TAMPER_ITAMP_Enable\n
  2738. * TAMP_CR1 ITAMP4E LL_RTC_TAMPER_ITAMP_Enable\n
  2739. * TAMP_CR1 ITAMP5E LL_RTC_TAMPER_ITAMP_Enable\n
  2740. * TAMP_CR1 ITAMP6E LL_RTC_TAMPER_ITAMP_Enable\n
  2741. * TAMP_CR1 ITAMP7E... LL_RTC_TAMPER_ITAMP_Enable
  2742. * @param RTCx RTC Instance
  2743. * @param InternalTamper This parameter can be a combination of the following values:
  2744. * @arg @ref LL_RTC_TAMPER_ITAMP1
  2745. * @arg @ref LL_RTC_TAMPER_ITAMP3
  2746. * @arg @ref LL_RTC_TAMPER_ITAMP4
  2747. * @arg @ref LL_RTC_TAMPER_ITAMP5
  2748. * @arg @ref LL_RTC_TAMPER_ITAMP6
  2749. @if RTC_TAMP_INT_7_SUPPORT
  2750. * @arg @ref LL_RTC_TAMPER_ITAMP7
  2751. @endif
  2752. *
  2753. * @retval None
  2754. */
  2755. __STATIC_INLINE void LL_RTC_TAMPER_ITAMP_Enable(RTC_TypeDef *RTCx, uint32_t InternalTamper)
  2756. {
  2757. UNUSED(RTCx);
  2758. SET_BIT(TAMP->CR1, InternalTamper);
  2759. }
  2760. /**
  2761. * @brief Disable internal tamper detection.
  2762. * @rmtoll TAMP_CR1 ITAMP1E LL_RTC_TAMPER_ITAMP_Disable\n
  2763. * TAMP_CR1 ITAMP3E LL_RTC_TAMPER_ITAMP_Disable\n
  2764. * TAMP_CR1 ITAMP4E LL_RTC_TAMPER_ITAMP_Disable\n
  2765. * TAMP_CR1 ITAMP5E LL_RTC_TAMPER_ITAMP_Disable\n
  2766. * TAMP_CR1 ITAMP6E LL_RTC_TAMPER_ITAMP_Disable\n
  2767. * TAMP_CR1 ITAMP7E... LL_RTC_TAMPER_ITAMP_Disable
  2768. * @param RTCx RTC Instance
  2769. * @param InternalTamper This parameter can be a combination of the following values:
  2770. * @arg @ref LL_RTC_TAMPER_ITAMP1
  2771. * @arg @ref LL_RTC_TAMPER_ITAMP3
  2772. * @arg @ref LL_RTC_TAMPER_ITAMP4
  2773. * @arg @ref LL_RTC_TAMPER_ITAMP5
  2774. * @arg @ref LL_RTC_TAMPER_ITAMP6
  2775. @if RTC_TAMP_INT_7_SUPPORT
  2776. * @arg @ref LL_RTC_TAMPER_ITAMP7
  2777. @endif
  2778. *
  2779. * @retval None
  2780. */
  2781. __STATIC_INLINE void LL_RTC_TAMPER_ITAMP_Disable(RTC_TypeDef *RTCx, uint32_t InternalTamper)
  2782. {
  2783. UNUSED(RTCx);
  2784. CLEAR_BIT(TAMP->CR1, InternalTamper);
  2785. }
  2786. /**
  2787. * @}
  2788. */
  2789. /** @defgroup RTC_LL_EF_Wakeup Wakeup
  2790. * @{
  2791. */
  2792. /**
  2793. * @brief Enable Wakeup timer
  2794. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  2795. * @rmtoll RTC_CR WUTE LL_RTC_WAKEUP_Enable
  2796. * @param RTCx RTC Instance
  2797. * @retval None
  2798. */
  2799. __STATIC_INLINE void LL_RTC_WAKEUP_Enable(RTC_TypeDef *RTCx)
  2800. {
  2801. SET_BIT(RTCx->CR, RTC_CR_WUTE);
  2802. }
  2803. /**
  2804. * @brief Disable Wakeup timer
  2805. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  2806. * @rmtoll RTC_CR WUTE LL_RTC_WAKEUP_Disable
  2807. * @param RTCx RTC Instance
  2808. * @retval None
  2809. */
  2810. __STATIC_INLINE void LL_RTC_WAKEUP_Disable(RTC_TypeDef *RTCx)
  2811. {
  2812. CLEAR_BIT(RTCx->CR, RTC_CR_WUTE);
  2813. }
  2814. /**
  2815. * @brief Check if Wakeup timer is enabled or not
  2816. * @rmtoll RTC_CR WUTE LL_RTC_WAKEUP_IsEnabled
  2817. * @param RTCx RTC Instance
  2818. * @retval State of bit (1 or 0).
  2819. */
  2820. __STATIC_INLINE uint32_t LL_RTC_WAKEUP_IsEnabled(RTC_TypeDef *RTCx)
  2821. {
  2822. return ((READ_BIT(RTCx->CR, RTC_CR_WUTE) == (RTC_CR_WUTE)) ? 1U : 0U);
  2823. }
  2824. /**
  2825. * @brief Select Wakeup clock
  2826. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  2827. * @note Bit can be written only when RTC_CR WUTE bit = 0 and RTC_ICSR WUTWF bit = 1
  2828. * @rmtoll RTC_CR WUCKSEL LL_RTC_WAKEUP_SetClock
  2829. * @param RTCx RTC Instance
  2830. * @param WakeupClock This parameter can be one of the following values:
  2831. * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16
  2832. * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8
  2833. * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4
  2834. * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2
  2835. * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE
  2836. * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT
  2837. * @retval None
  2838. */
  2839. __STATIC_INLINE void LL_RTC_WAKEUP_SetClock(RTC_TypeDef *RTCx, uint32_t WakeupClock)
  2840. {
  2841. MODIFY_REG(RTCx->CR, RTC_CR_WUCKSEL, WakeupClock);
  2842. }
  2843. /**
  2844. * @brief Get Wakeup clock
  2845. * @rmtoll RTC_CR WUCKSEL LL_RTC_WAKEUP_GetClock
  2846. * @param RTCx RTC Instance
  2847. * @retval Returned value can be one of the following values:
  2848. * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_16
  2849. * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_8
  2850. * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_4
  2851. * @arg @ref LL_RTC_WAKEUPCLOCK_DIV_2
  2852. * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE
  2853. * @arg @ref LL_RTC_WAKEUPCLOCK_CKSPRE_WUT
  2854. */
  2855. __STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetClock(RTC_TypeDef *RTCx)
  2856. {
  2857. return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_WUCKSEL));
  2858. }
  2859. /**
  2860. * @brief Set Wakeup auto-reload value
  2861. * @note Bit can be written only when WUTWF is set to 1 in RTC_ICSR
  2862. * @rmtoll RTC_WUTR WUT LL_RTC_WAKEUP_SetAutoReload
  2863. * @param RTCx RTC Instance
  2864. * @param Value Value between Min_Data=0x00 and Max_Data=0xFFFF
  2865. * @retval None
  2866. */
  2867. __STATIC_INLINE void LL_RTC_WAKEUP_SetAutoReload(RTC_TypeDef *RTCx, uint32_t Value)
  2868. {
  2869. MODIFY_REG(RTCx->WUTR, RTC_WUTR_WUT, Value);
  2870. }
  2871. /**
  2872. * @brief Get Wakeup auto-reload value
  2873. * @rmtoll RTC_WUTR WUT LL_RTC_WAKEUP_GetAutoReload
  2874. * @param RTCx RTC Instance
  2875. * @retval Value between Min_Data=0x00 and Max_Data=0xFFFF
  2876. */
  2877. __STATIC_INLINE uint32_t LL_RTC_WAKEUP_GetAutoReload(RTC_TypeDef *RTCx)
  2878. {
  2879. return (uint32_t)(READ_BIT(RTCx->WUTR, RTC_WUTR_WUT));
  2880. }
  2881. /**
  2882. * @}
  2883. */
  2884. /** @defgroup RTC_LL_EF_Backup_Registers Backup_Registers
  2885. * @{
  2886. */
  2887. /**
  2888. * @brief Writes a data in a specified Backup data register.
  2889. * @rmtoll TAMP_BKPxR BKP LL_RTC_BKP_SetRegister
  2890. * @param RTCx RTC Instance
  2891. * @param BackupRegister This parameter can be one of the following values:
  2892. * @arg @ref LL_RTC_BKP_DR0
  2893. * @arg @ref LL_RTC_BKP_DR1
  2894. * @arg @ref LL_RTC_BKP_DR2
  2895. * @arg @ref LL_RTC_BKP_DR3
  2896. * ...
  2897. * @param Data Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF
  2898. * @retval None
  2899. */
  2900. __STATIC_INLINE void LL_RTC_BKP_SetRegister(RTC_TypeDef *RTCx, uint32_t BackupRegister, uint32_t Data)
  2901. {
  2902. __IO uint32_t *tmp;
  2903. UNUSED(RTCx);
  2904. tmp = &(TAMP->BKP0R) + BackupRegister;
  2905. /* Write the specified register */
  2906. *tmp = Data;
  2907. }
  2908. /**
  2909. * @brief Reads data from the specified RTC Backup data Register.
  2910. * @rmtoll TAMP_BKPxR BKP LL_RTC_BKP_GetRegister
  2911. * @param RTCx RTC Instance
  2912. * @param BackupRegister This parameter can be one of the following values:
  2913. * @arg @ref LL_RTC_BKP_DR0
  2914. * @arg @ref LL_RTC_BKP_DR1
  2915. * @arg @ref LL_RTC_BKP_DR2
  2916. * @arg @ref LL_RTC_BKP_DR3
  2917. * ...
  2918. * @retval Value between Min_Data=0x00 and Max_Data=0xFFFFFFFF
  2919. */
  2920. __STATIC_INLINE uint32_t LL_RTC_BKP_GetRegister(RTC_TypeDef *RTCx, uint32_t BackupRegister)
  2921. {
  2922. const __IO uint32_t *tmp;
  2923. UNUSED(RTCx);
  2924. tmp = &(TAMP->BKP0R) + BackupRegister;
  2925. /* Read the specified register */
  2926. return *tmp;
  2927. }
  2928. /**
  2929. * @}
  2930. */
  2931. /** @defgroup RTC_LL_EF_Calibration Calibration
  2932. * @{
  2933. */
  2934. /**
  2935. * @brief Set Calibration output frequency (1 Hz or 512 Hz)
  2936. * @note Bits are write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  2937. * @rmtoll RTC_CR COE LL_RTC_CAL_SetOutputFreq\n
  2938. * RTC_CR COSEL LL_RTC_CAL_SetOutputFreq
  2939. * @param RTCx RTC Instance
  2940. * @param Frequency This parameter can be one of the following values:
  2941. * @arg @ref LL_RTC_CALIB_OUTPUT_NONE
  2942. * @arg @ref LL_RTC_CALIB_OUTPUT_1HZ
  2943. * @arg @ref LL_RTC_CALIB_OUTPUT_512HZ
  2944. * @retval None
  2945. */
  2946. __STATIC_INLINE void LL_RTC_CAL_SetOutputFreq(RTC_TypeDef *RTCx, uint32_t Frequency)
  2947. {
  2948. MODIFY_REG(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL, Frequency);
  2949. }
  2950. /**
  2951. * @brief Get Calibration output frequency (1 Hz or 512 Hz)
  2952. * @rmtoll RTC_CR COE LL_RTC_CAL_GetOutputFreq\n
  2953. * RTC_CR COSEL LL_RTC_CAL_GetOutputFreq
  2954. * @param RTCx RTC Instance
  2955. * @retval Returned value can be one of the following values:
  2956. * @arg @ref LL_RTC_CALIB_OUTPUT_NONE
  2957. * @arg @ref LL_RTC_CALIB_OUTPUT_1HZ
  2958. * @arg @ref LL_RTC_CALIB_OUTPUT_512HZ
  2959. */
  2960. __STATIC_INLINE uint32_t LL_RTC_CAL_GetOutputFreq(RTC_TypeDef *RTCx)
  2961. {
  2962. return (uint32_t)(READ_BIT(RTCx->CR, RTC_CR_COE | RTC_CR_COSEL));
  2963. }
  2964. /**
  2965. * @brief Insert or not One RTCCLK pulse every 2exp11 pulses (frequency increased by 488.5 ppm)
  2966. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  2967. * @note Bit can be written only when RECALPF is set to 0 in RTC_ICSR
  2968. * @rmtoll RTC_CALR CALP LL_RTC_CAL_SetPulse
  2969. * @param RTCx RTC Instance
  2970. * @param Pulse This parameter can be one of the following values:
  2971. * @arg @ref LL_RTC_CALIB_INSERTPULSE_NONE
  2972. * @arg @ref LL_RTC_CALIB_INSERTPULSE_SET
  2973. * @retval None
  2974. */
  2975. __STATIC_INLINE void LL_RTC_CAL_SetPulse(RTC_TypeDef *RTCx, uint32_t Pulse)
  2976. {
  2977. MODIFY_REG(RTCx->CALR, RTC_CALR_CALP, Pulse);
  2978. }
  2979. /**
  2980. * @brief Check if one RTCCLK has been inserted or not every 2exp11 pulses (frequency increased by 488.5 ppm)
  2981. * @rmtoll RTC_CALR CALP LL_RTC_CAL_IsPulseInserted
  2982. * @param RTCx RTC Instance
  2983. * @retval State of bit (1 or 0).
  2984. */
  2985. __STATIC_INLINE uint32_t LL_RTC_CAL_IsPulseInserted(RTC_TypeDef *RTCx)
  2986. {
  2987. return ((READ_BIT(RTCx->CALR, RTC_CALR_CALP) == (RTC_CALR_CALP)) ? 1U : 0U);
  2988. }
  2989. /**
  2990. * @brief Set the calibration cycle period
  2991. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  2992. * @note Bit can be written only when RECALPF is set to 0 in RTC_ICSR
  2993. * @rmtoll RTC_CALR CALW8 LL_RTC_CAL_SetPeriod\n
  2994. * RTC_CALR CALW16 LL_RTC_CAL_SetPeriod
  2995. * @param RTCx RTC Instance
  2996. * @param Period This parameter can be one of the following values:
  2997. * @arg @ref LL_RTC_CALIB_PERIOD_32SEC
  2998. * @arg @ref LL_RTC_CALIB_PERIOD_16SEC
  2999. * @arg @ref LL_RTC_CALIB_PERIOD_8SEC
  3000. * @retval None
  3001. */
  3002. __STATIC_INLINE void LL_RTC_CAL_SetPeriod(RTC_TypeDef *RTCx, uint32_t Period)
  3003. {
  3004. MODIFY_REG(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16, Period);
  3005. }
  3006. /**
  3007. * @brief Get the calibration cycle period
  3008. * @rmtoll RTC_CALR CALW8 LL_RTC_CAL_GetPeriod\n
  3009. * RTC_CALR CALW16 LL_RTC_CAL_GetPeriod
  3010. * @param RTCx RTC Instance
  3011. * @retval Returned value can be one of the following values:
  3012. * @arg @ref LL_RTC_CALIB_PERIOD_32SEC
  3013. * @arg @ref LL_RTC_CALIB_PERIOD_16SEC
  3014. * @arg @ref LL_RTC_CALIB_PERIOD_8SEC
  3015. */
  3016. __STATIC_INLINE uint32_t LL_RTC_CAL_GetPeriod(RTC_TypeDef *RTCx)
  3017. {
  3018. return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALW8 | RTC_CALR_CALW16));
  3019. }
  3020. /**
  3021. * @brief Set Calibration minus
  3022. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  3023. * @note Bit can be written only when RECALPF is set to 0 in RTC_ICSR
  3024. * @rmtoll RTC_CALR CALM LL_RTC_CAL_SetMinus
  3025. * @param RTCx RTC Instance
  3026. * @param CalibMinus Value between Min_Data=0x00 and Max_Data=0x1FF
  3027. * @retval None
  3028. */
  3029. __STATIC_INLINE void LL_RTC_CAL_SetMinus(RTC_TypeDef *RTCx, uint32_t CalibMinus)
  3030. {
  3031. MODIFY_REG(RTCx->CALR, RTC_CALR_CALM, CalibMinus);
  3032. }
  3033. /**
  3034. * @brief Get Calibration minus
  3035. * @rmtoll RTC_CALR CALM LL_RTC_CAL_GetMinus
  3036. * @param RTCx RTC Instance
  3037. * @retval Value between Min_Data=0x00 and Max_Data= 0x1FF
  3038. */
  3039. __STATIC_INLINE uint32_t LL_RTC_CAL_GetMinus(RTC_TypeDef *RTCx)
  3040. {
  3041. return (uint32_t)(READ_BIT(RTCx->CALR, RTC_CALR_CALM));
  3042. }
  3043. /**
  3044. * @}
  3045. */
  3046. /** @defgroup RTC_LL_EF_FLAG_Management FLAG_Management
  3047. * @{
  3048. */
  3049. /**
  3050. * @brief Get Internal Time-stamp flag
  3051. * @rmtoll RTC_SR ITSF LL_RTC_IsActiveFlag_ITS
  3052. * @param RTCx RTC Instance
  3053. * @retval State of bit (1 or 0).
  3054. */
  3055. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITS(RTC_TypeDef *RTCx)
  3056. {
  3057. return ((READ_BIT(RTCx->SR, RTC_SR_ITSF) == (RTC_SR_ITSF)) ? 1U : 0U);
  3058. }
  3059. /**
  3060. * @brief Get Recalibration pending Flag
  3061. * @rmtoll RTC_ICSR RECALPF LL_RTC_IsActiveFlag_RECALP
  3062. * @param RTCx RTC Instance
  3063. * @retval State of bit (1 or 0).
  3064. */
  3065. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RECALP(RTC_TypeDef *RTCx)
  3066. {
  3067. return ((READ_BIT(RTCx->ICSR, RTC_ICSR_RECALPF) == (RTC_ICSR_RECALPF)) ? 1U : 0U);
  3068. }
  3069. /**
  3070. * @brief Get Time-stamp overflow flag
  3071. * @rmtoll RTC_SR TSOVF LL_RTC_IsActiveFlag_TSOV
  3072. * @param RTCx RTC Instance
  3073. * @retval State of bit (1 or 0).
  3074. */
  3075. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSOV(RTC_TypeDef *RTCx)
  3076. {
  3077. return ((READ_BIT(RTCx->SR, RTC_SR_TSOVF) == (RTC_SR_TSOVF)) ? 1U : 0U);
  3078. }
  3079. /**
  3080. * @brief Get Time-stamp flag
  3081. * @rmtoll RTC_SR TSF LL_RTC_IsActiveFlag_TS
  3082. * @param RTCx RTC Instance
  3083. * @retval State of bit (1 or 0).
  3084. */
  3085. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TS(RTC_TypeDef *RTCx)
  3086. {
  3087. return ((READ_BIT(RTCx->SR, RTC_SR_TSF) == (RTC_SR_TSF)) ? 1U : 0U);
  3088. }
  3089. /**
  3090. * @brief Get Wakeup timer flag
  3091. * @rmtoll RTC_SR WUTF LL_RTC_IsActiveFlag_WUT
  3092. * @param RTCx RTC Instance
  3093. * @retval State of bit (1 or 0).
  3094. */
  3095. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUT(RTC_TypeDef *RTCx)
  3096. {
  3097. return ((READ_BIT(RTCx->SR, RTC_SR_WUTF) == (RTC_SR_WUTF)) ? 1U : 0U);
  3098. }
  3099. /**
  3100. * @brief Get Alarm B flag
  3101. * @rmtoll RTC_SR ALRBF LL_RTC_IsActiveFlag_ALRB
  3102. * @param RTCx RTC Instance
  3103. * @retval State of bit (1 or 0).
  3104. */
  3105. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRB(RTC_TypeDef *RTCx)
  3106. {
  3107. return ((READ_BIT(RTCx->SR, RTC_SR_ALRBF) == (RTC_SR_ALRBF)) ? 1U : 0U);
  3108. }
  3109. /**
  3110. * @brief Get Alarm A flag
  3111. * @rmtoll RTC_SR ALRAF LL_RTC_IsActiveFlag_ALRA
  3112. * @param RTCx RTC Instance
  3113. * @retval State of bit (1 or 0).
  3114. */
  3115. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRA(RTC_TypeDef *RTCx)
  3116. {
  3117. return ((READ_BIT(RTCx->SR, RTC_SR_ALRAF) == (RTC_SR_ALRAF)) ? 1U : 0U);
  3118. }
  3119. /**
  3120. * @brief Clear Internal Time-stamp flag
  3121. * @rmtoll RTC_SCR CITSF LL_RTC_ClearFlag_ITS
  3122. * @param RTCx RTC Instance
  3123. * @retval None
  3124. */
  3125. __STATIC_INLINE void LL_RTC_ClearFlag_ITS(RTC_TypeDef *RTCx)
  3126. {
  3127. SET_BIT(RTCx->SCR, RTC_SCR_CITSF);
  3128. }
  3129. /**
  3130. * @brief Clear Time-stamp overflow flag
  3131. * @rmtoll RTC_SCR CTSOVF LL_RTC_ClearFlag_TSOV
  3132. * @param RTCx RTC Instance
  3133. * @retval None
  3134. */
  3135. __STATIC_INLINE void LL_RTC_ClearFlag_TSOV(RTC_TypeDef *RTCx)
  3136. {
  3137. SET_BIT(RTCx->SCR, RTC_SCR_CTSOVF);
  3138. }
  3139. /**
  3140. * @brief Clear Time-stamp flag
  3141. * @rmtoll RTC_SCR CTSF LL_RTC_ClearFlag_TS
  3142. * @param RTCx RTC Instance
  3143. * @retval None
  3144. */
  3145. __STATIC_INLINE void LL_RTC_ClearFlag_TS(RTC_TypeDef *RTCx)
  3146. {
  3147. SET_BIT(RTCx->SCR, RTC_SCR_CTSF);
  3148. }
  3149. /**
  3150. * @brief Clear Wakeup timer flag
  3151. * @rmtoll RTC_SCR CWUTF LL_RTC_ClearFlag_WUT
  3152. * @param RTCx RTC Instance
  3153. * @retval None
  3154. */
  3155. __STATIC_INLINE void LL_RTC_ClearFlag_WUT(RTC_TypeDef *RTCx)
  3156. {
  3157. SET_BIT(RTCx->SCR, RTC_SCR_CWUTF);
  3158. }
  3159. /**
  3160. * @brief Clear Alarm B flag
  3161. * @rmtoll RTC_SCR CALRBF LL_RTC_ClearFlag_ALRB
  3162. * @param RTCx RTC Instance
  3163. * @retval None
  3164. */
  3165. __STATIC_INLINE void LL_RTC_ClearFlag_ALRB(RTC_TypeDef *RTCx)
  3166. {
  3167. SET_BIT(RTCx->SCR, RTC_SCR_CALRBF);
  3168. }
  3169. /**
  3170. * @brief Clear Alarm A flag
  3171. * @rmtoll RTC_SCR CALRAF LL_RTC_ClearFlag_ALRA
  3172. * @param RTCx RTC Instance
  3173. * @retval None
  3174. */
  3175. __STATIC_INLINE void LL_RTC_ClearFlag_ALRA(RTC_TypeDef *RTCx)
  3176. {
  3177. SET_BIT(RTCx->SCR, RTC_SCR_CALRAF);
  3178. }
  3179. /**
  3180. * @brief Get Initialization flag
  3181. * @rmtoll RTC_ICSR INITF LL_RTC_IsActiveFlag_INIT
  3182. * @param RTCx RTC Instance
  3183. * @retval State of bit (1 or 0).
  3184. */
  3185. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INIT(RTC_TypeDef *RTCx)
  3186. {
  3187. return ((READ_BIT(RTCx->ICSR, RTC_ICSR_INITF) == (RTC_ICSR_INITF)) ? 1U : 0U);
  3188. }
  3189. /**
  3190. * @brief Get Registers synchronization flag
  3191. * @rmtoll RTC_ICSR RSF LL_RTC_IsActiveFlag_RS
  3192. * @param RTCx RTC Instance
  3193. * @retval State of bit (1 or 0).
  3194. */
  3195. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_RS(RTC_TypeDef *RTCx)
  3196. {
  3197. return ((READ_BIT(RTCx->ICSR, RTC_ICSR_RSF) == (RTC_ICSR_RSF)) ? 1U : 0U);
  3198. }
  3199. /**
  3200. * @brief Clear Registers synchronization flag
  3201. * @rmtoll RTC_ICSR RSF LL_RTC_ClearFlag_RS
  3202. * @param RTCx RTC Instance
  3203. * @retval None
  3204. */
  3205. __STATIC_INLINE void LL_RTC_ClearFlag_RS(RTC_TypeDef *RTCx)
  3206. {
  3207. WRITE_REG(RTCx->ICSR, (~((RTC_ICSR_RSF | RTC_ICSR_INIT) & 0x000000FFU) | (RTCx->ICSR & RTC_ICSR_INIT)));
  3208. }
  3209. /**
  3210. * @brief Get Initialization status flag
  3211. * @rmtoll RTC_ICSR INITS LL_RTC_IsActiveFlag_INITS
  3212. * @param RTCx RTC Instance
  3213. * @retval State of bit (1 or 0).
  3214. */
  3215. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_INITS(RTC_TypeDef *RTCx)
  3216. {
  3217. return ((READ_BIT(RTCx->ICSR, RTC_ICSR_INITS) == (RTC_ICSR_INITS)) ? 1U : 0U);
  3218. }
  3219. /**
  3220. * @brief Get Shift operation pending flag
  3221. * @rmtoll RTC_ICSR SHPF LL_RTC_IsActiveFlag_SHP
  3222. * @param RTCx RTC Instance
  3223. * @retval State of bit (1 or 0).
  3224. */
  3225. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_SHP(RTC_TypeDef *RTCx)
  3226. {
  3227. return ((READ_BIT(RTCx->ICSR, RTC_ICSR_SHPF) == (RTC_ICSR_SHPF)) ? 1U : 0U);
  3228. }
  3229. /**
  3230. * @brief Get Wakeup timer write flag
  3231. * @rmtoll RTC_ICSR WUTWF LL_RTC_IsActiveFlag_WUTW
  3232. * @param RTCx RTC Instance
  3233. * @retval State of bit (1 or 0).
  3234. */
  3235. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUTW(RTC_TypeDef *RTCx)
  3236. {
  3237. return ((READ_BIT(RTCx->ICSR, RTC_ICSR_WUTWF) == (RTC_ICSR_WUTWF)) ? 1U : 0U);
  3238. }
  3239. /**
  3240. * @brief Get Alarm B write flag
  3241. * @rmtoll RTC_ICSR ALRBWF LL_RTC_IsActiveFlag_ALRBW
  3242. * @param RTCx RTC Instance
  3243. * @retval State of bit (1 or 0).
  3244. */
  3245. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRBW(RTC_TypeDef *RTCx)
  3246. {
  3247. return ((READ_BIT(RTCx->ICSR, RTC_ICSR_ALRBWF) == (RTC_ICSR_ALRBWF)) ? 1U : 0U);
  3248. }
  3249. /**
  3250. * @brief Get Alarm A write flag
  3251. * @rmtoll RTC_ICSR ALRAWF LL_RTC_IsActiveFlag_ALRAW
  3252. * @param RTCx RTC Instance
  3253. * @retval State of bit (1 or 0).
  3254. */
  3255. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRAW(RTC_TypeDef *RTCx)
  3256. {
  3257. return ((READ_BIT(RTCx->ICSR, RTC_ICSR_ALRAWF) == (RTC_ICSR_ALRAWF)) ? 1U : 0U);
  3258. }
  3259. /**
  3260. * @brief Get Alarm A masked flag.
  3261. * @rmtoll RTC_MISR ALRAMF LL_RTC_IsActiveFlag_ALRAM
  3262. * @param RTCx RTC Instance
  3263. * @retval State of bit (1 or 0).
  3264. */
  3265. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRAM(RTC_TypeDef *RTCx)
  3266. {
  3267. return ((READ_BIT(RTCx->MISR, RTC_MISR_ALRAMF) == (RTC_MISR_ALRAMF)) ? 1U : 0U);
  3268. }
  3269. /**
  3270. * @brief Get Alarm B masked flag.
  3271. * @rmtoll RTC_MISR ALRBMF LL_RTC_IsActiveFlag_ALRBM
  3272. * @param RTCx RTC Instance
  3273. * @retval State of bit (1 or 0).
  3274. */
  3275. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ALRBM(RTC_TypeDef *RTCx)
  3276. {
  3277. return ((READ_BIT(RTCx->MISR, RTC_MISR_ALRBMF) == (RTC_MISR_ALRBMF)) ? 1U : 0U);
  3278. }
  3279. /**
  3280. * @brief Get Wakeup timer masked flag.
  3281. * @rmtoll RTC_MISR WUTMF LL_RTC_IsActiveFlag_WUTM
  3282. * @param RTCx RTC Instance
  3283. * @retval State of bit (1 or 0).
  3284. */
  3285. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_WUTM(RTC_TypeDef *RTCx)
  3286. {
  3287. return ((READ_BIT(RTCx->MISR, RTC_MISR_WUTMF) == (RTC_MISR_WUTMF)) ? 1U : 0U);
  3288. }
  3289. /**
  3290. * @brief Get Time-stamp masked flag.
  3291. * @rmtoll RTC_MISR TSMF LL_RTC_IsActiveFlag_TSM
  3292. * @param RTCx RTC Instance
  3293. * @retval State of bit (1 or 0).
  3294. */
  3295. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSM(RTC_TypeDef *RTCx)
  3296. {
  3297. return ((READ_BIT(RTCx->MISR, RTC_MISR_TSMF) == (RTC_MISR_TSMF)) ? 1U : 0U);
  3298. }
  3299. /**
  3300. * @brief Get Time-stamp overflow masked flag.
  3301. * @rmtoll RTC_MISR TSOVMF LL_RTC_IsActiveFlag_TSOVM
  3302. * @param RTCx RTC Instance
  3303. * @retval State of bit (1 or 0).
  3304. */
  3305. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TSOVM(RTC_TypeDef *RTCx)
  3306. {
  3307. return ((READ_BIT(RTCx->MISR, RTC_MISR_TSOVMF) == (RTC_MISR_TSOVMF)) ? 1U : 0U);
  3308. }
  3309. /**
  3310. * @brief Get Internal Time-stamp masked flag.
  3311. * @rmtoll RTC_MISR ITSMF LL_RTC_IsActiveFlag_ITSM
  3312. * @param RTCx RTC Instance
  3313. * @retval State of bit (1 or 0).
  3314. */
  3315. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITSM(RTC_TypeDef *RTCx)
  3316. {
  3317. return ((READ_BIT(RTCx->MISR, RTC_MISR_ITSMF) == (RTC_MISR_ITSMF)) ? 1U : 0U);
  3318. }
  3319. /**
  3320. * @brief Get tamper 1 detection flag.
  3321. * @rmtoll TAMP_SR TAMP1F LL_RTC_IsActiveFlag_TAMP1
  3322. * @param RTCx RTC Instance
  3323. * @retval State of bit (1 or 0).
  3324. */
  3325. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP1(RTC_TypeDef *RTCx)
  3326. {
  3327. UNUSED(RTCx);
  3328. return ((READ_BIT(TAMP->SR, TAMP_SR_TAMP1F) == (TAMP_SR_TAMP1F)) ? 1U : 0U);
  3329. }
  3330. /**
  3331. * @brief Get tamper 2 detection flag.
  3332. * @rmtoll TAMP_SR TAMP2F LL_RTC_IsActiveFlag_TAMP2
  3333. * @param RTCx RTC Instance
  3334. * @retval State of bit (1 or 0).
  3335. */
  3336. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP2(RTC_TypeDef *RTCx)
  3337. {
  3338. UNUSED(RTCx);
  3339. return ((READ_BIT(TAMP->SR, TAMP_SR_TAMP2F) == (TAMP_SR_TAMP2F)) ? 1U : 0U);
  3340. }
  3341. #if (RTC_TAMP_NB==3)
  3342. /**
  3343. * @brief Get tamper 3 detection flag.
  3344. * @rmtoll TAMP_SR TAMP3F LL_RTC_IsActiveFlag_TAMP3
  3345. * @param RTCx RTC Instance
  3346. * @retval State of bit (1 or 0).
  3347. */
  3348. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP3(RTC_TypeDef *RTCx)
  3349. {
  3350. UNUSED(RTCx);
  3351. return ((READ_BIT(TAMP->SR, TAMP_SR_TAMP3F) == (TAMP_SR_TAMP3F)) ? 1U : 0U);
  3352. }
  3353. #elif (RTC_TAMP_NB==8)
  3354. /**
  3355. * @brief Get tamper 3 detection flag.
  3356. * @rmtoll TAMP_SR TAMP3F LL_RTC_IsActiveFlag_TAMP3
  3357. * @param RTCx RTC Instance
  3358. * @retval State of bit (1 or 0).
  3359. */
  3360. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP3(RTC_TypeDef *RTCx)
  3361. {
  3362. UNUSED(RTCx);
  3363. return ((READ_BIT(TAMP->SR, TAMP_SR_TAMP3F) == (TAMP_SR_TAMP3F)) ? 1U : 0U);
  3364. }
  3365. /**
  3366. * @brief Get tamper 4 detection flag.
  3367. * @rmtoll TAMP_SR TAMP4F LL_RTC_IsActiveFlag_TAMP4
  3368. * @param RTCx RTC Instance
  3369. * @retval State of bit (1 or 0).
  3370. */
  3371. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP4(RTC_TypeDef *RTCx)
  3372. {
  3373. UNUSED(RTCx);
  3374. return ((READ_BIT(TAMP->SR, TAMP_SR_TAMP4F) == (TAMP_SR_TAMP4F)) ? 1U : 0U);
  3375. }
  3376. /**
  3377. * @brief Get tamper 5 detection flag.
  3378. * @rmtoll TAMP_SR TAMP5F LL_RTC_IsActiveFlag_TAMP5
  3379. * @param RTCx RTC Instance
  3380. * @retval State of bit (1 or 0).
  3381. */
  3382. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP5(RTC_TypeDef *RTCx)
  3383. {
  3384. UNUSED(RTCx);
  3385. return ((READ_BIT(TAMP->SR, TAMP_SR_TAMP5F) == (TAMP_SR_TAMP5F)) ? 1U : 0U);
  3386. }
  3387. /**
  3388. * @brief Get tamper 6 detection flag.
  3389. * @rmtoll TAMP_SR TAMP6F LL_RTC_IsActiveFlag_TAMP6
  3390. * @param RTCx RTC Instance
  3391. * @retval State of bit (1 or 0).
  3392. */
  3393. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP6(RTC_TypeDef *RTCx)
  3394. {
  3395. UNUSED(RTCx);
  3396. return ((READ_BIT(TAMP->SR, TAMP_SR_TAMP6F) == (TAMP_SR_TAMP6F)) ? 1U : 0U);
  3397. }
  3398. /**
  3399. * @brief Get tamper 7 detection flag.
  3400. * @rmtoll TAMP_SR TAMP7F LL_RTC_IsActiveFlag_TAMP7
  3401. * @param RTCx RTC Instance
  3402. * @retval State of bit (1 or 0).
  3403. */
  3404. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP7(RTC_TypeDef *RTCx)
  3405. {
  3406. UNUSED(RTCx);
  3407. return ((READ_BIT(TAMP->SR, TAMP_SR_TAMP7F) == (TAMP_SR_TAMP7F)) ? 1U : 0U);
  3408. }
  3409. /**
  3410. * @brief Get tamper 8 detection flag.
  3411. * @rmtoll TAMP_SR TAMP8F LL_RTC_IsActiveFlag_TAMP8
  3412. * @param RTCx RTC Instance
  3413. * @retval State of bit (1 or 0).
  3414. */
  3415. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP8(RTC_TypeDef *RTCx)
  3416. {
  3417. UNUSED(RTCx);
  3418. return ((READ_BIT(TAMP->SR, TAMP_SR_TAMP8F) == (TAMP_SR_TAMP8F)) ? 1U : 0U);
  3419. }
  3420. #endif /* RTC_TAMP_NB */
  3421. #if defined (RTC_TAMP_INT_1_SUPPORT)
  3422. /**
  3423. * @brief Get internal tamper 1 detection flag.
  3424. * @rmtoll TAMP_SR ITAMP1F LL_RTC_IsActiveFlag_ITAMP1
  3425. * @param RTCx RTC Instance
  3426. * @retval State of bit (1 or 0).
  3427. */
  3428. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP1(RTC_TypeDef *RTCx)
  3429. {
  3430. UNUSED(RTCx);
  3431. return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP1F) == (TAMP_SR_ITAMP1F)) ? 1U : 0U);
  3432. }
  3433. #endif /* RTC_TAMP_INT_1_SUPPORT */
  3434. #if defined (RTC_TAMP_INT_2_SUPPORT)
  3435. /**
  3436. * @brief Get internal tamper 2 detection flag.
  3437. * @rmtoll TAMP_SR ITAMP2F LL_RTC_IsActiveFlag_ITAMP2
  3438. * @param RTCx RTC Instance
  3439. * @retval State of bit (1 or 0).
  3440. */
  3441. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP2(RTC_TypeDef *RTCx)
  3442. {
  3443. UNUSED(RTCx);
  3444. return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP2F) == (TAMP_SR_ITAMP2F)) ? 1U : 0U);
  3445. }
  3446. #endif /* RTC_TAMP_INT_2_SUPPORT */
  3447. /**
  3448. * @brief Get internal tamper 3 detection flag.
  3449. * @rmtoll TAMP_SR ITAMP3F LL_RTC_IsActiveFlag_ITAMP3
  3450. * @param RTCx RTC Instance
  3451. * @retval State of bit (1 or 0).
  3452. */
  3453. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP3(RTC_TypeDef *RTCx)
  3454. {
  3455. UNUSED(RTCx);
  3456. return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP3F) == (TAMP_SR_ITAMP3F)) ? 1U : 0U);
  3457. }
  3458. /**
  3459. * @brief Get internal tamper 4 detection flag.
  3460. * @rmtoll TAMP_SR ITAMP4F LL_RTC_IsActiveFlag_ITAMP4
  3461. * @param RTCx RTC Instance
  3462. * @retval State of bit (1 or 0).
  3463. */
  3464. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP4(RTC_TypeDef *RTCx)
  3465. {
  3466. UNUSED(RTCx);
  3467. return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP4F) == (TAMP_SR_ITAMP4F)) ? 1U : 0U);
  3468. }
  3469. /**
  3470. * @brief Get internal tamper 5 detection flag.
  3471. * @rmtoll TAMP_SR ITAMP5F LL_RTC_IsActiveFlag_ITAMP5
  3472. * @param RTCx RTC Instance
  3473. * @retval State of bit (1 or 0).
  3474. */
  3475. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP5(RTC_TypeDef *RTCx)
  3476. {
  3477. UNUSED(RTCx);
  3478. return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP5F) == (TAMP_SR_ITAMP5F)) ? 1U : 0U);
  3479. }
  3480. #if defined (RTC_TAMP_INT_6_SUPPORT)
  3481. /**
  3482. * @brief Get internal tamper 6 detection flag.
  3483. * @rmtoll TAMP_SR ITAMP6F LL_RTC_IsActiveFlag_ITAMP6
  3484. * @param RTCx RTC Instance
  3485. * @retval State of bit (1 or 0).
  3486. */
  3487. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP6(RTC_TypeDef *RTCx)
  3488. {
  3489. UNUSED(RTCx);
  3490. return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP6F) == (TAMP_SR_ITAMP6F)) ? 1U : 0U);
  3491. }
  3492. #endif /* RTC_TAMP_INT_6_SUPPORT */
  3493. #if defined (RTC_TAMP_INT_7_SUPPORT)
  3494. /**
  3495. * @brief Get internal tamper 7 detection flag.
  3496. * @rmtoll TAMP_SR ITAMP7F LL_RTC_IsActiveFlag_ITAMP7
  3497. * @param RTCx RTC Instance
  3498. * @retval State of bit (1 or 0).
  3499. */
  3500. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP7(RTC_TypeDef *RTCx)
  3501. {
  3502. UNUSED(RTCx);
  3503. return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP7F) == (TAMP_SR_ITAMP7F)) ? 1U : 0U);
  3504. }
  3505. #endif /* RTC_TAMP_INT_7_SUPPORT */
  3506. #if defined (RTC_TAMP_INT_8_SUPPORT)
  3507. /**
  3508. * @brief Get internal tamper 8 detection flag.
  3509. * @rmtoll TAMP_SR ITAMP8F LL_RTC_IsActiveFlag_ITAMP8
  3510. * @param RTCx RTC Instance
  3511. * @retval State of bit (1 or 0).
  3512. */
  3513. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP8(RTC_TypeDef *RTCx)
  3514. {
  3515. UNUSED(RTCx);
  3516. return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP8F) == (TAMP_SR_ITAMP8F)) ? 1U : 0U);
  3517. }
  3518. #endif /* RTC_TAMP_INT_8_SUPPORT */
  3519. #if 0
  3520. /**
  3521. * @brief Get internal tamper 9 detection flag.
  3522. * @rmtoll TAMP_SR ITAMP9F LL_RTC_IsActiveFlag_ITAMP9
  3523. * @param RTCx RTC Instance
  3524. * @retval State of bit (1 or 0).
  3525. */
  3526. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP9(RTC_TypeDef *RTCx)
  3527. {
  3528. UNUSED(RTCx);
  3529. return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP9F) == (TAMP_SR_ITAMP9F)) ? 1U : 0U);
  3530. }
  3531. /**
  3532. * @brief Get internal tamper 10 detection flag.
  3533. * @rmtoll TAMP_SR ITAMP10F LL_RTC_IsActiveFlag_ITAMP10
  3534. * @param RTCx RTC Instance
  3535. * @retval State of bit (1 or 0).
  3536. */
  3537. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP10(RTC_TypeDef *RTCx)
  3538. {
  3539. UNUSED(RTCx);
  3540. return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP10F) == (TAMP_SR_ITAMP10F)) ? 1U : 0U);
  3541. }
  3542. /**
  3543. * @brief Get internal tamper 11 detection flag.
  3544. * @rmtoll TAMP_SR ITAMP11F LL_RTC_IsActiveFlag_ITAMP11
  3545. * @param RTCx RTC Instance
  3546. * @retval State of bit (1 or 0).
  3547. */
  3548. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP11(RTC_TypeDef *RTCx)
  3549. {
  3550. UNUSED(RTCx);
  3551. return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP11F) == (TAMP_SR_ITAMP11F)) ? 1U : 0U);
  3552. }
  3553. /**
  3554. * @brief Get internal tamper 12 detection flag.
  3555. * @rmtoll TAMP_SR ITAMP7F LL_RTC_IsActiveFlag_ITAMP12
  3556. * @param RTCx RTC Instance
  3557. * @retval State of bit (1 or 0).
  3558. */
  3559. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP12(RTC_TypeDef *RTCx)
  3560. {
  3561. UNUSED(RTCx);
  3562. return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP12F) == (TAMP_SR_ITAMP12F)) ? 1U : 0U);
  3563. }
  3564. /**
  3565. * @brief Get internal tamper 13 detection flag.
  3566. * @rmtoll TAMP_SR ITAMP13F LL_RTC_IsActiveFlag_ITAMP13
  3567. * @param RTCx RTC Instance
  3568. * @retval State of bit (1 or 0).
  3569. */
  3570. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP13(RTC_TypeDef *RTCx)
  3571. {
  3572. UNUSED(RTCx);
  3573. return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP13F) == (TAMP_SR_ITAMP13F)) ? 1U : 0U);
  3574. }
  3575. /**
  3576. * @brief Get internal tamper 14 detection flag.
  3577. * @rmtoll TAMP_SR ITAMP14F LL_RTC_IsActiveFlag_ITAMP14
  3578. * @param RTCx RTC Instance
  3579. * @retval State of bit (1 or 0).
  3580. */
  3581. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP14(RTC_TypeDef *RTCx)
  3582. {
  3583. UNUSED(RTCx);
  3584. return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP14F) == (TAMP_SR_ITAMP14F)) ? 1U : 0U);
  3585. }
  3586. /**
  3587. * @brief Get internal tamper 15 detection flag.
  3588. * @rmtoll TAMP_SR ITAMP15F LL_RTC_IsActiveFlag_ITAMP15
  3589. * @param RTCx RTC Instance
  3590. * @retval State of bit (1 or 0).
  3591. */
  3592. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP15(RTC_TypeDef *RTCx)
  3593. {
  3594. UNUSED(RTCx);
  3595. return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP15F) == (TAMP_SR_ITAMP15F)) ? 1U : 0U);
  3596. }
  3597. /**
  3598. * @brief Get internal tamper 16 detection flag.
  3599. * @rmtoll TAMP_SR ITAMP7F LL_RTC_IsActiveFlag_ITAMP16
  3600. * @param RTCx RTC Instance
  3601. * @retval State of bit (1 or 0).
  3602. */
  3603. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP16(RTC_TypeDef *RTCx)
  3604. {
  3605. UNUSED(RTCx);
  3606. return ((READ_BIT(TAMP->SR, TAMP_SR_ITAMP16F) == (TAMP_SR_ITAMP16F)) ? 1U : 0U);
  3607. }
  3608. #endif /* 0 */
  3609. /**
  3610. * @brief Get tamper 1 interrupt masked flag.
  3611. * @rmtoll TAMP_MISR TAMP1MF LL_RTC_IsActiveFlag_TAMP1M
  3612. * @param RTCx RTC Instance
  3613. * @retval State of bit (1 or 0).
  3614. */
  3615. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP1M(RTC_TypeDef *RTCx)
  3616. {
  3617. UNUSED(RTCx);
  3618. return ((READ_BIT(TAMP->MISR, TAMP_MISR_TAMP1MF) == (TAMP_MISR_TAMP1MF)) ? 1U : 0U);
  3619. }
  3620. /**
  3621. * @brief Get tamper 2 interrupt masked flag.
  3622. * @rmtoll TAMP_MISR TAMP2MF LL_RTC_IsActiveFlag_TAMP2M
  3623. * @param RTCx RTC Instance
  3624. * @retval State of bit (1 or 0).
  3625. */
  3626. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP2M(RTC_TypeDef *RTCx)
  3627. {
  3628. UNUSED(RTCx);
  3629. return ((READ_BIT(TAMP->MISR, TAMP_MISR_TAMP2MF) == (TAMP_MISR_TAMP2MF)) ? 1U : 0U);
  3630. }
  3631. #if (RTC_TAMP_NB ==3)
  3632. /**
  3633. * @brief Get tamper 3 interrupt masked flag.
  3634. * @rmtoll TAMP_MISR TAMP3MF LL_RTC_IsActiveFlag_TAMP3M
  3635. * @param RTCx RTC Instance
  3636. * @retval State of bit (1 or 0).
  3637. */
  3638. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP3M(RTC_TypeDef *RTCx)
  3639. {
  3640. UNUSED(RTCx);
  3641. return ((READ_BIT(TAMP->MISR, TAMP_MISR_TAMP3MF) == (TAMP_MISR_TAMP3MF)) ? 1U : 0U);
  3642. }
  3643. #elif (RTC_TAMP_NB==8)
  3644. /**
  3645. * @brief Get tamper 3 interrupt masked flag.
  3646. * @rmtoll TAMP_MISR TAMP3MF LL_RTC_IsActiveFlag_TAMP3M
  3647. * @param RTCx RTC Instance
  3648. * @retval State of bit (1 or 0).
  3649. */
  3650. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP3M(RTC_TypeDef *RTCx)
  3651. {
  3652. UNUSED(RTCx);
  3653. return ((READ_BIT(TAMP->MISR, TAMP_MISR_TAMP3MF) == (TAMP_MISR_TAMP3MF)) ? 1U : 0U);
  3654. }
  3655. /**
  3656. * @brief Get tamper 4 interrupt masked flag.
  3657. * @rmtoll TAMP_MISR TAMP4MF LL_RTC_IsActiveFlag_TAMP4M
  3658. * @param RTCx RTC Instance
  3659. * @retval State of bit (1 or 0).
  3660. */
  3661. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP4M(RTC_TypeDef *RTCx)
  3662. {
  3663. UNUSED(RTCx);
  3664. return ((READ_BIT(TAMP->MISR, TAMP_MISR_TAMP4MF) == (TAMP_MISR_TAMP4MF)) ? 1U : 0U);
  3665. }
  3666. /**
  3667. * @brief Get tamper 5 interrupt masked flag.
  3668. * @rmtoll TAMP_MISR TAMP5MF LL_RTC_IsActiveFlag_TAMP5M
  3669. * @param RTCx RTC Instance
  3670. * @retval State of bit (1 or 0).
  3671. */
  3672. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP5M(RTC_TypeDef *RTCx)
  3673. {
  3674. UNUSED(RTCx);
  3675. return ((READ_BIT(TAMP->MISR, TAMP_MISR_TAMP5MF) == (TAMP_MISR_TAMP5MF)) ? 1U : 0U);
  3676. }
  3677. /**
  3678. * @brief Get tamper 6 interrupt masked flag.
  3679. * @rmtoll TAMP_MISR TAMP3MF LL_RTC_IsActiveFlag_TAMP6M
  3680. * @param RTCx RTC Instance
  3681. * @retval State of bit (1 or 0).
  3682. */
  3683. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP6M(RTC_TypeDef *RTCx)
  3684. {
  3685. UNUSED(RTCx);
  3686. return ((READ_BIT(TAMP->MISR, TAMP_MISR_TAMP6MF) == (TAMP_MISR_TAMP6MF)) ? 1U : 0U);
  3687. }
  3688. /**
  3689. * @brief Get tamper 7 interrupt masked flag.
  3690. * @rmtoll TAMP_MISR TAMP7MF LL_RTC_IsActiveFlag_TAMP7M
  3691. * @param RTCx RTC Instance
  3692. * @retval State of bit (1 or 0).
  3693. */
  3694. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP7M(RTC_TypeDef *RTCx)
  3695. {
  3696. UNUSED(RTCx);
  3697. return ((READ_BIT(TAMP->MISR, TAMP_MISR_TAMP7MF) == (TAMP_MISR_TAMP7MF)) ? 1U : 0U);
  3698. }
  3699. /**
  3700. * @brief Get tamper 8 interrupt masked flag.
  3701. * @rmtoll TAMP_MISR TAMP8MF LL_RTC_IsActiveFlag_TAMP8M
  3702. * @param RTCx RTC Instance
  3703. * @retval State of bit (1 or 0).
  3704. */
  3705. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_TAMP8M(RTC_TypeDef *RTCx)
  3706. {
  3707. UNUSED(RTCx);
  3708. return ((READ_BIT(TAMP->MISR, TAMP_MISR_TAMP8MF) == (TAMP_MISR_TAMP8MF)) ? 1U : 0U);
  3709. }
  3710. #endif /* RTC_TAMP_NB */
  3711. #if defined (RTC_TAMP_INT_1_SUPPORT)
  3712. /**
  3713. * @brief Get internal tamper 1 interrupt masked flag.
  3714. * @rmtoll TAMP_MISR ITAMP1MF LL_RTC_IsActiveFlag_ITAMP1M
  3715. * @param RTCx RTC Instance
  3716. * @retval State of bit (1 or 0).
  3717. */
  3718. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP1M(RTC_TypeDef *RTCx)
  3719. {
  3720. UNUSED(RTCx);
  3721. return ((READ_BIT(TAMP->MISR, TAMP_MISR_ITAMP1MF) == (TAMP_MISR_ITAMP1MF)) ? 1U : 0U);
  3722. }
  3723. #endif /* RTC_TAMP_INT_1_SUPPORT */
  3724. #if defined (RTC_TAMP_INT_2_SUPPORT)
  3725. /**
  3726. * @brief Get internal tamper 2 interrupt masked flag.
  3727. * @rmtoll TAMP_MISR ITAMP2MF LL_RTC_IsActiveFlag_ITAMP2M
  3728. * @param RTCx RTC Instance
  3729. * @retval State of bit (1 or 0).
  3730. */
  3731. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP2M(RTC_TypeDef *RTCx)
  3732. {
  3733. UNUSED(RTCx);
  3734. return ((READ_BIT(TAMP->MISR, TAMP_MISR_ITAMP2MF) == (TAMP_MISR_ITAMP2MF)) ? 1U : 0U);
  3735. }
  3736. #endif /* RTC_TAMP_INT_2_SUPPORT */
  3737. /**
  3738. * @brief Get internal tamper 3 interrupt masked flag.
  3739. * @rmtoll TAMP_MISR ITAMP3MF LL_RTC_IsActiveFlag_ITAMP3M
  3740. * @param RTCx RTC Instance
  3741. * @retval State of bit (1 or 0).
  3742. */
  3743. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP3M(RTC_TypeDef *RTCx)
  3744. {
  3745. UNUSED(RTCx);
  3746. return ((READ_BIT(TAMP->MISR, TAMP_MISR_ITAMP3MF) == (TAMP_MISR_ITAMP3MF)) ? 1U : 0U);
  3747. }
  3748. /**
  3749. * @brief Get internal tamper 4 interrupt masked flag.
  3750. * @rmtoll TAMP_MISR ITAMP4MF LL_RTC_IsActiveFlag_ITAMP4M
  3751. * @param RTCx RTC Instance
  3752. * @retval State of bit (1 or 0).
  3753. */
  3754. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP4M(RTC_TypeDef *RTCx)
  3755. {
  3756. UNUSED(RTCx);
  3757. return ((READ_BIT(TAMP->MISR, TAMP_MISR_ITAMP4MF) == (TAMP_MISR_ITAMP4MF)) ? 1U : 0U);
  3758. }
  3759. /**
  3760. * @brief Get internal tamper 5 interrupt masked flag.
  3761. * @rmtoll TAMP_MISR ITAMP5MF LL_RTC_IsActiveFlag_ITAMP5M
  3762. * @param RTCx RTC Instance
  3763. * @retval State of bit (1 or 0).
  3764. */
  3765. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP5M(RTC_TypeDef *RTCx)
  3766. {
  3767. UNUSED(RTCx);
  3768. return ((READ_BIT(TAMP->MISR, TAMP_MISR_ITAMP5MF) == (TAMP_MISR_ITAMP5MF)) ? 1U : 0U);
  3769. }
  3770. #if defined (RTC_TAMP_INT_6_SUPPORT)
  3771. /**
  3772. * @brief Get internal tamper 6 interrupt masked flag.
  3773. * @rmtoll TAMP_MISR ITAMP6MF LL_RTC_IsActiveFlag_ITAMP6M
  3774. * @param RTCx RTC Instance
  3775. * @retval State of bit (1 or 0).
  3776. */
  3777. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP6M(RTC_TypeDef *RTCx)
  3778. {
  3779. UNUSED(RTCx);
  3780. return ((READ_BIT(TAMP->MISR, TAMP_MISR_ITAMP6MF) == (TAMP_MISR_ITAMP6MF)) ? 1U : 0U);
  3781. }
  3782. #endif /* RTC_TAMP_INT_6_SUPPORT */
  3783. #if defined (RTC_TAMP_INT_7_SUPPORT)
  3784. /**
  3785. * @brief Get internal tamper 7 interrupt masked flag.
  3786. * @rmtoll TAMP_MISR ITAMP7MF LL_RTC_IsActiveFlag_ITAMP7M
  3787. * @param RTCx RTC Instance
  3788. * @retval State of bit (1 or 0).
  3789. */
  3790. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP7M(RTC_TypeDef *RTCx)
  3791. {
  3792. UNUSED(RTCx);
  3793. return ((READ_BIT(TAMP->MISR, TAMP_MISR_ITAMP7MF) == (TAMP_MISR_ITAMP7MF)) ? 1U : 0U);
  3794. }
  3795. #endif /* RTC_TAMP_INT_7_SUPPORT */
  3796. #if defined (RTC_TAMP_INT_8_SUPPORT)
  3797. /**
  3798. * @brief Get internal tamper 8 interrupt masked flag.
  3799. * @rmtoll TAMP_MISR ITAMP8MF LL_RTC_IsActiveFlag_ITAMP8M
  3800. * @param RTCx RTC Instance
  3801. * @retval State of bit (1 or 0).
  3802. */
  3803. __STATIC_INLINE uint32_t LL_RTC_IsActiveFlag_ITAMP8M(RTC_TypeDef *RTCx)
  3804. {
  3805. UNUSED(RTCx);
  3806. return ((READ_BIT(TAMP->MISR, TAMP_MISR_ITAMP8MF) == (TAMP_MISR_ITAMP8MF)) ? 1U : 0U);
  3807. }
  3808. #endif /* RTC_TAMP_INT_8_SUPPORT */
  3809. /**
  3810. * @brief Clear tamper 1 detection flag.
  3811. * @rmtoll TAMP_SCR CTAMP1F LL_RTC_ClearFlag_TAMP1
  3812. * @param RTCx RTC Instance
  3813. * @retval None
  3814. */
  3815. __STATIC_INLINE void LL_RTC_ClearFlag_TAMP1(RTC_TypeDef *RTCx)
  3816. {
  3817. UNUSED(RTCx);
  3818. SET_BIT(TAMP->SCR, TAMP_SCR_CTAMP1F);
  3819. }
  3820. /**
  3821. * @brief Clear tamper 2 detection flag.
  3822. * @rmtoll TAMP_SCR CTAMP2F LL_RTC_ClearFlag_TAMP2
  3823. * @param RTCx RTC Instance
  3824. * @retval None
  3825. */
  3826. __STATIC_INLINE void LL_RTC_ClearFlag_TAMP2(RTC_TypeDef *RTCx)
  3827. {
  3828. UNUSED(RTCx);
  3829. SET_BIT(TAMP->SCR, TAMP_SCR_CTAMP2F);
  3830. }
  3831. #if (RTC_TAMP_NB == 3)
  3832. /**
  3833. * @brief Clear tamper 3 detection flag.
  3834. * @rmtoll TAMP_SCR CTAMP3F LL_RTC_ClearFlag_TAMP3
  3835. * @param RTCx RTC Instance
  3836. * @retval None
  3837. */
  3838. __STATIC_INLINE void LL_RTC_ClearFlag_TAMP3(RTC_TypeDef *RTCx)
  3839. {
  3840. UNUSED(RTCx);
  3841. SET_BIT(TAMP->SCR, TAMP_SCR_CTAMP3F);
  3842. }
  3843. #elif (RTC_TAMP_NB == 8)
  3844. /**
  3845. * @brief Clear tamper 3 detection flag.
  3846. * @rmtoll TAMP_SCR CTAMP3F LL_RTC_ClearFlag_TAMP3
  3847. * @param RTCx RTC Instance
  3848. * @retval None
  3849. */
  3850. __STATIC_INLINE void LL_RTC_ClearFlag_TAMP3(RTC_TypeDef *RTCx)
  3851. {
  3852. UNUSED(RTCx);
  3853. SET_BIT(TAMP->SCR, TAMP_SCR_CTAMP3F);
  3854. }
  3855. /**
  3856. * @brief Clear tamper 4 detection flag.
  3857. * @rmtoll TAMP_SCR CTAMP3F LL_RTC_ClearFlag_TAMP4
  3858. * @param RTCx RTC Instance
  3859. * @retval None
  3860. */
  3861. __STATIC_INLINE void LL_RTC_ClearFlag_TAMP4(RTC_TypeDef *RTCx)
  3862. {
  3863. UNUSED(RTCx);
  3864. SET_BIT(TAMP->SCR, TAMP_SCR_CTAMP4F);
  3865. }
  3866. /**
  3867. * @brief Clear tamper 5 detection flag.
  3868. * @rmtoll TAMP_SCR CTAMP5F LL_RTC_ClearFlag_TAMP5
  3869. * @param RTCx RTC Instance
  3870. * @retval None
  3871. */
  3872. __STATIC_INLINE void LL_RTC_ClearFlag_TAMP5(RTC_TypeDef *RTCx)
  3873. {
  3874. UNUSED(RTCx);
  3875. SET_BIT(TAMP->SCR, TAMP_SCR_CTAMP5F);
  3876. }
  3877. /**
  3878. * @brief Clear tamper 6 detection flag.
  3879. * @rmtoll TAMP_SCR CTAMP6F LL_RTC_ClearFlag_TAMP6
  3880. * @param RTCx RTC Instance
  3881. * @retval None
  3882. */
  3883. __STATIC_INLINE void LL_RTC_ClearFlag_TAMP6(RTC_TypeDef *RTCx)
  3884. {
  3885. UNUSED(RTCx);
  3886. SET_BIT(TAMP->SCR, TAMP_SCR_CTAMP6F);
  3887. }
  3888. /**
  3889. * @brief Clear tamper 7 detection flag.
  3890. * @rmtoll TAMP_SCR CTAMP7F LL_RTC_ClearFlag_TAMP7
  3891. * @param RTCx RTC Instance
  3892. * @retval None
  3893. */
  3894. __STATIC_INLINE void LL_RTC_ClearFlag_TAMP7(RTC_TypeDef *RTCx)
  3895. {
  3896. UNUSED(RTCx);
  3897. SET_BIT(TAMP->SCR, TAMP_SCR_CTAMP7F);
  3898. }
  3899. /**
  3900. * @brief Clear tamper 8 detection flag.
  3901. * @rmtoll TAMP_SCR CTAMP8F LL_RTC_ClearFlag_TAMP8
  3902. * @param RTCx RTC Instance
  3903. * @retval None
  3904. */
  3905. __STATIC_INLINE void LL_RTC_ClearFlag_TAMP8(RTC_TypeDef *RTCx)
  3906. {
  3907. UNUSED(RTCx);
  3908. SET_BIT(TAMP->SCR, TAMP_SCR_CTAMP8F);
  3909. }
  3910. #endif /* RTC_TAMP_NB */
  3911. #if defined (RTC_TAMP_INT_1_SUPPORT)
  3912. /**
  3913. * @brief Clear internal tamper 1 detection flag.
  3914. * @rmtoll TAMP_SCR CITAMP1F LL_RTC_ClearFlag_ITAMP1
  3915. * @param RTCx RTC Instance
  3916. * @retval None
  3917. */
  3918. __STATIC_INLINE void LL_RTC_ClearFlag_ITAMP1(RTC_TypeDef *RTCx)
  3919. {
  3920. UNUSED(RTCx);
  3921. SET_BIT(TAMP->SCR, TAMP_SCR_CITAMP1F);
  3922. }
  3923. #endif /* RTC_TAMP_INT_1_SUPPORT */
  3924. #if defined (RTC_TAMP_INT_2_SUPPORT)
  3925. /**
  3926. * @brief Clear internal tamper 2 detection flag.
  3927. * @rmtoll TAMP_SCR CITAMP2F LL_RTC_ClearFlag_ITAMP2
  3928. * @param RTCx RTC Instance
  3929. * @retval None
  3930. */
  3931. __STATIC_INLINE void LL_RTC_ClearFlag_ITAMP2(RTC_TypeDef *RTCx)
  3932. {
  3933. UNUSED(RTCx);
  3934. SET_BIT(TAMP->SCR, TAMP_SCR_CITAMP2F);
  3935. }
  3936. #endif /* RTC_TAMP_INT_2_SUPPORT */
  3937. /**
  3938. * @brief Clear internal tamper 3 detection flag.
  3939. * @rmtoll TAMP_SCR CITAMP3F LL_RTC_ClearFlag_ITAMP3
  3940. * @param RTCx RTC Instance
  3941. * @retval None
  3942. */
  3943. __STATIC_INLINE void LL_RTC_ClearFlag_ITAMP3(RTC_TypeDef *RTCx)
  3944. {
  3945. UNUSED(RTCx);
  3946. SET_BIT(TAMP->SCR, TAMP_SCR_CITAMP3F);
  3947. }
  3948. /**
  3949. * @brief Clear internal tamper 4 detection flag.
  3950. * @rmtoll TAMP_SCR CITAMP4F LL_RTC_ClearFlag_ITAMP4
  3951. * @param RTCx RTC Instance
  3952. * @retval None
  3953. */
  3954. __STATIC_INLINE void LL_RTC_ClearFlag_ITAMP4(RTC_TypeDef *RTCx)
  3955. {
  3956. UNUSED(RTCx);
  3957. SET_BIT(TAMP->SCR, TAMP_SCR_CITAMP4F);
  3958. }
  3959. /**
  3960. * @brief Clear internal tamper 5 detection flag.
  3961. * @rmtoll TAMP_SCR CITAMP5F LL_RTC_ClearFlag_ITAMP5
  3962. * @param RTCx RTC Instance
  3963. * @retval None
  3964. */
  3965. __STATIC_INLINE void LL_RTC_ClearFlag_ITAMP5(RTC_TypeDef *RTCx)
  3966. {
  3967. UNUSED(RTCx);
  3968. SET_BIT(TAMP->SCR, TAMP_SCR_CITAMP5F);
  3969. }
  3970. #if defined (RTC_TAMP_INT_6_SUPPORT)
  3971. /**
  3972. * @brief Clear internal tamper 6 detection flag.
  3973. * @rmtoll TAMP_SCR CITAMP6F LL_RTC_ClearFlag_ITAMP6
  3974. * @param RTCx RTC Instance
  3975. * @retval None
  3976. */
  3977. __STATIC_INLINE void LL_RTC_ClearFlag_ITAMP6(RTC_TypeDef *RTCx)
  3978. {
  3979. UNUSED(RTCx);
  3980. SET_BIT(TAMP->SCR, TAMP_SCR_CITAMP6F);
  3981. }
  3982. #endif /* (RTC_TAMP_INT_2_SUPPORT)*/
  3983. #if defined (RTC_TAMP_INT_7_SUPPORT)
  3984. /**
  3985. * @brief Clear internal tamper 7 detection flag.
  3986. * @rmtoll TAMP_SCR CITAMP7F LL_RTC_ClearFlag_ITAMP7
  3987. * @param RTCx RTC Instance
  3988. * @retval None
  3989. */
  3990. __STATIC_INLINE void LL_RTC_ClearFlag_ITAMP7(RTC_TypeDef *RTCx)
  3991. {
  3992. UNUSED(RTCx);
  3993. SET_BIT(TAMP->SCR, TAMP_SCR_CITAMP7F);
  3994. }
  3995. #endif /* (RTC_TAMP_INT_7_SUPPORT) */
  3996. #if defined (RTC_TAMP_INT_8_SUPPORT)
  3997. /**
  3998. * @brief Clear internal tamper 8 detection flag.
  3999. * @rmtoll TAMP_SCR CITAMP8F LL_RTC_ClearFlag_ITAMP8
  4000. * @param RTCx RTC Instance
  4001. * @retval None
  4002. */
  4003. __STATIC_INLINE void LL_RTC_ClearFlag_ITAMP8(RTC_TypeDef *RTCx)
  4004. {
  4005. UNUSED(RTCx);
  4006. SET_BIT(TAMP->SCR, TAMP_SCR_CITAMP8F);
  4007. }
  4008. #endif /* (RTC_TAMP_INT_8_SUPPORT) */
  4009. /**
  4010. * @}
  4011. */
  4012. /** @defgroup RTC_LL_EF_IT_Management IT_Management
  4013. * @{
  4014. */
  4015. /**
  4016. * @brief Enable Time-stamp interrupt
  4017. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  4018. * @rmtoll RTC_CR LL_RTC_EnableIT_TS
  4019. * @param RTCx RTC Instance
  4020. * @retval None
  4021. */
  4022. __STATIC_INLINE void LL_RTC_EnableIT_TS(RTC_TypeDef *RTCx)
  4023. {
  4024. SET_BIT(RTCx->CR, RTC_CR_TSIE);
  4025. }
  4026. /**
  4027. * @brief Disable Time-stamp interrupt
  4028. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  4029. * @rmtoll RTC_CR LL_RTC_DisableIT_TS
  4030. * @param RTCx RTC Instance
  4031. * @retval None
  4032. */
  4033. __STATIC_INLINE void LL_RTC_DisableIT_TS(RTC_TypeDef *RTCx)
  4034. {
  4035. CLEAR_BIT(RTCx->CR, RTC_CR_TSIE);
  4036. }
  4037. /**
  4038. * @brief Enable Wakeup timer interrupt
  4039. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  4040. * @rmtoll RTC_CR LL_RTC_EnableIT_WUT
  4041. * @param RTCx RTC Instance
  4042. * @retval None
  4043. */
  4044. __STATIC_INLINE void LL_RTC_EnableIT_WUT(RTC_TypeDef *RTCx)
  4045. {
  4046. SET_BIT(RTCx->CR, RTC_CR_WUTIE);
  4047. }
  4048. /**
  4049. * @brief Disable Wakeup timer interrupt
  4050. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  4051. * @rmtoll RTC_CR LL_RTC_DisableIT_WUT
  4052. * @param RTCx RTC Instance
  4053. * @retval None
  4054. */
  4055. __STATIC_INLINE void LL_RTC_DisableIT_WUT(RTC_TypeDef *RTCx)
  4056. {
  4057. CLEAR_BIT(RTCx->CR, RTC_CR_WUTIE);
  4058. }
  4059. /**
  4060. * @brief Enable Alarm B interrupt
  4061. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  4062. * @rmtoll RTC_CR ALRBIE LL_RTC_EnableIT_ALRB
  4063. * @param RTCx RTC Instance
  4064. * @retval None
  4065. */
  4066. __STATIC_INLINE void LL_RTC_EnableIT_ALRB(RTC_TypeDef *RTCx)
  4067. {
  4068. SET_BIT(RTCx->CR, RTC_CR_ALRBIE);
  4069. }
  4070. /**
  4071. * @brief Disable Alarm B interrupt
  4072. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  4073. * @rmtoll RTC_CR ALRBIE LL_RTC_DisableIT_ALRB
  4074. * @param RTCx RTC Instance
  4075. * @retval None
  4076. */
  4077. __STATIC_INLINE void LL_RTC_DisableIT_ALRB(RTC_TypeDef *RTCx)
  4078. {
  4079. CLEAR_BIT(RTCx->CR, RTC_CR_ALRBIE);
  4080. }
  4081. /**
  4082. * @brief Enable Alarm A interrupt
  4083. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  4084. * @rmtoll RTC_CR ALRAIE LL_RTC_EnableIT_ALRA
  4085. * @param RTCx RTC Instance
  4086. * @retval None
  4087. */
  4088. __STATIC_INLINE void LL_RTC_EnableIT_ALRA(RTC_TypeDef *RTCx)
  4089. {
  4090. SET_BIT(RTCx->CR, RTC_CR_ALRAIE);
  4091. }
  4092. /**
  4093. * @brief Disable Alarm A interrupt
  4094. * @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
  4095. * @rmtoll RTC_CR ALRAIE LL_RTC_DisableIT_ALRA
  4096. * @param RTCx RTC Instance
  4097. * @retval None
  4098. */
  4099. __STATIC_INLINE void LL_RTC_DisableIT_ALRA(RTC_TypeDef *RTCx)
  4100. {
  4101. CLEAR_BIT(RTCx->CR, RTC_CR_ALRAIE);
  4102. }
  4103. /**
  4104. * @brief Check if Time-stamp interrupt is enabled or not
  4105. * @rmtoll RTC_CR TSIE LL_RTC_IsEnabledIT_TS
  4106. * @param RTCx RTC Instance
  4107. * @retval State of bit (1 or 0).
  4108. */
  4109. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TS(RTC_TypeDef *RTCx)
  4110. {
  4111. return ((READ_BIT(RTCx->CR, RTC_CR_TSIE) == (RTC_CR_TSIE)) ? 1U : 0U);
  4112. }
  4113. /**
  4114. * @brief Check if Wakeup timer interrupt is enabled or not
  4115. * @rmtoll RTC_CR WUTIE LL_RTC_IsEnabledIT_WUT
  4116. * @param RTCx RTC Instance
  4117. * @retval State of bit (1 or 0).
  4118. */
  4119. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_WUT(RTC_TypeDef *RTCx)
  4120. {
  4121. return ((READ_BIT(RTCx->CR, RTC_CR_WUTIE) == (RTC_CR_WUTIE)) ? 1U : 0U);
  4122. }
  4123. /**
  4124. * @brief Check if Alarm B interrupt is enabled or not
  4125. * @rmtoll RTC_CR ALRBIE LL_RTC_IsEnabledIT_ALRB
  4126. * @param RTCx RTC Instance
  4127. * @retval State of bit (1 or 0).
  4128. */
  4129. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRB(RTC_TypeDef *RTCx)
  4130. {
  4131. return ((READ_BIT(RTCx->CR, RTC_CR_ALRBIE) == (RTC_CR_ALRBIE)) ? 1U : 0U);
  4132. }
  4133. /**
  4134. * @brief Check if Alarm A interrupt is enabled or not
  4135. * @rmtoll RTC_CR ALRAIE LL_RTC_IsEnabledIT_ALRA
  4136. * @param RTCx RTC Instance
  4137. * @retval State of bit (1 or 0).
  4138. */
  4139. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ALRA(RTC_TypeDef *RTCx)
  4140. {
  4141. return ((READ_BIT(RTCx->CR, RTC_CR_ALRAIE) == (RTC_CR_ALRAIE)) ? 1U : 0U);
  4142. }
  4143. /**
  4144. * @brief Enable tamper 1 interrupt.
  4145. * @rmtoll TAMP_IER TAMP1IE LL_RTC_EnableIT_TAMP1
  4146. * @param RTCx RTC Instance
  4147. * @retval None
  4148. */
  4149. __STATIC_INLINE void LL_RTC_EnableIT_TAMP1(RTC_TypeDef *RTCx)
  4150. {
  4151. UNUSED(RTCx);
  4152. SET_BIT(TAMP->IER, TAMP_IER_TAMP1IE);
  4153. }
  4154. /**
  4155. * @brief Disable tamper 1 interrupt.
  4156. * @rmtoll TAMP_IER TAMP1IE LL_RTC_DisableIT_TAMP1
  4157. * @param RTCx RTC Instance
  4158. * @retval None
  4159. */
  4160. __STATIC_INLINE void LL_RTC_DisableIT_TAMP1(RTC_TypeDef *RTCx)
  4161. {
  4162. UNUSED(RTCx);
  4163. CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP1IE);
  4164. }
  4165. /**
  4166. * @brief Enable tamper 2 interrupt.
  4167. * @rmtoll TAMP_IER TAMP2IE LL_RTC_EnableIT_TAMP2
  4168. * @param RTCx RTC Instance
  4169. * @retval None
  4170. */
  4171. __STATIC_INLINE void LL_RTC_EnableIT_TAMP2(RTC_TypeDef *RTCx)
  4172. {
  4173. UNUSED(RTCx);
  4174. SET_BIT(TAMP->IER, TAMP_IER_TAMP2IE);
  4175. }
  4176. /**
  4177. * @brief Disable tamper 2 interrupt.
  4178. * @rmtoll TAMP_IER TAMP2IE LL_RTC_DisableIT_TAMP2
  4179. * @param RTCx RTC Instance
  4180. * @retval None
  4181. */
  4182. __STATIC_INLINE void LL_RTC_DisableIT_TAMP2(RTC_TypeDef *RTCx)
  4183. {
  4184. UNUSED(RTCx);
  4185. CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP2IE);
  4186. }
  4187. #if (RTC_TAMP_NB == 3)
  4188. /**
  4189. * @brief Enable tamper 3 interrupt.
  4190. * @rmtoll TAMP_IER TAMP3IE LL_RTC_EnableIT_TAMP3
  4191. * @param RTCx RTC Instance
  4192. * @retval None
  4193. */
  4194. __STATIC_INLINE void LL_RTC_EnableIT_TAMP3(RTC_TypeDef *RTCx)
  4195. {
  4196. UNUSED(RTCx);
  4197. SET_BIT(TAMP->IER, TAMP_IER_TAMP3IE);
  4198. }
  4199. /**
  4200. * @brief Disable tamper 3 interrupt.
  4201. * @rmtoll TAMP_IER TAMP3IE LL_RTC_DisableIT_TAMP3
  4202. * @param RTCx RTC Instance
  4203. * @retval None
  4204. */
  4205. __STATIC_INLINE void LL_RTC_DisableIT_TAMP3(RTC_TypeDef *RTCx)
  4206. {
  4207. UNUSED(RTCx);
  4208. CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP3IE);
  4209. }
  4210. #elif (RTC_TAMP_NB == 8)
  4211. /**
  4212. * @brief Enable tamper 3 interrupt.
  4213. * @rmtoll TAMP_IER TAMP3IE LL_RTC_EnableIT_TAMP3
  4214. * @param RTCx RTC Instance
  4215. * @retval None
  4216. */
  4217. __STATIC_INLINE void LL_RTC_EnableIT_TAMP3(RTC_TypeDef *RTCx)
  4218. {
  4219. UNUSED(RTCx);
  4220. SET_BIT(TAMP->IER, TAMP_IER_TAMP3IE);
  4221. }
  4222. /**
  4223. * @brief Disable tamper 3 interrupt.
  4224. * @rmtoll TAMP_IER TAMP3IE LL_RTC_DisableIT_TAMP3
  4225. * @param RTCx RTC Instance
  4226. * @retval None
  4227. */
  4228. __STATIC_INLINE void LL_RTC_DisableIT_TAMP3(RTC_TypeDef *RTCx)
  4229. {
  4230. UNUSED(RTCx);
  4231. CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP3IE);
  4232. }
  4233. /**
  4234. * @brief Enable tamper 4 interrupt.
  4235. * @rmtoll TAMP_IER TAMP4IE LL_RTC_EnableIT_TAMP4
  4236. * @param RTCx RTC Instance
  4237. * @retval None
  4238. */
  4239. __STATIC_INLINE void LL_RTC_EnableIT_TAMP4(RTC_TypeDef *RTCx)
  4240. {
  4241. UNUSED(RTCx);
  4242. SET_BIT(TAMP->IER, TAMP_IER_TAMP4IE);
  4243. }
  4244. /**
  4245. * @brief Disable tamper 4 interrupt.
  4246. * @rmtoll TAMP_IER TAMP4IE LL_RTC_DisableIT_TAMP4
  4247. * @param RTCx RTC Instance
  4248. * @retval None
  4249. */
  4250. __STATIC_INLINE void LL_RTC_DisableIT_TAMP4(RTC_TypeDef *RTCx)
  4251. {
  4252. UNUSED(RTCx);
  4253. CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP4IE);
  4254. }
  4255. /**
  4256. * @brief Enable tamper 5 interrupt.
  4257. * @rmtoll TAMP_IER TAMP5IE LL_RTC_EnableIT_TAMP5
  4258. * @param RTCx RTC Instance
  4259. * @retval None
  4260. */
  4261. __STATIC_INLINE void LL_RTC_EnableIT_TAMP5(RTC_TypeDef *RTCx)
  4262. {
  4263. UNUSED(RTCx);
  4264. SET_BIT(TAMP->IER, TAMP_IER_TAMP5IE);
  4265. }
  4266. /**
  4267. * @brief Disable tamper 5 interrupt.
  4268. * @rmtoll TAMP_IER TAMP5IE LL_RTC_DisableIT_TAMP5
  4269. * @param RTCx RTC Instance
  4270. * @retval None
  4271. */
  4272. __STATIC_INLINE void LL_RTC_DisableIT_TAMP5(RTC_TypeDef *RTCx)
  4273. {
  4274. UNUSED(RTCx);
  4275. CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP5IE);
  4276. }
  4277. /**
  4278. * @brief Enable tamper 6 interrupt.
  4279. * @rmtoll TAMP_IER TAMP6IE LL_RTC_EnableIT_TAMP6
  4280. * @param RTCx RTC Instance
  4281. * @retval None
  4282. */
  4283. __STATIC_INLINE void LL_RTC_EnableIT_TAMP6(RTC_TypeDef *RTCx)
  4284. {
  4285. UNUSED(RTCx);
  4286. SET_BIT(TAMP->IER, TAMP_IER_TAMP6IE);
  4287. }
  4288. /**
  4289. * @brief Disable tamper 6 interrupt.
  4290. * @rmtoll TAMP_IER TAMP6IE LL_RTC_DisableIT_TAMP6
  4291. * @param RTCx RTC Instance
  4292. * @retval None
  4293. */
  4294. __STATIC_INLINE void LL_RTC_DisableIT_TAMP6(RTC_TypeDef *RTCx)
  4295. {
  4296. UNUSED(RTCx);
  4297. CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP6IE);
  4298. }
  4299. /**
  4300. * @brief Enable tamper 7 interrupt.
  4301. * @rmtoll TAMP_IER TAMP7IE LL_RTC_EnableIT_TAMP7
  4302. * @param RTCx RTC Instance
  4303. * @retval None
  4304. */
  4305. __STATIC_INLINE void LL_RTC_EnableIT_TAMP7(RTC_TypeDef *RTCx)
  4306. {
  4307. UNUSED(RTCx);
  4308. SET_BIT(TAMP->IER, TAMP_IER_TAMP7IE);
  4309. }
  4310. /**
  4311. * @brief Disable tamper 7 interrupt.
  4312. * @rmtoll TAMP_IER TAMP7IE LL_RTC_DisableIT_TAMP7
  4313. * @param RTCx RTC Instance
  4314. * @retval None
  4315. */
  4316. __STATIC_INLINE void LL_RTC_DisableIT_TAMP7(RTC_TypeDef *RTCx)
  4317. {
  4318. UNUSED(RTCx);
  4319. CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP7IE);
  4320. }
  4321. /**
  4322. * @brief Enable tamper 8 interrupt.
  4323. * @rmtoll TAMP_IER TAMP8IE LL_RTC_EnableIT_TAMP8
  4324. * @param RTCx RTC Instance
  4325. * @retval None
  4326. */
  4327. __STATIC_INLINE void LL_RTC_EnableIT_TAMP8(RTC_TypeDef *RTCx)
  4328. {
  4329. UNUSED(RTCx);
  4330. SET_BIT(TAMP->IER, TAMP_IER_TAMP8IE);
  4331. }
  4332. /**
  4333. * @brief Disable tamper 8 interrupt.
  4334. * @rmtoll TAMP_IER TAMP8IE LL_RTC_DisableIT_TAMP8
  4335. * @param RTCx RTC Instance
  4336. * @retval None
  4337. */
  4338. __STATIC_INLINE void LL_RTC_DisableIT_TAMP8(RTC_TypeDef *RTCx)
  4339. {
  4340. UNUSED(RTCx);
  4341. CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP8IE);
  4342. }
  4343. #endif /* RTC_TAMP_NB */
  4344. #if 0
  4345. /**
  4346. * @brief Enable tamper 92 interrupt.
  4347. * @rmtoll TAMP_IER TAMP9IE LL_RTC_EnableIT_TAMP9
  4348. * @param RTCx RTC Instance
  4349. * @retval None
  4350. */
  4351. __STATIC_INLINE void LL_RTC_EnableIT_TAMP9(RTC_TypeDef *RTCx)
  4352. {
  4353. UNUSED(RTCx);
  4354. SET_BIT(TAMP->IER, TAMP_IER_TAMP9IE);
  4355. }
  4356. /**
  4357. * @brief Disable tamper 9 interrupt.
  4358. * @rmtoll TAMP_IER TAMP9IE LL_RTC_DisableIT_TAMP9
  4359. * @param RTCx RTC Instance
  4360. * @retval None
  4361. */
  4362. __STATIC_INLINE void LL_RTC_DisableIT_TAMP9(RTC_TypeDef *RTCx)
  4363. {
  4364. UNUSED(RTCx);
  4365. CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP9IE);
  4366. }
  4367. /**
  4368. * @brief Enable tamper 10 interrupt.
  4369. * @rmtoll TAMP_IER TAMP10IE LL_RTC_EnableIT_TAMP10
  4370. * @param RTCx RTC Instance
  4371. * @retval None
  4372. */
  4373. __STATIC_INLINE void LL_RTC_EnableIT_TAMP10(RTC_TypeDef *RTCx)
  4374. {
  4375. UNUSED(RTCx);
  4376. SET_BIT(TAMP->IER, TAMP_IER_TAMP10IE);
  4377. }
  4378. /**
  4379. * @brief Disable tamper 10 interrupt.
  4380. * @rmtoll TAMP_IER TAMP10IE LL_RTC_DisableIT_TAMP10
  4381. * @param RTCx RTC Instance
  4382. * @retval None
  4383. */
  4384. __STATIC_INLINE void LL_RTC_DisableIT_TAMP10(RTC_TypeDef *RTCx)
  4385. {
  4386. UNUSED(RTCx);
  4387. CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP10IE);
  4388. }
  4389. /**
  4390. * @brief Enable tamper 11 interrupt.
  4391. * @rmtoll TAMP_IER TAMP11IE LL_RTC_EnableIT_TAMP11
  4392. * @param RTCx RTC Instance
  4393. * @retval None
  4394. */
  4395. __STATIC_INLINE void LL_RTC_EnableIT_TAMP11(RTC_TypeDef *RTCx)
  4396. {
  4397. UNUSED(RTCx);
  4398. SET_BIT(TAMP->IER, TAMP_IER_TAMP11IE);
  4399. }
  4400. /**
  4401. * @brief Disable tamper 11 interrupt.
  4402. * @rmtoll TAMP_IER TAMP11IE LL_RTC_DisableIT_TAMP11
  4403. * @param RTCx RTC Instance
  4404. * @retval None
  4405. */
  4406. __STATIC_INLINE void LL_RTC_DisableIT_TAMP11(RTC_TypeDef *RTCx)
  4407. {
  4408. UNUSED(RTCx);
  4409. CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP11IE);
  4410. }
  4411. /**
  4412. * @brief Enable tamper 12 interrupt.
  4413. * @rmtoll TAMP_IER TAMP12IE LL_RTC_EnableIT_TAMP12
  4414. * @param RTCx RTC Instance
  4415. * @retval None
  4416. */
  4417. __STATIC_INLINE void LL_RTC_EnableIT_TAMP12(RTC_TypeDef *RTCx)
  4418. {
  4419. UNUSED(RTCx);
  4420. SET_BIT(TAMP->IER, TAMP_IER_TAMP12IE);
  4421. }
  4422. /**
  4423. * @brief Disable tamper 12 interrupt.
  4424. * @rmtoll TAMP_IER TAMP12IE LL_RTC_DisableIT_TAMP12
  4425. * @param RTCx RTC Instance
  4426. * @retval None
  4427. */
  4428. __STATIC_INLINE void LL_RTC_DisableIT_TAMP12(RTC_TypeDef *RTCx)
  4429. {
  4430. UNUSED(RTCx);
  4431. CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP12IE);
  4432. }
  4433. /**
  4434. * @brief Enable tamper 13 interrupt.
  4435. * @rmtoll TAMP_IER TAMP13IE LL_RTC_EnableIT_TAMP13
  4436. * @param RTCx RTC Instance
  4437. * @retval None
  4438. */
  4439. __STATIC_INLINE void LL_RTC_EnableIT_TAMP13(RTC_TypeDef *RTCx)
  4440. {
  4441. UNUSED(RTCx);
  4442. SET_BIT(TAMP->IER, TAMP_IER_TAMP13IE);
  4443. }
  4444. /**
  4445. * @brief Disable tamper 13 interrupt.
  4446. * @rmtoll TAMP_IER TAMP13IE LL_RTC_DisableIT_TAMP13
  4447. * @param RTCx RTC Instance
  4448. * @retval None
  4449. */
  4450. __STATIC_INLINE void LL_RTC_DisableIT_TAMP13(RTC_TypeDef *RTCx)
  4451. {
  4452. UNUSED(RTCx);
  4453. CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP13IE);
  4454. }
  4455. /**
  4456. * @brief Enable tamper 14 interrupt.
  4457. * @rmtoll TAMP_IER TAMP14IE LL_RTC_EnableIT_TAMP14
  4458. * @param RTCx RTC Instance
  4459. * @retval None
  4460. */
  4461. __STATIC_INLINE void LL_RTC_EnableIT_TAMP14(RTC_TypeDef *RTCx)
  4462. {
  4463. UNUSED(RTCx);
  4464. SET_BIT(TAMP->IER, TAMP_IER_TAMP14IE);
  4465. }
  4466. /**
  4467. * @brief Disable tamper 14 interrupt.
  4468. * @rmtoll TAMP_IER TAMP14IE LL_RTC_DisableIT_TAMP14
  4469. * @param RTCx RTC Instance
  4470. * @retval None
  4471. */
  4472. __STATIC_INLINE void LL_RTC_DisableIT_TAMP14(RTC_TypeDef *RTCx)
  4473. {
  4474. UNUSED(RTCx);
  4475. CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP14IE);
  4476. }
  4477. /**
  4478. * @brief Enable tamper 15 interrupt.
  4479. * @rmtoll TAMP_IER TAMP15IE LL_RTC_EnableIT_TAMP15
  4480. * @param RTCx RTC Instance
  4481. * @retval None
  4482. */
  4483. __STATIC_INLINE void LL_RTC_EnableIT_TAMP15(RTC_TypeDef *RTCx)
  4484. {
  4485. UNUSED(RTCx);
  4486. SET_BIT(TAMP->IER, TAMP_IER_TAMP15IE);
  4487. }
  4488. /**
  4489. * @brief Disable tamper 15 interrupt.
  4490. * @rmtoll TAMP_IER TAMP15IE LL_RTC_DisableIT_TAMP15
  4491. * @param RTCx RTC Instance
  4492. * @retval None
  4493. */
  4494. __STATIC_INLINE void LL_RTC_DisableIT_TAMP15(RTC_TypeDef *RTCx)
  4495. {
  4496. UNUSED(RTCx);
  4497. CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP15IE);
  4498. }
  4499. /**
  4500. * @brief Enable tamper 16 interrupt.
  4501. * @rmtoll TAMP_IER TAMP16IE LL_RTC_EnableIT_TAMP16
  4502. * @param RTCx RTC Instance
  4503. * @retval None
  4504. */
  4505. __STATIC_INLINE void LL_RTC_EnableIT_TAMP16(RTC_TypeDef *RTCx)
  4506. {
  4507. UNUSED(RTCx);
  4508. SET_BIT(TAMP->IER, TAMP_IER_TAMP16IE);
  4509. }
  4510. /**
  4511. * @brief Disable tamper 16 interrupt.
  4512. * @rmtoll TAMP_IER TAMP16IE LL_RTC_DisableIT_TAMP16
  4513. * @param RTCx RTC Instance
  4514. * @retval None
  4515. */
  4516. __STATIC_INLINE void LL_RTC_DisableIT_TAMP16(RTC_TypeDef *RTCx)
  4517. {
  4518. UNUSED(RTCx);
  4519. CLEAR_BIT(TAMP->IER, TAMP_IER_TAMP16IE);
  4520. }
  4521. #endif /* 0 */
  4522. #if defined (RTC_TAMP_INT_1_SUPPORT)
  4523. /**
  4524. * @brief Enable internal tamper 1 interrupt.
  4525. * @rmtoll TAMP_IER ITAMP1IE LL_RTC_EnableIT_ITAMP1
  4526. * @param RTCx RTC Instance
  4527. * @retval None
  4528. */
  4529. __STATIC_INLINE void LL_RTC_EnableIT_ITAMP1(RTC_TypeDef *RTCx)
  4530. {
  4531. UNUSED(RTCx);
  4532. SET_BIT(TAMP->IER, TAMP_IER_ITAMP1IE);
  4533. }
  4534. /**
  4535. * @brief Disable internal tamper 1 interrupt.
  4536. * @rmtoll TAMP_IER TAMP1IE LL_RTC_DisableIT_ITAMP1
  4537. * @param RTCx RTC Instance
  4538. * @retval None
  4539. */
  4540. __STATIC_INLINE void LL_RTC_DisableIT_ITAMP1(RTC_TypeDef *RTCx)
  4541. {
  4542. UNUSED(RTCx);
  4543. CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP1IE);
  4544. }
  4545. #endif /* RTC_TAMP_INT_1_SUPPORT */
  4546. #if defined (RTC_TAMP_INT_2_SUPPORT)
  4547. /**
  4548. * @brief Enable internal tamper 2 interrupt.
  4549. * @rmtoll TAMP_IER ITAMP2IE LL_RTC_EnableIT_ITAMP2
  4550. * @param RTCx RTC Instance
  4551. * @retval None
  4552. */
  4553. __STATIC_INLINE void LL_RTC_EnableIT_ITAMP2(RTC_TypeDef *RTCx)
  4554. {
  4555. UNUSED(RTCx);
  4556. SET_BIT(TAMP->IER, TAMP_IER_ITAMP2IE);
  4557. }
  4558. /**
  4559. * @brief Disable internal tamper 2 interrupt.
  4560. * @rmtoll TAMP_IER TAMP2IE LL_RTC_DisableIT_ITAMP2
  4561. * @param RTCx RTC Instance
  4562. * @retval None
  4563. */
  4564. __STATIC_INLINE void LL_RTC_DisableIT_ITAMP2(RTC_TypeDef *RTCx)
  4565. {
  4566. UNUSED(RTCx);
  4567. CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP2IE);
  4568. }
  4569. #endif /* RTC_TAMP_INT_2_SUPPORT */
  4570. /**
  4571. * @brief Enable internal tamper 3 interrupt.
  4572. * @rmtoll TAMP_IER ITAMP3IE LL_RTC_EnableIT_ITAMP3
  4573. * @param RTCx RTC Instance
  4574. * @retval None
  4575. */
  4576. __STATIC_INLINE void LL_RTC_EnableIT_ITAMP3(RTC_TypeDef *RTCx)
  4577. {
  4578. UNUSED(RTCx);
  4579. SET_BIT(TAMP->IER, TAMP_IER_ITAMP3IE);
  4580. }
  4581. /**
  4582. * @brief Disable internal tamper 3 interrupt.
  4583. * @rmtoll TAMP_IER TAMP3IE LL_RTC_DisableIT_ITAMP3
  4584. * @param RTCx RTC Instance
  4585. * @retval None
  4586. */
  4587. __STATIC_INLINE void LL_RTC_DisableIT_ITAMP3(RTC_TypeDef *RTCx)
  4588. {
  4589. UNUSED(RTCx);
  4590. CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP3IE);
  4591. }
  4592. /**
  4593. * @brief Enable internal tamper 4 interrupt.
  4594. * @rmtoll TAMP_IER ITAMP4IE LL_RTC_EnableIT_ITAMP4
  4595. * @param RTCx RTC Instance
  4596. * @retval None
  4597. */
  4598. __STATIC_INLINE void LL_RTC_EnableIT_ITAMP4(RTC_TypeDef *RTCx)
  4599. {
  4600. UNUSED(RTCx);
  4601. SET_BIT(TAMP->IER, TAMP_IER_ITAMP4IE);
  4602. }
  4603. /**
  4604. * @brief Disable internal tamper 4 interrupt.
  4605. * @rmtoll TAMP_IER TAMP4IE LL_RTC_DisableIT_ITAMP4
  4606. * @param RTCx RTC Instance
  4607. * @retval None
  4608. */
  4609. __STATIC_INLINE void LL_RTC_DisableIT_ITAMP4(RTC_TypeDef *RTCx)
  4610. {
  4611. UNUSED(RTCx);
  4612. CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP4IE);
  4613. }
  4614. /**
  4615. * @brief Enable internal tamper 5 interrupt.
  4616. * @rmtoll TAMP_IER ITAMP5IE LL_RTC_EnableIT_ITAMP5
  4617. * @param RTCx RTC Instance
  4618. * @retval None
  4619. */
  4620. __STATIC_INLINE void LL_RTC_EnableIT_ITAMP5(RTC_TypeDef *RTCx)
  4621. {
  4622. UNUSED(RTCx);
  4623. SET_BIT(TAMP->IER, TAMP_IER_ITAMP5IE);
  4624. }
  4625. /**
  4626. * @brief Disable internal tamper 5 interrupt.
  4627. * @rmtoll TAMP_IER TAMP5IE LL_RTC_DisableIT_ITAMP5
  4628. * @param RTCx RTC Instance
  4629. * @retval None
  4630. */
  4631. __STATIC_INLINE void LL_RTC_DisableIT_ITAMP5(RTC_TypeDef *RTCx)
  4632. {
  4633. UNUSED(RTCx);
  4634. CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP5IE);
  4635. }
  4636. #if defined (RTC_TAMP_INT_6_SUPPORT)
  4637. /**
  4638. * @brief Enable internal tamper 6 interrupt.
  4639. * @rmtoll TAMP_IER ITAMP6IE LL_RTC_EnableIT_ITAMP6
  4640. * @param RTCx RTC Instance
  4641. * @retval None
  4642. */
  4643. __STATIC_INLINE void LL_RTC_EnableIT_ITAMP6(RTC_TypeDef *RTCx)
  4644. {
  4645. UNUSED(RTCx);
  4646. SET_BIT(TAMP->IER, TAMP_IER_ITAMP6IE);
  4647. }
  4648. /**
  4649. * @brief Disable internal tamper 6 interrupt.
  4650. * @rmtoll TAMP_IER TAMP6IE LL_RTC_DisableIT_ITAMP6
  4651. * @param RTCx RTC Instance
  4652. * @retval None
  4653. */
  4654. __STATIC_INLINE void LL_RTC_DisableIT_ITAMP6(RTC_TypeDef *RTCx)
  4655. {
  4656. UNUSED(RTCx);
  4657. CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP6IE);
  4658. }
  4659. #endif /* (RTC_TAMP_INT_2_SUPPORT) */
  4660. #if defined (RTC_TAMP_INT_7_SUPPORT)
  4661. /**
  4662. * @brief Enable internal tamper 7 interrupt.
  4663. * @rmtoll TAMP_IER ITAMP7IE LL_RTC_EnableIT_ITAMP7
  4664. * @param RTCx RTC Instance
  4665. * @retval None
  4666. */
  4667. __STATIC_INLINE void LL_RTC_EnableIT_ITAMP7(RTC_TypeDef *RTCx)
  4668. {
  4669. UNUSED(RTCx);
  4670. SET_BIT(TAMP->IER, TAMP_IER_ITAMP7IE);
  4671. }
  4672. /**
  4673. * @brief Disable internal tamper 7 interrupt.
  4674. * @rmtoll TAMP_IER TAMP7IE LL_RTC_DisableIT_ITAMP7
  4675. * @param RTCx RTC Instance
  4676. * @retval None
  4677. */
  4678. __STATIC_INLINE void LL_RTC_DisableIT_ITAMP7(RTC_TypeDef *RTCx)
  4679. {
  4680. UNUSED(RTCx);
  4681. CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP7IE);
  4682. }
  4683. #endif /* (RTC_TAMP_INT_7_SUPPORT)*/
  4684. #if defined (RTC_TAMP_INT_8_SUPPORT)
  4685. /**
  4686. * @brief Enable internal tamper 8 interrupt.
  4687. * @rmtoll TAMP_IER ITAMP8IE LL_RTC_EnableIT_ITAMP8
  4688. * @param RTCx RTC Instance
  4689. * @retval None
  4690. */
  4691. __STATIC_INLINE void LL_RTC_EnableIT_ITAMP8(RTC_TypeDef *RTCx)
  4692. {
  4693. UNUSED(RTCx);
  4694. SET_BIT(TAMP->IER, TAMP_IER_ITAMP8IE);
  4695. }
  4696. /**
  4697. * @brief Disable internal tamper 8 interrupt.
  4698. * @rmtoll TAMP_IER TAMP8IE LL_RTC_DisableIT_ITAMP8
  4699. * @param RTCx RTC Instance
  4700. * @retval None
  4701. */
  4702. __STATIC_INLINE void LL_RTC_DisableIT_ITAMP8(RTC_TypeDef *RTCx)
  4703. {
  4704. UNUSED(RTCx);
  4705. CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP8IE);
  4706. }
  4707. #endif /* (RTC_TAMP_INT_8_SUPPORT)*/
  4708. #if 0
  4709. /**
  4710. * @brief Enable internal tamper 9 interrupt.
  4711. * @rmtoll TAMP_IER ITAMP7IE LL_RTC_EnableIT_ITAMP9
  4712. * @param RTCx RTC Instance
  4713. * @retval None
  4714. */
  4715. __STATIC_INLINE void LL_RTC_EnableIT_ITAMP9(RTC_TypeDef *RTCx)
  4716. {
  4717. UNUSED(RTCx);
  4718. SET_BIT(TAMP->IER, TAMP_IER_ITAMP9IE);
  4719. }
  4720. /**
  4721. * @brief Disable internal tamper 9 interrupt.
  4722. * @rmtoll TAMP_IER TAMP9IE LL_RTC_DisableIT_ITAMP9
  4723. * @param RTCx RTC Instance
  4724. * @retval None
  4725. */
  4726. __STATIC_INLINE void LL_RTC_DisableIT_ITAMP9(RTC_TypeDef *RTCx)
  4727. {
  4728. UNUSED(RTCx);
  4729. CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP9IE);
  4730. }
  4731. /**
  4732. * @brief Enable internal tamper 10 interrupt.
  4733. * @rmtoll TAMP_IER ITAMP10IE LL_RTC_EnableIT_ITAMP10
  4734. * @param RTCx RTC Instance
  4735. * @retval None
  4736. */
  4737. __STATIC_INLINE void LL_RTC_EnableIT_ITAMP10(RTC_TypeDef *RTCx)
  4738. {
  4739. UNUSED(RTCx);
  4740. SET_BIT(TAMP->IER, TAMP_IER_ITAMP10IE);
  4741. }
  4742. /**
  4743. * @brief Disable internal tamper 10 interrupt.
  4744. * @rmtoll TAMP_IER TAMP10IE LL_RTC_DisableIT_ITAMP10
  4745. * @param RTCx RTC Instance
  4746. * @retval None
  4747. */
  4748. __STATIC_INLINE void LL_RTC_DisableIT_ITAMP10(RTC_TypeDef *RTCx)
  4749. {
  4750. UNUSED(RTCx);
  4751. CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP10IE);
  4752. }
  4753. /**
  4754. * @brief Enable internal tamper 11 interrupt.
  4755. * @rmtoll TAMP_IER ITAMP11IE LL_RTC_EnableIT_ITAMP11
  4756. * @param RTCx RTC Instance
  4757. * @retval None
  4758. */
  4759. __STATIC_INLINE void LL_RTC_EnableIT_ITAMP11(RTC_TypeDef *RTCx)
  4760. {
  4761. UNUSED(RTCx);
  4762. SET_BIT(TAMP->IER, TAMP_IER_ITAMP11IE);
  4763. }
  4764. /**
  4765. * @brief Disable internal tamper 11 interrupt.
  4766. * @rmtoll TAMP_IER TAMP11IE LL_RTC_DisableIT_ITAMP11
  4767. * @param RTCx RTC Instance
  4768. * @retval None
  4769. */
  4770. __STATIC_INLINE void LL_RTC_DisableIT_ITAMP11(RTC_TypeDef *RTCx)
  4771. {
  4772. UNUSED(RTCx);
  4773. CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP11IE);
  4774. }
  4775. /**
  4776. * @brief Enable internal tamper 12 interrupt.
  4777. * @rmtoll TAMP_IER ITAMP12IE LL_RTC_EnableIT_ITAMP12
  4778. * @param RTCx RTC Instance
  4779. * @retval None
  4780. */
  4781. __STATIC_INLINE void LL_RTC_EnableIT_ITAMP12(RTC_TypeDef *RTCx)
  4782. {
  4783. UNUSED(RTCx);
  4784. SET_BIT(TAMP->IER, TAMP_IER_ITAMP12IE);
  4785. }
  4786. /**
  4787. * @brief Disable internal tamper 12 interrupt.
  4788. * @rmtoll TAMP_IER TAMP12IE LL_RTC_DisableIT_ITAMP12
  4789. * @param RTCx RTC Instance
  4790. * @retval None
  4791. */
  4792. __STATIC_INLINE void LL_RTC_DisableIT_ITAMP12(RTC_TypeDef *RTCx)
  4793. {
  4794. UNUSED(RTCx);
  4795. CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP12IE);
  4796. }
  4797. /**
  4798. * @brief Enable internal tamper 13 interrupt.
  4799. * @rmtoll TAMP_IER ITAMP13IE LL_RTC_EnableIT_ITAMP13
  4800. * @param RTCx RTC Instance
  4801. * @retval None
  4802. */
  4803. __STATIC_INLINE void LL_RTC_EnableIT_ITAMP13(RTC_TypeDef *RTCx)
  4804. {
  4805. UNUSED(RTCx);
  4806. SET_BIT(TAMP->IER, TAMP_IER_ITAMP13IE);
  4807. }
  4808. /**
  4809. * @brief Disable internal tamper 13 interrupt.
  4810. * @rmtoll TAMP_IER TAMP13IE LL_RTC_DisableIT_ITAMP13
  4811. * @param RTCx RTC Instance
  4812. * @retval None
  4813. */
  4814. __STATIC_INLINE void LL_RTC_DisableIT_ITAMP13(RTC_TypeDef *RTCx)
  4815. {
  4816. UNUSED(RTCx);
  4817. CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP13IE);
  4818. }
  4819. /**
  4820. * @brief Enable internal tamper 14 interrupt.
  4821. * @rmtoll TAMP_IER ITAMP14IE LL_RTC_EnableIT_ITAMP14
  4822. * @param RTCx RTC Instance
  4823. * @retval None
  4824. */
  4825. __STATIC_INLINE void LL_RTC_EnableIT_ITAMP14(RTC_TypeDef *RTCx)
  4826. {
  4827. UNUSED(RTCx);
  4828. SET_BIT(TAMP->IER, TAMP_IER_ITAMP14IE);
  4829. }
  4830. /**
  4831. * @brief Disable internal tamper 14 interrupt.
  4832. * @rmtoll TAMP_IER TAMP14IE LL_RTC_DisableIT_ITAMP14
  4833. * @param RTCx RTC Instance
  4834. * @retval None
  4835. */
  4836. __STATIC_INLINE void LL_RTC_DisableIT_ITAMP14(RTC_TypeDef *RTCx)
  4837. {
  4838. UNUSED(RTCx);
  4839. CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP14IE);
  4840. }
  4841. /**
  4842. * @brief Enable internal tamper 15 interrupt.
  4843. * @rmtoll TAMP_IER ITAMP15IE LL_RTC_EnableIT_ITAMP15
  4844. * @param RTCx RTC Instance
  4845. * @retval None
  4846. */
  4847. __STATIC_INLINE void LL_RTC_EnableIT_ITAMP15(RTC_TypeDef *RTCx)
  4848. {
  4849. UNUSED(RTCx);
  4850. SET_BIT(TAMP->IER, TAMP_IER_ITAMP15IE);
  4851. }
  4852. /**
  4853. * @brief Disable internal tamper 15 interrupt.
  4854. * @rmtoll TAMP_IER TAMP15IE LL_RTC_DisableIT_ITAMP15
  4855. * @param RTCx RTC Instance
  4856. * @retval None
  4857. */
  4858. __STATIC_INLINE void LL_RTC_DisableIT_ITAMP15(RTC_TypeDef *RTCx)
  4859. {
  4860. UNUSED(RTCx);
  4861. CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP15IE);
  4862. }
  4863. /**
  4864. * @brief Enable internal tamper 16 interrupt.
  4865. * @rmtoll TAMP_IER ITAMP16IE LL_RTC_EnableIT_ITAMP16
  4866. * @param RTCx RTC Instance
  4867. * @retval None
  4868. */
  4869. __STATIC_INLINE void LL_RTC_EnableIT_ITAMP16(RTC_TypeDef *RTCx)
  4870. {
  4871. UNUSED(RTCx);
  4872. SET_BIT(TAMP->IER, TAMP_IER_ITAMP16IE);
  4873. }
  4874. /**
  4875. * @brief Disable internal tamper 16 interrupt.
  4876. * @rmtoll TAMP_IER TAMP16IE LL_RTC_DisableIT_ITAMP16
  4877. * @param RTCx RTC Instance
  4878. * @retval None
  4879. */
  4880. __STATIC_INLINE void LL_RTC_DisableIT_ITAMP16(RTC_TypeDef *RTCx)
  4881. {
  4882. UNUSED(RTCx);
  4883. CLEAR_BIT(TAMP->IER, TAMP_IER_ITAMP16IE);
  4884. }
  4885. #endif /* 0 */
  4886. /**
  4887. * @brief Check if tamper 1 interrupt is enabled or not.
  4888. * @rmtoll TAMP_IER TAMP1IE LL_RTC_IsEnabledIT_TAMP1
  4889. * @param RTCx RTC Instance
  4890. * @retval State of bit (1 or 0).
  4891. */
  4892. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP1(RTC_TypeDef *RTCx)
  4893. {
  4894. UNUSED(RTCx);
  4895. return ((READ_BIT(TAMP->IER, TAMP_IER_TAMP1IE) == (TAMP_IER_TAMP1IE)) ? 1U : 0U);
  4896. }
  4897. /**
  4898. * @brief Check if tamper 2 interrupt is enabled or not.
  4899. * @rmtoll TAMP_IER TAMP2IE LL_RTC_IsEnabledIT_TAMP2
  4900. * @param RTCx RTC Instance
  4901. * @retval State of bit (1 or 0).
  4902. */
  4903. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP2(RTC_TypeDef *RTCx)
  4904. {
  4905. UNUSED(RTCx);
  4906. return ((READ_BIT(TAMP->IER, TAMP_IER_TAMP2IE) == (TAMP_IER_TAMP2IE)) ? 1U : 0U);
  4907. }
  4908. #if (RTC_TAMP_NB == 3)
  4909. /**
  4910. * @brief Check if tamper 3 interrupt is enabled or not.
  4911. * @rmtoll TAMP_IER TAMP3IE LL_RTC_IsEnabledIT_TAMP3
  4912. * @param RTCx RTC Instance
  4913. * @retval State of bit (1 or 0).
  4914. */
  4915. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP3(RTC_TypeDef *RTCx)
  4916. {
  4917. UNUSED(RTCx);
  4918. return ((READ_BIT(TAMP->IER, TAMP_IER_TAMP3IE) == (TAMP_IER_TAMP3IE)) ? 1U : 0U);
  4919. }
  4920. #elif (RTC_TAMP_NB == 8)
  4921. /**
  4922. * @brief Check if tamper 3 interrupt is enabled or not.
  4923. * @rmtoll TAMP_IER TAMP3IE LL_RTC_IsEnabledIT_TAMP3
  4924. * @param RTCx RTC Instance
  4925. * @retval State of bit (1 or 0).
  4926. */
  4927. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP3(RTC_TypeDef *RTCx)
  4928. {
  4929. UNUSED(RTCx);
  4930. return ((READ_BIT(TAMP->IER, TAMP_IER_TAMP3IE) == (TAMP_IER_TAMP3IE)) ? 1U : 0U);
  4931. }
  4932. /**
  4933. * @brief Check if tamper 4 interrupt is enabled or not.
  4934. * @rmtoll TAMP_IER TAMP4IE LL_RTC_IsEnabledIT_TAMP4
  4935. * @param RTCx RTC Instance
  4936. * @retval State of bit (1 or 0).
  4937. */
  4938. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP4(RTC_TypeDef *RTCx)
  4939. {
  4940. UNUSED(RTCx);
  4941. return ((READ_BIT(TAMP->IER, TAMP_IER_TAMP4IE) == (TAMP_IER_TAMP4IE)) ? 1U : 0U);
  4942. }
  4943. /**
  4944. * @brief Check if tamper 5 interrupt is enabled or not.
  4945. * @rmtoll TAMP_IER TAMP1IE LL_RTC_IsEnabledIT_TAMP5
  4946. * @param RTCx RTC Instance
  4947. * @retval State of bit (1 or 0).
  4948. */
  4949. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP5(RTC_TypeDef *RTCx)
  4950. {
  4951. UNUSED(RTCx);
  4952. return ((READ_BIT(TAMP->IER, TAMP_IER_TAMP5IE) == (TAMP_IER_TAMP5IE)) ? 1U : 0U);
  4953. }
  4954. /**
  4955. * @brief Check if tamper 6 interrupt is enabled or not.
  4956. * @rmtoll TAMP_IER TAMP6IE LL_RTC_IsEnabledIT_TAMP6
  4957. * @param RTCx RTC Instance
  4958. * @retval State of bit (1 or 0).
  4959. */
  4960. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP6(RTC_TypeDef *RTCx)
  4961. {
  4962. UNUSED(RTCx);
  4963. return ((READ_BIT(TAMP->IER, TAMP_IER_TAMP6IE) == (TAMP_IER_TAMP6IE)) ? 1U : 0U);
  4964. }
  4965. /**
  4966. * @brief Check if tamper 7 interrupt is enabled or not.
  4967. * @rmtoll TAMP_IER TAMP1IE LL_RTC_IsEnabledIT_TAMP7
  4968. * @param RTCx RTC Instance
  4969. * @retval State of bit (1 or 0).
  4970. */
  4971. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP7(RTC_TypeDef *RTCx)
  4972. {
  4973. UNUSED(RTCx);
  4974. return ((READ_BIT(TAMP->IER, TAMP_IER_TAMP7IE) == (TAMP_IER_TAMP7IE)) ? 1U : 0U);
  4975. }
  4976. /**
  4977. * @brief Check if tamper 8 interrupt is enabled or not.
  4978. * @rmtoll TAMP_IER TAMP8IE LL_RTC_IsEnabledIT_TAMP8
  4979. * @param RTCx RTC Instance
  4980. * @retval State of bit (1 or 0).
  4981. */
  4982. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_TAMP8(RTC_TypeDef *RTCx)
  4983. {
  4984. UNUSED(RTCx);
  4985. return ((READ_BIT(TAMP->IER, TAMP_IER_TAMP8IE) == (TAMP_IER_TAMP8IE)) ? 1U : 0U);
  4986. }
  4987. #endif /* RTC_TAMP_NB */
  4988. #if defined (RTC_TAMP_INT_1_SUPPORT)
  4989. /**
  4990. * @brief Check if internal tamper 1 interrupt is enabled or not.
  4991. * @rmtoll TAMP_IER ITAMP1IE LL_RTC_IsEnabledIT_ITAMP1
  4992. * @param RTCx RTC Instance
  4993. * @retval State of bit (1 or 0).
  4994. */
  4995. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ITAMP1(RTC_TypeDef *RTCx)
  4996. {
  4997. UNUSED(RTCx);
  4998. return ((READ_BIT(TAMP->IER, TAMP_IER_ITAMP1IE) == (TAMP_IER_ITAMP1IE)) ? 1U : 0U);
  4999. }
  5000. #endif /* RTC_TAMP_INT_1_SUPPORT */
  5001. #if defined (RTC_TAMP_INT_2_SUPPORT)
  5002. /**
  5003. * @brief Check if internal tamper 2 interrupt is enabled or not.
  5004. * @rmtoll TAMP_IER ITAMP2IE LL_RTC_IsEnabledIT_ITAMP2
  5005. * @param RTCx RTC Instance
  5006. * @retval State of bit (1 or 0).
  5007. */
  5008. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ITAMP2(RTC_TypeDef *RTCx)
  5009. {
  5010. UNUSED(RTCx);
  5011. return ((READ_BIT(TAMP->IER, TAMP_IER_ITAMP2IE) == (TAMP_IER_ITAMP2IE)) ? 1U : 0U);
  5012. }
  5013. #endif /* RTC_TAMP_INT_2_SUPPORT */
  5014. /**
  5015. * @brief Check if internal tamper 3 interrupt is enabled or not.
  5016. * @rmtoll TAMP_IER ITAMP3IE LL_RTC_IsEnabledIT_ITAMP3
  5017. * @param RTCx RTC Instance
  5018. * @retval State of bit (1 or 0).
  5019. */
  5020. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ITAMP3(RTC_TypeDef *RTCx)
  5021. {
  5022. UNUSED(RTCx);
  5023. return ((READ_BIT(TAMP->IER, TAMP_IER_ITAMP3IE) == (TAMP_IER_ITAMP3IE)) ? 1U : 0U);
  5024. }
  5025. /**
  5026. * @brief Check if internal tamper 4 interrupt is enabled or not.
  5027. * @rmtoll TAMP_IER ITAMP4IE LL_RTC_IsEnabledIT_ITAMP4
  5028. * @param RTCx RTC Instance
  5029. * @retval State of bit (1 or 0).
  5030. */
  5031. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ITAMP4(RTC_TypeDef *RTCx)
  5032. {
  5033. UNUSED(RTCx);
  5034. return ((READ_BIT(TAMP->IER, TAMP_IER_ITAMP4IE) == (TAMP_IER_ITAMP4IE)) ? 1U : 0U);
  5035. }
  5036. /**
  5037. * @brief Check if internal tamper 5 interrupt is enabled or not.
  5038. * @rmtoll TAMP_IER ITAMP5IE LL_RTC_IsEnabledIT_ITAMP5
  5039. * @param RTCx RTC Instance
  5040. * @retval State of bit (1 or 0).
  5041. */
  5042. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ITAMP5(RTC_TypeDef *RTCx)
  5043. {
  5044. UNUSED(RTCx);
  5045. return ((READ_BIT(TAMP->IER, TAMP_IER_ITAMP5IE) == (TAMP_IER_ITAMP5IE)) ? 1U : 0U);
  5046. }
  5047. #if defined (RTC_TAMP_INT_6_SUPPORT)
  5048. /**
  5049. * @brief Check if internal tamper 6 interrupt is enabled or not.
  5050. * @rmtoll TAMP_IER ITAMP6IE LL_RTC_IsEnabledIT_ITAMP6
  5051. * @param RTCx RTC Instance
  5052. * @retval State of bit (1 or 0).
  5053. */
  5054. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ITAMP6(RTC_TypeDef *RTCx)
  5055. {
  5056. UNUSED(RTCx);
  5057. return ((READ_BIT(TAMP->IER, TAMP_IER_ITAMP6IE) == (TAMP_IER_ITAMP6IE)) ? 1U : 0U);
  5058. }
  5059. #endif /* RTC_TAMP_INT_6_SUPPORT */
  5060. #if defined (RTC_TAMP_INT_7_SUPPORT)
  5061. /**
  5062. * @brief Check if internal tamper 7 interrupt is enabled or not.
  5063. * @rmtoll TAMP_IER ITAMP7IE LL_RTC_IsEnabledIT_ITAMP7
  5064. * @param RTCx RTC Instance
  5065. * @retval State of bit (1 or 0).
  5066. */
  5067. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ITAMP7(RTC_TypeDef *RTCx)
  5068. {
  5069. UNUSED(RTCx);
  5070. return ((READ_BIT(TAMP->IER, TAMP_IER_ITAMP7IE) == (TAMP_IER_ITAMP7IE)) ? 1U : 0U);
  5071. }
  5072. #endif /* RTC_TAMP_INT_7_SUPPORT */
  5073. #if defined (RTC_TAMP_INT_8_SUPPORT)
  5074. /**
  5075. * @brief Check if internal tamper 7 interrupt is enabled or not.
  5076. * @rmtoll TAMP_IER ITAMP7IE LL_RTC_IsEnabledIT_ITAMP7
  5077. * @param RTCx RTC Instance
  5078. * @retval State of bit (1 or 0).
  5079. */
  5080. __STATIC_INLINE uint32_t LL_RTC_IsEnabledIT_ITAMP7(RTC_TypeDef *RTCx)
  5081. {
  5082. UNUSED(RTCx);
  5083. return ((READ_BIT(TAMP->IER, TAMP_IER_ITAMP7IE) == (TAMP_IER_ITAMP7IE)) ? 1U : 0U);
  5084. }
  5085. #endif /* RTC_TAMP_INT_8_SUPPORT */
  5086. /**
  5087. * @}
  5088. */
  5089. #if defined(USE_FULL_LL_DRIVER)
  5090. /** @defgroup RTC_LL_EF_Init Initialization and de-initialization functions
  5091. * @{
  5092. */
  5093. ErrorStatus LL_RTC_DeInit(RTC_TypeDef *RTCx);
  5094. ErrorStatus LL_RTC_Init(RTC_TypeDef *RTCx, LL_RTC_InitTypeDef *RTC_InitStruct);
  5095. void LL_RTC_StructInit(LL_RTC_InitTypeDef *RTC_InitStruct);
  5096. ErrorStatus LL_RTC_TIME_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_TimeTypeDef *RTC_TimeStruct);
  5097. void LL_RTC_TIME_StructInit(LL_RTC_TimeTypeDef *RTC_TimeStruct);
  5098. ErrorStatus LL_RTC_DATE_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_DateTypeDef *RTC_DateStruct);
  5099. void LL_RTC_DATE_StructInit(LL_RTC_DateTypeDef *RTC_DateStruct);
  5100. ErrorStatus LL_RTC_ALMA_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
  5101. ErrorStatus LL_RTC_ALMB_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
  5102. void LL_RTC_ALMA_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
  5103. void LL_RTC_ALMB_StructInit(LL_RTC_AlarmTypeDef *RTC_AlarmStruct);
  5104. ErrorStatus LL_RTC_EnterInitMode(RTC_TypeDef *RTCx);
  5105. ErrorStatus LL_RTC_ExitInitMode(RTC_TypeDef *RTCx);
  5106. ErrorStatus LL_RTC_WaitForSynchro(RTC_TypeDef *RTCx);
  5107. /**
  5108. * @}
  5109. */
  5110. #endif /* USE_FULL_LL_DRIVER */
  5111. /**
  5112. * @}
  5113. */
  5114. /**
  5115. * @}
  5116. */
  5117. #endif /* defined(RTC) */
  5118. /**
  5119. * @}
  5120. */
  5121. #ifdef __cplusplus
  5122. }
  5123. #endif
  5124. #endif /* STM32G4xx_LL_RTC_H */