stm32h5xx_ll_tim.h 295 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571
  1. /**
  2. ******************************************************************************
  3. * @file stm32h5xx_ll_tim.h
  4. * @author MCD Application Team
  5. * @brief Header file of TIM LL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2023 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 __STM32H5xx_LL_TIM_H
  20. #define __STM32H5xx_LL_TIM_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32h5xx.h"
  26. /** @addtogroup STM32H5xx_LL_Driver
  27. * @{
  28. */
  29. #if defined (TIM1) \
  30. || defined (TIM2) \
  31. || defined (TIM3) \
  32. || defined (TIM4) \
  33. || defined (TIM5) \
  34. || defined (TIM6) \
  35. || defined (TIM7) \
  36. || defined (TIM8) \
  37. || defined (TIM12) \
  38. || defined (TIM13) \
  39. || defined (TIM14) \
  40. || defined (TIM15) \
  41. || defined (TIM16) \
  42. || defined (TIM17)
  43. /** @defgroup TIM_LL TIM
  44. * @{
  45. */
  46. /* Private types -------------------------------------------------------------*/
  47. /* Private variables ---------------------------------------------------------*/
  48. /** @defgroup TIM_LL_Private_Variables TIM Private Variables
  49. * @{
  50. */
  51. static const uint8_t OFFSET_TAB_CCMRx[] =
  52. {
  53. 0x00U, /* 0: TIMx_CH1 */
  54. 0x00U, /* 1: TIMx_CH1N */
  55. 0x00U, /* 2: TIMx_CH2 */
  56. 0x00U, /* 3: TIMx_CH2N */
  57. 0x04U, /* 4: TIMx_CH3 */
  58. 0x04U, /* 5: TIMx_CH3N */
  59. 0x04U, /* 6: TIMx_CH4 */
  60. 0x04U, /* 7: TIMx_CH4N */
  61. 0x38U, /* 8: TIMx_CH5 */
  62. 0x38U /* 9: TIMx_CH6 */
  63. };
  64. static const uint8_t SHIFT_TAB_OCxx[] =
  65. {
  66. 0U, /* 0: OC1M, OC1FE, OC1PE */
  67. 0U, /* 1: - NA */
  68. 8U, /* 2: OC2M, OC2FE, OC2PE */
  69. 0U, /* 3: - NA */
  70. 0U, /* 4: OC3M, OC3FE, OC3PE */
  71. 0U, /* 5: - NA */
  72. 8U, /* 6: OC4M, OC4FE, OC4PE */
  73. 0U, /* 7: - NA */
  74. 0U, /* 8: OC5M, OC5FE, OC5PE */
  75. 8U /* 9: OC6M, OC6FE, OC6PE */
  76. };
  77. static const uint8_t SHIFT_TAB_ICxx[] =
  78. {
  79. 0U, /* 0: CC1S, IC1PSC, IC1F */
  80. 0U, /* 1: - NA */
  81. 8U, /* 2: CC2S, IC2PSC, IC2F */
  82. 0U, /* 3: - NA */
  83. 0U, /* 4: CC3S, IC3PSC, IC3F */
  84. 0U, /* 5: - NA */
  85. 8U, /* 6: CC4S, IC4PSC, IC4F */
  86. 0U, /* 7: - NA */
  87. 0U, /* 8: - NA */
  88. 0U /* 9: - NA */
  89. };
  90. static const uint8_t SHIFT_TAB_CCxP[] =
  91. {
  92. 0U, /* 0: CC1P */
  93. 2U, /* 1: CC1NP */
  94. 4U, /* 2: CC2P */
  95. 6U, /* 3: CC2NP */
  96. 8U, /* 4: CC3P */
  97. 10U, /* 5: CC3NP */
  98. 12U, /* 6: CC4P */
  99. 14U, /* 7: CC4NP */
  100. 16U, /* 8: CC5P */
  101. 20U /* 9: CC6P */
  102. };
  103. static const uint8_t SHIFT_TAB_OISx[] =
  104. {
  105. 0U, /* 0: OIS1 */
  106. 1U, /* 1: OIS1N */
  107. 2U, /* 2: OIS2 */
  108. 3U, /* 3: OIS2N */
  109. 4U, /* 4: OIS3 */
  110. 5U, /* 5: OIS3N */
  111. 6U, /* 6: OIS4 */
  112. 7U, /* 7: OIS4N */
  113. 8U, /* 8: OIS5 */
  114. 10U /* 9: OIS6 */
  115. };
  116. /**
  117. * @}
  118. */
  119. /* Private constants ---------------------------------------------------------*/
  120. /** @defgroup TIM_LL_Private_Constants TIM Private Constants
  121. * @{
  122. */
  123. /* Defines used for the bit position in the register and perform offsets */
  124. #define TIM_POSITION_BRK_SOURCE (POSITION_VAL(Source) & 0x1FUL)
  125. /* Generic bit definitions for TIMx_AF1 register */
  126. #define TIMx_AF1_BKINP TIM1_AF1_BKINP /*!< BRK BKIN input polarity */
  127. #define TIMx_AF1_ETRSEL TIM1_AF1_ETRSEL /*!< TIMx ETR source selection */
  128. /* Mask used to set the TDG[x:0] of the DTG bits of the TIMx_BDTR register */
  129. #define DT_DELAY_1 ((uint8_t)0x7F)
  130. #define DT_DELAY_2 ((uint8_t)0x3F)
  131. #define DT_DELAY_3 ((uint8_t)0x1F)
  132. #define DT_DELAY_4 ((uint8_t)0x1F)
  133. /* Mask used to set the DTG[7:5] bits of the DTG bits of the TIMx_BDTR register */
  134. #define DT_RANGE_1 ((uint8_t)0x00)
  135. #define DT_RANGE_2 ((uint8_t)0x80)
  136. #define DT_RANGE_3 ((uint8_t)0xC0)
  137. #define DT_RANGE_4 ((uint8_t)0xE0)
  138. /** Legacy definitions for compatibility purpose
  139. @cond 0
  140. */
  141. /**
  142. @endcond
  143. */
  144. #define OCREF_CLEAR_SELECT_POS (28U)
  145. #define OCREF_CLEAR_SELECT_MSK (0x1U << OCREF_CLEAR_SELECT_POS) /*!< 0x10000000 */
  146. /**
  147. * @}
  148. */
  149. /* Private macros ------------------------------------------------------------*/
  150. /** @defgroup TIM_LL_Private_Macros TIM Private Macros
  151. * @{
  152. */
  153. /** @brief Convert channel id into channel index.
  154. * @param __CHANNEL__ This parameter can be one of the following values:
  155. * @arg @ref LL_TIM_CHANNEL_CH1
  156. * @arg @ref LL_TIM_CHANNEL_CH1N
  157. * @arg @ref LL_TIM_CHANNEL_CH2
  158. * @arg @ref LL_TIM_CHANNEL_CH2N
  159. * @arg @ref LL_TIM_CHANNEL_CH3
  160. * @arg @ref LL_TIM_CHANNEL_CH3N
  161. * @arg @ref LL_TIM_CHANNEL_CH4
  162. * @arg @ref LL_TIM_CHANNEL_CH4N
  163. * @arg @ref LL_TIM_CHANNEL_CH5
  164. * @arg @ref LL_TIM_CHANNEL_CH6
  165. * @retval none
  166. */
  167. #define TIM_GET_CHANNEL_INDEX( __CHANNEL__) \
  168. (((__CHANNEL__) == LL_TIM_CHANNEL_CH1) ? 0U :\
  169. ((__CHANNEL__) == LL_TIM_CHANNEL_CH1N) ? 1U :\
  170. ((__CHANNEL__) == LL_TIM_CHANNEL_CH2) ? 2U :\
  171. ((__CHANNEL__) == LL_TIM_CHANNEL_CH2N) ? 3U :\
  172. ((__CHANNEL__) == LL_TIM_CHANNEL_CH3) ? 4U :\
  173. ((__CHANNEL__) == LL_TIM_CHANNEL_CH3N) ? 5U :\
  174. ((__CHANNEL__) == LL_TIM_CHANNEL_CH4) ? 6U :\
  175. ((__CHANNEL__) == LL_TIM_CHANNEL_CH4N) ? 7U :\
  176. ((__CHANNEL__) == LL_TIM_CHANNEL_CH5) ? 8U : 9U)
  177. /** @brief Calculate the deadtime sampling period(in ps).
  178. * @param __TIMCLK__ timer input clock frequency (in Hz).
  179. * @param __CKD__ This parameter can be one of the following values:
  180. * @arg @ref LL_TIM_CLOCKDIVISION_DIV1
  181. * @arg @ref LL_TIM_CLOCKDIVISION_DIV2
  182. * @arg @ref LL_TIM_CLOCKDIVISION_DIV4
  183. * @retval none
  184. */
  185. #define TIM_CALC_DTS(__TIMCLK__, __CKD__) \
  186. (((__CKD__) == LL_TIM_CLOCKDIVISION_DIV1) ? ((uint64_t)1000000000000U/(__TIMCLK__)) : \
  187. ((__CKD__) == LL_TIM_CLOCKDIVISION_DIV2) ? ((uint64_t)1000000000000U/((__TIMCLK__) >> 1U)) : \
  188. ((uint64_t)1000000000000U/((__TIMCLK__) >> 2U)))
  189. /**
  190. * @}
  191. */
  192. /* Exported types ------------------------------------------------------------*/
  193. #if defined(USE_FULL_LL_DRIVER)
  194. /** @defgroup TIM_LL_ES_INIT TIM Exported Init structure
  195. * @{
  196. */
  197. /**
  198. * @brief TIM Time Base configuration structure definition.
  199. */
  200. typedef struct
  201. {
  202. uint16_t Prescaler; /*!< Specifies the prescaler value used to divide the TIM clock.
  203. This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF.
  204. This feature can be modified afterwards using unitary function
  205. @ref LL_TIM_SetPrescaler().*/
  206. uint32_t CounterMode; /*!< Specifies the counter mode.
  207. This parameter can be a value of @ref TIM_LL_EC_COUNTERMODE.
  208. This feature can be modified afterwards using unitary function
  209. @ref LL_TIM_SetCounterMode().*/
  210. uint32_t Autoreload; /*!< Specifies the auto reload value to be loaded into the active
  211. Auto-Reload Register at the next update event.
  212. This parameter must be a number between Min_Data=0x0000 and Max_Data=0xFFFF.
  213. Some timer instances may support 32 bits counters. In that case this parameter must
  214. be a number between 0x0000 and 0xFFFFFFFF.
  215. This feature can be modified afterwards using unitary function
  216. @ref LL_TIM_SetAutoReload().*/
  217. uint32_t ClockDivision; /*!< Specifies the clock division.
  218. This parameter can be a value of @ref TIM_LL_EC_CLOCKDIVISION.
  219. This feature can be modified afterwards using unitary function
  220. @ref LL_TIM_SetClockDivision().*/
  221. uint32_t RepetitionCounter; /*!< Specifies the repetition counter value. Each time the RCR downcounter
  222. reaches zero, an update event is generated and counting restarts
  223. from the RCR value (N).
  224. This means in PWM mode that (N+1) corresponds to:
  225. - the number of PWM periods in edge-aligned mode
  226. - the number of half PWM period in center-aligned mode
  227. GP timers: this parameter must be a number between Min_Data = 0x00 and
  228. Max_Data = 0xFF.
  229. Advanced timers: this parameter must be a number between Min_Data = 0x0000 and
  230. Max_Data = 0xFFFF.
  231. This feature can be modified afterwards using unitary function
  232. @ref LL_TIM_SetRepetitionCounter().*/
  233. } LL_TIM_InitTypeDef;
  234. /**
  235. * @brief TIM Output Compare configuration structure definition.
  236. */
  237. typedef struct
  238. {
  239. uint32_t OCMode; /*!< Specifies the output mode.
  240. This parameter can be a value of @ref TIM_LL_EC_OCMODE.
  241. This feature can be modified afterwards using unitary function
  242. @ref LL_TIM_OC_SetMode().*/
  243. uint32_t OCState; /*!< Specifies the TIM Output Compare state.
  244. This parameter can be a value of @ref TIM_LL_EC_OCSTATE.
  245. This feature can be modified afterwards using unitary functions
  246. @ref LL_TIM_CC_EnableChannel() or @ref LL_TIM_CC_DisableChannel().*/
  247. uint32_t OCNState; /*!< Specifies the TIM complementary Output Compare state.
  248. This parameter can be a value of @ref TIM_LL_EC_OCSTATE.
  249. This feature can be modified afterwards using unitary functions
  250. @ref LL_TIM_CC_EnableChannel() or @ref LL_TIM_CC_DisableChannel().*/
  251. uint32_t CompareValue; /*!< Specifies the Compare value to be loaded into the Capture Compare Register.
  252. This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF.
  253. This feature can be modified afterwards using unitary function
  254. LL_TIM_OC_SetCompareCHx (x=1..6).*/
  255. uint32_t OCPolarity; /*!< Specifies the output polarity.
  256. This parameter can be a value of @ref TIM_LL_EC_OCPOLARITY.
  257. This feature can be modified afterwards using unitary function
  258. @ref LL_TIM_OC_SetPolarity().*/
  259. uint32_t OCNPolarity; /*!< Specifies the complementary output polarity.
  260. This parameter can be a value of @ref TIM_LL_EC_OCPOLARITY.
  261. This feature can be modified afterwards using unitary function
  262. @ref LL_TIM_OC_SetPolarity().*/
  263. uint32_t OCIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state.
  264. This parameter can be a value of @ref TIM_LL_EC_OCIDLESTATE.
  265. This feature can be modified afterwards using unitary function
  266. @ref LL_TIM_OC_SetIdleState().*/
  267. uint32_t OCNIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state.
  268. This parameter can be a value of @ref TIM_LL_EC_OCIDLESTATE.
  269. This feature can be modified afterwards using unitary function
  270. @ref LL_TIM_OC_SetIdleState().*/
  271. } LL_TIM_OC_InitTypeDef;
  272. /**
  273. * @brief TIM Input Capture configuration structure definition.
  274. */
  275. typedef struct
  276. {
  277. uint32_t ICPolarity; /*!< Specifies the active edge of the input signal.
  278. This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY.
  279. This feature can be modified afterwards using unitary function
  280. @ref LL_TIM_IC_SetPolarity().*/
  281. uint32_t ICActiveInput; /*!< Specifies the input.
  282. This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT.
  283. This feature can be modified afterwards using unitary function
  284. @ref LL_TIM_IC_SetActiveInput().*/
  285. uint32_t ICPrescaler; /*!< Specifies the Input Capture Prescaler.
  286. This parameter can be a value of @ref TIM_LL_EC_ICPSC.
  287. This feature can be modified afterwards using unitary function
  288. @ref LL_TIM_IC_SetPrescaler().*/
  289. uint32_t ICFilter; /*!< Specifies the input capture filter.
  290. This parameter can be a value of @ref TIM_LL_EC_IC_FILTER.
  291. This feature can be modified afterwards using unitary function
  292. @ref LL_TIM_IC_SetFilter().*/
  293. } LL_TIM_IC_InitTypeDef;
  294. /**
  295. * @brief TIM Encoder interface configuration structure definition.
  296. */
  297. typedef struct
  298. {
  299. uint32_t EncoderMode; /*!< Specifies the encoder resolution (x2 or x4).
  300. This parameter can be a value of @ref TIM_LL_EC_ENCODERMODE.
  301. This feature can be modified afterwards using unitary function
  302. @ref LL_TIM_SetEncoderMode().*/
  303. uint32_t IC1Polarity; /*!< Specifies the active edge of TI1 input.
  304. This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY.
  305. This feature can be modified afterwards using unitary function
  306. @ref LL_TIM_IC_SetPolarity().*/
  307. uint32_t IC1ActiveInput; /*!< Specifies the TI1 input source
  308. This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT.
  309. This feature can be modified afterwards using unitary function
  310. @ref LL_TIM_IC_SetActiveInput().*/
  311. uint32_t IC1Prescaler; /*!< Specifies the TI1 input prescaler value.
  312. This parameter can be a value of @ref TIM_LL_EC_ICPSC.
  313. This feature can be modified afterwards using unitary function
  314. @ref LL_TIM_IC_SetPrescaler().*/
  315. uint32_t IC1Filter; /*!< Specifies the TI1 input filter.
  316. This parameter can be a value of @ref TIM_LL_EC_IC_FILTER.
  317. This feature can be modified afterwards using unitary function
  318. @ref LL_TIM_IC_SetFilter().*/
  319. uint32_t IC2Polarity; /*!< Specifies the active edge of TI2 input.
  320. This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY.
  321. This feature can be modified afterwards using unitary function
  322. @ref LL_TIM_IC_SetPolarity().*/
  323. uint32_t IC2ActiveInput; /*!< Specifies the TI2 input source
  324. This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT.
  325. This feature can be modified afterwards using unitary function
  326. @ref LL_TIM_IC_SetActiveInput().*/
  327. uint32_t IC2Prescaler; /*!< Specifies the TI2 input prescaler value.
  328. This parameter can be a value of @ref TIM_LL_EC_ICPSC.
  329. This feature can be modified afterwards using unitary function
  330. @ref LL_TIM_IC_SetPrescaler().*/
  331. uint32_t IC2Filter; /*!< Specifies the TI2 input filter.
  332. This parameter can be a value of @ref TIM_LL_EC_IC_FILTER.
  333. This feature can be modified afterwards using unitary function
  334. @ref LL_TIM_IC_SetFilter().*/
  335. } LL_TIM_ENCODER_InitTypeDef;
  336. /**
  337. * @brief TIM Hall sensor interface configuration structure definition.
  338. */
  339. typedef struct
  340. {
  341. uint32_t IC1Polarity; /*!< Specifies the active edge of TI1 input.
  342. This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY.
  343. This feature can be modified afterwards using unitary function
  344. @ref LL_TIM_IC_SetPolarity().*/
  345. uint32_t IC1Prescaler; /*!< Specifies the TI1 input prescaler value.
  346. Prescaler must be set to get a maximum counter period longer than the
  347. time interval between 2 consecutive changes on the Hall inputs.
  348. This parameter can be a value of @ref TIM_LL_EC_ICPSC.
  349. This feature can be modified afterwards using unitary function
  350. @ref LL_TIM_IC_SetPrescaler().*/
  351. uint32_t IC1Filter; /*!< Specifies the TI1 input filter.
  352. This parameter can be a value of
  353. @ref TIM_LL_EC_IC_FILTER.
  354. This feature can be modified afterwards using unitary function
  355. @ref LL_TIM_IC_SetFilter().*/
  356. uint32_t CommutationDelay; /*!< Specifies the compare value to be loaded into the Capture Compare Register.
  357. A positive pulse (TRGO event) is generated with a programmable delay every time
  358. a change occurs on the Hall inputs.
  359. This parameter can be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF.
  360. This feature can be modified afterwards using unitary function
  361. @ref LL_TIM_OC_SetCompareCH2().*/
  362. } LL_TIM_HALLSENSOR_InitTypeDef;
  363. /**
  364. * @brief BDTR (Break and Dead Time) structure definition
  365. */
  366. typedef struct
  367. {
  368. uint32_t OSSRState; /*!< Specifies the Off-State selection used in Run mode.
  369. This parameter can be a value of @ref TIM_LL_EC_OSSR
  370. This feature can be modified afterwards using unitary function
  371. @ref LL_TIM_SetOffStates()
  372. @note This bit-field cannot be modified as long as LOCK level 2 has been
  373. programmed. */
  374. uint32_t OSSIState; /*!< Specifies the Off-State used in Idle state.
  375. This parameter can be a value of @ref TIM_LL_EC_OSSI
  376. This feature can be modified afterwards using unitary function
  377. @ref LL_TIM_SetOffStates()
  378. @note This bit-field cannot be modified as long as LOCK level 2 has been
  379. programmed. */
  380. uint32_t LockLevel; /*!< Specifies the LOCK level parameters.
  381. This parameter can be a value of @ref TIM_LL_EC_LOCKLEVEL
  382. @note The LOCK bits can be written only once after the reset. Once the TIMx_BDTR
  383. register has been written, their content is frozen until the next reset.*/
  384. uint8_t DeadTime; /*!< Specifies the delay time between the switching-off and the
  385. switching-on of the outputs.
  386. This parameter can be a number between Min_Data = 0x00 and Max_Data = 0xFF.
  387. This feature can be modified afterwards using unitary function
  388. @ref LL_TIM_OC_SetDeadTime()
  389. @note This bit-field can not be modified as long as LOCK level 1, 2 or 3 has been
  390. programmed. */
  391. uint16_t BreakState; /*!< Specifies whether the TIM Break input is enabled or not.
  392. This parameter can be a value of @ref TIM_LL_EC_BREAK_ENABLE
  393. This feature can be modified afterwards using unitary functions
  394. @ref LL_TIM_EnableBRK() or @ref LL_TIM_DisableBRK()
  395. @note This bit-field can not be modified as long as LOCK level 1 has been
  396. programmed. */
  397. uint32_t BreakPolarity; /*!< Specifies the TIM Break Input pin polarity.
  398. This parameter can be a value of @ref TIM_LL_EC_BREAK_POLARITY
  399. This feature can be modified afterwards using unitary function
  400. @ref LL_TIM_ConfigBRK()
  401. @note This bit-field can not be modified as long as LOCK level 1 has been
  402. programmed. */
  403. uint32_t BreakFilter; /*!< Specifies the TIM Break Filter.
  404. This parameter can be a value of @ref TIM_LL_EC_BREAK_FILTER
  405. This feature can be modified afterwards using unitary function
  406. @ref LL_TIM_ConfigBRK()
  407. @note This bit-field can not be modified as long as LOCK level 1 has been
  408. programmed. */
  409. uint32_t BreakAFMode; /*!< Specifies the alternate function mode of the break input.
  410. This parameter can be a value of @ref TIM_LL_EC_BREAK_AFMODE
  411. This feature can be modified afterwards using unitary functions
  412. @ref LL_TIM_ConfigBRK()
  413. @note Bidirectional break input is only supported by advanced timers instances.
  414. @note This bit-field can not be modified as long as LOCK level 1 has been
  415. programmed. */
  416. uint32_t Break2State; /*!< Specifies whether the TIM Break2 input is enabled or not.
  417. This parameter can be a value of @ref TIM_LL_EC_BREAK2_ENABLE
  418. This feature can be modified afterwards using unitary functions
  419. @ref LL_TIM_EnableBRK2() or @ref LL_TIM_DisableBRK2()
  420. @note This bit-field can not be modified as long as LOCK level 1 has been
  421. programmed. */
  422. uint32_t Break2Polarity; /*!< Specifies the TIM Break2 Input pin polarity.
  423. This parameter can be a value of @ref TIM_LL_EC_BREAK2_POLARITY
  424. This feature can be modified afterwards using unitary function
  425. @ref LL_TIM_ConfigBRK2()
  426. @note This bit-field can not be modified as long as LOCK level 1 has been
  427. programmed. */
  428. uint32_t Break2Filter; /*!< Specifies the TIM Break2 Filter.
  429. This parameter can be a value of @ref TIM_LL_EC_BREAK2_FILTER
  430. This feature can be modified afterwards using unitary function
  431. @ref LL_TIM_ConfigBRK2()
  432. @note This bit-field can not be modified as long as LOCK level 1 has been
  433. programmed. */
  434. uint32_t Break2AFMode; /*!< Specifies the alternate function mode of the break2 input.
  435. This parameter can be a value of @ref TIM_LL_EC_BREAK2_AFMODE
  436. This feature can be modified afterwards using unitary functions
  437. @ref LL_TIM_ConfigBRK2()
  438. @note Bidirectional break input is only supported by advanced timers instances.
  439. @note This bit-field can not be modified as long as LOCK level 1 has been
  440. programmed. */
  441. uint32_t AutomaticOutput; /*!< Specifies whether the TIM Automatic Output feature is enabled or not.
  442. This parameter can be a value of @ref TIM_LL_EC_AUTOMATICOUTPUT_ENABLE
  443. This feature can be modified afterwards using unitary functions
  444. @ref LL_TIM_EnableAutomaticOutput() or @ref LL_TIM_DisableAutomaticOutput()
  445. @note This bit-field can not be modified as long as LOCK level 1 has been
  446. programmed. */
  447. } LL_TIM_BDTR_InitTypeDef;
  448. /**
  449. * @}
  450. */
  451. #endif /* USE_FULL_LL_DRIVER */
  452. /* Exported constants --------------------------------------------------------*/
  453. /** @defgroup TIM_LL_Exported_Constants TIM Exported Constants
  454. * @{
  455. */
  456. /** @defgroup TIM_LL_EC_GET_FLAG Get Flags Defines
  457. * @brief Flags defines which can be used with LL_TIM_ReadReg function.
  458. * @{
  459. */
  460. #define LL_TIM_SR_UIF TIM_SR_UIF /*!< Update interrupt flag */
  461. #define LL_TIM_SR_CC1IF TIM_SR_CC1IF /*!< Capture/compare 1 interrupt flag */
  462. #define LL_TIM_SR_CC2IF TIM_SR_CC2IF /*!< Capture/compare 2 interrupt flag */
  463. #define LL_TIM_SR_CC3IF TIM_SR_CC3IF /*!< Capture/compare 3 interrupt flag */
  464. #define LL_TIM_SR_CC4IF TIM_SR_CC4IF /*!< Capture/compare 4 interrupt flag */
  465. #define LL_TIM_SR_CC5IF TIM_SR_CC5IF /*!< Capture/compare 5 interrupt flag */
  466. #define LL_TIM_SR_CC6IF TIM_SR_CC6IF /*!< Capture/compare 6 interrupt flag */
  467. #define LL_TIM_SR_COMIF TIM_SR_COMIF /*!< COM interrupt flag */
  468. #define LL_TIM_SR_TIF TIM_SR_TIF /*!< Trigger interrupt flag */
  469. #define LL_TIM_SR_BIF TIM_SR_BIF /*!< Break interrupt flag */
  470. #define LL_TIM_SR_B2IF TIM_SR_B2IF /*!< Second break interrupt flag */
  471. #define LL_TIM_SR_CC1OF TIM_SR_CC1OF /*!< Capture/Compare 1 overcapture flag */
  472. #define LL_TIM_SR_CC2OF TIM_SR_CC2OF /*!< Capture/Compare 2 overcapture flag */
  473. #define LL_TIM_SR_CC3OF TIM_SR_CC3OF /*!< Capture/Compare 3 overcapture flag */
  474. #define LL_TIM_SR_CC4OF TIM_SR_CC4OF /*!< Capture/Compare 4 overcapture flag */
  475. #define LL_TIM_SR_SBIF TIM_SR_SBIF /*!< System Break interrupt flag */
  476. #define LL_TIM_SR_IDXF TIM_SR_IDXF /*!< Index interrupt flag */
  477. #define LL_TIM_SR_DIRF TIM_SR_DIRF /*!< Direction Change interrupt flag */
  478. #define LL_TIM_SR_IERRF TIM_SR_IERRF /*!< Index Error flag */
  479. #define LL_TIM_SR_TERRF TIM_SR_TERRF /*!< Transition Error flag */
  480. /**
  481. * @}
  482. */
  483. #if defined(USE_FULL_LL_DRIVER)
  484. /** @defgroup TIM_LL_EC_BREAK_ENABLE Break Enable
  485. * @{
  486. */
  487. #define LL_TIM_BREAK_DISABLE 0x00000000U /*!< Break function disabled */
  488. #define LL_TIM_BREAK_ENABLE TIM_BDTR_BKE /*!< Break function enabled */
  489. /**
  490. * @}
  491. */
  492. /** @defgroup TIM_LL_EC_BREAK2_ENABLE Break2 Enable
  493. * @{
  494. */
  495. #define LL_TIM_BREAK2_DISABLE 0x00000000U /*!< Break2 function disabled */
  496. #define LL_TIM_BREAK2_ENABLE TIM_BDTR_BK2E /*!< Break2 function enabled */
  497. /**
  498. * @}
  499. */
  500. /** @defgroup TIM_LL_EC_AUTOMATICOUTPUT_ENABLE Automatic output enable
  501. * @{
  502. */
  503. #define LL_TIM_AUTOMATICOUTPUT_DISABLE 0x00000000U /*!< MOE can be set only by software */
  504. #define LL_TIM_AUTOMATICOUTPUT_ENABLE TIM_BDTR_AOE /*!< MOE can be set by software or automatically at the next update event */
  505. /**
  506. * @}
  507. */
  508. #endif /* USE_FULL_LL_DRIVER */
  509. /** @defgroup TIM_LL_EC_IT IT Defines
  510. * @brief IT defines which can be used with LL_TIM_ReadReg and LL_TIM_WriteReg functions.
  511. * @{
  512. */
  513. #define LL_TIM_DIER_UIE TIM_DIER_UIE /*!< Update interrupt enable */
  514. #define LL_TIM_DIER_CC1IE TIM_DIER_CC1IE /*!< Capture/compare 1 interrupt enable */
  515. #define LL_TIM_DIER_CC2IE TIM_DIER_CC2IE /*!< Capture/compare 2 interrupt enable */
  516. #define LL_TIM_DIER_CC3IE TIM_DIER_CC3IE /*!< Capture/compare 3 interrupt enable */
  517. #define LL_TIM_DIER_CC4IE TIM_DIER_CC4IE /*!< Capture/compare 4 interrupt enable */
  518. #define LL_TIM_DIER_COMIE TIM_DIER_COMIE /*!< COM interrupt enable */
  519. #define LL_TIM_DIER_TIE TIM_DIER_TIE /*!< Trigger interrupt enable */
  520. #define LL_TIM_DIER_BIE TIM_DIER_BIE /*!< Break interrupt enable */
  521. #define LL_TIM_DIER_IDXIE TIM_DIER_IDXIE /*!< Index interrupt enable */
  522. #define LL_TIM_DIER_DIRIE TIM_DIER_DIRIE /*!< Direction Change interrupt enable */
  523. #define LL_TIM_DIER_IERRIE TIM_DIER_IERRIE /*!< Index Error interrupt enable */
  524. #define LL_TIM_DIER_TERRIE TIM_DIER_TERRIE /*!< Transition Error interrupt enable */
  525. /**
  526. * @}
  527. */
  528. /** @defgroup TIM_LL_EC_UPDATESOURCE Update Source
  529. * @{
  530. */
  531. #define LL_TIM_UPDATESOURCE_REGULAR 0x00000000U /*!< Counter overflow/underflow, Setting the UG bit or Update generation through the slave mode controller generates an update request */
  532. #define LL_TIM_UPDATESOURCE_COUNTER TIM_CR1_URS /*!< Only counter overflow/underflow generates an update request */
  533. /**
  534. * @}
  535. */
  536. /** @defgroup TIM_LL_EC_ONEPULSEMODE One Pulse Mode
  537. * @{
  538. */
  539. #define LL_TIM_ONEPULSEMODE_SINGLE TIM_CR1_OPM /*!< Counter stops counting at the next update event */
  540. #define LL_TIM_ONEPULSEMODE_REPETITIVE 0x00000000U /*!< Counter is not stopped at update event */
  541. /**
  542. * @}
  543. */
  544. /** @defgroup TIM_LL_EC_COUNTERMODE Counter Mode
  545. * @{
  546. */
  547. #define LL_TIM_COUNTERMODE_UP 0x00000000U /*!< Counter used as upcounter */
  548. #define LL_TIM_COUNTERMODE_DOWN TIM_CR1_DIR /*!< Counter used as downcounter */
  549. #define LL_TIM_COUNTERMODE_CENTER_DOWN TIM_CR1_CMS_0 /*!< The counter counts up and down alternatively. Output compare interrupt flags of output channels are set only when the counter is counting down. */
  550. #define LL_TIM_COUNTERMODE_CENTER_UP TIM_CR1_CMS_1 /*!< The counter counts up and down alternatively. Output compare interrupt flags of output channels are set only when the counter is counting up */
  551. #define LL_TIM_COUNTERMODE_CENTER_UP_DOWN TIM_CR1_CMS /*!< The counter counts up and down alternatively. Output compare interrupt flags of output channels are set only when the counter is counting up or down. */
  552. /**
  553. * @}
  554. */
  555. /** @defgroup TIM_LL_EC_CLOCKDIVISION Clock Division
  556. * @{
  557. */
  558. #define LL_TIM_CLOCKDIVISION_DIV1 0x00000000U /*!< tDTS=tCK_INT */
  559. #define LL_TIM_CLOCKDIVISION_DIV2 TIM_CR1_CKD_0 /*!< tDTS=2*tCK_INT */
  560. #define LL_TIM_CLOCKDIVISION_DIV4 TIM_CR1_CKD_1 /*!< tDTS=4*tCK_INT */
  561. /**
  562. * @}
  563. */
  564. /** @defgroup TIM_LL_EC_COUNTERDIRECTION Counter Direction
  565. * @{
  566. */
  567. #define LL_TIM_COUNTERDIRECTION_UP 0x00000000U /*!< Timer counter counts up */
  568. #define LL_TIM_COUNTERDIRECTION_DOWN TIM_CR1_DIR /*!< Timer counter counts down */
  569. /**
  570. * @}
  571. */
  572. /** @defgroup TIM_LL_EC_CCUPDATESOURCE Capture Compare Update Source
  573. * @{
  574. */
  575. #define LL_TIM_CCUPDATESOURCE_COMG_ONLY 0x00000000U /*!< Capture/compare control bits are updated by setting the COMG bit only */
  576. #define LL_TIM_CCUPDATESOURCE_COMG_AND_TRGI TIM_CR2_CCUS /*!< Capture/compare control bits are updated by setting the COMG bit or when a rising edge occurs on trigger input (TRGI) */
  577. /**
  578. * @}
  579. */
  580. /** @defgroup TIM_LL_EC_CCDMAREQUEST Capture Compare DMA Request
  581. * @{
  582. */
  583. #define LL_TIM_CCDMAREQUEST_CC 0x00000000U /*!< CCx DMA request sent when CCx event occurs */
  584. #define LL_TIM_CCDMAREQUEST_UPDATE TIM_CR2_CCDS /*!< CCx DMA requests sent when update event occurs */
  585. /**
  586. * @}
  587. */
  588. /** @defgroup TIM_LL_EC_LOCKLEVEL Lock Level
  589. * @{
  590. */
  591. #define LL_TIM_LOCKLEVEL_OFF 0x00000000U /*!< LOCK OFF - No bit is write protected */
  592. #define LL_TIM_LOCKLEVEL_1 TIM_BDTR_LOCK_0 /*!< LOCK Level 1 */
  593. #define LL_TIM_LOCKLEVEL_2 TIM_BDTR_LOCK_1 /*!< LOCK Level 2 */
  594. #define LL_TIM_LOCKLEVEL_3 TIM_BDTR_LOCK /*!< LOCK Level 3 */
  595. /**
  596. * @}
  597. */
  598. /** @defgroup TIM_LL_EC_CHANNEL Channel
  599. * @{
  600. */
  601. #define LL_TIM_CHANNEL_CH1 TIM_CCER_CC1E /*!< Timer input/output channel 1 */
  602. #define LL_TIM_CHANNEL_CH1N TIM_CCER_CC1NE /*!< Timer complementary output channel 1 */
  603. #define LL_TIM_CHANNEL_CH2 TIM_CCER_CC2E /*!< Timer input/output channel 2 */
  604. #define LL_TIM_CHANNEL_CH2N TIM_CCER_CC2NE /*!< Timer complementary output channel 2 */
  605. #define LL_TIM_CHANNEL_CH3 TIM_CCER_CC3E /*!< Timer input/output channel 3 */
  606. #define LL_TIM_CHANNEL_CH3N TIM_CCER_CC3NE /*!< Timer complementary output channel 3 */
  607. #define LL_TIM_CHANNEL_CH4 TIM_CCER_CC4E /*!< Timer input/output channel 4 */
  608. #define LL_TIM_CHANNEL_CH4N TIM_CCER_CC4NE /*!< Timer complementary output channel 4 */
  609. #define LL_TIM_CHANNEL_CH5 TIM_CCER_CC5E /*!< Timer output channel 5 */
  610. #define LL_TIM_CHANNEL_CH6 TIM_CCER_CC6E /*!< Timer output channel 6 */
  611. /**
  612. * @}
  613. */
  614. #if defined(USE_FULL_LL_DRIVER)
  615. /** @defgroup TIM_LL_EC_OCSTATE Output Configuration State
  616. * @{
  617. */
  618. #define LL_TIM_OCSTATE_DISABLE 0x00000000U /*!< OCx is not active */
  619. #define LL_TIM_OCSTATE_ENABLE TIM_CCER_CC1E /*!< OCx signal is output on the corresponding output pin */
  620. /**
  621. * @}
  622. */
  623. #endif /* USE_FULL_LL_DRIVER */
  624. /** Legacy definitions for compatibility purpose
  625. @cond 0
  626. */
  627. #define LL_TIM_OCMODE_ASSYMETRIC_PWM1 LL_TIM_OCMODE_ASYMMETRIC_PWM1
  628. #define LL_TIM_OCMODE_ASSYMETRIC_PWM2 LL_TIM_OCMODE_ASYMMETRIC_PWM2
  629. /**
  630. @endcond
  631. */
  632. /** @defgroup TIM_LL_EC_OCMODE Output Configuration Mode
  633. * @{
  634. */
  635. #define LL_TIM_OCMODE_FROZEN 0x00000000U /*!<The comparison between the output compare register TIMx_CCRy and the counter TIMx_CNT has no effect on the output channel level */
  636. #define LL_TIM_OCMODE_ACTIVE TIM_CCMR1_OC1M_0 /*!<OCyREF is forced high on compare match*/
  637. #define LL_TIM_OCMODE_INACTIVE TIM_CCMR1_OC1M_1 /*!<OCyREF is forced low on compare match*/
  638. #define LL_TIM_OCMODE_TOGGLE (TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0) /*!<OCyREF toggles on compare match*/
  639. #define LL_TIM_OCMODE_FORCED_INACTIVE TIM_CCMR1_OC1M_2 /*!<OCyREF is forced low*/
  640. #define LL_TIM_OCMODE_FORCED_ACTIVE (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_0) /*!<OCyREF is forced high*/
  641. #define LL_TIM_OCMODE_PWM1 (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1) /*!<In upcounting, channel y is active as long as TIMx_CNT<TIMx_CCRy else inactive. In downcounting, channel y is inactive as long as TIMx_CNT>TIMx_CCRy else active.*/
  642. #define LL_TIM_OCMODE_PWM2 (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0) /*!<In upcounting, channel y is inactive as long as TIMx_CNT<TIMx_CCRy else active. In downcounting, channel y is active as long as TIMx_CNT>TIMx_CCRy else inactive*/
  643. #define LL_TIM_OCMODE_RETRIG_OPM1 TIM_CCMR1_OC1M_3 /*!<Retrigerrable OPM mode 1*/
  644. #define LL_TIM_OCMODE_RETRIG_OPM2 (TIM_CCMR1_OC1M_3 | TIM_CCMR1_OC1M_0) /*!<Retrigerrable OPM mode 2*/
  645. #define LL_TIM_OCMODE_COMBINED_PWM1 (TIM_CCMR1_OC1M_3 | TIM_CCMR1_OC1M_2) /*!<Combined PWM mode 1*/
  646. #define LL_TIM_OCMODE_COMBINED_PWM2 (TIM_CCMR1_OC1M_3 | TIM_CCMR1_OC1M_0 | TIM_CCMR1_OC1M_2) /*!<Combined PWM mode 2*/
  647. #define LL_TIM_OCMODE_ASYMMETRIC_PWM1 (TIM_CCMR1_OC1M_3 | TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2) /*!<Asymmetric PWM mode 1*/
  648. #define LL_TIM_OCMODE_ASYMMETRIC_PWM2 (TIM_CCMR1_OC1M_3 | TIM_CCMR1_OC1M) /*!<Asymmetric PWM mode 2*/
  649. #define LL_TIM_OCMODE_PULSE_ON_COMPARE (TIM_CCMR2_OC3M_3 | TIM_CCMR2_OC3M_1) /*!<Pulse on Compare mode */
  650. #define LL_TIM_OCMODE_DIRECTION_OUTPUT (TIM_CCMR2_OC3M_3 | TIM_CCMR2_OC3M_1 | TIM_CCMR2_OC3M_0) /*!<Direction output mode */
  651. /**
  652. * @}
  653. */
  654. /** @defgroup TIM_LL_EC_OCPOLARITY Output Configuration Polarity
  655. * @{
  656. */
  657. #define LL_TIM_OCPOLARITY_HIGH 0x00000000U /*!< OCxactive high*/
  658. #define LL_TIM_OCPOLARITY_LOW TIM_CCER_CC1P /*!< OCxactive low*/
  659. /**
  660. * @}
  661. */
  662. /** @defgroup TIM_LL_EC_OCIDLESTATE Output Configuration Idle State
  663. * @{
  664. */
  665. #define LL_TIM_OCIDLESTATE_LOW 0x00000000U /*!<OCx=0 (after a dead-time if OC is implemented) when MOE=0*/
  666. #define LL_TIM_OCIDLESTATE_HIGH TIM_CR2_OIS1 /*!<OCx=1 (after a dead-time if OC is implemented) when MOE=0*/
  667. /**
  668. * @}
  669. */
  670. /** @defgroup TIM_LL_EC_GROUPCH5 GROUPCH5
  671. * @{
  672. */
  673. #define LL_TIM_GROUPCH5_NONE 0x00000000U /*!< No effect of OC5REF on OC1REFC, OC2REFC and OC3REFC */
  674. #define LL_TIM_GROUPCH5_OC1REFC TIM_CCR5_GC5C1 /*!< OC1REFC is the logical AND of OC1REFC and OC5REF */
  675. #define LL_TIM_GROUPCH5_OC2REFC TIM_CCR5_GC5C2 /*!< OC2REFC is the logical AND of OC2REFC and OC5REF */
  676. #define LL_TIM_GROUPCH5_OC3REFC TIM_CCR5_GC5C3 /*!< OC3REFC is the logical AND of OC3REFC and OC5REF */
  677. /**
  678. * @}
  679. */
  680. /** @defgroup TIM_LL_EC_ACTIVEINPUT Active Input Selection
  681. * @{
  682. */
  683. #define LL_TIM_ACTIVEINPUT_DIRECTTI (TIM_CCMR1_CC1S_0 << 16U) /*!< ICx is mapped on TIx */
  684. #define LL_TIM_ACTIVEINPUT_INDIRECTTI (TIM_CCMR1_CC1S_1 << 16U) /*!< ICx is mapped on TIy */
  685. #define LL_TIM_ACTIVEINPUT_TRC (TIM_CCMR1_CC1S << 16U) /*!< ICx is mapped on TRC */
  686. /**
  687. * @}
  688. */
  689. /** @defgroup TIM_LL_EC_ICPSC Input Configuration Prescaler
  690. * @{
  691. */
  692. #define LL_TIM_ICPSC_DIV1 0x00000000U /*!< No prescaler, capture is done each time an edge is detected on the capture input */
  693. #define LL_TIM_ICPSC_DIV2 (TIM_CCMR1_IC1PSC_0 << 16U) /*!< Capture is done once every 2 events */
  694. #define LL_TIM_ICPSC_DIV4 (TIM_CCMR1_IC1PSC_1 << 16U) /*!< Capture is done once every 4 events */
  695. #define LL_TIM_ICPSC_DIV8 (TIM_CCMR1_IC1PSC << 16U) /*!< Capture is done once every 8 events */
  696. /**
  697. * @}
  698. */
  699. /** @defgroup TIM_LL_EC_IC_FILTER Input Configuration Filter
  700. * @{
  701. */
  702. #define LL_TIM_IC_FILTER_FDIV1 0x00000000U /*!< No filter, sampling is done at fDTS */
  703. #define LL_TIM_IC_FILTER_FDIV1_N2 (TIM_CCMR1_IC1F_0 << 16U) /*!< fSAMPLING=fCK_INT, N=2 */
  704. #define LL_TIM_IC_FILTER_FDIV1_N4 (TIM_CCMR1_IC1F_1 << 16U) /*!< fSAMPLING=fCK_INT, N=4 */
  705. #define LL_TIM_IC_FILTER_FDIV1_N8 ((TIM_CCMR1_IC1F_1 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fCK_INT, N=8 */
  706. #define LL_TIM_IC_FILTER_FDIV2_N6 (TIM_CCMR1_IC1F_2 << 16U) /*!< fSAMPLING=fDTS/2, N=6 */
  707. #define LL_TIM_IC_FILTER_FDIV2_N8 ((TIM_CCMR1_IC1F_2 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fDTS/2, N=8 */
  708. #define LL_TIM_IC_FILTER_FDIV4_N6 ((TIM_CCMR1_IC1F_2 | TIM_CCMR1_IC1F_1) << 16U) /*!< fSAMPLING=fDTS/4, N=6 */
  709. #define LL_TIM_IC_FILTER_FDIV4_N8 ((TIM_CCMR1_IC1F_2 | TIM_CCMR1_IC1F_1 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fDTS/4, N=8 */
  710. #define LL_TIM_IC_FILTER_FDIV8_N6 (TIM_CCMR1_IC1F_3 << 16U) /*!< fSAMPLING=fDTS/8, N=6 */
  711. #define LL_TIM_IC_FILTER_FDIV8_N8 ((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fDTS/8, N=8 */
  712. #define LL_TIM_IC_FILTER_FDIV16_N5 ((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_1) << 16U) /*!< fSAMPLING=fDTS/16, N=5 */
  713. #define LL_TIM_IC_FILTER_FDIV16_N6 ((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_1 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fDTS/16, N=6 */
  714. #define LL_TIM_IC_FILTER_FDIV16_N8 ((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_2) << 16U) /*!< fSAMPLING=fDTS/16, N=8 */
  715. #define LL_TIM_IC_FILTER_FDIV32_N5 ((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_2 | TIM_CCMR1_IC1F_0) << 16U) /*!< fSAMPLING=fDTS/32, N=5 */
  716. #define LL_TIM_IC_FILTER_FDIV32_N6 ((TIM_CCMR1_IC1F_3 | TIM_CCMR1_IC1F_2 | TIM_CCMR1_IC1F_1) << 16U) /*!< fSAMPLING=fDTS/32, N=6 */
  717. #define LL_TIM_IC_FILTER_FDIV32_N8 (TIM_CCMR1_IC1F << 16U) /*!< fSAMPLING=fDTS/32, N=8 */
  718. /**
  719. * @}
  720. */
  721. /** @defgroup TIM_LL_EC_IC_POLARITY Input Configuration Polarity
  722. * @{
  723. */
  724. #define LL_TIM_IC_POLARITY_RISING 0x00000000U /*!< The circuit is sensitive to TIxFP1 rising edge, TIxFP1 is not inverted */
  725. #define LL_TIM_IC_POLARITY_FALLING TIM_CCER_CC1P /*!< The circuit is sensitive to TIxFP1 falling edge, TIxFP1 is inverted */
  726. #define LL_TIM_IC_POLARITY_BOTHEDGE (TIM_CCER_CC1P | TIM_CCER_CC1NP) /*!< The circuit is sensitive to both TIxFP1 rising and falling edges, TIxFP1 is not inverted */
  727. /**
  728. * @}
  729. */
  730. /** @defgroup TIM_LL_EC_CLOCKSOURCE Clock Source
  731. * @{
  732. */
  733. #define LL_TIM_CLOCKSOURCE_INTERNAL 0x00000000U /*!< The timer is clocked by the internal clock provided from the RCC */
  734. #define LL_TIM_CLOCKSOURCE_EXT_MODE1 (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_1 | TIM_SMCR_SMS_0) /*!< Counter counts at each rising or falling edge on a selected input*/
  735. #define LL_TIM_CLOCKSOURCE_EXT_MODE2 TIM_SMCR_ECE /*!< Counter counts at each rising or falling edge on the external trigger input ETR */
  736. /**
  737. * @}
  738. */
  739. /** @defgroup TIM_LL_EC_ENCODERMODE Encoder Mode
  740. * @{
  741. */
  742. #define LL_TIM_ENCODERMODE_X2_TI1 TIM_SMCR_SMS_0 /*!< Quadrature encoder mode 1, x2 mode - Counter counts up/down on TI1FP1 edge depending on TI2FP2 level */
  743. #define LL_TIM_ENCODERMODE_X2_TI2 TIM_SMCR_SMS_1 /*!< Quadrature encoder mode 2, x2 mode - Counter counts up/down on TI2FP2 edge depending on TI1FP1 level */
  744. #define LL_TIM_ENCODERMODE_X4_TI12 (TIM_SMCR_SMS_1 | TIM_SMCR_SMS_0) /*!< Quadrature encoder mode 3, x4 mode - Counter counts up/down on both TI1FP1 and TI2FP2 edges depending on the level of the other input */
  745. #define LL_TIM_ENCODERMODE_CLOCKPLUSDIRECTION_X2 (TIM_SMCR_SMS_3 | TIM_SMCR_SMS_1) /*!< Encoder mode: Clock plus direction - x2 mode */
  746. #define LL_TIM_ENCODERMODE_CLOCKPLUSDIRECTION_X1 (TIM_SMCR_SMS_3 | TIM_SMCR_SMS_1 | TIM_SMCR_SMS_0) /*!< Encoder mode: Clock plus direction, x1 mode, TI2FP2 edge sensitivity is set by CC2P */
  747. #define LL_TIM_ENCODERMODE_DIRECTIONALCLOCK_X2 (TIM_SMCR_SMS_3 | TIM_SMCR_SMS_2) /*!< Encoder mode: Directional Clock, x2 mode */
  748. #define LL_TIM_ENCODERMODE_DIRECTIONALCLOCK_X1_TI12 (TIM_SMCR_SMS_3 | TIM_SMCR_SMS_2 | TIM_SMCR_SMS_0) /*!< Encoder mode: Directional Clock, x1 mode, TI1FP1 and TI2FP2 edge sensitivity is set by CC1P and CC2P */
  749. #define LL_TIM_ENCODERMODE_X1_TI1 (TIM_SMCR_SMS_3 | TIM_SMCR_SMS_2 | TIM_SMCR_SMS_1) /*!< Quadrature encoder mode: x1 mode, counting on TI1FP1 edges only, edge sensitivity is set by CC1P */
  750. #define LL_TIM_ENCODERMODE_X1_TI2 (TIM_SMCR_SMS_3 | TIM_SMCR_SMS_2 | TIM_SMCR_SMS_1 | TIM_SMCR_SMS_0) /*!< Quadrature encoder mode: x1 mode, counting on TI2FP2 edges only, edge sensitivity is set by CC1P */
  751. /**
  752. * @}
  753. */
  754. /** @defgroup TIM_LL_EC_TRGO Trigger Output
  755. * @{
  756. */
  757. #define LL_TIM_TRGO_RESET 0x00000000U /*!< UG bit from the TIMx_EGR register is used as trigger output */
  758. #define LL_TIM_TRGO_ENABLE TIM_CR2_MMS_0 /*!< Counter Enable signal (CNT_EN) is used as trigger output */
  759. #define LL_TIM_TRGO_UPDATE TIM_CR2_MMS_1 /*!< Update event is used as trigger output */
  760. #define LL_TIM_TRGO_CC1IF (TIM_CR2_MMS_1 | TIM_CR2_MMS_0) /*!< CC1 capture or a compare match is used as trigger output */
  761. #define LL_TIM_TRGO_OC1REF TIM_CR2_MMS_2 /*!< OC1REF signal is used as trigger output */
  762. #define LL_TIM_TRGO_OC2REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_0) /*!< OC2REF signal is used as trigger output */
  763. #define LL_TIM_TRGO_OC3REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_1) /*!< OC3REF signal is used as trigger output */
  764. #define LL_TIM_TRGO_OC4REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_1 | TIM_CR2_MMS_0) /*!< OC4REF signal is used as trigger output */
  765. #define LL_TIM_TRGO_ENCODERCLK TIM_CR2_MMS_3 /*!< Encoder clock signal is used as trigger output */
  766. /**
  767. * @}
  768. */
  769. /** @defgroup TIM_LL_EC_TRGO2 Trigger Output 2
  770. * @{
  771. */
  772. #define LL_TIM_TRGO2_RESET 0x00000000U /*!< UG bit from the TIMx_EGR register is used as trigger output 2 */
  773. #define LL_TIM_TRGO2_ENABLE TIM_CR2_MMS2_0 /*!< Counter Enable signal (CNT_EN) is used as trigger output 2 */
  774. #define LL_TIM_TRGO2_UPDATE TIM_CR2_MMS2_1 /*!< Update event is used as trigger output 2 */
  775. #define LL_TIM_TRGO2_CC1F (TIM_CR2_MMS2_1 | TIM_CR2_MMS2_0) /*!< CC1 capture or a compare match is used as trigger output 2 */
  776. #define LL_TIM_TRGO2_OC1 TIM_CR2_MMS2_2 /*!< OC1REF signal is used as trigger output 2 */
  777. #define LL_TIM_TRGO2_OC2 (TIM_CR2_MMS2_2 | TIM_CR2_MMS2_0) /*!< OC2REF signal is used as trigger output 2 */
  778. #define LL_TIM_TRGO2_OC3 (TIM_CR2_MMS2_2 | TIM_CR2_MMS2_1) /*!< OC3REF signal is used as trigger output 2 */
  779. #define LL_TIM_TRGO2_OC4 (TIM_CR2_MMS2_2 | TIM_CR2_MMS2_1 | TIM_CR2_MMS2_0) /*!< OC4REF signal is used as trigger output 2 */
  780. #define LL_TIM_TRGO2_OC5 TIM_CR2_MMS2_3 /*!< OC5REF signal is used as trigger output 2 */
  781. #define LL_TIM_TRGO2_OC6 (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_0) /*!< OC6REF signal is used as trigger output 2 */
  782. #define LL_TIM_TRGO2_OC4_RISINGFALLING (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_1) /*!< OC4REF rising or falling edges are used as trigger output 2 */
  783. #define LL_TIM_TRGO2_OC6_RISINGFALLING (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_1 | TIM_CR2_MMS2_0) /*!< OC6REF rising or falling edges are used as trigger output 2 */
  784. #define LL_TIM_TRGO2_OC4_RISING_OC6_RISING (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_2) /*!< OC4REF or OC6REF rising edges are used as trigger output 2 */
  785. #define LL_TIM_TRGO2_OC4_RISING_OC6_FALLING (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_2 | TIM_CR2_MMS2_0) /*!< OC4REF rising or OC6REF falling edges are used as trigger output 2 */
  786. #define LL_TIM_TRGO2_OC5_RISING_OC6_RISING (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_2 |TIM_CR2_MMS2_1) /*!< OC5REF or OC6REF rising edges are used as trigger output 2 */
  787. #define LL_TIM_TRGO2_OC5_RISING_OC6_FALLING (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_2 | TIM_CR2_MMS2_1 | TIM_CR2_MMS2_0) /*!< OC5REF rising or OC6REF falling edges are used as trigger output 2 */
  788. /**
  789. * @}
  790. */
  791. /** @defgroup TIM_LL_EC_SLAVEMODE Slave Mode
  792. * @{
  793. */
  794. #define LL_TIM_SLAVEMODE_DISABLED 0x00000000U /*!< Slave mode disabled */
  795. #define LL_TIM_SLAVEMODE_RESET TIM_SMCR_SMS_2 /*!< Reset Mode - Rising edge of the selected trigger input (TRGI) reinitializes the counter */
  796. #define LL_TIM_SLAVEMODE_GATED (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_0) /*!< Gated Mode - The counter clock is enabled when the trigger input (TRGI) is high */
  797. #define LL_TIM_SLAVEMODE_TRIGGER (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_1) /*!< Trigger Mode - The counter starts at a rising edge of the trigger TRGI */
  798. #define LL_TIM_SLAVEMODE_COMBINED_RESETTRIGGER TIM_SMCR_SMS_3 /*!< Combined reset + trigger mode - Rising edge of the selected trigger input (TRGI) reinitializes the counter, generates an update of the registers and starts the counter */
  799. #define LL_TIM_SLAVEMODE_COMBINED_GATEDRESET (TIM_SMCR_SMS_3 | TIM_SMCR_SMS_0) /*!< Combined gated + reset mode - The counter clock is enabled when the trigger input (TRGI) is high. The counter stops and is reset) as soon as the trigger becomes low.Both startand stop of
  800. the counter are controlled. */
  801. /**
  802. * @}
  803. */
  804. /** @defgroup TIM_LL_EC_SMS_PRELOAD_SOURCE SMS Preload Source
  805. * @{
  806. */
  807. #define LL_TIM_SMSPS_TIMUPDATE 0x00000000U /*!< The SMS preload transfer is triggered by the Timer's Update event */
  808. #define LL_TIM_SMSPS_INDEX TIM_SMCR_SMSPS /*!< The SMS preload transfer is triggered by the Index event */
  809. /**
  810. * @}
  811. */
  812. /** @defgroup TIM_LL_EC_TS Trigger Selection
  813. * @{
  814. */
  815. #define LL_TIM_TS_ITR0 0x00000000U /*!< Internal Trigger 0 (ITR0) is used as trigger input */
  816. #define LL_TIM_TS_ITR1 TIM_SMCR_TS_0 /*!< Internal Trigger 1 (ITR1) is used as trigger input */
  817. #define LL_TIM_TS_ITR2 TIM_SMCR_TS_1 /*!< Internal Trigger 2 (ITR2) is used as trigger input */
  818. #define LL_TIM_TS_ITR3 (TIM_SMCR_TS_0 | TIM_SMCR_TS_1) /*!< Internal Trigger 3 (ITR3) is used as trigger input */
  819. #define LL_TIM_TS_ITR4 TIM_SMCR_TS_3 /*!< Internal Trigger 4 (ITR4) is used as trigger input */
  820. #define LL_TIM_TS_ITR5 (TIM_SMCR_TS_3 | TIM_SMCR_TS_0) /*!< Internal Trigger 5 (ITR5) is used as trigger input */
  821. #define LL_TIM_TS_ITR6 (TIM_SMCR_TS_3 | TIM_SMCR_TS_1) /*!< Internal Trigger 6 (ITR6) is used as trigger input */
  822. #define LL_TIM_TS_ITR7 (TIM_SMCR_TS_3 | TIM_SMCR_TS_1 | TIM_SMCR_TS_0) /*!< Internal Trigger 7 (ITR7) is used as trigger input */
  823. #define LL_TIM_TS_ITR8 (TIM_SMCR_TS_3 | TIM_SMCR_TS_2) /*!< Internal Trigger 8 (ITR8) is used as trigger input */
  824. #define LL_TIM_TS_ITR9 (TIM_SMCR_TS_0 | TIM_SMCR_TS_2 | TIM_SMCR_TS_3) /*!< Internal Trigger 9 (ITR9) is used as trigger input */
  825. #define LL_TIM_TS_ITR10 (TIM_SMCR_TS_1 | TIM_SMCR_TS_2 | TIM_SMCR_TS_3) /*!< Internal Trigger 10 (ITR10) is used as trigger input */
  826. #define LL_TIM_TS_ITR11 (TIM_SMCR_TS_0 | TIM_SMCR_TS_1 | TIM_SMCR_TS_2 | TIM_SMCR_TS_3) /*!< Internal Trigger 11 (ITR11) is used as trigger input */
  827. #define LL_TIM_TS_ITR12 (TIM_SMCR_TS_4) /*!< Internal Trigger 12 (ITR12) is used as trigger input */
  828. #define LL_TIM_TS_TI1F_ED TIM_SMCR_TS_2 /*!< TI1 Edge Detector (TI1F_ED) is used as trigger input */
  829. #define LL_TIM_TS_TI1FP1 (TIM_SMCR_TS_2 | TIM_SMCR_TS_0) /*!< Filtered Timer Input 1 (TI1FP1) is used as trigger input */
  830. #define LL_TIM_TS_TI2FP2 (TIM_SMCR_TS_2 | TIM_SMCR_TS_1) /*!< Filtered Timer Input 2 (TI12P2) is used as trigger input */
  831. #define LL_TIM_TS_ETRF (TIM_SMCR_TS_2 | TIM_SMCR_TS_1 | TIM_SMCR_TS_0) /*!< Filtered external Trigger (ETRF) is used as trigger input */
  832. /**
  833. * @}
  834. */
  835. /** @defgroup TIM_LL_EC_ETR_POLARITY External Trigger Polarity
  836. * @{
  837. */
  838. #define LL_TIM_ETR_POLARITY_NONINVERTED 0x00000000U /*!< ETR is non-inverted, active at high level or rising edge */
  839. #define LL_TIM_ETR_POLARITY_INVERTED TIM_SMCR_ETP /*!< ETR is inverted, active at low level or falling edge */
  840. /**
  841. * @}
  842. */
  843. /** @defgroup TIM_LL_EC_ETR_PRESCALER External Trigger Prescaler
  844. * @{
  845. */
  846. #define LL_TIM_ETR_PRESCALER_DIV1 0x00000000U /*!< ETR prescaler OFF */
  847. #define LL_TIM_ETR_PRESCALER_DIV2 TIM_SMCR_ETPS_0 /*!< ETR frequency is divided by 2 */
  848. #define LL_TIM_ETR_PRESCALER_DIV4 TIM_SMCR_ETPS_1 /*!< ETR frequency is divided by 4 */
  849. #define LL_TIM_ETR_PRESCALER_DIV8 TIM_SMCR_ETPS /*!< ETR frequency is divided by 8 */
  850. /**
  851. * @}
  852. */
  853. /** @defgroup TIM_LL_EC_ETR_FILTER External Trigger Filter
  854. * @{
  855. */
  856. #define LL_TIM_ETR_FILTER_FDIV1 0x00000000U /*!< No filter, sampling is done at fDTS */
  857. #define LL_TIM_ETR_FILTER_FDIV1_N2 TIM_SMCR_ETF_0 /*!< fSAMPLING=fCK_INT, N=2 */
  858. #define LL_TIM_ETR_FILTER_FDIV1_N4 TIM_SMCR_ETF_1 /*!< fSAMPLING=fCK_INT, N=4 */
  859. #define LL_TIM_ETR_FILTER_FDIV1_N8 (TIM_SMCR_ETF_1 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fCK_INT, N=8 */
  860. #define LL_TIM_ETR_FILTER_FDIV2_N6 TIM_SMCR_ETF_2 /*!< fSAMPLING=fDTS/2, N=6 */
  861. #define LL_TIM_ETR_FILTER_FDIV2_N8 (TIM_SMCR_ETF_2 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fDTS/2, N=8 */
  862. #define LL_TIM_ETR_FILTER_FDIV4_N6 (TIM_SMCR_ETF_2 | TIM_SMCR_ETF_1) /*!< fSAMPLING=fDTS/4, N=6 */
  863. #define LL_TIM_ETR_FILTER_FDIV4_N8 (TIM_SMCR_ETF_2 | TIM_SMCR_ETF_1 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fDTS/4, N=8 */
  864. #define LL_TIM_ETR_FILTER_FDIV8_N6 TIM_SMCR_ETF_3 /*!< fSAMPLING=fDTS/8, N=6 */
  865. #define LL_TIM_ETR_FILTER_FDIV8_N8 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fDTS/16, N=8 */
  866. #define LL_TIM_ETR_FILTER_FDIV16_N5 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_1) /*!< fSAMPLING=fDTS/16, N=5 */
  867. #define LL_TIM_ETR_FILTER_FDIV16_N6 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_1 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fDTS/16, N=6 */
  868. #define LL_TIM_ETR_FILTER_FDIV16_N8 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_2) /*!< fSAMPLING=fDTS/16, N=8 */
  869. #define LL_TIM_ETR_FILTER_FDIV32_N5 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_2 | TIM_SMCR_ETF_0) /*!< fSAMPLING=fDTS/32, N=5 */
  870. #define LL_TIM_ETR_FILTER_FDIV32_N6 (TIM_SMCR_ETF_3 | TIM_SMCR_ETF_2 | TIM_SMCR_ETF_1) /*!< fSAMPLING=fDTS/32, N=6 */
  871. #define LL_TIM_ETR_FILTER_FDIV32_N8 TIM_SMCR_ETF /*!< fSAMPLING=fDTS/32, N=8 */
  872. /**
  873. * @}
  874. */
  875. /** @defgroup TIM_LL_EC_TIM1_ETRSOURCE External Trigger Source TIM1
  876. * @{
  877. */
  878. #define LL_TIM_TIM1_ETRSOURCE_GPIO 0x00000000U /*!< ETR input is connected to GPIO */
  879. #if defined(COMP1)
  880. #define LL_TIM_TIM1_ETRSOURCE_COMP1 TIM1_AF1_ETRSEL_0 /*!< ETR input is connected to COMP1_OUT */
  881. #endif /* COMP1 */
  882. #if defined(COMP2)
  883. #define LL_TIM_TIM1_ETRSOURCE_COMP2 TIM1_AF1_ETRSEL_1 /*!< ETR input is connected to COMP2_OUT */
  884. #endif /* COMP2 */
  885. #define LL_TIM_TIM1_ETRSOURCE_ADC1_AWD1 (TIM1_AF1_ETRSEL_1 | TIM1_AF1_ETRSEL_0) /*!< ADC1 analog watchdog 1 */
  886. #define LL_TIM_TIM1_ETRSOURCE_ADC1_AWD2 TIM1_AF1_ETRSEL_2 /*!< ADC1 analog watchdog 2 */
  887. #define LL_TIM_TIM1_ETRSOURCE_ADC1_AWD3 (TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_0) /*!< ADC1 analog watchdog 3 */
  888. /**
  889. * @}
  890. */
  891. /** @defgroup TIM_LL_EC_TIM2_ETRSOURCE External Trigger Source TIM2
  892. * @{
  893. */
  894. #define LL_TIM_TIM2_ETRSOURCE_GPIO 0x00000000U /*!< ETR input is connected to GPIO */
  895. #if defined(COMP1)
  896. #define LL_TIM_TIM2_ETRSOURCE_COMP1 TIM1_AF1_ETRSEL_0 /*!< ETR input is connected to COMP1_OUT */
  897. #endif /* COMP1 */
  898. #if defined(COMP2)
  899. #define LL_TIM_TIM2_ETRSOURCE_COMP2 TIM1_AF1_ETRSEL_1 /*!< ETR input is connected to COMP2_OUT */
  900. #endif /* COMP2 */
  901. #define LL_TIM_TIM2_ETRSOURCE_LSE (TIM1_AF1_ETRSEL_1 | TIM1_AF1_ETRSEL_0) /*!< ETR input is connected to LSE */
  902. #if defined(SAI1)
  903. #define LL_TIM_TIM2_ETRSOURCE_SAI1_FSA TIM1_AF1_ETRSEL_2 /*!< ETR input is connected to SAI1_FSA */
  904. #define LL_TIM_TIM2_ETRSOURCE_SAI1_FSB (TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_0) /*!< ETR input is connected to SAI1_FSB */
  905. #endif /* SAI1 */
  906. #define LL_TIM_TIM2_ETRSOURCE_TIM3_ETR (TIM1_AF1_ETRSEL_3 | TIM1_AF1_ETRSEL_0) /*!< ETR input is connected to TIM3 ETR */
  907. #if defined(TIM4)
  908. #define LL_TIM_TIM2_ETRSOURCE_TIM4_ETR (TIM1_AF1_ETRSEL_3 | TIM1_AF1_ETRSEL_1) /*!< ETR input is connected to TIM4 ETR */
  909. #endif /* TIM4 */
  910. #if defined(TIM5)
  911. #define LL_TIM_TIM2_ETRSOURCE_TIM5_ETR (TIM1_AF1_ETRSEL_3 | TIM1_AF1_ETRSEL_1 | TIM1_AF1_ETRSEL_0) /*!< ETR input is connected to TIM5 ETR */
  912. #endif /* TIM5 */
  913. #if defined(USB_DRD_FS)
  914. #define LL_TIM_TIM2_ETRSOURCE_USB_SOF (TIM1_AF1_ETRSEL_3 | TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_0) /*!< ETR input is connected to USB SOF */
  915. #elif defined(USB_OTG_HS)
  916. #define LL_TIM_TIM2_ETRSOURCE_USBHS_SOF (TIM1_AF1_ETRSEL_3 | TIM1_AF1_ETRSEL_2) /*!< ETR is connected to USBHS OTG SOF */
  917. #define LL_TIM_TIM2_ETRSOURCE_USBFS_SOF (TIM1_AF1_ETRSEL_3 | TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_0) /*!< ETR is connected to USBFS OTG SOF */
  918. #endif /* USB_DRD_FS */
  919. #if defined(ETH_NS)
  920. #define LL_TIM_TIM2_ETRSOURCE_ETH_PPS (TIM1_AF1_ETRSEL_3 | TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_1) /*!< ETR input is connected to ETH PPS */
  921. #endif /* ETH_NS */
  922. #if defined(PLAY1)
  923. #define LL_TIM_TIM2_ETRSOURCE_PLAY1_OUT0 TIM1_AF1_ETRSEL_Msk /*!< ETR input is connected to PLAY1 output 0 */
  924. #endif /* PLAY1 */
  925. /**
  926. * @}
  927. */
  928. /** @defgroup TIM_LL_EC_TIM3_ETRSOURCE External Trigger Source TIM3
  929. * @{
  930. */
  931. #define LL_TIM_TIM3_ETRSOURCE_GPIO 0x00000000U /*!< ETR input is connected to GPIO */
  932. #if defined(COMP1)
  933. #define LL_TIM_TIM3_ETRSOURCE_COMP1 TIM1_AF1_ETRSEL_0 /*!< ETR input is connected to COMP1_OUT */
  934. #endif /* COMP1 */
  935. #if defined(COMP2)
  936. #define LL_TIM_TIM3_ETRSOURCE_COMP2 TIM1_AF1_ETRSEL_1 /*!< ETR input is connected to COMP2_OUT */
  937. #endif /* COMP2 */
  938. #if defined(ADC2)
  939. #define LL_TIM_TIM3_ETRSOURCE_ADC2_AWD1 (TIM1_AF1_ETRSEL_1 | TIM1_AF1_ETRSEL_0) /*!< ADC2 analog watchdog 1 */
  940. #define LL_TIM_TIM3_ETRSOURCE_ADC2_AWD2 TIM1_AF1_ETRSEL_2 /*!< ADC2 analog watchdog 2 */
  941. #define LL_TIM_TIM3_ETRSOURCE_ADC2_AWD3 (TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_0) /*!< ADC2 analog watchdog 3 */
  942. #endif /* ADC2 */
  943. #define LL_TIM_TIM3_ETRSOURCE_TIM2_ETR TIM1_AF1_ETRSEL_3 /*!< ETR input is connected to TIM2 ETR */
  944. #if defined(TIM4)
  945. #define LL_TIM_TIM3_ETRSOURCE_TIM4_ETR (TIM1_AF1_ETRSEL_3 | TIM1_AF1_ETRSEL_1) /*!< ETR input is connected to TIM4 ETR */
  946. #endif /* TIM4 */
  947. #if defined(TIM5)
  948. #define LL_TIM_TIM3_ETRSOURCE_TIM5_ETR (TIM1_AF1_ETRSEL_3 | TIM1_AF1_ETRSEL_1| TIM1_AF1_ETRSEL_0) /*!< ETR input is connected to TIM5 ETR */
  949. #endif /* TIM5 */
  950. #if defined(ETH_NS)
  951. #define LL_TIM_TIM3_ETRSOURCE_ETH_PPS (TIM1_AF1_ETRSEL_1 | TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_3 ) /*!< ETR input is connected to ETH PPS */
  952. #endif /* ETH_NS */
  953. #if defined(PLAY1)
  954. #define LL_TIM_TIM3_ETRSOURCE_PLAY1_OUT0 TIM1_AF1_ETRSEL_Msk /*!< ETR input is connected to PLAY1 output 0 */
  955. #endif /* PLAY1 */
  956. /**
  957. * @}
  958. */
  959. #if defined(TIM4)
  960. /** @defgroup TIM_LL_EC_TIM4_ETRSOURCE External Trigger Source TIM4
  961. * @{
  962. */
  963. #define LL_TIM_TIM4_ETRSOURCE_GPIO 0x00000000U /*!< ETR input is connected to GPIO */
  964. #if defined(COMP1) && defined(COMP2)
  965. #define LL_TIM_TIM4_ETRSOURCE_COMP1 TIM1_AF1_ETRSEL_0 /*!< ETR input is connected to COMP1_OUT */
  966. #define LL_TIM_TIM4_ETRSOURCE_COMP2 TIM1_AF1_ETRSEL_1 /*!< ETR input is connected to COMP2_OUT */
  967. #endif /* COMP1 && COMP2 */
  968. #define LL_TIM_TIM4_ETRSOURCE_TIM2_ETR TIM1_AF1_ETRSEL_3 /*!< ETR input is connected to TIM3 ETR */
  969. #define LL_TIM_TIM4_ETRSOURCE_TIM3_ETR (TIM1_AF1_ETRSEL_3 | TIM1_AF1_ETRSEL_0) /*!< ETR input is connected to TIM4 ETR */
  970. #define LL_TIM_TIM4_ETRSOURCE_TIM5_ETR (TIM1_AF1_ETRSEL_3 | TIM1_AF1_ETRSEL_1 | TIM1_AF1_ETRSEL_0) /*!< ETR input is connected to TIM5 ETR */
  971. /**
  972. * @}
  973. */
  974. #endif /* TIM4 */
  975. #if defined(TIM5)
  976. /** @defgroup TIM_LL_EC_TIM5_ETRSOURCE External Trigger Source TIM5
  977. * @{
  978. */
  979. #define LL_TIM_TIM5_ETRSOURCE_GPIO 0x00000000U /*!< ETR input is connected to GPIO */
  980. #define LL_TIM_TIM5_ETRSOURCE_SAI2_FSA TIM1_AF1_ETRSEL_0 /*!< ETR input is connected to SAI2_FSA */
  981. #define LL_TIM_TIM5_ETRSOURCE_SAI2_FSB TIM1_AF1_ETRSEL_1 /*!< ETR input is connected to SAI2_FSB */
  982. #if defined(COMP1) && defined(COMP2)
  983. #define LL_TIM_TIM5_ETRSOURCE_COMP1 (TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_0) /*!< ETR input is connected to COMP1_OUT */
  984. #define LL_TIM_TIM5_ETRSOURCE_COMP2 (TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_1 | TIM1_AF1_ETRSEL_0) /*!< ETR input is connected to COMP2_OUT */
  985. #endif /* COMP1 && COMP2 */
  986. #define LL_TIM_TIM5_ETRSOURCE_TIM2_ETR TIM1_AF1_ETRSEL_3 /*!< ETR input is connected to TIM2 ETR */
  987. #define LL_TIM_TIM5_ETRSOURCE_TIM3_ETR (TIM1_AF1_ETRSEL_3 | TIM1_AF1_ETRSEL_0) /*!< ETR input is connected to TIM3 ETR */
  988. #define LL_TIM_TIM5_ETRSOURCE_TIM4_ETR (TIM1_AF1_ETRSEL_3 | TIM1_AF1_ETRSEL_1) /*!< ETR input is connected to TIM4 ETR */
  989. #if defined(USB_DRD_FS)
  990. #define LL_TIM_TIM5_ETRSOURCE_USB_SOF (TIM1_AF1_ETRSEL_3 | TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_0) /*!< ETR input is connected to USB SOF */
  991. #elif defined(USB_OTG_HS)
  992. #define LL_TIM_TIM5_ETRSOURCE_USBHS_SOF (TIM1_AF1_ETRSEL_3 | TIM1_AF1_ETRSEL_2) /*!< ETR is connected to USBHS OTG SOF */
  993. #define LL_TIM_TIM5_ETRSOURCE_USBFS_SOF (TIM1_AF1_ETRSEL_3 | TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_0) /*!< ETR is connected to USBFS OTG SOF */
  994. #endif /* USB_DRD_FS */
  995. /**
  996. * @}
  997. */
  998. #endif /* TIM5 */
  999. #if defined(TIM8)
  1000. /** @defgroup TIM_LL_EC_TIM8_ETRSOURCE External Trigger Source TIM8
  1001. * @{
  1002. */
  1003. #define LL_TIM_TIM8_ETRSOURCE_GPIO 0x00000000U /*!< ETR input is connected to GPIO */
  1004. #if defined(COMP1) && defined(COMP2)
  1005. #define LL_TIM_TIM8_ETRSOURCE_COMP1 TIM1_AF1_ETRSEL_0 /*!< ETR input is connected to COMP1_OUT */
  1006. #define LL_TIM_TIM8_ETRSOURCE_COMP2 TIM1_AF1_ETRSEL_1 /*!< ETR input is connected to COMP2_OUT */
  1007. #endif /* COMP1 && COMP2 */
  1008. #define LL_TIM_TIM8_ETRSOURCE_ADC2_AWD1 (TIM1_AF1_ETRSEL_1 | TIM1_AF1_ETRSEL_0) /*!< ADC2 analog watchdog 1 */
  1009. #define LL_TIM_TIM8_ETRSOURCE_ADC2_AWD2 TIM1_AF1_ETRSEL_2 /*!< ADC2 analog watchdog 2 */
  1010. #define LL_TIM_TIM8_ETRSOURCE_ADC2_AWD3 (TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_0) /*!< ADC2 analog watchdog 3 */
  1011. #if defined(ADC3)
  1012. #define LL_TIM_TIM8_ETRSOURCE_ADC3_AWD1 (TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_1) /*!< ADC3 analog watchdog 1 */
  1013. #define LL_TIM_TIM8_ETRSOURCE_ADC3_AWD2 (TIM1_AF1_ETRSEL_2 | TIM1_AF1_ETRSEL_1 | TIM1_AF1_ETRSEL_0) /*!< ADC3 analog watchdog 2 */
  1014. #define LL_TIM_TIM8_ETRSOURCE_ADC3_AWD3 TIM1_AF1_ETRSEL_3 /*!< ADC3 analog watchdog 3 */
  1015. #endif /* ADC3 */
  1016. /**
  1017. * @}
  1018. */
  1019. #endif /* TIM8 */
  1020. /** @defgroup TIM_LL_EC_BREAK_POLARITY break polarity
  1021. * @{
  1022. */
  1023. #define LL_TIM_BREAK_POLARITY_LOW 0x00000000U /*!< Break input BRK is active low */
  1024. #define LL_TIM_BREAK_POLARITY_HIGH TIM_BDTR_BKP /*!< Break input BRK is active high */
  1025. /**
  1026. * @}
  1027. */
  1028. /** @defgroup TIM_LL_EC_BREAK_FILTER break filter
  1029. * @{
  1030. */
  1031. #define LL_TIM_BREAK_FILTER_FDIV1 0x00000000U /*!< No filter, BRK acts asynchronously */
  1032. #define LL_TIM_BREAK_FILTER_FDIV1_N2 0x00010000U /*!< fSAMPLING=fCK_INT, N=2 */
  1033. #define LL_TIM_BREAK_FILTER_FDIV1_N4 0x00020000U /*!< fSAMPLING=fCK_INT, N=4 */
  1034. #define LL_TIM_BREAK_FILTER_FDIV1_N8 0x00030000U /*!< fSAMPLING=fCK_INT, N=8 */
  1035. #define LL_TIM_BREAK_FILTER_FDIV2_N6 0x00040000U /*!< fSAMPLING=fDTS/2, N=6 */
  1036. #define LL_TIM_BREAK_FILTER_FDIV2_N8 0x00050000U /*!< fSAMPLING=fDTS/2, N=8 */
  1037. #define LL_TIM_BREAK_FILTER_FDIV4_N6 0x00060000U /*!< fSAMPLING=fDTS/4, N=6 */
  1038. #define LL_TIM_BREAK_FILTER_FDIV4_N8 0x00070000U /*!< fSAMPLING=fDTS/4, N=8 */
  1039. #define LL_TIM_BREAK_FILTER_FDIV8_N6 0x00080000U /*!< fSAMPLING=fDTS/8, N=6 */
  1040. #define LL_TIM_BREAK_FILTER_FDIV8_N8 0x00090000U /*!< fSAMPLING=fDTS/8, N=8 */
  1041. #define LL_TIM_BREAK_FILTER_FDIV16_N5 0x000A0000U /*!< fSAMPLING=fDTS/16, N=5 */
  1042. #define LL_TIM_BREAK_FILTER_FDIV16_N6 0x000B0000U /*!< fSAMPLING=fDTS/16, N=6 */
  1043. #define LL_TIM_BREAK_FILTER_FDIV16_N8 0x000C0000U /*!< fSAMPLING=fDTS/16, N=8 */
  1044. #define LL_TIM_BREAK_FILTER_FDIV32_N5 0x000D0000U /*!< fSAMPLING=fDTS/32, N=5 */
  1045. #define LL_TIM_BREAK_FILTER_FDIV32_N6 0x000E0000U /*!< fSAMPLING=fDTS/32, N=6 */
  1046. #define LL_TIM_BREAK_FILTER_FDIV32_N8 0x000F0000U /*!< fSAMPLING=fDTS/32, N=8 */
  1047. /**
  1048. * @}
  1049. */
  1050. /** @defgroup TIM_LL_EC_BREAK2_POLARITY BREAK2 POLARITY
  1051. * @{
  1052. */
  1053. #define LL_TIM_BREAK2_POLARITY_LOW 0x00000000U /*!< Break input BRK2 is active low */
  1054. #define LL_TIM_BREAK2_POLARITY_HIGH TIM_BDTR_BK2P /*!< Break input BRK2 is active high */
  1055. /**
  1056. * @}
  1057. */
  1058. /** @defgroup TIM_LL_EC_BREAK2_FILTER BREAK2 FILTER
  1059. * @{
  1060. */
  1061. #define LL_TIM_BREAK2_FILTER_FDIV1 0x00000000U /*!< No filter, BRK acts asynchronously */
  1062. #define LL_TIM_BREAK2_FILTER_FDIV1_N2 0x00100000U /*!< fSAMPLING=fCK_INT, N=2 */
  1063. #define LL_TIM_BREAK2_FILTER_FDIV1_N4 0x00200000U /*!< fSAMPLING=fCK_INT, N=4 */
  1064. #define LL_TIM_BREAK2_FILTER_FDIV1_N8 0x00300000U /*!< fSAMPLING=fCK_INT, N=8 */
  1065. #define LL_TIM_BREAK2_FILTER_FDIV2_N6 0x00400000U /*!< fSAMPLING=fDTS/2, N=6 */
  1066. #define LL_TIM_BREAK2_FILTER_FDIV2_N8 0x00500000U /*!< fSAMPLING=fDTS/2, N=8 */
  1067. #define LL_TIM_BREAK2_FILTER_FDIV4_N6 0x00600000U /*!< fSAMPLING=fDTS/4, N=6 */
  1068. #define LL_TIM_BREAK2_FILTER_FDIV4_N8 0x00700000U /*!< fSAMPLING=fDTS/4, N=8 */
  1069. #define LL_TIM_BREAK2_FILTER_FDIV8_N6 0x00800000U /*!< fSAMPLING=fDTS/8, N=6 */
  1070. #define LL_TIM_BREAK2_FILTER_FDIV8_N8 0x00900000U /*!< fSAMPLING=fDTS/8, N=8 */
  1071. #define LL_TIM_BREAK2_FILTER_FDIV16_N5 0x00A00000U /*!< fSAMPLING=fDTS/16, N=5 */
  1072. #define LL_TIM_BREAK2_FILTER_FDIV16_N6 0x00B00000U /*!< fSAMPLING=fDTS/16, N=6 */
  1073. #define LL_TIM_BREAK2_FILTER_FDIV16_N8 0x00C00000U /*!< fSAMPLING=fDTS/16, N=8 */
  1074. #define LL_TIM_BREAK2_FILTER_FDIV32_N5 0x00D00000U /*!< fSAMPLING=fDTS/32, N=5 */
  1075. #define LL_TIM_BREAK2_FILTER_FDIV32_N6 0x00E00000U /*!< fSAMPLING=fDTS/32, N=6 */
  1076. #define LL_TIM_BREAK2_FILTER_FDIV32_N8 0x00F00000U /*!< fSAMPLING=fDTS/32, N=8 */
  1077. /**
  1078. * @}
  1079. */
  1080. /** @defgroup TIM_LL_EC_OSSI OSSI
  1081. * @{
  1082. */
  1083. #define LL_TIM_OSSI_DISABLE 0x00000000U /*!< When inactive, OCx/OCxN outputs are disabled */
  1084. #define LL_TIM_OSSI_ENABLE TIM_BDTR_OSSI /*!< When inactive, OxC/OCxN outputs are first forced with their inactive level then forced to their idle level after the deadtime */
  1085. /**
  1086. * @}
  1087. */
  1088. /** @defgroup TIM_LL_EC_OSSR OSSR
  1089. * @{
  1090. */
  1091. #define LL_TIM_OSSR_DISABLE 0x00000000U /*!< When inactive, OCx/OCxN outputs are disabled */
  1092. #define LL_TIM_OSSR_ENABLE TIM_BDTR_OSSR /*!< When inactive, OC/OCN outputs are enabled with their inactive level as soon as CCxE=1 or CCxNE=1 */
  1093. /**
  1094. * @}
  1095. */
  1096. /** @defgroup TIM_LL_EC_BREAK_INPUT BREAK INPUT
  1097. * @{
  1098. */
  1099. #define LL_TIM_BREAK_INPUT_BKIN 0x00000000U /*!< TIMx_BKIN input */
  1100. #define LL_TIM_BREAK_INPUT_BKIN2 0x00000004U /*!< TIMx_BKIN2 input */
  1101. /**
  1102. * @}
  1103. */
  1104. /** @defgroup TIM_LL_EC_BKIN_SOURCE BKIN SOURCE
  1105. * @{
  1106. */
  1107. #define LL_TIM_BKIN_SOURCE_BKIN TIM1_AF1_BKINE /*!< BKIN input from AF controller */
  1108. #if defined(COMP1)
  1109. #define LL_TIM_BKIN_SOURCE_BKCOMP1 TIM1_AF1_BKCMP1E /*!< internal signal: COMP1 output */
  1110. #endif /* COMP1 */
  1111. #if defined(COMP2)
  1112. #define LL_TIM_BKIN_SOURCE_BKCOMP2 TIM1_AF1_BKCMP2E /*!< internal signal: COMP2 output */
  1113. #endif /* COMP2 */
  1114. #if defined(PLAY1)
  1115. #define LL_TIM_BKIN_SOURCE_PLAY1 TIM1_AF1_BKCMP3E /*!< internal signal: PLAY1 output */
  1116. #endif /* PLAY1 */
  1117. #if defined(MDF1)
  1118. #define LL_TIM_BKIN_SOURCE_MDF1 TIM1_AF1_BKDF1BK0E /*!< internal signal: Digital filter break output */
  1119. #endif /* MDF1 */
  1120. /**
  1121. * @}
  1122. */
  1123. /** @defgroup TIM_LL_EC_BKIN_POLARITY BKIN POLARITY
  1124. * @{
  1125. */
  1126. #define LL_TIM_BKIN_POLARITY_LOW TIM1_AF1_BKINP /*!< BRK BKIN input is active low */
  1127. #define LL_TIM_BKIN_POLARITY_HIGH 0x00000000U /*!< BRK BKIN input is active high */
  1128. /**
  1129. * @}
  1130. */
  1131. /** @defgroup TIM_LL_EC_BREAK_AFMODE BREAK AF MODE
  1132. * @{
  1133. */
  1134. #define LL_TIM_BREAK_AFMODE_INPUT 0x00000000U /*!< Break input BRK in input mode */
  1135. #define LL_TIM_BREAK_AFMODE_BIDIRECTIONAL TIM_BDTR_BKBID /*!< Break input BRK in bidirectional mode */
  1136. /**
  1137. * @}
  1138. */
  1139. /** @defgroup TIM_LL_EC_BREAK2_AFMODE BREAK2 AF MODE
  1140. * @{
  1141. */
  1142. #define LL_TIM_BREAK2_AFMODE_INPUT 0x00000000U /*!< Break2 input BRK2 in input mode */
  1143. #define LL_TIM_BREAK2_AFMODE_BIDIRECTIONAL TIM_BDTR_BK2BID /*!< Break2 input BRK2 in bidirectional mode */
  1144. /**
  1145. * @}
  1146. */
  1147. /** Legacy definitions for compatibility purpose
  1148. @cond 0
  1149. */
  1150. #define LL_TIM_ReArmBRK(_PARAM_)
  1151. #define LL_TIM_ReArmBRK2(_PARAM_)
  1152. /**
  1153. @endcond
  1154. */
  1155. /** @defgroup TIM_LL_EC_DMABURST_BASEADDR DMA Burst Base Address
  1156. * @{
  1157. */
  1158. #define LL_TIM_DMABURST_BASEADDR_CR1 0x00000000U /*!< TIMx_CR1 register is the DMA base address for DMA burst */
  1159. #define LL_TIM_DMABURST_BASEADDR_CR2 TIM_DCR_DBA_0 /*!< TIMx_CR2 register is the DMA base address for DMA burst */
  1160. #define LL_TIM_DMABURST_BASEADDR_SMCR TIM_DCR_DBA_1 /*!< TIMx_SMCR register is the DMA base address for DMA burst */
  1161. #define LL_TIM_DMABURST_BASEADDR_DIER (TIM_DCR_DBA_1 | TIM_DCR_DBA_0) /*!< TIMx_DIER register is the DMA base address for DMA burst */
  1162. #define LL_TIM_DMABURST_BASEADDR_SR TIM_DCR_DBA_2 /*!< TIMx_SR register is the DMA base address for DMA burst */
  1163. #define LL_TIM_DMABURST_BASEADDR_EGR (TIM_DCR_DBA_2 | TIM_DCR_DBA_0) /*!< TIMx_EGR register is the DMA base address for DMA burst */
  1164. #define LL_TIM_DMABURST_BASEADDR_CCMR1 (TIM_DCR_DBA_2 | TIM_DCR_DBA_1) /*!< TIMx_CCMR1 register is the DMA base address for DMA burst */
  1165. #define LL_TIM_DMABURST_BASEADDR_CCMR2 (TIM_DCR_DBA_2 | TIM_DCR_DBA_1 | TIM_DCR_DBA_0) /*!< TIMx_CCMR2 register is the DMA base address for DMA burst */
  1166. #define LL_TIM_DMABURST_BASEADDR_CCER TIM_DCR_DBA_3 /*!< TIMx_CCER register is the DMA base address for DMA burst */
  1167. #define LL_TIM_DMABURST_BASEADDR_CNT (TIM_DCR_DBA_3 | TIM_DCR_DBA_0) /*!< TIMx_CNT register is the DMA base address for DMA burst */
  1168. #define LL_TIM_DMABURST_BASEADDR_PSC (TIM_DCR_DBA_3 | TIM_DCR_DBA_1) /*!< TIMx_PSC register is the DMA base address for DMA burst */
  1169. #define LL_TIM_DMABURST_BASEADDR_ARR (TIM_DCR_DBA_3 | TIM_DCR_DBA_1 | TIM_DCR_DBA_0) /*!< TIMx_ARR register is the DMA base address for DMA burst */
  1170. #define LL_TIM_DMABURST_BASEADDR_RCR (TIM_DCR_DBA_3 | TIM_DCR_DBA_2) /*!< TIMx_RCR register is the DMA base address for DMA burst */
  1171. #define LL_TIM_DMABURST_BASEADDR_CCR1 (TIM_DCR_DBA_3 | TIM_DCR_DBA_2 | TIM_DCR_DBA_0) /*!< TIMx_CCR1 register is the DMA base address for DMA burst */
  1172. #define LL_TIM_DMABURST_BASEADDR_CCR2 (TIM_DCR_DBA_3 | TIM_DCR_DBA_2 | TIM_DCR_DBA_1) /*!< TIMx_CCR2 register is the DMA base address for DMA burst */
  1173. #define LL_TIM_DMABURST_BASEADDR_CCR3 (TIM_DCR_DBA_3 | TIM_DCR_DBA_2 | TIM_DCR_DBA_1 | TIM_DCR_DBA_0) /*!< TIMx_CCR3 register is the DMA base address for DMA burst */
  1174. #define LL_TIM_DMABURST_BASEADDR_CCR4 TIM_DCR_DBA_4 /*!< TIMx_CCR4 register is the DMA base address for DMA burst */
  1175. #define LL_TIM_DMABURST_BASEADDR_BDTR (TIM_DCR_DBA_4 | TIM_DCR_DBA_0) /*!< TIMx_BDTR register is the DMA base address for DMA burst */
  1176. #define LL_TIM_DMABURST_BASEADDR_CCR5 (TIM_DCR_DBA_4 | TIM_DCR_DBA_1) /*!< TIMx_CCR5 register is the DMA base address for DMA burst */
  1177. #define LL_TIM_DMABURST_BASEADDR_CCR6 (TIM_DCR_DBA_4 | TIM_DCR_DBA_1 | TIM_DCR_DBA_0) /*!< TIMx_CCR6 register is the DMA base address for DMA burst */
  1178. #define LL_TIM_DMABURST_BASEADDR_CCMR3 (TIM_DCR_DBA_4 | TIM_DCR_DBA_2) /*!< TIMx_CCMR3 register is the DMA base address for DMA burst */
  1179. #define LL_TIM_DMABURST_BASEADDR_DTR2 (TIM_DCR_DBA_4 | TIM_DCR_DBA_2 | TIM_DCR_DBA_0) /*!< TIMx_DTR2 register is the DMA base address for DMA burst */
  1180. #define LL_TIM_DMABURST_BASEADDR_ECR (TIM_DCR_DBA_4 | TIM_DCR_DBA_2 | TIM_DCR_DBA_1) /*!< TIMx_ECR register is the DMA base address for DMA burst */
  1181. #define LL_TIM_DMABURST_BASEADDR_TISEL (TIM_DCR_DBA_4 | TIM_DCR_DBA_2 | TIM_DCR_DBA_1 | TIM_DCR_DBA_0) /*!< TIMx_TISEL register is the DMA base address for DMA burst */
  1182. #define LL_TIM_DMABURST_BASEADDR_AF1 (TIM_DCR_DBA_4 | TIM_DCR_DBA_3) /*!< TIMx_AF1 register is the DMA base address for DMA burst */
  1183. #define LL_TIM_DMABURST_BASEADDR_AF2 (TIM_DCR_DBA_4 | TIM_DCR_DBA_3 | TIM_DCR_DBA_0) /*!< TIMx_AF2 register is the DMA base address for DMA burst */
  1184. #define LL_TIM_DMABURST_BASEADDR_OR1 (TIM_DCR_DBA_4 | TIM_DCR_DBA_3 | TIM_DCR_DBA_1) /*!< TIMx_OR1 register is the DMA base address for DMA burst */
  1185. /**
  1186. * @}
  1187. */
  1188. /** @defgroup TIM_LL_EC_DMABURST_LENGTH DMA Burst Length
  1189. * @{
  1190. */
  1191. #define LL_TIM_DMABURST_LENGTH_1TRANSFER 0x00000000U /*!< Transfer is done to 1 register starting from the DMA burst base address */
  1192. #define LL_TIM_DMABURST_LENGTH_2TRANSFERS TIM_DCR_DBL_0 /*!< Transfer is done to 2 registers starting from the DMA burst base address */
  1193. #define LL_TIM_DMABURST_LENGTH_3TRANSFERS TIM_DCR_DBL_1 /*!< Transfer is done to 3 registers starting from the DMA burst base address */
  1194. #define LL_TIM_DMABURST_LENGTH_4TRANSFERS (TIM_DCR_DBL_1 | TIM_DCR_DBL_0) /*!< Transfer is done to 4 registers starting from the DMA burst base address */
  1195. #define LL_TIM_DMABURST_LENGTH_5TRANSFERS TIM_DCR_DBL_2 /*!< Transfer is done to 5 registers starting from the DMA burst base address */
  1196. #define LL_TIM_DMABURST_LENGTH_6TRANSFERS (TIM_DCR_DBL_2 | TIM_DCR_DBL_0) /*!< Transfer is done to 6 registers starting from the DMA burst base address */
  1197. #define LL_TIM_DMABURST_LENGTH_7TRANSFERS (TIM_DCR_DBL_2 | TIM_DCR_DBL_1) /*!< Transfer is done to 7 registers starting from the DMA burst base address */
  1198. #define LL_TIM_DMABURST_LENGTH_8TRANSFERS (TIM_DCR_DBL_2 | TIM_DCR_DBL_1 | TIM_DCR_DBL_0) /*!< Transfer is done to 1 registers starting from the DMA burst base address */
  1199. #define LL_TIM_DMABURST_LENGTH_9TRANSFERS TIM_DCR_DBL_3 /*!< Transfer is done to 9 registers starting from the DMA burst base address */
  1200. #define LL_TIM_DMABURST_LENGTH_10TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_0) /*!< Transfer is done to 10 registers starting from the DMA burst base address */
  1201. #define LL_TIM_DMABURST_LENGTH_11TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_1) /*!< Transfer is done to 11 registers starting from the DMA burst base address */
  1202. #define LL_TIM_DMABURST_LENGTH_12TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_1 | TIM_DCR_DBL_0) /*!< Transfer is done to 12 registers starting from the DMA burst base address */
  1203. #define LL_TIM_DMABURST_LENGTH_13TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_2) /*!< Transfer is done to 13 registers starting from the DMA burst base address */
  1204. #define LL_TIM_DMABURST_LENGTH_14TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_2 | TIM_DCR_DBL_0) /*!< Transfer is done to 14 registers starting from the DMA burst base address */
  1205. #define LL_TIM_DMABURST_LENGTH_15TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_2 | TIM_DCR_DBL_1) /*!< Transfer is done to 15 registers starting from the DMA burst base address */
  1206. #define LL_TIM_DMABURST_LENGTH_16TRANSFERS (TIM_DCR_DBL_3 | TIM_DCR_DBL_2 | TIM_DCR_DBL_1 | TIM_DCR_DBL_0) /*!< Transfer is done to 16 registers starting from the DMA burst base address */
  1207. #define LL_TIM_DMABURST_LENGTH_17TRANSFERS TIM_DCR_DBL_4 /*!< Transfer is done to 17 registers starting from the DMA burst base address */
  1208. #define LL_TIM_DMABURST_LENGTH_18TRANSFERS (TIM_DCR_DBL_4 | TIM_DCR_DBL_0) /*!< Transfer is done to 18 registers starting from the DMA burst base address */
  1209. #define LL_TIM_DMABURST_LENGTH_19TRANSFERS (TIM_DCR_DBL_4 | TIM_DCR_DBL_1) /*!< Transfer is done to 19 registers starting from the DMA burst base address */
  1210. #define LL_TIM_DMABURST_LENGTH_20TRANSFERS (TIM_DCR_DBL_4 | TIM_DCR_DBL_1 | TIM_DCR_DBL_0) /*!< Transfer is done to 20 registers starting from the DMA burst base address */
  1211. #define LL_TIM_DMABURST_LENGTH_21TRANSFERS (TIM_DCR_DBL_4 | TIM_DCR_DBL_2) /*!< Transfer is done to 21 registers starting from the DMA burst base address */
  1212. #define LL_TIM_DMABURST_LENGTH_22TRANSFERS (TIM_DCR_DBL_4 | TIM_DCR_DBL_2 | TIM_DCR_DBL_0) /*!< Transfer is done to 22 registers starting from the DMA burst base address */
  1213. #define LL_TIM_DMABURST_LENGTH_23TRANSFERS (TIM_DCR_DBL_4 | TIM_DCR_DBL_2 | TIM_DCR_DBL_1) /*!< Transfer is done to 23 registers starting from the DMA burst base address */
  1214. #define LL_TIM_DMABURST_LENGTH_24TRANSFERS (TIM_DCR_DBL_4 | TIM_DCR_DBL_2 | TIM_DCR_DBL_1 | TIM_DCR_DBL_0) /*!< Transfer is done to 24 registers starting from the DMA burst base address */
  1215. #define LL_TIM_DMABURST_LENGTH_25TRANSFERS (TIM_DCR_DBL_4 | TIM_DCR_DBL_3) /*!< Transfer is done to 25 registers starting from the DMA burst base address */
  1216. #define LL_TIM_DMABURST_LENGTH_26TRANSFERS (TIM_DCR_DBL_4 | TIM_DCR_DBL_3 | TIM_DCR_DBL_0) /*!< Transfer is done to 26 registers starting from the DMA burst base address */
  1217. /**
  1218. * @}
  1219. */
  1220. /** @defgroup TIM_LL_EC_DMABURST_SOURCE DMA Burst Source
  1221. * @{
  1222. */
  1223. #define LL_TIM_DMA_UPDATE TIM_DCR_DBSS_0 /*!< Transfer source is update event */
  1224. #define LL_TIM_DMA_CC1 TIM_DCR_DBSS_1 /*!< Transfer source is CC1 event */
  1225. #define LL_TIM_DMA_CC2 (TIM_DCR_DBSS_1 | TIM_DCR_DBSS_0) /*!< Transfer source is CC2 event */
  1226. #define LL_TIM_DMA_CC3 TIM_DCR_DBSS_2 /*!< Transfer source is CC3 event */
  1227. #define LL_TIM_DMA_CC4 (TIM_DCR_DBSS_2 | TIM_DCR_DBSS_0) /*!< Transfer source is CC4 event */
  1228. #define LL_TIM_DMA_COM (TIM_DCR_DBSS_2 | TIM_DCR_DBSS_1) /*!< Transfer source is COM event */
  1229. #define LL_TIM_DMA_TRIGGER (TIM_DCR_DBSS_2 | TIM_DCR_DBSS_1 | TIM_DCR_DBSS_0) /*!< Transfer source is trigger event */
  1230. /**
  1231. * @}
  1232. */
  1233. /** @defgroup TIM_LL_EC_TIM1_TI1_RMP TIM1 External Input Ch1 Remap
  1234. * @{
  1235. */
  1236. #define LL_TIM_TIM1_TI1_RMP_GPIO 0x00000000UL /*!< TIM1_TI1 is connected to GPIO */
  1237. #if defined(COMP1) && defined(COMP2)
  1238. #define LL_TIM_TIM1_TI1_RMP_COMP1 TIM_TISEL_TI1SEL_1 /*!< TIM1_TI1 is connected to COMP1 output */
  1239. #define LL_TIM_TIM1_TI1_RMP_COMP2 (TIM_TISEL_TI1SEL_1 | TIM_TISEL_TI1SEL_0) /*!< TIM1_TI1 is connected to COMP2 output */
  1240. #elif defined(COMP1)
  1241. #define LL_TIM_TIM1_TI1_RMP_COMP1 TIM_TISEL_TI1SEL_0 /*!< TIM1_TI1 is connected to COMP1 output */
  1242. #endif /* COMP1 && COMP2 */
  1243. /**
  1244. * @}
  1245. */
  1246. /** @defgroup TIM_LL_EC_TIM2_TI1_RMP TIM2 External Input Ch1 Remap
  1247. * @{
  1248. */
  1249. #define LL_TIM_TIM2_TI1_RMP_GPIO 0x00000000UL /*!< TIM2_TI1 is connected to GPIO */
  1250. #if defined(STM32H503xx)
  1251. #define LL_TIM_TIM2_TI1_RMP_LSI TIM_TISEL_TI1SEL_0 /*!< TIM2_TI1 is connected to LSI */
  1252. #define LL_TIM_TIM2_TI1_RMP_LSE TIM_TISEL_TI1SEL_1 /*!< TIM2_TI1 is connected to LSE */
  1253. #define LL_TIM_TIM2_TI1_RMP_RTC (TIM_TISEL_TI1SEL_1 | TIM_TISEL_TI1SEL_0) /*!< TIM2_TI1 is connected to RTC */
  1254. #define LL_TIM_TIM2_TI1_RMP_TIM3_TI1 TIM_TISEL_TI1SEL_2 /*!< TIM2_TI1 is connected to TIM3 TI1 */
  1255. #endif /* STM32H503xx */
  1256. #if defined(ETH_NS)
  1257. #define LL_TIM_TIM2_TI1_RMP_ETH_PPS TIM_TISEL_TI1SEL_0 /*!< TIM2_TI1 is connected to ETH PPS */
  1258. #endif /* ETH_NS */
  1259. #if defined(COMP1) && defined(COMP2)
  1260. #define LL_TIM_TIM2_TI1_RMP_COMP1 TIM_TISEL_TI1SEL_1 /*!< TIM2_TI1 is connected to COMP1 output */
  1261. #define LL_TIM_TIM2_TI1_RMP_COMP2 (TIM_TISEL_TI1SEL_1 | TIM_TISEL_TI1SEL_0) /*!< TIM2_TI1 is connected to COMP2 output */
  1262. #define LL_TIM_TIM2_TI1_RMP_PLAY1_OUT3 TIM_TISEL_TI1SEL_2 /*!< TIM2_TI1 is connected to PLAY1 output 3 */
  1263. #endif /* COMP1 && COMP2 */
  1264. /**
  1265. * @}
  1266. */
  1267. /** @defgroup TIM_LL_EC_TIM2_TI2_RMP TIM2 External Input Ch2 Remap
  1268. * @{
  1269. */
  1270. #define LL_TIM_TIM2_TI2_RMP_GPIO 0x00000000UL /*!< TIM2_TI2 is connected to GPIO */
  1271. #if defined(STM32H503xx)
  1272. #define LL_TIM_TIM2_TI2_RMP_HSI_1024 TIM_TISEL_TI2SEL_0 /*!< TIM2_TI2 is connected to HSI_1024 */
  1273. #define LL_TIM_TIM2_TI2_RMP_CSI_128 TIM_TISEL_TI2SEL_1 /*!< TIM2_TI2 is connected to CSI_128 */
  1274. #define LL_TIM_TIM2_TI2_RMP_MCO2 (TIM_TISEL_TI2SEL_1 |TIM_TISEL_TI2SEL_0) /*!< TIM2_TI2 is connected to MCO2 */
  1275. #define LL_TIM_TIM2_TI2_RMP_MCO1 TIM_TISEL_TI2SEL_2 /*!< TIM2_TI2 is connected to MCO1 */
  1276. #endif /* STM32H503xx */
  1277. #if defined(COMP1) && defined(COMP2)
  1278. #define LL_TIM_TIM2_TI2_RMP_COMP1 TIM_TISEL_TI2SEL_0 /*!< TIM2_TI2 is connected to COMP1 output */
  1279. #define LL_TIM_TIM2_TI2_RMP_COMP2 TIM_TISEL_TI2SEL_1 /*!< TIM2_TI2 is connected to COMP2 output */
  1280. #endif /* COMP1 && COMP2 */
  1281. /**
  1282. * @}
  1283. */
  1284. /** @defgroup TIM_LL_EC_TIM2_TI4_RMP TIM2 External Input Ch4 Remap
  1285. * @{
  1286. */
  1287. #define LL_TIM_TIM2_TI4_RMP_GPIO 0x00000000UL /*!< TIM2_TI4 is connected to GPIO */
  1288. #if defined(STM32H503xx)
  1289. #define LL_TIM_TIM2_TI4_RMP_COMP1 TIM_TISEL_TI4SEL_0 /*!< TIM2_TI4 is connected to COMP1 output */
  1290. #endif /* STM32H503xx */
  1291. /**
  1292. * @}
  1293. */
  1294. /** @defgroup TIM_LL_EC_TIM3_TI1_RMP TIM3 External Input Ch1 Remap
  1295. * @{
  1296. */
  1297. #define LL_TIM_TIM3_TI1_RMP_GPIO 0x00000000UL /*!< TIM3_TI1 is connected to GPIO */
  1298. #if defined(STM32H503xx)
  1299. #define LL_TIM_TIM3_TI1_RMP_COMP1 TIM_TISEL_TI1SEL_0 /*!< TIM3_TI1 is connected to COMP1 output */
  1300. #define LL_TIM_TIM3_TI1_RMP_MCO1 TIM_TISEL_TI1SEL_1 /*!< TIM3_TI1 is connected to MCO1 */
  1301. #define LL_TIM_TIM3_TI1_RMP_TIM2_TI1 (TIM_TISEL_TI1SEL_1 | TIM_TISEL_TI1SEL_0) /*!< TIM3_TI1 is connected to TIM2 TI1 */
  1302. #define LL_TIM_TIM3_TI1_RMP_HSE_1MHZ TIM_TISEL_TI1SEL_2 /*!< TIM3_TI1 is connected to HSE 1MHZ */
  1303. #endif /* STM32H503xx */
  1304. #if defined(ETH_NS)
  1305. #define LL_TIM_TIM3_TI1_RMP_ETH_PPS TIM_TISEL_TI1SEL_0 /*!< TIM3_TI1 is connected to ETH PPS */
  1306. #endif /* ETH_NS */
  1307. #if defined(COMP1) && defined(COMP2)
  1308. #define LL_TIM_TIM3_TI1_RMP_COMP1 TIM_TISEL_TI1SEL_1 /*!< TIM3_TI1 is connected to COMP1 output */
  1309. #define LL_TIM_TIM3_TI1_RMP_COMP2 (TIM_TISEL_TI1SEL_1 | TIM_TISEL_TI1SEL_0) /*!< TIM3_TI1 is connected to COMP2 output */
  1310. #define LL_TIM_TIM3_TI1_RMP_PLAY1_OUT3 TIM_TISEL_TI1SEL_2 /*!< TIM3_TI1 is connected to PLAY1 output 3 */
  1311. #endif /* COMP1 && COMP2 */
  1312. /**
  1313. * @}
  1314. */
  1315. /** @defgroup TIM_LL_EC_TIM3_TI2_RMP TIM3 External Input Ch2 Remap
  1316. * @{
  1317. */
  1318. #define LL_TIM_TIM3_TI2_RMP_GPIO 0x00000000UL /*!< TIM3_TI2 is connected to GPIO */
  1319. #if defined(STM32H503xx)
  1320. #define LL_TIM_TIM3_TI2_RMP_CSI_128 TIM_TISEL_TI2SEL_0 /*!< TIM3_TI2 is connected to CSI 128 */
  1321. #define LL_TIM_TIM3_TI2_RMP_MCO2 TIM_TISEL_TI2SEL_1 /*!< TIM3_TI2 is connected to MCO2 */
  1322. #define LL_TIM_TIM3_TI2_RMP_HSI_1024 (TIM_TISEL_TI2SEL_1 |TIM_TISEL_TI2SEL_0) /*!< TIM3_TI2 is connected to HSI 1024 */
  1323. #endif /* STM32H503xx */
  1324. #if defined(COMP1) && defined(COMP2)
  1325. #define LL_TIM_TIM3_TI2_RMP_COMP1 TIM_TISEL_TI2SEL_0 /*!< TIM3_TI2 is connected to COMP1 output */
  1326. #define LL_TIM_TIM3_TI2_RMP_COMP2 TIM_TISEL_TI2SEL_1 /*!< TIM3_TI2 is connected to COMP2 output */
  1327. #endif /* COMP1 && COMP2 */
  1328. /**
  1329. * @}
  1330. */
  1331. #if defined(TIM4)
  1332. /** @defgroup TIM_LL_EC_TIM4_TI1_RMP TIM4 External Input Ch1 Remap
  1333. * @{
  1334. */
  1335. #define LL_TIM_TIM4_TI1_RMP_GPIO 0x00000000UL /*!< TIM4_TI1 is connected to GPIO */
  1336. #if defined(COMP1) && defined(COMP2)
  1337. #define LL_TIM_TIM4_TI1_RMP_COMP1 TIM_TISEL_TI1SEL_1 /*!< TIM4_TI1 is connected to COMP1 output */
  1338. #define LL_TIM_TIM4_TI1_RMP_COMP2 (TIM_TISEL_TI1SEL_1 | TIM_TISEL_TI1SEL_0) /*!< TIM4_TI1 is connected to COMP2 output */
  1339. #endif /* COMP1 && COMP2 */
  1340. /**
  1341. * @}
  1342. */
  1343. #endif /* TIM4 */
  1344. #if defined(TIM5)
  1345. /** @defgroup TIM_LL_EC_TIM5_TI1_RMP TIM5 External Input Ch1 Remap
  1346. * @{
  1347. */
  1348. #define LL_TIM_TIM5_TI1_RMP_GPIO 0x00000000UL /*!< TIM5_TI1 is connected to GPIO */
  1349. #if defined(COMP1) && defined(COMP2)
  1350. #define LL_TIM_TIM5_TI1_RMP_COMP1 TIM_TISEL_TI1SEL_1 /*!< TIM5_TI1 is connected to COMP1 output */
  1351. #define LL_TIM_TIM5_TI1_RMP_COMP2 (TIM_TISEL_TI1SEL_1 | TIM_TISEL_TI1SEL_0) /*!< TIM5_TI1 is connected to COMP2 output */
  1352. #endif /* COMP1 && COMP2 */
  1353. /**
  1354. * @}
  1355. */
  1356. #endif /* TIM5 */
  1357. #if defined(TIM8)
  1358. /** @defgroup TIM_LL_EC_TIM8_TI1_RMP TIM8 External Input Ch1 Remap
  1359. * @{
  1360. */
  1361. #define LL_TIM_TIM8_TI1_RMP_GPIO 0x00000000UL /*!< TIM8_TI1 is connected to GPIO */
  1362. #if defined(COMP1) && defined(COMP2)
  1363. #define LL_TIM_TIM8_TI1_RMP_COMP1 TIM_TISEL_TI1SEL_1 /*!< TIM8_TI1 is connected to COMP1 output */
  1364. #define LL_TIM_TIM8_TI1_RMP_COMP2 (TIM_TISEL_TI1SEL_1 | TIM_TISEL_TI1SEL_0) /*!< TIM8_TI1 is connected to COMP2 output */
  1365. #endif /* COMP1 && COMP2 */
  1366. /**
  1367. * @}
  1368. */
  1369. #endif /* TIM8 */
  1370. #if defined(TIM12)
  1371. /** @defgroup TIM_LL_EC_TIM12_TI1_RMP TIM12 External Input Ch1 Remap
  1372. * @{
  1373. */
  1374. #define LL_TIM_TIM12_TI1_RMP_GPIO 0x00000000UL /*!< TIM12_TI1 is connected to GPIO */
  1375. #if defined(COMP1) && defined(COMP2)
  1376. #define LL_TIM_TIM12_TI1_RMP_COMP1 TIM_TISEL_TI1SEL_1 /*!< TIM12_TI1 is connected to COMP1 output */
  1377. #define LL_TIM_TIM12_TI1_RMP_COMP2 (TIM_TISEL_TI1SEL_1 | TIM_TISEL_TI1SEL_0) /*!< TIM12_TI1 is connected to COMP2 output */
  1378. #endif /* COMP1 && COMP2 */
  1379. #define LL_TIM_TIM12_TI1_RMP_HSI_1024 TIM_TISEL_TI1SEL_2 /*!< TIM12_TI1 is connected to HSI 1024 */
  1380. #define LL_TIM_TIM12_TI1_RMP_CSI_128 (TIM_TISEL_TI1SEL_2 |TIM_TISEL_TI1SEL_0) /*!< TIM12_TI1 is connected to CSI 128 */
  1381. /**
  1382. * @}
  1383. */
  1384. /** @defgroup TIM_LL_EC_TIM12_TI2_RMP TIM12 External Input Ch2 Remap
  1385. * @{
  1386. */
  1387. #define LL_TIM_TIM12_TI2_RMP_GPIO 0x00000000UL /*!< TIM12_TI2 is connected to GPIO */
  1388. #if defined(COMP2)
  1389. #define LL_TIM_TIM12_TI2_RMP_COMP2 TIM_TISEL_TI2SEL_0 /*!< TIM12_TI2 is connected to COMP2 output */
  1390. #endif /* COMP2 */
  1391. /**
  1392. * @}
  1393. */
  1394. #endif /* TIM12 */
  1395. #if defined(TIM13)
  1396. /** @defgroup TIM_LL_EC_TIM13_TI1_RMP TIM13 External Input Ch1 Remap
  1397. * @{
  1398. */
  1399. #define LL_TIM_TIM13_TI1_RMP_GPIO 0x00000000UL /*!< TIM13_TI1 is connected to GPIO */
  1400. #if defined(I3C1)
  1401. #define LL_TIM_TIM13_TI1_RMP_I3C1_IBIACK TIM_TISEL_TI1SEL_0 /*!< TIM13_TI1 is connected to I3C1 IBI ACK */
  1402. #endif /* I3C1 */
  1403. #if defined(COMP1) && defined(COMP2)
  1404. #define LL_TIM_TIM13_TI1_RMP_COMP1 TIM_TISEL_TI1SEL_1 /*!< TIM13_TI1 is connected to COMP1 output */
  1405. #define LL_TIM_TIM13_TI1_RMP_COMP2 (TIM_TISEL_TI1SEL_1 | TIM_TISEL_TI1SEL_0) /*!< TIM13_TI1 is connected to COMP2 output */
  1406. #endif /* COMP1 && COMP2 */
  1407. /**
  1408. * @}
  1409. */
  1410. #endif /* TIM13 */
  1411. #if defined(TIM14)
  1412. /** @defgroup TIM_LL_EC_TIM14_TI1_RMP TIM14 External Input Ch1 Remap
  1413. * @{
  1414. */
  1415. #define LL_TIM_TIM14_TI1_RMP_GPIO 0x00000000UL /*!< TIM14_TI1 is connected to GPIO */
  1416. #if defined(I3C2)
  1417. #define LL_TIM_TIM14_TI1_RMP_I3C2_IBIACK TIM_TISEL_TI1SEL_0 /*!< TIM14_TI1 is connected to I3C2 IBI ACK */
  1418. #endif /* I3C1 */
  1419. #if defined(COMP1) && defined(COMP2)
  1420. #define LL_TIM_TIM14_TI1_RMP_COMP1 TIM_TISEL_TI1SEL_1 /*!< TIM14_TI1 is connected to COMP1 output */
  1421. #define LL_TIM_TIM14_TI1_RMP_COMP2 (TIM_TISEL_TI1SEL_1 | TIM_TISEL_TI1SEL_0) /*!< TIM14_TI1 is connected to COMP2 output */
  1422. #endif /* COMP1 && COMP2 */
  1423. /**
  1424. * @}
  1425. */
  1426. #endif /* TIM14 */
  1427. #if defined(TIM15)
  1428. /** @defgroup TIM_LL_EC_TIM15_TI1_RMP TIM15 External Input Ch1 Remap
  1429. * @{
  1430. */
  1431. #define LL_TIM_TIM15_TI1_RMP_GPIO 0x00000000UL /*!< TIM15_TI1 is connected to GPIO */
  1432. #define LL_TIM_TIM15_TI1_RMP_TIM2 TIM_TISEL_TI1SEL_0 /*!< TIM15_TI1 is connected to TIM2 */
  1433. #define LL_TIM_TIM15_TI1_RMP_TIM3 TIM_TISEL_TI1SEL_1 /*!< TIM15_TI1 is connected to TIM3 */
  1434. #define LL_TIM_TIM15_TI1_RMP_TIM4 (TIM_TISEL_TI1SEL_1 | TIM_TISEL_TI1SEL_0) /*!< TIM15_TI1 is connected to TIM4 */
  1435. #define LL_TIM_TIM15_TI1_RMP_LSE TIM_TISEL_TI1SEL_2 /*!< TIM15_TI1 is connected to LSE */
  1436. #define LL_TIM_TIM15_TI1_RMP_CSI_128 (TIM_TISEL_TI1SEL_2 |TIM_TISEL_TI1SEL_0) /*!< TIM15_TI1 is connected to CSI 128*/
  1437. #define LL_TIM_TIM15_TI1_RMP_MCO2 (TIM_TISEL_TI1SEL_2 |TIM_TISEL_TI1SEL_1) /*!< TIM15_TI1 is connected to MCO2 */
  1438. #if defined(COMP1) && defined(COMP2)
  1439. #define LL_TIM_TIM15_TI1_RMP_COMP1 TIM_TISEL_TI1SEL_3 /*!< TIM15_TI1 is connected to COMP1 output */
  1440. #define LL_TIM_TIM15_TI1_RMP_COMP2 (TIM_TISEL_TI1SEL_3 | TIM_TISEL_TI1SEL_0) /*!< TIM15_TI1 is connected to COMP2 output */
  1441. #endif /* COMP1 && COMP2 */
  1442. /**
  1443. * @}
  1444. */
  1445. /** @defgroup TIM_LL_EC_TIM15_TI2_RMP TIM15 External Input Ch2 Remap
  1446. * @{
  1447. */
  1448. #define LL_TIM_TIM15_TI2_RMP_GPIO 0x00000000UL /*!< TIM15_TI1 is connected to GPIO */
  1449. #define LL_TIM_TIM15_TI2_RMP_TIM2 TIM_TISEL_TI2SEL_0 /*!< TIM15_TI2 is connected to TIM2 */
  1450. #define LL_TIM_TIM15_TI2_RMP_TIM3 TIM_TISEL_TI2SEL_1 /*!< TIM15_TI2 is connected to TIM3 */
  1451. #define LL_TIM_TIM15_TI2_RMP_TIM4 (TIM_TISEL_TI2SEL_1 | TIM_TISEL_TI2SEL_0) /*!< TIM15_TI2 is connected to TIM4 */
  1452. #if defined(COMP1) && defined(COMP2)
  1453. #define LL_TIM_TIM15_TI2_RMP_COMP1 TIM_TISEL_TI2SEL_2 /*!< TIM15_TI2 is connected to COMP1 output */
  1454. #define LL_TIM_TIM15_TI2_RMP_COMP2 (TIM_TISEL_TI2SEL_2 | TIM_TISEL_TI2SEL_0) /*!< TIM15_TI2 is connected to COMP2 output */
  1455. #endif /* COMP1 && COMP2 */
  1456. /**
  1457. * @}
  1458. */
  1459. #endif /* TIM15 */
  1460. #if defined(TIM16)
  1461. /** @defgroup TIM_LL_EC_TIM16_TI1_RMP TIM16 External Input Ch1 Remap
  1462. * @{
  1463. */
  1464. #define LL_TIM_TIM16_TI1_RMP_GPIO 0x00000000UL /*!< TIM16_TI1 is connected to GPIO */
  1465. #define LL_TIM_TIM16_TI1_RMP_LSI TIM_TISEL_TI1SEL_0 /*!< TIM16_TI1 is connected to LSI */
  1466. #define LL_TIM_TIM16_TI1_RMP_LSE TIM_TISEL_TI1SEL_1 /*!< TIM16_TI1 is connected to LSE */
  1467. #define LL_TIM_TIM16_TI1_RMP_RTC_WKUP (TIM_TISEL_TI1SEL_1 | TIM_TISEL_TI1SEL_0) /*!< TIM16_TI1 is connected to RTC */
  1468. #if defined(COMP1) && defined(COMP2)
  1469. #define LL_TIM_TIM16_TI1_RMP_COMP1 TIM_TISEL_TI1SEL_3 /*!< TIM16_TI1 is connected to COMP1 output */
  1470. #define LL_TIM_TIM16_TI1_RMP_COMP2 (TIM_TISEL_TI1SEL_3 | TIM_TISEL_TI1SEL_0) /*!< TIM16_TI1 is connected to COMP2 output */
  1471. #endif /* COMP1 && COMP2 */
  1472. /**
  1473. * @}
  1474. */
  1475. #endif /* TIM16 */
  1476. #if defined(TIM17)
  1477. /** @defgroup TIM_LL_EC_TIM17_TI1_RMP TIM17 External Input Ch1 Remap
  1478. * @{
  1479. */
  1480. #define LL_TIM_TIM17_TI1_RMP_GPIO 0x00000000UL /*!< TIM17_TI1 is connected to GPIO */
  1481. #define LL_TIM_TIM17_TI1_RMP_HSE_1MHZ TIM_TISEL_TI1SEL_1 /*!< TIM17_TI1 is connected to HSE 1MHZ */
  1482. #define LL_TIM_TIM17_TI1_RMP_MCO1 (TIM_TISEL_TI1SEL_1 | TIM_TISEL_TI1SEL_0) /*!< TIM17_TI1 is connected to MCO1 */
  1483. #if defined(COMP1) && defined(COMP2)
  1484. #define LL_TIM_TIM17_TI1_RMP_COMP1 TIM_TISEL_TI1SEL_2 /*!< TIM17_TI1 is connected to COMP1 output */
  1485. #define LL_TIM_TIM17_TI1_RMP_COMP2 (TIM_TISEL_TI1SEL_2 | TIM_TISEL_TI1SEL_0) /*!< TIM17_TI1 is connected to COMP2 output */
  1486. #endif /* COMP1 && COMP2 */
  1487. /**
  1488. * @}
  1489. */
  1490. #endif /* TIM17 */
  1491. /** @defgroup TIM_LL_EC_OCREF_CLR_INT OCREF clear input selection
  1492. * @{
  1493. */
  1494. #define LL_TIM_OCREF_CLR_INT_ETR OCREF_CLEAR_SELECT_MSK /*!< OCREF_CLR_INT is connected to ETRF */
  1495. #if defined(COMP1) && defined(COMP2)
  1496. #define LL_TIM_OCREF_CLR_INT_COMP1 0x00000000U /*!< OCREF clear input is connected to COMP1_OUT */
  1497. #define LL_TIM_OCREF_CLR_INT_COMP2 TIM1_AF2_OCRSEL_0 /*!< OCREF clear input is connected to COMP2_OUT */
  1498. #endif /* COMP1 && COMP2 */
  1499. /**
  1500. * @}
  1501. */
  1502. /** @defgroup TIM_LL_EC_INDEX_DIR index direction selection
  1503. * @{
  1504. */
  1505. #define LL_TIM_INDEX_UP_DOWN 0x00000000U /*!< Index resets the counter whatever the direction */
  1506. #define LL_TIM_INDEX_UP TIM_ECR_IDIR_0 /*!< Index resets the counter when up-counting only */
  1507. #define LL_TIM_INDEX_DOWN TIM_ECR_IDIR_1 /*!< Index resets the counter when down-counting only */
  1508. /**
  1509. * @}
  1510. */
  1511. /** @defgroup TIM_LL_EC_INDEX_BLANK index blanking selection
  1512. * @{
  1513. */
  1514. #define LL_TIM_INDEX_BLANK_ALWAYS 0x00000000U /*!< Index always active */
  1515. #define LL_TIM_INDEX_BLANK_TI3 TIM_ECR_IBLK_0 /*!< Index disabled when TI3 input is active, as per CC3P bitfield */
  1516. #define LL_TIM_INDEX_BLANK_TI4 TIM_ECR_IBLK_1 /*!< Index disabled when TI4 input is active, as per CC4P bitfield */
  1517. /**
  1518. * @}
  1519. */
  1520. /** @defgroup TIM_LL_EC_INDEX_POSITION index positioning selection
  1521. * @{
  1522. */
  1523. #define LL_TIM_INDEX_POSITION_DOWN_DOWN 0x00000000U /*!< Index resets the counter when AB = 00 */
  1524. #define LL_TIM_INDEX_POSITION_DOWN_UP TIM_ECR_IPOS_0 /*!< Index resets the counter when AB = 01 */
  1525. #define LL_TIM_INDEX_POSITION_UP_DOWN TIM_ECR_IPOS_1 /*!< Index resets the counter when AB = 10 */
  1526. #define LL_TIM_INDEX_POSITION_UP_UP (TIM_ECR_IPOS_1 | TIM_ECR_IPOS_0) /*!< Index resets the counter when AB = 11 */
  1527. #define LL_TIM_INDEX_POSITION_DOWN 0x00000000U /*!< Index resets the counter when clock is 0 */
  1528. #define LL_TIM_INDEX_POSITION_UP TIM_ECR_IPOS_0 /*!< Index resets the counter when clock is 1 */
  1529. /**
  1530. * @}
  1531. */
  1532. /** @defgroup TIM_LL_EC_FIRST_INDEX first index selection
  1533. * @{
  1534. */
  1535. #define LL_TIM_INDEX_ALL 0x00000000U /*!< Index is always active */
  1536. #define LL_TIM_INDEX_FIRST_ONLY TIM_ECR_FIDX /*!< The first Index only resets the counter */
  1537. /**
  1538. * @}
  1539. */
  1540. /** @defgroup TIM_LL_EC_PWPRSC Pulse on compare pulse width prescaler
  1541. * @{
  1542. */
  1543. #define LL_TIM_PWPRSC_X1 0x00000000U /*!< Pulse on compare pulse width prescaler 1 */
  1544. #define LL_TIM_PWPRSC_X2 TIM_ECR_PWPRSC_0 /*!< Pulse on compare pulse width prescaler 2 */
  1545. #define LL_TIM_PWPRSC_X4 TIM_ECR_PWPRSC_1 /*!< Pulse on compare pulse width prescaler 4 */
  1546. #define LL_TIM_PWPRSC_X8 (TIM_ECR_PWPRSC_1 | TIM_ECR_PWPRSC_0) /*!< Pulse on compare pulse width prescaler 8 */
  1547. #define LL_TIM_PWPRSC_X16 TIM_ECR_PWPRSC_2 /*!< Pulse on compare pulse width prescaler 16 */
  1548. #define LL_TIM_PWPRSC_X32 (TIM_ECR_PWPRSC_2 | TIM_ECR_PWPRSC_0) /*!< Pulse on compare pulse width prescaler 32 */
  1549. #define LL_TIM_PWPRSC_X64 (TIM_ECR_PWPRSC_2 | TIM_ECR_PWPRSC_1) /*!< Pulse on compare pulse width prescaler 64 */
  1550. #define LL_TIM_PWPRSC_X128 (TIM_ECR_PWPRSC_2 | TIM_ECR_PWPRSC_1 | TIM_ECR_PWPRSC_0) /*!< Pulse on compare pulse width prescaler 128 */
  1551. /**
  1552. * @}
  1553. */
  1554. /** Legacy definitions for compatibility purpose
  1555. @cond 0
  1556. */
  1557. #define LL_TIM_BKIN_SOURCE_DFBK LL_TIM_BKIN_SOURCE_DF1BK
  1558. /**
  1559. @endcond
  1560. */
  1561. /**
  1562. * @}
  1563. */
  1564. /* Exported macro ------------------------------------------------------------*/
  1565. /** @defgroup TIM_LL_Exported_Macros TIM Exported Macros
  1566. * @{
  1567. */
  1568. /** @defgroup TIM_LL_EM_WRITE_READ Common Write and read registers Macros
  1569. * @{
  1570. */
  1571. /**
  1572. * @brief Write a value in TIM register.
  1573. * @param __INSTANCE__ TIM Instance
  1574. * @param __REG__ Register to be written
  1575. * @param __VALUE__ Value to be written in the register
  1576. * @retval None
  1577. */
  1578. #define LL_TIM_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG((__INSTANCE__)->__REG__, (__VALUE__))
  1579. /**
  1580. * @brief Read a value in TIM register.
  1581. * @param __INSTANCE__ TIM Instance
  1582. * @param __REG__ Register to be read
  1583. * @retval Register value
  1584. */
  1585. #define LL_TIM_ReadReg(__INSTANCE__, __REG__) READ_REG((__INSTANCE__)->__REG__)
  1586. /**
  1587. * @}
  1588. */
  1589. /**
  1590. * @brief HELPER macro retrieving the UIFCPY flag from the counter value.
  1591. * @note ex: @ref __LL_TIM_GETFLAG_UIFCPY (@ref LL_TIM_GetCounter ());
  1592. * @note Relevant only if UIF flag remapping has been enabled (UIF status bit is copied
  1593. * to TIMx_CNT register bit 31)
  1594. * @param __CNT__ Counter value
  1595. * @retval UIF status bit
  1596. */
  1597. #define __LL_TIM_GETFLAG_UIFCPY(__CNT__) \
  1598. (READ_BIT((__CNT__), TIM_CNT_UIFCPY) >> TIM_CNT_UIFCPY_Pos)
  1599. /**
  1600. * @brief HELPER macro calculating DTG[0:7] in the TIMx_BDTR register to achieve the requested dead time duration.
  1601. * @note ex: @ref __LL_TIM_CALC_DEADTIME (80000000, @ref LL_TIM_GetClockDivision (), 120);
  1602. * @param __TIMCLK__ timer input clock frequency (in Hz)
  1603. * @param __CKD__ This parameter can be one of the following values:
  1604. * @arg @ref LL_TIM_CLOCKDIVISION_DIV1
  1605. * @arg @ref LL_TIM_CLOCKDIVISION_DIV2
  1606. * @arg @ref LL_TIM_CLOCKDIVISION_DIV4
  1607. * @param __DT__ deadtime duration (in ns)
  1608. * @retval DTG[0:7]
  1609. */
  1610. #define __LL_TIM_CALC_DEADTIME(__TIMCLK__, __CKD__, __DT__) \
  1611. ( (((uint64_t)((__DT__)*1000U)) < ((DT_DELAY_1+1U) * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? \
  1612. (uint8_t)(((uint64_t)((__DT__)*1000U) / TIM_CALC_DTS((__TIMCLK__), (__CKD__))) & DT_DELAY_1) : \
  1613. (((uint64_t)((__DT__)*1000U)) < ((64U + (DT_DELAY_2+1U)) * 2U * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? \
  1614. (uint8_t)(DT_RANGE_2 | ((uint8_t)((uint8_t)((((uint64_t)((__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), \
  1615. (__CKD__))) >> 1U) - (uint8_t) 64) & DT_DELAY_2)) :\
  1616. (((uint64_t)((__DT__)*1000U)) < ((32U + (DT_DELAY_3+1U)) * 8U * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? \
  1617. (uint8_t)(DT_RANGE_3 | ((uint8_t)((uint8_t)(((((uint64_t)(__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), \
  1618. (__CKD__))) >> 3U) - (uint8_t) 32) & DT_DELAY_3)) :\
  1619. (((uint64_t)((__DT__)*1000U)) < ((32U + (DT_DELAY_4+1U)) * 16U * TIM_CALC_DTS((__TIMCLK__), (__CKD__)))) ? \
  1620. (uint8_t)(DT_RANGE_4 | ((uint8_t)((uint8_t)(((((uint64_t)(__DT__)*1000U))/ TIM_CALC_DTS((__TIMCLK__), \
  1621. (__CKD__))) >> 4U) - (uint8_t) 32) & DT_DELAY_4)) :\
  1622. 0U)
  1623. /**
  1624. * @brief HELPER macro calculating the prescaler value to achieve the required counter clock frequency.
  1625. * @note ex: @ref __LL_TIM_CALC_PSC (80000000, 1000000);
  1626. * @param __TIMCLK__ timer input clock frequency (in Hz)
  1627. * @param __CNTCLK__ counter clock frequency (in Hz)
  1628. * @retval Prescaler value (between Min_Data=0 and Max_Data=65535)
  1629. */
  1630. #define __LL_TIM_CALC_PSC(__TIMCLK__, __CNTCLK__) \
  1631. (((__TIMCLK__) >= (__CNTCLK__)) ? (uint32_t)((((__TIMCLK__) + (__CNTCLK__)/2U)/(__CNTCLK__)) - 1U) : 0U)
  1632. /**
  1633. * @brief HELPER macro calculating the auto-reload value to achieve the required output signal frequency.
  1634. * @note ex: @ref __LL_TIM_CALC_ARR (1000000, @ref LL_TIM_GetPrescaler (), 10000);
  1635. * @param __TIMCLK__ timer input clock frequency (in Hz)
  1636. * @param __PSC__ prescaler
  1637. * @param __FREQ__ output signal frequency (in Hz)
  1638. * @retval Auto-reload value (between Min_Data=0 and Max_Data=65535)
  1639. */
  1640. #define __LL_TIM_CALC_ARR(__TIMCLK__, __PSC__, __FREQ__) \
  1641. ((((__TIMCLK__)/((__PSC__) + 1U)) >= (__FREQ__)) ? (((__TIMCLK__)/((__FREQ__) * ((__PSC__) + 1U))) - 1U) : 0U)
  1642. /**
  1643. * @brief HELPER macro calculating the auto-reload value, with dithering feature enabled, to achieve the required
  1644. * output signal frequency.
  1645. * @note ex: @ref __LL_TIM_CALC_ARR_DITHER (1000000, @ref LL_TIM_GetPrescaler (), 10000);
  1646. * @param __TIMCLK__ timer input clock frequency (in Hz)
  1647. * @param __PSC__ prescaler
  1648. * @param __FREQ__ output signal frequency (in Hz)
  1649. * @retval Auto-reload value (between Min_Data=0 and Max_Data=65535)
  1650. */
  1651. #define __LL_TIM_CALC_ARR_DITHER(__TIMCLK__, __PSC__, __FREQ__) \
  1652. ((((__TIMCLK__)/((__PSC__) + 1U)) >= (__FREQ__)) ? \
  1653. (uint32_t)((((uint64_t)(__TIMCLK__) * 16U/((__FREQ__) * ((__PSC__) + 1U))) - 16U)) : 0U)
  1654. /**
  1655. * @brief HELPER macro calculating the compare value required to achieve the required timer output compare
  1656. * active/inactive delay.
  1657. * @note ex: @ref __LL_TIM_CALC_DELAY (1000000, @ref LL_TIM_GetPrescaler (), 10);
  1658. * @param __TIMCLK__ timer input clock frequency (in Hz)
  1659. * @param __PSC__ prescaler
  1660. * @param __DELAY__ timer output compare active/inactive delay (in us)
  1661. * @retval Compare value (between Min_Data=0 and Max_Data=65535)
  1662. */
  1663. #define __LL_TIM_CALC_DELAY(__TIMCLK__, __PSC__, __DELAY__) \
  1664. ((uint32_t)(((uint64_t)(__TIMCLK__) * (uint64_t)(__DELAY__)) \
  1665. / ((uint64_t)1000000U * (uint64_t)((__PSC__) + 1U))))
  1666. /**
  1667. * @brief HELPER macro calculating the compare value, with dithering feature enabled, to achieve the required timer
  1668. * output compare active/inactive delay.
  1669. * @note ex: @ref __LL_TIM_CALC_DELAY_DITHER (1000000, @ref LL_TIM_GetPrescaler (), 10);
  1670. * @param __TIMCLK__ timer input clock frequency (in Hz)
  1671. * @param __PSC__ prescaler
  1672. * @param __DELAY__ timer output compare active/inactive delay (in us)
  1673. * @retval Compare value (between Min_Data=0 and Max_Data=65535)
  1674. */
  1675. #define __LL_TIM_CALC_DELAY_DITHER(__TIMCLK__, __PSC__, __DELAY__) \
  1676. ((uint32_t)(((uint64_t)(__TIMCLK__) * (uint64_t)(__DELAY__) * 16U) \
  1677. / ((uint64_t)1000000U * (uint64_t)((__PSC__) + 1U))))
  1678. /**
  1679. * @brief HELPER macro calculating the auto-reload value to achieve the required pulse duration
  1680. * (when the timer operates in one pulse mode).
  1681. * @note ex: @ref __LL_TIM_CALC_PULSE (1000000, @ref LL_TIM_GetPrescaler (), 10, 20);
  1682. * @param __TIMCLK__ timer input clock frequency (in Hz)
  1683. * @param __PSC__ prescaler
  1684. * @param __DELAY__ timer output compare active/inactive delay (in us)
  1685. * @param __PULSE__ pulse duration (in us)
  1686. * @retval Auto-reload value (between Min_Data=0 and Max_Data=65535)
  1687. */
  1688. #define __LL_TIM_CALC_PULSE(__TIMCLK__, __PSC__, __DELAY__, __PULSE__) \
  1689. ((uint32_t)(__LL_TIM_CALC_DELAY((__TIMCLK__), (__PSC__), (__PULSE__)) \
  1690. + __LL_TIM_CALC_DELAY((__TIMCLK__), (__PSC__), (__DELAY__))))
  1691. /**
  1692. * @brief HELPER macro calculating the auto-reload value, with dithering feature enabled, to achieve the required
  1693. * pulse duration (when the timer operates in one pulse mode).
  1694. * @note ex: @ref __LL_TIM_CALC_PULSE_DITHER (1000000, @ref LL_TIM_GetPrescaler (), 10, 20);
  1695. * @param __TIMCLK__ timer input clock frequency (in Hz)
  1696. * @param __PSC__ prescaler
  1697. * @param __DELAY__ timer output compare active/inactive delay (in us)
  1698. * @param __PULSE__ pulse duration (in us)
  1699. * @retval Auto-reload value (between Min_Data=0 and Max_Data=65535)
  1700. */
  1701. #define __LL_TIM_CALC_PULSE_DITHER(__TIMCLK__, __PSC__, __DELAY__, __PULSE__) \
  1702. ((uint32_t)(__LL_TIM_CALC_DELAY_DITHER((__TIMCLK__), (__PSC__), (__PULSE__)) \
  1703. + __LL_TIM_CALC_DELAY_DITHER((__TIMCLK__), (__PSC__), (__DELAY__))))
  1704. /**
  1705. * @brief HELPER macro retrieving the ratio of the input capture prescaler
  1706. * @note ex: @ref __LL_TIM_GET_ICPSC_RATIO (@ref LL_TIM_IC_GetPrescaler ());
  1707. * @param __ICPSC__ This parameter can be one of the following values:
  1708. * @arg @ref LL_TIM_ICPSC_DIV1
  1709. * @arg @ref LL_TIM_ICPSC_DIV2
  1710. * @arg @ref LL_TIM_ICPSC_DIV4
  1711. * @arg @ref LL_TIM_ICPSC_DIV8
  1712. * @retval Input capture prescaler ratio (1, 2, 4 or 8)
  1713. */
  1714. #define __LL_TIM_GET_ICPSC_RATIO(__ICPSC__) \
  1715. ((uint32_t)(0x01U << (((__ICPSC__) >> 16U) >> TIM_CCMR1_IC1PSC_Pos)))
  1716. /**
  1717. * @}
  1718. */
  1719. /* Exported functions --------------------------------------------------------*/
  1720. /** @defgroup TIM_LL_Exported_Functions TIM Exported Functions
  1721. * @{
  1722. */
  1723. /** @defgroup TIM_LL_EF_Time_Base Time Base configuration
  1724. * @{
  1725. */
  1726. /**
  1727. * @brief Enable timer counter.
  1728. * @rmtoll CR1 CEN LL_TIM_EnableCounter
  1729. * @param TIMx Timer instance
  1730. * @retval None
  1731. */
  1732. __STATIC_INLINE void LL_TIM_EnableCounter(TIM_TypeDef *TIMx)
  1733. {
  1734. SET_BIT(TIMx->CR1, TIM_CR1_CEN);
  1735. }
  1736. /**
  1737. * @brief Disable timer counter.
  1738. * @rmtoll CR1 CEN LL_TIM_DisableCounter
  1739. * @param TIMx Timer instance
  1740. * @retval None
  1741. */
  1742. __STATIC_INLINE void LL_TIM_DisableCounter(TIM_TypeDef *TIMx)
  1743. {
  1744. CLEAR_BIT(TIMx->CR1, TIM_CR1_CEN);
  1745. }
  1746. /**
  1747. * @brief Indicates whether the timer counter is enabled.
  1748. * @rmtoll CR1 CEN LL_TIM_IsEnabledCounter
  1749. * @param TIMx Timer instance
  1750. * @retval State of bit (1 or 0).
  1751. */
  1752. __STATIC_INLINE uint32_t LL_TIM_IsEnabledCounter(const TIM_TypeDef *TIMx)
  1753. {
  1754. return ((READ_BIT(TIMx->CR1, TIM_CR1_CEN) == (TIM_CR1_CEN)) ? 1UL : 0UL);
  1755. }
  1756. /**
  1757. * @brief Enable update event generation.
  1758. * @rmtoll CR1 UDIS LL_TIM_EnableUpdateEvent
  1759. * @param TIMx Timer instance
  1760. * @retval None
  1761. */
  1762. __STATIC_INLINE void LL_TIM_EnableUpdateEvent(TIM_TypeDef *TIMx)
  1763. {
  1764. CLEAR_BIT(TIMx->CR1, TIM_CR1_UDIS);
  1765. }
  1766. /**
  1767. * @brief Disable update event generation.
  1768. * @rmtoll CR1 UDIS LL_TIM_DisableUpdateEvent
  1769. * @param TIMx Timer instance
  1770. * @retval None
  1771. */
  1772. __STATIC_INLINE void LL_TIM_DisableUpdateEvent(TIM_TypeDef *TIMx)
  1773. {
  1774. SET_BIT(TIMx->CR1, TIM_CR1_UDIS);
  1775. }
  1776. /**
  1777. * @brief Indicates whether update event generation is enabled.
  1778. * @rmtoll CR1 UDIS LL_TIM_IsEnabledUpdateEvent
  1779. * @param TIMx Timer instance
  1780. * @retval Inverted state of bit (0 or 1).
  1781. */
  1782. __STATIC_INLINE uint32_t LL_TIM_IsEnabledUpdateEvent(const TIM_TypeDef *TIMx)
  1783. {
  1784. return ((READ_BIT(TIMx->CR1, TIM_CR1_UDIS) == (uint32_t)RESET) ? 1UL : 0UL);
  1785. }
  1786. /**
  1787. * @brief Set update event source
  1788. * @note Update event source set to LL_TIM_UPDATESOURCE_REGULAR: any of the following events
  1789. * generate an update interrupt or DMA request if enabled:
  1790. * - Counter overflow/underflow
  1791. * - Setting the UG bit
  1792. * - Update generation through the slave mode controller
  1793. * @note Update event source set to LL_TIM_UPDATESOURCE_COUNTER: only counter
  1794. * overflow/underflow generates an update interrupt or DMA request if enabled.
  1795. * @rmtoll CR1 URS LL_TIM_SetUpdateSource
  1796. * @param TIMx Timer instance
  1797. * @param UpdateSource This parameter can be one of the following values:
  1798. * @arg @ref LL_TIM_UPDATESOURCE_REGULAR
  1799. * @arg @ref LL_TIM_UPDATESOURCE_COUNTER
  1800. * @retval None
  1801. */
  1802. __STATIC_INLINE void LL_TIM_SetUpdateSource(TIM_TypeDef *TIMx, uint32_t UpdateSource)
  1803. {
  1804. MODIFY_REG(TIMx->CR1, TIM_CR1_URS, UpdateSource);
  1805. }
  1806. /**
  1807. * @brief Get actual event update source
  1808. * @rmtoll CR1 URS LL_TIM_GetUpdateSource
  1809. * @param TIMx Timer instance
  1810. * @retval Returned value can be one of the following values:
  1811. * @arg @ref LL_TIM_UPDATESOURCE_REGULAR
  1812. * @arg @ref LL_TIM_UPDATESOURCE_COUNTER
  1813. */
  1814. __STATIC_INLINE uint32_t LL_TIM_GetUpdateSource(const TIM_TypeDef *TIMx)
  1815. {
  1816. return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_URS));
  1817. }
  1818. /**
  1819. * @brief Set one pulse mode (one shot v.s. repetitive).
  1820. * @rmtoll CR1 OPM LL_TIM_SetOnePulseMode
  1821. * @param TIMx Timer instance
  1822. * @param OnePulseMode This parameter can be one of the following values:
  1823. * @arg @ref LL_TIM_ONEPULSEMODE_SINGLE
  1824. * @arg @ref LL_TIM_ONEPULSEMODE_REPETITIVE
  1825. * @retval None
  1826. */
  1827. __STATIC_INLINE void LL_TIM_SetOnePulseMode(TIM_TypeDef *TIMx, uint32_t OnePulseMode)
  1828. {
  1829. MODIFY_REG(TIMx->CR1, TIM_CR1_OPM, OnePulseMode);
  1830. }
  1831. /**
  1832. * @brief Get actual one pulse mode.
  1833. * @rmtoll CR1 OPM LL_TIM_GetOnePulseMode
  1834. * @param TIMx Timer instance
  1835. * @retval Returned value can be one of the following values:
  1836. * @arg @ref LL_TIM_ONEPULSEMODE_SINGLE
  1837. * @arg @ref LL_TIM_ONEPULSEMODE_REPETITIVE
  1838. */
  1839. __STATIC_INLINE uint32_t LL_TIM_GetOnePulseMode(const TIM_TypeDef *TIMx)
  1840. {
  1841. return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_OPM));
  1842. }
  1843. /**
  1844. * @brief Set the timer counter counting mode.
  1845. * @note Macro IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx) can be used to
  1846. * check whether or not the counter mode selection feature is supported
  1847. * by a timer instance.
  1848. * @note Switching from Center Aligned counter mode to Edge counter mode (or reverse)
  1849. * requires a timer reset to avoid unexpected direction
  1850. * due to DIR bit readonly in center aligned mode.
  1851. * @rmtoll CR1 DIR LL_TIM_SetCounterMode\n
  1852. * CR1 CMS LL_TIM_SetCounterMode
  1853. * @param TIMx Timer instance
  1854. * @param CounterMode This parameter can be one of the following values:
  1855. * @arg @ref LL_TIM_COUNTERMODE_UP
  1856. * @arg @ref LL_TIM_COUNTERMODE_DOWN
  1857. * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP
  1858. * @arg @ref LL_TIM_COUNTERMODE_CENTER_DOWN
  1859. * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP_DOWN
  1860. * @retval None
  1861. */
  1862. __STATIC_INLINE void LL_TIM_SetCounterMode(TIM_TypeDef *TIMx, uint32_t CounterMode)
  1863. {
  1864. MODIFY_REG(TIMx->CR1, (TIM_CR1_DIR | TIM_CR1_CMS), CounterMode);
  1865. }
  1866. /**
  1867. * @brief Get actual counter mode.
  1868. * @note Macro IS_TIM_COUNTER_MODE_SELECT_INSTANCE(TIMx) can be used to
  1869. * check whether or not the counter mode selection feature is supported
  1870. * by a timer instance.
  1871. * @rmtoll CR1 DIR LL_TIM_GetCounterMode\n
  1872. * CR1 CMS LL_TIM_GetCounterMode
  1873. * @param TIMx Timer instance
  1874. * @retval Returned value can be one of the following values:
  1875. * @arg @ref LL_TIM_COUNTERMODE_UP
  1876. * @arg @ref LL_TIM_COUNTERMODE_DOWN
  1877. * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP
  1878. * @arg @ref LL_TIM_COUNTERMODE_CENTER_DOWN
  1879. * @arg @ref LL_TIM_COUNTERMODE_CENTER_UP_DOWN
  1880. */
  1881. __STATIC_INLINE uint32_t LL_TIM_GetCounterMode(const TIM_TypeDef *TIMx)
  1882. {
  1883. uint32_t counter_mode;
  1884. counter_mode = (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_CMS));
  1885. if (counter_mode == 0U)
  1886. {
  1887. counter_mode = (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_DIR));
  1888. }
  1889. return counter_mode;
  1890. }
  1891. /**
  1892. * @brief Enable auto-reload (ARR) preload.
  1893. * @rmtoll CR1 ARPE LL_TIM_EnableARRPreload
  1894. * @param TIMx Timer instance
  1895. * @retval None
  1896. */
  1897. __STATIC_INLINE void LL_TIM_EnableARRPreload(TIM_TypeDef *TIMx)
  1898. {
  1899. SET_BIT(TIMx->CR1, TIM_CR1_ARPE);
  1900. }
  1901. /**
  1902. * @brief Disable auto-reload (ARR) preload.
  1903. * @rmtoll CR1 ARPE LL_TIM_DisableARRPreload
  1904. * @param TIMx Timer instance
  1905. * @retval None
  1906. */
  1907. __STATIC_INLINE void LL_TIM_DisableARRPreload(TIM_TypeDef *TIMx)
  1908. {
  1909. CLEAR_BIT(TIMx->CR1, TIM_CR1_ARPE);
  1910. }
  1911. /**
  1912. * @brief Indicates whether auto-reload (ARR) preload is enabled.
  1913. * @rmtoll CR1 ARPE LL_TIM_IsEnabledARRPreload
  1914. * @param TIMx Timer instance
  1915. * @retval State of bit (1 or 0).
  1916. */
  1917. __STATIC_INLINE uint32_t LL_TIM_IsEnabledARRPreload(const TIM_TypeDef *TIMx)
  1918. {
  1919. return ((READ_BIT(TIMx->CR1, TIM_CR1_ARPE) == (TIM_CR1_ARPE)) ? 1UL : 0UL);
  1920. }
  1921. /**
  1922. * @brief Set the division ratio between the timer clock and the sampling clock used by the dead-time generators
  1923. * (when supported) and the digital filters.
  1924. * @note Macro IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check
  1925. * whether or not the clock division feature is supported by the timer
  1926. * instance.
  1927. * @rmtoll CR1 CKD LL_TIM_SetClockDivision
  1928. * @param TIMx Timer instance
  1929. * @param ClockDivision This parameter can be one of the following values:
  1930. * @arg @ref LL_TIM_CLOCKDIVISION_DIV1
  1931. * @arg @ref LL_TIM_CLOCKDIVISION_DIV2
  1932. * @arg @ref LL_TIM_CLOCKDIVISION_DIV4
  1933. * @retval None
  1934. */
  1935. __STATIC_INLINE void LL_TIM_SetClockDivision(TIM_TypeDef *TIMx, uint32_t ClockDivision)
  1936. {
  1937. MODIFY_REG(TIMx->CR1, TIM_CR1_CKD, ClockDivision);
  1938. }
  1939. /**
  1940. * @brief Get the actual division ratio between the timer clock and the sampling clock used by the dead-time
  1941. * generators (when supported) and the digital filters.
  1942. * @note Macro IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check
  1943. * whether or not the clock division feature is supported by the timer
  1944. * instance.
  1945. * @rmtoll CR1 CKD LL_TIM_GetClockDivision
  1946. * @param TIMx Timer instance
  1947. * @retval Returned value can be one of the following values:
  1948. * @arg @ref LL_TIM_CLOCKDIVISION_DIV1
  1949. * @arg @ref LL_TIM_CLOCKDIVISION_DIV2
  1950. * @arg @ref LL_TIM_CLOCKDIVISION_DIV4
  1951. */
  1952. __STATIC_INLINE uint32_t LL_TIM_GetClockDivision(const TIM_TypeDef *TIMx)
  1953. {
  1954. return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_CKD));
  1955. }
  1956. /**
  1957. * @brief Set the counter value.
  1958. * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check
  1959. * whether or not a timer instance supports a 32 bits counter.
  1960. * @note If dithering is activated, pay attention to the Counter value interpretation
  1961. * @rmtoll CNT CNT LL_TIM_SetCounter
  1962. * @param TIMx Timer instance
  1963. * @param Counter Counter value (between Min_Data=0 and Max_Data=0xFFFF or 0xFFFFFFFF)
  1964. * @retval None
  1965. */
  1966. __STATIC_INLINE void LL_TIM_SetCounter(TIM_TypeDef *TIMx, uint32_t Counter)
  1967. {
  1968. WRITE_REG(TIMx->CNT, Counter);
  1969. }
  1970. /**
  1971. * @brief Get the counter value.
  1972. * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check
  1973. * whether or not a timer instance supports a 32 bits counter.
  1974. * @note If dithering is activated, pay attention to the Counter value interpretation
  1975. * @rmtoll CNT CNT LL_TIM_GetCounter
  1976. * @param TIMx Timer instance
  1977. * @retval Counter value (between Min_Data=0 and Max_Data=0xFFFF or 0xFFFFFFFF)
  1978. */
  1979. __STATIC_INLINE uint32_t LL_TIM_GetCounter(const TIM_TypeDef *TIMx)
  1980. {
  1981. return (uint32_t)(READ_REG(TIMx->CNT));
  1982. }
  1983. /**
  1984. * @brief Get the current direction of the counter
  1985. * @rmtoll CR1 DIR LL_TIM_GetDirection
  1986. * @param TIMx Timer instance
  1987. * @retval Returned value can be one of the following values:
  1988. * @arg @ref LL_TIM_COUNTERDIRECTION_UP
  1989. * @arg @ref LL_TIM_COUNTERDIRECTION_DOWN
  1990. */
  1991. __STATIC_INLINE uint32_t LL_TIM_GetDirection(const TIM_TypeDef *TIMx)
  1992. {
  1993. return (uint32_t)(READ_BIT(TIMx->CR1, TIM_CR1_DIR));
  1994. }
  1995. /**
  1996. * @brief Set the prescaler value.
  1997. * @note The counter clock frequency CK_CNT is equal to fCK_PSC / (PSC[15:0] + 1).
  1998. * @note The prescaler can be changed on the fly as this control register is buffered. The new
  1999. * prescaler ratio is taken into account at the next update event.
  2000. * @note Helper macro @ref __LL_TIM_CALC_PSC can be used to calculate the Prescaler parameter
  2001. * @rmtoll PSC PSC LL_TIM_SetPrescaler
  2002. * @param TIMx Timer instance
  2003. * @param Prescaler between Min_Data=0 and Max_Data=65535
  2004. * @retval None
  2005. */
  2006. __STATIC_INLINE void LL_TIM_SetPrescaler(TIM_TypeDef *TIMx, uint32_t Prescaler)
  2007. {
  2008. WRITE_REG(TIMx->PSC, Prescaler);
  2009. }
  2010. /**
  2011. * @brief Get the prescaler value.
  2012. * @rmtoll PSC PSC LL_TIM_GetPrescaler
  2013. * @param TIMx Timer instance
  2014. * @retval Prescaler value between Min_Data=0 and Max_Data=65535
  2015. */
  2016. __STATIC_INLINE uint32_t LL_TIM_GetPrescaler(const TIM_TypeDef *TIMx)
  2017. {
  2018. return (uint32_t)(READ_REG(TIMx->PSC));
  2019. }
  2020. /**
  2021. * @brief Set the auto-reload value.
  2022. * @note The counter is blocked while the auto-reload value is null.
  2023. * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check
  2024. * whether or not a timer instance supports a 32 bits counter.
  2025. * @note Helper macro @ref __LL_TIM_CALC_ARR can be used to calculate the AutoReload parameter
  2026. * In case dithering is activated,macro __LL_TIM_CALC_ARR_DITHER can be used instead, to calculate the AutoReload
  2027. * parameter.
  2028. * @rmtoll ARR ARR LL_TIM_SetAutoReload
  2029. * @param TIMx Timer instance
  2030. * @param AutoReload between Min_Data=0 and Max_Data=65535
  2031. * @retval None
  2032. */
  2033. __STATIC_INLINE void LL_TIM_SetAutoReload(TIM_TypeDef *TIMx, uint32_t AutoReload)
  2034. {
  2035. WRITE_REG(TIMx->ARR, AutoReload);
  2036. }
  2037. /**
  2038. * @brief Get the auto-reload value.
  2039. * @rmtoll ARR ARR LL_TIM_GetAutoReload
  2040. * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check
  2041. * whether or not a timer instance supports a 32 bits counter.
  2042. * @note If dithering is activated, pay attention to the returned value interpretation
  2043. * @param TIMx Timer instance
  2044. * @retval Auto-reload value
  2045. */
  2046. __STATIC_INLINE uint32_t LL_TIM_GetAutoReload(const TIM_TypeDef *TIMx)
  2047. {
  2048. return (uint32_t)(READ_REG(TIMx->ARR));
  2049. }
  2050. /**
  2051. * @brief Set the repetition counter value.
  2052. * @note For advanced timer instances RepetitionCounter can be up to 65535.
  2053. * @note Macro IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx) can be used to check
  2054. * whether or not a timer instance supports a repetition counter.
  2055. * @rmtoll RCR REP LL_TIM_SetRepetitionCounter
  2056. * @param TIMx Timer instance
  2057. * @param RepetitionCounter between Min_Data=0 and Max_Data=255 or 65535 for advanced timer.
  2058. * @retval None
  2059. */
  2060. __STATIC_INLINE void LL_TIM_SetRepetitionCounter(TIM_TypeDef *TIMx, uint32_t RepetitionCounter)
  2061. {
  2062. WRITE_REG(TIMx->RCR, RepetitionCounter);
  2063. }
  2064. /**
  2065. * @brief Get the repetition counter value.
  2066. * @note Macro IS_TIM_REPETITION_COUNTER_INSTANCE(TIMx) can be used to check
  2067. * whether or not a timer instance supports a repetition counter.
  2068. * @rmtoll RCR REP LL_TIM_GetRepetitionCounter
  2069. * @param TIMx Timer instance
  2070. * @retval Repetition counter value
  2071. */
  2072. __STATIC_INLINE uint32_t LL_TIM_GetRepetitionCounter(const TIM_TypeDef *TIMx)
  2073. {
  2074. return (uint32_t)(READ_REG(TIMx->RCR));
  2075. }
  2076. /**
  2077. * @brief Force a continuous copy of the update interrupt flag (UIF) into the timer counter register (bit 31).
  2078. * @note This allows both the counter value and a potential roll-over condition signalled by the UIFCPY flag to be read
  2079. * in an atomic way.
  2080. * @rmtoll CR1 UIFREMAP LL_TIM_EnableUIFRemap
  2081. * @param TIMx Timer instance
  2082. * @retval None
  2083. */
  2084. __STATIC_INLINE void LL_TIM_EnableUIFRemap(TIM_TypeDef *TIMx)
  2085. {
  2086. SET_BIT(TIMx->CR1, TIM_CR1_UIFREMAP);
  2087. }
  2088. /**
  2089. * @brief Disable update interrupt flag (UIF) remapping.
  2090. * @rmtoll CR1 UIFREMAP LL_TIM_DisableUIFRemap
  2091. * @param TIMx Timer instance
  2092. * @retval None
  2093. */
  2094. __STATIC_INLINE void LL_TIM_DisableUIFRemap(TIM_TypeDef *TIMx)
  2095. {
  2096. CLEAR_BIT(TIMx->CR1, TIM_CR1_UIFREMAP);
  2097. }
  2098. /**
  2099. * @brief Indicate whether update interrupt flag (UIF) copy is set.
  2100. * @param Counter Counter value
  2101. * @retval State of bit (1 or 0).
  2102. */
  2103. __STATIC_INLINE uint32_t LL_TIM_IsActiveUIFCPY(const uint32_t Counter)
  2104. {
  2105. return (((Counter & TIM_CNT_UIFCPY) == (TIM_CNT_UIFCPY)) ? 1UL : 0UL);
  2106. }
  2107. /**
  2108. * @brief Enable dithering.
  2109. * @note Macro IS_TIM_DITHERING_INSTANCE(TIMx) can be used to check whether or not
  2110. * a timer instance provides dithering.
  2111. * @rmtoll CR1 DITHEN LL_TIM_EnableDithering
  2112. * @param TIMx Timer instance
  2113. * @retval None
  2114. */
  2115. __STATIC_INLINE void LL_TIM_EnableDithering(TIM_TypeDef *TIMx)
  2116. {
  2117. SET_BIT(TIMx->CR1, TIM_CR1_DITHEN);
  2118. }
  2119. /**
  2120. * @brief Disable dithering.
  2121. * @note Macro IS_TIM_DITHERING_INSTANCE(TIMx) can be used to check whether or not
  2122. * a timer instance provides dithering.
  2123. * @rmtoll CR1 DITHEN LL_TIM_DisableDithering
  2124. * @param TIMx Timer instance
  2125. * @retval None
  2126. */
  2127. __STATIC_INLINE void LL_TIM_DisableDithering(TIM_TypeDef *TIMx)
  2128. {
  2129. CLEAR_BIT(TIMx->CR1, TIM_CR1_DITHEN);
  2130. }
  2131. /**
  2132. * @brief Indicates whether dithering is activated.
  2133. * @note Macro IS_TIM_DITHERING_INSTANCE(TIMx) can be used to check whether or not
  2134. * a timer instance provides dithering.
  2135. * @rmtoll CR1 DITHEN LL_TIM_IsEnabledDithering
  2136. * @param TIMx Timer instance
  2137. * @retval State of bit (1 or 0).
  2138. */
  2139. __STATIC_INLINE uint32_t LL_TIM_IsEnabledDithering(const TIM_TypeDef *TIMx)
  2140. {
  2141. return ((READ_BIT(TIMx->CR1, TIM_CR1_DITHEN) == (TIM_CR1_DITHEN)) ? 1UL : 0UL);
  2142. }
  2143. /**
  2144. * @}
  2145. */
  2146. /** @defgroup TIM_LL_EF_Capture_Compare Capture Compare configuration
  2147. * @{
  2148. */
  2149. /**
  2150. * @brief Enable the capture/compare control bits (CCxE, CCxNE and OCxM) preload.
  2151. * @note CCxE, CCxNE and OCxM bits are preloaded, after having been written,
  2152. * they are updated only when a commutation event (COM) occurs.
  2153. * @note Only on channels that have a complementary output.
  2154. * @note Macro IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check
  2155. * whether or not a timer instance is able to generate a commutation event.
  2156. * @rmtoll CR2 CCPC LL_TIM_CC_EnablePreload
  2157. * @param TIMx Timer instance
  2158. * @retval None
  2159. */
  2160. __STATIC_INLINE void LL_TIM_CC_EnablePreload(TIM_TypeDef *TIMx)
  2161. {
  2162. SET_BIT(TIMx->CR2, TIM_CR2_CCPC);
  2163. }
  2164. /**
  2165. * @brief Disable the capture/compare control bits (CCxE, CCxNE and OCxM) preload.
  2166. * @note Macro IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check
  2167. * whether or not a timer instance is able to generate a commutation event.
  2168. * @rmtoll CR2 CCPC LL_TIM_CC_DisablePreload
  2169. * @param TIMx Timer instance
  2170. * @retval None
  2171. */
  2172. __STATIC_INLINE void LL_TIM_CC_DisablePreload(TIM_TypeDef *TIMx)
  2173. {
  2174. CLEAR_BIT(TIMx->CR2, TIM_CR2_CCPC);
  2175. }
  2176. /**
  2177. * @brief Indicates whether the capture/compare control bits (CCxE, CCxNE and OCxM) preload is enabled.
  2178. * @rmtoll CR2 CCPC LL_TIM_CC_IsEnabledPreload
  2179. * @param TIMx Timer instance
  2180. * @retval State of bit (1 or 0).
  2181. */
  2182. __STATIC_INLINE uint32_t LL_TIM_CC_IsEnabledPreload(const TIM_TypeDef *TIMx)
  2183. {
  2184. return ((READ_BIT(TIMx->CR2, TIM_CR2_CCPC) == (TIM_CR2_CCPC)) ? 1UL : 0UL);
  2185. }
  2186. /**
  2187. * @brief Set the updated source of the capture/compare control bits (CCxE, CCxNE and OCxM).
  2188. * @note Macro IS_TIM_COMMUTATION_EVENT_INSTANCE(TIMx) can be used to check
  2189. * whether or not a timer instance is able to generate a commutation event.
  2190. * @rmtoll CR2 CCUS LL_TIM_CC_SetUpdate
  2191. * @param TIMx Timer instance
  2192. * @param CCUpdateSource This parameter can be one of the following values:
  2193. * @arg @ref LL_TIM_CCUPDATESOURCE_COMG_ONLY
  2194. * @arg @ref LL_TIM_CCUPDATESOURCE_COMG_AND_TRGI
  2195. * @retval None
  2196. */
  2197. __STATIC_INLINE void LL_TIM_CC_SetUpdate(TIM_TypeDef *TIMx, uint32_t CCUpdateSource)
  2198. {
  2199. MODIFY_REG(TIMx->CR2, TIM_CR2_CCUS, CCUpdateSource);
  2200. }
  2201. /**
  2202. * @brief Set the trigger of the capture/compare DMA request.
  2203. * @rmtoll CR2 CCDS LL_TIM_CC_SetDMAReqTrigger
  2204. * @param TIMx Timer instance
  2205. * @param DMAReqTrigger This parameter can be one of the following values:
  2206. * @arg @ref LL_TIM_CCDMAREQUEST_CC
  2207. * @arg @ref LL_TIM_CCDMAREQUEST_UPDATE
  2208. * @retval None
  2209. */
  2210. __STATIC_INLINE void LL_TIM_CC_SetDMAReqTrigger(TIM_TypeDef *TIMx, uint32_t DMAReqTrigger)
  2211. {
  2212. MODIFY_REG(TIMx->CR2, TIM_CR2_CCDS, DMAReqTrigger);
  2213. }
  2214. /**
  2215. * @brief Get actual trigger of the capture/compare DMA request.
  2216. * @rmtoll CR2 CCDS LL_TIM_CC_GetDMAReqTrigger
  2217. * @param TIMx Timer instance
  2218. * @retval Returned value can be one of the following values:
  2219. * @arg @ref LL_TIM_CCDMAREQUEST_CC
  2220. * @arg @ref LL_TIM_CCDMAREQUEST_UPDATE
  2221. */
  2222. __STATIC_INLINE uint32_t LL_TIM_CC_GetDMAReqTrigger(const TIM_TypeDef *TIMx)
  2223. {
  2224. return (uint32_t)(READ_BIT(TIMx->CR2, TIM_CR2_CCDS));
  2225. }
  2226. /**
  2227. * @brief Set the lock level to freeze the
  2228. * configuration of several capture/compare parameters.
  2229. * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
  2230. * the lock mechanism is supported by a timer instance.
  2231. * @rmtoll BDTR LOCK LL_TIM_CC_SetLockLevel
  2232. * @param TIMx Timer instance
  2233. * @param LockLevel This parameter can be one of the following values:
  2234. * @arg @ref LL_TIM_LOCKLEVEL_OFF
  2235. * @arg @ref LL_TIM_LOCKLEVEL_1
  2236. * @arg @ref LL_TIM_LOCKLEVEL_2
  2237. * @arg @ref LL_TIM_LOCKLEVEL_3
  2238. * @retval None
  2239. */
  2240. __STATIC_INLINE void LL_TIM_CC_SetLockLevel(TIM_TypeDef *TIMx, uint32_t LockLevel)
  2241. {
  2242. MODIFY_REG(TIMx->BDTR, TIM_BDTR_LOCK, LockLevel);
  2243. }
  2244. /**
  2245. * @brief Enable capture/compare channels.
  2246. * @rmtoll CCER CC1E LL_TIM_CC_EnableChannel\n
  2247. * CCER CC1NE LL_TIM_CC_EnableChannel\n
  2248. * CCER CC2E LL_TIM_CC_EnableChannel\n
  2249. * CCER CC2NE LL_TIM_CC_EnableChannel\n
  2250. * CCER CC3E LL_TIM_CC_EnableChannel\n
  2251. * CCER CC3NE LL_TIM_CC_EnableChannel\n
  2252. * CCER CC4E LL_TIM_CC_EnableChannel\n
  2253. * CCER CC4NE LL_TIM_CC_EnableChannel\n
  2254. * CCER CC5E LL_TIM_CC_EnableChannel\n
  2255. * CCER CC6E LL_TIM_CC_EnableChannel
  2256. * @param TIMx Timer instance
  2257. * @param Channels This parameter can be a combination of the following values:
  2258. * @arg @ref LL_TIM_CHANNEL_CH1
  2259. * @arg @ref LL_TIM_CHANNEL_CH1N
  2260. * @arg @ref LL_TIM_CHANNEL_CH2
  2261. * @arg @ref LL_TIM_CHANNEL_CH2N
  2262. * @arg @ref LL_TIM_CHANNEL_CH3
  2263. * @arg @ref LL_TIM_CHANNEL_CH3N
  2264. * @arg @ref LL_TIM_CHANNEL_CH4
  2265. * @arg @ref LL_TIM_CHANNEL_CH4N
  2266. * @arg @ref LL_TIM_CHANNEL_CH5
  2267. * @arg @ref LL_TIM_CHANNEL_CH6
  2268. * @retval None
  2269. */
  2270. __STATIC_INLINE void LL_TIM_CC_EnableChannel(TIM_TypeDef *TIMx, uint32_t Channels)
  2271. {
  2272. SET_BIT(TIMx->CCER, Channels);
  2273. }
  2274. /**
  2275. * @brief Disable capture/compare channels.
  2276. * @rmtoll CCER CC1E LL_TIM_CC_DisableChannel\n
  2277. * CCER CC1NE LL_TIM_CC_DisableChannel\n
  2278. * CCER CC2E LL_TIM_CC_DisableChannel\n
  2279. * CCER CC2NE LL_TIM_CC_DisableChannel\n
  2280. * CCER CC3E LL_TIM_CC_DisableChannel\n
  2281. * CCER CC3NE LL_TIM_CC_DisableChannel\n
  2282. * CCER CC4E LL_TIM_CC_DisableChannel\n
  2283. * CCER CC4NE LL_TIM_CC_DisableChannel\n
  2284. * CCER CC5E LL_TIM_CC_DisableChannel\n
  2285. * CCER CC6E LL_TIM_CC_DisableChannel
  2286. * @param TIMx Timer instance
  2287. * @param Channels This parameter can be a combination of the following values:
  2288. * @arg @ref LL_TIM_CHANNEL_CH1
  2289. * @arg @ref LL_TIM_CHANNEL_CH1N
  2290. * @arg @ref LL_TIM_CHANNEL_CH2
  2291. * @arg @ref LL_TIM_CHANNEL_CH2N
  2292. * @arg @ref LL_TIM_CHANNEL_CH3
  2293. * @arg @ref LL_TIM_CHANNEL_CH3N
  2294. * @arg @ref LL_TIM_CHANNEL_CH4
  2295. * @arg @ref LL_TIM_CHANNEL_CH4N
  2296. * @arg @ref LL_TIM_CHANNEL_CH5
  2297. * @arg @ref LL_TIM_CHANNEL_CH6
  2298. * @retval None
  2299. */
  2300. __STATIC_INLINE void LL_TIM_CC_DisableChannel(TIM_TypeDef *TIMx, uint32_t Channels)
  2301. {
  2302. CLEAR_BIT(TIMx->CCER, Channels);
  2303. }
  2304. /**
  2305. * @brief Indicate whether channel(s) is(are) enabled.
  2306. * @rmtoll CCER CC1E LL_TIM_CC_IsEnabledChannel\n
  2307. * CCER CC1NE LL_TIM_CC_IsEnabledChannel\n
  2308. * CCER CC2E LL_TIM_CC_IsEnabledChannel\n
  2309. * CCER CC2NE LL_TIM_CC_IsEnabledChannel\n
  2310. * CCER CC3E LL_TIM_CC_IsEnabledChannel\n
  2311. * CCER CC3NE LL_TIM_CC_IsEnabledChannel\n
  2312. * CCER CC4E LL_TIM_CC_IsEnabledChannel\n
  2313. * CCER CC4NE LL_TIM_CC_IsEnabledChannel\n
  2314. * CCER CC5E LL_TIM_CC_IsEnabledChannel\n
  2315. * CCER CC6E LL_TIM_CC_IsEnabledChannel
  2316. * @param TIMx Timer instance
  2317. * @param Channels This parameter can be a combination of the following values:
  2318. * @arg @ref LL_TIM_CHANNEL_CH1
  2319. * @arg @ref LL_TIM_CHANNEL_CH1N
  2320. * @arg @ref LL_TIM_CHANNEL_CH2
  2321. * @arg @ref LL_TIM_CHANNEL_CH2N
  2322. * @arg @ref LL_TIM_CHANNEL_CH3
  2323. * @arg @ref LL_TIM_CHANNEL_CH3N
  2324. * @arg @ref LL_TIM_CHANNEL_CH4
  2325. * @arg @ref LL_TIM_CHANNEL_CH4N
  2326. * @arg @ref LL_TIM_CHANNEL_CH5
  2327. * @arg @ref LL_TIM_CHANNEL_CH6
  2328. * @retval State of bit (1 or 0).
  2329. */
  2330. __STATIC_INLINE uint32_t LL_TIM_CC_IsEnabledChannel(const TIM_TypeDef *TIMx, uint32_t Channels)
  2331. {
  2332. return ((READ_BIT(TIMx->CCER, Channels) == (Channels)) ? 1UL : 0UL);
  2333. }
  2334. /**
  2335. * @}
  2336. */
  2337. /** @defgroup TIM_LL_EF_Output_Channel Output channel configuration
  2338. * @{
  2339. */
  2340. /**
  2341. * @brief Configure an output channel.
  2342. * @rmtoll CCMR1 CC1S LL_TIM_OC_ConfigOutput\n
  2343. * CCMR1 CC2S LL_TIM_OC_ConfigOutput\n
  2344. * CCMR2 CC3S LL_TIM_OC_ConfigOutput\n
  2345. * CCMR2 CC4S LL_TIM_OC_ConfigOutput\n
  2346. * CCMR3 CC5S LL_TIM_OC_ConfigOutput\n
  2347. * CCMR3 CC6S LL_TIM_OC_ConfigOutput\n
  2348. * CCER CC1P LL_TIM_OC_ConfigOutput\n
  2349. * CCER CC2P LL_TIM_OC_ConfigOutput\n
  2350. * CCER CC3P LL_TIM_OC_ConfigOutput\n
  2351. * CCER CC4P LL_TIM_OC_ConfigOutput\n
  2352. * CCER CC5P LL_TIM_OC_ConfigOutput\n
  2353. * CCER CC6P LL_TIM_OC_ConfigOutput\n
  2354. * CR2 OIS1 LL_TIM_OC_ConfigOutput\n
  2355. * CR2 OIS2 LL_TIM_OC_ConfigOutput\n
  2356. * CR2 OIS3 LL_TIM_OC_ConfigOutput\n
  2357. * CR2 OIS4 LL_TIM_OC_ConfigOutput\n
  2358. * CR2 OIS5 LL_TIM_OC_ConfigOutput\n
  2359. * CR2 OIS6 LL_TIM_OC_ConfigOutput
  2360. * @param TIMx Timer instance
  2361. * @param Channel This parameter can be one of the following values:
  2362. * @arg @ref LL_TIM_CHANNEL_CH1
  2363. * @arg @ref LL_TIM_CHANNEL_CH2
  2364. * @arg @ref LL_TIM_CHANNEL_CH3
  2365. * @arg @ref LL_TIM_CHANNEL_CH4
  2366. * @arg @ref LL_TIM_CHANNEL_CH5
  2367. * @arg @ref LL_TIM_CHANNEL_CH6
  2368. * @param Configuration This parameter must be a combination of all the following values:
  2369. * @arg @ref LL_TIM_OCPOLARITY_HIGH or @ref LL_TIM_OCPOLARITY_LOW
  2370. * @arg @ref LL_TIM_OCIDLESTATE_LOW or @ref LL_TIM_OCIDLESTATE_HIGH
  2371. * @retval None
  2372. */
  2373. __STATIC_INLINE void LL_TIM_OC_ConfigOutput(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Configuration)
  2374. {
  2375. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  2376. __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
  2377. CLEAR_BIT(*pReg, (TIM_CCMR1_CC1S << SHIFT_TAB_OCxx[iChannel]));
  2378. MODIFY_REG(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel]),
  2379. (Configuration & TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]);
  2380. MODIFY_REG(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel]),
  2381. (Configuration & TIM_CR2_OIS1) << SHIFT_TAB_OISx[iChannel]);
  2382. }
  2383. /**
  2384. * @brief Define the behavior of the output reference signal OCxREF from which
  2385. * OCx and OCxN (when relevant) are derived.
  2386. * @rmtoll CCMR1 OC1M LL_TIM_OC_SetMode\n
  2387. * CCMR1 OC2M LL_TIM_OC_SetMode\n
  2388. * CCMR2 OC3M LL_TIM_OC_SetMode\n
  2389. * CCMR2 OC4M LL_TIM_OC_SetMode\n
  2390. * CCMR3 OC5M LL_TIM_OC_SetMode\n
  2391. * CCMR3 OC6M LL_TIM_OC_SetMode
  2392. * @param TIMx Timer instance
  2393. * @param Channel This parameter can be one of the following values:
  2394. * @arg @ref LL_TIM_CHANNEL_CH1
  2395. * @arg @ref LL_TIM_CHANNEL_CH2
  2396. * @arg @ref LL_TIM_CHANNEL_CH3
  2397. * @arg @ref LL_TIM_CHANNEL_CH4
  2398. * @arg @ref LL_TIM_CHANNEL_CH5
  2399. * @arg @ref LL_TIM_CHANNEL_CH6
  2400. * @param Mode This parameter can be one of the following values:
  2401. * @arg @ref LL_TIM_OCMODE_FROZEN
  2402. * @arg @ref LL_TIM_OCMODE_ACTIVE
  2403. * @arg @ref LL_TIM_OCMODE_INACTIVE
  2404. * @arg @ref LL_TIM_OCMODE_TOGGLE
  2405. * @arg @ref LL_TIM_OCMODE_FORCED_INACTIVE
  2406. * @arg @ref LL_TIM_OCMODE_FORCED_ACTIVE
  2407. * @arg @ref LL_TIM_OCMODE_PWM1
  2408. * @arg @ref LL_TIM_OCMODE_PWM2
  2409. * @arg @ref LL_TIM_OCMODE_RETRIG_OPM1
  2410. * @arg @ref LL_TIM_OCMODE_RETRIG_OPM2
  2411. * @arg @ref LL_TIM_OCMODE_COMBINED_PWM1
  2412. * @arg @ref LL_TIM_OCMODE_COMBINED_PWM2
  2413. * @arg @ref LL_TIM_OCMODE_ASYMMETRIC_PWM1
  2414. * @arg @ref LL_TIM_OCMODE_ASYMMETRIC_PWM2
  2415. * @arg @ref LL_TIM_OCMODE_PULSE_ON_COMPARE (for channel 3 or channel 4 only)
  2416. * @arg @ref LL_TIM_OCMODE_DIRECTION_OUTPUT (for channel 3 or channel 4 only)
  2417. * @retval None
  2418. */
  2419. __STATIC_INLINE void LL_TIM_OC_SetMode(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Mode)
  2420. {
  2421. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  2422. __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
  2423. MODIFY_REG(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel]), Mode << SHIFT_TAB_OCxx[iChannel]);
  2424. }
  2425. /**
  2426. * @brief Get the output compare mode of an output channel.
  2427. * @rmtoll CCMR1 OC1M LL_TIM_OC_GetMode\n
  2428. * CCMR1 OC2M LL_TIM_OC_GetMode\n
  2429. * CCMR2 OC3M LL_TIM_OC_GetMode\n
  2430. * CCMR2 OC4M LL_TIM_OC_GetMode\n
  2431. * CCMR3 OC5M LL_TIM_OC_GetMode\n
  2432. * CCMR3 OC6M LL_TIM_OC_GetMode
  2433. * @param TIMx Timer instance
  2434. * @param Channel This parameter can be one of the following values:
  2435. * @arg @ref LL_TIM_CHANNEL_CH1
  2436. * @arg @ref LL_TIM_CHANNEL_CH2
  2437. * @arg @ref LL_TIM_CHANNEL_CH3
  2438. * @arg @ref LL_TIM_CHANNEL_CH4
  2439. * @arg @ref LL_TIM_CHANNEL_CH5
  2440. * @arg @ref LL_TIM_CHANNEL_CH6
  2441. * @retval Returned value can be one of the following values:
  2442. * @arg @ref LL_TIM_OCMODE_FROZEN
  2443. * @arg @ref LL_TIM_OCMODE_ACTIVE
  2444. * @arg @ref LL_TIM_OCMODE_INACTIVE
  2445. * @arg @ref LL_TIM_OCMODE_TOGGLE
  2446. * @arg @ref LL_TIM_OCMODE_FORCED_INACTIVE
  2447. * @arg @ref LL_TIM_OCMODE_FORCED_ACTIVE
  2448. * @arg @ref LL_TIM_OCMODE_PWM1
  2449. * @arg @ref LL_TIM_OCMODE_PWM2
  2450. * @arg @ref LL_TIM_OCMODE_RETRIG_OPM1
  2451. * @arg @ref LL_TIM_OCMODE_RETRIG_OPM2
  2452. * @arg @ref LL_TIM_OCMODE_COMBINED_PWM1
  2453. * @arg @ref LL_TIM_OCMODE_COMBINED_PWM2
  2454. * @arg @ref LL_TIM_OCMODE_ASYMMETRIC_PWM1
  2455. * @arg @ref LL_TIM_OCMODE_ASYMMETRIC_PWM2
  2456. * @arg @ref LL_TIM_OCMODE_PULSE_ON_COMPARE (for channel 3 or channel 4 only)
  2457. * @arg @ref LL_TIM_OCMODE_DIRECTION_OUTPUT (for channel 3 or channel 4 only)
  2458. */
  2459. __STATIC_INLINE uint32_t LL_TIM_OC_GetMode(const TIM_TypeDef *TIMx, uint32_t Channel)
  2460. {
  2461. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  2462. const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
  2463. return (READ_BIT(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel])) >> SHIFT_TAB_OCxx[iChannel]);
  2464. }
  2465. /**
  2466. * @brief Set the polarity of an output channel.
  2467. * @rmtoll CCER CC1P LL_TIM_OC_SetPolarity\n
  2468. * CCER CC1NP LL_TIM_OC_SetPolarity\n
  2469. * CCER CC2P LL_TIM_OC_SetPolarity\n
  2470. * CCER CC2NP LL_TIM_OC_SetPolarity\n
  2471. * CCER CC3P LL_TIM_OC_SetPolarity\n
  2472. * CCER CC3NP LL_TIM_OC_SetPolarity\n
  2473. * CCER CC4P LL_TIM_OC_SetPolarity\n
  2474. * CCER CC4NP LL_TIM_OC_SetPolarity\n
  2475. * CCER CC5P LL_TIM_OC_SetPolarity\n
  2476. * CCER CC6P LL_TIM_OC_SetPolarity
  2477. * @param TIMx Timer instance
  2478. * @param Channel This parameter can be one of the following values:
  2479. * @arg @ref LL_TIM_CHANNEL_CH1
  2480. * @arg @ref LL_TIM_CHANNEL_CH1N
  2481. * @arg @ref LL_TIM_CHANNEL_CH2
  2482. * @arg @ref LL_TIM_CHANNEL_CH2N
  2483. * @arg @ref LL_TIM_CHANNEL_CH3
  2484. * @arg @ref LL_TIM_CHANNEL_CH3N
  2485. * @arg @ref LL_TIM_CHANNEL_CH4
  2486. * @arg @ref LL_TIM_CHANNEL_CH4N
  2487. * @arg @ref LL_TIM_CHANNEL_CH5
  2488. * @arg @ref LL_TIM_CHANNEL_CH6
  2489. * @param Polarity This parameter can be one of the following values:
  2490. * @arg @ref LL_TIM_OCPOLARITY_HIGH
  2491. * @arg @ref LL_TIM_OCPOLARITY_LOW
  2492. * @retval None
  2493. */
  2494. __STATIC_INLINE void LL_TIM_OC_SetPolarity(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Polarity)
  2495. {
  2496. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  2497. MODIFY_REG(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel]), Polarity << SHIFT_TAB_CCxP[iChannel]);
  2498. }
  2499. /**
  2500. * @brief Get the polarity of an output channel.
  2501. * @rmtoll CCER CC1P LL_TIM_OC_GetPolarity\n
  2502. * CCER CC1NP LL_TIM_OC_GetPolarity\n
  2503. * CCER CC2P LL_TIM_OC_GetPolarity\n
  2504. * CCER CC2NP LL_TIM_OC_GetPolarity\n
  2505. * CCER CC3P LL_TIM_OC_GetPolarity\n
  2506. * CCER CC3NP LL_TIM_OC_GetPolarity\n
  2507. * CCER CC4P LL_TIM_OC_GetPolarity\n
  2508. * CCER CC4NP LL_TIM_OC_GetPolarity\n
  2509. * CCER CC5P LL_TIM_OC_GetPolarity\n
  2510. * CCER CC6P LL_TIM_OC_GetPolarity
  2511. * @param TIMx Timer instance
  2512. * @param Channel This parameter can be one of the following values:
  2513. * @arg @ref LL_TIM_CHANNEL_CH1
  2514. * @arg @ref LL_TIM_CHANNEL_CH1N
  2515. * @arg @ref LL_TIM_CHANNEL_CH2
  2516. * @arg @ref LL_TIM_CHANNEL_CH2N
  2517. * @arg @ref LL_TIM_CHANNEL_CH3
  2518. * @arg @ref LL_TIM_CHANNEL_CH3N
  2519. * @arg @ref LL_TIM_CHANNEL_CH4
  2520. * @arg @ref LL_TIM_CHANNEL_CH4N
  2521. * @arg @ref LL_TIM_CHANNEL_CH5
  2522. * @arg @ref LL_TIM_CHANNEL_CH6
  2523. * @retval Returned value can be one of the following values:
  2524. * @arg @ref LL_TIM_OCPOLARITY_HIGH
  2525. * @arg @ref LL_TIM_OCPOLARITY_LOW
  2526. */
  2527. __STATIC_INLINE uint32_t LL_TIM_OC_GetPolarity(const TIM_TypeDef *TIMx, uint32_t Channel)
  2528. {
  2529. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  2530. return (READ_BIT(TIMx->CCER, (TIM_CCER_CC1P << SHIFT_TAB_CCxP[iChannel])) >> SHIFT_TAB_CCxP[iChannel]);
  2531. }
  2532. /**
  2533. * @brief Set the IDLE state of an output channel
  2534. * @note This function is significant only for the timer instances
  2535. * supporting the break feature. Macro IS_TIM_BREAK_INSTANCE(TIMx)
  2536. * can be used to check whether or not a timer instance provides
  2537. * a break input.
  2538. * @rmtoll CR2 OIS1 LL_TIM_OC_SetIdleState\n
  2539. * CR2 OIS2N LL_TIM_OC_SetIdleState\n
  2540. * CR2 OIS2 LL_TIM_OC_SetIdleState\n
  2541. * CR2 OIS2N LL_TIM_OC_SetIdleState\n
  2542. * CR2 OIS3 LL_TIM_OC_SetIdleState\n
  2543. * CR2 OIS3N LL_TIM_OC_SetIdleState\n
  2544. * CR2 OIS4 LL_TIM_OC_SetIdleState\n
  2545. * CR2 OIS4N LL_TIM_OC_SetIdleState\n
  2546. * CR2 OIS5 LL_TIM_OC_SetIdleState\n
  2547. * CR2 OIS6 LL_TIM_OC_SetIdleState
  2548. * @param TIMx Timer instance
  2549. * @param Channel This parameter can be one of the following values:
  2550. * @arg @ref LL_TIM_CHANNEL_CH1
  2551. * @arg @ref LL_TIM_CHANNEL_CH1N
  2552. * @arg @ref LL_TIM_CHANNEL_CH2
  2553. * @arg @ref LL_TIM_CHANNEL_CH2N
  2554. * @arg @ref LL_TIM_CHANNEL_CH3
  2555. * @arg @ref LL_TIM_CHANNEL_CH3N
  2556. * @arg @ref LL_TIM_CHANNEL_CH4
  2557. * @arg @ref LL_TIM_CHANNEL_CH4N
  2558. * @arg @ref LL_TIM_CHANNEL_CH5
  2559. * @arg @ref LL_TIM_CHANNEL_CH6
  2560. * @param IdleState This parameter can be one of the following values:
  2561. * @arg @ref LL_TIM_OCIDLESTATE_LOW
  2562. * @arg @ref LL_TIM_OCIDLESTATE_HIGH
  2563. * @retval None
  2564. */
  2565. __STATIC_INLINE void LL_TIM_OC_SetIdleState(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t IdleState)
  2566. {
  2567. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  2568. MODIFY_REG(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel]), IdleState << SHIFT_TAB_OISx[iChannel]);
  2569. }
  2570. /**
  2571. * @brief Get the IDLE state of an output channel
  2572. * @rmtoll CR2 OIS1 LL_TIM_OC_GetIdleState\n
  2573. * CR2 OIS2N LL_TIM_OC_GetIdleState\n
  2574. * CR2 OIS2 LL_TIM_OC_GetIdleState\n
  2575. * CR2 OIS2N LL_TIM_OC_GetIdleState\n
  2576. * CR2 OIS3 LL_TIM_OC_GetIdleState\n
  2577. * CR2 OIS3N LL_TIM_OC_GetIdleState\n
  2578. * CR2 OIS4 LL_TIM_OC_GetIdleState\n
  2579. * CR2 OIS4N LL_TIM_OC_GetIdleState\n
  2580. * CR2 OIS5 LL_TIM_OC_GetIdleState\n
  2581. * CR2 OIS6 LL_TIM_OC_GetIdleState
  2582. * @param TIMx Timer instance
  2583. * @param Channel This parameter can be one of the following values:
  2584. * @arg @ref LL_TIM_CHANNEL_CH1
  2585. * @arg @ref LL_TIM_CHANNEL_CH1N
  2586. * @arg @ref LL_TIM_CHANNEL_CH2
  2587. * @arg @ref LL_TIM_CHANNEL_CH2N
  2588. * @arg @ref LL_TIM_CHANNEL_CH3
  2589. * @arg @ref LL_TIM_CHANNEL_CH3N
  2590. * @arg @ref LL_TIM_CHANNEL_CH4
  2591. * @arg @ref LL_TIM_CHANNEL_CH4N
  2592. * @arg @ref LL_TIM_CHANNEL_CH5
  2593. * @arg @ref LL_TIM_CHANNEL_CH6
  2594. * @retval Returned value can be one of the following values:
  2595. * @arg @ref LL_TIM_OCIDLESTATE_LOW
  2596. * @arg @ref LL_TIM_OCIDLESTATE_HIGH
  2597. */
  2598. __STATIC_INLINE uint32_t LL_TIM_OC_GetIdleState(const TIM_TypeDef *TIMx, uint32_t Channel)
  2599. {
  2600. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  2601. return (READ_BIT(TIMx->CR2, (TIM_CR2_OIS1 << SHIFT_TAB_OISx[iChannel])) >> SHIFT_TAB_OISx[iChannel]);
  2602. }
  2603. /**
  2604. * @brief Enable fast mode for the output channel.
  2605. * @note Acts only if the channel is configured in PWM1 or PWM2 mode.
  2606. * @rmtoll CCMR1 OC1FE LL_TIM_OC_EnableFast\n
  2607. * CCMR1 OC2FE LL_TIM_OC_EnableFast\n
  2608. * CCMR2 OC3FE LL_TIM_OC_EnableFast\n
  2609. * CCMR2 OC4FE LL_TIM_OC_EnableFast\n
  2610. * CCMR3 OC5FE LL_TIM_OC_EnableFast\n
  2611. * CCMR3 OC6FE LL_TIM_OC_EnableFast
  2612. * @param TIMx Timer instance
  2613. * @param Channel This parameter can be one of the following values:
  2614. * @arg @ref LL_TIM_CHANNEL_CH1
  2615. * @arg @ref LL_TIM_CHANNEL_CH2
  2616. * @arg @ref LL_TIM_CHANNEL_CH3
  2617. * @arg @ref LL_TIM_CHANNEL_CH4
  2618. * @arg @ref LL_TIM_CHANNEL_CH5
  2619. * @arg @ref LL_TIM_CHANNEL_CH6
  2620. * @retval None
  2621. */
  2622. __STATIC_INLINE void LL_TIM_OC_EnableFast(TIM_TypeDef *TIMx, uint32_t Channel)
  2623. {
  2624. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  2625. __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
  2626. SET_BIT(*pReg, (TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel]));
  2627. }
  2628. /**
  2629. * @brief Disable fast mode for the output channel.
  2630. * @rmtoll CCMR1 OC1FE LL_TIM_OC_DisableFast\n
  2631. * CCMR1 OC2FE LL_TIM_OC_DisableFast\n
  2632. * CCMR2 OC3FE LL_TIM_OC_DisableFast\n
  2633. * CCMR2 OC4FE LL_TIM_OC_DisableFast\n
  2634. * CCMR3 OC5FE LL_TIM_OC_DisableFast\n
  2635. * CCMR3 OC6FE LL_TIM_OC_DisableFast
  2636. * @param TIMx Timer instance
  2637. * @param Channel This parameter can be one of the following values:
  2638. * @arg @ref LL_TIM_CHANNEL_CH1
  2639. * @arg @ref LL_TIM_CHANNEL_CH2
  2640. * @arg @ref LL_TIM_CHANNEL_CH3
  2641. * @arg @ref LL_TIM_CHANNEL_CH4
  2642. * @arg @ref LL_TIM_CHANNEL_CH5
  2643. * @arg @ref LL_TIM_CHANNEL_CH6
  2644. * @retval None
  2645. */
  2646. __STATIC_INLINE void LL_TIM_OC_DisableFast(TIM_TypeDef *TIMx, uint32_t Channel)
  2647. {
  2648. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  2649. __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
  2650. CLEAR_BIT(*pReg, (TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel]));
  2651. }
  2652. /**
  2653. * @brief Indicates whether fast mode is enabled for the output channel.
  2654. * @rmtoll CCMR1 OC1FE LL_TIM_OC_IsEnabledFast\n
  2655. * CCMR1 OC2FE LL_TIM_OC_IsEnabledFast\n
  2656. * CCMR2 OC3FE LL_TIM_OC_IsEnabledFast\n
  2657. * CCMR2 OC4FE LL_TIM_OC_IsEnabledFast\n
  2658. * CCMR3 OC5FE LL_TIM_OC_IsEnabledFast\n
  2659. * CCMR3 OC6FE LL_TIM_OC_IsEnabledFast
  2660. * @param TIMx Timer instance
  2661. * @param Channel This parameter can be one of the following values:
  2662. * @arg @ref LL_TIM_CHANNEL_CH1
  2663. * @arg @ref LL_TIM_CHANNEL_CH2
  2664. * @arg @ref LL_TIM_CHANNEL_CH3
  2665. * @arg @ref LL_TIM_CHANNEL_CH4
  2666. * @arg @ref LL_TIM_CHANNEL_CH5
  2667. * @arg @ref LL_TIM_CHANNEL_CH6
  2668. * @retval State of bit (1 or 0).
  2669. */
  2670. __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledFast(const TIM_TypeDef *TIMx, uint32_t Channel)
  2671. {
  2672. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  2673. const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
  2674. uint32_t bitfield = TIM_CCMR1_OC1FE << SHIFT_TAB_OCxx[iChannel];
  2675. return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL);
  2676. }
  2677. /**
  2678. * @brief Enable compare register (TIMx_CCRx) preload for the output channel.
  2679. * @rmtoll CCMR1 OC1PE LL_TIM_OC_EnablePreload\n
  2680. * CCMR1 OC2PE LL_TIM_OC_EnablePreload\n
  2681. * CCMR2 OC3PE LL_TIM_OC_EnablePreload\n
  2682. * CCMR2 OC4PE LL_TIM_OC_EnablePreload\n
  2683. * CCMR3 OC5PE LL_TIM_OC_EnablePreload\n
  2684. * CCMR3 OC6PE LL_TIM_OC_EnablePreload
  2685. * @param TIMx Timer instance
  2686. * @param Channel This parameter can be one of the following values:
  2687. * @arg @ref LL_TIM_CHANNEL_CH1
  2688. * @arg @ref LL_TIM_CHANNEL_CH2
  2689. * @arg @ref LL_TIM_CHANNEL_CH3
  2690. * @arg @ref LL_TIM_CHANNEL_CH4
  2691. * @arg @ref LL_TIM_CHANNEL_CH5
  2692. * @arg @ref LL_TIM_CHANNEL_CH6
  2693. * @retval None
  2694. */
  2695. __STATIC_INLINE void LL_TIM_OC_EnablePreload(TIM_TypeDef *TIMx, uint32_t Channel)
  2696. {
  2697. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  2698. __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
  2699. SET_BIT(*pReg, (TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel]));
  2700. }
  2701. /**
  2702. * @brief Disable compare register (TIMx_CCRx) preload for the output channel.
  2703. * @rmtoll CCMR1 OC1PE LL_TIM_OC_DisablePreload\n
  2704. * CCMR1 OC2PE LL_TIM_OC_DisablePreload\n
  2705. * CCMR2 OC3PE LL_TIM_OC_DisablePreload\n
  2706. * CCMR2 OC4PE LL_TIM_OC_DisablePreload\n
  2707. * CCMR3 OC5PE LL_TIM_OC_DisablePreload\n
  2708. * CCMR3 OC6PE LL_TIM_OC_DisablePreload
  2709. * @param TIMx Timer instance
  2710. * @param Channel This parameter can be one of the following values:
  2711. * @arg @ref LL_TIM_CHANNEL_CH1
  2712. * @arg @ref LL_TIM_CHANNEL_CH2
  2713. * @arg @ref LL_TIM_CHANNEL_CH3
  2714. * @arg @ref LL_TIM_CHANNEL_CH4
  2715. * @arg @ref LL_TIM_CHANNEL_CH5
  2716. * @arg @ref LL_TIM_CHANNEL_CH6
  2717. * @retval None
  2718. */
  2719. __STATIC_INLINE void LL_TIM_OC_DisablePreload(TIM_TypeDef *TIMx, uint32_t Channel)
  2720. {
  2721. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  2722. __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
  2723. CLEAR_BIT(*pReg, (TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel]));
  2724. }
  2725. /**
  2726. * @brief Indicates whether compare register (TIMx_CCRx) preload is enabled for the output channel.
  2727. * @rmtoll CCMR1 OC1PE LL_TIM_OC_IsEnabledPreload\n
  2728. * CCMR1 OC2PE LL_TIM_OC_IsEnabledPreload\n
  2729. * CCMR2 OC3PE LL_TIM_OC_IsEnabledPreload\n
  2730. * CCMR2 OC4PE LL_TIM_OC_IsEnabledPreload\n
  2731. * CCMR3 OC5PE LL_TIM_OC_IsEnabledPreload\n
  2732. * CCMR3 OC6PE LL_TIM_OC_IsEnabledPreload
  2733. * @param TIMx Timer instance
  2734. * @param Channel This parameter can be one of the following values:
  2735. * @arg @ref LL_TIM_CHANNEL_CH1
  2736. * @arg @ref LL_TIM_CHANNEL_CH2
  2737. * @arg @ref LL_TIM_CHANNEL_CH3
  2738. * @arg @ref LL_TIM_CHANNEL_CH4
  2739. * @arg @ref LL_TIM_CHANNEL_CH5
  2740. * @arg @ref LL_TIM_CHANNEL_CH6
  2741. * @retval State of bit (1 or 0).
  2742. */
  2743. __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledPreload(const TIM_TypeDef *TIMx, uint32_t Channel)
  2744. {
  2745. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  2746. const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
  2747. uint32_t bitfield = TIM_CCMR1_OC1PE << SHIFT_TAB_OCxx[iChannel];
  2748. return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL);
  2749. }
  2750. /**
  2751. * @brief Enable clearing the output channel on an external event.
  2752. * @note This function can only be used in Output compare and PWM modes. It does not work in Forced mode.
  2753. * @note Macro IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether
  2754. * or not a timer instance can clear the OCxREF signal on an external event.
  2755. * @rmtoll CCMR1 OC1CE LL_TIM_OC_EnableClear\n
  2756. * CCMR1 OC2CE LL_TIM_OC_EnableClear\n
  2757. * CCMR2 OC3CE LL_TIM_OC_EnableClear\n
  2758. * CCMR2 OC4CE LL_TIM_OC_EnableClear\n
  2759. * CCMR3 OC5CE LL_TIM_OC_EnableClear\n
  2760. * CCMR3 OC6CE LL_TIM_OC_EnableClear
  2761. * @param TIMx Timer instance
  2762. * @param Channel This parameter can be one of the following values:
  2763. * @arg @ref LL_TIM_CHANNEL_CH1
  2764. * @arg @ref LL_TIM_CHANNEL_CH2
  2765. * @arg @ref LL_TIM_CHANNEL_CH3
  2766. * @arg @ref LL_TIM_CHANNEL_CH4
  2767. * @arg @ref LL_TIM_CHANNEL_CH5
  2768. * @arg @ref LL_TIM_CHANNEL_CH6
  2769. * @retval None
  2770. */
  2771. __STATIC_INLINE void LL_TIM_OC_EnableClear(TIM_TypeDef *TIMx, uint32_t Channel)
  2772. {
  2773. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  2774. __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
  2775. SET_BIT(*pReg, (TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel]));
  2776. }
  2777. /**
  2778. * @brief Disable clearing the output channel on an external event.
  2779. * @note Macro IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether
  2780. * or not a timer instance can clear the OCxREF signal on an external event.
  2781. * @rmtoll CCMR1 OC1CE LL_TIM_OC_DisableClear\n
  2782. * CCMR1 OC2CE LL_TIM_OC_DisableClear\n
  2783. * CCMR2 OC3CE LL_TIM_OC_DisableClear\n
  2784. * CCMR2 OC4CE LL_TIM_OC_DisableClear\n
  2785. * CCMR3 OC5CE LL_TIM_OC_DisableClear\n
  2786. * CCMR3 OC6CE LL_TIM_OC_DisableClear
  2787. * @param TIMx Timer instance
  2788. * @param Channel This parameter can be one of the following values:
  2789. * @arg @ref LL_TIM_CHANNEL_CH1
  2790. * @arg @ref LL_TIM_CHANNEL_CH2
  2791. * @arg @ref LL_TIM_CHANNEL_CH3
  2792. * @arg @ref LL_TIM_CHANNEL_CH4
  2793. * @arg @ref LL_TIM_CHANNEL_CH5
  2794. * @arg @ref LL_TIM_CHANNEL_CH6
  2795. * @retval None
  2796. */
  2797. __STATIC_INLINE void LL_TIM_OC_DisableClear(TIM_TypeDef *TIMx, uint32_t Channel)
  2798. {
  2799. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  2800. __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
  2801. CLEAR_BIT(*pReg, (TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel]));
  2802. }
  2803. /**
  2804. * @brief Indicates clearing the output channel on an external event is enabled for the output channel.
  2805. * @note This function enables clearing the output channel on an external event.
  2806. * @note This function can only be used in Output compare and PWM modes. It does not work in Forced mode.
  2807. * @note Macro IS_TIM_OCXREF_CLEAR_INSTANCE(TIMx) can be used to check whether
  2808. * or not a timer instance can clear the OCxREF signal on an external event.
  2809. * @rmtoll CCMR1 OC1CE LL_TIM_OC_IsEnabledClear\n
  2810. * CCMR1 OC2CE LL_TIM_OC_IsEnabledClear\n
  2811. * CCMR2 OC3CE LL_TIM_OC_IsEnabledClear\n
  2812. * CCMR2 OC4CE LL_TIM_OC_IsEnabledClear\n
  2813. * CCMR3 OC5CE LL_TIM_OC_IsEnabledClear\n
  2814. * CCMR3 OC6CE LL_TIM_OC_IsEnabledClear
  2815. * @param TIMx Timer instance
  2816. * @param Channel This parameter can be one of the following values:
  2817. * @arg @ref LL_TIM_CHANNEL_CH1
  2818. * @arg @ref LL_TIM_CHANNEL_CH2
  2819. * @arg @ref LL_TIM_CHANNEL_CH3
  2820. * @arg @ref LL_TIM_CHANNEL_CH4
  2821. * @arg @ref LL_TIM_CHANNEL_CH5
  2822. * @arg @ref LL_TIM_CHANNEL_CH6
  2823. * @retval State of bit (1 or 0).
  2824. */
  2825. __STATIC_INLINE uint32_t LL_TIM_OC_IsEnabledClear(const TIM_TypeDef *TIMx, uint32_t Channel)
  2826. {
  2827. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  2828. const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
  2829. uint32_t bitfield = TIM_CCMR1_OC1CE << SHIFT_TAB_OCxx[iChannel];
  2830. return ((READ_BIT(*pReg, bitfield) == bitfield) ? 1UL : 0UL);
  2831. }
  2832. /**
  2833. * @brief Set the dead-time delay (delay inserted between the rising edge of the OCxREF signal and the rising edge of
  2834. * the Ocx and OCxN signals).
  2835. * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
  2836. * dead-time insertion feature is supported by a timer instance.
  2837. * @note Helper macro @ref __LL_TIM_CALC_DEADTIME can be used to calculate the DeadTime parameter
  2838. * @rmtoll BDTR DTG LL_TIM_OC_SetDeadTime
  2839. * @param TIMx Timer instance
  2840. * @param DeadTime between Min_Data=0 and Max_Data=255
  2841. * @retval None
  2842. */
  2843. __STATIC_INLINE void LL_TIM_OC_SetDeadTime(TIM_TypeDef *TIMx, uint32_t DeadTime)
  2844. {
  2845. MODIFY_REG(TIMx->BDTR, TIM_BDTR_DTG, DeadTime);
  2846. }
  2847. /**
  2848. * @brief Set compare value for output channel 1 (TIMx_CCR1).
  2849. * @note In 32-bit timer implementations compare value can be between 0x00000000 and 0xFFFFFFFF.
  2850. * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check
  2851. * whether or not a timer instance supports a 32 bits counter.
  2852. * @note Macro IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not
  2853. * output channel 1 is supported by a timer instance.
  2854. * @note If dithering is activated, CompareValue can be calculated with macro @ref __LL_TIM_CALC_DELAY_DITHER .
  2855. * @rmtoll CCR1 CCR1 LL_TIM_OC_SetCompareCH1
  2856. * @param TIMx Timer instance
  2857. * @param CompareValue between Min_Data=0 and Max_Data=65535
  2858. * @retval None
  2859. */
  2860. __STATIC_INLINE void LL_TIM_OC_SetCompareCH1(TIM_TypeDef *TIMx, uint32_t CompareValue)
  2861. {
  2862. WRITE_REG(TIMx->CCR1, CompareValue);
  2863. }
  2864. /**
  2865. * @brief Set compare value for output channel 2 (TIMx_CCR2).
  2866. * @note In 32-bit timer implementations compare value can be between 0x00000000 and 0xFFFFFFFF.
  2867. * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check
  2868. * whether or not a timer instance supports a 32 bits counter.
  2869. * @note Macro IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not
  2870. * output channel 2 is supported by a timer instance.
  2871. * @note If dithering is activated, CompareValue can be calculated with macro @ref __LL_TIM_CALC_DELAY_DITHER .
  2872. * @rmtoll CCR2 CCR2 LL_TIM_OC_SetCompareCH2
  2873. * @param TIMx Timer instance
  2874. * @param CompareValue between Min_Data=0 and Max_Data=65535
  2875. * @retval None
  2876. */
  2877. __STATIC_INLINE void LL_TIM_OC_SetCompareCH2(TIM_TypeDef *TIMx, uint32_t CompareValue)
  2878. {
  2879. WRITE_REG(TIMx->CCR2, CompareValue);
  2880. }
  2881. /**
  2882. * @brief Set compare value for output channel 3 (TIMx_CCR3).
  2883. * @note In 32-bit timer implementations compare value can be between 0x00000000 and 0xFFFFFFFF.
  2884. * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check
  2885. * whether or not a timer instance supports a 32 bits counter.
  2886. * @note Macro IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not
  2887. * output channel is supported by a timer instance.
  2888. * @note If dithering is activated, CompareValue can be calculated with macro @ref __LL_TIM_CALC_DELAY_DITHER .
  2889. * @rmtoll CCR3 CCR3 LL_TIM_OC_SetCompareCH3
  2890. * @param TIMx Timer instance
  2891. * @param CompareValue between Min_Data=0 and Max_Data=65535
  2892. * @retval None
  2893. */
  2894. __STATIC_INLINE void LL_TIM_OC_SetCompareCH3(TIM_TypeDef *TIMx, uint32_t CompareValue)
  2895. {
  2896. WRITE_REG(TIMx->CCR3, CompareValue);
  2897. }
  2898. /**
  2899. * @brief Set compare value for output channel 4 (TIMx_CCR4).
  2900. * @note In 32-bit timer implementations compare value can be between 0x00000000 and 0xFFFFFFFF.
  2901. * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check
  2902. * whether or not a timer instance supports a 32 bits counter.
  2903. * @note Macro IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not
  2904. * output channel 4 is supported by a timer instance.
  2905. * @note If dithering is activated, CompareValue can be calculated with macro @ref __LL_TIM_CALC_DELAY_DITHER .
  2906. * @rmtoll CCR4 CCR4 LL_TIM_OC_SetCompareCH4
  2907. * @param TIMx Timer instance
  2908. * @param CompareValue between Min_Data=0 and Max_Data=65535
  2909. * @retval None
  2910. */
  2911. __STATIC_INLINE void LL_TIM_OC_SetCompareCH4(TIM_TypeDef *TIMx, uint32_t CompareValue)
  2912. {
  2913. WRITE_REG(TIMx->CCR4, CompareValue);
  2914. }
  2915. /**
  2916. * @brief Set compare value for output channel 5 (TIMx_CCR5).
  2917. * @note Macro IS_TIM_CC5_INSTANCE(TIMx) can be used to check whether or not
  2918. * output channel 5 is supported by a timer instance.
  2919. * @note If dithering is activated, CompareValue can be calculated with macro @ref __LL_TIM_CALC_DELAY_DITHER .
  2920. * @rmtoll CCR5 CCR5 LL_TIM_OC_SetCompareCH5
  2921. * @param TIMx Timer instance
  2922. * @param CompareValue between Min_Data=0 and Max_Data=65535
  2923. * @retval None
  2924. */
  2925. __STATIC_INLINE void LL_TIM_OC_SetCompareCH5(TIM_TypeDef *TIMx, uint32_t CompareValue)
  2926. {
  2927. MODIFY_REG(TIMx->CCR5, TIM_CCR5_CCR5, CompareValue);
  2928. }
  2929. /**
  2930. * @brief Set compare value for output channel 6 (TIMx_CCR6).
  2931. * @note Macro IS_TIM_CC6_INSTANCE(TIMx) can be used to check whether or not
  2932. * output channel 6 is supported by a timer instance.
  2933. * @note If dithering is activated, CompareValue can be calculated with macro @ref __LL_TIM_CALC_DELAY_DITHER .
  2934. * @rmtoll CCR6 CCR6 LL_TIM_OC_SetCompareCH6
  2935. * @param TIMx Timer instance
  2936. * @param CompareValue between Min_Data=0 and Max_Data=65535
  2937. * @retval None
  2938. */
  2939. __STATIC_INLINE void LL_TIM_OC_SetCompareCH6(TIM_TypeDef *TIMx, uint32_t CompareValue)
  2940. {
  2941. WRITE_REG(TIMx->CCR6, CompareValue);
  2942. }
  2943. /**
  2944. * @brief Get compare value (TIMx_CCR1) set for output channel 1.
  2945. * @note In 32-bit timer implementations returned compare value can be between 0x00000000 and 0xFFFFFFFF.
  2946. * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check
  2947. * whether or not a timer instance supports a 32 bits counter.
  2948. * @note Macro IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not
  2949. * output channel 1 is supported by a timer instance.
  2950. * @note If dithering is activated, pay attention to the returned value interpretation.
  2951. * @rmtoll CCR1 CCR1 LL_TIM_OC_GetCompareCH1
  2952. * @param TIMx Timer instance
  2953. * @retval CompareValue (between Min_Data=0 and Max_Data=65535)
  2954. */
  2955. __STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH1(const TIM_TypeDef *TIMx)
  2956. {
  2957. return (uint32_t)(READ_REG(TIMx->CCR1));
  2958. }
  2959. /**
  2960. * @brief Get compare value (TIMx_CCR2) set for output channel 2.
  2961. * @note In 32-bit timer implementations returned compare value can be between 0x00000000 and 0xFFFFFFFF.
  2962. * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check
  2963. * whether or not a timer instance supports a 32 bits counter.
  2964. * @note Macro IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not
  2965. * output channel 2 is supported by a timer instance.
  2966. * @note If dithering is activated, pay attention to the returned value interpretation.
  2967. * @rmtoll CCR2 CCR2 LL_TIM_OC_GetCompareCH2
  2968. * @param TIMx Timer instance
  2969. * @retval CompareValue (between Min_Data=0 and Max_Data=65535)
  2970. */
  2971. __STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH2(const TIM_TypeDef *TIMx)
  2972. {
  2973. return (uint32_t)(READ_REG(TIMx->CCR2));
  2974. }
  2975. /**
  2976. * @brief Get compare value (TIMx_CCR3) set for output channel 3.
  2977. * @note In 32-bit timer implementations returned compare value can be between 0x00000000 and 0xFFFFFFFF.
  2978. * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check
  2979. * whether or not a timer instance supports a 32 bits counter.
  2980. * @note Macro IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not
  2981. * output channel 3 is supported by a timer instance.
  2982. * @note If dithering is activated, pay attention to the returned value interpretation.
  2983. * @rmtoll CCR3 CCR3 LL_TIM_OC_GetCompareCH3
  2984. * @param TIMx Timer instance
  2985. * @retval CompareValue (between Min_Data=0 and Max_Data=65535)
  2986. */
  2987. __STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH3(const TIM_TypeDef *TIMx)
  2988. {
  2989. return (uint32_t)(READ_REG(TIMx->CCR3));
  2990. }
  2991. /**
  2992. * @brief Get compare value (TIMx_CCR4) set for output channel 4.
  2993. * @note In 32-bit timer implementations returned compare value can be between 0x00000000 and 0xFFFFFFFF.
  2994. * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check
  2995. * whether or not a timer instance supports a 32 bits counter.
  2996. * @note Macro IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not
  2997. * output channel 4 is supported by a timer instance.
  2998. * @note If dithering is activated, pay attention to the returned value interpretation.
  2999. * @rmtoll CCR4 CCR4 LL_TIM_OC_GetCompareCH4
  3000. * @param TIMx Timer instance
  3001. * @retval CompareValue (between Min_Data=0 and Max_Data=65535)
  3002. */
  3003. __STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH4(const TIM_TypeDef *TIMx)
  3004. {
  3005. return (uint32_t)(READ_REG(TIMx->CCR4));
  3006. }
  3007. /**
  3008. * @brief Get compare value (TIMx_CCR5) set for output channel 5.
  3009. * @note Macro IS_TIM_CC5_INSTANCE(TIMx) can be used to check whether or not
  3010. * output channel 5 is supported by a timer instance.
  3011. * @note If dithering is activated, pay attention to the returned value interpretation.
  3012. * @rmtoll CCR5 CCR5 LL_TIM_OC_GetCompareCH5
  3013. * @param TIMx Timer instance
  3014. * @retval CompareValue (between Min_Data=0 and Max_Data=65535)
  3015. */
  3016. __STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH5(const TIM_TypeDef *TIMx)
  3017. {
  3018. return (uint32_t)(READ_BIT(TIMx->CCR5, TIM_CCR5_CCR5));
  3019. }
  3020. /**
  3021. * @brief Get compare value (TIMx_CCR6) set for output channel 6.
  3022. * @note Macro IS_TIM_CC6_INSTANCE(TIMx) can be used to check whether or not
  3023. * output channel 6 is supported by a timer instance.
  3024. * @note If dithering is activated, pay attention to the returned value interpretation.
  3025. * @rmtoll CCR6 CCR6 LL_TIM_OC_GetCompareCH6
  3026. * @param TIMx Timer instance
  3027. * @retval CompareValue (between Min_Data=0 and Max_Data=65535)
  3028. */
  3029. __STATIC_INLINE uint32_t LL_TIM_OC_GetCompareCH6(const TIM_TypeDef *TIMx)
  3030. {
  3031. return (uint32_t)(READ_REG(TIMx->CCR6));
  3032. }
  3033. /**
  3034. * @brief Select on which reference signal the OC5REF is combined to.
  3035. * @note Macro IS_TIM_COMBINED3PHASEPWM_INSTANCE(TIMx) can be used to check
  3036. * whether or not a timer instance supports the combined 3-phase PWM mode.
  3037. * @rmtoll CCR5 GC5C3 LL_TIM_SetCH5CombinedChannels\n
  3038. * CCR5 GC5C2 LL_TIM_SetCH5CombinedChannels\n
  3039. * CCR5 GC5C1 LL_TIM_SetCH5CombinedChannels
  3040. * @param TIMx Timer instance
  3041. * @param GroupCH5 This parameter can be a combination of the following values:
  3042. * @arg @ref LL_TIM_GROUPCH5_NONE
  3043. * @arg @ref LL_TIM_GROUPCH5_OC1REFC
  3044. * @arg @ref LL_TIM_GROUPCH5_OC2REFC
  3045. * @arg @ref LL_TIM_GROUPCH5_OC3REFC
  3046. * @retval None
  3047. */
  3048. __STATIC_INLINE void LL_TIM_SetCH5CombinedChannels(TIM_TypeDef *TIMx, uint32_t GroupCH5)
  3049. {
  3050. MODIFY_REG(TIMx->CCR5, (TIM_CCR5_GC5C3 | TIM_CCR5_GC5C2 | TIM_CCR5_GC5C1), GroupCH5);
  3051. }
  3052. /**
  3053. * @brief Set the pulse on compare pulse width prescaler.
  3054. * @note Macro IS_TIM_PULSEONCOMPARE_INSTANCE(TIMx) can be used to check
  3055. * whether or not the pulse on compare feature is supported by the timer
  3056. * instance.
  3057. * @rmtoll ECR PWPRSC LL_TIM_OC_SetPulseWidthPrescaler
  3058. * @param TIMx Timer instance
  3059. * @param PulseWidthPrescaler This parameter can be one of the following values:
  3060. * @arg @ref LL_TIM_PWPRSC_X1
  3061. * @arg @ref LL_TIM_PWPRSC_X2
  3062. * @arg @ref LL_TIM_PWPRSC_X4
  3063. * @arg @ref LL_TIM_PWPRSC_X8
  3064. * @arg @ref LL_TIM_PWPRSC_X16
  3065. * @arg @ref LL_TIM_PWPRSC_X32
  3066. * @arg @ref LL_TIM_PWPRSC_X64
  3067. * @arg @ref LL_TIM_PWPRSC_X128
  3068. * @retval None
  3069. */
  3070. __STATIC_INLINE void LL_TIM_OC_SetPulseWidthPrescaler(TIM_TypeDef *TIMx, uint32_t PulseWidthPrescaler)
  3071. {
  3072. MODIFY_REG(TIMx->ECR, TIM_ECR_PWPRSC, PulseWidthPrescaler);
  3073. }
  3074. /**
  3075. * @brief Get the pulse on compare pulse width prescaler.
  3076. * @note Macro IS_TIM_PULSEONCOMPARE_INSTANCE(TIMx) can be used to check
  3077. * whether or not the pulse on compare feature is supported by the timer
  3078. * instance.
  3079. * @rmtoll ECR PWPRSC LL_TIM_OC_GetPulseWidthPrescaler
  3080. * @param TIMx Timer instance
  3081. * @retval Returned value can be one of the following values:
  3082. * @arg @ref LL_TIM_PWPRSC_X1
  3083. * @arg @ref LL_TIM_PWPRSC_X2
  3084. * @arg @ref LL_TIM_PWPRSC_X4
  3085. * @arg @ref LL_TIM_PWPRSC_X8
  3086. * @arg @ref LL_TIM_PWPRSC_X16
  3087. * @arg @ref LL_TIM_PWPRSC_X32
  3088. * @arg @ref LL_TIM_PWPRSC_X64
  3089. * @arg @ref LL_TIM_PWPRSC_X128
  3090. */
  3091. __STATIC_INLINE uint32_t LL_TIM_OC_GetPulseWidthPrescaler(const TIM_TypeDef *TIMx)
  3092. {
  3093. return (uint32_t)(READ_BIT(TIMx->ECR, TIM_ECR_PWPRSC));
  3094. }
  3095. /**
  3096. * @brief Set the pulse on compare pulse width duration.
  3097. * @note Macro IS_TIM_PULSEONCOMPARE_INSTANCE(TIMx) can be used to check
  3098. * whether or not the pulse on compare feature is supported by the timer
  3099. * instance.
  3100. * @rmtoll ECR PW LL_TIM_OC_SetPulseWidth
  3101. * @param TIMx Timer instance
  3102. * @param PulseWidth This parameter can be between Min_Data=0 and Max_Data=255
  3103. * @retval None
  3104. */
  3105. __STATIC_INLINE void LL_TIM_OC_SetPulseWidth(TIM_TypeDef *TIMx, uint32_t PulseWidth)
  3106. {
  3107. MODIFY_REG(TIMx->ECR, TIM_ECR_PW, PulseWidth << TIM_ECR_PW_Pos);
  3108. }
  3109. /**
  3110. * @brief Get the pulse on compare pulse width duration.
  3111. * @note Macro IS_TIM_PULSEONCOMPARE_INSTANCE(TIMx) can be used to check
  3112. * whether or not the pulse on compare feature is supported by the timer
  3113. * instance.
  3114. * @rmtoll ECR PW LL_TIM_OC_GetPulseWidth
  3115. * @param TIMx Timer instance
  3116. * @retval Returned value can be between Min_Data=0 and Max_Data=255:
  3117. */
  3118. __STATIC_INLINE uint32_t LL_TIM_OC_GetPulseWidth(const TIM_TypeDef *TIMx)
  3119. {
  3120. return (uint32_t)(READ_BIT(TIMx->ECR, TIM_ECR_PW));
  3121. }
  3122. /**
  3123. * @}
  3124. */
  3125. /** @defgroup TIM_LL_EF_Input_Channel Input channel configuration
  3126. * @{
  3127. */
  3128. /**
  3129. * @brief Configure input channel.
  3130. * @rmtoll CCMR1 CC1S LL_TIM_IC_Config\n
  3131. * CCMR1 IC1PSC LL_TIM_IC_Config\n
  3132. * CCMR1 IC1F LL_TIM_IC_Config\n
  3133. * CCMR1 CC2S LL_TIM_IC_Config\n
  3134. * CCMR1 IC2PSC LL_TIM_IC_Config\n
  3135. * CCMR1 IC2F LL_TIM_IC_Config\n
  3136. * CCMR2 CC3S LL_TIM_IC_Config\n
  3137. * CCMR2 IC3PSC LL_TIM_IC_Config\n
  3138. * CCMR2 IC3F LL_TIM_IC_Config\n
  3139. * CCMR2 CC4S LL_TIM_IC_Config\n
  3140. * CCMR2 IC4PSC LL_TIM_IC_Config\n
  3141. * CCMR2 IC4F LL_TIM_IC_Config\n
  3142. * CCER CC1P LL_TIM_IC_Config\n
  3143. * CCER CC1NP LL_TIM_IC_Config\n
  3144. * CCER CC2P LL_TIM_IC_Config\n
  3145. * CCER CC2NP LL_TIM_IC_Config\n
  3146. * CCER CC3P LL_TIM_IC_Config\n
  3147. * CCER CC3NP LL_TIM_IC_Config\n
  3148. * CCER CC4P LL_TIM_IC_Config\n
  3149. * CCER CC4NP LL_TIM_IC_Config
  3150. * @param TIMx Timer instance
  3151. * @param Channel This parameter can be one of the following values:
  3152. * @arg @ref LL_TIM_CHANNEL_CH1
  3153. * @arg @ref LL_TIM_CHANNEL_CH2
  3154. * @arg @ref LL_TIM_CHANNEL_CH3
  3155. * @arg @ref LL_TIM_CHANNEL_CH4
  3156. * @param Configuration This parameter must be a combination of all the following values:
  3157. * @arg @ref LL_TIM_ACTIVEINPUT_DIRECTTI or @ref LL_TIM_ACTIVEINPUT_INDIRECTTI or @ref LL_TIM_ACTIVEINPUT_TRC
  3158. * @arg @ref LL_TIM_ICPSC_DIV1 or ... or @ref LL_TIM_ICPSC_DIV8
  3159. * @arg @ref LL_TIM_IC_FILTER_FDIV1 or ... or @ref LL_TIM_IC_FILTER_FDIV32_N8
  3160. * @arg @ref LL_TIM_IC_POLARITY_RISING or @ref LL_TIM_IC_POLARITY_FALLING or @ref LL_TIM_IC_POLARITY_BOTHEDGE
  3161. * @retval None
  3162. */
  3163. __STATIC_INLINE void LL_TIM_IC_Config(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t Configuration)
  3164. {
  3165. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  3166. __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
  3167. MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]),
  3168. ((Configuration >> 16U) & (TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S)) \
  3169. << SHIFT_TAB_ICxx[iChannel]);
  3170. MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]),
  3171. (Configuration & (TIM_CCER_CC1NP | TIM_CCER_CC1P)) << SHIFT_TAB_CCxP[iChannel]);
  3172. }
  3173. /**
  3174. * @brief Set the active input.
  3175. * @rmtoll CCMR1 CC1S LL_TIM_IC_SetActiveInput\n
  3176. * CCMR1 CC2S LL_TIM_IC_SetActiveInput\n
  3177. * CCMR2 CC3S LL_TIM_IC_SetActiveInput\n
  3178. * CCMR2 CC4S LL_TIM_IC_SetActiveInput
  3179. * @param TIMx Timer instance
  3180. * @param Channel This parameter can be one of the following values:
  3181. * @arg @ref LL_TIM_CHANNEL_CH1
  3182. * @arg @ref LL_TIM_CHANNEL_CH2
  3183. * @arg @ref LL_TIM_CHANNEL_CH3
  3184. * @arg @ref LL_TIM_CHANNEL_CH4
  3185. * @param ICActiveInput This parameter can be one of the following values:
  3186. * @arg @ref LL_TIM_ACTIVEINPUT_DIRECTTI
  3187. * @arg @ref LL_TIM_ACTIVEINPUT_INDIRECTTI
  3188. * @arg @ref LL_TIM_ACTIVEINPUT_TRC
  3189. * @retval None
  3190. */
  3191. __STATIC_INLINE void LL_TIM_IC_SetActiveInput(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICActiveInput)
  3192. {
  3193. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  3194. __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
  3195. MODIFY_REG(*pReg, ((TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]), (ICActiveInput >> 16U) << SHIFT_TAB_ICxx[iChannel]);
  3196. }
  3197. /**
  3198. * @brief Get the current active input.
  3199. * @rmtoll CCMR1 CC1S LL_TIM_IC_GetActiveInput\n
  3200. * CCMR1 CC2S LL_TIM_IC_GetActiveInput\n
  3201. * CCMR2 CC3S LL_TIM_IC_GetActiveInput\n
  3202. * CCMR2 CC4S LL_TIM_IC_GetActiveInput
  3203. * @param TIMx Timer instance
  3204. * @param Channel This parameter can be one of the following values:
  3205. * @arg @ref LL_TIM_CHANNEL_CH1
  3206. * @arg @ref LL_TIM_CHANNEL_CH2
  3207. * @arg @ref LL_TIM_CHANNEL_CH3
  3208. * @arg @ref LL_TIM_CHANNEL_CH4
  3209. * @retval Returned value can be one of the following values:
  3210. * @arg @ref LL_TIM_ACTIVEINPUT_DIRECTTI
  3211. * @arg @ref LL_TIM_ACTIVEINPUT_INDIRECTTI
  3212. * @arg @ref LL_TIM_ACTIVEINPUT_TRC
  3213. */
  3214. __STATIC_INLINE uint32_t LL_TIM_IC_GetActiveInput(const TIM_TypeDef *TIMx, uint32_t Channel)
  3215. {
  3216. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  3217. const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
  3218. return ((READ_BIT(*pReg, ((TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U);
  3219. }
  3220. /**
  3221. * @brief Set the prescaler of input channel.
  3222. * @rmtoll CCMR1 IC1PSC LL_TIM_IC_SetPrescaler\n
  3223. * CCMR1 IC2PSC LL_TIM_IC_SetPrescaler\n
  3224. * CCMR2 IC3PSC LL_TIM_IC_SetPrescaler\n
  3225. * CCMR2 IC4PSC LL_TIM_IC_SetPrescaler
  3226. * @param TIMx Timer instance
  3227. * @param Channel This parameter can be one of the following values:
  3228. * @arg @ref LL_TIM_CHANNEL_CH1
  3229. * @arg @ref LL_TIM_CHANNEL_CH2
  3230. * @arg @ref LL_TIM_CHANNEL_CH3
  3231. * @arg @ref LL_TIM_CHANNEL_CH4
  3232. * @param ICPrescaler This parameter can be one of the following values:
  3233. * @arg @ref LL_TIM_ICPSC_DIV1
  3234. * @arg @ref LL_TIM_ICPSC_DIV2
  3235. * @arg @ref LL_TIM_ICPSC_DIV4
  3236. * @arg @ref LL_TIM_ICPSC_DIV8
  3237. * @retval None
  3238. */
  3239. __STATIC_INLINE void LL_TIM_IC_SetPrescaler(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICPrescaler)
  3240. {
  3241. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  3242. __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
  3243. MODIFY_REG(*pReg, ((TIM_CCMR1_IC1PSC) << SHIFT_TAB_ICxx[iChannel]), (ICPrescaler >> 16U) << SHIFT_TAB_ICxx[iChannel]);
  3244. }
  3245. /**
  3246. * @brief Get the current prescaler value acting on an input channel.
  3247. * @rmtoll CCMR1 IC1PSC LL_TIM_IC_GetPrescaler\n
  3248. * CCMR1 IC2PSC LL_TIM_IC_GetPrescaler\n
  3249. * CCMR2 IC3PSC LL_TIM_IC_GetPrescaler\n
  3250. * CCMR2 IC4PSC LL_TIM_IC_GetPrescaler
  3251. * @param TIMx Timer instance
  3252. * @param Channel This parameter can be one of the following values:
  3253. * @arg @ref LL_TIM_CHANNEL_CH1
  3254. * @arg @ref LL_TIM_CHANNEL_CH2
  3255. * @arg @ref LL_TIM_CHANNEL_CH3
  3256. * @arg @ref LL_TIM_CHANNEL_CH4
  3257. * @retval Returned value can be one of the following values:
  3258. * @arg @ref LL_TIM_ICPSC_DIV1
  3259. * @arg @ref LL_TIM_ICPSC_DIV2
  3260. * @arg @ref LL_TIM_ICPSC_DIV4
  3261. * @arg @ref LL_TIM_ICPSC_DIV8
  3262. */
  3263. __STATIC_INLINE uint32_t LL_TIM_IC_GetPrescaler(const TIM_TypeDef *TIMx, uint32_t Channel)
  3264. {
  3265. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  3266. const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
  3267. return ((READ_BIT(*pReg, ((TIM_CCMR1_IC1PSC) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U);
  3268. }
  3269. /**
  3270. * @brief Set the input filter duration.
  3271. * @rmtoll CCMR1 IC1F LL_TIM_IC_SetFilter\n
  3272. * CCMR1 IC2F LL_TIM_IC_SetFilter\n
  3273. * CCMR2 IC3F LL_TIM_IC_SetFilter\n
  3274. * CCMR2 IC4F LL_TIM_IC_SetFilter
  3275. * @param TIMx Timer instance
  3276. * @param Channel This parameter can be one of the following values:
  3277. * @arg @ref LL_TIM_CHANNEL_CH1
  3278. * @arg @ref LL_TIM_CHANNEL_CH2
  3279. * @arg @ref LL_TIM_CHANNEL_CH3
  3280. * @arg @ref LL_TIM_CHANNEL_CH4
  3281. * @param ICFilter This parameter can be one of the following values:
  3282. * @arg @ref LL_TIM_IC_FILTER_FDIV1
  3283. * @arg @ref LL_TIM_IC_FILTER_FDIV1_N2
  3284. * @arg @ref LL_TIM_IC_FILTER_FDIV1_N4
  3285. * @arg @ref LL_TIM_IC_FILTER_FDIV1_N8
  3286. * @arg @ref LL_TIM_IC_FILTER_FDIV2_N6
  3287. * @arg @ref LL_TIM_IC_FILTER_FDIV2_N8
  3288. * @arg @ref LL_TIM_IC_FILTER_FDIV4_N6
  3289. * @arg @ref LL_TIM_IC_FILTER_FDIV4_N8
  3290. * @arg @ref LL_TIM_IC_FILTER_FDIV8_N6
  3291. * @arg @ref LL_TIM_IC_FILTER_FDIV8_N8
  3292. * @arg @ref LL_TIM_IC_FILTER_FDIV16_N5
  3293. * @arg @ref LL_TIM_IC_FILTER_FDIV16_N6
  3294. * @arg @ref LL_TIM_IC_FILTER_FDIV16_N8
  3295. * @arg @ref LL_TIM_IC_FILTER_FDIV32_N5
  3296. * @arg @ref LL_TIM_IC_FILTER_FDIV32_N6
  3297. * @arg @ref LL_TIM_IC_FILTER_FDIV32_N8
  3298. * @retval None
  3299. */
  3300. __STATIC_INLINE void LL_TIM_IC_SetFilter(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICFilter)
  3301. {
  3302. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  3303. __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
  3304. MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F) << SHIFT_TAB_ICxx[iChannel]), (ICFilter >> 16U) << SHIFT_TAB_ICxx[iChannel]);
  3305. }
  3306. /**
  3307. * @brief Get the input filter duration.
  3308. * @rmtoll CCMR1 IC1F LL_TIM_IC_GetFilter\n
  3309. * CCMR1 IC2F LL_TIM_IC_GetFilter\n
  3310. * CCMR2 IC3F LL_TIM_IC_GetFilter\n
  3311. * CCMR2 IC4F LL_TIM_IC_GetFilter
  3312. * @param TIMx Timer instance
  3313. * @param Channel This parameter can be one of the following values:
  3314. * @arg @ref LL_TIM_CHANNEL_CH1
  3315. * @arg @ref LL_TIM_CHANNEL_CH2
  3316. * @arg @ref LL_TIM_CHANNEL_CH3
  3317. * @arg @ref LL_TIM_CHANNEL_CH4
  3318. * @retval Returned value can be one of the following values:
  3319. * @arg @ref LL_TIM_IC_FILTER_FDIV1
  3320. * @arg @ref LL_TIM_IC_FILTER_FDIV1_N2
  3321. * @arg @ref LL_TIM_IC_FILTER_FDIV1_N4
  3322. * @arg @ref LL_TIM_IC_FILTER_FDIV1_N8
  3323. * @arg @ref LL_TIM_IC_FILTER_FDIV2_N6
  3324. * @arg @ref LL_TIM_IC_FILTER_FDIV2_N8
  3325. * @arg @ref LL_TIM_IC_FILTER_FDIV4_N6
  3326. * @arg @ref LL_TIM_IC_FILTER_FDIV4_N8
  3327. * @arg @ref LL_TIM_IC_FILTER_FDIV8_N6
  3328. * @arg @ref LL_TIM_IC_FILTER_FDIV8_N8
  3329. * @arg @ref LL_TIM_IC_FILTER_FDIV16_N5
  3330. * @arg @ref LL_TIM_IC_FILTER_FDIV16_N6
  3331. * @arg @ref LL_TIM_IC_FILTER_FDIV16_N8
  3332. * @arg @ref LL_TIM_IC_FILTER_FDIV32_N5
  3333. * @arg @ref LL_TIM_IC_FILTER_FDIV32_N6
  3334. * @arg @ref LL_TIM_IC_FILTER_FDIV32_N8
  3335. */
  3336. __STATIC_INLINE uint32_t LL_TIM_IC_GetFilter(const TIM_TypeDef *TIMx, uint32_t Channel)
  3337. {
  3338. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  3339. const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
  3340. return ((READ_BIT(*pReg, ((TIM_CCMR1_IC1F) << SHIFT_TAB_ICxx[iChannel])) >> SHIFT_TAB_ICxx[iChannel]) << 16U);
  3341. }
  3342. /**
  3343. * @brief Set the input channel polarity.
  3344. * @rmtoll CCER CC1P LL_TIM_IC_SetPolarity\n
  3345. * CCER CC1NP LL_TIM_IC_SetPolarity\n
  3346. * CCER CC2P LL_TIM_IC_SetPolarity\n
  3347. * CCER CC2NP LL_TIM_IC_SetPolarity\n
  3348. * CCER CC3P LL_TIM_IC_SetPolarity\n
  3349. * CCER CC3NP LL_TIM_IC_SetPolarity\n
  3350. * CCER CC4P LL_TIM_IC_SetPolarity\n
  3351. * CCER CC4NP LL_TIM_IC_SetPolarity
  3352. * @param TIMx Timer instance
  3353. * @param Channel This parameter can be one of the following values:
  3354. * @arg @ref LL_TIM_CHANNEL_CH1
  3355. * @arg @ref LL_TIM_CHANNEL_CH2
  3356. * @arg @ref LL_TIM_CHANNEL_CH3
  3357. * @arg @ref LL_TIM_CHANNEL_CH4
  3358. * @param ICPolarity This parameter can be one of the following values:
  3359. * @arg @ref LL_TIM_IC_POLARITY_RISING
  3360. * @arg @ref LL_TIM_IC_POLARITY_FALLING
  3361. * @arg @ref LL_TIM_IC_POLARITY_BOTHEDGE
  3362. * @retval None
  3363. */
  3364. __STATIC_INLINE void LL_TIM_IC_SetPolarity(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ICPolarity)
  3365. {
  3366. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  3367. MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]),
  3368. ICPolarity << SHIFT_TAB_CCxP[iChannel]);
  3369. }
  3370. /**
  3371. * @brief Get the current input channel polarity.
  3372. * @rmtoll CCER CC1P LL_TIM_IC_GetPolarity\n
  3373. * CCER CC1NP LL_TIM_IC_GetPolarity\n
  3374. * CCER CC2P LL_TIM_IC_GetPolarity\n
  3375. * CCER CC2NP LL_TIM_IC_GetPolarity\n
  3376. * CCER CC3P LL_TIM_IC_GetPolarity\n
  3377. * CCER CC3NP LL_TIM_IC_GetPolarity\n
  3378. * CCER CC4P LL_TIM_IC_GetPolarity\n
  3379. * CCER CC4NP LL_TIM_IC_GetPolarity
  3380. * @param TIMx Timer instance
  3381. * @param Channel This parameter can be one of the following values:
  3382. * @arg @ref LL_TIM_CHANNEL_CH1
  3383. * @arg @ref LL_TIM_CHANNEL_CH2
  3384. * @arg @ref LL_TIM_CHANNEL_CH3
  3385. * @arg @ref LL_TIM_CHANNEL_CH4
  3386. * @retval Returned value can be one of the following values:
  3387. * @arg @ref LL_TIM_IC_POLARITY_RISING
  3388. * @arg @ref LL_TIM_IC_POLARITY_FALLING
  3389. * @arg @ref LL_TIM_IC_POLARITY_BOTHEDGE
  3390. */
  3391. __STATIC_INLINE uint32_t LL_TIM_IC_GetPolarity(const TIM_TypeDef *TIMx, uint32_t Channel)
  3392. {
  3393. uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
  3394. return (READ_BIT(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel])) >>
  3395. SHIFT_TAB_CCxP[iChannel]);
  3396. }
  3397. /**
  3398. * @brief Connect the TIMx_CH1, CH2 and CH3 pins to the TI1 input (XOR combination).
  3399. * @note Macro IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not
  3400. * a timer instance provides an XOR input.
  3401. * @rmtoll CR2 TI1S LL_TIM_IC_EnableXORCombination
  3402. * @param TIMx Timer instance
  3403. * @retval None
  3404. */
  3405. __STATIC_INLINE void LL_TIM_IC_EnableXORCombination(TIM_TypeDef *TIMx)
  3406. {
  3407. SET_BIT(TIMx->CR2, TIM_CR2_TI1S);
  3408. }
  3409. /**
  3410. * @brief Disconnect the TIMx_CH1, CH2 and CH3 pins from the TI1 input.
  3411. * @note Macro IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not
  3412. * a timer instance provides an XOR input.
  3413. * @rmtoll CR2 TI1S LL_TIM_IC_DisableXORCombination
  3414. * @param TIMx Timer instance
  3415. * @retval None
  3416. */
  3417. __STATIC_INLINE void LL_TIM_IC_DisableXORCombination(TIM_TypeDef *TIMx)
  3418. {
  3419. CLEAR_BIT(TIMx->CR2, TIM_CR2_TI1S);
  3420. }
  3421. /**
  3422. * @brief Indicates whether the TIMx_CH1, CH2 and CH3 pins are connectected to the TI1 input.
  3423. * @note Macro IS_TIM_XOR_INSTANCE(TIMx) can be used to check whether or not
  3424. * a timer instance provides an XOR input.
  3425. * @rmtoll CR2 TI1S LL_TIM_IC_IsEnabledXORCombination
  3426. * @param TIMx Timer instance
  3427. * @retval State of bit (1 or 0).
  3428. */
  3429. __STATIC_INLINE uint32_t LL_TIM_IC_IsEnabledXORCombination(const TIM_TypeDef *TIMx)
  3430. {
  3431. return ((READ_BIT(TIMx->CR2, TIM_CR2_TI1S) == (TIM_CR2_TI1S)) ? 1UL : 0UL);
  3432. }
  3433. /**
  3434. * @brief Get captured value for input channel 1.
  3435. * @note In 32-bit timer implementations returned captured value can be between 0x00000000 and 0xFFFFFFFF.
  3436. * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check
  3437. * whether or not a timer instance supports a 32 bits counter.
  3438. * @note Macro IS_TIM_CC1_INSTANCE(TIMx) can be used to check whether or not
  3439. * input channel 1 is supported by a timer instance.
  3440. * @note If dithering is activated, pay attention to the returned value interpretation.
  3441. * @rmtoll CCR1 CCR1 LL_TIM_IC_GetCaptureCH1
  3442. * @param TIMx Timer instance
  3443. * @retval CapturedValue (between Min_Data=0 and Max_Data=65535)
  3444. */
  3445. __STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH1(const TIM_TypeDef *TIMx)
  3446. {
  3447. return (uint32_t)(READ_REG(TIMx->CCR1));
  3448. }
  3449. /**
  3450. * @brief Get captured value for input channel 2.
  3451. * @note In 32-bit timer implementations returned captured value can be between 0x00000000 and 0xFFFFFFFF.
  3452. * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check
  3453. * whether or not a timer instance supports a 32 bits counter.
  3454. * @note Macro IS_TIM_CC2_INSTANCE(TIMx) can be used to check whether or not
  3455. * input channel 2 is supported by a timer instance.
  3456. * @note If dithering is activated, pay attention to the returned value interpretation.
  3457. * @rmtoll CCR2 CCR2 LL_TIM_IC_GetCaptureCH2
  3458. * @param TIMx Timer instance
  3459. * @retval CapturedValue (between Min_Data=0 and Max_Data=65535)
  3460. */
  3461. __STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH2(const TIM_TypeDef *TIMx)
  3462. {
  3463. return (uint32_t)(READ_REG(TIMx->CCR2));
  3464. }
  3465. /**
  3466. * @brief Get captured value for input channel 3.
  3467. * @note In 32-bit timer implementations returned captured value can be between 0x00000000 and 0xFFFFFFFF.
  3468. * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check
  3469. * whether or not a timer instance supports a 32 bits counter.
  3470. * @note Macro IS_TIM_CC3_INSTANCE(TIMx) can be used to check whether or not
  3471. * input channel 3 is supported by a timer instance.
  3472. * @note If dithering is activated, pay attention to the returned value interpretation.
  3473. * @rmtoll CCR3 CCR3 LL_TIM_IC_GetCaptureCH3
  3474. * @param TIMx Timer instance
  3475. * @retval CapturedValue (between Min_Data=0 and Max_Data=65535)
  3476. */
  3477. __STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH3(const TIM_TypeDef *TIMx)
  3478. {
  3479. return (uint32_t)(READ_REG(TIMx->CCR3));
  3480. }
  3481. /**
  3482. * @brief Get captured value for input channel 4.
  3483. * @note In 32-bit timer implementations returned captured value can be between 0x00000000 and 0xFFFFFFFF.
  3484. * @note Macro IS_TIM_32B_COUNTER_INSTANCE(TIMx) can be used to check
  3485. * whether or not a timer instance supports a 32 bits counter.
  3486. * @note Macro IS_TIM_CC4_INSTANCE(TIMx) can be used to check whether or not
  3487. * input channel 4 is supported by a timer instance.
  3488. * @note If dithering is activated, pay attention to the returned value interpretation.
  3489. * @rmtoll CCR4 CCR4 LL_TIM_IC_GetCaptureCH4
  3490. * @param TIMx Timer instance
  3491. * @retval CapturedValue (between Min_Data=0 and Max_Data=65535)
  3492. */
  3493. __STATIC_INLINE uint32_t LL_TIM_IC_GetCaptureCH4(const TIM_TypeDef *TIMx)
  3494. {
  3495. return (uint32_t)(READ_REG(TIMx->CCR4));
  3496. }
  3497. /**
  3498. * @}
  3499. */
  3500. /** @defgroup TIM_LL_EF_Clock_Selection Counter clock selection
  3501. * @{
  3502. */
  3503. /**
  3504. * @brief Enable external clock mode 2.
  3505. * @note When external clock mode 2 is enabled the counter is clocked by any active edge on the ETRF signal.
  3506. * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check
  3507. * whether or not a timer instance supports external clock mode2.
  3508. * @rmtoll SMCR ECE LL_TIM_EnableExternalClock
  3509. * @param TIMx Timer instance
  3510. * @retval None
  3511. */
  3512. __STATIC_INLINE void LL_TIM_EnableExternalClock(TIM_TypeDef *TIMx)
  3513. {
  3514. SET_BIT(TIMx->SMCR, TIM_SMCR_ECE);
  3515. }
  3516. /**
  3517. * @brief Disable external clock mode 2.
  3518. * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check
  3519. * whether or not a timer instance supports external clock mode2.
  3520. * @rmtoll SMCR ECE LL_TIM_DisableExternalClock
  3521. * @param TIMx Timer instance
  3522. * @retval None
  3523. */
  3524. __STATIC_INLINE void LL_TIM_DisableExternalClock(TIM_TypeDef *TIMx)
  3525. {
  3526. CLEAR_BIT(TIMx->SMCR, TIM_SMCR_ECE);
  3527. }
  3528. /**
  3529. * @brief Indicate whether external clock mode 2 is enabled.
  3530. * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check
  3531. * whether or not a timer instance supports external clock mode2.
  3532. * @rmtoll SMCR ECE LL_TIM_IsEnabledExternalClock
  3533. * @param TIMx Timer instance
  3534. * @retval State of bit (1 or 0).
  3535. */
  3536. __STATIC_INLINE uint32_t LL_TIM_IsEnabledExternalClock(const TIM_TypeDef *TIMx)
  3537. {
  3538. return ((READ_BIT(TIMx->SMCR, TIM_SMCR_ECE) == (TIM_SMCR_ECE)) ? 1UL : 0UL);
  3539. }
  3540. /**
  3541. * @brief Set the clock source of the counter clock.
  3542. * @note when selected clock source is external clock mode 1, the timer input
  3543. * the external clock is applied is selected by calling the @ref LL_TIM_SetTriggerInput()
  3544. * function. This timer input must be configured by calling
  3545. * the @ref LL_TIM_IC_Config() function.
  3546. * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE(TIMx) can be used to check
  3547. * whether or not a timer instance supports external clock mode1.
  3548. * @note Macro IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(TIMx) can be used to check
  3549. * whether or not a timer instance supports external clock mode2.
  3550. * @rmtoll SMCR SMS LL_TIM_SetClockSource\n
  3551. * SMCR ECE LL_TIM_SetClockSource
  3552. * @param TIMx Timer instance
  3553. * @param ClockSource This parameter can be one of the following values:
  3554. * @arg @ref LL_TIM_CLOCKSOURCE_INTERNAL
  3555. * @arg @ref LL_TIM_CLOCKSOURCE_EXT_MODE1
  3556. * @arg @ref LL_TIM_CLOCKSOURCE_EXT_MODE2
  3557. * @retval None
  3558. */
  3559. __STATIC_INLINE void LL_TIM_SetClockSource(TIM_TypeDef *TIMx, uint32_t ClockSource)
  3560. {
  3561. MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS | TIM_SMCR_ECE, ClockSource);
  3562. }
  3563. /**
  3564. * @brief Set the encoder interface mode.
  3565. * @note Macro IS_TIM_ENCODER_INTERFACE_INSTANCE(TIMx) can be used to check
  3566. * whether or not a timer instance supports the encoder mode.
  3567. * @rmtoll SMCR SMS LL_TIM_SetEncoderMode
  3568. * @param TIMx Timer instance
  3569. * @param EncoderMode This parameter can be one of the following values:
  3570. * @arg @ref LL_TIM_ENCODERMODE_X2_TI1
  3571. * @arg @ref LL_TIM_ENCODERMODE_X2_TI2
  3572. * @arg @ref LL_TIM_ENCODERMODE_X4_TI12
  3573. * @arg @ref LL_TIM_ENCODERMODE_CLOCKPLUSDIRECTION_X2
  3574. * @arg @ref LL_TIM_ENCODERMODE_CLOCKPLUSDIRECTION_X1
  3575. * @arg @ref LL_TIM_ENCODERMODE_DIRECTIONALCLOCK_X2
  3576. * @arg @ref LL_TIM_ENCODERMODE_DIRECTIONALCLOCK_X1_TI12
  3577. * @arg @ref LL_TIM_ENCODERMODE_X1_TI1
  3578. * @arg @ref LL_TIM_ENCODERMODE_X1_TI2
  3579. * @retval None
  3580. */
  3581. __STATIC_INLINE void LL_TIM_SetEncoderMode(TIM_TypeDef *TIMx, uint32_t EncoderMode)
  3582. {
  3583. MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS, EncoderMode);
  3584. }
  3585. /**
  3586. * @}
  3587. */
  3588. /** @defgroup TIM_LL_EF_Timer_Synchronization Timer synchronisation configuration
  3589. * @{
  3590. */
  3591. /**
  3592. * @brief Set the trigger output (TRGO) used for timer synchronization .
  3593. * @note Macro IS_TIM_MASTER_INSTANCE(TIMx) can be used to check
  3594. * whether or not a timer instance can operate as a master timer.
  3595. * @rmtoll CR2 MMS LL_TIM_SetTriggerOutput
  3596. * @param TIMx Timer instance
  3597. * @param TimerSynchronization This parameter can be one of the following values:
  3598. * @arg @ref LL_TIM_TRGO_RESET
  3599. * @arg @ref LL_TIM_TRGO_ENABLE
  3600. * @arg @ref LL_TIM_TRGO_UPDATE
  3601. * @arg @ref LL_TIM_TRGO_CC1IF
  3602. * @arg @ref LL_TIM_TRGO_OC1REF
  3603. * @arg @ref LL_TIM_TRGO_OC2REF
  3604. * @arg @ref LL_TIM_TRGO_OC3REF
  3605. * @arg @ref LL_TIM_TRGO_OC4REF
  3606. * @arg @ref LL_TIM_TRGO_ENCODERCLK
  3607. * @retval None
  3608. */
  3609. __STATIC_INLINE void LL_TIM_SetTriggerOutput(TIM_TypeDef *TIMx, uint32_t TimerSynchronization)
  3610. {
  3611. MODIFY_REG(TIMx->CR2, TIM_CR2_MMS, TimerSynchronization);
  3612. }
  3613. /**
  3614. * @brief Set the trigger output 2 (TRGO2) used for ADC synchronization .
  3615. * @note Macro IS_TIM_TRGO2_INSTANCE(TIMx) can be used to check
  3616. * whether or not a timer instance can be used for ADC synchronization.
  3617. * @rmtoll CR2 MMS2 LL_TIM_SetTriggerOutput2
  3618. * @param TIMx Timer Instance
  3619. * @param ADCSynchronization This parameter can be one of the following values:
  3620. * @arg @ref LL_TIM_TRGO2_RESET
  3621. * @arg @ref LL_TIM_TRGO2_ENABLE
  3622. * @arg @ref LL_TIM_TRGO2_UPDATE
  3623. * @arg @ref LL_TIM_TRGO2_CC1F
  3624. * @arg @ref LL_TIM_TRGO2_OC1
  3625. * @arg @ref LL_TIM_TRGO2_OC2
  3626. * @arg @ref LL_TIM_TRGO2_OC3
  3627. * @arg @ref LL_TIM_TRGO2_OC4
  3628. * @arg @ref LL_TIM_TRGO2_OC5
  3629. * @arg @ref LL_TIM_TRGO2_OC6
  3630. * @arg @ref LL_TIM_TRGO2_OC4_RISINGFALLING
  3631. * @arg @ref LL_TIM_TRGO2_OC6_RISINGFALLING
  3632. * @arg @ref LL_TIM_TRGO2_OC4_RISING_OC6_RISING
  3633. * @arg @ref LL_TIM_TRGO2_OC4_RISING_OC6_FALLING
  3634. * @arg @ref LL_TIM_TRGO2_OC5_RISING_OC6_RISING
  3635. * @arg @ref LL_TIM_TRGO2_OC5_RISING_OC6_FALLING
  3636. * @retval None
  3637. */
  3638. __STATIC_INLINE void LL_TIM_SetTriggerOutput2(TIM_TypeDef *TIMx, uint32_t ADCSynchronization)
  3639. {
  3640. MODIFY_REG(TIMx->CR2, TIM_CR2_MMS2, ADCSynchronization);
  3641. }
  3642. /**
  3643. * @brief Set the synchronization mode of a slave timer.
  3644. * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not
  3645. * a timer instance can operate as a slave timer.
  3646. * @rmtoll SMCR SMS LL_TIM_SetSlaveMode
  3647. * @param TIMx Timer instance
  3648. * @param SlaveMode This parameter can be one of the following values:
  3649. * @arg @ref LL_TIM_SLAVEMODE_DISABLED
  3650. * @arg @ref LL_TIM_SLAVEMODE_RESET
  3651. * @arg @ref LL_TIM_SLAVEMODE_GATED
  3652. * @arg @ref LL_TIM_SLAVEMODE_TRIGGER
  3653. * @arg @ref LL_TIM_SLAVEMODE_COMBINED_RESETTRIGGER
  3654. * @arg @ref LL_TIM_SLAVEMODE_COMBINED_GATEDRESET
  3655. * @retval None
  3656. */
  3657. __STATIC_INLINE void LL_TIM_SetSlaveMode(TIM_TypeDef *TIMx, uint32_t SlaveMode)
  3658. {
  3659. MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMS, SlaveMode);
  3660. }
  3661. /**
  3662. * @brief Set the selects the trigger input to be used to synchronize the counter.
  3663. * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not
  3664. * a timer instance can operate as a slave timer.
  3665. * @rmtoll SMCR TS LL_TIM_SetTriggerInput
  3666. * @param TIMx Timer instance
  3667. * @param TriggerInput This parameter can be one of the following values:
  3668. * @arg @ref LL_TIM_TS_ITR0
  3669. * @arg @ref LL_TIM_TS_ITR1
  3670. * @arg @ref LL_TIM_TS_ITR2
  3671. * @arg @ref LL_TIM_TS_ITR3
  3672. * @arg @ref LL_TIM_TS_ITR4
  3673. * @arg @ref LL_TIM_TS_ITR5
  3674. * @arg @ref LL_TIM_TS_ITR6
  3675. * @arg @ref LL_TIM_TS_ITR7
  3676. * @arg @ref LL_TIM_TS_ITR8
  3677. * @arg @ref LL_TIM_TS_ITR9
  3678. * @arg @ref LL_TIM_TS_ITR10
  3679. * @arg @ref LL_TIM_TS_ITR11
  3680. * @arg @ref LL_TIM_TS_ITR12
  3681. * @arg @ref LL_TIM_TS_TI1F_ED
  3682. * @arg @ref LL_TIM_TS_TI1FP1
  3683. * @arg @ref LL_TIM_TS_TI2FP2
  3684. * @arg @ref LL_TIM_TS_ETRF
  3685. * @retval None
  3686. */
  3687. __STATIC_INLINE void LL_TIM_SetTriggerInput(TIM_TypeDef *TIMx, uint32_t TriggerInput)
  3688. {
  3689. MODIFY_REG(TIMx->SMCR, TIM_SMCR_TS, TriggerInput);
  3690. }
  3691. /**
  3692. * @brief Enable the Master/Slave mode.
  3693. * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not
  3694. * a timer instance can operate as a slave timer.
  3695. * @rmtoll SMCR MSM LL_TIM_EnableMasterSlaveMode
  3696. * @param TIMx Timer instance
  3697. * @retval None
  3698. */
  3699. __STATIC_INLINE void LL_TIM_EnableMasterSlaveMode(TIM_TypeDef *TIMx)
  3700. {
  3701. SET_BIT(TIMx->SMCR, TIM_SMCR_MSM);
  3702. }
  3703. /**
  3704. * @brief Disable the Master/Slave mode.
  3705. * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not
  3706. * a timer instance can operate as a slave timer.
  3707. * @rmtoll SMCR MSM LL_TIM_DisableMasterSlaveMode
  3708. * @param TIMx Timer instance
  3709. * @retval None
  3710. */
  3711. __STATIC_INLINE void LL_TIM_DisableMasterSlaveMode(TIM_TypeDef *TIMx)
  3712. {
  3713. CLEAR_BIT(TIMx->SMCR, TIM_SMCR_MSM);
  3714. }
  3715. /**
  3716. * @brief Indicates whether the Master/Slave mode is enabled.
  3717. * @note Macro IS_TIM_SLAVE_INSTANCE(TIMx) can be used to check whether or not
  3718. * a timer instance can operate as a slave timer.
  3719. * @rmtoll SMCR MSM LL_TIM_IsEnabledMasterSlaveMode
  3720. * @param TIMx Timer instance
  3721. * @retval State of bit (1 or 0).
  3722. */
  3723. __STATIC_INLINE uint32_t LL_TIM_IsEnabledMasterSlaveMode(const TIM_TypeDef *TIMx)
  3724. {
  3725. return ((READ_BIT(TIMx->SMCR, TIM_SMCR_MSM) == (TIM_SMCR_MSM)) ? 1UL : 0UL);
  3726. }
  3727. /**
  3728. * @brief Configure the external trigger (ETR) input.
  3729. * @note Macro IS_TIM_ETR_INSTANCE(TIMx) can be used to check whether or not
  3730. * a timer instance provides an external trigger input.
  3731. * @rmtoll SMCR ETP LL_TIM_ConfigETR\n
  3732. * SMCR ETPS LL_TIM_ConfigETR\n
  3733. * SMCR ETF LL_TIM_ConfigETR
  3734. * @param TIMx Timer instance
  3735. * @param ETRPolarity This parameter can be one of the following values:
  3736. * @arg @ref LL_TIM_ETR_POLARITY_NONINVERTED
  3737. * @arg @ref LL_TIM_ETR_POLARITY_INVERTED
  3738. * @param ETRPrescaler This parameter can be one of the following values:
  3739. * @arg @ref LL_TIM_ETR_PRESCALER_DIV1
  3740. * @arg @ref LL_TIM_ETR_PRESCALER_DIV2
  3741. * @arg @ref LL_TIM_ETR_PRESCALER_DIV4
  3742. * @arg @ref LL_TIM_ETR_PRESCALER_DIV8
  3743. * @param ETRFilter This parameter can be one of the following values:
  3744. * @arg @ref LL_TIM_ETR_FILTER_FDIV1
  3745. * @arg @ref LL_TIM_ETR_FILTER_FDIV1_N2
  3746. * @arg @ref LL_TIM_ETR_FILTER_FDIV1_N4
  3747. * @arg @ref LL_TIM_ETR_FILTER_FDIV1_N8
  3748. * @arg @ref LL_TIM_ETR_FILTER_FDIV2_N6
  3749. * @arg @ref LL_TIM_ETR_FILTER_FDIV2_N8
  3750. * @arg @ref LL_TIM_ETR_FILTER_FDIV4_N6
  3751. * @arg @ref LL_TIM_ETR_FILTER_FDIV4_N8
  3752. * @arg @ref LL_TIM_ETR_FILTER_FDIV8_N6
  3753. * @arg @ref LL_TIM_ETR_FILTER_FDIV8_N8
  3754. * @arg @ref LL_TIM_ETR_FILTER_FDIV16_N5
  3755. * @arg @ref LL_TIM_ETR_FILTER_FDIV16_N6
  3756. * @arg @ref LL_TIM_ETR_FILTER_FDIV16_N8
  3757. * @arg @ref LL_TIM_ETR_FILTER_FDIV32_N5
  3758. * @arg @ref LL_TIM_ETR_FILTER_FDIV32_N6
  3759. * @arg @ref LL_TIM_ETR_FILTER_FDIV32_N8
  3760. * @retval None
  3761. */
  3762. __STATIC_INLINE void LL_TIM_ConfigETR(TIM_TypeDef *TIMx, uint32_t ETRPolarity, uint32_t ETRPrescaler,
  3763. uint32_t ETRFilter)
  3764. {
  3765. MODIFY_REG(TIMx->SMCR, TIM_SMCR_ETP | TIM_SMCR_ETPS | TIM_SMCR_ETF, ETRPolarity | ETRPrescaler | ETRFilter);
  3766. }
  3767. /**
  3768. * @brief Select the external trigger (ETR) input source.
  3769. * @note Macro IS_TIM_ETRSEL_INSTANCE(TIMx) can be used to check whether or
  3770. * not a timer instance supports ETR source selection.
  3771. * @rmtoll AF1 ETRSEL LL_TIM_SetETRSource
  3772. * @param TIMx Timer instance
  3773. * @param ETRSource This parameter can be one of the following values:
  3774. *
  3775. * TIM1: any combination of ETR_RMP where
  3776. *
  3777. * @arg @ref LL_TIM_TIM1_ETRSOURCE_GPIO
  3778. * @arg @ref LL_TIM_TIM1_ETRSOURCE_COMP1 (*)
  3779. * @arg @ref LL_TIM_TIM1_ETRSOURCE_COMP2 (*)
  3780. * @arg @ref LL_TIM_TIM1_ETRSOURCE_ADC1_AWD1
  3781. * @arg @ref LL_TIM_TIM1_ETRSOURCE_ADC1_AWD2
  3782. * @arg @ref LL_TIM_TIM1_ETRSOURCE_ADC1_AWD3
  3783. *
  3784. * TIM2: any combination of ETR_RMP where
  3785. *
  3786. * @arg @ref LL_TIM_TIM2_ETRSOURCE_GPIO
  3787. * @arg @ref LL_TIM_TIM2_ETRSOURCE_COMP1 (*)
  3788. * @arg @ref LL_TIM_TIM2_ETRSOURCE_COMP2 (*)
  3789. * @arg @ref LL_TIM_TIM2_ETRSOURCE_LSE
  3790. * @arg @ref LL_TIM_TIM2_ETRSOURCE_SAI1_FSA (*)
  3791. * @arg @ref LL_TIM_TIM2_ETRSOURCE_SAI1_FSB (*)
  3792. * @arg @ref LL_TIM_TIM2_ETRSOURCE_TIM3_ETR
  3793. * @arg @ref LL_TIM_TIM2_ETRSOURCE_TIM4_ETR (*)
  3794. * @arg @ref LL_TIM_TIM2_ETRSOURCE_TIM5_ETR (*)
  3795. * @arg @ref LL_TIM_TIM2_ETRSOURCE_USB_SOF (*)
  3796. * @arg @ref LL_TIM_TIM2_ETRSOURCE_USBHS_SOF (*)
  3797. * @arg @ref LL_TIM_TIM2_ETRSOURCE_USBFS_SOF (*)
  3798. * @arg @ref LL_TIM_TIM2_ETRSOURCE_ETH_PPS (*)
  3799. * @arg @ref LL_TIM_TIM2_ETRSOURCE_PLAY1_OUT0 (*)
  3800. *
  3801. * TIM3: any combination of ETR_RMP where
  3802. *
  3803. * @arg @ref LL_TIM_TIM3_ETRSOURCE_GPIO
  3804. * @arg @ref LL_TIM_TIM3_ETRSOURCE_COMP1 (*)
  3805. * @arg @ref LL_TIM_TIM3_ETRSOURCE_COMP2 (*)
  3806. * @arg @ref LL_TIM_TIM3_ETRSOURCE_ADC2_AWD1 (*)
  3807. * @arg @ref LL_TIM_TIM3_ETRSOURCE_ADC2_AWD2 (*)
  3808. * @arg @ref LL_TIM_TIM3_ETRSOURCE_ADC2_AWD3 (*)
  3809. * @arg @ref LL_TIM_TIM3_ETRSOURCE_TIM2_ETR
  3810. * @arg @ref LL_TIM_TIM3_ETRSOURCE_TIM4_ETR (*)
  3811. * @arg @ref LL_TIM_TIM3_ETRSOURCE_TIM5_ETR (*)
  3812. * @arg @ref LL_TIM_TIM3_ETRSOURCE_ETH_PPS (*)
  3813. * @arg @ref LL_TIM_TIM3_ETRSOURCE_PLAY1_OUT0 (*)
  3814. *
  3815. * TIM4: any combination of ETR_RMP where (**)
  3816. *
  3817. * @arg @ref LL_TIM_TIM4_ETRSOURCE_GPIO
  3818. * @arg @ref LL_TIM_TIM4_ETRSOURCE_COMP1 (*)
  3819. * @arg @ref LL_TIM_TIM4_ETRSOURCE_COMP2 (*)
  3820. * @arg @ref LL_TIM_TIM4_ETRSOURCE_TIM2_ETR
  3821. * @arg @ref LL_TIM_TIM4_ETRSOURCE_TIM3_ETR
  3822. * @arg @ref LL_TIM_TIM4_ETRSOURCE_TIM5_ETR
  3823. *
  3824. * TIM5: any combination of ETR_RMP where (**)
  3825. *
  3826. * @arg @ref LL_TIM_TIM5_ETRSOURCE_GPIO
  3827. * @arg @ref LL_TIM_TIM5_ETRSOURCE_SAI2_FSA
  3828. * @arg @ref LL_TIM_TIM5_ETRSOURCE_SAI2_FSB
  3829. * @arg @ref LL_TIM_TIM5_ETRSOURCE_COMP1 (*)
  3830. * @arg @ref LL_TIM_TIM5_ETRSOURCE_COMP2 (*)
  3831. * @arg @ref LL_TIM_TIM5_ETRSOURCE_TIM2_ETR
  3832. * @arg @ref LL_TIM_TIM5_ETRSOURCE_TIM3_ETR
  3833. * @arg @ref LL_TIM_TIM5_ETRSOURCE_TIM4_ETR
  3834. * @arg @ref LL_TIM_TIM5_ETRSOURCE_USB_SOF (*)
  3835. * @arg @ref LL_TIM_TIM5_ETRSOURCE_USBHS_SOF (*)
  3836. * @arg @ref LL_TIM_TIM5_ETRSOURCE_USBFS_SOF (*)
  3837. *
  3838. * TIM8: any combination of ETR_RMP where (**)
  3839. *
  3840. * . . ETR_RMP can be one of the following values
  3841. * @arg @ref LL_TIM_TIM8_ETRSOURCE_GPIO
  3842. * @arg @ref LL_TIM_TIM8_ETRSOURCE_COMP1 (*)
  3843. * @arg @ref LL_TIM_TIM8_ETRSOURCE_COMP2 (*)
  3844. * @arg @ref LL_TIM_TIM8_ETRSOURCE_ADC2_AWD1
  3845. * @arg @ref LL_TIM_TIM8_ETRSOURCE_ADC2_AWD2
  3846. * @arg @ref LL_TIM_TIM8_ETRSOURCE_ADC2_AWD3
  3847. * @arg @ref LL_TIM_TIM8_ETRSOURCE_ADC3_AWD1 (*)
  3848. * @arg @ref LL_TIM_TIM8_ETRSOURCE_ADC3_AWD2 (*)
  3849. * @arg @ref LL_TIM_TIM8_ETRSOURCE_ADC3_AWD3 (*)
  3850. *
  3851. * (*) Value not defined in all devices. \n
  3852. * (**) Timer instance not available on all devices. \n
  3853. * @retval None
  3854. */
  3855. __STATIC_INLINE void LL_TIM_SetETRSource(TIM_TypeDef *TIMx, uint32_t ETRSource)
  3856. {
  3857. MODIFY_REG(TIMx->AF1, TIMx_AF1_ETRSEL, ETRSource);
  3858. }
  3859. /**
  3860. * @brief Enable SMS preload.
  3861. * @note Macro IS_TIM_SMS_PRELOAD_INSTANCE(TIMx) can be used to check
  3862. * whether or not a timer instance supports the preload of SMS field in SMCR register.
  3863. * @rmtoll SMCR SMSPE LL_TIM_EnableSMSPreload
  3864. * @param TIMx Timer instance
  3865. * @retval None
  3866. */
  3867. __STATIC_INLINE void LL_TIM_EnableSMSPreload(TIM_TypeDef *TIMx)
  3868. {
  3869. SET_BIT(TIMx->SMCR, TIM_SMCR_SMSPE);
  3870. }
  3871. /**
  3872. * @brief Disable SMS preload.
  3873. * @note Macro IS_TIM_SMS_PRELOAD_INSTANCE(TIMx) can be used to check
  3874. * whether or not a timer instance supports the preload of SMS field in SMCR register.
  3875. * @rmtoll SMCR SMSPE LL_TIM_DisableSMSPreload
  3876. * @param TIMx Timer instance
  3877. * @retval None
  3878. */
  3879. __STATIC_INLINE void LL_TIM_DisableSMSPreload(TIM_TypeDef *TIMx)
  3880. {
  3881. CLEAR_BIT(TIMx->SMCR, TIM_SMCR_SMSPE);
  3882. }
  3883. /**
  3884. * @brief Indicate whether SMS preload is enabled.
  3885. * @note Macro IS_TIM_SMS_PRELOAD_INSTANCE(TIMx) can be used to check
  3886. * whether or not a timer instance supports the preload of SMS field in SMCR register.
  3887. * @rmtoll SMCR SMSPE LL_TIM_IsEnabledSMSPreload
  3888. * @param TIMx Timer instance
  3889. * @retval State of bit (1 or 0).
  3890. */
  3891. __STATIC_INLINE uint32_t LL_TIM_IsEnabledSMSPreload(const TIM_TypeDef *TIMx)
  3892. {
  3893. return ((READ_BIT(TIMx->SMCR, TIM_SMCR_SMSPE) == (TIM_SMCR_SMSPE)) ? 1UL : 0UL);
  3894. }
  3895. /**
  3896. * @brief Set the preload source of SMS.
  3897. * @note Macro IS_TIM_SMS_PRELOAD_INSTANCE(TIMx) can be used to check
  3898. * whether or not a timer instance supports the preload of SMS field in SMCR register.
  3899. * @rmtoll SMCR SMSPS LL_TIM_SetSMSPreloadSource\n
  3900. * @param TIMx Timer instance
  3901. * @param PreloadSource This parameter can be one of the following values:
  3902. * @arg @ref LL_TIM_SMSPS_TIMUPDATE
  3903. * @arg @ref LL_TIM_SMSPS_INDEX
  3904. * @retval None
  3905. */
  3906. __STATIC_INLINE void LL_TIM_SetSMSPreloadSource(TIM_TypeDef *TIMx, uint32_t PreloadSource)
  3907. {
  3908. MODIFY_REG(TIMx->SMCR, TIM_SMCR_SMSPS, PreloadSource);
  3909. }
  3910. /**
  3911. * @brief Get the preload source of SMS.
  3912. * @note Macro IS_TIM_SMS_PRELOAD_INSTANCE(TIMx) can be used to check
  3913. * whether or not a timer instance supports the preload of SMS field in SMCR register.
  3914. * @rmtoll SMCR SMSPS LL_TIM_GetSMSPreloadSource\n
  3915. * @param TIMx Timer instance
  3916. * @retval Returned value can be one of the following values:
  3917. * @arg @ref LL_TIM_SMSPS_TIMUPDATE
  3918. * @arg @ref LL_TIM_SMSPS_INDEX
  3919. */
  3920. __STATIC_INLINE uint32_t LL_TIM_GetSMSPreloadSource(const TIM_TypeDef *TIMx)
  3921. {
  3922. return (uint32_t)(READ_BIT(TIMx->SMCR, TIM_SMCR_SMSPS));
  3923. }
  3924. /**
  3925. * @}
  3926. */
  3927. /** @defgroup TIM_LL_EF_Break_Function Break function configuration
  3928. * @{
  3929. */
  3930. /**
  3931. * @brief Enable the break function.
  3932. * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
  3933. * a timer instance provides a break input.
  3934. * @rmtoll BDTR BKE LL_TIM_EnableBRK
  3935. * @param TIMx Timer instance
  3936. * @retval None
  3937. */
  3938. __STATIC_INLINE void LL_TIM_EnableBRK(TIM_TypeDef *TIMx)
  3939. {
  3940. SET_BIT(TIMx->BDTR, TIM_BDTR_BKE);
  3941. }
  3942. /**
  3943. * @brief Disable the break function.
  3944. * @rmtoll BDTR BKE LL_TIM_DisableBRK
  3945. * @param TIMx Timer instance
  3946. * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
  3947. * a timer instance provides a break input.
  3948. * @retval None
  3949. */
  3950. __STATIC_INLINE void LL_TIM_DisableBRK(TIM_TypeDef *TIMx)
  3951. {
  3952. CLEAR_BIT(TIMx->BDTR, TIM_BDTR_BKE);
  3953. }
  3954. /**
  3955. * @brief Configure the break input.
  3956. * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
  3957. * a timer instance provides a break input.
  3958. * @note Bidirectional mode is only supported by advanced timer instances.
  3959. * Macro IS_TIM_ADVANCED_INSTANCE(TIMx) can be used to check whether or not
  3960. * a timer instance is an advanced-control timer.
  3961. * @note In bidirectional mode (BKBID bit set), the Break input is configured both
  3962. * in input mode and in open drain output mode. Any active Break event will
  3963. * assert a low logic level on the Break input to indicate an internal break
  3964. * event to external devices.
  3965. * @note When bidirectional mode isn't supported, BreakAFMode must be set to
  3966. * LL_TIM_BREAK_AFMODE_INPUT.
  3967. * @rmtoll BDTR BKP LL_TIM_ConfigBRK\n
  3968. * BDTR BKF LL_TIM_ConfigBRK\n
  3969. * BDTR BKBID LL_TIM_ConfigBRK
  3970. * @param TIMx Timer instance
  3971. * @param BreakPolarity This parameter can be one of the following values:
  3972. * @arg @ref LL_TIM_BREAK_POLARITY_LOW
  3973. * @arg @ref LL_TIM_BREAK_POLARITY_HIGH
  3974. * @param BreakFilter This parameter can be one of the following values:
  3975. * @arg @ref LL_TIM_BREAK_FILTER_FDIV1
  3976. * @arg @ref LL_TIM_BREAK_FILTER_FDIV1_N2
  3977. * @arg @ref LL_TIM_BREAK_FILTER_FDIV1_N4
  3978. * @arg @ref LL_TIM_BREAK_FILTER_FDIV1_N8
  3979. * @arg @ref LL_TIM_BREAK_FILTER_FDIV2_N6
  3980. * @arg @ref LL_TIM_BREAK_FILTER_FDIV2_N8
  3981. * @arg @ref LL_TIM_BREAK_FILTER_FDIV4_N6
  3982. * @arg @ref LL_TIM_BREAK_FILTER_FDIV4_N8
  3983. * @arg @ref LL_TIM_BREAK_FILTER_FDIV8_N6
  3984. * @arg @ref LL_TIM_BREAK_FILTER_FDIV8_N8
  3985. * @arg @ref LL_TIM_BREAK_FILTER_FDIV16_N5
  3986. * @arg @ref LL_TIM_BREAK_FILTER_FDIV16_N6
  3987. * @arg @ref LL_TIM_BREAK_FILTER_FDIV16_N8
  3988. * @arg @ref LL_TIM_BREAK_FILTER_FDIV32_N5
  3989. * @arg @ref LL_TIM_BREAK_FILTER_FDIV32_N6
  3990. * @arg @ref LL_TIM_BREAK_FILTER_FDIV32_N8
  3991. * @param BreakAFMode This parameter can be one of the following values:
  3992. * @arg @ref LL_TIM_BREAK_AFMODE_INPUT
  3993. * @arg @ref LL_TIM_BREAK_AFMODE_BIDIRECTIONAL
  3994. * @retval None
  3995. */
  3996. __STATIC_INLINE void LL_TIM_ConfigBRK(TIM_TypeDef *TIMx, uint32_t BreakPolarity, uint32_t BreakFilter,
  3997. uint32_t BreakAFMode)
  3998. {
  3999. MODIFY_REG(TIMx->BDTR, TIM_BDTR_BKP | TIM_BDTR_BKF | TIM_BDTR_BKBID, BreakPolarity | BreakFilter | BreakAFMode);
  4000. }
  4001. /**
  4002. * @brief Disarm the break input (when it operates in bidirectional mode).
  4003. * @note The break input can be disarmed only when it is configured in
  4004. * bidirectional mode and when when MOE is reset.
  4005. * @note Purpose is to be able to have the input voltage back to high-state,
  4006. * whatever the time constant on the output .
  4007. * @rmtoll BDTR BKDSRM LL_TIM_DisarmBRK
  4008. * @param TIMx Timer instance
  4009. * @retval None
  4010. */
  4011. __STATIC_INLINE void LL_TIM_DisarmBRK(TIM_TypeDef *TIMx)
  4012. {
  4013. SET_BIT(TIMx->BDTR, TIM_BDTR_BKDSRM);
  4014. }
  4015. /**
  4016. * @brief Enable the break 2 function.
  4017. * @note Macro IS_TIM_BKIN2_INSTANCE(TIMx) can be used to check whether or not
  4018. * a timer instance provides a second break input.
  4019. * @rmtoll BDTR BK2E LL_TIM_EnableBRK2
  4020. * @param TIMx Timer instance
  4021. * @retval None
  4022. */
  4023. __STATIC_INLINE void LL_TIM_EnableBRK2(TIM_TypeDef *TIMx)
  4024. {
  4025. SET_BIT(TIMx->BDTR, TIM_BDTR_BK2E);
  4026. }
  4027. /**
  4028. * @brief Disable the break 2 function.
  4029. * @note Macro IS_TIM_BKIN2_INSTANCE(TIMx) can be used to check whether or not
  4030. * a timer instance provides a second break input.
  4031. * @rmtoll BDTR BK2E LL_TIM_DisableBRK2
  4032. * @param TIMx Timer instance
  4033. * @retval None
  4034. */
  4035. __STATIC_INLINE void LL_TIM_DisableBRK2(TIM_TypeDef *TIMx)
  4036. {
  4037. CLEAR_BIT(TIMx->BDTR, TIM_BDTR_BK2E);
  4038. }
  4039. /**
  4040. * @brief Configure the break 2 input.
  4041. * @note Macro IS_TIM_BKIN2_INSTANCE(TIMx) can be used to check whether or not
  4042. * a timer instance provides a second break input.
  4043. * @note Bidirectional mode is only supported by advanced timer instances.
  4044. * Macro IS_TIM_ADVANCED_INSTANCE(TIMx) can be used to check whether or not
  4045. * a timer instance is an advanced-control timer.
  4046. * @note In bidirectional mode (BK2BID bit set), the Break 2 input is configured both
  4047. * in input mode and in open drain output mode. Any active Break event will
  4048. * assert a low logic level on the Break 2 input to indicate an internal break
  4049. * event to external devices.
  4050. * @note When bidirectional mode isn't supported, Break2AFMode must be set to
  4051. * LL_TIM_BREAK2_AFMODE_INPUT.
  4052. * @rmtoll BDTR BK2P LL_TIM_ConfigBRK2\n
  4053. * BDTR BK2F LL_TIM_ConfigBRK2\n
  4054. * BDTR BK2BID LL_TIM_ConfigBRK2
  4055. * @param TIMx Timer instance
  4056. * @param Break2Polarity This parameter can be one of the following values:
  4057. * @arg @ref LL_TIM_BREAK2_POLARITY_LOW
  4058. * @arg @ref LL_TIM_BREAK2_POLARITY_HIGH
  4059. * @param Break2Filter This parameter can be one of the following values:
  4060. * @arg @ref LL_TIM_BREAK2_FILTER_FDIV1
  4061. * @arg @ref LL_TIM_BREAK2_FILTER_FDIV1_N2
  4062. * @arg @ref LL_TIM_BREAK2_FILTER_FDIV1_N4
  4063. * @arg @ref LL_TIM_BREAK2_FILTER_FDIV1_N8
  4064. * @arg @ref LL_TIM_BREAK2_FILTER_FDIV2_N6
  4065. * @arg @ref LL_TIM_BREAK2_FILTER_FDIV2_N8
  4066. * @arg @ref LL_TIM_BREAK2_FILTER_FDIV4_N6
  4067. * @arg @ref LL_TIM_BREAK2_FILTER_FDIV4_N8
  4068. * @arg @ref LL_TIM_BREAK2_FILTER_FDIV8_N6
  4069. * @arg @ref LL_TIM_BREAK2_FILTER_FDIV8_N8
  4070. * @arg @ref LL_TIM_BREAK2_FILTER_FDIV16_N5
  4071. * @arg @ref LL_TIM_BREAK2_FILTER_FDIV16_N6
  4072. * @arg @ref LL_TIM_BREAK2_FILTER_FDIV16_N8
  4073. * @arg @ref LL_TIM_BREAK2_FILTER_FDIV32_N5
  4074. * @arg @ref LL_TIM_BREAK2_FILTER_FDIV32_N6
  4075. * @arg @ref LL_TIM_BREAK2_FILTER_FDIV32_N8
  4076. * @param Break2AFMode This parameter can be one of the following values:
  4077. * @arg @ref LL_TIM_BREAK2_AFMODE_INPUT
  4078. * @arg @ref LL_TIM_BREAK2_AFMODE_BIDIRECTIONAL
  4079. * @retval None
  4080. */
  4081. __STATIC_INLINE void LL_TIM_ConfigBRK2(TIM_TypeDef *TIMx, uint32_t Break2Polarity, uint32_t Break2Filter,
  4082. uint32_t Break2AFMode)
  4083. {
  4084. MODIFY_REG(TIMx->BDTR, TIM_BDTR_BK2P | TIM_BDTR_BK2F | TIM_BDTR_BK2BID, Break2Polarity | Break2Filter | Break2AFMode);
  4085. }
  4086. /**
  4087. * @brief Disarm the break 2 input (when it operates in bidirectional mode).
  4088. * @note The break 2 input can be disarmed only when it is configured in
  4089. * bidirectional mode and when when MOE is reset.
  4090. * @note Purpose is to be able to have the input voltage back to high-state,
  4091. * whatever the time constant on the output.
  4092. * @rmtoll BDTR BK2DSRM LL_TIM_DisarmBRK2
  4093. * @param TIMx Timer instance
  4094. * @retval None
  4095. */
  4096. __STATIC_INLINE void LL_TIM_DisarmBRK2(TIM_TypeDef *TIMx)
  4097. {
  4098. SET_BIT(TIMx->BDTR, TIM_BDTR_BK2DSRM);
  4099. }
  4100. /**
  4101. * @brief Select the outputs off state (enabled v.s. disabled) in Idle and Run modes.
  4102. * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
  4103. * a timer instance provides a break input.
  4104. * @rmtoll BDTR OSSI LL_TIM_SetOffStates\n
  4105. * BDTR OSSR LL_TIM_SetOffStates
  4106. * @param TIMx Timer instance
  4107. * @param OffStateIdle This parameter can be one of the following values:
  4108. * @arg @ref LL_TIM_OSSI_DISABLE
  4109. * @arg @ref LL_TIM_OSSI_ENABLE
  4110. * @param OffStateRun This parameter can be one of the following values:
  4111. * @arg @ref LL_TIM_OSSR_DISABLE
  4112. * @arg @ref LL_TIM_OSSR_ENABLE
  4113. * @retval None
  4114. */
  4115. __STATIC_INLINE void LL_TIM_SetOffStates(TIM_TypeDef *TIMx, uint32_t OffStateIdle, uint32_t OffStateRun)
  4116. {
  4117. MODIFY_REG(TIMx->BDTR, TIM_BDTR_OSSI | TIM_BDTR_OSSR, OffStateIdle | OffStateRun);
  4118. }
  4119. /**
  4120. * @brief Enable automatic output (MOE can be set by software or automatically when a break input is active).
  4121. * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
  4122. * a timer instance provides a break input.
  4123. * @rmtoll BDTR AOE LL_TIM_EnableAutomaticOutput
  4124. * @param TIMx Timer instance
  4125. * @retval None
  4126. */
  4127. __STATIC_INLINE void LL_TIM_EnableAutomaticOutput(TIM_TypeDef *TIMx)
  4128. {
  4129. SET_BIT(TIMx->BDTR, TIM_BDTR_AOE);
  4130. }
  4131. /**
  4132. * @brief Disable automatic output (MOE can be set only by software).
  4133. * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
  4134. * a timer instance provides a break input.
  4135. * @rmtoll BDTR AOE LL_TIM_DisableAutomaticOutput
  4136. * @param TIMx Timer instance
  4137. * @retval None
  4138. */
  4139. __STATIC_INLINE void LL_TIM_DisableAutomaticOutput(TIM_TypeDef *TIMx)
  4140. {
  4141. CLEAR_BIT(TIMx->BDTR, TIM_BDTR_AOE);
  4142. }
  4143. /**
  4144. * @brief Indicate whether automatic output is enabled.
  4145. * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
  4146. * a timer instance provides a break input.
  4147. * @rmtoll BDTR AOE LL_TIM_IsEnabledAutomaticOutput
  4148. * @param TIMx Timer instance
  4149. * @retval State of bit (1 or 0).
  4150. */
  4151. __STATIC_INLINE uint32_t LL_TIM_IsEnabledAutomaticOutput(const TIM_TypeDef *TIMx)
  4152. {
  4153. return ((READ_BIT(TIMx->BDTR, TIM_BDTR_AOE) == (TIM_BDTR_AOE)) ? 1UL : 0UL);
  4154. }
  4155. /**
  4156. * @brief Enable the outputs (set the MOE bit in TIMx_BDTR register).
  4157. * @note The MOE bit in TIMx_BDTR register allows to enable /disable the outputs by
  4158. * software and is reset in case of break or break2 event
  4159. * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
  4160. * a timer instance provides a break input.
  4161. * @rmtoll BDTR MOE LL_TIM_EnableAllOutputs
  4162. * @param TIMx Timer instance
  4163. * @retval None
  4164. */
  4165. __STATIC_INLINE void LL_TIM_EnableAllOutputs(TIM_TypeDef *TIMx)
  4166. {
  4167. SET_BIT(TIMx->BDTR, TIM_BDTR_MOE);
  4168. }
  4169. /**
  4170. * @brief Disable the outputs (reset the MOE bit in TIMx_BDTR register).
  4171. * @note The MOE bit in TIMx_BDTR register allows to enable /disable the outputs by
  4172. * software and is reset in case of break or break2 event.
  4173. * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
  4174. * a timer instance provides a break input.
  4175. * @rmtoll BDTR MOE LL_TIM_DisableAllOutputs
  4176. * @param TIMx Timer instance
  4177. * @retval None
  4178. */
  4179. __STATIC_INLINE void LL_TIM_DisableAllOutputs(TIM_TypeDef *TIMx)
  4180. {
  4181. CLEAR_BIT(TIMx->BDTR, TIM_BDTR_MOE);
  4182. }
  4183. /**
  4184. * @brief Indicates whether outputs are enabled.
  4185. * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
  4186. * a timer instance provides a break input.
  4187. * @rmtoll BDTR MOE LL_TIM_IsEnabledAllOutputs
  4188. * @param TIMx Timer instance
  4189. * @retval State of bit (1 or 0).
  4190. */
  4191. __STATIC_INLINE uint32_t LL_TIM_IsEnabledAllOutputs(const TIM_TypeDef *TIMx)
  4192. {
  4193. return ((READ_BIT(TIMx->BDTR, TIM_BDTR_MOE) == (TIM_BDTR_MOE)) ? 1UL : 0UL);
  4194. }
  4195. /**
  4196. * @brief Enable the signals connected to the designated timer break input.
  4197. * @note Macro IS_TIM_BREAKSOURCE_INSTANCE(TIMx) can be used to check whether
  4198. * or not a timer instance allows for break input selection.
  4199. * @rmtoll AF1 BKINE LL_TIM_EnableBreakInputSource\n
  4200. * AF1 BKCMP1E LL_TIM_EnableBreakInputSource\n
  4201. * AF1 BKCMP2E LL_TIM_EnableBreakInputSource\n
  4202. * AF1 BKCMP3E LL_TIM_EnableBreakInputSource\n
  4203. * AF1 BKDF1BK0E LL_TIM_EnableBreakInputSource\n
  4204. * AF2 BK2INE LL_TIM_EnableBreakInputSource\n
  4205. * AF2 BK2CMP1E LL_TIM_EnableBreakInputSource\n
  4206. * AF2 BK2CMP2E LL_TIM_EnableBreakInputSource\n
  4207. * AF2 BK2CMP3E LL_TIM_EnableBreakInputSource\n
  4208. * AF2 BK2DF1BK1E LL_TIM_EnableBreakInputSource
  4209. * @param TIMx Timer instance
  4210. * @param BreakInput This parameter can be one of the following values:
  4211. * @arg @ref LL_TIM_BREAK_INPUT_BKIN
  4212. * @arg @ref LL_TIM_BREAK_INPUT_BKIN2
  4213. * @param Source This parameter can be one of the following values:
  4214. * @arg @ref LL_TIM_BKIN_SOURCE_BKIN
  4215. * @arg @ref LL_TIM_BKIN_SOURCE_BKCOMP1 (*)
  4216. * @arg @ref LL_TIM_BKIN_SOURCE_BKCOMP2 (*)
  4217. * @arg @ref LL_TIM_BKIN_SOURCE_PLAY1 (*)
  4218. * @arg @ref LL_TIM_BKIN_SOURCE_MDF1 (*)
  4219. *
  4220. * (*) Value not defined in all devices.
  4221. * @retval None
  4222. */
  4223. __STATIC_INLINE void LL_TIM_EnableBreakInputSource(TIM_TypeDef *TIMx, uint32_t BreakInput, uint32_t Source)
  4224. {
  4225. __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->AF1) + BreakInput));
  4226. SET_BIT(*pReg, Source);
  4227. }
  4228. /**
  4229. * @brief Disable the signals connected to the designated timer break input.
  4230. * @note Macro IS_TIM_BREAKSOURCE_INSTANCE(TIMx) can be used to check whether
  4231. * or not a timer instance allows for break input selection.
  4232. * @rmtoll AF1 BKINE LL_TIM_DisableBreakInputSource\n
  4233. * AF1 BKCMP1E LL_TIM_DisableBreakInputSource\n
  4234. * AF1 BKCMP2E LL_TIM_DisableBreakInputSource\n
  4235. * AF1 BKCMP3E LL_TIM_DisableBreakInputSource\n
  4236. * AF1 BKDF1BK0E LL_TIM_DisableBreakInputSource\n
  4237. * AF2 BK2INE LL_TIM_DisableBreakInputSource\n
  4238. * AF2 BK2CMP1E LL_TIM_DisableBreakInputSource\n
  4239. * AF2 BK2CMP2E LL_TIM_DisableBreakInputSource\n
  4240. * AF2 BK2CMP3E LL_TIM_DisableBreakInputSource\n
  4241. * AF2 BK2DF1BK1E LL_TIM_DisableBreakInputSource
  4242. * @param TIMx Timer instance
  4243. * @param BreakInput This parameter can be one of the following values:
  4244. * @arg @ref LL_TIM_BREAK_INPUT_BKIN
  4245. * @arg @ref LL_TIM_BREAK_INPUT_BKIN2
  4246. * @param Source This parameter can be one of the following values:
  4247. * @arg @ref LL_TIM_BKIN_SOURCE_BKIN
  4248. * @arg @ref LL_TIM_BKIN_SOURCE_BKCOMP1 (*)
  4249. * @arg @ref LL_TIM_BKIN_SOURCE_BKCOMP2 (*)
  4250. * @arg @ref LL_TIM_BKIN_SOURCE_PLAY1 (*)
  4251. * @arg @ref LL_TIM_BKIN_SOURCE_MDF1 (*)
  4252. *
  4253. * (*) Value not defined in all devices.
  4254. * @retval None
  4255. */
  4256. __STATIC_INLINE void LL_TIM_DisableBreakInputSource(TIM_TypeDef *TIMx, uint32_t BreakInput, uint32_t Source)
  4257. {
  4258. __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->AF1) + BreakInput));
  4259. CLEAR_BIT(*pReg, Source);
  4260. }
  4261. /**
  4262. * @brief Set the polarity of the break signal for the timer break input.
  4263. * @note Macro IS_TIM_BREAKSOURCE_INSTANCE(TIMx) can be used to check whether
  4264. * or not a timer instance allows for break input selection.
  4265. * @rmtoll AF1 BKINP LL_TIM_SetBreakInputSourcePolarity\n
  4266. * AF1 BKCMP1P LL_TIM_SetBreakInputSourcePolarity\n
  4267. * AF1 BKCMP2P LL_TIM_SetBreakInputSourcePolarity\n
  4268. * AF1 BKCMP3P LL_TIM_SetBreakInputSourcePolarity\n
  4269. * AF2 BK2INP LL_TIM_SetBreakInputSourcePolarity\n
  4270. * AF2 BK2CMP1P LL_TIM_SetBreakInputSourcePolarity\n
  4271. * AF2 BK2CMP2P LL_TIM_SetBreakInputSourcePolarity\n
  4272. * AF2 BK2CMP3P LL_TIM_SetBreakInputSourcePolarity
  4273. * @param TIMx Timer instance
  4274. * @param BreakInput This parameter can be one of the following values:
  4275. * @arg @ref LL_TIM_BREAK_INPUT_BKIN
  4276. * @arg @ref LL_TIM_BREAK_INPUT_BKIN2
  4277. * @param Source This parameter can be one of the following values:
  4278. * @arg @ref LL_TIM_BKIN_SOURCE_BKIN
  4279. * @arg @ref LL_TIM_BKIN_SOURCE_BKCOMP1 (*)
  4280. * @arg @ref LL_TIM_BKIN_SOURCE_BKCOMP2 (*)
  4281. * @arg @ref LL_TIM_BKIN_SOURCE_PLAY1 (*)
  4282. * @param Polarity This parameter can be one of the following values:
  4283. * @arg @ref LL_TIM_BKIN_POLARITY_LOW
  4284. * @arg @ref LL_TIM_BKIN_POLARITY_HIGH
  4285. *
  4286. * (*) Value not defined in all devices.
  4287. * @retval None
  4288. */
  4289. __STATIC_INLINE void LL_TIM_SetBreakInputSourcePolarity(TIM_TypeDef *TIMx, uint32_t BreakInput, uint32_t Source,
  4290. uint32_t Polarity)
  4291. {
  4292. __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->AF1) + BreakInput));
  4293. MODIFY_REG(*pReg, (TIMx_AF1_BKINP << TIM_POSITION_BRK_SOURCE), (Polarity << TIM_POSITION_BRK_SOURCE));
  4294. }
  4295. /**
  4296. * @brief Enable asymmetrical deadtime.
  4297. * @note Macro IS_TIM_DEADTIME_ASYMMETRICAL_INSTANCE(TIMx) can be used to check whether or not
  4298. * a timer instance provides asymmetrical deadtime.
  4299. * @rmtoll DTR2 DTAE LL_TIM_EnableAsymmetricalDeadTime
  4300. * @param TIMx Timer instance
  4301. * @retval None
  4302. */
  4303. __STATIC_INLINE void LL_TIM_EnableAsymmetricalDeadTime(TIM_TypeDef *TIMx)
  4304. {
  4305. SET_BIT(TIMx->DTR2, TIM_DTR2_DTAE);
  4306. }
  4307. /**
  4308. * @brief Disable asymmetrical dead-time.
  4309. * @note Macro IS_TIM_DEADTIME_ASYMMETRICAL_INSTANCE(TIMx) can be used to check whether or not
  4310. * a timer instance provides asymmetrical deadtime.
  4311. * @rmtoll DTR2 DTAE LL_TIM_DisableAsymmetricalDeadTime
  4312. * @param TIMx Timer instance
  4313. * @retval None
  4314. */
  4315. __STATIC_INLINE void LL_TIM_DisableAsymmetricalDeadTime(TIM_TypeDef *TIMx)
  4316. {
  4317. CLEAR_BIT(TIMx->DTR2, TIM_DTR2_DTAE);
  4318. }
  4319. /**
  4320. * @brief Indicates whether asymmetrical deadtime is activated.
  4321. * @note Macro IS_TIM_DEADTIME_ASYMMETRICAL_INSTANCE(TIMx) can be used to check whether or not
  4322. * a timer instance provides asymmetrical deadtime.
  4323. * @rmtoll DTR2 DTAE LL_TIM_IsEnabledAsymmetricalDeadTime
  4324. * @param TIMx Timer instance
  4325. * @retval State of bit (1 or 0).
  4326. */
  4327. __STATIC_INLINE uint32_t LL_TIM_IsEnabledAsymmetricalDeadTime(const TIM_TypeDef *TIMx)
  4328. {
  4329. return ((READ_BIT(TIMx->DTR2, TIM_DTR2_DTAE) == (TIM_DTR2_DTAE)) ? 1UL : 0UL);
  4330. }
  4331. /**
  4332. * @brief Set the falling edge dead-time delay (delay inserted between the falling edge of the OCxREF signal and the
  4333. * rising edge of OCxN signals).
  4334. * @note Macro IS_TIM_DEADTIME_ASYMMETRICAL_INSTANCE(TIMx) can be used to check whether or not
  4335. * asymmetrical dead-time insertion feature is supported by a timer instance.
  4336. * @note Helper macro @ref __LL_TIM_CALC_DEADTIME can be used to calculate the DeadTime parameter
  4337. * @note This bit-field can not be modified as long as LOCK level 1, 2 or 3 has been programmed
  4338. * (LOCK bits in TIMx_BDTR register).
  4339. * @rmtoll DTR2 DTGF LL_TIM_SetFallingDeadTime
  4340. * @param TIMx Timer instance
  4341. * @param DeadTime between Min_Data=0 and Max_Data=255
  4342. * @retval None
  4343. */
  4344. __STATIC_INLINE void LL_TIM_SetFallingDeadTime(TIM_TypeDef *TIMx, uint32_t DeadTime)
  4345. {
  4346. MODIFY_REG(TIMx->DTR2, TIM_DTR2_DTGF, DeadTime);
  4347. }
  4348. /**
  4349. * @brief Get the falling edge dead-time delay (delay inserted between the falling edge of the OCxREF signal and
  4350. * the rising edge of OCxN signals).
  4351. * @note Macro IS_TIM_DEADTIME_ASYMMETRICAL_INSTANCE(TIMx) can be used to check whether or not
  4352. * asymmetrical dead-time insertion feature is supported by a timer instance.
  4353. * @note This bit-field can not be modified as long as LOCK level 1, 2 or 3 has been programmed
  4354. * (LOCK bits in TIMx_BDTR register).
  4355. * @rmtoll DTR2 DTGF LL_TIM_GetFallingDeadTime
  4356. * @param TIMx Timer instance
  4357. * @retval Returned value can be between Min_Data=0 and Max_Data=255:
  4358. */
  4359. __STATIC_INLINE uint32_t LL_TIM_GetFallingDeadTime(const TIM_TypeDef *TIMx)
  4360. {
  4361. return (uint32_t)(READ_BIT(TIMx->DTR2, TIM_DTR2_DTGF));
  4362. }
  4363. /**
  4364. * @brief Enable deadtime preload.
  4365. * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
  4366. * a timer instance provides deadtime preload.
  4367. * @rmtoll DTR2 DTPE LL_TIM_EnableDeadTimePreload
  4368. * @param TIMx Timer instance
  4369. * @retval None
  4370. */
  4371. __STATIC_INLINE void LL_TIM_EnableDeadTimePreload(TIM_TypeDef *TIMx)
  4372. {
  4373. SET_BIT(TIMx->DTR2, TIM_DTR2_DTPE);
  4374. }
  4375. /**
  4376. * @brief Disable dead-time preload.
  4377. * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
  4378. * a timer instance provides deadtime preload.
  4379. * @rmtoll DTR2 DTPE LL_TIM_DisableDeadTimePreload
  4380. * @param TIMx Timer instance
  4381. * @retval None
  4382. */
  4383. __STATIC_INLINE void LL_TIM_DisableDeadTimePreload(TIM_TypeDef *TIMx)
  4384. {
  4385. CLEAR_BIT(TIMx->DTR2, TIM_DTR2_DTPE);
  4386. }
  4387. /**
  4388. * @brief Indicates whether deadtime preload is activated.
  4389. * @note Macro IS_TIM_BREAK_INSTANCE(TIMx) can be used to check whether or not
  4390. * a timer instance provides deadtime preload.
  4391. * @rmtoll DTR2 DTPE LL_TIM_IsEnabledDeadTimePreload
  4392. * @param TIMx Timer instance
  4393. * @retval State of bit (1 or 0).
  4394. */
  4395. __STATIC_INLINE uint32_t LL_TIM_IsEnabledDeadTimePreload(const TIM_TypeDef *TIMx)
  4396. {
  4397. return ((READ_BIT(TIMx->DTR2, TIM_DTR2_DTPE) == (TIM_DTR2_DTPE)) ? 1UL : 0UL);
  4398. }
  4399. /**
  4400. * @}
  4401. */
  4402. /** @defgroup TIM_LL_EF_DMA_Burst_Mode DMA burst mode configuration
  4403. * @{
  4404. */
  4405. /**
  4406. * @brief Configures the timer DMA burst feature.
  4407. * @note Macro IS_TIM_DMABURST_INSTANCE(TIMx) can be used to check whether or
  4408. * not a timer instance supports the DMA burst mode.
  4409. * @rmtoll DCR DBL LL_TIM_ConfigDMABurst\n
  4410. * DCR DBA LL_TIM_ConfigDMABurst
  4411. * @param TIMx Timer instance
  4412. * @param DMABurstBaseAddress This parameter can be one of the following values:
  4413. * @arg @ref LL_TIM_DMABURST_BASEADDR_CR1
  4414. * @arg @ref LL_TIM_DMABURST_BASEADDR_CR2
  4415. * @arg @ref LL_TIM_DMABURST_BASEADDR_SMCR
  4416. * @arg @ref LL_TIM_DMABURST_BASEADDR_DIER
  4417. * @arg @ref LL_TIM_DMABURST_BASEADDR_SR
  4418. * @arg @ref LL_TIM_DMABURST_BASEADDR_EGR
  4419. * @arg @ref LL_TIM_DMABURST_BASEADDR_CCMR1
  4420. * @arg @ref LL_TIM_DMABURST_BASEADDR_CCMR2
  4421. * @arg @ref LL_TIM_DMABURST_BASEADDR_CCER
  4422. * @arg @ref LL_TIM_DMABURST_BASEADDR_CNT
  4423. * @arg @ref LL_TIM_DMABURST_BASEADDR_PSC
  4424. * @arg @ref LL_TIM_DMABURST_BASEADDR_ARR
  4425. * @arg @ref LL_TIM_DMABURST_BASEADDR_RCR
  4426. * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR1
  4427. * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR2
  4428. * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR3
  4429. * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR4
  4430. * @arg @ref LL_TIM_DMABURST_BASEADDR_BDTR
  4431. * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR5
  4432. * @arg @ref LL_TIM_DMABURST_BASEADDR_CCR6
  4433. * @arg @ref LL_TIM_DMABURST_BASEADDR_CCMR3
  4434. * @arg @ref LL_TIM_DMABURST_BASEADDR_DTR2
  4435. * @arg @ref LL_TIM_DMABURST_BASEADDR_ECR
  4436. * @arg @ref LL_TIM_DMABURST_BASEADDR_TISEL
  4437. * @arg @ref LL_TIM_DMABURST_BASEADDR_AF1
  4438. * @arg @ref LL_TIM_DMABURST_BASEADDR_AF2
  4439. * @arg @ref LL_TIM_DMABURST_BASEADDR_OR1
  4440. * @param DMABurstLength This parameter can be one of the following values:
  4441. * @arg @ref LL_TIM_DMABURST_LENGTH_1TRANSFER
  4442. * @arg @ref LL_TIM_DMABURST_LENGTH_2TRANSFERS
  4443. * @arg @ref LL_TIM_DMABURST_LENGTH_3TRANSFERS
  4444. * @arg @ref LL_TIM_DMABURST_LENGTH_4TRANSFERS
  4445. * @arg @ref LL_TIM_DMABURST_LENGTH_5TRANSFERS
  4446. * @arg @ref LL_TIM_DMABURST_LENGTH_6TRANSFERS
  4447. * @arg @ref LL_TIM_DMABURST_LENGTH_7TRANSFERS
  4448. * @arg @ref LL_TIM_DMABURST_LENGTH_8TRANSFERS
  4449. * @arg @ref LL_TIM_DMABURST_LENGTH_9TRANSFERS
  4450. * @arg @ref LL_TIM_DMABURST_LENGTH_10TRANSFERS
  4451. * @arg @ref LL_TIM_DMABURST_LENGTH_11TRANSFERS
  4452. * @arg @ref LL_TIM_DMABURST_LENGTH_12TRANSFERS
  4453. * @arg @ref LL_TIM_DMABURST_LENGTH_13TRANSFERS
  4454. * @arg @ref LL_TIM_DMABURST_LENGTH_14TRANSFERS
  4455. * @arg @ref LL_TIM_DMABURST_LENGTH_15TRANSFERS
  4456. * @arg @ref LL_TIM_DMABURST_LENGTH_16TRANSFERS
  4457. * @arg @ref LL_TIM_DMABURST_LENGTH_17TRANSFERS
  4458. * @arg @ref LL_TIM_DMABURST_LENGTH_18TRANSFERS
  4459. * @arg @ref LL_TIM_DMABURST_LENGTH_19TRANSFERS
  4460. * @arg @ref LL_TIM_DMABURST_LENGTH_20TRANSFERS
  4461. * @arg @ref LL_TIM_DMABURST_LENGTH_21TRANSFERS
  4462. * @arg @ref LL_TIM_DMABURST_LENGTH_22TRANSFERS
  4463. * @arg @ref LL_TIM_DMABURST_LENGTH_23TRANSFERS
  4464. * @arg @ref LL_TIM_DMABURST_LENGTH_24TRANSFERS
  4465. * @arg @ref LL_TIM_DMABURST_LENGTH_25TRANSFERS
  4466. * @arg @ref LL_TIM_DMABURST_LENGTH_26TRANSFERS
  4467. * @param DMABurstSource This parameter can be one of the following values:
  4468. * @arg @ref LL_TIM_DMA_UPDATE
  4469. * @arg @ref LL_TIM_DMA_CC1
  4470. * @arg @ref LL_TIM_DMA_CC2
  4471. * @arg @ref LL_TIM_DMA_CC3
  4472. * @arg @ref LL_TIM_DMA_CC4
  4473. * @arg @ref LL_TIM_DMA_COM
  4474. * @arg @ref LL_TIM_DMA_TRIGGER
  4475. * @retval None
  4476. */
  4477. __STATIC_INLINE void LL_TIM_ConfigDMABurst(TIM_TypeDef *TIMx, uint32_t DMABurstBaseAddress, uint32_t DMABurstLength,
  4478. uint32_t DMABurstSource)
  4479. {
  4480. MODIFY_REG(TIMx->DCR, (TIM_DCR_DBL | TIM_DCR_DBA | TIM_DCR_DBSS),
  4481. (DMABurstBaseAddress | DMABurstLength | DMABurstSource));
  4482. }
  4483. /**
  4484. * @}
  4485. */
  4486. /** @defgroup TIM_LL_EF_Encoder Encoder configuration
  4487. * @{
  4488. */
  4489. /**
  4490. * @brief Enable encoder index.
  4491. * @note Macro IS_TIM_INDEX_INSTANCE(TIMx) can be used to check whether or not
  4492. * a timer instance provides an index input.
  4493. * @rmtoll ECR IE LL_TIM_EnableEncoderIndex
  4494. * @param TIMx Timer instance
  4495. * @retval None
  4496. */
  4497. __STATIC_INLINE void LL_TIM_EnableEncoderIndex(TIM_TypeDef *TIMx)
  4498. {
  4499. SET_BIT(TIMx->ECR, TIM_ECR_IE);
  4500. }
  4501. /**
  4502. * @brief Disable encoder index.
  4503. * @note Macro IS_TIM_INDEX_INSTANCE(TIMx) can be used to check whether or not
  4504. * a timer instance provides an index input.
  4505. * @rmtoll ECR IE LL_TIM_DisableEncoderIndex
  4506. * @param TIMx Timer instance
  4507. * @retval None
  4508. */
  4509. __STATIC_INLINE void LL_TIM_DisableEncoderIndex(TIM_TypeDef *TIMx)
  4510. {
  4511. CLEAR_BIT(TIMx->ECR, TIM_ECR_IE);
  4512. }
  4513. /**
  4514. * @brief Indicate whether encoder index is enabled.
  4515. * @note Macro IS_TIM_INDEX_INSTANCE(TIMx) can be used to check whether or not
  4516. * a timer instance provides an index input.
  4517. * @rmtoll ECR IE LL_TIM_IsEnabledEncoderIndex
  4518. * @param TIMx Timer instance
  4519. * @retval State of bit (1 or 0).
  4520. */
  4521. __STATIC_INLINE uint32_t LL_TIM_IsEnabledEncoderIndex(const TIM_TypeDef *TIMx)
  4522. {
  4523. return ((READ_BIT(TIMx->ECR, TIM_ECR_IE) == (TIM_ECR_IE)) ? 1U : 0U);
  4524. }
  4525. /**
  4526. * @brief Set index direction
  4527. * @note Macro IS_TIM_INDEX_INSTANCE(TIMx) can be used to check whether or not
  4528. * a timer instance provides an index input.
  4529. * @rmtoll ECR IDIR LL_TIM_SetIndexDirection
  4530. * @param TIMx Timer instance
  4531. * @param IndexDirection This parameter can be one of the following values:
  4532. * @arg @ref LL_TIM_INDEX_UP_DOWN
  4533. * @arg @ref LL_TIM_INDEX_UP
  4534. * @arg @ref LL_TIM_INDEX_DOWN
  4535. * @retval None
  4536. */
  4537. __STATIC_INLINE void LL_TIM_SetIndexDirection(TIM_TypeDef *TIMx, uint32_t IndexDirection)
  4538. {
  4539. MODIFY_REG(TIMx->ECR, TIM_ECR_IDIR, IndexDirection);
  4540. }
  4541. /**
  4542. * @brief Get actual index direction
  4543. * @note Macro IS_TIM_INDEX_INSTANCE(TIMx) can be used to check whether or not
  4544. * a timer instance provides an index input.
  4545. * @rmtoll ECR IDIR LL_TIM_GetIndexDirection
  4546. * @param TIMx Timer instance
  4547. * @retval Returned value can be one of the following values:
  4548. * @arg @ref LL_TIM_INDEX_UP_DOWN
  4549. * @arg @ref LL_TIM_INDEX_UP
  4550. * @arg @ref LL_TIM_INDEX_DOWN
  4551. */
  4552. __STATIC_INLINE uint32_t LL_TIM_GetIndexDirection(const TIM_TypeDef *TIMx)
  4553. {
  4554. return (uint32_t)(READ_BIT(TIMx->ECR, TIM_ECR_IDIR));
  4555. }
  4556. /**
  4557. * @brief Set index blanking
  4558. * @note Macro IS_TIM_INDEX_INSTANCE(TIMx) can be used to check whether or not
  4559. * a timer instance provides an index input.
  4560. * @rmtoll ECR IBLK LL_TIM_SetIndexblanking
  4561. * @param TIMx Timer instance
  4562. * @param Indexblanking This parameter can be one of the following values:
  4563. * @arg @ref LL_TIM_INDEX_BLANK_ALWAYS
  4564. * @arg @ref LL_TIM_INDEX_BLANK_TI3
  4565. * @arg @ref LL_TIM_INDEX_BLANK_TI4
  4566. * @retval None
  4567. */
  4568. __STATIC_INLINE void LL_TIM_SetIndexblanking(TIM_TypeDef *TIMx, uint32_t Indexblanking)
  4569. {
  4570. MODIFY_REG(TIMx->ECR, TIM_ECR_IBLK, Indexblanking);
  4571. }
  4572. /**
  4573. * @brief Get actual index blanking
  4574. * @note Macro IS_TIM_INDEX_INSTANCE(TIMx) can be used to check whether or not
  4575. * a timer instance provides an index input.
  4576. * @rmtoll ECR IBLK LL_TIM_GetIndexblanking
  4577. * @param TIMx Timer instance
  4578. * @retval Returned value can be one of the following values:
  4579. * @arg @ref LL_TIM_INDEX_BLANK_ALWAYS
  4580. * @arg @ref LL_TIM_INDEX_BLANK_TI3
  4581. * @arg @ref LL_TIM_INDEX_BLANK_TI4
  4582. */
  4583. __STATIC_INLINE uint32_t LL_TIM_GetIndexblanking(const TIM_TypeDef *TIMx)
  4584. {
  4585. return (uint32_t)(READ_BIT(TIMx->ECR, TIM_ECR_IBLK));
  4586. }
  4587. /**
  4588. * @brief Enable first index.
  4589. * @note Macro IS_TIM_INDEX_INSTANCE(TIMx) can be used to check whether or not
  4590. * a timer instance provides an index input.
  4591. * @rmtoll ECR FIDX LL_TIM_EnableFirstIndex
  4592. * @param TIMx Timer instance
  4593. * @retval None
  4594. */
  4595. __STATIC_INLINE void LL_TIM_EnableFirstIndex(TIM_TypeDef *TIMx)
  4596. {
  4597. SET_BIT(TIMx->ECR, TIM_ECR_FIDX);
  4598. }
  4599. /**
  4600. * @brief Disable first index.
  4601. * @note Macro IS_TIM_INDEX_INSTANCE(TIMx) can be used to check whether or not
  4602. * a timer instance provides an index input.
  4603. * @rmtoll ECR FIDX LL_TIM_DisableFirstIndex
  4604. * @param TIMx Timer instance
  4605. * @retval None
  4606. */
  4607. __STATIC_INLINE void LL_TIM_DisableFirstIndex(TIM_TypeDef *TIMx)
  4608. {
  4609. CLEAR_BIT(TIMx->ECR, TIM_ECR_FIDX);
  4610. }
  4611. /**
  4612. * @brief Indicates whether first index is enabled.
  4613. * @note Macro IS_TIM_INDEX_INSTANCE(TIMx) can be used to check whether or not
  4614. * a timer instance provides an index input.
  4615. * @rmtoll ECR FIDX LL_TIM_IsEnabledFirstIndex
  4616. * @param TIMx Timer instance
  4617. * @retval State of bit (1 or 0).
  4618. */
  4619. __STATIC_INLINE uint32_t LL_TIM_IsEnabledFirstIndex(const TIM_TypeDef *TIMx)
  4620. {
  4621. return ((READ_BIT(TIMx->ECR, TIM_ECR_FIDX) == (TIM_ECR_FIDX)) ? 1UL : 0UL);
  4622. }
  4623. /**
  4624. * @brief Set index positioning
  4625. * @note Macro IS_TIM_INDEX_INSTANCE(TIMx) can be used to check whether or not
  4626. * a timer instance provides an index input.
  4627. * @rmtoll ECR IPOS LL_TIM_SetIndexPositionning
  4628. * @param TIMx Timer instance
  4629. * @param IndexPositionning This parameter can be one of the following values:
  4630. * @arg @ref LL_TIM_INDEX_POSITION_DOWN_DOWN
  4631. * @arg @ref LL_TIM_INDEX_POSITION_DOWN_UP
  4632. * @arg @ref LL_TIM_INDEX_POSITION_UP_DOWN
  4633. * @arg @ref LL_TIM_INDEX_POSITION_UP_UP
  4634. * @arg @ref LL_TIM_INDEX_POSITION_DOWN
  4635. * @arg @ref LL_TIM_INDEX_POSITION_UP
  4636. * @retval None
  4637. */
  4638. __STATIC_INLINE void LL_TIM_SetIndexPositionning(TIM_TypeDef *TIMx, uint32_t IndexPositionning)
  4639. {
  4640. MODIFY_REG(TIMx->ECR, TIM_ECR_IPOS, IndexPositionning);
  4641. }
  4642. /**
  4643. * @brief Get actual index positioning
  4644. * @note Macro IS_TIM_INDEX_INSTANCE(TIMx) can be used to check whether or not
  4645. * a timer instance provides an index input.
  4646. * @rmtoll ECR IPOS LL_TIM_GetIndexPositionning
  4647. * @param TIMx Timer instance
  4648. * @retval Returned value can be one of the following values:
  4649. * @arg @ref LL_TIM_INDEX_POSITION_DOWN_DOWN
  4650. * @arg @ref LL_TIM_INDEX_POSITION_DOWN_UP
  4651. * @arg @ref LL_TIM_INDEX_POSITION_UP_DOWN
  4652. * @arg @ref LL_TIM_INDEX_POSITION_UP_UP
  4653. * @arg @ref LL_TIM_INDEX_POSITION_DOWN
  4654. * @arg @ref LL_TIM_INDEX_POSITION_UP
  4655. */
  4656. __STATIC_INLINE uint32_t LL_TIM_GetIndexPositionning(const TIM_TypeDef *TIMx)
  4657. {
  4658. return (uint32_t)(READ_BIT(TIMx->ECR, TIM_ECR_IPOS));
  4659. }
  4660. /**
  4661. * @brief Configure encoder index.
  4662. * @note Macro IS_TIM_INDEX_INSTANCE(TIMx) can be used to check whether or not
  4663. * a timer instance provides an index input.
  4664. * @rmtoll ECR IDIR LL_TIM_ConfigIDX\n
  4665. * ECR IBLK LL_TIM_ConfigIDX\n
  4666. * ECR FIDX LL_TIM_ConfigIDX\n
  4667. * ECR IPOS LL_TIM_ConfigIDX
  4668. * @param TIMx Timer instance
  4669. * @param Configuration This parameter must be a combination of all the following values:
  4670. * @arg @ref LL_TIM_INDEX_UP or @ref LL_TIM_INDEX_DOWN or @ref LL_TIM_INDEX_UP_DOWN
  4671. * @arg @ref LL_TIM_INDEX_BLANK_ALWAYS or @ref LL_TIM_INDEX_BLANK_TI3 or @ref LL_TIM_INDEX_BLANK_TI4
  4672. * @arg @ref LL_TIM_INDEX_ALL or @ref LL_TIM_INDEX_FIRST_ONLY
  4673. * @arg @ref LL_TIM_INDEX_POSITION_DOWN_DOWN or ... or @ref LL_TIM_INDEX_POSITION_UP
  4674. * @retval None
  4675. */
  4676. __STATIC_INLINE void LL_TIM_ConfigIDX(TIM_TypeDef *TIMx, uint32_t Configuration)
  4677. {
  4678. MODIFY_REG(TIMx->ECR, TIM_ECR_IDIR | TIM_ECR_IBLK | TIM_ECR_FIDX | TIM_ECR_IPOS, Configuration);
  4679. }
  4680. /**
  4681. * @}
  4682. */
  4683. /** @defgroup TIM_LL_EF_Timer_Inputs_Remapping Timer input remapping
  4684. * @{
  4685. */
  4686. /**
  4687. * @brief Remap TIM inputs (input channel, internal/external triggers).
  4688. * @note Macro IS_TIM_REMAP_INSTANCE(TIMx) can be used to check whether or not
  4689. * a some timer inputs can be remapped.
  4690. * @rmtoll TIM1_TISEL TI1SEL LL_TIM_SetRemap\n
  4691. * TIM2_TISEL TI1SEL LL_TIM_SetRemap\n
  4692. * TIM2_TISEL TI2SEL LL_TIM_SetRemap\n
  4693. * TIM2_TISEL TI4SEL LL_TIM_SetRemap\n
  4694. * TIM3_TISEL TI1SEL LL_TIM_SetRemap\n
  4695. * TIM3_TISEL TI2SEL LL_TIM_SetRemap\n
  4696. * TIM4_TISEL TI1SEL LL_TIM_SetRemap\n
  4697. * TIM5_TISEL TI1SEL LL_TIM_SetRemap\n
  4698. * TIM8_TISEL TI1SEL LL_TIM_SetRemap\n
  4699. * TIM12_TISEL TI1SEL LL_TIM_SetRemap\n
  4700. * TIM12_TISEL TI2SEL LL_TIM_SetRemap\n
  4701. * TIM13_TISEL TI1SEL LL_TIM_SetRemap\n
  4702. * TIM14_TISEL TI1SEL LL_TIM_SetRemap\n
  4703. * TIM15_TISEL TI1SEL LL_TIM_SetRemap\n
  4704. * TIM15_TISEL TI2SEL LL_TIM_SetRemap\n
  4705. * TIM16_TISEL TI1SEL LL_TIM_SetRemap\n
  4706. * TIM17_TISEL TI1SEL LL_TIM_SetRemap
  4707. *
  4708. * @param TIMx Timer instance
  4709. * @param Remap Remap param depends on the TIMx. Description available only
  4710. * in CHM version of the User Manual (not in .pdf).
  4711. * Otherwise see Reference Manual description of TISEL registers.
  4712. *
  4713. * Below description summarizes "Timer Instance" and "Remap" param combinations:
  4714. *
  4715. * TIM1: one of the following values:
  4716. * @arg LL_TIM_TIM1_TI1_RMP_GPIO: TIM1 TI1 is connected to GPIO
  4717. * @arg LL_TIM_TIM1_TI1_RMP_COMP1: TIM1 TI1 is connected to COMP1 output (*)
  4718. * @arg LL_TIM_TIM1_TI1_RMP_COMP2: TIM1 TI1 is connected to COMP2 output (*)
  4719. *
  4720. * TIM2: one of the following values:
  4721. * @arg LL_TIM_TIM2_TI1_RMP_GPIO: TIM2 TI1 is connected to GPIO
  4722. * @arg LL_TIM_TIM2_TI1_RMP_LSI: TIM2 TI1 is connected to LSI (*)
  4723. * @arg LL_TIM_TIM2_TI1_RMP_LSE: TIM2 TI1 is connected to LSE (*)
  4724. * @arg LL_TIM_TIM2_TI1_RMP_RTC: TIM2 TI1 is connected to RTC (*)
  4725. * @arg LL_TIM_TIM2_TI1_RMP_TIM3_TI1: TIM2 TI1 is connected to TIM3 TI1 (*)
  4726. * @arg LL_TIM_TIM2_TI1_RMP_ETH_PPS: TIM2 TI1 is connected to ETH PPS (*)
  4727. * @arg LL_TIM_TIM2_TI1_RMP_COMP1: TIM2 TI1 is connected to COMP1 output (*)
  4728. * @arg LL_TIM_TIM2_TI1_RMP_COMP2: TIM2 TI1 is connected to COMP2 output (*)
  4729. * @arg LL_TIM_TIM2_TI1_RMP_PLAY1_OUT3: TIM2 TI1 is connected to PLAY1 output 3 (*)
  4730. * @arg LL_TIM_TIM2_TI2_RMP_GPIO: TIM2 TI2 is connected to GPIO
  4731. * @arg LL_TIM_TIM2_TI2_RMP_HSI_1024: TIM2 TI2 is connected to HSI 1024 (*)
  4732. * @arg LL_TIM_TIM2_TI2_RMP_CSI_128: TIM2 TI2 is connected to CSI 128 (*)
  4733. * @arg LL_TIM_TIM2_TI2_RMP_MCO2: TIM2 TI2 is connected to MCO2 (*)
  4734. * @arg LL_TIM_TIM2_TI2_RMP_MCO1: TIM2 TI2 is connected to MCO1 (*)
  4735. * @arg LL_TIM_TIM2_TI1_RMP_COMP1: TIM2 TI2 is connected to COMP1 output (*)
  4736. * @arg LL_TIM_TIM2_TI1_RMP_COMP2: TIM2 TI2 is connected to COMP2 output (*)
  4737. * @arg LL_TIM_TIM2_TI4_RMP_GPIO: TIM2 TI4 is connected to GPIO
  4738. * @arg LL_TIM_TIM2_TI4_RMP_COMP1: TIM2 TI4 is connected to COMP1 (*)
  4739. *
  4740. * TIM3: one of the following values:
  4741. * @arg LL_TIM_TIM3_TI1_RMP_GPIO: TIM3 TI1 is connected to GPIO
  4742. * @arg LL_TIM_TIM3_TI1_RMP_COMP1: TIM3 TI1 is connected to COMP1 output (*)
  4743. * @arg LL_TIM_TIM3_TI1_RMP_COMP2: TIM3 TI1 is connected to COMP2 output (*)
  4744. * @arg LL_TIM_TIM3_TI1_RMP_MCO1: TIM3 TI1 is connected to MCO1 (*)
  4745. * @arg LL_TIM_TIM3_TI1_RMP_TIM2_TI1: TIM3 TI1 is connected to TIM2 TI1 (*)
  4746. * @arg LL_TIM_TIM3_TI1_RMP_HSE_1MHZ: TIM3 TI1 is connected to HSE_1MHZ (*)
  4747. * @arg LL_TIM_TIM3_TI1_RMP_ETH_PPS: TIM3 TI1 is connected to ETH PPS (*)
  4748. * @arg LL_TIM_TIM3_TI1_RMP_PLAY1_OUT3: TIM3 TI1 is connected to PLAY1 output 3 (*)
  4749. * @arg LL_TIM_TIM3_TI2_RMP_GPIO: TIM3 TI2 is connected to GPIO
  4750. * @arg LL_TIM_TIM3_TI2_RMP_CSI_128: TIM3 TI2 is connected to CSI_128 (*)
  4751. * @arg LL_TIM_TIM3_TI2_RMP_MCO2: TIM3 TI2 is connected to MCO2 (*)
  4752. * @arg LL_TIM_TIM3_TI2_RMP_HSI_1024: TIM3 TI2 is connected to HSI_1024 (*)
  4753. * @arg LL_TIM_TIM3_TI2_RMP_COMP1: TIM3 TI2 is connected to COMP1 output (*)
  4754. * @arg LL_TIM_TIM3_TI2_RMP_COMP2: TIM3 TI2 is connected to COMP2 output (*)
  4755. *
  4756. * TIM4: one of the following values: (**)
  4757. * @arg LL_TIM_TIM4_TI1_RMP_GPIO: TIM4 TI1 is connected to GPIO
  4758. * @arg LL_TIM_TIM4_TI1_RMP_COMP1: TIM4 TI1 is connected to COMP1 output (*)
  4759. * @arg LL_TIM_TIM4_TI1_RMP_COMP2: TIM4 TI1 is connected to COMP2 output (*)
  4760. *
  4761. * TIM5: one of the following values: (**)
  4762. * @arg LL_TIM_TIM5_TI1_RMP_GPIO: TIM5 TI1 is connected to GPIO
  4763. * @arg LL_TIM_TIM5_TI1_RMP_COMP1: TIM5 TI1 is connected to COMP1 output (*)
  4764. * @arg LL_TIM_TIM5_TI1_RMP_COMP2: TIM5 TI1 is connected to COMP2 output (*)
  4765. *
  4766. * TIM8: one of the following values: (**)
  4767. * @arg LL_TIM_TIM8_TI1_RMP_GPIO: TIM8 TI1 is connected to GPIO
  4768. * @arg LL_TIM_TIM8_TI1_RMP_COMP1: TIM8 TI1 is connected to COMP1 output (*)
  4769. * @arg LL_TIM_TIM8_TI1_RMP_COMP2: TIM8 TI1 is connected to COMP2 output (*)
  4770. *
  4771. * TIM12: one of the following values: (**)
  4772. * @arg LL_TIM_TIM12_TI1_RMP_GPIO: TIM12 TI1 is connected to GPIO
  4773. * @arg LL_TIM_TIM12_TI1_RMP_COMP1: TIM12 TI1 is connected to COMP1 output (*)
  4774. * @arg LL_TIM_TIM12_TI1_RMP_COMP2: TIM12 TI1 is connected to COMP2 output (*)
  4775. * @arg LL_TIM_TIM12_TI1_RMP_HSI_1024: TIM12 TI1 is connected to HSI 1024
  4776. * @arg LL_TIM_TIM12_TI1_RMP_CSI_128: TIM12 TI1 is connected to CSI 128
  4777. *
  4778. * TIM13: one of the following values: (**)
  4779. * @arg LL_TIM_TIM13_TI1_RMP_GPIO: TIM13 TI1 is connected to GPIO
  4780. * @arg LL_TIM_TIM13_TI1_RMP_I3C1_IBIACK: TIM13 TI1 is connected to I3C1 IBI ACK (*)
  4781. * @arg LL_TIM_TIM13_TI1_RMP_COMP1: TIM13 TI1 is connected to COMP1 output (*)
  4782. * @arg LL_TIM_TIM13_TI1_RMP_COMP2: TIM13 TI1 is connected to COMP2 output (*)
  4783. *
  4784. * TIM14: one of the following values: (**)
  4785. * @arg LL_TIM_TIM14_TI1_RMP_GPIO: TIM14 TI1 is connected to GPIO
  4786. * @arg LL_TIM_TIM14_TI1_RMP_I3C2_IBIACK: TIM14 TI1 is connected to I3C2 IBI ACK (*)
  4787. * @arg LL_TIM_TIM14_TI1_RMP_COMP1: TIM14 TI1 is connected to COMP1 output (*)
  4788. * @arg LL_TIM_TIM14_TI1_RMP_COMP2: TIM14 TI1 is connected to COMP2 output (*)
  4789. *
  4790. * TIM15: one of the following values: (**)
  4791. * @arg LL_TIM_TIM15_TI1_RMP_GPIO: TIM15 TI1 is connected to GPIO
  4792. * @arg LL_TIM_TIM15_TI1_RMP_TIM2: TIM15 TI1 is connected to TIM2
  4793. * @arg LL_TIM_TIM15_TI1_RMP_TIM3: TIM15 TI1 is connected to TIM3
  4794. * @arg LL_TIM_TIM15_TI1_RMP_TIM4: TIM15 TI1 is connected to TIM4
  4795. * @arg LL_TIM_TIM15_TI1_RMP_LSE: TIM15 TI1 is connected to LSE
  4796. * @arg LL_TIM_TIM15_TI1_RMP_CSI_128: TIM15 TI1 is connected to CSI/128
  4797. * @arg LL_TIM_TIM15_TI1_RMP_MCO2: TIM15 TI1 is connected to MCO2
  4798. * @arg LL_TIM_TIM15_TI1_RMP_COMP1: TIM15 TI1 is connected to COMP1 output (*)
  4799. * @arg LL_TIM_TIM15_TI1_RMP_COMP2: TIM15 TI1 is connected to COMP2 output (*)
  4800. * @arg LL_TIM_TIM15_TI2_RMP_GPIO: TIM15 TI1 is connected to GPIO
  4801. * @arg LL_TIM_TIM15_TI2_RMP_TIM2: TIM15 TI1 is connected to TIM2
  4802. * @arg LL_TIM_TIM15_TI2_RMP_TIM3: TIM15 TI1 is connected to TIM3
  4803. * @arg LL_TIM_TIM15_TI2_RMP_TIM4: TIM15 TI1 is connected to TIM4
  4804. * @arg LL_TIM_TIM15_TI2_RMP_COMP1: TIM15 TI2 is connected to COMP1 output (*)
  4805. * @arg LL_TIM_TIM15_TI2_RMP_COMP2: TIM15 TI2 is connected to COMP2 output (*)
  4806. *
  4807. * TIM16: one of the following values: (**)
  4808. * @arg LL_TIM_TIM16_TI1_RMP_GPIO: TIM16 TI1 is connected to GPIO
  4809. * @arg LL_TIM_TIM16_TI1_RMP_LSI: TIM16 TI1 is connected to LSI
  4810. * @arg LL_TIM_TIM16_TI1_RMP_LSE: TIM16 TI1 is connected to LSE
  4811. * @arg LL_TIM_TIM16_TI1_RMP_RTC_WKUP: TIM16 TI1 is connected to RTC_WKUP
  4812. * @arg LL_TIM_TIM16_TI1_RMP_COMP1: TIM16 TI1 is connected to COMP1 output (*)
  4813. * @arg LL_TIM_TIM16_TI1_RMP_COMP2: TIM16 TI1 is connected to COMP2 output (*)
  4814. *
  4815. * TIM17: one of the following values: (**)
  4816. * @arg LL_TIM_TIM17_TI1_RMP_GPIO: TIM17 TI1 is connected to GPIO
  4817. * @arg LL_TIM_TIM17_TI1_RMP_HSE_1MHZ: TIM17 TI1 is connected to HSE_1MHZ
  4818. * @arg LL_TIM_TIM17_TI1_RMP_MCO1: TIM17 TI1 is connected to MCO1
  4819. * @arg LL_TIM_TIM17_TI1_RMP_COMP1: TIM17 TI1 is connected to COMP1 output (*)
  4820. * @arg LL_TIM_TIM17_TI1_RMP_COMP2: TIM17 TI1 is connected to COMP2 output (*)
  4821. *
  4822. * (*) Value not defined in all devices. \n
  4823. * (**) Timer instance not available on all devices. \n
  4824. *
  4825. * @retval None
  4826. */
  4827. __STATIC_INLINE void LL_TIM_SetRemap(TIM_TypeDef *TIMx, uint32_t Remap)
  4828. {
  4829. MODIFY_REG(TIMx->TISEL, (TIM_TISEL_TI1SEL | TIM_TISEL_TI2SEL | TIM_TISEL_TI3SEL | TIM_TISEL_TI4SEL), Remap);
  4830. }
  4831. /**
  4832. * @brief Enable request for HSE 1MHz clock used for TISEL remap.
  4833. * @note Only TIM17 support HSE 1MHz remap
  4834. * @rmtoll OR1 RTCPREEN LL_TIM_EnableRTCPRE
  4835. * @param TIMx Timer instance
  4836. * @retval None
  4837. */
  4838. __STATIC_INLINE void LL_TIM_EnableRTCPRE(TIM_TypeDef *TIMx)
  4839. {
  4840. SET_BIT(TIMx->OR1, TIM_OR1_RTCPREEN);
  4841. }
  4842. /**
  4843. * @brief Disable request for HSE 1MHz clock used for TISEL remap.
  4844. * @note Only TIM17 support HSE 1MHz remap
  4845. * @rmtoll OR1 RTCPREEN LL_TIM_DisableRTCPRE
  4846. * @param TIMx Timer instance
  4847. * @retval None
  4848. */
  4849. __STATIC_INLINE void LL_TIM_DisableRTCPRE(TIM_TypeDef *TIMx)
  4850. {
  4851. CLEAR_BIT(TIMx->OR1, TIM_OR1_RTCPREEN);
  4852. }
  4853. /**
  4854. * @brief Indicate whether request for HSE 1MHz clock is enabled.
  4855. * @note Only TIM17 support HSE 1MHz remap
  4856. * @rmtoll OR1 RTCPREEN LL_TIM_IsEnabledRTCPRE
  4857. * @param TIMx Timer instance
  4858. * @retval State of bit (1 or 0).
  4859. */
  4860. __STATIC_INLINE uint32_t LL_TIM_IsEnabledRTCPRE(const TIM_TypeDef *TIMx)
  4861. {
  4862. return ((READ_BIT(TIMx->OR1, TIM_OR1_RTCPREEN) == (TIM_OR1_RTCPREEN)) ? 1UL : 0UL);
  4863. }
  4864. /**
  4865. * @}
  4866. */
  4867. /** @defgroup TIM_LL_EF_OCREF_Clear OCREF_Clear_Management
  4868. * @{
  4869. */
  4870. /**
  4871. * @brief Set the OCREF clear input source
  4872. * @note The OCxREF signal of a given channel can be cleared when a high level is applied on the OCREF_CLR_INPUT
  4873. * @note This function can only be used in Output compare and PWM modes.
  4874. * @rmtoll SMCR OCCS LL_TIM_SetOCRefClearInputSource
  4875. * @rmtoll AF2 OCRSEL LL_TIM_SetOCRefClearInputSource
  4876. * @param TIMx Timer instance
  4877. * @param OCRefClearInputSource This parameter can be one of the following values:
  4878. * @arg @ref LL_TIM_OCREF_CLR_INT_ETR
  4879. * @arg @ref LL_TIM_OCREF_CLR_INT_COMP1 (*)
  4880. * @arg @ref LL_TIM_OCREF_CLR_INT_COMP2 (*)
  4881. *
  4882. * (*) Value not defined in all devices. \n
  4883. * @retval None
  4884. */
  4885. __STATIC_INLINE void LL_TIM_SetOCRefClearInputSource(TIM_TypeDef *TIMx, uint32_t OCRefClearInputSource)
  4886. {
  4887. MODIFY_REG(TIMx->SMCR, TIM_SMCR_OCCS,
  4888. ((OCRefClearInputSource & OCREF_CLEAR_SELECT_MSK) >> OCREF_CLEAR_SELECT_POS) << TIM_SMCR_OCCS_Pos);
  4889. MODIFY_REG(TIMx->AF2, TIM1_AF2_OCRSEL, OCRefClearInputSource);
  4890. }
  4891. /**
  4892. * @}
  4893. */
  4894. /** @defgroup TIM_LL_EF_FLAG_Management FLAG-Management
  4895. * @{
  4896. */
  4897. /**
  4898. * @brief Clear the update interrupt flag (UIF).
  4899. * @rmtoll SR UIF LL_TIM_ClearFlag_UPDATE
  4900. * @param TIMx Timer instance
  4901. * @retval None
  4902. */
  4903. __STATIC_INLINE void LL_TIM_ClearFlag_UPDATE(TIM_TypeDef *TIMx)
  4904. {
  4905. WRITE_REG(TIMx->SR, ~(TIM_SR_UIF));
  4906. }
  4907. /**
  4908. * @brief Indicate whether update interrupt flag (UIF) is set (update interrupt is pending).
  4909. * @rmtoll SR UIF LL_TIM_IsActiveFlag_UPDATE
  4910. * @param TIMx Timer instance
  4911. * @retval State of bit (1 or 0).
  4912. */
  4913. __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_UPDATE(const TIM_TypeDef *TIMx)
  4914. {
  4915. return ((READ_BIT(TIMx->SR, TIM_SR_UIF) == (TIM_SR_UIF)) ? 1UL : 0UL);
  4916. }
  4917. /**
  4918. * @brief Clear the Capture/Compare 1 interrupt flag (CC1F).
  4919. * @rmtoll SR CC1IF LL_TIM_ClearFlag_CC1
  4920. * @param TIMx Timer instance
  4921. * @retval None
  4922. */
  4923. __STATIC_INLINE void LL_TIM_ClearFlag_CC1(TIM_TypeDef *TIMx)
  4924. {
  4925. WRITE_REG(TIMx->SR, ~(TIM_SR_CC1IF));
  4926. }
  4927. /**
  4928. * @brief Indicate whether Capture/Compare 1 interrupt flag (CC1F) is set (Capture/Compare 1 interrupt is pending).
  4929. * @rmtoll SR CC1IF LL_TIM_IsActiveFlag_CC1
  4930. * @param TIMx Timer instance
  4931. * @retval State of bit (1 or 0).
  4932. */
  4933. __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC1(const TIM_TypeDef *TIMx)
  4934. {
  4935. return ((READ_BIT(TIMx->SR, TIM_SR_CC1IF) == (TIM_SR_CC1IF)) ? 1UL : 0UL);
  4936. }
  4937. /**
  4938. * @brief Clear the Capture/Compare 2 interrupt flag (CC2F).
  4939. * @rmtoll SR CC2IF LL_TIM_ClearFlag_CC2
  4940. * @param TIMx Timer instance
  4941. * @retval None
  4942. */
  4943. __STATIC_INLINE void LL_TIM_ClearFlag_CC2(TIM_TypeDef *TIMx)
  4944. {
  4945. WRITE_REG(TIMx->SR, ~(TIM_SR_CC2IF));
  4946. }
  4947. /**
  4948. * @brief Indicate whether Capture/Compare 2 interrupt flag (CC2F) is set (Capture/Compare 2 interrupt is pending).
  4949. * @rmtoll SR CC2IF LL_TIM_IsActiveFlag_CC2
  4950. * @param TIMx Timer instance
  4951. * @retval State of bit (1 or 0).
  4952. */
  4953. __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC2(const TIM_TypeDef *TIMx)
  4954. {
  4955. return ((READ_BIT(TIMx->SR, TIM_SR_CC2IF) == (TIM_SR_CC2IF)) ? 1UL : 0UL);
  4956. }
  4957. /**
  4958. * @brief Clear the Capture/Compare 3 interrupt flag (CC3F).
  4959. * @rmtoll SR CC3IF LL_TIM_ClearFlag_CC3
  4960. * @param TIMx Timer instance
  4961. * @retval None
  4962. */
  4963. __STATIC_INLINE void LL_TIM_ClearFlag_CC3(TIM_TypeDef *TIMx)
  4964. {
  4965. WRITE_REG(TIMx->SR, ~(TIM_SR_CC3IF));
  4966. }
  4967. /**
  4968. * @brief Indicate whether Capture/Compare 3 interrupt flag (CC3F) is set (Capture/Compare 3 interrupt is pending).
  4969. * @rmtoll SR CC3IF LL_TIM_IsActiveFlag_CC3
  4970. * @param TIMx Timer instance
  4971. * @retval State of bit (1 or 0).
  4972. */
  4973. __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC3(const TIM_TypeDef *TIMx)
  4974. {
  4975. return ((READ_BIT(TIMx->SR, TIM_SR_CC3IF) == (TIM_SR_CC3IF)) ? 1UL : 0UL);
  4976. }
  4977. /**
  4978. * @brief Clear the Capture/Compare 4 interrupt flag (CC4F).
  4979. * @rmtoll SR CC4IF LL_TIM_ClearFlag_CC4
  4980. * @param TIMx Timer instance
  4981. * @retval None
  4982. */
  4983. __STATIC_INLINE void LL_TIM_ClearFlag_CC4(TIM_TypeDef *TIMx)
  4984. {
  4985. WRITE_REG(TIMx->SR, ~(TIM_SR_CC4IF));
  4986. }
  4987. /**
  4988. * @brief Indicate whether Capture/Compare 4 interrupt flag (CC4F) is set (Capture/Compare 4 interrupt is pending).
  4989. * @rmtoll SR CC4IF LL_TIM_IsActiveFlag_CC4
  4990. * @param TIMx Timer instance
  4991. * @retval State of bit (1 or 0).
  4992. */
  4993. __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC4(const TIM_TypeDef *TIMx)
  4994. {
  4995. return ((READ_BIT(TIMx->SR, TIM_SR_CC4IF) == (TIM_SR_CC4IF)) ? 1UL : 0UL);
  4996. }
  4997. /**
  4998. * @brief Clear the Capture/Compare 5 interrupt flag (CC5F).
  4999. * @rmtoll SR CC5IF LL_TIM_ClearFlag_CC5
  5000. * @param TIMx Timer instance
  5001. * @retval None
  5002. */
  5003. __STATIC_INLINE void LL_TIM_ClearFlag_CC5(TIM_TypeDef *TIMx)
  5004. {
  5005. WRITE_REG(TIMx->SR, ~(TIM_SR_CC5IF));
  5006. }
  5007. /**
  5008. * @brief Indicate whether Capture/Compare 5 interrupt flag (CC5F) is set (Capture/Compare 5 interrupt is pending).
  5009. * @rmtoll SR CC5IF LL_TIM_IsActiveFlag_CC5
  5010. * @param TIMx Timer instance
  5011. * @retval State of bit (1 or 0).
  5012. */
  5013. __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC5(const TIM_TypeDef *TIMx)
  5014. {
  5015. return ((READ_BIT(TIMx->SR, TIM_SR_CC5IF) == (TIM_SR_CC5IF)) ? 1UL : 0UL);
  5016. }
  5017. /**
  5018. * @brief Clear the Capture/Compare 6 interrupt flag (CC6F).
  5019. * @rmtoll SR CC6IF LL_TIM_ClearFlag_CC6
  5020. * @param TIMx Timer instance
  5021. * @retval None
  5022. */
  5023. __STATIC_INLINE void LL_TIM_ClearFlag_CC6(TIM_TypeDef *TIMx)
  5024. {
  5025. WRITE_REG(TIMx->SR, ~(TIM_SR_CC6IF));
  5026. }
  5027. /**
  5028. * @brief Indicate whether Capture/Compare 6 interrupt flag (CC6F) is set (Capture/Compare 6 interrupt is pending).
  5029. * @rmtoll SR CC6IF LL_TIM_IsActiveFlag_CC6
  5030. * @param TIMx Timer instance
  5031. * @retval State of bit (1 or 0).
  5032. */
  5033. __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC6(const TIM_TypeDef *TIMx)
  5034. {
  5035. return ((READ_BIT(TIMx->SR, TIM_SR_CC6IF) == (TIM_SR_CC6IF)) ? 1UL : 0UL);
  5036. }
  5037. /**
  5038. * @brief Clear the commutation interrupt flag (COMIF).
  5039. * @rmtoll SR COMIF LL_TIM_ClearFlag_COM
  5040. * @param TIMx Timer instance
  5041. * @retval None
  5042. */
  5043. __STATIC_INLINE void LL_TIM_ClearFlag_COM(TIM_TypeDef *TIMx)
  5044. {
  5045. WRITE_REG(TIMx->SR, ~(TIM_SR_COMIF));
  5046. }
  5047. /**
  5048. * @brief Indicate whether commutation interrupt flag (COMIF) is set (commutation interrupt is pending).
  5049. * @rmtoll SR COMIF LL_TIM_IsActiveFlag_COM
  5050. * @param TIMx Timer instance
  5051. * @retval State of bit (1 or 0).
  5052. */
  5053. __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_COM(const TIM_TypeDef *TIMx)
  5054. {
  5055. return ((READ_BIT(TIMx->SR, TIM_SR_COMIF) == (TIM_SR_COMIF)) ? 1UL : 0UL);
  5056. }
  5057. /**
  5058. * @brief Clear the trigger interrupt flag (TIF).
  5059. * @rmtoll SR TIF LL_TIM_ClearFlag_TRIG
  5060. * @param TIMx Timer instance
  5061. * @retval None
  5062. */
  5063. __STATIC_INLINE void LL_TIM_ClearFlag_TRIG(TIM_TypeDef *TIMx)
  5064. {
  5065. WRITE_REG(TIMx->SR, ~(TIM_SR_TIF));
  5066. }
  5067. /**
  5068. * @brief Indicate whether trigger interrupt flag (TIF) is set (trigger interrupt is pending).
  5069. * @rmtoll SR TIF LL_TIM_IsActiveFlag_TRIG
  5070. * @param TIMx Timer instance
  5071. * @retval State of bit (1 or 0).
  5072. */
  5073. __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_TRIG(const TIM_TypeDef *TIMx)
  5074. {
  5075. return ((READ_BIT(TIMx->SR, TIM_SR_TIF) == (TIM_SR_TIF)) ? 1UL : 0UL);
  5076. }
  5077. /**
  5078. * @brief Clear the break interrupt flag (BIF).
  5079. * @rmtoll SR BIF LL_TIM_ClearFlag_BRK
  5080. * @param TIMx Timer instance
  5081. * @retval None
  5082. */
  5083. __STATIC_INLINE void LL_TIM_ClearFlag_BRK(TIM_TypeDef *TIMx)
  5084. {
  5085. WRITE_REG(TIMx->SR, ~(TIM_SR_BIF));
  5086. }
  5087. /**
  5088. * @brief Indicate whether break interrupt flag (BIF) is set (break interrupt is pending).
  5089. * @rmtoll SR BIF LL_TIM_IsActiveFlag_BRK
  5090. * @param TIMx Timer instance
  5091. * @retval State of bit (1 or 0).
  5092. */
  5093. __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_BRK(const TIM_TypeDef *TIMx)
  5094. {
  5095. return ((READ_BIT(TIMx->SR, TIM_SR_BIF) == (TIM_SR_BIF)) ? 1UL : 0UL);
  5096. }
  5097. /**
  5098. * @brief Clear the break 2 interrupt flag (B2IF).
  5099. * @rmtoll SR B2IF LL_TIM_ClearFlag_BRK2
  5100. * @param TIMx Timer instance
  5101. * @retval None
  5102. */
  5103. __STATIC_INLINE void LL_TIM_ClearFlag_BRK2(TIM_TypeDef *TIMx)
  5104. {
  5105. WRITE_REG(TIMx->SR, ~(TIM_SR_B2IF));
  5106. }
  5107. /**
  5108. * @brief Indicate whether break 2 interrupt flag (B2IF) is set (break 2 interrupt is pending).
  5109. * @rmtoll SR B2IF LL_TIM_IsActiveFlag_BRK2
  5110. * @param TIMx Timer instance
  5111. * @retval State of bit (1 or 0).
  5112. */
  5113. __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_BRK2(const TIM_TypeDef *TIMx)
  5114. {
  5115. return ((READ_BIT(TIMx->SR, TIM_SR_B2IF) == (TIM_SR_B2IF)) ? 1UL : 0UL);
  5116. }
  5117. /**
  5118. * @brief Clear the Capture/Compare 1 over-capture interrupt flag (CC1OF).
  5119. * @rmtoll SR CC1OF LL_TIM_ClearFlag_CC1OVR
  5120. * @param TIMx Timer instance
  5121. * @retval None
  5122. */
  5123. __STATIC_INLINE void LL_TIM_ClearFlag_CC1OVR(TIM_TypeDef *TIMx)
  5124. {
  5125. WRITE_REG(TIMx->SR, ~(TIM_SR_CC1OF));
  5126. }
  5127. /**
  5128. * @brief Indicate whether Capture/Compare 1 over-capture interrupt flag (CC1OF) is set
  5129. * (Capture/Compare 1 interrupt is pending).
  5130. * @rmtoll SR CC1OF LL_TIM_IsActiveFlag_CC1OVR
  5131. * @param TIMx Timer instance
  5132. * @retval State of bit (1 or 0).
  5133. */
  5134. __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC1OVR(const TIM_TypeDef *TIMx)
  5135. {
  5136. return ((READ_BIT(TIMx->SR, TIM_SR_CC1OF) == (TIM_SR_CC1OF)) ? 1UL : 0UL);
  5137. }
  5138. /**
  5139. * @brief Clear the Capture/Compare 2 over-capture interrupt flag (CC2OF).
  5140. * @rmtoll SR CC2OF LL_TIM_ClearFlag_CC2OVR
  5141. * @param TIMx Timer instance
  5142. * @retval None
  5143. */
  5144. __STATIC_INLINE void LL_TIM_ClearFlag_CC2OVR(TIM_TypeDef *TIMx)
  5145. {
  5146. WRITE_REG(TIMx->SR, ~(TIM_SR_CC2OF));
  5147. }
  5148. /**
  5149. * @brief Indicate whether Capture/Compare 2 over-capture interrupt flag (CC2OF) is set
  5150. * (Capture/Compare 2 over-capture interrupt is pending).
  5151. * @rmtoll SR CC2OF LL_TIM_IsActiveFlag_CC2OVR
  5152. * @param TIMx Timer instance
  5153. * @retval State of bit (1 or 0).
  5154. */
  5155. __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC2OVR(const TIM_TypeDef *TIMx)
  5156. {
  5157. return ((READ_BIT(TIMx->SR, TIM_SR_CC2OF) == (TIM_SR_CC2OF)) ? 1UL : 0UL);
  5158. }
  5159. /**
  5160. * @brief Clear the Capture/Compare 3 over-capture interrupt flag (CC3OF).
  5161. * @rmtoll SR CC3OF LL_TIM_ClearFlag_CC3OVR
  5162. * @param TIMx Timer instance
  5163. * @retval None
  5164. */
  5165. __STATIC_INLINE void LL_TIM_ClearFlag_CC3OVR(TIM_TypeDef *TIMx)
  5166. {
  5167. WRITE_REG(TIMx->SR, ~(TIM_SR_CC3OF));
  5168. }
  5169. /**
  5170. * @brief Indicate whether Capture/Compare 3 over-capture interrupt flag (CC3OF) is set
  5171. * (Capture/Compare 3 over-capture interrupt is pending).
  5172. * @rmtoll SR CC3OF LL_TIM_IsActiveFlag_CC3OVR
  5173. * @param TIMx Timer instance
  5174. * @retval State of bit (1 or 0).
  5175. */
  5176. __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC3OVR(const TIM_TypeDef *TIMx)
  5177. {
  5178. return ((READ_BIT(TIMx->SR, TIM_SR_CC3OF) == (TIM_SR_CC3OF)) ? 1UL : 0UL);
  5179. }
  5180. /**
  5181. * @brief Clear the Capture/Compare 4 over-capture interrupt flag (CC4OF).
  5182. * @rmtoll SR CC4OF LL_TIM_ClearFlag_CC4OVR
  5183. * @param TIMx Timer instance
  5184. * @retval None
  5185. */
  5186. __STATIC_INLINE void LL_TIM_ClearFlag_CC4OVR(TIM_TypeDef *TIMx)
  5187. {
  5188. WRITE_REG(TIMx->SR, ~(TIM_SR_CC4OF));
  5189. }
  5190. /**
  5191. * @brief Indicate whether Capture/Compare 4 over-capture interrupt flag (CC4OF) is set
  5192. * (Capture/Compare 4 over-capture interrupt is pending).
  5193. * @rmtoll SR CC4OF LL_TIM_IsActiveFlag_CC4OVR
  5194. * @param TIMx Timer instance
  5195. * @retval State of bit (1 or 0).
  5196. */
  5197. __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_CC4OVR(const TIM_TypeDef *TIMx)
  5198. {
  5199. return ((READ_BIT(TIMx->SR, TIM_SR_CC4OF) == (TIM_SR_CC4OF)) ? 1UL : 0UL);
  5200. }
  5201. /**
  5202. * @brief Clear the system break interrupt flag (SBIF).
  5203. * @rmtoll SR SBIF LL_TIM_ClearFlag_SYSBRK
  5204. * @param TIMx Timer instance
  5205. * @retval None
  5206. */
  5207. __STATIC_INLINE void LL_TIM_ClearFlag_SYSBRK(TIM_TypeDef *TIMx)
  5208. {
  5209. WRITE_REG(TIMx->SR, ~(TIM_SR_SBIF));
  5210. }
  5211. /**
  5212. * @brief Indicate whether system break interrupt flag (SBIF) is set (system break interrupt is pending).
  5213. * @rmtoll SR SBIF LL_TIM_IsActiveFlag_SYSBRK
  5214. * @param TIMx Timer instance
  5215. * @retval State of bit (1 or 0).
  5216. */
  5217. __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_SYSBRK(const TIM_TypeDef *TIMx)
  5218. {
  5219. return ((READ_BIT(TIMx->SR, TIM_SR_SBIF) == (TIM_SR_SBIF)) ? 1UL : 0UL);
  5220. }
  5221. /**
  5222. * @brief Clear the transition error interrupt flag (TERRF).
  5223. * @note Macro IS_TIM_ENCODER_ERROR_INSTANCE(TIMx) can be used to check whether or not
  5224. * a timer instance provides encoder error management.
  5225. * @rmtoll SR TERRF LL_TIM_ClearFlag_TERR
  5226. * @param TIMx Timer instance
  5227. * @retval None
  5228. */
  5229. __STATIC_INLINE void LL_TIM_ClearFlag_TERR(TIM_TypeDef *TIMx)
  5230. {
  5231. WRITE_REG(TIMx->SR, ~(TIM_SR_TERRF));
  5232. }
  5233. /**
  5234. * @brief Indicate whether transition error interrupt flag (TERRF) is set (transition error interrupt is pending).
  5235. * @note Macro IS_TIM_ENCODER_ERROR_INSTANCE(TIMx) can be used to check whether or not
  5236. * a timer instance provides encoder error management.
  5237. * @rmtoll SR TERRF LL_TIM_IsActiveFlag_TERR
  5238. * @param TIMx Timer instance
  5239. * @retval State of bit (1 or 0).
  5240. */
  5241. __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_TERR(const TIM_TypeDef *TIMx)
  5242. {
  5243. return ((READ_BIT(TIMx->SR, TIM_SR_TERRF) == (TIM_SR_TERRF)) ? 1UL : 0UL);
  5244. }
  5245. /**
  5246. * @brief Clear the index error interrupt flag (IERRF).
  5247. * @note Macro IS_TIM_ENCODER_ERROR_INSTANCE(TIMx) can be used to check whether or not
  5248. * a timer instance provides encoder error management.
  5249. * @rmtoll SR IERRF LL_TIM_ClearFlag_IERR
  5250. * @param TIMx Timer instance
  5251. * @retval None
  5252. */
  5253. __STATIC_INLINE void LL_TIM_ClearFlag_IERR(TIM_TypeDef *TIMx)
  5254. {
  5255. WRITE_REG(TIMx->SR, ~(TIM_SR_IERRF));
  5256. }
  5257. /**
  5258. * @brief Indicate whether index error interrupt flag (IERRF) is set (index error interrupt is pending).
  5259. * @note Macro IS_TIM_ENCODER_ERROR_INSTANCE(TIMx) can be used to check whether or not
  5260. * a timer instance provides encoder error management.
  5261. * @rmtoll SR IERRF LL_TIM_IsActiveFlag_IERR
  5262. * @param TIMx Timer instance
  5263. * @retval State of bit (1 or 0).
  5264. */
  5265. __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_IERR(const TIM_TypeDef *TIMx)
  5266. {
  5267. return ((READ_BIT(TIMx->SR, TIM_SR_IERRF) == (TIM_SR_IERRF)) ? 1UL : 0UL);
  5268. }
  5269. /**
  5270. * @brief Clear the direction change interrupt flag (DIRF).
  5271. * @note Macro IS_TIM_FUNCTINONAL_ENCODER_INTERRUPT_INSTANCE(TIMx) can be used to check whether or not
  5272. * a timer instance provides encoder interrupt management.
  5273. * @rmtoll SR DIRF LL_TIM_ClearFlag_DIR
  5274. * @param TIMx Timer instance
  5275. * @retval None
  5276. */
  5277. __STATIC_INLINE void LL_TIM_ClearFlag_DIR(TIM_TypeDef *TIMx)
  5278. {
  5279. WRITE_REG(TIMx->SR, ~(TIM_SR_DIRF));
  5280. }
  5281. /**
  5282. * @brief Indicate whether direction change interrupt flag (DIRF) is set (direction change interrupt is pending).
  5283. * @note Macro IS_TIM_FUNCTINONAL_ENCODER_INTERRUPT_INSTANCE(TIMx) can be used to check whether or not
  5284. * a timer instance provides encoder interrupt management.
  5285. * @rmtoll SR DIRF LL_TIM_IsActiveFlag_DIR
  5286. * @param TIMx Timer instance
  5287. * @retval State of bit (1 or 0).
  5288. */
  5289. __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_DIR(const TIM_TypeDef *TIMx)
  5290. {
  5291. return ((READ_BIT(TIMx->SR, TIM_SR_DIRF) == (TIM_SR_DIRF)) ? 1UL : 0UL);
  5292. }
  5293. /**
  5294. * @brief Clear the index interrupt flag (IDXF).
  5295. * @note Macro IS_TIM_FUNCTINONAL_ENCODER_INTERRUPT_INSTANCE(TIMx) can be used to check whether or not
  5296. * a timer instance provides encoder interrupt management.
  5297. * @rmtoll SR IDXF LL_TIM_ClearFlag_IDX
  5298. * @param TIMx Timer instance
  5299. * @retval None
  5300. */
  5301. __STATIC_INLINE void LL_TIM_ClearFlag_IDX(TIM_TypeDef *TIMx)
  5302. {
  5303. WRITE_REG(TIMx->SR, ~(TIM_SR_IDXF));
  5304. }
  5305. /**
  5306. * @brief Indicate whether index interrupt flag (IDXF) is set (index interrupt is pending).
  5307. * @note Macro IS_TIM_FUNCTINONAL_ENCODER_INTERRUPT_INSTANCE(TIMx) can be used to check whether or not
  5308. * a timer instance provides encoder interrupt management.
  5309. * @rmtoll SR IDXF LL_TIM_IsActiveFlag_IDX
  5310. * @param TIMx Timer instance
  5311. * @retval State of bit (1 or 0).
  5312. */
  5313. __STATIC_INLINE uint32_t LL_TIM_IsActiveFlag_IDX(const TIM_TypeDef *TIMx)
  5314. {
  5315. return ((READ_BIT(TIMx->SR, TIM_SR_IDXF) == (TIM_SR_IDXF)) ? 1UL : 0UL);
  5316. }
  5317. /**
  5318. * @}
  5319. */
  5320. /** @defgroup TIM_LL_EF_IT_Management IT-Management
  5321. * @{
  5322. */
  5323. /**
  5324. * @brief Enable update interrupt (UIE).
  5325. * @rmtoll DIER UIE LL_TIM_EnableIT_UPDATE
  5326. * @param TIMx Timer instance
  5327. * @retval None
  5328. */
  5329. __STATIC_INLINE void LL_TIM_EnableIT_UPDATE(TIM_TypeDef *TIMx)
  5330. {
  5331. SET_BIT(TIMx->DIER, TIM_DIER_UIE);
  5332. }
  5333. /**
  5334. * @brief Disable update interrupt (UIE).
  5335. * @rmtoll DIER UIE LL_TIM_DisableIT_UPDATE
  5336. * @param TIMx Timer instance
  5337. * @retval None
  5338. */
  5339. __STATIC_INLINE void LL_TIM_DisableIT_UPDATE(TIM_TypeDef *TIMx)
  5340. {
  5341. CLEAR_BIT(TIMx->DIER, TIM_DIER_UIE);
  5342. }
  5343. /**
  5344. * @brief Indicates whether the update interrupt (UIE) is enabled.
  5345. * @rmtoll DIER UIE LL_TIM_IsEnabledIT_UPDATE
  5346. * @param TIMx Timer instance
  5347. * @retval State of bit (1 or 0).
  5348. */
  5349. __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_UPDATE(const TIM_TypeDef *TIMx)
  5350. {
  5351. return ((READ_BIT(TIMx->DIER, TIM_DIER_UIE) == (TIM_DIER_UIE)) ? 1UL : 0UL);
  5352. }
  5353. /**
  5354. * @brief Enable capture/compare 1 interrupt (CC1IE).
  5355. * @rmtoll DIER CC1IE LL_TIM_EnableIT_CC1
  5356. * @param TIMx Timer instance
  5357. * @retval None
  5358. */
  5359. __STATIC_INLINE void LL_TIM_EnableIT_CC1(TIM_TypeDef *TIMx)
  5360. {
  5361. SET_BIT(TIMx->DIER, TIM_DIER_CC1IE);
  5362. }
  5363. /**
  5364. * @brief Disable capture/compare 1 interrupt (CC1IE).
  5365. * @rmtoll DIER CC1IE LL_TIM_DisableIT_CC1
  5366. * @param TIMx Timer instance
  5367. * @retval None
  5368. */
  5369. __STATIC_INLINE void LL_TIM_DisableIT_CC1(TIM_TypeDef *TIMx)
  5370. {
  5371. CLEAR_BIT(TIMx->DIER, TIM_DIER_CC1IE);
  5372. }
  5373. /**
  5374. * @brief Indicates whether the capture/compare 1 interrupt (CC1IE) is enabled.
  5375. * @rmtoll DIER CC1IE LL_TIM_IsEnabledIT_CC1
  5376. * @param TIMx Timer instance
  5377. * @retval State of bit (1 or 0).
  5378. */
  5379. __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC1(const TIM_TypeDef *TIMx)
  5380. {
  5381. return ((READ_BIT(TIMx->DIER, TIM_DIER_CC1IE) == (TIM_DIER_CC1IE)) ? 1UL : 0UL);
  5382. }
  5383. /**
  5384. * @brief Enable capture/compare 2 interrupt (CC2IE).
  5385. * @rmtoll DIER CC2IE LL_TIM_EnableIT_CC2
  5386. * @param TIMx Timer instance
  5387. * @retval None
  5388. */
  5389. __STATIC_INLINE void LL_TIM_EnableIT_CC2(TIM_TypeDef *TIMx)
  5390. {
  5391. SET_BIT(TIMx->DIER, TIM_DIER_CC2IE);
  5392. }
  5393. /**
  5394. * @brief Disable capture/compare 2 interrupt (CC2IE).
  5395. * @rmtoll DIER CC2IE LL_TIM_DisableIT_CC2
  5396. * @param TIMx Timer instance
  5397. * @retval None
  5398. */
  5399. __STATIC_INLINE void LL_TIM_DisableIT_CC2(TIM_TypeDef *TIMx)
  5400. {
  5401. CLEAR_BIT(TIMx->DIER, TIM_DIER_CC2IE);
  5402. }
  5403. /**
  5404. * @brief Indicates whether the capture/compare 2 interrupt (CC2IE) is enabled.
  5405. * @rmtoll DIER CC2IE LL_TIM_IsEnabledIT_CC2
  5406. * @param TIMx Timer instance
  5407. * @retval State of bit (1 or 0).
  5408. */
  5409. __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC2(const TIM_TypeDef *TIMx)
  5410. {
  5411. return ((READ_BIT(TIMx->DIER, TIM_DIER_CC2IE) == (TIM_DIER_CC2IE)) ? 1UL : 0UL);
  5412. }
  5413. /**
  5414. * @brief Enable capture/compare 3 interrupt (CC3IE).
  5415. * @rmtoll DIER CC3IE LL_TIM_EnableIT_CC3
  5416. * @param TIMx Timer instance
  5417. * @retval None
  5418. */
  5419. __STATIC_INLINE void LL_TIM_EnableIT_CC3(TIM_TypeDef *TIMx)
  5420. {
  5421. SET_BIT(TIMx->DIER, TIM_DIER_CC3IE);
  5422. }
  5423. /**
  5424. * @brief Disable capture/compare 3 interrupt (CC3IE).
  5425. * @rmtoll DIER CC3IE LL_TIM_DisableIT_CC3
  5426. * @param TIMx Timer instance
  5427. * @retval None
  5428. */
  5429. __STATIC_INLINE void LL_TIM_DisableIT_CC3(TIM_TypeDef *TIMx)
  5430. {
  5431. CLEAR_BIT(TIMx->DIER, TIM_DIER_CC3IE);
  5432. }
  5433. /**
  5434. * @brief Indicates whether the capture/compare 3 interrupt (CC3IE) is enabled.
  5435. * @rmtoll DIER CC3IE LL_TIM_IsEnabledIT_CC3
  5436. * @param TIMx Timer instance
  5437. * @retval State of bit (1 or 0).
  5438. */
  5439. __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC3(const TIM_TypeDef *TIMx)
  5440. {
  5441. return ((READ_BIT(TIMx->DIER, TIM_DIER_CC3IE) == (TIM_DIER_CC3IE)) ? 1UL : 0UL);
  5442. }
  5443. /**
  5444. * @brief Enable capture/compare 4 interrupt (CC4IE).
  5445. * @rmtoll DIER CC4IE LL_TIM_EnableIT_CC4
  5446. * @param TIMx Timer instance
  5447. * @retval None
  5448. */
  5449. __STATIC_INLINE void LL_TIM_EnableIT_CC4(TIM_TypeDef *TIMx)
  5450. {
  5451. SET_BIT(TIMx->DIER, TIM_DIER_CC4IE);
  5452. }
  5453. /**
  5454. * @brief Disable capture/compare 4 interrupt (CC4IE).
  5455. * @rmtoll DIER CC4IE LL_TIM_DisableIT_CC4
  5456. * @param TIMx Timer instance
  5457. * @retval None
  5458. */
  5459. __STATIC_INLINE void LL_TIM_DisableIT_CC4(TIM_TypeDef *TIMx)
  5460. {
  5461. CLEAR_BIT(TIMx->DIER, TIM_DIER_CC4IE);
  5462. }
  5463. /**
  5464. * @brief Indicates whether the capture/compare 4 interrupt (CC4IE) is enabled.
  5465. * @rmtoll DIER CC4IE LL_TIM_IsEnabledIT_CC4
  5466. * @param TIMx Timer instance
  5467. * @retval State of bit (1 or 0).
  5468. */
  5469. __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_CC4(const TIM_TypeDef *TIMx)
  5470. {
  5471. return ((READ_BIT(TIMx->DIER, TIM_DIER_CC4IE) == (TIM_DIER_CC4IE)) ? 1UL : 0UL);
  5472. }
  5473. /**
  5474. * @brief Enable commutation interrupt (COMIE).
  5475. * @rmtoll DIER COMIE LL_TIM_EnableIT_COM
  5476. * @param TIMx Timer instance
  5477. * @retval None
  5478. */
  5479. __STATIC_INLINE void LL_TIM_EnableIT_COM(TIM_TypeDef *TIMx)
  5480. {
  5481. SET_BIT(TIMx->DIER, TIM_DIER_COMIE);
  5482. }
  5483. /**
  5484. * @brief Disable commutation interrupt (COMIE).
  5485. * @rmtoll DIER COMIE LL_TIM_DisableIT_COM
  5486. * @param TIMx Timer instance
  5487. * @retval None
  5488. */
  5489. __STATIC_INLINE void LL_TIM_DisableIT_COM(TIM_TypeDef *TIMx)
  5490. {
  5491. CLEAR_BIT(TIMx->DIER, TIM_DIER_COMIE);
  5492. }
  5493. /**
  5494. * @brief Indicates whether the commutation interrupt (COMIE) is enabled.
  5495. * @rmtoll DIER COMIE LL_TIM_IsEnabledIT_COM
  5496. * @param TIMx Timer instance
  5497. * @retval State of bit (1 or 0).
  5498. */
  5499. __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_COM(const TIM_TypeDef *TIMx)
  5500. {
  5501. return ((READ_BIT(TIMx->DIER, TIM_DIER_COMIE) == (TIM_DIER_COMIE)) ? 1UL : 0UL);
  5502. }
  5503. /**
  5504. * @brief Enable trigger interrupt (TIE).
  5505. * @rmtoll DIER TIE LL_TIM_EnableIT_TRIG
  5506. * @param TIMx Timer instance
  5507. * @retval None
  5508. */
  5509. __STATIC_INLINE void LL_TIM_EnableIT_TRIG(TIM_TypeDef *TIMx)
  5510. {
  5511. SET_BIT(TIMx->DIER, TIM_DIER_TIE);
  5512. }
  5513. /**
  5514. * @brief Disable trigger interrupt (TIE).
  5515. * @rmtoll DIER TIE LL_TIM_DisableIT_TRIG
  5516. * @param TIMx Timer instance
  5517. * @retval None
  5518. */
  5519. __STATIC_INLINE void LL_TIM_DisableIT_TRIG(TIM_TypeDef *TIMx)
  5520. {
  5521. CLEAR_BIT(TIMx->DIER, TIM_DIER_TIE);
  5522. }
  5523. /**
  5524. * @brief Indicates whether the trigger interrupt (TIE) is enabled.
  5525. * @rmtoll DIER TIE LL_TIM_IsEnabledIT_TRIG
  5526. * @param TIMx Timer instance
  5527. * @retval State of bit (1 or 0).
  5528. */
  5529. __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_TRIG(const TIM_TypeDef *TIMx)
  5530. {
  5531. return ((READ_BIT(TIMx->DIER, TIM_DIER_TIE) == (TIM_DIER_TIE)) ? 1UL : 0UL);
  5532. }
  5533. /**
  5534. * @brief Enable break interrupt (BIE).
  5535. * @rmtoll DIER BIE LL_TIM_EnableIT_BRK
  5536. * @param TIMx Timer instance
  5537. * @retval None
  5538. */
  5539. __STATIC_INLINE void LL_TIM_EnableIT_BRK(TIM_TypeDef *TIMx)
  5540. {
  5541. SET_BIT(TIMx->DIER, TIM_DIER_BIE);
  5542. }
  5543. /**
  5544. * @brief Disable break interrupt (BIE).
  5545. * @rmtoll DIER BIE LL_TIM_DisableIT_BRK
  5546. * @param TIMx Timer instance
  5547. * @retval None
  5548. */
  5549. __STATIC_INLINE void LL_TIM_DisableIT_BRK(TIM_TypeDef *TIMx)
  5550. {
  5551. CLEAR_BIT(TIMx->DIER, TIM_DIER_BIE);
  5552. }
  5553. /**
  5554. * @brief Indicates whether the break interrupt (BIE) is enabled.
  5555. * @rmtoll DIER BIE LL_TIM_IsEnabledIT_BRK
  5556. * @param TIMx Timer instance
  5557. * @retval State of bit (1 or 0).
  5558. */
  5559. __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_BRK(const TIM_TypeDef *TIMx)
  5560. {
  5561. return ((READ_BIT(TIMx->DIER, TIM_DIER_BIE) == (TIM_DIER_BIE)) ? 1UL : 0UL);
  5562. }
  5563. /**
  5564. * @brief Enable transition error interrupt (TERRIE).
  5565. * @note Macro IS_TIM_ENCODER_ERROR_INSTANCE(TIMx) can be used to check whether or not
  5566. * a timer instance provides encoder error management.
  5567. * @rmtoll DIER TERRIE LL_TIM_EnableIT_TERR
  5568. * @param TIMx Timer instance
  5569. * @retval None
  5570. */
  5571. __STATIC_INLINE void LL_TIM_EnableIT_TERR(TIM_TypeDef *TIMx)
  5572. {
  5573. SET_BIT(TIMx->DIER, TIM_DIER_TERRIE);
  5574. }
  5575. /**
  5576. * @brief Disable transition error interrupt (TERRIE).
  5577. * @note Macro IS_TIM_ENCODER_ERROR_INSTANCE(TIMx) can be used to check whether or not
  5578. * a timer instance provides encoder error management.
  5579. * @rmtoll DIER TERRIE LL_TIM_DisableIT_TERR
  5580. * @param TIMx Timer instance
  5581. * @retval None
  5582. */
  5583. __STATIC_INLINE void LL_TIM_DisableIT_TERR(TIM_TypeDef *TIMx)
  5584. {
  5585. CLEAR_BIT(TIMx->DIER, TIM_DIER_TERRIE);
  5586. }
  5587. /**
  5588. * @brief Indicates whether the transition error interrupt (TERRIE) is enabled.
  5589. * @note Macro IS_TIM_ENCODER_ERROR_INSTANCE(TIMx) can be used to check whether or not
  5590. * a timer instance provides encoder error management.
  5591. * @rmtoll DIER TERRIE LL_TIM_IsEnabledIT_TERR
  5592. * @param TIMx Timer instance
  5593. * @retval State of bit (1 or 0).
  5594. */
  5595. __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_TERR(const TIM_TypeDef *TIMx)
  5596. {
  5597. return ((READ_BIT(TIMx->DIER, TIM_DIER_TERRIE) == (TIM_DIER_TERRIE)) ? 1UL : 0UL);
  5598. }
  5599. /**
  5600. * @brief Enable index error interrupt (IERRIE).
  5601. * @note Macro IS_TIM_ENCODER_ERROR_INSTANCE(TIMx) can be used to check whether or not
  5602. * a timer instance provides encoder error management.
  5603. * @rmtoll DIER IERRIE LL_TIM_EnableIT_IERR
  5604. * @param TIMx Timer instance
  5605. * @retval None
  5606. */
  5607. __STATIC_INLINE void LL_TIM_EnableIT_IERR(TIM_TypeDef *TIMx)
  5608. {
  5609. SET_BIT(TIMx->DIER, TIM_DIER_IERRIE);
  5610. }
  5611. /**
  5612. * @brief Disable index error interrupt (IERRIE).
  5613. * @note Macro IS_TIM_ENCODER_ERROR_INSTANCE(TIMx) can be used to check whether or not
  5614. * a timer instance provides encoder error management.
  5615. * @rmtoll DIER IERRIE LL_TIM_DisableIT_IERR
  5616. * @param TIMx Timer instance
  5617. * @retval None
  5618. */
  5619. __STATIC_INLINE void LL_TIM_DisableIT_IERR(TIM_TypeDef *TIMx)
  5620. {
  5621. CLEAR_BIT(TIMx->DIER, TIM_DIER_IERRIE);
  5622. }
  5623. /**
  5624. * @brief Indicates whether the index error interrupt (IERRIE) is enabled.
  5625. * @note Macro IS_TIM_ENCODER_ERROR_INSTANCE(TIMx) can be used to check whether or not
  5626. * a timer instance provides encoder error management.
  5627. * @rmtoll DIER IERRIE LL_TIM_IsEnabledIT_IERR
  5628. * @param TIMx Timer instance
  5629. * @retval State of bit (1 or 0).
  5630. */
  5631. __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_IERR(const TIM_TypeDef *TIMx)
  5632. {
  5633. return ((READ_BIT(TIMx->DIER, TIM_DIER_IERRIE) == (TIM_DIER_IERRIE)) ? 1UL : 0UL);
  5634. }
  5635. /**
  5636. * @brief Enable direction change interrupt (DIRIE).
  5637. * @note Macro IS_TIM_FUNCTINONAL_ENCODER_INTERRUPT_INSTANCE(TIMx) can be used to check whether or not
  5638. * a timer instance provides encoder interrupt management.
  5639. * @rmtoll DIER DIRIE LL_TIM_EnableIT_DIR
  5640. * @param TIMx Timer instance
  5641. * @retval None
  5642. */
  5643. __STATIC_INLINE void LL_TIM_EnableIT_DIR(TIM_TypeDef *TIMx)
  5644. {
  5645. SET_BIT(TIMx->DIER, TIM_DIER_DIRIE);
  5646. }
  5647. /**
  5648. * @brief Disable direction change interrupt (DIRIE).
  5649. * @note Macro IS_TIM_FUNCTINONAL_ENCODER_INTERRUPT_INSTANCE(TIMx) can be used to check whether or not
  5650. * a timer instance provides encoder interrupt management.
  5651. * @rmtoll DIER DIRIE LL_TIM_DisableIT_DIR
  5652. * @param TIMx Timer instance
  5653. * @retval None
  5654. */
  5655. __STATIC_INLINE void LL_TIM_DisableIT_DIR(TIM_TypeDef *TIMx)
  5656. {
  5657. CLEAR_BIT(TIMx->DIER, TIM_DIER_DIRIE);
  5658. }
  5659. /**
  5660. * @brief Indicates whether the direction change interrupt (DIRIE) is enabled.
  5661. * @note Macro IS_TIM_FUNCTINONAL_ENCODER_INTERRUPT_INSTANCE(TIMx) can be used to check whether or not
  5662. * a timer instance provides encoder interrupt management.
  5663. * @rmtoll DIER DIRIE LL_TIM_IsEnabledIT_DIR
  5664. * @param TIMx Timer instance
  5665. * @retval State of bit (1 or 0).
  5666. */
  5667. __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_DIR(const TIM_TypeDef *TIMx)
  5668. {
  5669. return ((READ_BIT(TIMx->DIER, TIM_DIER_DIRIE) == (TIM_DIER_DIRIE)) ? 1UL : 0UL);
  5670. }
  5671. /**
  5672. * @brief Enable index interrupt (IDXIE).
  5673. * @note Macro IS_TIM_FUNCTINONAL_ENCODER_INTERRUPT_INSTANCE(TIMx) can be used to check whether or not
  5674. * a timer instance provides encoder interrupt management.
  5675. * @rmtoll DIER IDXIE LL_TIM_EnableIT_IDX
  5676. * @param TIMx Timer instance
  5677. * @retval None
  5678. */
  5679. __STATIC_INLINE void LL_TIM_EnableIT_IDX(TIM_TypeDef *TIMx)
  5680. {
  5681. SET_BIT(TIMx->DIER, TIM_DIER_IDXIE);
  5682. }
  5683. /**
  5684. * @brief Disable index interrupt (IDXIE).
  5685. * @note Macro IS_TIM_FUNCTINONAL_ENCODER_INTERRUPT_INSTANCE(TIMx) can be used to check whether or not
  5686. * a timer instance provides encoder interrupt management.
  5687. * @rmtoll DIER IDXIE LL_TIM_DisableIT_IDX
  5688. * @param TIMx Timer instance
  5689. * @retval None
  5690. */
  5691. __STATIC_INLINE void LL_TIM_DisableIT_IDX(TIM_TypeDef *TIMx)
  5692. {
  5693. CLEAR_BIT(TIMx->DIER, TIM_DIER_IDXIE);
  5694. }
  5695. /**
  5696. * @brief Indicates whether the index interrupt (IDXIE) is enabled.
  5697. * @note Macro IS_TIM_FUNCTINONAL_ENCODER_INTERRUPT_INSTANCE(TIMx) can be used to check whether or not
  5698. * a timer instance provides encoder interrupt management.
  5699. * @rmtoll DIER IDXIE LL_TIM_IsEnabledIT_IDX
  5700. * @param TIMx Timer instance
  5701. * @retval State of bit (1 or 0).
  5702. */
  5703. __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_IDX(const TIM_TypeDef *TIMx)
  5704. {
  5705. return ((READ_BIT(TIMx->DIER, TIM_DIER_IDXIE) == (TIM_DIER_IDXIE)) ? 1UL : 0UL);
  5706. }
  5707. /**
  5708. * @}
  5709. */
  5710. /** @defgroup TIM_LL_EF_DMA_Management DMA Management
  5711. * @{
  5712. */
  5713. /**
  5714. * @brief Enable update DMA request (UDE).
  5715. * @rmtoll DIER UDE LL_TIM_EnableDMAReq_UPDATE
  5716. * @param TIMx Timer instance
  5717. * @retval None
  5718. */
  5719. __STATIC_INLINE void LL_TIM_EnableDMAReq_UPDATE(TIM_TypeDef *TIMx)
  5720. {
  5721. SET_BIT(TIMx->DIER, TIM_DIER_UDE);
  5722. }
  5723. /**
  5724. * @brief Disable update DMA request (UDE).
  5725. * @rmtoll DIER UDE LL_TIM_DisableDMAReq_UPDATE
  5726. * @param TIMx Timer instance
  5727. * @retval None
  5728. */
  5729. __STATIC_INLINE void LL_TIM_DisableDMAReq_UPDATE(TIM_TypeDef *TIMx)
  5730. {
  5731. CLEAR_BIT(TIMx->DIER, TIM_DIER_UDE);
  5732. }
  5733. /**
  5734. * @brief Indicates whether the update DMA request (UDE) is enabled.
  5735. * @rmtoll DIER UDE LL_TIM_IsEnabledDMAReq_UPDATE
  5736. * @param TIMx Timer instance
  5737. * @retval State of bit (1 or 0).
  5738. */
  5739. __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_UPDATE(const TIM_TypeDef *TIMx)
  5740. {
  5741. return ((READ_BIT(TIMx->DIER, TIM_DIER_UDE) == (TIM_DIER_UDE)) ? 1UL : 0UL);
  5742. }
  5743. /**
  5744. * @brief Enable capture/compare 1 DMA request (CC1DE).
  5745. * @rmtoll DIER CC1DE LL_TIM_EnableDMAReq_CC1
  5746. * @param TIMx Timer instance
  5747. * @retval None
  5748. */
  5749. __STATIC_INLINE void LL_TIM_EnableDMAReq_CC1(TIM_TypeDef *TIMx)
  5750. {
  5751. SET_BIT(TIMx->DIER, TIM_DIER_CC1DE);
  5752. }
  5753. /**
  5754. * @brief Disable capture/compare 1 DMA request (CC1DE).
  5755. * @rmtoll DIER CC1DE LL_TIM_DisableDMAReq_CC1
  5756. * @param TIMx Timer instance
  5757. * @retval None
  5758. */
  5759. __STATIC_INLINE void LL_TIM_DisableDMAReq_CC1(TIM_TypeDef *TIMx)
  5760. {
  5761. CLEAR_BIT(TIMx->DIER, TIM_DIER_CC1DE);
  5762. }
  5763. /**
  5764. * @brief Indicates whether the capture/compare 1 DMA request (CC1DE) is enabled.
  5765. * @rmtoll DIER CC1DE LL_TIM_IsEnabledDMAReq_CC1
  5766. * @param TIMx Timer instance
  5767. * @retval State of bit (1 or 0).
  5768. */
  5769. __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC1(const TIM_TypeDef *TIMx)
  5770. {
  5771. return ((READ_BIT(TIMx->DIER, TIM_DIER_CC1DE) == (TIM_DIER_CC1DE)) ? 1UL : 0UL);
  5772. }
  5773. /**
  5774. * @brief Enable capture/compare 2 DMA request (CC2DE).
  5775. * @rmtoll DIER CC2DE LL_TIM_EnableDMAReq_CC2
  5776. * @param TIMx Timer instance
  5777. * @retval None
  5778. */
  5779. __STATIC_INLINE void LL_TIM_EnableDMAReq_CC2(TIM_TypeDef *TIMx)
  5780. {
  5781. SET_BIT(TIMx->DIER, TIM_DIER_CC2DE);
  5782. }
  5783. /**
  5784. * @brief Disable capture/compare 2 DMA request (CC2DE).
  5785. * @rmtoll DIER CC2DE LL_TIM_DisableDMAReq_CC2
  5786. * @param TIMx Timer instance
  5787. * @retval None
  5788. */
  5789. __STATIC_INLINE void LL_TIM_DisableDMAReq_CC2(TIM_TypeDef *TIMx)
  5790. {
  5791. CLEAR_BIT(TIMx->DIER, TIM_DIER_CC2DE);
  5792. }
  5793. /**
  5794. * @brief Indicates whether the capture/compare 2 DMA request (CC2DE) is enabled.
  5795. * @rmtoll DIER CC2DE LL_TIM_IsEnabledDMAReq_CC2
  5796. * @param TIMx Timer instance
  5797. * @retval State of bit (1 or 0).
  5798. */
  5799. __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC2(const TIM_TypeDef *TIMx)
  5800. {
  5801. return ((READ_BIT(TIMx->DIER, TIM_DIER_CC2DE) == (TIM_DIER_CC2DE)) ? 1UL : 0UL);
  5802. }
  5803. /**
  5804. * @brief Enable capture/compare 3 DMA request (CC3DE).
  5805. * @rmtoll DIER CC3DE LL_TIM_EnableDMAReq_CC3
  5806. * @param TIMx Timer instance
  5807. * @retval None
  5808. */
  5809. __STATIC_INLINE void LL_TIM_EnableDMAReq_CC3(TIM_TypeDef *TIMx)
  5810. {
  5811. SET_BIT(TIMx->DIER, TIM_DIER_CC3DE);
  5812. }
  5813. /**
  5814. * @brief Disable capture/compare 3 DMA request (CC3DE).
  5815. * @rmtoll DIER CC3DE LL_TIM_DisableDMAReq_CC3
  5816. * @param TIMx Timer instance
  5817. * @retval None
  5818. */
  5819. __STATIC_INLINE void LL_TIM_DisableDMAReq_CC3(TIM_TypeDef *TIMx)
  5820. {
  5821. CLEAR_BIT(TIMx->DIER, TIM_DIER_CC3DE);
  5822. }
  5823. /**
  5824. * @brief Indicates whether the capture/compare 3 DMA request (CC3DE) is enabled.
  5825. * @rmtoll DIER CC3DE LL_TIM_IsEnabledDMAReq_CC3
  5826. * @param TIMx Timer instance
  5827. * @retval State of bit (1 or 0).
  5828. */
  5829. __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC3(const TIM_TypeDef *TIMx)
  5830. {
  5831. return ((READ_BIT(TIMx->DIER, TIM_DIER_CC3DE) == (TIM_DIER_CC3DE)) ? 1UL : 0UL);
  5832. }
  5833. /**
  5834. * @brief Enable capture/compare 4 DMA request (CC4DE).
  5835. * @rmtoll DIER CC4DE LL_TIM_EnableDMAReq_CC4
  5836. * @param TIMx Timer instance
  5837. * @retval None
  5838. */
  5839. __STATIC_INLINE void LL_TIM_EnableDMAReq_CC4(TIM_TypeDef *TIMx)
  5840. {
  5841. SET_BIT(TIMx->DIER, TIM_DIER_CC4DE);
  5842. }
  5843. /**
  5844. * @brief Disable capture/compare 4 DMA request (CC4DE).
  5845. * @rmtoll DIER CC4DE LL_TIM_DisableDMAReq_CC4
  5846. * @param TIMx Timer instance
  5847. * @retval None
  5848. */
  5849. __STATIC_INLINE void LL_TIM_DisableDMAReq_CC4(TIM_TypeDef *TIMx)
  5850. {
  5851. CLEAR_BIT(TIMx->DIER, TIM_DIER_CC4DE);
  5852. }
  5853. /**
  5854. * @brief Indicates whether the capture/compare 4 DMA request (CC4DE) is enabled.
  5855. * @rmtoll DIER CC4DE LL_TIM_IsEnabledDMAReq_CC4
  5856. * @param TIMx Timer instance
  5857. * @retval State of bit (1 or 0).
  5858. */
  5859. __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_CC4(const TIM_TypeDef *TIMx)
  5860. {
  5861. return ((READ_BIT(TIMx->DIER, TIM_DIER_CC4DE) == (TIM_DIER_CC4DE)) ? 1UL : 0UL);
  5862. }
  5863. /**
  5864. * @brief Enable commutation DMA request (COMDE).
  5865. * @rmtoll DIER COMDE LL_TIM_EnableDMAReq_COM
  5866. * @param TIMx Timer instance
  5867. * @retval None
  5868. */
  5869. __STATIC_INLINE void LL_TIM_EnableDMAReq_COM(TIM_TypeDef *TIMx)
  5870. {
  5871. SET_BIT(TIMx->DIER, TIM_DIER_COMDE);
  5872. }
  5873. /**
  5874. * @brief Disable commutation DMA request (COMDE).
  5875. * @rmtoll DIER COMDE LL_TIM_DisableDMAReq_COM
  5876. * @param TIMx Timer instance
  5877. * @retval None
  5878. */
  5879. __STATIC_INLINE void LL_TIM_DisableDMAReq_COM(TIM_TypeDef *TIMx)
  5880. {
  5881. CLEAR_BIT(TIMx->DIER, TIM_DIER_COMDE);
  5882. }
  5883. /**
  5884. * @brief Indicates whether the commutation DMA request (COMDE) is enabled.
  5885. * @rmtoll DIER COMDE LL_TIM_IsEnabledDMAReq_COM
  5886. * @param TIMx Timer instance
  5887. * @retval State of bit (1 or 0).
  5888. */
  5889. __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_COM(const TIM_TypeDef *TIMx)
  5890. {
  5891. return ((READ_BIT(TIMx->DIER, TIM_DIER_COMDE) == (TIM_DIER_COMDE)) ? 1UL : 0UL);
  5892. }
  5893. /**
  5894. * @brief Enable trigger interrupt (TDE).
  5895. * @rmtoll DIER TDE LL_TIM_EnableDMAReq_TRIG
  5896. * @param TIMx Timer instance
  5897. * @retval None
  5898. */
  5899. __STATIC_INLINE void LL_TIM_EnableDMAReq_TRIG(TIM_TypeDef *TIMx)
  5900. {
  5901. SET_BIT(TIMx->DIER, TIM_DIER_TDE);
  5902. }
  5903. /**
  5904. * @brief Disable trigger interrupt (TDE).
  5905. * @rmtoll DIER TDE LL_TIM_DisableDMAReq_TRIG
  5906. * @param TIMx Timer instance
  5907. * @retval None
  5908. */
  5909. __STATIC_INLINE void LL_TIM_DisableDMAReq_TRIG(TIM_TypeDef *TIMx)
  5910. {
  5911. CLEAR_BIT(TIMx->DIER, TIM_DIER_TDE);
  5912. }
  5913. /**
  5914. * @brief Indicates whether the trigger interrupt (TDE) is enabled.
  5915. * @rmtoll DIER TDE LL_TIM_IsEnabledDMAReq_TRIG
  5916. * @param TIMx Timer instance
  5917. * @retval State of bit (1 or 0).
  5918. */
  5919. __STATIC_INLINE uint32_t LL_TIM_IsEnabledDMAReq_TRIG(const TIM_TypeDef *TIMx)
  5920. {
  5921. return ((READ_BIT(TIMx->DIER, TIM_DIER_TDE) == (TIM_DIER_TDE)) ? 1UL : 0UL);
  5922. }
  5923. /**
  5924. * @}
  5925. */
  5926. /** @defgroup TIM_LL_EF_EVENT_Management EVENT-Management
  5927. * @{
  5928. */
  5929. /**
  5930. * @brief Generate an update event.
  5931. * @rmtoll EGR UG LL_TIM_GenerateEvent_UPDATE
  5932. * @param TIMx Timer instance
  5933. * @retval None
  5934. */
  5935. __STATIC_INLINE void LL_TIM_GenerateEvent_UPDATE(TIM_TypeDef *TIMx)
  5936. {
  5937. SET_BIT(TIMx->EGR, TIM_EGR_UG);
  5938. }
  5939. /**
  5940. * @brief Generate Capture/Compare 1 event.
  5941. * @rmtoll EGR CC1G LL_TIM_GenerateEvent_CC1
  5942. * @param TIMx Timer instance
  5943. * @retval None
  5944. */
  5945. __STATIC_INLINE void LL_TIM_GenerateEvent_CC1(TIM_TypeDef *TIMx)
  5946. {
  5947. SET_BIT(TIMx->EGR, TIM_EGR_CC1G);
  5948. }
  5949. /**
  5950. * @brief Generate Capture/Compare 2 event.
  5951. * @rmtoll EGR CC2G LL_TIM_GenerateEvent_CC2
  5952. * @param TIMx Timer instance
  5953. * @retval None
  5954. */
  5955. __STATIC_INLINE void LL_TIM_GenerateEvent_CC2(TIM_TypeDef *TIMx)
  5956. {
  5957. SET_BIT(TIMx->EGR, TIM_EGR_CC2G);
  5958. }
  5959. /**
  5960. * @brief Generate Capture/Compare 3 event.
  5961. * @rmtoll EGR CC3G LL_TIM_GenerateEvent_CC3
  5962. * @param TIMx Timer instance
  5963. * @retval None
  5964. */
  5965. __STATIC_INLINE void LL_TIM_GenerateEvent_CC3(TIM_TypeDef *TIMx)
  5966. {
  5967. SET_BIT(TIMx->EGR, TIM_EGR_CC3G);
  5968. }
  5969. /**
  5970. * @brief Generate Capture/Compare 4 event.
  5971. * @rmtoll EGR CC4G LL_TIM_GenerateEvent_CC4
  5972. * @param TIMx Timer instance
  5973. * @retval None
  5974. */
  5975. __STATIC_INLINE void LL_TIM_GenerateEvent_CC4(TIM_TypeDef *TIMx)
  5976. {
  5977. SET_BIT(TIMx->EGR, TIM_EGR_CC4G);
  5978. }
  5979. /**
  5980. * @brief Generate commutation event.
  5981. * @rmtoll EGR COMG LL_TIM_GenerateEvent_COM
  5982. * @param TIMx Timer instance
  5983. * @retval None
  5984. */
  5985. __STATIC_INLINE void LL_TIM_GenerateEvent_COM(TIM_TypeDef *TIMx)
  5986. {
  5987. SET_BIT(TIMx->EGR, TIM_EGR_COMG);
  5988. }
  5989. /**
  5990. * @brief Generate trigger event.
  5991. * @rmtoll EGR TG LL_TIM_GenerateEvent_TRIG
  5992. * @param TIMx Timer instance
  5993. * @retval None
  5994. */
  5995. __STATIC_INLINE void LL_TIM_GenerateEvent_TRIG(TIM_TypeDef *TIMx)
  5996. {
  5997. SET_BIT(TIMx->EGR, TIM_EGR_TG);
  5998. }
  5999. /**
  6000. * @brief Generate break event.
  6001. * @rmtoll EGR BG LL_TIM_GenerateEvent_BRK
  6002. * @param TIMx Timer instance
  6003. * @retval None
  6004. */
  6005. __STATIC_INLINE void LL_TIM_GenerateEvent_BRK(TIM_TypeDef *TIMx)
  6006. {
  6007. SET_BIT(TIMx->EGR, TIM_EGR_BG);
  6008. }
  6009. /**
  6010. * @brief Generate break 2 event.
  6011. * @rmtoll EGR B2G LL_TIM_GenerateEvent_BRK2
  6012. * @param TIMx Timer instance
  6013. * @retval None
  6014. */
  6015. __STATIC_INLINE void LL_TIM_GenerateEvent_BRK2(TIM_TypeDef *TIMx)
  6016. {
  6017. SET_BIT(TIMx->EGR, TIM_EGR_B2G);
  6018. }
  6019. /**
  6020. * @}
  6021. */
  6022. #if defined(USE_FULL_LL_DRIVER)
  6023. /** @defgroup TIM_LL_EF_Init Initialisation and deinitialisation functions
  6024. * @{
  6025. */
  6026. ErrorStatus LL_TIM_DeInit(const TIM_TypeDef *TIMx);
  6027. void LL_TIM_StructInit(LL_TIM_InitTypeDef *TIM_InitStruct);
  6028. ErrorStatus LL_TIM_Init(TIM_TypeDef *TIMx, const LL_TIM_InitTypeDef *TIM_InitStruct);
  6029. void LL_TIM_OC_StructInit(LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct);
  6030. ErrorStatus LL_TIM_OC_Init(TIM_TypeDef *TIMx, uint32_t Channel, const LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct);
  6031. void LL_TIM_IC_StructInit(LL_TIM_IC_InitTypeDef *TIM_ICInitStruct);
  6032. ErrorStatus LL_TIM_IC_Init(TIM_TypeDef *TIMx, uint32_t Channel, const LL_TIM_IC_InitTypeDef *TIM_IC_InitStruct);
  6033. void LL_TIM_ENCODER_StructInit(LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct);
  6034. ErrorStatus LL_TIM_ENCODER_Init(TIM_TypeDef *TIMx, const LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct);
  6035. void LL_TIM_HALLSENSOR_StructInit(LL_TIM_HALLSENSOR_InitTypeDef *TIM_HallSensorInitStruct);
  6036. ErrorStatus LL_TIM_HALLSENSOR_Init(TIM_TypeDef *TIMx, const LL_TIM_HALLSENSOR_InitTypeDef *TIM_HallSensorInitStruct);
  6037. void LL_TIM_BDTR_StructInit(LL_TIM_BDTR_InitTypeDef *TIM_BDTRInitStruct);
  6038. ErrorStatus LL_TIM_BDTR_Init(TIM_TypeDef *TIMx, const LL_TIM_BDTR_InitTypeDef *TIM_BDTRInitStruct);
  6039. /**
  6040. * @}
  6041. */
  6042. #endif /* USE_FULL_LL_DRIVER */
  6043. /**
  6044. * @}
  6045. */
  6046. /**
  6047. * @}
  6048. */
  6049. #endif /* TIM1 || TIM2 || TIM3 || TIM4 || TIM5 || TIM6 || TIM7 || TIM8 || TIM12 || TIM13 || TIM14 || TIM15 || TIM16 || TIM17 */
  6050. /**
  6051. * @}
  6052. */
  6053. #ifdef __cplusplus
  6054. }
  6055. #endif
  6056. #endif /* __STM32H5xx_LL_TIM_H */