bmi160.h 399 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802
  1. /** \mainpage
  2. *
  3. ****************************************************************************
  4. * Copyright (C) 2016 Bosch Sensortec GmbH
  5. *
  6. * File : bmi160.h
  7. *
  8. * Date : 2016/06/27
  9. *
  10. * Revision : 2.2.1 $
  11. *
  12. * Usage: Sensor Driver for BMI160 sensor
  13. *
  14. ****************************************************************************
  15. *
  16. * \section License
  17. *
  18. * Redistribution and use in source and binary forms, with or without
  19. * modification, are permitted provided that the following conditions are met:
  20. *
  21. * Redistributions of source code must retain the above copyright
  22. * notice, this list of conditions and the following disclaimer.
  23. *
  24. * Redistributions in binary form must reproduce the above copyright
  25. * notice, this list of conditions and the following disclaimer in the
  26. * documentation and/or other materials provided with the distribution.
  27. *
  28. * Neither the name of the copyright holder nor the names of the
  29. * contributors may be used to endorse or promote products derived from
  30. * this software without specific prior written permission.
  31. *
  32. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
  33. * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  34. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  35. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  36. * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
  37. * OR CONTRIBUTORS BE LIABLE FOR ANY
  38. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
  39. * OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,
  40. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  41. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  42. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  43. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  44. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  45. * ANY WAY OUT OF THE USE OF THIS
  46. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
  47. *
  48. * The information provided is believed to be accurate and reliable.
  49. * The copyright holder assumes no responsibility
  50. * for the consequences of use
  51. * of such information nor for any infringement of patents or
  52. * other rights of third parties which may result from its use.
  53. * No license is granted by implication or otherwise under any patent or
  54. * patent rights of the copyright holder.
  55. **************************************************************************/
  56. /*! \file bmi160.h
  57. \brief BMI160 Sensor Driver Support Header File */
  58. /* user defined code to be added here ... */
  59. #ifndef __BMI160_H__
  60. #define __BMI160_H__
  61. /*!
  62. * @brief The following definition is used to define the data types
  63. *
  64. * @note While porting the API please consider the following
  65. * @note Please check the version of C standard
  66. * @note Are you using Linux platform
  67. */
  68. /*!
  69. * @brief For the Linux platform support
  70. * Please use the types.h for your data types definitions
  71. */
  72. #ifdef __KERNEL__
  73. #include <linux/types.h>
  74. /* singed integer type*/
  75. typedef int8_t s8;/**< used for signed 8bit */
  76. typedef int16_t s16;/**< used for signed 16bit */
  77. typedef int32_t s32;/**< used for signed 32bit */
  78. typedef int64_t s64;/**< used for signed 64bit */
  79. typedef u_int8_t u8;/**< used for unsigned 8bit */
  80. typedef u_int16_t u16;/**< used for unsigned 16bit */
  81. typedef u_int32_t u32;/**< used for unsigned 32bit */
  82. typedef u_int64_t u64;/**< used for unsigned 64bit */
  83. #else /* ! __KERNEL__ */
  84. /**********************************************************
  85. * below definitions are used to define the C
  86. * standard version data types
  87. ***********************************************************/
  88. # if !defined(__STDC_VERSION__)
  89. /************************************************
  90. * compiler is C11 C standard
  91. ************************************************/
  92. #if (__STDC_VERSION__ == 201112L)
  93. /************************************************/
  94. #include <stdint.h>
  95. /************************************************/
  96. /*unsigned integer types*/
  97. typedef uint8_t u8;/**< used for unsigned 8bit */
  98. typedef uint16_t u16;/**< used for unsigned 16bit */
  99. typedef uint32_t u32;/**< used for unsigned 32bit */
  100. typedef uint64_t u64;/**< used for unsigned 64bit */
  101. /*signed integer types*/
  102. typedef int8_t s8;/**< used for signed 8bit */
  103. typedef int16_t s16;/**< used for signed 16bit */
  104. typedef int32_t s32;/**< used for signed 32bit */
  105. typedef int64_t s64;/**< used for signed 64bit */
  106. /************************************************
  107. * compiler is C99 C standard
  108. ************************************************/
  109. #elif (__STDC_VERSION__ == 199901L)
  110. /* stdint.h is a C99 supported c library.
  111. which is used to fix the integer size*/
  112. /************************************************/
  113. #include <stdint.h>
  114. /************************************************/
  115. /*unsigned integer types*/
  116. typedef uint8_t u8;/**< used for unsigned 8bit */
  117. typedef uint16_t u16;/**< used for unsigned 16bit */
  118. typedef uint32_t u32;/**< used for unsigned 32bit */
  119. typedef uint64_t u64;/**< used for unsigned 64bit */
  120. /*signed integer types*/
  121. typedef int8_t s8;/**< used for signed 8bit */
  122. typedef int16_t s16;/**< used for signed 16bit */
  123. typedef int32_t s32;/**< used for signed 32bit */
  124. typedef int64_t s64;/**< used for signed 64bit */
  125. /************************************************
  126. * compiler is C89 or other C standard
  127. ************************************************/
  128. #else /* !defined(__STDC_VERSION__) */
  129. /*!
  130. * @brief By default it is defined as 32 bit machine configuration
  131. * define your data types based on your
  132. * machine/compiler/controller configuration
  133. */
  134. #define MACHINE_32_BIT
  135. /*! @brief
  136. * If your machine support 16 bit
  137. * define the MACHINE_16_BIT
  138. */
  139. #ifdef MACHINE_16_BIT
  140. #include <limits.h>
  141. /*signed integer types*/
  142. typedef signed char s8;/**< used for signed 8bit */
  143. typedef signed short int s16;/**< used for signed 16bit */
  144. typedef signed long int s32;/**< used for signed 32bit */
  145. #if defined(LONG_MAX) && LONG_MAX == 0x7fffffffffffffffL
  146. typedef long int s64;/**< used for signed 64bit */
  147. typedef unsigned long int u64;/**< used for unsigned 64bit */
  148. #elif defined(LLONG_MAX) && (LLONG_MAX == 0x7fffffffffffffffLL)
  149. typedef long long int s64;/**< used for signed 64bit */
  150. typedef unsigned long long int u64;/**< used for unsigned 64bit */
  151. #else
  152. #warning Either the correct data type for signed 64 bit integer \
  153. could not be found, or 64 bit integers are not supported in your environment.
  154. #warning If 64 bit integers are supported on your platform, \
  155. please set s64 manually.
  156. #endif
  157. /*unsigned integer types*/
  158. typedef unsigned char u8;/**< used for unsigned 8bit */
  159. typedef unsigned short int u16;/**< used for unsigned 16bit */
  160. typedef unsigned long int u32;/**< used for unsigned 32bit */
  161. /* If your machine support 32 bit
  162. define the MACHINE_32_BIT*/
  163. #elif defined MACHINE_32_BIT
  164. /*signed integer types*/
  165. typedef signed char s8;/**< used for signed 8bit */
  166. typedef signed short int s16;/**< used for signed 16bit */
  167. typedef signed int s32;/**< used for signed 32bit */
  168. typedef signed long long int s64;/**< used for signed 64bit */
  169. /*unsigned integer types*/
  170. typedef unsigned char u8;/**< used for unsigned 8bit */
  171. typedef unsigned short int u16;/**< used for unsigned 16bit */
  172. typedef unsigned int u32;/**< used for unsigned 32bit */
  173. typedef unsigned long long int u64;/**< used for unsigned 64bit */
  174. /* If your machine support 64 bit
  175. define the MACHINE_64_BIT*/
  176. #elif defined MACHINE_64_BIT
  177. /*signed integer types*/
  178. typedef signed char s8;/**< used for signed 8bit */
  179. typedef signed short int s16;/**< used for signed 16bit */
  180. typedef signed int s32;/**< used for signed 32bit */
  181. typedef signed long int s64;/**< used for signed 64bit */
  182. /*unsigned integer types*/
  183. typedef unsigned char u8;/**< used for unsigned 8bit */
  184. typedef unsigned short int u16;/**< used for unsigned 16bit */
  185. typedef unsigned int u32;/**< used for unsigned 32bit */
  186. typedef unsigned long int u64;/**< used for unsigned 64bit */
  187. #else
  188. #warning The data types defined above which not supported \
  189. define the data types manually
  190. #endif
  191. #endif
  192. /* This else part will be executed for the compilers
  193. which does not support the C89/C99/C11 standards ***/
  194. #else
  195. /*!
  196. * @brief By default it is defined as 32 bit machine configuration
  197. * define your data types based on your
  198. * machine/compiler/controller configuration
  199. */
  200. #define MACHINE_32_BIT
  201. /* If your machine support 16 bit
  202. define the MACHINE_16_BIT*/
  203. #ifdef MACHINE_16_BIT
  204. #include <limits.h>
  205. /*signed integer types*/
  206. typedef signed char s8;/**< used for signed 8bit */
  207. typedef signed short int s16;/**< used for signed 16bit */
  208. typedef signed long int s32;/**< used for signed 32bit */
  209. #if defined(LONG_MAX) && LONG_MAX == 0x7fffffffffffffffL
  210. typedef long int s64;/**< used for signed 64bit */
  211. typedef unsigned long int u64;/**< used for unsigned 64bit */
  212. #elif defined(LLONG_MAX) && (LLONG_MAX == 0x7fffffffffffffffLL)
  213. typedef long long int s64;/**< used for signed 64bit */
  214. typedef unsigned long long int u64;/**< used for unsigned 64bit */
  215. #else
  216. #warning Either the correct data type for signed 64 bit integer \
  217. could not be found, or 64 bit integers are not supported in your environment.
  218. #warning If 64 bit integers are supported on your platform, \
  219. please set s64 manually.
  220. #endif
  221. /*unsigned integer types*/
  222. typedef unsigned char u8;/**< used for unsigned 8bit */
  223. typedef unsigned short int u16;/**< used for unsigned 16bit */
  224. typedef unsigned long int u32;/**< used for unsigned 32bit */
  225. /*! @brief If your machine support 32 bit
  226. define the MACHINE_32_BIT*/
  227. #elif defined MACHINE_32_BIT
  228. /*signed integer types*/
  229. typedef signed char s8;/**< used for signed 8bit */
  230. typedef signed short int s16;/**< used for signed 16bit */
  231. typedef signed int s32;/**< used for signed 32bit */
  232. typedef signed long long int s64;/**< used for signed 64bit */
  233. /*unsigned integer types*/
  234. typedef unsigned char u8;/**< used for unsigned 8bit */
  235. typedef unsigned short int u16;/**< used for unsigned 16bit */
  236. typedef unsigned int u32;/**< used for unsigned 32bit */
  237. typedef unsigned long long int u64;/**< used for unsigned 64bit */
  238. /* If your machine support 64 bit
  239. define the MACHINE_64_BIT*/
  240. #elif defined MACHINE_64_BIT
  241. /*signed integer types*/
  242. typedef signed char s8;/**< used for signed 8bit */
  243. typedef signed short int s16;/**< used for signed 16bit */
  244. typedef signed int s32;/**< used for signed 32bit */
  245. typedef signed long int s64;/**< used for signed 64bit */
  246. /*unsigned integer types*/
  247. typedef unsigned char u8;/**< used for unsigned 8bit */
  248. typedef unsigned short int u16;/**< used for unsigned 16bit */
  249. typedef unsigned int u32;/**< used for unsigned 32bit */
  250. typedef unsigned long int u64;/**< used for unsigned 64bit */
  251. #else
  252. #warning If the data types defined above are not supported \
  253. then define the data types manually
  254. #endif
  255. #endif
  256. #endif
  257. /***************************************************************/
  258. /**\name BUS READ AND WRITE FUNCTION POINTERS */
  259. /***************************************************************/
  260. /*!
  261. @brief Define the calling convention of your bus communication routine.
  262. @note This includes types of parameters. This example shows the
  263. configuration for an SPI bus link.
  264. If your communication function looks like this:
  265. write_my_bus_xy(u8 device_addr, u8 register_addr,
  266. u8 * data, u8 length);
  267. The BMI160_WR_FUNC_PTR would equal:
  268. BMI160_WR_FUNC_PTR s8 (* bus_write)(u8,
  269. u8, u8 *, u8)
  270. Parameters can be mixed as needed refer to the
  271. @ref BMI160_BUS_WRITE_FUNC macro.
  272. */
  273. #define BMI160_WR_FUNC_PTR s8 (*bus_write)(u8, u8,\
  274. u8 *, u8)
  275. /**< link macro between API function calls and bus write function
  276. @note The bus write function can change since this is a
  277. system dependant issue.
  278. If the bus_write parameter calling order is like: reg_addr,
  279. reg_data, wr_len it would be as it is here.
  280. If the parameters are differently ordered or your communication
  281. function like I2C need to know the device address,
  282. you can change this macro accordingly.
  283. BMI160_BUS_WRITE_FUNC(dev_addr, reg_addr, reg_data, wr_len)\
  284. bus_write(dev_addr, reg_addr, reg_data, wr_len)
  285. This macro lets all API functions call your communication routine in a
  286. way that equals your definition in the
  287. @ref BMI160_WR_FUNC_PTR definition.
  288. */
  289. #define BMI160_BUS_WRITE_FUNC(dev_addr, reg_addr, reg_data, wr_len)\
  290. bus_write(dev_addr, reg_addr, reg_data, wr_len)
  291. /**< Define the calling convention of your bus communication routine.
  292. @note This includes types of parameters. This example shows the
  293. configuration for an SPI bus link.
  294. If your communication function looks like this:
  295. read_my_bus_xy(u8 device_addr, u8 register_addr,
  296. u8 * data, u8 length);
  297. The BMI160_RD_FUNC_PTR would equal:
  298. BMI160_RD_FUNC_PTR s8 (* bus_read)(u8,
  299. u8, u8 *, u8)
  300. Parameters can be mixed as needed refer to the
  301. refer BMI160_BUS_READ_FUNC macro.
  302. */
  303. #define BMI160_SPI_RD_MASK (0x80) /* for spi read transactions on SPI the
  304. MSB has to be set */
  305. #define BMI160_RD_FUNC_PTR s8 (*bus_read)(u8,\
  306. u8, u8 *, u8)
  307. #define BMI160_BRD_FUNC_PTR s8 \
  308. (*burst_read)(u8, u8, u8 *, u32)
  309. /**< link macro between API function calls and bus read function
  310. @note The bus write function can change since this is a
  311. system dependant issue.
  312. If the bus_read parameter calling order is like: reg_addr,
  313. reg_data, wr_len it would be as it is here.
  314. If the parameters are differently ordered or your communication
  315. function like I2C need to know the device address,
  316. you can change this macro accordingly.
  317. BMI160_BUS_READ_FUNC(dev_addr, reg_addr, reg_data, wr_len)\
  318. bus_read(dev_addr, reg_addr, reg_data, wr_len)
  319. This macro lets all API functions call your communication routine in a
  320. way that equals your definition in the
  321. refer BMI160_WR_FUNC_PTR definition.
  322. @note: this macro also includes the "MSB='1'
  323. for reading BMI160 addresses.
  324. */
  325. #define BMI160_BUS_READ_FUNC(dev_addr, reg_addr, reg_data, r_len)\
  326. bus_read(dev_addr, reg_addr, reg_data, r_len)
  327. #define BMI160_BURST_READ_FUNC(device_addr, \
  328. register_addr, register_data, rd_len)\
  329. burst_read(device_addr, register_addr, register_data, rd_len)
  330. /* enable the macro for FIFO functionalities when FIFO is used*/
  331. #define FIFO_ENABLE
  332. /* enable the macro of the secondary interface which is used */
  333. #define YAS537 /* used to select the secondary interface as YAS537 */
  334. #define YAS532 /* used to select the secondary interface as YAS532 */
  335. #define AKM09911 /* used to select the secondary interface as AKM09911 */
  336. #define AKM09912 /* used to select the secondary interface as AKM09912 */
  337. #define BMI160_MDELAY_DATA_TYPE u32
  338. /***************************************************************/
  339. /**\name BUS READ AND WRITE FUNCTION POINTERS */
  340. /***************************************************************/
  341. #define BMI160_I2C_ADDR1 (0x68)
  342. /**< I2C Address needs to be changed */
  343. #define BMI160_I2C_ADDR2 (0x69)
  344. /**< I2C Address needs to be changed */
  345. #define BMI160_AUX_BMM150_I2C_ADDRESS (0x10)
  346. /**< I2C address of BMM150*/
  347. #define BMI160_AUX_YAS532_I2C_ADDRESS (0x2E)
  348. /**< I2C address of YAS532*/
  349. #define BMI160_AUX_AKM09911_I2C_ADDR_1 (0x0C)
  350. /**< I2C address of AKM09911*/
  351. #define BMI160_AUX_AKM09911_I2C_ADDR_2 (0x0D)
  352. /**< I2C address of AKM09911*/
  353. #define BMI160_AUX_AKM09912_I2C_ADDR_1 (0x0C)
  354. /**< I2C address of AKM09912*/
  355. #define BMI160_AUX_AKM09912_I2C_ADDR_2 (0x0D)
  356. /**< I2C address of AKM09912*/
  357. #define BMI160_AUX_AKM09912_I2C_ADDR_3 (0x0E)
  358. /**< I2C address of AKM09912*/
  359. #define BMI160_AUX_AKM09912_I2C_ADDR_4 (0x0F)
  360. /**< I2C address of AKM09912*/
  361. /*******************************************/
  362. /**\name CONSTANTS */
  363. /******************************************/
  364. #define BMI160_INIT_VALUE (0)
  365. #define BMI160_ASSIGN_DATA (1)
  366. #define BMI160_GEN_READ_WRITE_DATA_LENGTH (1)
  367. #define BMI160_MAXIMUM_TIMEOUT (10)
  368. /* output data rate condition check*/
  369. #define BMI160_OUTPUT_DATA_RATE0 (0)
  370. #define BMI160_OUTPUT_DATA_RATE1 (1)
  371. #define BMI160_OUTPUT_DATA_RATE2 (2)
  372. #define BMI160_OUTPUT_DATA_RATE3 (3)
  373. #define BMI160_OUTPUT_DATA_RATE4 (4)
  374. #define BMI160_OUTPUT_DATA_RATE5 (5)
  375. #define BMI160_OUTPUT_DATA_RATE6 (14)
  376. #define BMI160_OUTPUT_DATA_RATE7 (15)
  377. /*unmap significant motion*/
  378. #define V_ANY_MOTION_INTR_STAT (4)
  379. #define V_ANY_MOTION_AXIS_STAT (7)
  380. /* Accel range check*/
  381. #define BMI160_ACCEL_RANGE0 (3)
  382. #define BMI160_ACCEL_RANGE1 (5)
  383. #define BMI160_ACCEL_RANGE3 (8)
  384. #define BMI160_ACCEL_RANGE4 (12)
  385. /* check the status of registers*/
  386. #define BMI160_FOC_STAT_HIGH (1)
  387. #define BMI160_SIG_MOTION_STAT_HIGH (1)
  388. #define BMI160_STEP_DET_STAT_HIGH (1)
  389. /*condition check for reading and writing data*/
  390. #define BMI160_MAX_VALUE_SIGNIFICANT_MOTION (1)
  391. #define BMI160_MAX_VALUE_FIFO_FILTER (1)
  392. #define BMI160_MAX_VALUE_FIFO_TIME (1)
  393. #define BMI160_MAX_VALUE_FIFO_INTR (1)
  394. #define BMI160_MAX_VALUE_FIFO_HEADER (1)
  395. #define BMI160_MAX_VALUE_FIFO_MAG (1)
  396. #define BMI160_MAX_VALUE_FIFO_ACCEL (1)
  397. #define BMI160_MAX_VALUE_FIFO_GYRO (1)
  398. #define BMI160_MAX_VALUE_SOURCE_INTR (1)
  399. #define BMI160_MAX_VALUE_LOW_G_MODE (1)
  400. #define BMI160_MAX_VALUE_NO_MOTION (1)
  401. #define BMI160_MAX_VALUE_TAP_SHOCK (1)
  402. #define BMI160_MAX_VALUE_TAP_QUIET (1)
  403. #define BMI160_MAX_VALUE_ORIENT_UD (1)
  404. #define BMI160_MAX_VALUE_ORIENT_AXES (1)
  405. #define BMI160_MAX_VALUE_SPI3 (1)
  406. #define BMI160_MAX_VALUE_I2C_WDT (1)
  407. #define BMI160_MAX_VALUE_SLEEP_STATE (1)
  408. #define BMI160_MAX_VALUE_WAKEUP_INTR (1)
  409. #define BMI160_MAX_VALUE_SELFTEST_SIGN (1)
  410. #define BMI160_MAX_VALUE_SELFTEST_AMP (1)
  411. #define BMI160_MAX_VALUE_SELFTEST_START (1)
  412. #define BMI160_MAX_GYRO_WAKEUP_TRIGGER (3)
  413. #define BMI160_MAX_ACCEL_SELFTEST_AXIS (3)
  414. #define BMI160_MAX_GYRO_STEP_COUNTER (1)
  415. #define BMI160_MAX_GYRO_BW (3)
  416. #define BMI160_MAX_ACCEL_BW (7)
  417. #define BMI160_MAX_ORIENT_MODE (3)
  418. #define BMI160_MAX_ORIENT_BLOCKING (3)
  419. #define BMI160_MAX_FLAT_HOLD (3)
  420. #define BMI160_MAX_ACCEL_FOC (3)
  421. #define BMI160_MAX_IF_MODE (3)
  422. #define BMI160_MAX_GYRO_RANGE (4)
  423. #define BMI160_MAX_GYRO_SLEEP_TRIGGER (7)
  424. #define BMI160_MAX_TAP_TURN (7)
  425. #define BMI160_MAX_UNDER_SAMPLING (1)
  426. #define BMI160_MAX_UNDER_SIG_MOTION (3)
  427. #define BMI160_MAX_ACCEL_OUTPUT_DATA_RATE (12)
  428. #define BMI160_MAX_LATCH_INTR (15)
  429. #define BMI160_MAX_FLAT_HYST (15)
  430. #define BMI160_MAX_ORIENT_THETA (63)
  431. #define BMI160_MAX_FLAT_THETA (63)
  432. #ifdef FIFO_ENABLE
  433. /* FIFO index definitions*/
  434. #define BMI160_FIFO_X_LSB_DATA (0)
  435. #define BMI160_FIFO_X_MSB_DATA (1)
  436. #define BMI160_FIFO_Y_LSB_DATA (2)
  437. #define BMI160_FIFO_Y_MSB_DATA (3)
  438. #define BMI160_FIFO_Z_LSB_DATA (4)
  439. #define BMI160_FIFO_Z_MSB_DATA (5)
  440. #define BMI160_FIFO_R_LSB_DATA (6)
  441. #define BMI160_FIFO_R_MSB_DATA (7)
  442. /* FIFO Gyro definition*/
  443. #define BMI160_GA_FIFO_G_X_LSB (0)
  444. #define BMI160_GA_FIFO_G_X_MSB (1)
  445. #define BMI160_GA_FIFO_G_Y_LSB (2)
  446. #define BMI160_GA_FIFO_G_Y_MSB (3)
  447. #define BMI160_GA_FIFO_G_Z_LSB (4)
  448. #define BMI160_GA_FIFO_G_Z_MSB (5)
  449. #define BMI160_GA_FIFO_A_X_LSB (6)
  450. #define BMI160_GA_FIFO_A_X_MSB (7)
  451. #define BMI160_GA_FIFO_A_Y_LSB (8)
  452. #define BMI160_GA_FIFO_A_Y_MSB (9)
  453. #define BMI160_GA_FIFO_A_Z_LSB (10)
  454. #define BMI160_GA_FIFO_A_Z_MSB (11)
  455. /* FIFO mag/gyro/accel definition*/
  456. #define BMI160_MGA_FIFO_M_X_LSB (0)
  457. #define BMI160_MGA_FIFO_M_X_MSB (1)
  458. #define BMI160_MGA_FIFO_M_Y_LSB (2)
  459. #define BMI160_MGA_FIFO_M_Y_MSB (3)
  460. #define BMI160_MGA_FIFO_M_Z_LSB (4)
  461. #define BMI160_MGA_FIFO_M_Z_MSB (5)
  462. #define BMI160_MGA_FIFO_M_R_LSB (6)
  463. #define BMI160_MGA_FIFO_M_R_MSB (7)
  464. #define BMI160_MGA_FIFO_G_X_LSB (8)
  465. #define BMI160_MGA_FIFO_G_X_MSB (9)
  466. #define BMI160_MGA_FIFO_G_Y_LSB (10)
  467. #define BMI160_MGA_FIFO_G_Y_MSB (11)
  468. #define BMI160_MGA_FIFO_G_Z_LSB (12)
  469. #define BMI160_MGA_FIFO_G_Z_MSB (13)
  470. #define BMI160_MGA_FIFO_A_X_LSB (14)
  471. #define BMI160_MGA_FIFO_A_X_MSB (15)
  472. #define BMI160_MGA_FIFO_A_Y_LSB (16)
  473. #define BMI160_MGA_FIFO_A_Y_MSB (17)
  474. #define BMI160_MGA_FIFO_A_Z_LSB (18)
  475. #define BMI160_MGA_FIFO_A_Z_MSB (19)
  476. /* FIFO Mag definition*/
  477. #define BMI160_MA_FIFO_M_X_LSB (0)
  478. #define BMI160_MA_FIFO_M_X_MSB (1)
  479. #define BMI160_MA_FIFO_M_Y_LSB (2)
  480. #define BMI160_MA_FIFO_M_Y_MSB (3)
  481. #define BMI160_MA_FIFO_M_Z_LSB (4)
  482. #define BMI160_MA_FIFO_M_Z_MSB (5)
  483. #define BMI160_MA_FIFO_M_R_LSB (6)
  484. #define BMI160_MA_FIFO_M_R_MSB (7)
  485. #define BMI160_MA_FIFO_A_X_LSB (8)
  486. #define BMI160_MA_FIFO_A_X_MSB (9)
  487. #define BMI160_MA_FIFO_A_Y_LSB (10)
  488. #define BMI160_MA_FIFO_A_Y_MSB (11)
  489. #define BMI160_MA_FIFO_A_Z_LSB (12)
  490. #define BMI160_MA_FIFO_A_Z_MSB (13)
  491. /* FIFO mag/gyro definition*/
  492. #define BMI160_MG_FIFO_M_X_LSB (0)
  493. #define BMI160_MG_FIFO_M_X_MSB (1)
  494. #define BMI160_MG_FIFO_M_Y_LSB (2)
  495. #define BMI160_MG_FIFO_M_Y_MSB (3)
  496. #define BMI160_MG_FIFO_M_Z_LSB (4)
  497. #define BMI160_MG_FIFO_M_Z_MSB (5)
  498. #define BMI160_MG_FIFO_M_R_LSB (6)
  499. #define BMI160_MG_FIFO_M_R_MSB (7)
  500. #define BMI160_MG_FIFO_G_X_LSB (8)
  501. #define BMI160_MG_FIFO_G_X_MSB (9)
  502. #define BMI160_MG_FIFO_G_Y_LSB (10)
  503. #define BMI160_MG_FIFO_G_Y_MSB (11)
  504. #define BMI160_MG_FIFO_G_Z_LSB (12)
  505. #define BMI160_MG_FIFO_G_Z_MSB (13)
  506. /* FIFO length definitions*/
  507. #define BMI160_FIFO_SENSOR_TIME_LSB (0)
  508. #define BMI160_FIFO_SENSOR_TIME_XLSB (1)
  509. #define BMI160_FIFO_SENSOR_TIME_MSB (2)
  510. #define BMI160_FIFO_SENSOR_TIME_LENGTH (3)
  511. #define BMI160_FIFO_A_LENGTH (6)
  512. #define BMI160_FIFO_G_LENGTH (6)
  513. #define BMI160_FIFO_M_LENGTH (8)
  514. #define BMI160_FIFO_AG_LENGTH (12)
  515. #define BMI160_FIFO_AMG_LENGTH (20)
  516. #define BMI160_FIFO_MA_OR_MG_LENGTH (14)
  517. #define BMI160_FIFO_LENGTH_LSB_BYTE (0)
  518. #define BMI160_FIFO_LENGTH_MSB_BYTE (1)
  519. #endif
  520. /* bus read and write length for mag, Accel and gyro*/
  521. #define BMI160_MAG_X_DATA_LENGTH (2)
  522. #define BMI160_MAG_Y_DATA_LENGTH (2)
  523. #define BMI160_MAG_Z_DATA_LENGTH (2)
  524. #define BMI160_MAG_R_DATA_LENGTH (2)
  525. #define BMI160_MAG_XYZ_DATA_LENGTH (6)
  526. #define BMI160_MAG_XYZR_DATA_LENGTH (8)
  527. #define BMI160_MAG_YAS_DATA_LENGTH (8)
  528. #define BMI160_GYRO_DATA_LENGTH (2)
  529. #define BMI160_GYRO_XYZ_DATA_LENGTH (6)
  530. #define BMI160_ACCEL_DATA_LENGTH (2)
  531. #define BMI160_ACCEL_XYZ_DATA_LENGTH (6)
  532. #define BMI160_TEMP_DATA_LENGTH (2)
  533. #define BMI160_FIFO_DATA_LENGTH (2)
  534. #define BMI160_STEP_COUNTER_LENGTH (2)
  535. #define BMI160_SENSOR_TIME_LENGTH (3)
  536. /* Delay definitions*/
  537. #define BMI160_SEC_INTERFACE_GEN_READ_WRITE_DELAY (5)
  538. #define BMI160_BMM150_WAKEUP_DELAY1 (2)
  539. #define BMI160_BMM150_WAKEUP_DELAY2 (3)
  540. #define BMI160_BMM150_WAKEUP_DELAY3 (1)
  541. #define BMI160_YAS532_OFFSET_DELAY (2)
  542. #define BMI160_GEN_READ_WRITE_DELAY (1)
  543. #define BMI160_YAS532_MEASUREMENT_DELAY (25)
  544. #define BMI160_YAS_ACQ_COMMAND_DELAY (50)
  545. #define BMI160_YAS532_SET_INITIAL_VALUE_DELAY (200)
  546. #define BMI160_AKM_INIT_DELAY (60)
  547. /****************************************************/
  548. /**\name ARRAY SIZE DEFINITIONS */
  549. /***************************************************/
  550. #define BMI160_ACCEL_X_DATA_SIZE (2)
  551. #define BMI160_ACCEL_Y_DATA_SIZE (2)
  552. #define BMI160_ACCEL_Z_DATA_SIZE (2)
  553. #define BMI160_ACCEL_XYZ_DATA_SIZE (6)
  554. #define BMI160_GYRO_X_DATA_SIZE (2)
  555. #define BMI160_GYRO_Y_DATA_SIZE (2)
  556. #define BMI160_GYRO_Z_DATA_SIZE (2)
  557. #define BMI160_GYRO_XYZ_DATA_SIZE (6)
  558. #define BMI160_MAG_X_DATA_SIZE (2)
  559. #define BMI160_MAG_Y_DATA_SIZE (2)
  560. #define BMI160_MAG_Z_DATA_SIZE (2)
  561. #define BMI160_MAG_R_DATA_SIZE (2)
  562. #define BMI160_MAG_XYZ_DATA_SIZE (6)
  563. #define BMI160_MAG_XYZR_DATA_SIZE (8)
  564. #define BMI160_MAG_TRIM_DATA_SIZE (16)
  565. #define BMI160_TEMP_DATA_SIZE (2)
  566. #define BMI160_FIFO_DATA_SIZE (2)
  567. #define BMI160_STEP_COUNT_DATA_SIZE (2)
  568. #define BMI160_SENSOR_TIME_DATA_SIZE (3)
  569. #define BMI160_AKM_SENSITIVITY_DATA_SIZE (3)
  570. #define BMI160_HARD_OFFSET_DATA_SIZE (3)
  571. #define BMI160_YAS_XY1Y2_DATA_SIZE (3)
  572. #define BMI160_YAS_FLAG_DATA_SIZE (3)
  573. #define BMI160_YAS_TEMP_DATA_SIZE (3)
  574. #define BMI160_YAS_H_DATA_SIZE (3)
  575. #define BMI160_YAS_S_DATA_SIZE (3)
  576. #define BMI160_YAS_CORRECT_DATA_SIZE (5)
  577. #define BMI160_YAS_XY1Y2T_DATA_SIZE (8)
  578. #define BMI160_YAS537_CALIB_DATA_SIZE (17)
  579. #define BMI160_YAS532_CALIB_DATA_SIZE (14)
  580. #define BMI160_GYRO_ACCEL_SENSORTIME_DATA_SIZE (15)
  581. #define BMI160_ACCEL_SENSORTIME_DATA_SIZE (9)
  582. #define BMI160_GYRO_ACCEL_SENSORTIME_DATA (1)
  583. #define BMI160_ACCEL_SENSORTIME_DATA (0)
  584. /****************************************************/
  585. /**\name ARRAY PARAMETER DEFINITIONS */
  586. /***************************************************/
  587. #define BMI160_SENSOR_TIME_MSB_BYTE (2)
  588. #define BMI160_SENSOR_TIME_XLSB_BYTE (1)
  589. #define BMI160_SENSOR_TIME_LSB_BYTE (0)
  590. #define BMI160_MAG_X_LSB_BYTE (0)
  591. #define BMI160_MAG_X_MSB_BYTE (1)
  592. #define BMI160_MAG_Y_LSB_BYTE (0)
  593. #define BMI160_MAG_Y_MSB_BYTE (1)
  594. #define BMI160_MAG_Z_LSB_BYTE (0)
  595. #define BMI160_MAG_Z_MSB_BYTE (1)
  596. #define BMI160_MAG_R_LSB_BYTE (0)
  597. #define BMI160_MAG_R_MSB_BYTE (1)
  598. #define BMI160_DATA_FRAME_MAG_X_LSB_BYTE (0)
  599. #define BMI160_DATA_FRAME_MAG_X_MSB_BYTE (1)
  600. #define BMI160_DATA_FRAME_MAG_Y_LSB_BYTE (2)
  601. #define BMI160_DATA_FRAME_MAG_Y_MSB_BYTE (3)
  602. #define BMI160_DATA_FRAME_MAG_Z_LSB_BYTE (4)
  603. #define BMI160_DATA_FRAME_MAG_Z_MSB_BYTE (5)
  604. #define BMI160_DATA_FRAME_MAG_R_LSB_BYTE (6)
  605. #define BMI160_DATA_FRAME_MAG_R_MSB_BYTE (7)
  606. #define BMI160_GYRO_X_LSB_BYTE (0)
  607. #define BMI160_GYRO_X_MSB_BYTE (1)
  608. #define BMI160_GYRO_Y_LSB_BYTE (0)
  609. #define BMI160_GYRO_Y_MSB_BYTE (1)
  610. #define BMI160_GYRO_Z_LSB_BYTE (0)
  611. #define BMI160_GYRO_Z_MSB_BYTE (1)
  612. #define BMI160_DATA_FRAME_GYRO_X_LSB_BYTE (0)
  613. #define BMI160_DATA_FRAME_GYRO_X_MSB_BYTE (1)
  614. #define BMI160_DATA_FRAME_GYRO_Y_LSB_BYTE (2)
  615. #define BMI160_DATA_FRAME_GYRO_Y_MSB_BYTE (3)
  616. #define BMI160_DATA_FRAME_GYRO_Z_LSB_BYTE (4)
  617. #define BMI160_DATA_FRAME_GYRO_Z_MSB_BYTE (5)
  618. #define BMI160_ACCEL_X_LSB_BYTE (0)
  619. #define BMI160_ACCEL_X_MSB_BYTE (1)
  620. #define BMI160_ACCEL_Y_LSB_BYTE (0)
  621. #define BMI160_ACCEL_Y_MSB_BYTE (1)
  622. #define BMI160_ACCEL_Z_LSB_BYTE (0)
  623. #define BMI160_ACCEL_Z_MSB_BYTE (1)
  624. #define BMI160_DATA_FRAME_ACCEL_X_LSB_BYTE (0)
  625. #define BMI160_DATA_FRAME_ACCEL_X_MSB_BYTE (1)
  626. #define BMI160_DATA_FRAME_ACCEL_Y_LSB_BYTE (2)
  627. #define BMI160_DATA_FRAME_ACCEL_Y_MSB_BYTE (3)
  628. #define BMI160_DATA_FRAME_ACCEL_Z_LSB_BYTE (4)
  629. #define BMI160_DATA_FRAME_ACCEL_Z_MSB_BYTE (5)
  630. #define BMI160_TEMP_LSB_BYTE (0)
  631. #define BMI160_TEMP_MSB_BYTE (1)
  632. #define BMI160_STEP_COUNT_LSB_BYTE (0)
  633. #define BMI160_STEP_COUNT_MSB_BYTE (1)
  634. /****************************************************/
  635. /**\name ERROR CODES */
  636. /***************************************************/
  637. #define E_BMI160_NULL_PTR ((s8)-127)
  638. #define E_BMI160_COMM_RES ((s8)-1)
  639. #define E_BMI160_OUT_OF_RANGE ((s8)-2)
  640. #define E_BMI160_BUSY ((s8)-3)
  641. #define SUCCESS ((u8)0)
  642. #define ERROR ((s8)-1)
  643. /* Constants */
  644. #define BMI160_NULL (0)
  645. #define BMI160_DELAY_SETTLING_TIME (5)
  646. /*This refers BMI160 return type as s8 */
  647. #define BMI160_RETURN_FUNCTION_TYPE s8
  648. /****************************************************/
  649. /**\name REGISTER DEFINITIONS */
  650. /***************************************************/
  651. /*******************/
  652. /**\name CHIP ID */
  653. /*******************/
  654. #define BMI160_USER_CHIP_ID_ADDR (0x00)
  655. /*******************/
  656. /**\name ERROR STATUS */
  657. /*******************/
  658. #define BMI160_USER_ERROR_ADDR (0X02)
  659. /*******************/
  660. /**\name POWER MODE STATUS */
  661. /*******************/
  662. #define BMI160_USER_PMU_STAT_ADDR (0X03)
  663. #define BMI160_ACCEL_GYRO_PMU_MASK (0X3C)
  664. #define BMI160_NORMAL_MODE (0X14)
  665. /*******************/
  666. /**\name MAG DATA REGISTERS */
  667. /*******************/
  668. #define BMI160_USER_DATA_0_ADDR (0X04)
  669. #define BMI160_USER_DATA_1_ADDR (0X05)
  670. #define BMI160_USER_DATA_2_ADDR (0X06)
  671. #define BMI160_USER_DATA_3_ADDR (0X07)
  672. #define BMI160_USER_DATA_4_ADDR (0X08)
  673. #define BMI160_USER_DATA_5_ADDR (0X09)
  674. #define BMI160_USER_DATA_6_ADDR (0X0A)
  675. #define BMI160_USER_DATA_7_ADDR (0X0B)
  676. /*******************/
  677. /**\name GYRO DATA REGISTERS */
  678. /*******************/
  679. #define BMI160_USER_DATA_8_ADDR (0X0C)
  680. #define BMI160_USER_DATA_9_ADDR (0X0D)
  681. #define BMI160_USER_DATA_10_ADDR (0X0E)
  682. #define BMI160_USER_DATA_11_ADDR (0X0F)
  683. #define BMI160_USER_DATA_12_ADDR (0X10)
  684. #define BMI160_USER_DATA_13_ADDR (0X11)
  685. /*******************/
  686. /**\name ACCEL DATA REGISTERS */
  687. /*******************/
  688. #define BMI160_USER_DATA_14_ADDR (0X12)
  689. #define BMI160_USER_DATA_15_ADDR (0X13)
  690. #define BMI160_USER_DATA_16_ADDR (0X14)
  691. #define BMI160_USER_DATA_17_ADDR (0X15)
  692. #define BMI160_USER_DATA_18_ADDR (0X16)
  693. #define BMI160_USER_DATA_19_ADDR (0X17)
  694. /*******************/
  695. /**\name SENSOR TIME REGISTERS */
  696. /*******************/
  697. #define BMI160_USER_SENSORTIME_0_ADDR (0X18)
  698. #define BMI160_USER_SENSORTIME_1_ADDR (0X19)
  699. #define BMI160_USER_SENSORTIME_2_ADDR (0X1A)
  700. /*******************/
  701. /**\name STATUS REGISTER FOR SENSOR STATUS FLAG */
  702. /*******************/
  703. #define BMI160_USER_STAT_ADDR (0X1B)
  704. /*******************/
  705. /**\name INTERRUPT STATUS REGISTERS */
  706. /*******************/
  707. #define BMI160_USER_INTR_STAT_0_ADDR (0X1C)
  708. #define BMI160_USER_INTR_STAT_1_ADDR (0X1D)
  709. #define BMI160_USER_INTR_STAT_2_ADDR (0X1E)
  710. #define BMI160_USER_INTR_STAT_3_ADDR (0X1F)
  711. /*******************/
  712. /**\name TEMPERATURE REGISTERS */
  713. /*******************/
  714. #define BMI160_USER_TEMPERATURE_0_ADDR (0X20)
  715. #define BMI160_USER_TEMPERATURE_1_ADDR (0X21)
  716. /*******************/
  717. /**\name FIFO REGISTERS */
  718. /*******************/
  719. #define BMI160_USER_FIFO_LENGTH_0_ADDR (0X22)
  720. #define BMI160_USER_FIFO_LENGTH_1_ADDR (0X23)
  721. #define BMI160_USER_FIFO_DATA_ADDR (0X24)
  722. /***************************************************/
  723. /**\name ACCEL CONFIG REGISTERS FOR ODR, BANDWIDTH AND UNDERSAMPLING*/
  724. /******************************************************/
  725. #define BMI160_USER_ACCEL_CONFIG_ADDR (0X40)
  726. /*******************/
  727. /**\name ACCEL RANGE */
  728. /*******************/
  729. #define BMI160_USER_ACCEL_RANGE_ADDR (0X41)
  730. /***************************************************/
  731. /**\name GYRO CONFIG REGISTERS FOR ODR AND BANDWIDTH */
  732. /******************************************************/
  733. #define BMI160_USER_GYRO_CONFIG_ADDR (0X42)
  734. /*******************/
  735. /**\name GYRO RANGE */
  736. /*******************/
  737. #define BMI160_USER_GYRO_RANGE_ADDR (0X43)
  738. /***************************************************/
  739. /**\name MAG CONFIG REGISTERS FOR ODR*/
  740. /******************************************************/
  741. #define BMI160_USER_MAG_CONFIG_ADDR (0X44)
  742. #ifdef FIFO_ENABLE
  743. /***************************************************/
  744. /**\name REGISTER FOR GYRO AND ACCEL DOWNSAMPLING RATES FOR FIFO*/
  745. /******************************************************/
  746. #define BMI160_USER_FIFO_DOWN_ADDR (0X45)
  747. /***************************************************/
  748. /**\name FIFO CONFIG REGISTERS*/
  749. /******************************************************/
  750. #define BMI160_USER_FIFO_CONFIG_0_ADDR (0X46)
  751. #define BMI160_USER_FIFO_CONFIG_1_ADDR (0X47)
  752. #endif
  753. /***************************************************/
  754. /**\name MAG INTERFACE REGISTERS*/
  755. /******************************************************/
  756. #define BMI160_USER_MAG_IF_0_ADDR (0X4B)
  757. #define BMI160_USER_MAG_IF_1_ADDR (0X4C)
  758. #define BMI160_USER_MAG_IF_2_ADDR (0X4D)
  759. #define BMI160_USER_MAG_IF_3_ADDR (0X4E)
  760. #define BMI160_USER_MAG_IF_4_ADDR (0X4F)
  761. /***************************************************/
  762. /**\name INTERRUPT ENABLE REGISTERS*/
  763. /******************************************************/
  764. #define BMI160_USER_INTR_ENABLE_0_ADDR (0X50)
  765. #define BMI160_USER_INTR_ENABLE_1_ADDR (0X51)
  766. #define BMI160_USER_INTR_ENABLE_2_ADDR (0X52)
  767. #define BMI160_USER_INTR_OUT_CTRL_ADDR (0X53)
  768. /***************************************************/
  769. /**\name LATCH DURATION REGISTERS*/
  770. /******************************************************/
  771. #define BMI160_USER_INTR_LATCH_ADDR (0X54)
  772. /***************************************************/
  773. /**\name MAP INTERRUPT 1 and 2 REGISTERS*/
  774. /******************************************************/
  775. #define BMI160_USER_INTR_MAP_0_ADDR (0X55)
  776. #define BMI160_USER_INTR_MAP_1_ADDR (0X56)
  777. #define BMI160_USER_INTR_MAP_2_ADDR (0X57)
  778. /***************************************************/
  779. /**\name DATA SOURCE REGISTERS*/
  780. /******************************************************/
  781. #define BMI160_USER_INTR_DATA_0_ADDR (0X58)
  782. #define BMI160_USER_INTR_DATA_1_ADDR (0X59)
  783. /***************************************************/
  784. /**\name
  785. INTERRUPT THRESHOLD, HYSTERESIS, DURATION, MODE CONFIGURATION REGISTERS*/
  786. /******************************************************/
  787. #define BMI160_USER_INTR_LOWHIGH_0_ADDR (0X5A)
  788. #define BMI160_USER_INTR_LOWHIGH_1_ADDR (0X5B)
  789. #define BMI160_USER_INTR_LOWHIGH_2_ADDR (0X5C)
  790. #define BMI160_USER_INTR_LOWHIGH_3_ADDR (0X5D)
  791. #define BMI160_USER_INTR_LOWHIGH_4_ADDR (0X5E)
  792. #define BMI160_USER_INTR_MOTION_0_ADDR (0X5F)
  793. #define BMI160_USER_INTR_MOTION_1_ADDR (0X60)
  794. #define BMI160_USER_INTR_MOTION_2_ADDR (0X61)
  795. #define BMI160_USER_INTR_MOTION_3_ADDR (0X62)
  796. #define BMI160_USER_INTR_TAP_0_ADDR (0X63)
  797. #define BMI160_USER_INTR_TAP_1_ADDR (0X64)
  798. #define BMI160_USER_INTR_ORIENT_0_ADDR (0X65)
  799. #define BMI160_USER_INTR_ORIENT_1_ADDR (0X66)
  800. #define BMI160_USER_INTR_FLAT_0_ADDR (0X67)
  801. #define BMI160_USER_INTR_FLAT_1_ADDR (0X68)
  802. /***************************************************/
  803. /**\name FAST OFFSET CONFIGURATION REGISTER*/
  804. /******************************************************/
  805. #define BMI160_USER_FOC_CONFIG_ADDR (0X69)
  806. /***************************************************/
  807. /**\name MISCELLANEOUS CONFIGURATION REGISTER*/
  808. /******************************************************/
  809. #define BMI160_USER_CONFIG_ADDR (0X6A)
  810. /***************************************************/
  811. /**\name SERIAL INTERFACE SETTINGS REGISTER*/
  812. /******************************************************/
  813. #define BMI160_USER_IF_CONFIG_ADDR (0X6B)
  814. /***************************************************/
  815. /**\name GYRO POWER MODE TRIGGER REGISTER */
  816. /******************************************************/
  817. #define BMI160_USER_PMU_TRIGGER_ADDR (0X6C)
  818. /***************************************************/
  819. /**\name SELF_TEST REGISTER*/
  820. /******************************************************/
  821. #define BMI160_USER_SELF_TEST_ADDR (0X6D)
  822. /***************************************************/
  823. /**\name SPI,I2C SELECTION REGISTER*/
  824. /******************************************************/
  825. #define BMI160_USER_NV_CONFIG_ADDR (0x70)
  826. /***************************************************/
  827. /**\name ACCEL AND GYRO OFFSET REGISTERS*/
  828. /******************************************************/
  829. #define BMI160_USER_OFFSET_0_ADDR (0X71)
  830. #define BMI160_USER_OFFSET_1_ADDR (0X72)
  831. #define BMI160_USER_OFFSET_2_ADDR (0X73)
  832. #define BMI160_USER_OFFSET_3_ADDR (0X74)
  833. #define BMI160_USER_OFFSET_4_ADDR (0X75)
  834. #define BMI160_USER_OFFSET_5_ADDR (0X76)
  835. #define BMI160_USER_OFFSET_6_ADDR (0X77)
  836. /***************************************************/
  837. /**\name STEP COUNTER INTERRUPT REGISTERS*/
  838. /******************************************************/
  839. #define BMI160_USER_STEP_COUNT_0_ADDR (0X78)
  840. #define BMI160_USER_STEP_COUNT_1_ADDR (0X79)
  841. /***************************************************/
  842. /**\name STEP COUNTER CONFIGURATION REGISTERS*/
  843. /******************************************************/
  844. #define BMI160_USER_STEP_CONFIG_0_ADDR (0X7A)
  845. #define BMI160_USER_STEP_CONFIG_1_ADDR (0X7B)
  846. /***************************************************/
  847. /**\name COMMAND REGISTER*/
  848. /******************************************************/
  849. #define BMI160_CMD_COMMANDS_ADDR (0X7E)
  850. /****************************************************/
  851. /**\name SHIFT VALUE DEFINITION */
  852. /***************************************************/
  853. #define BMI160_SHIFT_BIT_POSITION_BY_01_BIT (1)
  854. #define BMI160_SHIFT_BIT_POSITION_BY_02_BITS (2)
  855. #define BMI160_SHIFT_BIT_POSITION_BY_03_BITS (3)
  856. #define BMI160_SHIFT_BIT_POSITION_BY_04_BITS (4)
  857. #define BMI160_SHIFT_BIT_POSITION_BY_05_BITS (5)
  858. #define BMI160_SHIFT_BIT_POSITION_BY_06_BITS (6)
  859. #define BMI160_SHIFT_BIT_POSITION_BY_07_BITS (7)
  860. #define BMI160_SHIFT_BIT_POSITION_BY_08_BITS (8)
  861. #define BMI160_SHIFT_BIT_POSITION_BY_09_BITS (9)
  862. #define BMI160_SHIFT_BIT_POSITION_BY_12_BITS (12)
  863. #define BMI160_SHIFT_BIT_POSITION_BY_13_BITS (13)
  864. #define BMI160_SHIFT_BIT_POSITION_BY_14_BITS (14)
  865. #define BMI160_SHIFT_BIT_POSITION_BY_15_BITS (15)
  866. #define BMI160_SHIFT_BIT_POSITION_BY_16_BITS (16)
  867. /****************************************************/
  868. /**\name DEFINITIONS USED FOR YAMAHA-YAS532 */
  869. /***************************************************/
  870. #define YAS532_MAG_STATE_NORMAL (0)
  871. #define YAS532_MAG_STATE_INIT_COIL (1)
  872. #define YAS532_MAG_STATE_MEASURE_OFFSET (2)
  873. #define YAS532_MAG_INITCOIL_TIMEOUT (1000)
  874. #define YAS532_MAG_NOTRANS_POSITION (3)
  875. #define YAS532_DEFAULT_SENSOR_DELAY (50)
  876. #define YAS532_DATA_OVERFLOW (8190)
  877. #define YAS532_DATA_UNDERFLOW (0)
  878. #define YAS532_MAG_TEMPERATURE_LOG (10)
  879. #define YAS532_TEMP20DEGREE_TYPICAL (390)
  880. #define YAS532_VERSION_AC_COEF_X (850)
  881. #define YAS532_VERSION_AC_COEF_Y1 (750)
  882. #define YAS532_VERSION_AC_COEF_Y2 (750)
  883. #define YAS532_DATA_CENTER (4096)
  884. /****************************************************/
  885. /**\name YAMAHA-YAS532 OFFSET DEFINITION */
  886. /***************************************************/
  887. static const s8 INVALID_OFFSET[] = {0x7f, 0x7f, 0x7f};
  888. #define set_vector(to, from) \
  889. {int _l; for (_l = 0; _l < 3; _l++) (to)[_l] = (from)[_l]; }
  890. #define is_valid_offset(a) \
  891. (((a)[0] <= 31) && ((a)[1] <= 31) && ((a)[2] <= 31) \
  892. && (-31 <= (a)[0]) && (-31 <= (a)[1]) && (-31 <= (a)[2]))
  893. /**************************************************/
  894. /**\name YAS532 CALIB DATA DEFINITIONS */
  895. /*************************************************/
  896. /* register address of YAS532*/
  897. #define BMI160_YAS532_TESTR1 (0x88)
  898. #define BMI160_YAS532_TESTR2 (0x89)
  899. #define BMI160_YAS532_RCOIL (0x81)
  900. #define BMI160_YAS532_COMMAND_REGISTER (0x82)
  901. #define BMI160_YAS532_DATA_REGISTER (0xB0)
  902. /* calib data register definition*/
  903. #define BMI160_YAS532_CALIB_CX (0x90)
  904. #define BMI160_YAS532_CALIB_CY1 (0x91)
  905. #define BMI160_YAS532_CALIB_CY2 (0x92)
  906. #define BMI160_YAS532_CALIB1 (0x93)
  907. #define BMI160_YAS532_CALIB2 (0x94)
  908. #define BMI160_YAS532_CALIB3 (0x95)
  909. #define BMI160_YAS532_CALIB4 (0x96)
  910. #define BMI160_YAS532_CALIB5 (0x97)
  911. #define BMI160_YAS532_CALIB6 (0x98)
  912. #define BMI160_YAS532_CALIB7 (0x99)
  913. #define BMI160_YAS532_CALIB8 (0x9A)
  914. #define BMI160_YAS532_CALIB9 (0x9B)
  915. #define BMI160_YAS532_CALIB10 (0x9C)
  916. #define BMI160_YAS532_CALIB11 (0x9D)
  917. /* offset definition */
  918. #define BMI160_YAS532_OFFSET_X (0x85)
  919. #define BMI160_YAS532_OFFSET_Y (0x86)
  920. #define BMI160_YAS532_OFFSET_Z (0x87)
  921. /* data to write register for yas532*/
  922. #define BMI160_YAS532_WRITE_TESTR1 (0x00)
  923. #define BMI160_YAS532_WRITE_TESTR2 (0x00)
  924. #define BMI160_YAS532_WRITE_RCOIL (0x00)
  925. /**************************************************/
  926. /**\name YAS537 DEFINITION */
  927. /*************************************************/
  928. #define YAS537_SRSTR_DATA (0x02)
  929. #define YAS537_WRITE_A_D_CONVERTER (0x03)
  930. #define YAS537_WRITE_A_D_CONVERTER2 (0xF8)
  931. #define YAS537_WRITE_FILTER (0x08)
  932. #define YAS537_WRITE_CONFR (0x08)
  933. #define YAS537_WRITE_TEMP_CALIB (0xFF)
  934. #define YAS537_SET_COMMAND_REGISTER (0x01)
  935. /**************************************************/
  936. /**\name YAS537 REGISTER DEFINITION */
  937. /*************************************************/
  938. #define YAS537_REG_SRSTR (0x90)
  939. #define YAS537_REG_CALR_C0 (0xC0)
  940. #define YAS537_REG_CALR_C1 (0xC1)
  941. #define YAS537_REG_CALR_C2 (0xC2)
  942. #define YAS537_REG_CALR_C3 (0xC3)
  943. #define YAS537_REG_CALR_C4 (0xC4)
  944. #define YAS537_REG_CALR_C5 (0xC5)
  945. #define YAS537_REG_CALR_C6 (0xC6)
  946. #define YAS537_REG_CALR_C7 (0xC7)
  947. #define YAS537_REG_CALR_C8 (0xC8)
  948. #define YAS537_REG_CALR_C9 (0xC9)
  949. #define YAS537_REG_CALR_CA (0xCA)
  950. #define YAS537_REG_CALR_CB (0xCB)
  951. #define YAS537_REG_CALR_CC (0xCC)
  952. #define YAS537_REG_CALR_CD (0xCD)
  953. #define YAS537_REG_CALR_CE (0xCE)
  954. #define YAS537_REG_CALR_CF (0xCF)
  955. #define YAS537_REG_CALR_DO (0xD0)
  956. #define YAS537_REG_MTCR (0x93)
  957. #define YAS537_REG_CONFR (0x82)
  958. #define BMI160_REG_YAS537_CMDR (0x81)
  959. #define YAS537_REG_OXR (0x84)
  960. #define YAS537_REG_AVRR (0x87)
  961. #define YAS537_REG_HCKR (0x88)
  962. #define YAS537_REG_LCKR (0x89)
  963. #define YAS537_REG_ADCCALR (0x91)
  964. #define YAS537_REG_ADCCALR_ONE (0x92)
  965. #define YAS537_REG_OCR (0x9E)
  966. #define YAS537_REG_TRMR (0x9F)
  967. #define YAS537_REG_TEMPERATURE_0 (0xB0)
  968. #define YAS537_REG_TEMPERATURE_1 (0xB1)
  969. #define YAS537_REG_DATA_X_0 (0xB2)
  970. #define YAS537_REG_DATA_X_1 (0xB3)
  971. #define YAS537_REG_DATA_Y1_0 (0xB4)
  972. #define YAS537_REG_DATA_Y1_1 (0xB5)
  973. #define YAS537_REG_DATA_Y2_0 (0xB6)
  974. #define YAS537_REG_DATA_Y2_1 (0xB7)
  975. #define YAS537_MAG_STATE_NORMAL (0)
  976. #define YAS537_MAG_STATE_INIT_COIL (1)
  977. #define YAS537_MAG_STATE_RECORD_DATA (2)
  978. #define YAS537_DATA_UNDERFLOW (0)
  979. #define YAS537_DATA_OVERFLOW (16383)
  980. /****************************************************/
  981. /**\name YAS537_set vector */
  982. /***************************************************/
  983. #define yas537_set_vector(to, from) \
  984. {int _l; for (_l = 0; _l < 3; _l++) (to)[_l] = (from)[_l]; }
  985. #ifndef ABS
  986. #define ABS(a) ((a) > 0 ? (a) : -(a)) /*!< Absolute value */
  987. #endif
  988. /****************************************************/
  989. /**\name AKM09911 AND AKM09912 DEFINITION */
  990. /***************************************************/
  991. #define AKM09912_SENSITIVITY_DIV (256)
  992. #define AKM09912_SENSITIVITY (128)
  993. #define AKM09911_SENSITIVITY_DIV (128)
  994. #define AKM_ASAX (0)
  995. #define AKM_ASAY (1)
  996. #define AKM_ASAZ (2)
  997. #define AKM_POWER_DOWN_MODE_DATA (0x00)
  998. #define AKM_FUSE_ROM_MODE (0x1F)
  999. #define AKM_POWER_MODE_REG (0x31)
  1000. #define AKM_SINGLE_MEASUREMENT_MODE (0x01)
  1001. #define AKM_DATA_REGISTER (0x11)
  1002. /*! AKM09912 Register definition */
  1003. #define AKM_CHIP_ID_REG (0x01)
  1004. /****************************************************/
  1005. /**\name BMM150 DEFINITION */
  1006. /***************************************************/
  1007. #define BMI160_BMM150_SET_POWER_CONTROL (0x01)
  1008. #define BMI160_BMM150_MAX_RETRY_WAKEUP (5)
  1009. #define BMI160_BMM150_POWER_ON (0x01)
  1010. #define BMI160_BMM150_POWER_OFF (0x00)
  1011. #define BMI160_BMM150_FORCE_MODE (0x02)
  1012. #define BMI160_BMM150_POWER_ON_SUCCESS (0)
  1013. #define BMI160_BMM150_POWER_ON_FAIL ((s8)-1)
  1014. #define BMI160_BMM150_DIG_X1 (0)
  1015. #define BMI160_BMM150_DIG_Y1 (1)
  1016. #define BMI160_BMM150_DIG_X2 (2)
  1017. #define BMI160_BMM150_DIG_Y3 (3)
  1018. #define BMI160_BMM150_DIG_XY1 (4)
  1019. #define BMI160_BMM150_DIG_XY2 (5)
  1020. #define BMI160_BMM150_DIG_Z1_LSB (6)
  1021. #define BMI160_BMM150_DIG_Z1_MSB (7)
  1022. #define BMI160_BMM150_DIG_Z2_LSB (8)
  1023. #define BMI160_BMM150_DIG_Z2_MSB (9)
  1024. #define BMI160_BMM150_DIG_DIG_Z3_LSB (10)
  1025. #define BMI160_BMM150_DIG_DIG_Z3_MSB (11)
  1026. #define BMI160_BMM150_DIG_DIG_Z4_LSB (12)
  1027. #define BMI160_BMM150_DIG_DIG_Z4_MSB (13)
  1028. #define BMI160_BMM150_DIG_DIG_XYZ1_LSB (14)
  1029. #define BMI160_BMM150_DIG_DIG_XYZ1_MSB (15)
  1030. #define BMI160_FIFO_FRAME_CNT (146)
  1031. #define BMI160_FRAME_COUNT (1)
  1032. /**************************************************************/
  1033. /**\name STRUCTURE DEFINITIONS */
  1034. /**************************************************************/
  1035. /*!
  1036. * @brief bmi160 structure
  1037. * This structure holds all relevant information about bmi160
  1038. */
  1039. struct bmi160_t {
  1040. u8 chip_id;/**< chip id of BMI160 */
  1041. u8 dev_addr;/**< device address of BMI160 */
  1042. s8 mag_manual_enable;/**< used to check the Mag manual/auto mode status */
  1043. BMI160_WR_FUNC_PTR;/**< bus write function pointer */
  1044. BMI160_RD_FUNC_PTR;/**< bus read function pointer */
  1045. BMI160_BRD_FUNC_PTR;/**< burst write function pointer */
  1046. void (*delay_msec)(BMI160_MDELAY_DATA_TYPE);/**< delay function pointer */
  1047. };
  1048. /*!
  1049. * @brief Structure containing bmm150 and akm09911
  1050. * magnetometer values for x,y and
  1051. * z-axis in s16
  1052. */
  1053. struct bmi160_mag_t {
  1054. s32 x;/**< BMM150 and AKM09911 and AKM09912 X raw data*/
  1055. s32 y;/**< BMM150 and AKM09911 and AKM09912 Y raw data*/
  1056. s32 z;/**< BMM150 and AKM09911 and AKM09912 Z raw data*/
  1057. };
  1058. /*!
  1059. * @brief Structure containing bmm150 xyz data and temperature
  1060. */
  1061. struct bmi160_mag_xyzr_t {
  1062. s16 x;/**< BMM150 X raw data*/
  1063. s16 y;/**< BMM150 Y raw data*/
  1064. s16 z;/**<BMM150 Z raw data*/
  1065. u16 r;/**<BMM150 R raw data*/
  1066. };
  1067. /*!
  1068. * @brief Structure containing Gyro xyz data
  1069. */
  1070. struct bmi160_gyro_t {
  1071. s16 x;/**<gyro X data*/
  1072. s16 y;/**<gyro Y data*/
  1073. s16 z;/**<gyro Z data*/
  1074. };
  1075. /*!
  1076. * @brief Structure containing Accel xyz data
  1077. */
  1078. struct bmi160_accel_t {
  1079. s16 x;/**<accel X data*/
  1080. s16 y;/**<accel Y data*/
  1081. s16 z;/**<accel Z data*/
  1082. };
  1083. /*!
  1084. * @brief Structure containing Accel Gyro data and sensor time
  1085. */
  1086. struct bmi160_sensortime_accel_gyro_data {
  1087. struct bmi160_gyro_t gyro; /**<gyro data structure*/
  1088. struct bmi160_accel_t accel;/**<accel data structure*/
  1089. u32 v_sensor_time_u32;/**<Sensor time value*/
  1090. };
  1091. /*!
  1092. * @brief Structure bmm150 Mag compensated data with s32 output
  1093. */
  1094. struct bmi160_mag_xyz_s32_t {
  1095. s32 x;/**<BMM150 X compensated data*/
  1096. s32 y;/**<BMM150 Y compensated data*/
  1097. s32 z;/**<BMM150 Z compensated data*/
  1098. };
  1099. /*!
  1100. * @brief Structure bmm150 Mag trim data
  1101. */
  1102. struct trim_data_t {
  1103. s8 dig_x1;/**<BMM150 trim x1 data*/
  1104. s8 dig_y1;/**<BMM150 trim y1 data*/
  1105. s8 dig_x2;/**<BMM150 trim x2 data*/
  1106. s8 dig_y2;/**<BMM150 trim y2 data*/
  1107. u16 dig_z1;/**<BMM150 trim z1 data*/
  1108. s16 dig_z2;/**<BMM150 trim z2 data*/
  1109. s16 dig_z3;/**<BMM150 trim z3 data*/
  1110. s16 dig_z4;/**<BMM150 trim z4 data*/
  1111. u8 dig_xy1;/**<BMM150 trim xy1 data*/
  1112. s8 dig_xy2;/**<BMM150 trim xy2 data*/
  1113. u16 dig_xyz1;/**<BMM150 trim xyz1 data*/
  1114. };
  1115. #ifdef FIFO_ENABLE
  1116. /*!
  1117. * @brief FIFO used to store the FIFO header less data
  1118. */
  1119. struct bmi160_fifo_data_header_less_t {
  1120. struct bmi160_accel_t accel_fifo[BMI160_FIFO_FRAME_CNT];/**<
  1121. Accel data of XYZ */
  1122. struct bmi160_mag_t mag_fifo[BMI160_FIFO_FRAME_CNT];/**<
  1123. Mag data of XYZ */
  1124. struct bmi160_gyro_t gyro_fifo[BMI160_FIFO_FRAME_CNT];/**<
  1125. Gyro data of XYZ */
  1126. u8 accel_frame_count;/**< The total number of Accel frame stored
  1127. in the FIFO*/
  1128. u8 gyro_frame_count;/**< The total number of Gyro frame stored
  1129. in the FIFO*/
  1130. u8 mag_frame_count;/**< The total number of Mag frame stored
  1131. in the FIFO*/
  1132. };
  1133. /*!
  1134. * @brief Struct used to store the FIFO header data
  1135. */
  1136. struct bmi160_fifo_data_header_t {
  1137. struct bmi160_accel_t accel_fifo[BMI160_FIFO_FRAME_CNT];/**<
  1138. Accel data of XYZ */
  1139. struct bmi160_mag_t mag_fifo[BMI160_FIFO_FRAME_CNT];/**<
  1140. Mag data of XYZ */
  1141. struct bmi160_gyro_t gyro_fifo[BMI160_FIFO_FRAME_CNT];/**<
  1142. Gyro data of XYZ */
  1143. u32 fifo_time;/**< Value of FIFO time*/
  1144. u8 skip_frame;/**< The value of skip frame information */
  1145. u8 fifo_input_config_info; /**< FIFO input config info*/
  1146. u8 accel_frame_count; /**< The total number of Accel frame stored
  1147. in the FIFO*/
  1148. u8 gyro_frame_count; /**< The total number of Gyro frame stored
  1149. in the FIFO*/
  1150. u8 mag_frame_count; /**< The total number of Mag frame stored
  1151. in the FIFO*/
  1152. u8 fifo_header[BMI160_FIFO_FRAME_CNT]; /**< FIFO header info*/
  1153. };
  1154. /*!
  1155. * @brief Struct used to store the FIFO Mag data
  1156. */
  1157. struct bmi160_mag_fifo_data_t {
  1158. u8 mag_x_lsb;/**< The value of Mag x LSB data*/
  1159. u8 mag_x_msb;/**< The value of Mag x MSB data*/
  1160. u8 mag_y_lsb;/**< The value of Mag y LSB data*/
  1161. u8 mag_y_msb;/**< The value of Mag y MSB data*/
  1162. u8 mag_z_lsb;/**< The value of Mag z LSB data*/
  1163. u8 mag_z_msb;/**< The value of Mag z MSB data*/
  1164. u8 mag_r_y2_lsb;
  1165. /**< The value of Mag r for BMM150 Y2 for YAMAHA LSB data*/
  1166. u8 mag_r_y2_msb;
  1167. /**< The value of Mag r for BMM150 Y2 for YAMAHA MSB data*/
  1168. };
  1169. #endif
  1170. /**************************************************************/
  1171. /**\name USER DATA REGISTERS DEFINITION START */
  1172. /**************************************************************/
  1173. /**************************************************************/
  1174. /**\name CHIP ID LENGTH, POSITION AND MASK */
  1175. /**************************************************************/
  1176. /* Chip ID Description - Reg Addr --> (0x00), Bit --> 0...7 */
  1177. #define BMI160_USER_CHIP_ID__POS (0)
  1178. #define BMI160_USER_CHIP_ID__MSK (0xFF)
  1179. #define BMI160_USER_CHIP_ID__LEN (8)
  1180. #define BMI160_USER_CHIP_ID__REG (BMI160_USER_CHIP_ID_ADDR)
  1181. /**************************************************************/
  1182. /**\name ERROR STATUS LENGTH, POSITION AND MASK */
  1183. /**************************************************************/
  1184. /* Error Description - Reg Addr --> (0x02), Bit --> 0 */
  1185. #define BMI160_USER_ERR_STAT__POS (0)
  1186. #define BMI160_USER_ERR_STAT__LEN (8)
  1187. #define BMI160_USER_ERR_STAT__MSK (0xFF)
  1188. #define BMI160_USER_ERR_STAT__REG (BMI160_USER_ERROR_ADDR)
  1189. #define BMI160_USER_FATAL_ERR__POS (0)
  1190. #define BMI160_USER_FATAL_ERR__LEN (1)
  1191. #define BMI160_USER_FATAL_ERR__MSK (0x01)
  1192. #define BMI160_USER_FATAL_ERR__REG (BMI160_USER_ERROR_ADDR)
  1193. /* Error Description - Reg Addr --> (0x02), Bit --> 1...4 */
  1194. #define BMI160_USER_ERR_CODE__POS (1)
  1195. #define BMI160_USER_ERR_CODE__LEN (4)
  1196. #define BMI160_USER_ERR_CODE__MSK (0x1E)
  1197. #define BMI160_USER_ERR_CODE__REG (BMI160_USER_ERROR_ADDR)
  1198. /* Error Description - Reg Addr --> (0x02), Bit --> 5 */
  1199. #define BMI160_USER_I2C_FAIL_ERR__POS (5)
  1200. #define BMI160_USER_I2C_FAIL_ERR__LEN (1)
  1201. #define BMI160_USER_I2C_FAIL_ERR__MSK (0x20)
  1202. #define BMI160_USER_I2C_FAIL_ERR__REG (BMI160_USER_ERROR_ADDR)
  1203. /* Error Description - Reg Addr --> (0x02), Bit --> 6 */
  1204. #define BMI160_USER_DROP_CMD_ERR__POS (6)
  1205. #define BMI160_USER_DROP_CMD_ERR__LEN (1)
  1206. #define BMI160_USER_DROP_CMD_ERR__MSK (0x40)
  1207. #define BMI160_USER_DROP_CMD_ERR__REG (BMI160_USER_ERROR_ADDR)
  1208. /**************************************************************/
  1209. /**\name MAG DATA READY LENGTH, POSITION AND MASK */
  1210. /**************************************************************/
  1211. /* Error Description - Reg Addr --> (0x02), Bit --> 7 */
  1212. #define BMI160_USER_MAG_DATA_RDY_ERR__POS (7)
  1213. #define BMI160_USER_MAG_DATA_RDY_ERR__LEN (1)
  1214. #define BMI160_USER_MAG_DATA_RDY_ERR__MSK (0x80)
  1215. #define BMI160_USER_MAG_DATA_RDY_ERR__REG (BMI160_USER_ERROR_ADDR)
  1216. /**************************************************************/
  1217. /**\name MAG POWER MODE LENGTH, POSITION AND MASK */
  1218. /**************************************************************/
  1219. /* PMU_Status Description of MAG - Reg Addr --> (0x03), Bit --> 1..0 */
  1220. #define BMI160_USER_MAG_POWER_MODE_STAT__POS (0)
  1221. #define BMI160_USER_MAG_POWER_MODE_STAT__LEN (2)
  1222. #define BMI160_USER_MAG_POWER_MODE_STAT__MSK (0x03)
  1223. #define BMI160_USER_MAG_POWER_MODE_STAT__REG \
  1224. (BMI160_USER_PMU_STAT_ADDR)
  1225. /**************************************************************/
  1226. /**\name GYRO POWER MODE LENGTH, POSITION AND MASK */
  1227. /**************************************************************/
  1228. /* PMU_Status Description of GYRO - Reg Addr --> (0x03), Bit --> 3...2 */
  1229. #define BMI160_USER_GYRO_POWER_MODE_STAT__POS (2)
  1230. #define BMI160_USER_GYRO_POWER_MODE_STAT__LEN (2)
  1231. #define BMI160_USER_GYRO_POWER_MODE_STAT__MSK (0x0C)
  1232. #define BMI160_USER_GYRO_POWER_MODE_STAT__REG \
  1233. (BMI160_USER_PMU_STAT_ADDR)
  1234. /**************************************************************/
  1235. /**\name ACCEL POWER MODE LENGTH, POSITION AND MASK */
  1236. /**************************************************************/
  1237. /* PMU_Status Description of ACCEL - Reg Addr --> (0x03), Bit --> 5...4 */
  1238. #define BMI160_USER_ACCEL_POWER_MODE_STAT__POS (4)
  1239. #define BMI160_USER_ACCEL_POWER_MODE_STAT__LEN (2)
  1240. #define BMI160_USER_ACCEL_POWER_MODE_STAT__MSK (0x30)
  1241. #define BMI160_USER_ACCEL_POWER_MODE_STAT__REG \
  1242. (BMI160_USER_PMU_STAT_ADDR)
  1243. /**************************************************************/
  1244. /**\name MAG DATA XYZ LENGTH, POSITION AND MASK */
  1245. /**************************************************************/
  1246. /* Mag_X(LSB) Description - Reg Addr --> (0x04), Bit --> 0...7 */
  1247. #define BMI160_USER_DATA_0_MAG_X_LSB__POS (0)
  1248. #define BMI160_USER_DATA_0_MAG_X_LSB__LEN (8)
  1249. #define BMI160_USER_DATA_0_MAG_X_LSB__MSK (0xFF)
  1250. #define BMI160_USER_DATA_0_MAG_X_LSB__REG (BMI160_USER_DATA_0_ADDR)
  1251. /* Mag_X(LSB) Description - Reg Addr --> (0x04), Bit --> 3...7 */
  1252. #define BMI160_USER_DATA_MAG_X_LSB__POS (3)
  1253. #define BMI160_USER_DATA_MAG_X_LSB__LEN (5)
  1254. #define BMI160_USER_DATA_MAG_X_LSB__MSK (0xF8)
  1255. #define BMI160_USER_DATA_MAG_X_LSB__REG (BMI160_USER_DATA_0_ADDR)
  1256. /* Mag_X(MSB) Description - Reg Addr --> (0x05), Bit --> 0...7 */
  1257. #define BMI160_USER_DATA_1_MAG_X_MSB__POS (0)
  1258. #define BMI160_USER_DATA_1_MAG_X_MSB__LEN (8)
  1259. #define BMI160_USER_DATA_1_MAG_X_MSB__MSK (0xFF)
  1260. #define BMI160_USER_DATA_1_MAG_X_MSB__REG (BMI160_USER_DATA_1_ADDR)
  1261. /* Mag_Y(LSB) Description - Reg Addr --> (0x06), Bit --> 0...7 */
  1262. #define BMI160_USER_DATA_2_MAG_Y_LSB__POS (0)
  1263. #define BMI160_USER_DATA_2_MAG_Y_LSB__LEN (8)
  1264. #define BMI160_USER_DATA_2_MAG_Y_LSB__MSK (0xFF)
  1265. #define BMI160_USER_DATA_2_MAG_Y_LSB__REG (BMI160_USER_DATA_2_ADDR)
  1266. /* Mag_Y(LSB) Description - Reg Addr --> (0x06), Bit --> 3...7 */
  1267. #define BMI160_USER_DATA_MAG_Y_LSB__POS (3)
  1268. #define BMI160_USER_DATA_MAG_Y_LSB__LEN (5)
  1269. #define BMI160_USER_DATA_MAG_Y_LSB__MSK (0xF8)
  1270. #define BMI160_USER_DATA_MAG_Y_LSB__REG (BMI160_USER_DATA_2_ADDR)
  1271. /* Mag_Y(MSB) Description - Reg Addr --> (0x07), Bit --> 0...7 */
  1272. #define BMI160_USER_DATA_3_MAG_Y_MSB__POS (0)
  1273. #define BMI160_USER_DATA_3_MAG_Y_MSB__LEN (8)
  1274. #define BMI160_USER_DATA_3_MAG_Y_MSB__MSK (0xFF)
  1275. #define BMI160_USER_DATA_3_MAG_Y_MSB__REG (BMI160_USER_DATA_3_ADDR)
  1276. /* Mag_Z(LSB) Description - Reg Addr --> (0x08), Bit --> 0...7 */
  1277. #define BMI160_USER_DATA_4_MAG_Z_LSB__POS (0)
  1278. #define BMI160_USER_DATA_4_MAG_Z_LSB__LEN (8)
  1279. #define BMI160_USER_DATA_4_MAG_Z_LSB__MSK (0xFF)
  1280. #define BMI160_USER_DATA_4_MAG_Z_LSB__REG (BMI160_USER_DATA_4_ADDR)
  1281. /* Mag_X(LSB) Description - Reg Addr --> (0x08), Bit --> 3...7 */
  1282. #define BMI160_USER_DATA_MAG_Z_LSB__POS (1)
  1283. #define BMI160_USER_DATA_MAG_Z_LSB__LEN (7)
  1284. #define BMI160_USER_DATA_MAG_Z_LSB__MSK (0xFE)
  1285. #define BMI160_USER_DATA_MAG_Z_LSB__REG (BMI160_USER_DATA_4_ADDR)
  1286. /* Mag_Z(MSB) Description - Reg Addr --> (0x09), Bit --> 0...7 */
  1287. #define BMI160_USER_DATA_5_MAG_Z_MSB__POS (0)
  1288. #define BMI160_USER_DATA_5_MAG_Z_MSB__LEN (8)
  1289. #define BMI160_USER_DATA_5_MAG_Z_MSB__MSK (0xFF)
  1290. #define BMI160_USER_DATA_5_MAG_Z_MSB__REG (BMI160_USER_DATA_5_ADDR)
  1291. /* RHALL(LSB) Description - Reg Addr --> (0x0A), Bit --> 0...7 */
  1292. #define BMI160_USER_DATA_6_RHALL_LSB__POS (0)
  1293. #define BMI160_USER_DATA_6_RHALL_LSB__LEN (8)
  1294. #define BMI160_USER_DATA_6_RHALL_LSB__MSK (0xFF)
  1295. #define BMI160_USER_DATA_6_RHALL_LSB__REG (BMI160_USER_DATA_6_ADDR)
  1296. /* Mag_R(LSB) Description - Reg Addr --> (0x0A), Bit --> 3...7 */
  1297. #define BMI160_USER_DATA_MAG_R_LSB__POS (2)
  1298. #define BMI160_USER_DATA_MAG_R_LSB__LEN (6)
  1299. #define BMI160_USER_DATA_MAG_R_LSB__MSK (0xFC)
  1300. #define BMI160_USER_DATA_MAG_R_LSB__REG (BMI160_USER_DATA_6_ADDR)
  1301. /* RHALL(MSB) Description - Reg Addr --> (0x0B), Bit --> 0...7 */
  1302. #define BMI160_USER_DATA_7_RHALL_MSB__POS (0)
  1303. #define BMI160_USER_DATA_7_RHALL_MSB__LEN (8)
  1304. #define BMI160_USER_DATA_7_RHALL_MSB__MSK (0xFF)
  1305. #define BMI160_USER_DATA_7_RHALL_MSB__REG (BMI160_USER_DATA_7_ADDR)
  1306. /**************************************************************/
  1307. /**\name GYRO DATA XYZ LENGTH, POSITION AND MASK */
  1308. /**************************************************************/
  1309. /* GYR_X (LSB) Description - Reg Addr --> (0x0C), Bit --> 0...7 */
  1310. #define BMI160_USER_DATA_8_GYRO_X_LSB__POS (0)
  1311. #define BMI160_USER_DATA_8_GYRO_X_LSB__LEN (8)
  1312. #define BMI160_USER_DATA_8_GYRO_X_LSB__MSK (0xFF)
  1313. #define BMI160_USER_DATA_8_GYRO_X_LSB__REG (BMI160_USER_DATA_8_ADDR)
  1314. /* GYR_X (MSB) Description - Reg Addr --> (0x0D), Bit --> 0...7 */
  1315. #define BMI160_USER_DATA_9_GYRO_X_MSB__POS (0)
  1316. #define BMI160_USER_DATA_9_GYRO_X_MSB__LEN (8)
  1317. #define BMI160_USER_DATA_9_GYRO_X_MSB__MSK (0xFF)
  1318. #define BMI160_USER_DATA_9_GYRO_X_MSB__REG (BMI160_USER_DATA_9_ADDR)
  1319. /* GYR_Y (LSB) Description - Reg Addr --> 0x0E, Bit --> 0...7 */
  1320. #define BMI160_USER_DATA_10_GYRO_Y_LSB__POS (0)
  1321. #define BMI160_USER_DATA_10_GYRO_Y_LSB__LEN (8)
  1322. #define BMI160_USER_DATA_10_GYRO_Y_LSB__MSK (0xFF)
  1323. #define BMI160_USER_DATA_10_GYRO_Y_LSB__REG (BMI160_USER_DATA_10_ADDR)
  1324. /* GYR_Y (MSB) Description - Reg Addr --> (0x0F), Bit --> 0...7 */
  1325. #define BMI160_USER_DATA_11_GYRO_Y_MSB__POS (0)
  1326. #define BMI160_USER_DATA_11_GYRO_Y_MSB__LEN (8)
  1327. #define BMI160_USER_DATA_11_GYRO_Y_MSB__MSK (0xFF)
  1328. #define BMI160_USER_DATA_11_GYRO_Y_MSB__REG (BMI160_USER_DATA_11_ADDR)
  1329. /* GYR_Z (LSB) Description - Reg Addr --> (0x10), Bit --> 0...7 */
  1330. #define BMI160_USER_DATA_12_GYRO_Z_LSB__POS (0)
  1331. #define BMI160_USER_DATA_12_GYRO_Z_LSB__LEN (8)
  1332. #define BMI160_USER_DATA_12_GYRO_Z_LSB__MSK (0xFF)
  1333. #define BMI160_USER_DATA_12_GYRO_Z_LSB__REG (BMI160_USER_DATA_12_ADDR)
  1334. /* GYR_Z (MSB) Description - Reg Addr --> (0x11), Bit --> 0...7 */
  1335. #define BMI160_USER_DATA_13_GYRO_Z_MSB__POS (0)
  1336. #define BMI160_USER_DATA_13_GYRO_Z_MSB__LEN (8)
  1337. #define BMI160_USER_DATA_13_GYRO_Z_MSB__MSK (0xFF)
  1338. #define BMI160_USER_DATA_13_GYRO_Z_MSB__REG (BMI160_USER_DATA_13_ADDR)
  1339. /**************************************************************/
  1340. /**\name ACCEL DATA XYZ LENGTH, POSITION AND MASK */
  1341. /**************************************************************/
  1342. /* ACC_X (LSB) Description - Reg Addr --> (0x12), Bit --> 0...7 */
  1343. #define BMI160_USER_DATA_14_ACCEL_X_LSB__POS (0)
  1344. #define BMI160_USER_DATA_14_ACCEL_X_LSB__LEN (8)
  1345. #define BMI160_USER_DATA_14_ACCEL_X_LSB__MSK (0xFF)
  1346. #define BMI160_USER_DATA_14_ACCEL_X_LSB__REG (BMI160_USER_DATA_14_ADDR)
  1347. /* ACC_X (MSB) Description - Reg Addr --> 0x13, Bit --> 0...7 */
  1348. #define BMI160_USER_DATA_15_ACCEL_X_MSB__POS (0)
  1349. #define BMI160_USER_DATA_15_ACCEL_X_MSB__LEN (8)
  1350. #define BMI160_USER_DATA_15_ACCEL_X_MSB__MSK (0xFF)
  1351. #define BMI160_USER_DATA_15_ACCEL_X_MSB__REG (BMI160_USER_DATA_15_ADDR)
  1352. /* ACC_Y (LSB) Description - Reg Addr --> (0x14), Bit --> 0...7 */
  1353. #define BMI160_USER_DATA_16_ACCEL_Y_LSB__POS (0)
  1354. #define BMI160_USER_DATA_16_ACCEL_Y_LSB__LEN (8)
  1355. #define BMI160_USER_DATA_16_ACCEL_Y_LSB__MSK (0xFF)
  1356. #define BMI160_USER_DATA_16_ACCEL_Y_LSB__REG (BMI160_USER_DATA_16_ADDR)
  1357. /* ACC_Y (MSB) Description - Reg Addr --> (0x15), Bit --> 0...7 */
  1358. #define BMI160_USER_DATA_17_ACCEL_Y_MSB__POS (0)
  1359. #define BMI160_USER_DATA_17_ACCEL_Y_MSB__LEN (8)
  1360. #define BMI160_USER_DATA_17_ACCEL_Y_MSB__MSK (0xFF)
  1361. #define BMI160_USER_DATA_17_ACCEL_Y_MSB__REG (BMI160_USER_DATA_17_ADDR)
  1362. /* ACC_Z (LSB) Description - Reg Addr --> 0x16, Bit --> 0...7 */
  1363. #define BMI160_USER_DATA_18_ACCEL_Z_LSB__POS (0)
  1364. #define BMI160_USER_DATA_18_ACCEL_Z_LSB__LEN (8)
  1365. #define BMI160_USER_DATA_18_ACCEL_Z_LSB__MSK (0xFF)
  1366. #define BMI160_USER_DATA_18_ACCEL_Z_LSB__REG (BMI160_USER_DATA_18_ADDR)
  1367. /* ACC_Z (MSB) Description - Reg Addr --> (0x17), Bit --> 0...7 */
  1368. #define BMI160_USER_DATA_19_ACCEL_Z_MSB__POS (0)
  1369. #define BMI160_USER_DATA_19_ACCEL_Z_MSB__LEN (8)
  1370. #define BMI160_USER_DATA_19_ACCEL_Z_MSB__MSK (0xFF)
  1371. #define BMI160_USER_DATA_19_ACCEL_Z_MSB__REG (BMI160_USER_DATA_19_ADDR)
  1372. /**************************************************************/
  1373. /**\name SENSOR TIME LENGTH, POSITION AND MASK */
  1374. /**************************************************************/
  1375. /* SENSORTIME_0 (LSB) Description - Reg Addr --> (0x18), Bit --> 0...7 */
  1376. #define BMI160_USER_SENSORTIME_0_SENSOR_TIME_LSB__POS (0)
  1377. #define BMI160_USER_SENSORTIME_0_SENSOR_TIME_LSB__LEN (8)
  1378. #define BMI160_USER_SENSORTIME_0_SENSOR_TIME_LSB__MSK (0xFF)
  1379. #define BMI160_USER_SENSORTIME_0_SENSOR_TIME_LSB__REG \
  1380. (BMI160_USER_SENSORTIME_0_ADDR)
  1381. /* SENSORTIME_1 (MSB) Description - Reg Addr --> (0x19), Bit --> 0...7 */
  1382. #define BMI160_USER_SENSORTIME_1_SENSOR_TIME_MSB__POS (0)
  1383. #define BMI160_USER_SENSORTIME_1_SENSOR_TIME_MSB__LEN (8)
  1384. #define BMI160_USER_SENSORTIME_1_SENSOR_TIME_MSB__MSK (0xFF)
  1385. #define BMI160_USER_SENSORTIME_1_SENSOR_TIME_MSB__REG \
  1386. (BMI160_USER_SENSORTIME_1_ADDR)
  1387. /* SENSORTIME_2 (MSB) Description - Reg Addr --> (0x1A), Bit --> 0...7 */
  1388. #define BMI160_USER_SENSORTIME_2_SENSOR_TIME_MSB__POS (0)
  1389. #define BMI160_USER_SENSORTIME_2_SENSOR_TIME_MSB__LEN (8)
  1390. #define BMI160_USER_SENSORTIME_2_SENSOR_TIME_MSB__MSK (0xFF)
  1391. #define BMI160_USER_SENSORTIME_2_SENSOR_TIME_MSB__REG \
  1392. (BMI160_USER_SENSORTIME_2_ADDR)
  1393. /**************************************************************/
  1394. /**\name GYRO SELF TEST LENGTH, POSITION AND MASK */
  1395. /**************************************************************/
  1396. /* Status Description - Reg Addr --> 0x1B, Bit --> 1 */
  1397. #define BMI160_USER_STAT_GYRO_SELFTEST_OK__POS (1)
  1398. #define BMI160_USER_STAT_GYRO_SELFTEST_OK__LEN (1)
  1399. #define BMI160_USER_STAT_GYRO_SELFTEST_OK__MSK (0x02)
  1400. #define BMI160_USER_STAT_GYRO_SELFTEST_OK__REG \
  1401. (BMI160_USER_STAT_ADDR)
  1402. /**************************************************************/
  1403. /**\name MAG MANUAL OPERATION LENGTH, POSITION AND MASK */
  1404. /**************************************************************/
  1405. /* Status Description - Reg Addr --> 0x1B, Bit --> 2 */
  1406. #define BMI160_USER_STAT_MAG_MANUAL_OPERATION__POS (2)
  1407. #define BMI160_USER_STAT_MAG_MANUAL_OPERATION__LEN (1)
  1408. #define BMI160_USER_STAT_MAG_MANUAL_OPERATION__MSK (0x04)
  1409. #define BMI160_USER_STAT_MAG_MANUAL_OPERATION__REG \
  1410. (BMI160_USER_STAT_ADDR)
  1411. /**************************************************************/
  1412. /**\name FOC STATUS LENGTH, POSITION AND MASK */
  1413. /**************************************************************/
  1414. /* Status Description - Reg Addr --> 0x1B, Bit --> 3 */
  1415. #define BMI160_USER_STAT_FOC_RDY__POS (3)
  1416. #define BMI160_USER_STAT_FOC_RDY__LEN (1)
  1417. #define BMI160_USER_STAT_FOC_RDY__MSK (0x08)
  1418. #define BMI160_USER_STAT_FOC_RDY__REG (BMI160_USER_STAT_ADDR)
  1419. /**************************************************************/
  1420. /**\name DATA READY LENGTH, POSITION AND MASK FOR ACCEL, MAG AND GYRO*/
  1421. /**************************************************************/
  1422. /* Status Description - Reg Addr --> 0x1B, Bit --> 5 */
  1423. #define BMI160_USER_STAT_DATA_RDY_MAG__POS (5)
  1424. #define BMI160_USER_STAT_DATA_RDY_MAG__LEN (1)
  1425. #define BMI160_USER_STAT_DATA_RDY_MAG__MSK (0x20)
  1426. #define BMI160_USER_STAT_DATA_RDY_MAG__REG (BMI160_USER_STAT_ADDR)
  1427. /* Status Description - Reg Addr --> 0x1B, Bit --> 6 */
  1428. #define BMI160_USER_STAT_DATA_RDY_GYRO__POS (6)
  1429. #define BMI160_USER_STAT_DATA_RDY_GYRO__LEN (1)
  1430. #define BMI160_USER_STAT_DATA_RDY_GYRO__MSK (0x40)
  1431. #define BMI160_USER_STAT_DATA_RDY_GYRO__REG (BMI160_USER_STAT_ADDR)
  1432. /* Status Description - Reg Addr --> 0x1B, Bit --> 7 */
  1433. #define BMI160_USER_STAT_DATA_RDY_ACCEL__POS (7)
  1434. #define BMI160_USER_STAT_DATA_RDY_ACCEL__LEN (1)
  1435. #define BMI160_USER_STAT_DATA_RDY_ACCEL__MSK (0x80)
  1436. #define BMI160_USER_STAT_DATA_RDY_ACCEL__REG (BMI160_USER_STAT_ADDR)
  1437. /**************************************************************/
  1438. /**\name INTERRUPT STATUS LENGTH, POSITION AND MASK */
  1439. /**************************************************************/
  1440. /* Int_Status_0 Description - Reg Addr --> 0x1C, Bit --> 0 */
  1441. #define BMI160_USER_INTR_STAT_0_STEP_INTR__POS (0)
  1442. #define BMI160_USER_INTR_STAT_0_STEP_INTR__LEN (1)
  1443. #define BMI160_USER_INTR_STAT_0_STEP_INTR__MSK (0x01)
  1444. #define BMI160_USER_INTR_STAT_0_STEP_INTR__REG \
  1445. (BMI160_USER_INTR_STAT_0_ADDR)
  1446. /**************************************************************/
  1447. /**\name SIGNIFICANT INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1448. /**************************************************************/
  1449. /* Int_Status_0 Description - Reg Addr --> 0x1C, Bit --> 1 */
  1450. #define BMI160_USER_INTR_STAT_0_SIGNIFICANT_INTR__POS (1)
  1451. #define BMI160_USER_INTR_STAT_0_SIGNIFICANT_INTR__LEN (1)
  1452. #define BMI160_USER_INTR_STAT_0_SIGNIFICANT_INTR__MSK (0x02)
  1453. #define BMI160_USER_INTR_STAT_0_SIGNIFICANT_INTR__REG \
  1454. (BMI160_USER_INTR_STAT_0_ADDR)
  1455. /**************************************************************/
  1456. /**\name ANY_MOTION INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1457. /**************************************************************/
  1458. /* Int_Status_0 Description - Reg Addr --> 0x1C, Bit --> 2 */
  1459. #define BMI160_USER_INTR_STAT_0_ANY_MOTION__POS (2)
  1460. #define BMI160_USER_INTR_STAT_0_ANY_MOTION__LEN (1)
  1461. #define BMI160_USER_INTR_STAT_0_ANY_MOTION__MSK (0x04)
  1462. #define BMI160_USER_INTR_STAT_0_ANY_MOTION__REG \
  1463. (BMI160_USER_INTR_STAT_0_ADDR)
  1464. /**************************************************************/
  1465. /**\name PMU TRIGGER INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1466. /**************************************************************/
  1467. /* Int_Status_0 Description - Reg Addr --> 0x1C, Bit --> 3 */
  1468. #define BMI160_USER_INTR_STAT_0_PMU_TRIGGER__POS 3
  1469. #define BMI160_USER_INTR_STAT_0_PMU_TRIGGER__LEN (1)
  1470. #define BMI160_USER_INTR_STAT_0_PMU_TRIGGER__MSK (0x08)
  1471. #define BMI160_USER_INTR_STAT_0_PMU_TRIGGER__REG \
  1472. (BMI160_USER_INTR_STAT_0_ADDR)
  1473. /**************************************************************/
  1474. /**\name DOUBLE TAP INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1475. /**************************************************************/
  1476. /* Int_Status_0 Description - Reg Addr --> 0x1C, Bit --> 4 */
  1477. #define BMI160_USER_INTR_STAT_0_DOUBLE_TAP_INTR__POS 4
  1478. #define BMI160_USER_INTR_STAT_0_DOUBLE_TAP_INTR__LEN (1)
  1479. #define BMI160_USER_INTR_STAT_0_DOUBLE_TAP_INTR__MSK (0x10)
  1480. #define BMI160_USER_INTR_STAT_0_DOUBLE_TAP_INTR__REG \
  1481. (BMI160_USER_INTR_STAT_0_ADDR)
  1482. /**************************************************************/
  1483. /**\name SINGLE TAP INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1484. /**************************************************************/
  1485. /* Int_Status_0 Description - Reg Addr --> 0x1C, Bit --> 5 */
  1486. #define BMI160_USER_INTR_STAT_0_SINGLE_TAP_INTR__POS 5
  1487. #define BMI160_USER_INTR_STAT_0_SINGLE_TAP_INTR__LEN (1)
  1488. #define BMI160_USER_INTR_STAT_0_SINGLE_TAP_INTR__MSK (0x20)
  1489. #define BMI160_USER_INTR_STAT_0_SINGLE_TAP_INTR__REG \
  1490. (BMI160_USER_INTR_STAT_0_ADDR)
  1491. /**************************************************************/
  1492. /**\name ORIENT INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1493. /**************************************************************/
  1494. /* Int_Status_0 Description - Reg Addr --> 0x1C, Bit --> 6 */
  1495. #define BMI160_USER_INTR_STAT_0_ORIENT__POS (6)
  1496. #define BMI160_USER_INTR_STAT_0_ORIENT__LEN (1)
  1497. #define BMI160_USER_INTR_STAT_0_ORIENT__MSK (0x40)
  1498. #define BMI160_USER_INTR_STAT_0_ORIENT__REG \
  1499. (BMI160_USER_INTR_STAT_0_ADDR)
  1500. /**************************************************************/
  1501. /**\name FLAT INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1502. /**************************************************************/
  1503. /* Int_Status_0 Description - Reg Addr --> 0x1C, Bit --> 7 */
  1504. #define BMI160_USER_INTR_STAT_0_FLAT__POS (7)
  1505. #define BMI160_USER_INTR_STAT_0_FLAT__LEN (1)
  1506. #define BMI160_USER_INTR_STAT_0_FLAT__MSK (0x80)
  1507. #define BMI160_USER_INTR_STAT_0_FLAT__REG \
  1508. (BMI160_USER_INTR_STAT_0_ADDR)
  1509. /**************************************************************/
  1510. /**\name HIGH_G INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1511. /**************************************************************/
  1512. /* Int_Status_1 Description - Reg Addr --> 0x1D, Bit --> 2 */
  1513. #define BMI160_USER_INTR_STAT_1_HIGH_G_INTR__POS (2)
  1514. #define BMI160_USER_INTR_STAT_1_HIGH_G_INTR__LEN (1)
  1515. #define BMI160_USER_INTR_STAT_1_HIGH_G_INTR__MSK (0x04)
  1516. #define BMI160_USER_INTR_STAT_1_HIGH_G_INTR__REG \
  1517. (BMI160_USER_INTR_STAT_1_ADDR)
  1518. /**************************************************************/
  1519. /**\name LOW_G INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1520. /**************************************************************/
  1521. /* Int_Status_1 Description - Reg Addr --> 0x1D, Bit --> 3 */
  1522. #define BMI160_USER_INTR_STAT_1_LOW_G_INTR__POS (3)
  1523. #define BMI160_USER_INTR_STAT_1_LOW_G_INTR__LEN (1)
  1524. #define BMI160_USER_INTR_STAT_1_LOW_G_INTR__MSK (0x08)
  1525. #define BMI160_USER_INTR_STAT_1_LOW_G_INTR__REG \
  1526. (BMI160_USER_INTR_STAT_1_ADDR)
  1527. /**************************************************************/
  1528. /**\name DATA READY INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1529. /**************************************************************/
  1530. /* Int_Status_1 Description - Reg Addr --> 0x1D, Bit --> 4 */
  1531. #define BMI160_USER_INTR_STAT_1_DATA_RDY_INTR__POS (4)
  1532. #define BMI160_USER_INTR_STAT_1_DATA_RDY_INTR__LEN (1)
  1533. #define BMI160_USER_INTR_STAT_1_DATA_RDY_INTR__MSK (0x10)
  1534. #define BMI160_USER_INTR_STAT_1_DATA_RDY_INTR__REG \
  1535. (BMI160_USER_INTR_STAT_1_ADDR)
  1536. /**************************************************************/
  1537. /**\name FIFO FULL INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1538. /**************************************************************/
  1539. /* Int_Status_1 Description - Reg Addr --> 0x1D, Bit --> 5 */
  1540. #define BMI160_USER_INTR_STAT_1_FIFO_FULL_INTR__POS (5)
  1541. #define BMI160_USER_INTR_STAT_1_FIFO_FULL_INTR__LEN (1)
  1542. #define BMI160_USER_INTR_STAT_1_FIFO_FULL_INTR__MSK (0x20)
  1543. #define BMI160_USER_INTR_STAT_1_FIFO_FULL_INTR__REG \
  1544. (BMI160_USER_INTR_STAT_1_ADDR)
  1545. /**************************************************************/
  1546. /**\name FIFO WATERMARK INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1547. /**************************************************************/
  1548. /* Int_Status_1 Description - Reg Addr --> 0x1D, Bit --> 6 */
  1549. #define BMI160_USER_INTR_STAT_1_FIFO_WM_INTR__POS (6)
  1550. #define BMI160_USER_INTR_STAT_1_FIFO_WM_INTR__LEN (1)
  1551. #define BMI160_USER_INTR_STAT_1_FIFO_WM_INTR__MSK (0x40)
  1552. #define BMI160_USER_INTR_STAT_1_FIFO_WM_INTR__REG \
  1553. (BMI160_USER_INTR_STAT_1_ADDR)
  1554. /**************************************************************/
  1555. /**\name NO MOTION INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1556. /**************************************************************/
  1557. /* Int_Status_1 Description - Reg Addr --> 0x1D, Bit --> 7 */
  1558. #define BMI160_USER_INTR_STAT_1_NOMOTION_INTR__POS (7)
  1559. #define BMI160_USER_INTR_STAT_1_NOMOTION_INTR__LEN (1)
  1560. #define BMI160_USER_INTR_STAT_1_NOMOTION_INTR__MSK (0x80)
  1561. #define BMI160_USER_INTR_STAT_1_NOMOTION_INTR__REG \
  1562. (BMI160_USER_INTR_STAT_1_ADDR)
  1563. /**************************************************************/
  1564. /**\name ANY MOTION-XYZ AXIS INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1565. /**************************************************************/
  1566. /* Int_Status_2 Description - Reg Addr --> 0x1E, Bit --> 0 */
  1567. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_X__POS (0)
  1568. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_X__LEN (1)
  1569. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_X__MSK (0x01)
  1570. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_X__REG \
  1571. (BMI160_USER_INTR_STAT_2_ADDR)
  1572. /* Int_Status_2 Description - Reg Addr --> 0x1E, Bit --> 1 */
  1573. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_Y__POS (1)
  1574. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_Y__LEN (1)
  1575. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_Y__MSK (0x02)
  1576. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_Y__REG \
  1577. (BMI160_USER_INTR_STAT_2_ADDR)
  1578. /* Int_Status_2 Description - Reg Addr --> 0x1E, Bit --> 2 */
  1579. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_Z__POS (2)
  1580. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_Z__LEN (1)
  1581. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_Z__MSK (0x04)
  1582. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_Z__REG \
  1583. (BMI160_USER_INTR_STAT_2_ADDR)
  1584. /**************************************************************/
  1585. /**\name ANY MOTION SIGN LENGTH, POSITION AND MASK*/
  1586. /**************************************************************/
  1587. /* Int_Status_2 Description - Reg Addr --> 0x1E, Bit --> 3 */
  1588. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_SIGN__POS (3)
  1589. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_SIGN__LEN (1)
  1590. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_SIGN__MSK (0x08)
  1591. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_SIGN__REG \
  1592. (BMI160_USER_INTR_STAT_2_ADDR)
  1593. /**************************************************************/
  1594. /**\name TAP_XYZ AND SIGN LENGTH, POSITION AND MASK*/
  1595. /**************************************************************/
  1596. /* Int_Status_2 Description - Reg Addr --> 0x1E, Bit --> 4 */
  1597. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_X__POS (4)
  1598. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_X__LEN (1)
  1599. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_X__MSK (0x10)
  1600. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_X__REG \
  1601. (BMI160_USER_INTR_STAT_2_ADDR)
  1602. /* Int_Status_2 Description - Reg Addr --> 0x1E, Bit --> 5 */
  1603. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_Y__POS (5)
  1604. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_Y__LEN (1)
  1605. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_Y__MSK (0x20)
  1606. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_Y__REG \
  1607. (BMI160_USER_INTR_STAT_2_ADDR)
  1608. /* Int_Status_2 Description - Reg Addr --> 0x1E, Bit --> 6 */
  1609. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_Z__POS (6)
  1610. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_Z__LEN (1)
  1611. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_Z__MSK (0x40)
  1612. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_Z__REG \
  1613. (BMI160_USER_INTR_STAT_2_ADDR)
  1614. /* Int_Status_2 Description - Reg Addr --> 0x1E, Bit --> 7 */
  1615. #define BMI160_USER_INTR_STAT_2_TAP_SIGN__POS (7)
  1616. #define BMI160_USER_INTR_STAT_2_TAP_SIGN__LEN (1)
  1617. #define BMI160_USER_INTR_STAT_2_TAP_SIGN__MSK (0x80)
  1618. #define BMI160_USER_INTR_STAT_2_TAP_SIGN__REG \
  1619. (BMI160_USER_INTR_STAT_2_ADDR)
  1620. /**************************************************************/
  1621. /**\name INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1622. /**************************************************************/
  1623. /* Int_Status_2 Description - Reg Addr --> 0x1E, Bit --> 0...7 */
  1624. #define BMI160_USER_INTR_STAT_2__POS (0)
  1625. #define BMI160_USER_INTR_STAT_2__LEN (8)
  1626. #define BMI160_USER_INTR_STAT_2__MSK (0xFF)
  1627. #define BMI160_USER_INTR_STAT_2__REG \
  1628. (BMI160_USER_INTR_STAT_2_ADDR)
  1629. /**************************************************************/
  1630. /**\name HIGH_G-XYZ AND SIGN LENGTH, POSITION AND MASK*/
  1631. /**************************************************************/
  1632. /* Int_Status_3 Description - Reg Addr --> (0x1F), Bit --> 0 */
  1633. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_X__POS (0)
  1634. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_X__LEN (1)
  1635. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_X__MSK (0x01)
  1636. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_X__REG \
  1637. (BMI160_USER_INTR_STAT_3_ADDR)
  1638. /* Int_Status_3 Description - Reg Addr --> 0x1E, Bit --> 1 */
  1639. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_Y__POS (1)
  1640. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_Y__LEN (1)
  1641. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_Y__MSK (0x02)
  1642. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_Y__REG \
  1643. (BMI160_USER_INTR_STAT_3_ADDR)
  1644. /* Int_Status_3 Description - Reg Addr --> (0x1F), Bit --> 2 */
  1645. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_Z__POS (2)
  1646. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_Z__LEN (1)
  1647. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_Z__MSK (0x04)
  1648. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_Z__REG \
  1649. (BMI160_USER_INTR_STAT_3_ADDR)
  1650. /* Int_Status_3 Description - Reg Addr --> (0x1F), Bit --> 3 */
  1651. #define BMI160_USER_INTR_STAT_3_HIGH_G_SIGN__POS (3)
  1652. #define BMI160_USER_INTR_STAT_3_HIGH_G_SIGN__LEN (1)
  1653. #define BMI160_USER_INTR_STAT_3_HIGH_G_SIGN__MSK (0x08)
  1654. #define BMI160_USER_INTR_STAT_3_HIGH_G_SIGN__REG \
  1655. (BMI160_USER_INTR_STAT_3_ADDR)
  1656. /**************************************************************/
  1657. /**\name ORIENT XY and Z AXIS LENGTH, POSITION AND MASK*/
  1658. /**************************************************************/
  1659. /* Int_Status_3 Description - Reg Addr --> (0x1F), Bit --> 4...5 */
  1660. #define BMI160_USER_INTR_STAT_3_ORIENT_XY__POS (4)
  1661. #define BMI160_USER_INTR_STAT_3_ORIENT_XY__LEN (2)
  1662. #define BMI160_USER_INTR_STAT_3_ORIENT_XY__MSK (0x30)
  1663. #define BMI160_USER_INTR_STAT_3_ORIENT_XY__REG \
  1664. (BMI160_USER_INTR_STAT_3_ADDR)
  1665. /* Int_Status_3 Description - Reg Addr --> (0x1F), Bit --> 6 */
  1666. #define BMI160_USER_INTR_STAT_3_ORIENT_Z__POS (6)
  1667. #define BMI160_USER_INTR_STAT_3_ORIENT_Z__LEN (1)
  1668. #define BMI160_USER_INTR_STAT_3_ORIENT_Z__MSK (0x40)
  1669. #define BMI160_USER_INTR_STAT_3_ORIENT_Z__REG \
  1670. (BMI160_USER_INTR_STAT_3_ADDR)
  1671. /**************************************************************/
  1672. /**\name FLAT LENGTH, POSITION AND MASK*/
  1673. /**************************************************************/
  1674. /* Int_Status_3 Description - Reg Addr --> (0x1F), Bit --> 7 */
  1675. #define BMI160_USER_INTR_STAT_3_FLAT__POS (7)
  1676. #define BMI160_USER_INTR_STAT_3_FLAT__LEN (1)
  1677. #define BMI160_USER_INTR_STAT_3_FLAT__MSK (0x80)
  1678. #define BMI160_USER_INTR_STAT_3_FLAT__REG \
  1679. (BMI160_USER_INTR_STAT_3_ADDR)
  1680. /**************************************************************/
  1681. /**\name (0x1F) LENGTH, POSITION AND MASK*/
  1682. /**************************************************************/
  1683. /* Int_Status_3 Description - Reg Addr --> (0x1F), Bit --> 0...7 */
  1684. #define BMI160_USER_INTR_STAT_3__POS (0)
  1685. #define BMI160_USER_INTR_STAT_3__LEN (8)
  1686. #define BMI160_USER_INTR_STAT_3__MSK (0xFF)
  1687. #define BMI160_USER_INTR_STAT_3__REG \
  1688. (BMI160_USER_INTR_STAT_3_ADDR)
  1689. /**************************************************************/
  1690. /**\name TEMPERATURE LENGTH, POSITION AND MASK*/
  1691. /**************************************************************/
  1692. /* Temperature Description - LSB Reg Addr --> (0x20), Bit --> 0...7 */
  1693. #define BMI160_USER_TEMP_LSB_VALUE__POS (0)
  1694. #define BMI160_USER_TEMP_LSB_VALUE__LEN (8)
  1695. #define BMI160_USER_TEMP_LSB_VALUE__MSK (0xFF)
  1696. #define BMI160_USER_TEMP_LSB_VALUE__REG \
  1697. (BMI160_USER_TEMPERATURE_0_ADDR)
  1698. /* Temperature Description - LSB Reg Addr --> 0x21, Bit --> 0...7 */
  1699. #define BMI160_USER_TEMP_MSB_VALUE__POS (0)
  1700. #define BMI160_USER_TEMP_MSB_VALUE__LEN (8)
  1701. #define BMI160_USER_TEMP_MSB_VALUE__MSK (0xFF)
  1702. #define BMI160_USER_TEMP_MSB_VALUE__REG \
  1703. (BMI160_USER_TEMPERATURE_1_ADDR)
  1704. #ifdef FIFO_ENABLE
  1705. /**************************************************************/
  1706. /**\name FIFO BYTE COUNTER LENGTH, POSITION AND MASK*/
  1707. /**************************************************************/
  1708. /* Fifo_Length0 Description - Reg Addr --> 0x22, Bit --> 0...7 */
  1709. #define BMI160_USER_FIFO_BYTE_COUNTER_LSB__POS (0)
  1710. #define BMI160_USER_FIFO_BYTE_COUNTER_LSB__LEN (8)
  1711. #define BMI160_USER_FIFO_BYTE_COUNTER_LSB__MSK (0xFF)
  1712. #define BMI160_USER_FIFO_BYTE_COUNTER_LSB__REG \
  1713. (BMI160_USER_FIFO_LENGTH_0_ADDR)
  1714. /*Fifo_Length1 Description - Reg Addr --> 0x23, Bit --> 0...2 */
  1715. #define BMI160_USER_FIFO_BYTE_COUNTER_MSB__POS (0)
  1716. #define BMI160_USER_FIFO_BYTE_COUNTER_MSB__LEN 3
  1717. #define BMI160_USER_FIFO_BYTE_COUNTER_MSB__MSK (0x07)
  1718. #define BMI160_USER_FIFO_BYTE_COUNTER_MSB__REG \
  1719. (BMI160_USER_FIFO_LENGTH_1_ADDR)
  1720. /**************************************************************/
  1721. /**\name FIFO DATA LENGTH, POSITION AND MASK*/
  1722. /**************************************************************/
  1723. /* Fifo_Data Description - Reg Addr --> 0x24, Bit --> 0...7 */
  1724. #define BMI160_USER_FIFO_DATA__POS (0)
  1725. #define BMI160_USER_FIFO_DATA__LEN (8)
  1726. #define BMI160_USER_FIFO_DATA__MSK (0xFF)
  1727. #define BMI160_USER_FIFO_DATA__REG (BMI160_USER_FIFO_DATA_ADDR)
  1728. #endif
  1729. /**************************************************************/
  1730. /**\name ACCEL CONFIGURATION LENGTH, POSITION AND MASK*/
  1731. /**************************************************************/
  1732. /* Acc_Conf Description - Reg Addr --> (0x40), Bit --> 0...3 */
  1733. #define BMI160_USER_ACCEL_CONFIG_OUTPUT_DATA_RATE__POS (0)
  1734. #define BMI160_USER_ACCEL_CONFIG_OUTPUT_DATA_RATE__LEN (4)
  1735. #define BMI160_USER_ACCEL_CONFIG_OUTPUT_DATA_RATE__MSK (0x0F)
  1736. #define BMI160_USER_ACCEL_CONFIG_OUTPUT_DATA_RATE__REG \
  1737. (BMI160_USER_ACCEL_CONFIG_ADDR)
  1738. /* Acc_Conf Description - Reg Addr --> (0x40), Bit --> 4...6 */
  1739. #define BMI160_USER_ACCEL_CONFIG_ACCEL_BW__POS (4)
  1740. #define BMI160_USER_ACCEL_CONFIG_ACCEL_BW__LEN (3)
  1741. #define BMI160_USER_ACCEL_CONFIG_ACCEL_BW__MSK (0x70)
  1742. #define BMI160_USER_ACCEL_CONFIG_ACCEL_BW__REG (BMI160_USER_ACCEL_CONFIG_ADDR)
  1743. /* Acc_Conf Description - Reg Addr --> (0x40), Bit --> 7 */
  1744. #define BMI160_USER_ACCEL_CONFIG_ACCEL_UNDER_SAMPLING__POS (7)
  1745. #define BMI160_USER_ACCEL_CONFIG_ACCEL_UNDER_SAMPLING__LEN (1)
  1746. #define BMI160_USER_ACCEL_CONFIG_ACCEL_UNDER_SAMPLING__MSK (0x80)
  1747. #define BMI160_USER_ACCEL_CONFIG_ACCEL_UNDER_SAMPLING__REG \
  1748. (BMI160_USER_ACCEL_CONFIG_ADDR)
  1749. /* Acc_Range Description - Reg Addr --> 0x41, Bit --> 0...3 */
  1750. #define BMI160_USER_ACCEL_RANGE__POS (0)
  1751. #define BMI160_USER_ACCEL_RANGE__LEN (4)
  1752. #define BMI160_USER_ACCEL_RANGE__MSK (0x0F)
  1753. #define BMI160_USER_ACCEL_RANGE__REG \
  1754. (BMI160_USER_ACCEL_RANGE_ADDR)
  1755. /**************************************************************/
  1756. /**\name GYRO CONFIGURATION LENGTH, POSITION AND MASK*/
  1757. /**************************************************************/
  1758. /* Gyro_Conf Description - Reg Addr --> (0x42), Bit --> 0...3 */
  1759. #define BMI160_USER_GYRO_CONFIG_OUTPUT_DATA_RATE__POS (0)
  1760. #define BMI160_USER_GYRO_CONFIG_OUTPUT_DATA_RATE__LEN (4)
  1761. #define BMI160_USER_GYRO_CONFIG_OUTPUT_DATA_RATE__MSK (0x0F)
  1762. #define BMI160_USER_GYRO_CONFIG_OUTPUT_DATA_RATE__REG \
  1763. (BMI160_USER_GYRO_CONFIG_ADDR)
  1764. /* Gyro_Conf Description - Reg Addr --> (0x42), Bit --> 4...5 */
  1765. #define BMI160_USER_GYRO_CONFIG_BW__POS (4)
  1766. #define BMI160_USER_GYRO_CONFIG_BW__LEN (2)
  1767. #define BMI160_USER_GYRO_CONFIG_BW__MSK (0x30)
  1768. #define BMI160_USER_GYRO_CONFIG_BW__REG \
  1769. (BMI160_USER_GYRO_CONFIG_ADDR)
  1770. /* Gyr_Range Description - Reg Addr --> 0x43, Bit --> 0...2 */
  1771. #define BMI160_USER_GYRO_RANGE__POS (0)
  1772. #define BMI160_USER_GYRO_RANGE__LEN (3)
  1773. #define BMI160_USER_GYRO_RANGE__MSK (0x07)
  1774. #define BMI160_USER_GYRO_RANGE__REG (BMI160_USER_GYRO_RANGE_ADDR)
  1775. /**************************************************************/
  1776. /**\name MAG CONFIGURATION LENGTH, POSITION AND MASK*/
  1777. /**************************************************************/
  1778. /* Mag_Conf Description - Reg Addr --> (0x44), Bit --> 0...3 */
  1779. #define BMI160_USER_MAG_CONFIG_OUTPUT_DATA_RATE__POS (0)
  1780. #define BMI160_USER_MAG_CONFIG_OUTPUT_DATA_RATE__LEN (4)
  1781. #define BMI160_USER_MAG_CONFIG_OUTPUT_DATA_RATE__MSK (0x0F)
  1782. #define BMI160_USER_MAG_CONFIG_OUTPUT_DATA_RATE__REG \
  1783. (BMI160_USER_MAG_CONFIG_ADDR)
  1784. #ifdef FIFO_ENABLE
  1785. /**************************************************************/
  1786. /**\name FIFO DOWNS LENGTH, POSITION AND MASK*/
  1787. /**************************************************************/
  1788. /* Fifo_Downs Description - Reg Addr --> 0x45, Bit --> 0...2 */
  1789. #define BMI160_USER_FIFO_DOWN_GYRO__POS (0)
  1790. #define BMI160_USER_FIFO_DOWN_GYRO__LEN (3)
  1791. #define BMI160_USER_FIFO_DOWN_GYRO__MSK (0x07)
  1792. #define BMI160_USER_FIFO_DOWN_GYRO__REG (BMI160_USER_FIFO_DOWN_ADDR)
  1793. /**************************************************************/
  1794. /**\name FIFO FILTER FOR ACCEL AND GYRO LENGTH, POSITION AND MASK*/
  1795. /**************************************************************/
  1796. /* Fifo_filter Description - Reg Addr --> 0x45, Bit --> 3 */
  1797. #define BMI160_USER_FIFO_FILTER_GYRO__POS (3)
  1798. #define BMI160_USER_FIFO_FILTER_GYRO__LEN (1)
  1799. #define BMI160_USER_FIFO_FILTER_GYRO__MSK (0x08)
  1800. #define BMI160_USER_FIFO_FILTER_GYRO__REG (BMI160_USER_FIFO_DOWN_ADDR)
  1801. /* Fifo_Downs Description - Reg Addr --> 0x45, Bit --> 4...6 */
  1802. #define BMI160_USER_FIFO_DOWN_ACCEL__POS (4)
  1803. #define BMI160_USER_FIFO_DOWN_ACCEL__LEN (3)
  1804. #define BMI160_USER_FIFO_DOWN_ACCEL__MSK (0x70)
  1805. #define BMI160_USER_FIFO_DOWN_ACCEL__REG (BMI160_USER_FIFO_DOWN_ADDR)
  1806. /* Fifo_FILT Description - Reg Addr --> 0x45, Bit --> 7 */
  1807. #define BMI160_USER_FIFO_FILTER_ACCEL__POS (7)
  1808. #define BMI160_USER_FIFO_FILTER_ACCEL__LEN (1)
  1809. #define BMI160_USER_FIFO_FILTER_ACCEL__MSK (0x80)
  1810. #define BMI160_USER_FIFO_FILTER_ACCEL__REG (BMI160_USER_FIFO_DOWN_ADDR)
  1811. /**************************************************************/
  1812. /**\name FIFO WATER MARK LENGTH, POSITION AND MASK*/
  1813. /**************************************************************/
  1814. /* Fifo_Config_0 Description - Reg Addr --> 0x46, Bit --> 0...7 */
  1815. #define BMI160_USER_FIFO_WM__POS (0)
  1816. #define BMI160_USER_FIFO_WM__LEN (8)
  1817. #define BMI160_USER_FIFO_WM__MSK (0xFF)
  1818. #define BMI160_USER_FIFO_WM__REG (BMI160_USER_FIFO_CONFIG_0_ADDR)
  1819. /**************************************************************/
  1820. /**\name FIFO TIME LENGTH, POSITION AND MASK*/
  1821. /**************************************************************/
  1822. /* Fifo_Config_1 Description - Reg Addr --> 0x47, Bit --> 1 */
  1823. #define BMI160_USER_FIFO_TIME_ENABLE__POS (1)
  1824. #define BMI160_USER_FIFO_TIME_ENABLE__LEN (1)
  1825. #define BMI160_USER_FIFO_TIME_ENABLE__MSK (0x02)
  1826. #define BMI160_USER_FIFO_TIME_ENABLE__REG (BMI160_USER_FIFO_CONFIG_1_ADDR)
  1827. /**************************************************************/
  1828. /**\name FIFO TAG INTERRUPT LENGTH, POSITION AND MASK*/
  1829. /**************************************************************/
  1830. /* Fifo_Config_1 Description - Reg Addr --> 0x47, Bit --> 2 */
  1831. #define BMI160_USER_FIFO_TAG_INTR2_ENABLE__POS (2)
  1832. #define BMI160_USER_FIFO_TAG_INTR2_ENABLE__LEN (1)
  1833. #define BMI160_USER_FIFO_TAG_INTR2_ENABLE__MSK (0x04)
  1834. #define BMI160_USER_FIFO_TAG_INTR2_ENABLE__REG (BMI160_USER_FIFO_CONFIG_1_ADDR)
  1835. /* Fifo_Config_1 Description - Reg Addr --> 0x47, Bit --> 3 */
  1836. #define BMI160_USER_FIFO_TAG_INTR1_ENABLE__POS (3)
  1837. #define BMI160_USER_FIFO_TAG_INTR1_ENABLE__LEN (1)
  1838. #define BMI160_USER_FIFO_TAG_INTR1_ENABLE__MSK (0x08)
  1839. #define BMI160_USER_FIFO_TAG_INTR1_ENABLE__REG (BMI160_USER_FIFO_CONFIG_1_ADDR)
  1840. /**************************************************************/
  1841. /**\name FIFO HEADER LENGTH, POSITION AND MASK*/
  1842. /**************************************************************/
  1843. /* Fifo_Config_1 Description - Reg Addr --> 0x47, Bit --> 4 */
  1844. #define BMI160_USER_FIFO_HEADER_ENABLE__POS (4)
  1845. #define BMI160_USER_FIFO_HEADER_ENABLE__LEN (1)
  1846. #define BMI160_USER_FIFO_HEADER_ENABLE__MSK (0x10)
  1847. #define BMI160_USER_FIFO_HEADER_ENABLE__REG \
  1848. (BMI160_USER_FIFO_CONFIG_1_ADDR)
  1849. /**************************************************************/
  1850. /**\name FIFO MAG ENABLE LENGTH, POSITION AND MASK*/
  1851. /**************************************************************/
  1852. /* Fifo_Config_1 Description - Reg Addr --> 0x47, Bit --> 5 */
  1853. #define BMI160_USER_FIFO_MAG_ENABLE__POS (5)
  1854. #define BMI160_USER_FIFO_MAG_ENABLE__LEN (1)
  1855. #define BMI160_USER_FIFO_MAG_ENABLE__MSK (0x20)
  1856. #define BMI160_USER_FIFO_MAG_ENABLE__REG \
  1857. (BMI160_USER_FIFO_CONFIG_1_ADDR)
  1858. /**************************************************************/
  1859. /**\name FIFO ACCEL ENABLE LENGTH, POSITION AND MASK*/
  1860. /**************************************************************/
  1861. /* Fifo_Config_1 Description - Reg Addr --> 0x47, Bit --> 6 */
  1862. #define BMI160_USER_FIFO_ACCEL_ENABLE__POS (6)
  1863. #define BMI160_USER_FIFO_ACCEL_ENABLE__LEN (1)
  1864. #define BMI160_USER_FIFO_ACCEL_ENABLE__MSK (0x40)
  1865. #define BMI160_USER_FIFO_ACCEL_ENABLE__REG \
  1866. (BMI160_USER_FIFO_CONFIG_1_ADDR)
  1867. /**************************************************************/
  1868. /**\name FIFO GYRO ENABLE LENGTH, POSITION AND MASK*/
  1869. /**************************************************************/
  1870. /* Fifo_Config_1 Description - Reg Addr --> 0x47, Bit --> 7 */
  1871. #define BMI160_USER_FIFO_GYRO_ENABLE__POS (7)
  1872. #define BMI160_USER_FIFO_GYRO_ENABLE__LEN (1)
  1873. #define BMI160_USER_FIFO_GYRO_ENABLE__MSK (0x80)
  1874. #define BMI160_USER_FIFO_GYRO_ENABLE__REG \
  1875. (BMI160_USER_FIFO_CONFIG_1_ADDR)
  1876. #endif
  1877. /**************************************************************/
  1878. /**\name MAG I2C ADDRESS SELECTION LENGTH, POSITION AND MASK*/
  1879. /**************************************************************/
  1880. /* Mag_IF_0 Description - Reg Addr --> 0x4b, Bit --> 1...7 */
  1881. #define BMI160_USER_I2C_DEVICE_ADDR__POS (1)
  1882. #define BMI160_USER_I2C_DEVICE_ADDR__LEN (7)
  1883. #define BMI160_USER_I2C_DEVICE_ADDR__MSK (0xFE)
  1884. #define BMI160_USER_I2C_DEVICE_ADDR__REG (BMI160_USER_MAG_IF_0_ADDR)
  1885. /**************************************************************/
  1886. /**\name MAG CONFIGURATION FOR SECONDARY
  1887. INTERFACE LENGTH, POSITION AND MASK*/
  1888. /**************************************************************/
  1889. /* Mag_IF_1 Description - Reg Addr --> 0x4c, Bit --> 0...1 */
  1890. #define BMI160_USER_MAG_BURST__POS (0)
  1891. #define BMI160_USER_MAG_BURST__LEN (2)
  1892. #define BMI160_USER_MAG_BURST__MSK (0x03)
  1893. #define BMI160_USER_MAG_BURST__REG (BMI160_USER_MAG_IF_1_ADDR)
  1894. /* Mag_IF_1 Description - Reg Addr --> 0x4c, Bit --> 2...5 */
  1895. #define BMI160_USER_MAG_OFFSET__POS (2)
  1896. #define BMI160_USER_MAG_OFFSET__LEN (4)
  1897. #define BMI160_USER_MAG_OFFSET__MSK (0x3C)
  1898. #define BMI160_USER_MAG_OFFSET__REG (BMI160_USER_MAG_IF_1_ADDR)
  1899. /* Mag_IF_1 Description - Reg Addr --> 0x4c, Bit --> 7 */
  1900. #define BMI160_USER_MAG_MANUAL_ENABLE__POS (7)
  1901. #define BMI160_USER_MAG_MANUAL_ENABLE__LEN (1)
  1902. #define BMI160_USER_MAG_MANUAL_ENABLE__MSK (0x80)
  1903. #define BMI160_USER_MAG_MANUAL_ENABLE__REG \
  1904. (BMI160_USER_MAG_IF_1_ADDR)
  1905. /* Mag_IF_2 Description - Reg Addr --> 0x4d, Bit -->0... 7 */
  1906. #define BMI160_USER_READ_ADDR__POS (0)
  1907. #define BMI160_USER_READ_ADDR__LEN (8)
  1908. #define BMI160_USER_READ_ADDR__MSK (0xFF)
  1909. #define BMI160_USER_READ_ADDR__REG (BMI160_USER_MAG_IF_2_ADDR)
  1910. /* Mag_IF_3 Description - Reg Addr --> 0x4e, Bit -->0... 7 */
  1911. #define BMI160_USER_WRITE_ADDR__POS (0)
  1912. #define BMI160_USER_WRITE_ADDR__LEN (8)
  1913. #define BMI160_USER_WRITE_ADDR__MSK (0xFF)
  1914. #define BMI160_USER_WRITE_ADDR__REG (BMI160_USER_MAG_IF_3_ADDR)
  1915. /* Mag_IF_4 Description - Reg Addr --> 0x4f, Bit -->0... 7 */
  1916. #define BMI160_USER_WRITE_DATA__POS (0)
  1917. #define BMI160_USER_WRITE_DATA__LEN (8)
  1918. #define BMI160_USER_WRITE_DATA__MSK (0xFF)
  1919. #define BMI160_USER_WRITE_DATA__REG (BMI160_USER_MAG_IF_4_ADDR)
  1920. /**************************************************************/
  1921. /**\name ANY MOTION XYZ AXIS ENABLE LENGTH, POSITION AND MASK*/
  1922. /**************************************************************/
  1923. /* Int_En_0 Description - Reg Addr --> 0x50, Bit -->0 */
  1924. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_X_ENABLE__POS (0)
  1925. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_X_ENABLE__LEN (1)
  1926. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_X_ENABLE__MSK (0x01)
  1927. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_X_ENABLE__REG \
  1928. (BMI160_USER_INTR_ENABLE_0_ADDR)
  1929. /* Int_En_0 Description - Reg Addr --> 0x50, Bit -->1 */
  1930. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_Y_ENABLE__POS (1)
  1931. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_Y_ENABLE__LEN (1)
  1932. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_Y_ENABLE__MSK (0x02)
  1933. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_Y_ENABLE__REG \
  1934. (BMI160_USER_INTR_ENABLE_0_ADDR)
  1935. /* Int_En_0 Description - Reg Addr --> 0x50, Bit -->2 */
  1936. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_Z_ENABLE__POS (2)
  1937. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_Z_ENABLE__LEN (1)
  1938. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_Z_ENABLE__MSK (0x04)
  1939. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_Z_ENABLE__REG \
  1940. (BMI160_USER_INTR_ENABLE_0_ADDR)
  1941. /**************************************************************/
  1942. /**\name DOUBLE TAP ENABLE LENGTH, POSITION AND MASK*/
  1943. /**************************************************************/
  1944. /* Int_En_0 Description - Reg Addr --> 0x50, Bit -->4 */
  1945. #define BMI160_USER_INTR_ENABLE_0_DOUBLE_TAP_ENABLE__POS (4)
  1946. #define BMI160_USER_INTR_ENABLE_0_DOUBLE_TAP_ENABLE__LEN (1)
  1947. #define BMI160_USER_INTR_ENABLE_0_DOUBLE_TAP_ENABLE__MSK (0x10)
  1948. #define BMI160_USER_INTR_ENABLE_0_DOUBLE_TAP_ENABLE__REG \
  1949. (BMI160_USER_INTR_ENABLE_0_ADDR)
  1950. /**************************************************************/
  1951. /**\name SINGLE TAP ENABLE LENGTH, POSITION AND MASK*/
  1952. /**************************************************************/
  1953. /* Int_En_0 Description - Reg Addr --> 0x50, Bit -->5 */
  1954. #define BMI160_USER_INTR_ENABLE_0_SINGLE_TAP_ENABLE__POS (5)
  1955. #define BMI160_USER_INTR_ENABLE_0_SINGLE_TAP_ENABLE__LEN (1)
  1956. #define BMI160_USER_INTR_ENABLE_0_SINGLE_TAP_ENABLE__MSK (0x20)
  1957. #define BMI160_USER_INTR_ENABLE_0_SINGLE_TAP_ENABLE__REG \
  1958. (BMI160_USER_INTR_ENABLE_0_ADDR)
  1959. /**************************************************************/
  1960. /**\name ORIENT ENABLE LENGTH, POSITION AND MASK*/
  1961. /**************************************************************/
  1962. /* Int_En_0 Description - Reg Addr --> 0x50, Bit -->6 */
  1963. #define BMI160_USER_INTR_ENABLE_0_ORIENT_ENABLE__POS (6)
  1964. #define BMI160_USER_INTR_ENABLE_0_ORIENT_ENABLE__LEN (1)
  1965. #define BMI160_USER_INTR_ENABLE_0_ORIENT_ENABLE__MSK (0x40)
  1966. #define BMI160_USER_INTR_ENABLE_0_ORIENT_ENABLE__REG \
  1967. (BMI160_USER_INTR_ENABLE_0_ADDR)
  1968. /**************************************************************/
  1969. /**\name FLAT ENABLE LENGTH, POSITION AND MASK*/
  1970. /**************************************************************/
  1971. /* Int_En_0 Description - Reg Addr --> 0x50, Bit -->7 */
  1972. #define BMI160_USER_INTR_ENABLE_0_FLAT_ENABLE__POS (7)
  1973. #define BMI160_USER_INTR_ENABLE_0_FLAT_ENABLE__LEN (1)
  1974. #define BMI160_USER_INTR_ENABLE_0_FLAT_ENABLE__MSK (0x80)
  1975. #define BMI160_USER_INTR_ENABLE_0_FLAT_ENABLE__REG \
  1976. (BMI160_USER_INTR_ENABLE_0_ADDR)
  1977. /**************************************************************/
  1978. /**\name HIGH_G XYZ ENABLE LENGTH, POSITION AND MASK*/
  1979. /**************************************************************/
  1980. /* Int_En_1 Description - Reg Addr --> (0x51), Bit -->0 */
  1981. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_X_ENABLE__POS (0)
  1982. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_X_ENABLE__LEN (1)
  1983. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_X_ENABLE__MSK (0x01)
  1984. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_X_ENABLE__REG \
  1985. (BMI160_USER_INTR_ENABLE_1_ADDR)
  1986. /* Int_En_1 Description - Reg Addr --> (0x51), Bit -->1 */
  1987. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_Y_ENABLE__POS (1)
  1988. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_Y_ENABLE__LEN (1)
  1989. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_Y_ENABLE__MSK (0x02)
  1990. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_Y_ENABLE__REG \
  1991. (BMI160_USER_INTR_ENABLE_1_ADDR)
  1992. /* Int_En_1 Description - Reg Addr --> (0x51), Bit -->2 */
  1993. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_Z_ENABLE__POS (2)
  1994. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_Z_ENABLE__LEN (1)
  1995. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_Z_ENABLE__MSK (0x04)
  1996. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_Z_ENABLE__REG \
  1997. (BMI160_USER_INTR_ENABLE_1_ADDR)
  1998. /**************************************************************/
  1999. /**\name LOW_G ENABLE LENGTH, POSITION AND MASK*/
  2000. /**************************************************************/
  2001. /* Int_En_1 Description - Reg Addr --> (0x51), Bit -->3 */
  2002. #define BMI160_USER_INTR_ENABLE_1_LOW_G_ENABLE__POS (3)
  2003. #define BMI160_USER_INTR_ENABLE_1_LOW_G_ENABLE__LEN (1)
  2004. #define BMI160_USER_INTR_ENABLE_1_LOW_G_ENABLE__MSK (0x08)
  2005. #define BMI160_USER_INTR_ENABLE_1_LOW_G_ENABLE__REG \
  2006. (BMI160_USER_INTR_ENABLE_1_ADDR)
  2007. /**************************************************************/
  2008. /**\name DATA READY ENABLE LENGTH, POSITION AND MASK*/
  2009. /**************************************************************/
  2010. /* Int_En_1 Description - Reg Addr --> (0x51), Bit -->4 */
  2011. #define BMI160_USER_INTR_ENABLE_1_DATA_RDY_ENABLE__POS (4)
  2012. #define BMI160_USER_INTR_ENABLE_1_DATA_RDY_ENABLE__LEN (1)
  2013. #define BMI160_USER_INTR_ENABLE_1_DATA_RDY_ENABLE__MSK (0x10)
  2014. #define BMI160_USER_INTR_ENABLE_1_DATA_RDY_ENABLE__REG \
  2015. (BMI160_USER_INTR_ENABLE_1_ADDR)
  2016. #ifdef FIFO_ENABLE
  2017. /**************************************************************/
  2018. /**\name FIFO FULL AND WATER MARK ENABLE LENGTH, POSITION AND MASK*/
  2019. /**************************************************************/
  2020. /* Int_En_1 Description - Reg Addr --> (0x51), Bit -->5 */
  2021. #define BMI160_USER_INTR_ENABLE_1_FIFO_FULL_ENABLE__POS (5)
  2022. #define BMI160_USER_INTR_ENABLE_1_FIFO_FULL_ENABLE__LEN (1)
  2023. #define BMI160_USER_INTR_ENABLE_1_FIFO_FULL_ENABLE__MSK (0x20)
  2024. #define BMI160_USER_INTR_ENABLE_1_FIFO_FULL_ENABLE__REG \
  2025. (BMI160_USER_INTR_ENABLE_1_ADDR)
  2026. /* Int_En_1 Description - Reg Addr --> (0x51), Bit -->6 */
  2027. #define BMI160_USER_INTR_ENABLE_1_FIFO_WM_ENABLE__POS (6)
  2028. #define BMI160_USER_INTR_ENABLE_1_FIFO_WM_ENABLE__LEN (1)
  2029. #define BMI160_USER_INTR_ENABLE_1_FIFO_WM_ENABLE__MSK (0x40)
  2030. #define BMI160_USER_INTR_ENABLE_1_FIFO_WM_ENABLE__REG \
  2031. (BMI160_USER_INTR_ENABLE_1_ADDR)
  2032. #endif
  2033. /**************************************************************/
  2034. /**\name NO MOTION XYZ ENABLE LENGTH, POSITION AND MASK*/
  2035. /**************************************************************/
  2036. /* Int_En_2 Description - Reg Addr --> (0x52), Bit -->0 */
  2037. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_X_ENABLE__POS (0)
  2038. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_X_ENABLE__LEN (1)
  2039. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_X_ENABLE__MSK (0x01)
  2040. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_X_ENABLE__REG \
  2041. (BMI160_USER_INTR_ENABLE_2_ADDR)
  2042. /* Int_En_2 Description - Reg Addr --> (0x52), Bit -->1 */
  2043. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_Y_ENABLE__POS (1)
  2044. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_Y_ENABLE__LEN (1)
  2045. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_Y_ENABLE__MSK (0x02)
  2046. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_Y_ENABLE__REG \
  2047. (BMI160_USER_INTR_ENABLE_2_ADDR)
  2048. /* Int_En_2 Description - Reg Addr --> (0x52), Bit -->2 */
  2049. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_Z_ENABLE__POS (2)
  2050. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_Z_ENABLE__LEN (1)
  2051. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_Z_ENABLE__MSK (0x04)
  2052. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_Z_ENABLE__REG \
  2053. (BMI160_USER_INTR_ENABLE_2_ADDR)
  2054. /**************************************************************/
  2055. /**\name STEP DETECTOR ENABLE LENGTH, POSITION AND MASK*/
  2056. /**************************************************************/
  2057. /* Int_En_2 Description - Reg Addr --> (0x52), Bit -->3 */
  2058. #define BMI160_USER_INTR_ENABLE_2_STEP_DETECTOR_ENABLE__POS (3)
  2059. #define BMI160_USER_INTR_ENABLE_2_STEP_DETECTOR_ENABLE__LEN (1)
  2060. #define BMI160_USER_INTR_ENABLE_2_STEP_DETECTOR_ENABLE__MSK (0x08)
  2061. #define BMI160_USER_INTR_ENABLE_2_STEP_DETECTOR_ENABLE__REG \
  2062. (BMI160_USER_INTR_ENABLE_2_ADDR)
  2063. /**************************************************************/
  2064. /**\name EDGE CONTROL ENABLE LENGTH, POSITION AND MASK*/
  2065. /**************************************************************/
  2066. /* Int_Out_Ctrl Description - Reg Addr --> 0x53, Bit -->0 */
  2067. #define BMI160_USER_INTR1_EDGE_CTRL__POS (0)
  2068. #define BMI160_USER_INTR1_EDGE_CTRL__LEN (1)
  2069. #define BMI160_USER_INTR1_EDGE_CTRL__MSK (0x01)
  2070. #define BMI160_USER_INTR1_EDGE_CTRL__REG \
  2071. (BMI160_USER_INTR_OUT_CTRL_ADDR)
  2072. /**************************************************************/
  2073. /**\name LEVEL CONTROL ENABLE LENGTH, POSITION AND MASK*/
  2074. /**************************************************************/
  2075. /* Int_Out_Ctrl Description - Reg Addr --> 0x53, Bit -->1 */
  2076. #define BMI160_USER_INTR1_LEVEL__POS (1)
  2077. #define BMI160_USER_INTR1_LEVEL__LEN (1)
  2078. #define BMI160_USER_INTR1_LEVEL__MSK (0x02)
  2079. #define BMI160_USER_INTR1_LEVEL__REG \
  2080. (BMI160_USER_INTR_OUT_CTRL_ADDR)
  2081. /**************************************************************/
  2082. /**\name OUTPUT TYPE ENABLE LENGTH, POSITION AND MASK*/
  2083. /**************************************************************/
  2084. /* Int_Out_Ctrl Description - Reg Addr --> 0x53, Bit -->2 */
  2085. #define BMI160_USER_INTR1_OUTPUT_TYPE__POS (2)
  2086. #define BMI160_USER_INTR1_OUTPUT_TYPE__LEN (1)
  2087. #define BMI160_USER_INTR1_OUTPUT_TYPE__MSK (0x04)
  2088. #define BMI160_USER_INTR1_OUTPUT_TYPE__REG \
  2089. (BMI160_USER_INTR_OUT_CTRL_ADDR)
  2090. /**************************************************************/
  2091. /**\name OUTPUT TYPE ENABLE LENGTH, POSITION AND MASK*/
  2092. /**************************************************************/
  2093. /* Int_Out_Ctrl Description - Reg Addr --> 0x53, Bit -->3 */
  2094. #define BMI160_USER_INTR1_OUTPUT_ENABLE__POS (3)
  2095. #define BMI160_USER_INTR1_OUTPUT_ENABLE__LEN (1)
  2096. #define BMI160_USER_INTR1_OUTPUT_ENABLE__MSK (0x08)
  2097. #define BMI160_USER_INTR1_OUTPUT_ENABLE__REG \
  2098. (BMI160_USER_INTR_OUT_CTRL_ADDR)
  2099. /**************************************************************/
  2100. /**\name EDGE CONTROL ENABLE LENGTH, POSITION AND MASK*/
  2101. /**************************************************************/
  2102. /* Int_Out_Ctrl Description - Reg Addr --> 0x53, Bit -->4 */
  2103. #define BMI160_USER_INTR2_EDGE_CTRL__POS (4)
  2104. #define BMI160_USER_INTR2_EDGE_CTRL__LEN (1)
  2105. #define BMI160_USER_INTR2_EDGE_CTRL__MSK (0x10)
  2106. #define BMI160_USER_INTR2_EDGE_CTRL__REG \
  2107. (BMI160_USER_INTR_OUT_CTRL_ADDR)
  2108. /**************************************************************/
  2109. /**\name LEVEL CONTROL ENABLE LENGTH, POSITION AND MASK*/
  2110. /**************************************************************/
  2111. /* Int_Out_Ctrl Description - Reg Addr --> 0x53, Bit -->5 */
  2112. #define BMI160_USER_INTR2_LEVEL__POS (5)
  2113. #define BMI160_USER_INTR2_LEVEL__LEN (1)
  2114. #define BMI160_USER_INTR2_LEVEL__MSK (0x20)
  2115. #define BMI160_USER_INTR2_LEVEL__REG \
  2116. (BMI160_USER_INTR_OUT_CTRL_ADDR)
  2117. /**************************************************************/
  2118. /**\name OUTPUT TYPE ENABLE LENGTH, POSITION AND MASK*/
  2119. /**************************************************************/
  2120. /* Int_Out_Ctrl Description - Reg Addr --> 0x53, Bit -->6 */
  2121. #define BMI160_USER_INTR2_OUTPUT_TYPE__POS (6)
  2122. #define BMI160_USER_INTR2_OUTPUT_TYPE__LEN (1)
  2123. #define BMI160_USER_INTR2_OUTPUT_TYPE__MSK (0x40)
  2124. #define BMI160_USER_INTR2_OUTPUT_TYPE__REG \
  2125. (BMI160_USER_INTR_OUT_CTRL_ADDR)
  2126. /* Int_Out_Ctrl Description - Reg Addr --> 0x53, Bit -->7 */
  2127. #define BMI160_USER_INTR2_OUTPUT_EN__POS (7)
  2128. #define BMI160_USER_INTR2_OUTPUT_EN__LEN (1)
  2129. #define BMI160_USER_INTR2_OUTPUT_EN__MSK (0x80)
  2130. #define BMI160_USER_INTR2_OUTPUT_EN__REG \
  2131. (BMI160_USER_INTR_OUT_CTRL_ADDR)
  2132. /**************************************************************/
  2133. /**\name LATCH INTERRUPT LENGTH, POSITION AND MASK*/
  2134. /**************************************************************/
  2135. /* Int_Latch Description - Reg Addr --> 0x54, Bit -->0...3 */
  2136. #define BMI160_USER_INTR_LATCH__POS (0)
  2137. #define BMI160_USER_INTR_LATCH__LEN (4)
  2138. #define BMI160_USER_INTR_LATCH__MSK (0x0F)
  2139. #define BMI160_USER_INTR_LATCH__REG (BMI160_USER_INTR_LATCH_ADDR)
  2140. /**************************************************************/
  2141. /**\name INPUT ENABLE LENGTH, POSITION AND MASK*/
  2142. /**************************************************************/
  2143. /* Int_Latch Description - Reg Addr --> 0x54, Bit -->4 */
  2144. #define BMI160_USER_INTR1_INPUT_ENABLE__POS (4)
  2145. #define BMI160_USER_INTR1_INPUT_ENABLE__LEN (1)
  2146. #define BMI160_USER_INTR1_INPUT_ENABLE__MSK (0x10)
  2147. #define BMI160_USER_INTR1_INPUT_ENABLE__REG \
  2148. (BMI160_USER_INTR_LATCH_ADDR)
  2149. /* Int_Latch Description - Reg Addr --> 0x54, Bit -->5*/
  2150. #define BMI160_USER_INTR2_INPUT_ENABLE__POS (5)
  2151. #define BMI160_USER_INTR2_INPUT_ENABLE__LEN (1)
  2152. #define BMI160_USER_INTR2_INPUT_ENABLE__MSK (0x20)
  2153. #define BMI160_USER_INTR2_INPUT_ENABLE__REG \
  2154. (BMI160_USER_INTR_LATCH_ADDR)
  2155. /**************************************************************/
  2156. /**\name INTERRUPT1 MAPPING OF LOW_G LENGTH, POSITION AND MASK*/
  2157. /**************************************************************/
  2158. /* Int_Map_0 Description - Reg Addr --> 0x55, Bit -->0 */
  2159. #define BMI160_USER_INTR_MAP_0_INTR1_LOW_G__POS (0)
  2160. #define BMI160_USER_INTR_MAP_0_INTR1_LOW_G__LEN (1)
  2161. #define BMI160_USER_INTR_MAP_0_INTR1_LOW_G__MSK (0x01)
  2162. #define BMI160_USER_INTR_MAP_0_INTR1_LOW_G__REG (BMI160_USER_INTR_MAP_0_ADDR)
  2163. /**************************************************************/
  2164. /**\name INTERRUPT1 MAPPING OF HIGH_G LENGTH, POSITION AND MASK*/
  2165. /**************************************************************/
  2166. /* Int_Map_0 Description - Reg Addr --> 0x55, Bit -->1 */
  2167. #define BMI160_USER_INTR_MAP_0_INTR1_HIGH_G__POS (1)
  2168. #define BMI160_USER_INTR_MAP_0_INTR1_HIGH_G__LEN (1)
  2169. #define BMI160_USER_INTR_MAP_0_INTR1_HIGH_G__MSK (0x02)
  2170. #define BMI160_USER_INTR_MAP_0_INTR1_HIGH_G__REG \
  2171. (BMI160_USER_INTR_MAP_0_ADDR)
  2172. /**************************************************************/
  2173. /**\name INTERRUPT MAPPING OF ANY MOTION_G LENGTH, POSITION AND MASK*/
  2174. /**************************************************************/
  2175. /* Int_Map_0 Description - Reg Addr --> 0x55, Bit -->2 */
  2176. #define BMI160_USER_INTR_MAP_0_INTR1_ANY_MOTION__POS (2)
  2177. #define BMI160_USER_INTR_MAP_0_INTR1_ANY_MOTION__LEN (1)
  2178. #define BMI160_USER_INTR_MAP_0_INTR1_ANY_MOTION__MSK (0x04)
  2179. #define BMI160_USER_INTR_MAP_0_INTR1_ANY_MOTION__REG \
  2180. (BMI160_USER_INTR_MAP_0_ADDR)
  2181. /**************************************************************/
  2182. /**\name INTERRUPT1 MAPPING OF NO MOTION LENGTH, POSITION AND MASK*/
  2183. /**************************************************************/
  2184. /* Int_Map_0 Description - Reg Addr --> 0x55, Bit -->3 */
  2185. #define BMI160_USER_INTR_MAP_0_INTR1_NOMOTION__POS (3)
  2186. #define BMI160_USER_INTR_MAP_0_INTR1_NOMOTION__LEN (1)
  2187. #define BMI160_USER_INTR_MAP_0_INTR1_NOMOTION__MSK (0x08)
  2188. #define BMI160_USER_INTR_MAP_0_INTR1_NOMOTION__REG (BMI160_USER_INTR_MAP_0_ADDR)
  2189. /**************************************************************/
  2190. /**\name INTERRUPT1 MAPPING OF DOUBLE TAP LENGTH, POSITION AND MASK*/
  2191. /**************************************************************/
  2192. /* Int_Map_0 Description - Reg Addr --> 0x55, Bit -->4 */
  2193. #define BMI160_USER_INTR_MAP_0_INTR1_DOUBLE_TAP__POS (4)
  2194. #define BMI160_USER_INTR_MAP_0_INTR1_DOUBLE_TAP__LEN (1)
  2195. #define BMI160_USER_INTR_MAP_0_INTR1_DOUBLE_TAP__MSK (0x10)
  2196. #define BMI160_USER_INTR_MAP_0_INTR1_DOUBLE_TAP__REG \
  2197. (BMI160_USER_INTR_MAP_0_ADDR)
  2198. /**************************************************************/
  2199. /**\name INTERRUPT1 MAPPING OF SINGLE TAP LENGTH, POSITION AND MASK*/
  2200. /**************************************************************/
  2201. /* Int_Map_0 Description - Reg Addr --> 0x55, Bit -->5 */
  2202. #define BMI160_USER_INTR_MAP_0_INTR1_SINGLE_TAP__POS (5)
  2203. #define BMI160_USER_INTR_MAP_0_INTR1_SINGLE_TAP__LEN (1)
  2204. #define BMI160_USER_INTR_MAP_0_INTR1_SINGLE_TAP__MSK (0x20)
  2205. #define BMI160_USER_INTR_MAP_0_INTR1_SINGLE_TAP__REG \
  2206. (BMI160_USER_INTR_MAP_0_ADDR)
  2207. /**************************************************************/
  2208. /**\name INTERRUPT1 MAPPING OF ORIENT LENGTH, POSITION AND MASK*/
  2209. /**************************************************************/
  2210. /* Int_Map_0 Description - Reg Addr --> 0x55, Bit -->6 */
  2211. #define BMI160_USER_INTR_MAP_0_INTR1_ORIENT__POS (6)
  2212. #define BMI160_USER_INTR_MAP_0_INTR1_ORIENT__LEN (1)
  2213. #define BMI160_USER_INTR_MAP_0_INTR1_ORIENT__MSK (0x40)
  2214. #define BMI160_USER_INTR_MAP_0_INTR1_ORIENT__REG \
  2215. (BMI160_USER_INTR_MAP_0_ADDR)
  2216. /**************************************************************/
  2217. /**\name INTERRUPT MAPPING OF FLAT LENGTH, POSITION AND MASK*/
  2218. /**************************************************************/
  2219. /* Int_Map_0 Description - Reg Addr --> 0x56, Bit -->7 */
  2220. #define BMI160_USER_INTR_MAP_0_INTR1_FLAT__POS (7)
  2221. #define BMI160_USER_INTR_MAP_0_INTR1_FLAT__LEN (1)
  2222. #define BMI160_USER_INTR_MAP_0_INTR1_FLAT__MSK (0x80)
  2223. #define BMI160_USER_INTR_MAP_0_INTR1_FLAT__REG (BMI160_USER_INTR_MAP_0_ADDR)
  2224. /**************************************************************/
  2225. /**\name INTERRUPT1 MAPPING OF PMU TRIGGER LENGTH, POSITION AND MASK*/
  2226. /**************************************************************/
  2227. /* Int_Map_1 Description - Reg Addr --> 0x56, Bit -->0 */
  2228. #define BMI160_USER_INTR_MAP_1_INTR2_PMU_TRIG__POS (0)
  2229. #define BMI160_USER_INTR_MAP_1_INTR2_PMU_TRIG__LEN (1)
  2230. #define BMI160_USER_INTR_MAP_1_INTR2_PMU_TRIG__MSK (0x01)
  2231. #define BMI160_USER_INTR_MAP_1_INTR2_PMU_TRIG__REG (BMI160_USER_INTR_MAP_1_ADDR)
  2232. #ifdef FIFO_ENABLE
  2233. /**************************************************************/
  2234. /**\name INTERRUPT1 MAPPING OF FIFO FULL AND
  2235. WATER MARK LENGTH, POSITION AND MASK*/
  2236. /**************************************************************/
  2237. /* Int_Map_1 Description - Reg Addr --> 0x56, Bit -->1 */
  2238. #define BMI160_USER_INTR_MAP_1_INTR2_FIFO_FULL__POS (1)
  2239. #define BMI160_USER_INTR_MAP_1_INTR2_FIFO_FULL__LEN (1)
  2240. #define BMI160_USER_INTR_MAP_1_INTR2_FIFO_FULL__MSK (0x02)
  2241. #define BMI160_USER_INTR_MAP_1_INTR2_FIFO_FULL__REG \
  2242. (BMI160_USER_INTR_MAP_1_ADDR)
  2243. /* Int_Map_1 Description - Reg Addr --> 0x56, Bit -->2 */
  2244. #define BMI160_USER_INTR_MAP_1_INTR2_FIFO_WM__POS (2)
  2245. #define BMI160_USER_INTR_MAP_1_INTR2_FIFO_WM__LEN (1)
  2246. #define BMI160_USER_INTR_MAP_1_INTR2_FIFO_WM__MSK (0x04)
  2247. #define BMI160_USER_INTR_MAP_1_INTR2_FIFO_WM__REG \
  2248. (BMI160_USER_INTR_MAP_1_ADDR)
  2249. #endif
  2250. /**************************************************************/
  2251. /**\name INTERRUPT1 MAPPING OF DATA READY LENGTH, POSITION AND MASK*/
  2252. /**************************************************************/
  2253. /* Int_Map_1 Description - Reg Addr --> 0x56, Bit -->3 */
  2254. #define BMI160_USER_INTR_MAP_1_INTR2_DATA_RDY__POS (3)
  2255. #define BMI160_USER_INTR_MAP_1_INTR2_DATA_RDY__LEN (1)
  2256. #define BMI160_USER_INTR_MAP_1_INTR2_DATA_RDY__MSK (0x08)
  2257. #define BMI160_USER_INTR_MAP_1_INTR2_DATA_RDY__REG \
  2258. (BMI160_USER_INTR_MAP_1_ADDR)
  2259. /**************************************************************/
  2260. /**\name INTERRUPT1 MAPPING OF PMU TRIGGER LENGTH, POSITION AND MASK*/
  2261. /**************************************************************/
  2262. /* Int_Map_1 Description - Reg Addr --> 0x56, Bit -->4 */
  2263. #define BMI160_USER_INTR_MAP_1_INTR1_PMU_TRIG__POS (4)
  2264. #define BMI160_USER_INTR_MAP_1_INTR1_PMU_TRIG__LEN (1)
  2265. #define BMI160_USER_INTR_MAP_1_INTR1_PMU_TRIG__MSK (0x10)
  2266. #define BMI160_USER_INTR_MAP_1_INTR1_PMU_TRIG__REG (BMI160_USER_INTR_MAP_1_ADDR)
  2267. /**************************************************************/
  2268. /**\name INTERRUPT1 MAPPING OF FIFO FULL AND
  2269. WATER MARK LENGTH, POSITION AND MASK*/
  2270. /**************************************************************/
  2271. /* Int_Map_1 Description - Reg Addr --> 0x56, Bit -->5 */
  2272. #define BMI160_USER_INTR_MAP_1_INTR1_FIFO_FULL__POS (5)
  2273. #define BMI160_USER_INTR_MAP_1_INTR1_FIFO_FULL__LEN (1)
  2274. #define BMI160_USER_INTR_MAP_1_INTR1_FIFO_FULL__MSK (0x20)
  2275. #define BMI160_USER_INTR_MAP_1_INTR1_FIFO_FULL__REG \
  2276. (BMI160_USER_INTR_MAP_1_ADDR)
  2277. /* Int_Map_1 Description - Reg Addr --> 0x56, Bit -->6 */
  2278. #define BMI160_USER_INTR_MAP_1_INTR1_FIFO_WM__POS (6)
  2279. #define BMI160_USER_INTR_MAP_1_INTR1_FIFO_WM__LEN (1)
  2280. #define BMI160_USER_INTR_MAP_1_INTR1_FIFO_WM__MSK (0x40)
  2281. #define BMI160_USER_INTR_MAP_1_INTR1_FIFO_WM__REG \
  2282. (BMI160_USER_INTR_MAP_1_ADDR)
  2283. /**************************************************************/
  2284. /**\name INTERRUPT1 MAPPING OF DATA READY LENGTH, POSITION AND MASK*/
  2285. /**************************************************************/
  2286. /* Int_Map_1 Description - Reg Addr --> 0x56, Bit -->7 */
  2287. #define BMI160_USER_INTR_MAP_1_INTR1_DATA_RDY__POS (7)
  2288. #define BMI160_USER_INTR_MAP_1_INTR1_DATA_RDY__LEN (1)
  2289. #define BMI160_USER_INTR_MAP_1_INTR1_DATA_RDY__MSK (0x80)
  2290. #define BMI160_USER_INTR_MAP_1_INTR1_DATA_RDY__REG \
  2291. (BMI160_USER_INTR_MAP_1_ADDR)
  2292. /**************************************************************/
  2293. /**\name INTERRUPT2 MAPPING OF LOW_G LENGTH, POSITION AND MASK*/
  2294. /**************************************************************/
  2295. /* Int_Map_2 Description - Reg Addr --> 0x57, Bit -->0 */
  2296. #define BMI160_USER_INTR_MAP_2_INTR2_LOW_G__POS (0)
  2297. #define BMI160_USER_INTR_MAP_2_INTR2_LOW_G__LEN (1)
  2298. #define BMI160_USER_INTR_MAP_2_INTR2_LOW_G__MSK (0x01)
  2299. #define BMI160_USER_INTR_MAP_2_INTR2_LOW_G__REG (BMI160_USER_INTR_MAP_2_ADDR)
  2300. /**************************************************************/
  2301. /**\name INTERRUPT2 MAPPING OF HIGH_G LENGTH, POSITION AND MASK*/
  2302. /**************************************************************/
  2303. /* Int_Map_2 Description - Reg Addr --> 0x57, Bit -->1 */
  2304. #define BMI160_USER_INTR_MAP_2_INTR2_HIGH_G__POS (1)
  2305. #define BMI160_USER_INTR_MAP_2_INTR2_HIGH_G__LEN (1)
  2306. #define BMI160_USER_INTR_MAP_2_INTR2_HIGH_G__MSK (0x02)
  2307. #define BMI160_USER_INTR_MAP_2_INTR2_HIGH_G__REG \
  2308. (BMI160_USER_INTR_MAP_2_ADDR)
  2309. /**************************************************************/
  2310. /**\name INTERRUPT2 MAPPING OF ANY MOTION LENGTH, POSITION AND MASK*/
  2311. /**************************************************************/
  2312. /* Int_Map_2 Description - Reg Addr --> 0x57, Bit -->2 */
  2313. #define BMI160_USER_INTR_MAP_2_INTR2_ANY_MOTION__POS (2)
  2314. #define BMI160_USER_INTR_MAP_2_INTR2_ANY_MOTION__LEN (1)
  2315. #define BMI160_USER_INTR_MAP_2_INTR2_ANY_MOTION__MSK (0x04)
  2316. #define BMI160_USER_INTR_MAP_2_INTR2_ANY_MOTION__REG \
  2317. (BMI160_USER_INTR_MAP_2_ADDR)
  2318. /**************************************************************/
  2319. /**\name INTERRUPT2 MAPPING OF NO MOTION LENGTH, POSITION AND MASK*/
  2320. /**************************************************************/
  2321. /* Int_Map_2 Description - Reg Addr --> 0x57, Bit -->3 */
  2322. #define BMI160_USER_INTR_MAP_2_INTR2_NOMOTION__POS (3)
  2323. #define BMI160_USER_INTR_MAP_2_INTR2_NOMOTION__LEN (1)
  2324. #define BMI160_USER_INTR_MAP_2_INTR2_NOMOTION__MSK (0x08)
  2325. #define BMI160_USER_INTR_MAP_2_INTR2_NOMOTION__REG (BMI160_USER_INTR_MAP_2_ADDR)
  2326. /**************************************************************/
  2327. /**\name INTERRUPT2 MAPPING OF DOUBLE TAP LENGTH, POSITION AND MASK*/
  2328. /**************************************************************/
  2329. /* Int_Map_2 Description - Reg Addr --> 0x57, Bit -->4 */
  2330. #define BMI160_USER_INTR_MAP_2_INTR2_DOUBLE_TAP__POS (4)
  2331. #define BMI160_USER_INTR_MAP_2_INTR2_DOUBLE_TAP__LEN (1)
  2332. #define BMI160_USER_INTR_MAP_2_INTR2_DOUBLE_TAP__MSK (0x10)
  2333. #define BMI160_USER_INTR_MAP_2_INTR2_DOUBLE_TAP__REG \
  2334. (BMI160_USER_INTR_MAP_2_ADDR)
  2335. /**************************************************************/
  2336. /**\name INTERRUPT2 MAPPING OF SINGLE TAP LENGTH, POSITION AND MASK*/
  2337. /**************************************************************/
  2338. /* Int_Map_2 Description - Reg Addr --> 0x57, Bit -->5 */
  2339. #define BMI160_USER_INTR_MAP_2_INTR2_SINGLE_TAP__POS (5)
  2340. #define BMI160_USER_INTR_MAP_2_INTR2_SINGLE_TAP__LEN (1)
  2341. #define BMI160_USER_INTR_MAP_2_INTR2_SINGLE_TAP__MSK (0x20)
  2342. #define BMI160_USER_INTR_MAP_2_INTR2_SINGLE_TAP__REG \
  2343. (BMI160_USER_INTR_MAP_2_ADDR)
  2344. /**************************************************************/
  2345. /**\name INTERRUPT2 MAPPING OF ORIENT LENGTH, POSITION AND MASK*/
  2346. /**************************************************************/
  2347. /* Int_Map_2 Description - Reg Addr --> 0x57, Bit -->6 */
  2348. #define BMI160_USER_INTR_MAP_2_INTR2_ORIENT__POS (6)
  2349. #define BMI160_USER_INTR_MAP_2_INTR2_ORIENT__LEN (1)
  2350. #define BMI160_USER_INTR_MAP_2_INTR2_ORIENT__MSK (0x40)
  2351. #define BMI160_USER_INTR_MAP_2_INTR2_ORIENT__REG \
  2352. (BMI160_USER_INTR_MAP_2_ADDR)
  2353. /**************************************************************/
  2354. /**\name INTERRUPT2 MAPPING OF FLAT LENGTH, POSITION AND MASK*/
  2355. /**************************************************************/
  2356. /* Int_Map_2 Description - Reg Addr --> 0x57, Bit -->7 */
  2357. #define BMI160_USER_INTR_MAP_2_INTR2_FLAT__POS (7)
  2358. #define BMI160_USER_INTR_MAP_2_INTR2_FLAT__LEN (1)
  2359. #define BMI160_USER_INTR_MAP_2_INTR2_FLAT__MSK (0x80)
  2360. #define BMI160_USER_INTR_MAP_2_INTR2_FLAT__REG (BMI160_USER_INTR_MAP_2_ADDR)
  2361. /**************************************************************/
  2362. /**\name TAP SOURCE LENGTH, POSITION AND MASK*/
  2363. /**************************************************************/
  2364. /* Int_Data_0 Description - Reg Addr --> 0x58, Bit --> 3 */
  2365. #define BMI160_USER_INTR_DATA_0_INTR_TAP_SOURCE__POS (3)
  2366. #define BMI160_USER_INTR_DATA_0_INTR_TAP_SOURCE__LEN (1)
  2367. #define BMI160_USER_INTR_DATA_0_INTR_TAP_SOURCE__MSK (0x08)
  2368. #define BMI160_USER_INTR_DATA_0_INTR_TAP_SOURCE__REG \
  2369. (BMI160_USER_INTR_DATA_0_ADDR)
  2370. /**************************************************************/
  2371. /**\name HIGH SOURCE LENGTH, POSITION AND MASK*/
  2372. /**************************************************************/
  2373. /* Int_Data_0 Description - Reg Addr --> 0x58, Bit --> 7 */
  2374. #define BMI160_USER_INTR_DATA_0_INTR_LOW_HIGH_SOURCE__POS (7)
  2375. #define BMI160_USER_INTR_DATA_0_INTR_LOW_HIGH_SOURCE__LEN (1)
  2376. #define BMI160_USER_INTR_DATA_0_INTR_LOW_HIGH_SOURCE__MSK (0x80)
  2377. #define BMI160_USER_INTR_DATA_0_INTR_LOW_HIGH_SOURCE__REG \
  2378. (BMI160_USER_INTR_DATA_0_ADDR)
  2379. /**************************************************************/
  2380. /**\name MOTION SOURCE LENGTH, POSITION AND MASK*/
  2381. /**************************************************************/
  2382. /* Int_Data_1 Description - Reg Addr --> 0x59, Bit --> 7 */
  2383. #define BMI160_USER_INTR_DATA_1_INTR_MOTION_SOURCE__POS (7)
  2384. #define BMI160_USER_INTR_DATA_1_INTR_MOTION_SOURCE__LEN (1)
  2385. #define BMI160_USER_INTR_DATA_1_INTR_MOTION_SOURCE__MSK (0x80)
  2386. #define BMI160_USER_INTR_DATA_1_INTR_MOTION_SOURCE__REG \
  2387. (BMI160_USER_INTR_DATA_1_ADDR)
  2388. /**************************************************************/
  2389. /**\name LOW HIGH DURATION LENGTH, POSITION AND MASK*/
  2390. /**************************************************************/
  2391. /* Int_LowHigh_0 Description - Reg Addr --> 0x5a, Bit --> 0...7 */
  2392. #define BMI160_USER_INTR_LOWHIGH_0_INTR_LOW_DURN__POS (0)
  2393. #define BMI160_USER_INTR_LOWHIGH_0_INTR_LOW_DURN__LEN (8)
  2394. #define BMI160_USER_INTR_LOWHIGH_0_INTR_LOW_DURN__MSK (0xFF)
  2395. #define BMI160_USER_INTR_LOWHIGH_0_INTR_LOW_DURN__REG \
  2396. (BMI160_USER_INTR_LOWHIGH_0_ADDR)
  2397. /**************************************************************/
  2398. /**\name LOW THRESHOLD LENGTH, POSITION AND MASK*/
  2399. /**************************************************************/
  2400. /* Int_LowHigh_1 Description - Reg Addr --> 0x5b, Bit --> 0...7 */
  2401. #define BMI160_USER_INTR_LOWHIGH_1_INTR_LOW_THRES__POS (0)
  2402. #define BMI160_USER_INTR_LOWHIGH_1_INTR_LOW_THRES__LEN (8)
  2403. #define BMI160_USER_INTR_LOWHIGH_1_INTR_LOW_THRES__MSK (0xFF)
  2404. #define BMI160_USER_INTR_LOWHIGH_1_INTR_LOW_THRES__REG \
  2405. (BMI160_USER_INTR_LOWHIGH_1_ADDR)
  2406. /**************************************************************/
  2407. /**\name LOW HYSTERESIS LENGTH, POSITION AND MASK*/
  2408. /**************************************************************/
  2409. /* Int_LowHigh_2 Description - Reg Addr --> 0x5c, Bit --> 0...1 */
  2410. #define BMI160_USER_INTR_LOWHIGH_2_INTR_LOW_G_HYST__POS (0)
  2411. #define BMI160_USER_INTR_LOWHIGH_2_INTR_LOW_G_HYST__LEN (2)
  2412. #define BMI160_USER_INTR_LOWHIGH_2_INTR_LOW_G_HYST__MSK (0x03)
  2413. #define BMI160_USER_INTR_LOWHIGH_2_INTR_LOW_G_HYST__REG \
  2414. (BMI160_USER_INTR_LOWHIGH_2_ADDR)
  2415. /**************************************************************/
  2416. /**\name LOW MODE LENGTH, POSITION AND MASK*/
  2417. /**************************************************************/
  2418. /* Int_LowHigh_2 Description - Reg Addr --> 0x5c, Bit --> 2 */
  2419. #define BMI160_USER_INTR_LOWHIGH_2_INTR_LOW_G_MODE__POS (2)
  2420. #define BMI160_USER_INTR_LOWHIGH_2_INTR_LOW_G_MODE__LEN (1)
  2421. #define BMI160_USER_INTR_LOWHIGH_2_INTR_LOW_G_MODE__MSK (0x04)
  2422. #define BMI160_USER_INTR_LOWHIGH_2_INTR_LOW_G_MODE__REG \
  2423. (BMI160_USER_INTR_LOWHIGH_2_ADDR)
  2424. /**************************************************************/
  2425. /**\name HIGH_G HYSTERESIS LENGTH, POSITION AND MASK*/
  2426. /**************************************************************/
  2427. /* Int_LowHigh_2 Description - Reg Addr --> 0x5c, Bit --> 6...7 */
  2428. #define BMI160_USER_INTR_LOWHIGH_2_INTR_HIGH_G_HYST__POS (6)
  2429. #define BMI160_USER_INTR_LOWHIGH_2_INTR_HIGH_G_HYST__LEN (2)
  2430. #define BMI160_USER_INTR_LOWHIGH_2_INTR_HIGH_G_HYST__MSK (0xC0)
  2431. #define BMI160_USER_INTR_LOWHIGH_2_INTR_HIGH_G_HYST__REG \
  2432. (BMI160_USER_INTR_LOWHIGH_2_ADDR)
  2433. /**************************************************************/
  2434. /**\name HIGH_G DURATION LENGTH, POSITION AND MASK*/
  2435. /**************************************************************/
  2436. /* Int_LowHigh_3 Description - Reg Addr --> 0x5d, Bit --> 0...7 */
  2437. #define BMI160_USER_INTR_LOWHIGH_3_INTR_HIGH_G_DURN__POS (0)
  2438. #define BMI160_USER_INTR_LOWHIGH_3_INTR_HIGH_G_DURN__LEN (8)
  2439. #define BMI160_USER_INTR_LOWHIGH_3_INTR_HIGH_G_DURN__MSK (0xFF)
  2440. #define BMI160_USER_INTR_LOWHIGH_3_INTR_HIGH_G_DURN__REG \
  2441. (BMI160_USER_INTR_LOWHIGH_3_ADDR)
  2442. /**************************************************************/
  2443. /**\name HIGH_G THRESHOLD LENGTH, POSITION AND MASK*/
  2444. /**************************************************************/
  2445. /* Int_LowHigh_4 Description - Reg Addr --> 0x5e, Bit --> 0...7 */
  2446. #define BMI160_USER_INTR_LOWHIGH_4_INTR_HIGH_THRES__POS (0)
  2447. #define BMI160_USER_INTR_LOWHIGH_4_INTR_HIGH_THRES__LEN (8)
  2448. #define BMI160_USER_INTR_LOWHIGH_4_INTR_HIGH_THRES__MSK (0xFF)
  2449. #define BMI160_USER_INTR_LOWHIGH_4_INTR_HIGH_THRES__REG \
  2450. (BMI160_USER_INTR_LOWHIGH_4_ADDR)
  2451. /**************************************************************/
  2452. /**\name ANY MOTION DURATION LENGTH, POSITION AND MASK*/
  2453. /**************************************************************/
  2454. /* Int_Motion_0 Description - Reg Addr --> 0x5f, Bit --> 0...1 */
  2455. #define BMI160_USER_INTR_MOTION_0_INTR_ANY_MOTION_DURN__POS (0)
  2456. #define BMI160_USER_INTR_MOTION_0_INTR_ANY_MOTION_DURN__LEN (2)
  2457. #define BMI160_USER_INTR_MOTION_0_INTR_ANY_MOTION_DURN__MSK (0x03)
  2458. #define BMI160_USER_INTR_MOTION_0_INTR_ANY_MOTION_DURN__REG \
  2459. (BMI160_USER_INTR_MOTION_0_ADDR)
  2460. /**************************************************************/
  2461. /**\name SLOW/NO MOTION DURATION LENGTH, POSITION AND MASK*/
  2462. /**************************************************************/
  2463. /* Int_Motion_0 Description - Reg Addr --> 0x5f, Bit --> 2...7 */
  2464. #define BMI160_USER_INTR_MOTION_0_INTR_SLOW_NO_MOTION_DURN__POS (2)
  2465. #define BMI160_USER_INTR_MOTION_0_INTR_SLOW_NO_MOTION_DURN__LEN (6)
  2466. #define BMI160_USER_INTR_MOTION_0_INTR_SLOW_NO_MOTION_DURN__MSK (0xFC)
  2467. #define BMI160_USER_INTR_MOTION_0_INTR_SLOW_NO_MOTION_DURN__REG \
  2468. (BMI160_USER_INTR_MOTION_0_ADDR)
  2469. /**************************************************************/
  2470. /**\name ANY MOTION THRESHOLD LENGTH, POSITION AND MASK*/
  2471. /**************************************************************/
  2472. /* Int_Motion_1 Description - Reg Addr --> (0x60), Bit --> 0...7 */
  2473. #define BMI160_USER_INTR_MOTION_1_INTR_ANY_MOTION_THRES__POS (0)
  2474. #define BMI160_USER_INTR_MOTION_1_INTR_ANY_MOTION_THRES__LEN (8)
  2475. #define BMI160_USER_INTR_MOTION_1_INTR_ANY_MOTION_THRES__MSK (0xFF)
  2476. #define BMI160_USER_INTR_MOTION_1_INTR_ANY_MOTION_THRES__REG \
  2477. (BMI160_USER_INTR_MOTION_1_ADDR)
  2478. /**************************************************************/
  2479. /**\name SLOW/NO MOTION THRESHOLD LENGTH, POSITION AND MASK*/
  2480. /**************************************************************/
  2481. /* Int_Motion_2 Description - Reg Addr --> 0x61, Bit --> 0...7 */
  2482. #define BMI160_USER_INTR_MOTION_2_INTR_SLOW_NO_MOTION_THRES__POS (0)
  2483. #define BMI160_USER_INTR_MOTION_2_INTR_SLOW_NO_MOTION_THRES__LEN (8)
  2484. #define BMI160_USER_INTR_MOTION_2_INTR_SLOW_NO_MOTION_THRES__MSK (0xFF)
  2485. #define BMI160_USER_INTR_MOTION_2_INTR_SLOW_NO_MOTION_THRES__REG \
  2486. (BMI160_USER_INTR_MOTION_2_ADDR)
  2487. /**************************************************************/
  2488. /**\name SLOW/NO MOTION SELECT LENGTH, POSITION AND MASK*/
  2489. /**************************************************************/
  2490. /* Int_Motion_3 Description - Reg Addr --> (0x62), Bit --> 0 */
  2491. #define BMI160_USER_INTR_MOTION_3_INTR_SLOW_NO_MOTION_SELECT__POS (0)
  2492. #define BMI160_USER_INTR_MOTION_3_INTR_SLOW_NO_MOTION_SELECT__LEN (1)
  2493. #define BMI160_USER_INTR_MOTION_3_INTR_SLOW_NO_MOTION_SELECT__MSK (0x01)
  2494. #define BMI160_USER_INTR_MOTION_3_INTR_SLOW_NO_MOTION_SELECT__REG \
  2495. (BMI160_USER_INTR_MOTION_3_ADDR)
  2496. /**************************************************************/
  2497. /**\name SIGNIFICANT MOTION SELECT LENGTH, POSITION AND MASK*/
  2498. /**************************************************************/
  2499. /* Int_Motion_3 Description - Reg Addr --> (0x62), Bit --> 1 */
  2500. #define BMI160_USER_INTR_SIGNIFICATION_MOTION_SELECT__POS (1)
  2501. #define BMI160_USER_INTR_SIGNIFICATION_MOTION_SELECT__LEN (1)
  2502. #define BMI160_USER_INTR_SIGNIFICATION_MOTION_SELECT__MSK (0x02)
  2503. #define BMI160_USER_INTR_SIGNIFICATION_MOTION_SELECT__REG \
  2504. (BMI160_USER_INTR_MOTION_3_ADDR)
  2505. /* Int_Motion_3 Description - Reg Addr --> (0x62), Bit --> 3..2 */
  2506. #define BMI160_USER_INTR_SIGNIFICANT_MOTION_SKIP__POS (2)
  2507. #define BMI160_USER_INTR_SIGNIFICANT_MOTION_SKIP__LEN (2)
  2508. #define BMI160_USER_INTR_SIGNIFICANT_MOTION_SKIP__MSK (0x0C)
  2509. #define BMI160_USER_INTR_SIGNIFICANT_MOTION_SKIP__REG \
  2510. (BMI160_USER_INTR_MOTION_3_ADDR)
  2511. /* Int_Motion_3 Description - Reg Addr --> (0x62), Bit --> 5..4 */
  2512. #define BMI160_USER_INTR_SIGNIFICANT_MOTION_PROOF__POS (4)
  2513. #define BMI160_USER_INTR_SIGNIFICANT_MOTION_PROOF__LEN (2)
  2514. #define BMI160_USER_INTR_SIGNIFICANT_MOTION_PROOF__MSK (0x30)
  2515. #define BMI160_USER_INTR_SIGNIFICANT_MOTION_PROOF__REG \
  2516. (BMI160_USER_INTR_MOTION_3_ADDR)
  2517. /**************************************************************/
  2518. /**\name TAP DURATION LENGTH, POSITION AND MASK*/
  2519. /**************************************************************/
  2520. /* INT_TAP_0 Description - Reg Addr --> (0x63), Bit --> 0..2*/
  2521. #define BMI160_USER_INTR_TAP_0_INTR_TAP_DURN__POS (0)
  2522. #define BMI160_USER_INTR_TAP_0_INTR_TAP_DURN__LEN (3)
  2523. #define BMI160_USER_INTR_TAP_0_INTR_TAP_DURN__MSK (0x07)
  2524. #define BMI160_USER_INTR_TAP_0_INTR_TAP_DURN__REG \
  2525. (BMI160_USER_INTR_TAP_0_ADDR)
  2526. /**************************************************************/
  2527. /**\name TAP SHOCK LENGTH, POSITION AND MASK*/
  2528. /**************************************************************/
  2529. /* Int_Tap_0 Description - Reg Addr --> (0x63), Bit --> 6 */
  2530. #define BMI160_USER_INTR_TAP_0_INTR_TAP_SHOCK__POS (6)
  2531. #define BMI160_USER_INTR_TAP_0_INTR_TAP_SHOCK__LEN (1)
  2532. #define BMI160_USER_INTR_TAP_0_INTR_TAP_SHOCK__MSK (0x40)
  2533. #define BMI160_USER_INTR_TAP_0_INTR_TAP_SHOCK__REG (BMI160_USER_INTR_TAP_0_ADDR)
  2534. /**************************************************************/
  2535. /**\name TAP QUIET LENGTH, POSITION AND MASK*/
  2536. /**************************************************************/
  2537. /* Int_Tap_0 Description - Reg Addr --> (0x63), Bit --> 7 */
  2538. #define BMI160_USER_INTR_TAP_0_INTR_TAP_QUIET__POS (7)
  2539. #define BMI160_USER_INTR_TAP_0_INTR_TAP_QUIET__LEN (1)
  2540. #define BMI160_USER_INTR_TAP_0_INTR_TAP_QUIET__MSK (0x80)
  2541. #define BMI160_USER_INTR_TAP_0_INTR_TAP_QUIET__REG (BMI160_USER_INTR_TAP_0_ADDR)
  2542. /**************************************************************/
  2543. /**\name TAP THRESHOLD LENGTH, POSITION AND MASK*/
  2544. /**************************************************************/
  2545. /* Int_Tap_1 Description - Reg Addr --> (0x64), Bit --> 0...4 */
  2546. #define BMI160_USER_INTR_TAP_1_INTR_TAP_THRES__POS (0)
  2547. #define BMI160_USER_INTR_TAP_1_INTR_TAP_THRES__LEN (5)
  2548. #define BMI160_USER_INTR_TAP_1_INTR_TAP_THRES__MSK (0x1F)
  2549. #define BMI160_USER_INTR_TAP_1_INTR_TAP_THRES__REG (BMI160_USER_INTR_TAP_1_ADDR)
  2550. /**************************************************************/
  2551. /**\name ORIENT MODE LENGTH, POSITION AND MASK*/
  2552. /**************************************************************/
  2553. /* Int_Orient_0 Description - Reg Addr --> (0x65), Bit --> 0...1 */
  2554. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_MODE__POS (0)
  2555. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_MODE__LEN (2)
  2556. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_MODE__MSK (0x03)
  2557. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_MODE__REG \
  2558. (BMI160_USER_INTR_ORIENT_0_ADDR)
  2559. /**************************************************************/
  2560. /**\name ORIENT BLOCKING LENGTH, POSITION AND MASK*/
  2561. /**************************************************************/
  2562. /* Int_Orient_0 Description - Reg Addr --> (0x65), Bit --> 2...3 */
  2563. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_BLOCKING__POS (2)
  2564. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_BLOCKING__LEN (2)
  2565. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_BLOCKING__MSK (0x0C)
  2566. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_BLOCKING__REG \
  2567. (BMI160_USER_INTR_ORIENT_0_ADDR)
  2568. /**************************************************************/
  2569. /**\name ORIENT HYSTERESIS LENGTH, POSITION AND MASK*/
  2570. /**************************************************************/
  2571. /* Int_Orient_0 Description - Reg Addr --> (0x65), Bit --> 4...7 */
  2572. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_HYST__POS (4)
  2573. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_HYST__LEN (4)
  2574. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_HYST__MSK (0xF0)
  2575. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_HYST__REG \
  2576. (BMI160_USER_INTR_ORIENT_0_ADDR)
  2577. /**************************************************************/
  2578. /**\name ORIENT THETA LENGTH, POSITION AND MASK*/
  2579. /**************************************************************/
  2580. /* Int_Orient_1 Description - Reg Addr --> 0x66, Bit --> 0...5 */
  2581. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_THETA__POS (0)
  2582. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_THETA__LEN (6)
  2583. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_THETA__MSK (0x3F)
  2584. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_THETA__REG \
  2585. (BMI160_USER_INTR_ORIENT_1_ADDR)
  2586. /**************************************************************/
  2587. /**\name ORIENT UD LENGTH, POSITION AND MASK*/
  2588. /**************************************************************/
  2589. /* Int_Orient_1 Description - Reg Addr --> 0x66, Bit --> 6 */
  2590. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_UD_ENABLE__POS (6)
  2591. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_UD_ENABLE__LEN (1)
  2592. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_UD_ENABLE__MSK (0x40)
  2593. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_UD_ENABLE__REG \
  2594. (BMI160_USER_INTR_ORIENT_1_ADDR)
  2595. /**************************************************************/
  2596. /**\name ORIENT AXIS LENGTH, POSITION AND MASK*/
  2597. /**************************************************************/
  2598. /* Int_Orient_1 Description - Reg Addr --> 0x66, Bit --> 7 */
  2599. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_AXES_EX__POS (7)
  2600. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_AXES_EX__LEN (1)
  2601. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_AXES_EX__MSK (0x80)
  2602. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_AXES_EX__REG \
  2603. (BMI160_USER_INTR_ORIENT_1_ADDR)
  2604. /**************************************************************/
  2605. /**\name FLAT THETA LENGTH, POSITION AND MASK*/
  2606. /**************************************************************/
  2607. /* Int_Flat_0 Description - Reg Addr --> 0x67, Bit --> 0...5 */
  2608. #define BMI160_USER_INTR_FLAT_0_INTR_FLAT_THETA__POS (0)
  2609. #define BMI160_USER_INTR_FLAT_0_INTR_FLAT_THETA__LEN (6)
  2610. #define BMI160_USER_INTR_FLAT_0_INTR_FLAT_THETA__MSK (0x3F)
  2611. #define BMI160_USER_INTR_FLAT_0_INTR_FLAT_THETA__REG \
  2612. (BMI160_USER_INTR_FLAT_0_ADDR)
  2613. /**************************************************************/
  2614. /**\name FLAT HYSTERESIS LENGTH, POSITION AND MASK*/
  2615. /**************************************************************/
  2616. /* Int_Flat_1 Description - Reg Addr --> (0x68), Bit --> 0...3 */
  2617. #define BMI160_USER_INTR_FLAT_1_INTR_FLAT_HYST__POS (0)
  2618. #define BMI160_USER_INTR_FLAT_1_INTR_FLAT_HYST__LEN (4)
  2619. #define BMI160_USER_INTR_FLAT_1_INTR_FLAT_HYST__MSK (0x0F)
  2620. #define BMI160_USER_INTR_FLAT_1_INTR_FLAT_HYST__REG \
  2621. (BMI160_USER_INTR_FLAT_1_ADDR)
  2622. /**************************************************************/
  2623. /**\name FLAT HOLD LENGTH, POSITION AND MASK*/
  2624. /**************************************************************/
  2625. /* Int_Flat_1 Description - Reg Addr --> (0x68), Bit --> 4...5 */
  2626. #define BMI160_USER_INTR_FLAT_1_INTR_FLAT_HOLD__POS (4)
  2627. #define BMI160_USER_INTR_FLAT_1_INTR_FLAT_HOLD__LEN (2)
  2628. #define BMI160_USER_INTR_FLAT_1_INTR_FLAT_HOLD__MSK (0x30)
  2629. #define BMI160_USER_INTR_FLAT_1_INTR_FLAT_HOLD__REG \
  2630. (BMI160_USER_INTR_FLAT_1_ADDR)
  2631. /**************************************************************/
  2632. /**\name FOC ACCEL XYZ LENGTH, POSITION AND MASK*/
  2633. /**************************************************************/
  2634. /* Foc_Conf Description - Reg Addr --> (0x69), Bit --> 0...1 */
  2635. #define BMI160_USER_FOC_ACCEL_Z__POS (0)
  2636. #define BMI160_USER_FOC_ACCEL_Z__LEN (2)
  2637. #define BMI160_USER_FOC_ACCEL_Z__MSK (0x03)
  2638. #define BMI160_USER_FOC_ACCEL_Z__REG (BMI160_USER_FOC_CONFIG_ADDR)
  2639. /* Foc_Conf Description - Reg Addr --> (0x69), Bit --> 2...3 */
  2640. #define BMI160_USER_FOC_ACCEL_Y__POS (2)
  2641. #define BMI160_USER_FOC_ACCEL_Y__LEN (2)
  2642. #define BMI160_USER_FOC_ACCEL_Y__MSK (0x0C)
  2643. #define BMI160_USER_FOC_ACCEL_Y__REG (BMI160_USER_FOC_CONFIG_ADDR)
  2644. /* Foc_Conf Description - Reg Addr --> (0x69), Bit --> 4...5 */
  2645. #define BMI160_USER_FOC_ACCEL_X__POS (4)
  2646. #define BMI160_USER_FOC_ACCEL_X__LEN (2)
  2647. #define BMI160_USER_FOC_ACCEL_X__MSK (0x30)
  2648. #define BMI160_USER_FOC_ACCEL_X__REG (BMI160_USER_FOC_CONFIG_ADDR)
  2649. /**************************************************************/
  2650. /**\name FOC GYRO LENGTH, POSITION AND MASK*/
  2651. /**************************************************************/
  2652. /* Foc_Conf Description - Reg Addr --> (0x69), Bit --> 6 */
  2653. #define BMI160_USER_FOC_GYRO_ENABLE__POS (6)
  2654. #define BMI160_USER_FOC_GYRO_ENABLE__LEN (1)
  2655. #define BMI160_USER_FOC_GYRO_ENABLE__MSK (0x40)
  2656. #define BMI160_USER_FOC_GYRO_ENABLE__REG \
  2657. (BMI160_USER_FOC_CONFIG_ADDR)
  2658. /*IF_CONF Description - Reg Addr --> (0x6B), Bit --> 0 */
  2659. #define BMI160_USER_IF_CONFIG_SPI3__POS (0)
  2660. #define BMI160_USER_IF_CONFIG_SPI3__LEN (1)
  2661. #define BMI160_USER_IF_CONFIG_SPI3__MSK (0x01)
  2662. #define BMI160_USER_IF_CONFIG_SPI3__REG \
  2663. (BMI160_USER_IF_CONFIG_ADDR)
  2664. /*IF_CONF Description - Reg Addr --> (0x6B), Bit --> 5..4 */
  2665. #define BMI160_USER_IF_CONFIG_IF_MODE__POS (4)
  2666. #define BMI160_USER_IF_CONFIG_IF_MODE__LEN (2)
  2667. #define BMI160_USER_IF_CONFIG_IF_MODE__MSK (0x30)
  2668. #define BMI160_USER_IF_CONFIG_IF_MODE__REG \
  2669. (BMI160_USER_IF_CONFIG_ADDR)
  2670. /**************************************************************/
  2671. /**\name GYRO SLEEP CONFIGURATION LENGTH, POSITION AND MASK*/
  2672. /**************************************************************/
  2673. /* Pmu_Trigger Description - Reg Addr --> 0x6c, Bit --> 0...2 */
  2674. #define BMI160_USER_GYRO_SLEEP_TRIGGER__POS (0)
  2675. #define BMI160_USER_GYRO_SLEEP_TRIGGER__LEN (3)
  2676. #define BMI160_USER_GYRO_SLEEP_TRIGGER__MSK (0x07)
  2677. #define BMI160_USER_GYRO_SLEEP_TRIGGER__REG (BMI160_USER_PMU_TRIGGER_ADDR)
  2678. /* Pmu_Trigger Description - Reg Addr --> 0x6c, Bit --> 3...4 */
  2679. #define BMI160_USER_GYRO_WAKEUP_TRIGGER__POS (3)
  2680. #define BMI160_USER_GYRO_WAKEUP_TRIGGER__LEN (2)
  2681. #define BMI160_USER_GYRO_WAKEUP_TRIGGER__MSK (0x18)
  2682. #define BMI160_USER_GYRO_WAKEUP_TRIGGER__REG (BMI160_USER_PMU_TRIGGER_ADDR)
  2683. /* Pmu_Trigger Description - Reg Addr --> 0x6c, Bit --> 5 */
  2684. #define BMI160_USER_GYRO_SLEEP_STATE__POS (5)
  2685. #define BMI160_USER_GYRO_SLEEP_STATE__LEN (1)
  2686. #define BMI160_USER_GYRO_SLEEP_STATE__MSK (0x20)
  2687. #define BMI160_USER_GYRO_SLEEP_STATE__REG (BMI160_USER_PMU_TRIGGER_ADDR)
  2688. /* Pmu_Trigger Description - Reg Addr --> 0x6c, Bit --> 6 */
  2689. #define BMI160_USER_GYRO_WAKEUP_INTR__POS (6)
  2690. #define BMI160_USER_GYRO_WAKEUP_INTR__LEN (1)
  2691. #define BMI160_USER_GYRO_WAKEUP_INTR__MSK (0x40)
  2692. #define BMI160_USER_GYRO_WAKEUP_INTR__REG (BMI160_USER_PMU_TRIGGER_ADDR)
  2693. /**************************************************************/
  2694. /**\name ACCEL SELF TEST LENGTH, POSITION AND MASK*/
  2695. /**************************************************************/
  2696. /* Self_Test Description - Reg Addr --> 0x6d, Bit --> 0...1 */
  2697. #define BMI160_USER_ACCEL_SELFTEST_AXIS__POS (0)
  2698. #define BMI160_USER_ACCEL_SELFTEST_AXIS__LEN (2)
  2699. #define BMI160_USER_ACCEL_SELFTEST_AXIS__MSK (0x03)
  2700. #define BMI160_USER_ACCEL_SELFTEST_AXIS__REG (BMI160_USER_SELF_TEST_ADDR)
  2701. /* Self_Test Description - Reg Addr --> 0x6d, Bit --> 2 */
  2702. #define BMI160_USER_ACCEL_SELFTEST_SIGN__POS (2)
  2703. #define BMI160_USER_ACCEL_SELFTEST_SIGN__LEN (1)
  2704. #define BMI160_USER_ACCEL_SELFTEST_SIGN__MSK (0x04)
  2705. #define BMI160_USER_ACCEL_SELFTEST_SIGN__REG (BMI160_USER_SELF_TEST_ADDR)
  2706. /* Self_Test Description - Reg Addr --> 0x6d, Bit --> 3 */
  2707. #define BMI160_USER_SELFTEST_AMP__POS (3)
  2708. #define BMI160_USER_SELFTEST_AMP__LEN (1)
  2709. #define BMI160_USER_SELFTEST_AMP__MSK (0x08)
  2710. #define BMI160_USER_SELFTEST_AMP__REG (BMI160_USER_SELF_TEST_ADDR)
  2711. /**************************************************************/
  2712. /**\name GYRO SELF TEST LENGTH, POSITION AND MASK*/
  2713. /**************************************************************/
  2714. /* Self_Test Description - Reg Addr --> 0x6d, Bit --> 4 */
  2715. #define BMI160_USER_GYRO_SELFTEST_START__POS (4)
  2716. #define BMI160_USER_GYRO_SELFTEST_START__LEN (1)
  2717. #define BMI160_USER_GYRO_SELFTEST_START__MSK (0x10)
  2718. #define BMI160_USER_GYRO_SELFTEST_START__REG \
  2719. (BMI160_USER_SELF_TEST_ADDR)
  2720. /**************************************************************/
  2721. /**\name NV_CONFIG LENGTH, POSITION AND MASK*/
  2722. /**************************************************************/
  2723. /* NV_CONF Description - Reg Addr --> (0x70), Bit --> 0 */
  2724. #define BMI160_USER_NV_CONFIG_SPI_ENABLE__POS (0)
  2725. #define BMI160_USER_NV_CONFIG_SPI_ENABLE__LEN (1)
  2726. #define BMI160_USER_NV_CONFIG_SPI_ENABLE__MSK (0x01)
  2727. #define BMI160_USER_NV_CONFIG_SPI_ENABLE__REG (BMI160_USER_NV_CONFIG_ADDR)
  2728. /*IF_CONF Description - Reg Addr --> (0x70), Bit --> 1 */
  2729. #define BMI160_USER_IF_CONFIG_I2C_WDT_SELECT__POS (1)
  2730. #define BMI160_USER_IF_CONFIG_I2C_WDT_SELECT__LEN (1)
  2731. #define BMI160_USER_IF_CONFIG_I2C_WDT_SELECT__MSK (0x02)
  2732. #define BMI160_USER_IF_CONFIG_I2C_WDT_SELECT__REG \
  2733. (BMI160_USER_NV_CONFIG_ADDR)
  2734. /*IF_CONF Description - Reg Addr --> (0x70), Bit --> 2 */
  2735. #define BMI160_USER_IF_CONFIG_I2C_WDT_ENABLE__POS (2)
  2736. #define BMI160_USER_IF_CONFIG_I2C_WDT_ENABLE__LEN (1)
  2737. #define BMI160_USER_IF_CONFIG_I2C_WDT_ENABLE__MSK (0x04)
  2738. #define BMI160_USER_IF_CONFIG_I2C_WDT_ENABLE__REG \
  2739. (BMI160_USER_NV_CONFIG_ADDR)
  2740. /**************************************************************/
  2741. /**\name ACCEL MANUAL OFFSET LENGTH, POSITION AND MASK*/
  2742. /**************************************************************/
  2743. /* Offset_0 Description - Reg Addr --> (0x71), Bit --> 0...7 */
  2744. #define BMI160_USER_OFFSET_0_ACCEL_OFF_X__POS (0)
  2745. #define BMI160_USER_OFFSET_0_ACCEL_OFF_X__LEN (8)
  2746. #define BMI160_USER_OFFSET_0_ACCEL_OFF_X__MSK (0xFF)
  2747. #define BMI160_USER_OFFSET_0_ACCEL_OFF_X__REG (BMI160_USER_OFFSET_0_ADDR)
  2748. /* Offset_1 Description - Reg Addr --> 0x72, Bit --> 0...7 */
  2749. #define BMI160_USER_OFFSET_1_ACCEL_OFF_Y__POS (0)
  2750. #define BMI160_USER_OFFSET_1_ACCEL_OFF_Y__LEN (8)
  2751. #define BMI160_USER_OFFSET_1_ACCEL_OFF_Y__MSK (0xFF)
  2752. #define BMI160_USER_OFFSET_1_ACCEL_OFF_Y__REG (BMI160_USER_OFFSET_1_ADDR)
  2753. /* Offset_2 Description - Reg Addr --> 0x73, Bit --> 0...7 */
  2754. #define BMI160_USER_OFFSET_2_ACCEL_OFF_Z__POS (0)
  2755. #define BMI160_USER_OFFSET_2_ACCEL_OFF_Z__LEN (8)
  2756. #define BMI160_USER_OFFSET_2_ACCEL_OFF_Z__MSK (0xFF)
  2757. #define BMI160_USER_OFFSET_2_ACCEL_OFF_Z__REG (BMI160_USER_OFFSET_2_ADDR)
  2758. /**************************************************************/
  2759. /**\name GYRO MANUAL OFFSET LENGTH, POSITION AND MASK*/
  2760. /**************************************************************/
  2761. /* Offset_3 Description - Reg Addr --> 0x74, Bit --> 0...7 */
  2762. #define BMI160_USER_OFFSET_3_GYRO_OFF_X__POS (0)
  2763. #define BMI160_USER_OFFSET_3_GYRO_OFF_X__LEN (8)
  2764. #define BMI160_USER_OFFSET_3_GYRO_OFF_X__MSK (0xFF)
  2765. #define BMI160_USER_OFFSET_3_GYRO_OFF_X__REG (BMI160_USER_OFFSET_3_ADDR)
  2766. /* Offset_4 Description - Reg Addr --> 0x75, Bit --> 0...7 */
  2767. #define BMI160_USER_OFFSET_4_GYRO_OFF_Y__POS (0)
  2768. #define BMI160_USER_OFFSET_4_GYRO_OFF_Y__LEN (8)
  2769. #define BMI160_USER_OFFSET_4_GYRO_OFF_Y__MSK (0xFF)
  2770. #define BMI160_USER_OFFSET_4_GYRO_OFF_Y__REG (BMI160_USER_OFFSET_4_ADDR)
  2771. /* Offset_5 Description - Reg Addr --> 0x76, Bit --> 0...7 */
  2772. #define BMI160_USER_OFFSET_5_GYRO_OFF_Z__POS (0)
  2773. #define BMI160_USER_OFFSET_5_GYRO_OFF_Z__LEN (8)
  2774. #define BMI160_USER_OFFSET_5_GYRO_OFF_Z__MSK (0xFF)
  2775. #define BMI160_USER_OFFSET_5_GYRO_OFF_Z__REG (BMI160_USER_OFFSET_5_ADDR)
  2776. /* Offset_6 Description - Reg Addr --> 0x77, Bit --> 0..1 */
  2777. #define BMI160_USER_OFFSET_6_GYRO_OFF_X__POS (0)
  2778. #define BMI160_USER_OFFSET_6_GYRO_OFF_X__LEN (2)
  2779. #define BMI160_USER_OFFSET_6_GYRO_OFF_X__MSK (0x03)
  2780. #define BMI160_USER_OFFSET_6_GYRO_OFF_X__REG (BMI160_USER_OFFSET_6_ADDR)
  2781. /* Offset_6 Description - Reg Addr --> 0x77, Bit --> 2...3 */
  2782. #define BMI160_USER_OFFSET_6_GYRO_OFF_Y__POS (2)
  2783. #define BMI160_USER_OFFSET_6_GYRO_OFF_Y__LEN (2)
  2784. #define BMI160_USER_OFFSET_6_GYRO_OFF_Y__MSK (0x0C)
  2785. #define BMI160_USER_OFFSET_6_GYRO_OFF_Y__REG (BMI160_USER_OFFSET_6_ADDR)
  2786. /* Offset_6 Description - Reg Addr --> 0x77, Bit --> 4...5 */
  2787. #define BMI160_USER_OFFSET_6_GYRO_OFF_Z__POS (4)
  2788. #define BMI160_USER_OFFSET_6_GYRO_OFF_Z__LEN (2)
  2789. #define BMI160_USER_OFFSET_6_GYRO_OFF_Z__MSK (0x30)
  2790. #define BMI160_USER_OFFSET_6_GYRO_OFF_Z__REG (BMI160_USER_OFFSET_6_ADDR)
  2791. /**************************************************************/
  2792. /**\name ACCEL OFFSET ENABLE LENGTH, POSITION AND MASK*/
  2793. /**************************************************************/
  2794. /* Offset_6 Description - Reg Addr --> 0x77, Bit --> 6 */
  2795. #define BMI160_USER_OFFSET_6_ACCEL_OFF_ENABLE__POS (6)
  2796. #define BMI160_USER_OFFSET_6_ACCEL_OFF_ENABLE__LEN (1)
  2797. #define BMI160_USER_OFFSET_6_ACCEL_OFF_ENABLE__MSK (0x40)
  2798. #define BMI160_USER_OFFSET_6_ACCEL_OFF_ENABLE__REG \
  2799. (BMI160_USER_OFFSET_6_ADDR)
  2800. /**************************************************************/
  2801. /**\name GYRO OFFSET ENABLE LENGTH, POSITION AND MASK*/
  2802. /**************************************************************/
  2803. /* Offset_6 Description - Reg Addr --> 0x77, Bit --> 7 */
  2804. #define BMI160_USER_OFFSET_6_GYRO_OFF_EN__POS (7)
  2805. #define BMI160_USER_OFFSET_6_GYRO_OFF_EN__LEN (1)
  2806. #define BMI160_USER_OFFSET_6_GYRO_OFF_EN__MSK (0x80)
  2807. #define BMI160_USER_OFFSET_6_GYRO_OFF_EN__REG (BMI160_USER_OFFSET_6_ADDR)
  2808. /**************************************************************/
  2809. /**\name STEP COUNTER LENGTH, POSITION AND MASK*/
  2810. /**************************************************************/
  2811. /* STEP_CNT_0 Description - Reg Addr --> 0x78, Bit --> 0 to 7 */
  2812. #define BMI160_USER_STEP_COUNT_LSB__POS (0)
  2813. #define BMI160_USER_STEP_COUNT_LSB__LEN (7)
  2814. #define BMI160_USER_STEP_COUNT_LSB__MSK (0xFF)
  2815. #define BMI160_USER_STEP_COUNT_LSB__REG (BMI160_USER_STEP_COUNT_0_ADDR)
  2816. /* STEP_CNT_1 Description - Reg Addr --> 0x79, Bit --> 0 to 7 */
  2817. #define BMI160_USER_STEP_COUNT_MSB__POS (0)
  2818. #define BMI160_USER_STEP_COUNT_MSB__LEN (7)
  2819. #define BMI160_USER_STEP_COUNT_MSB__MSK (0xFF)
  2820. #define BMI160_USER_STEP_COUNT_MSB__REG (BMI160_USER_STEP_COUNT_1_ADDR)
  2821. /**************************************************************/
  2822. /**\name STEP COUNTER CONFIGURATION LENGTH, POSITION AND MASK*/
  2823. /**************************************************************/
  2824. /* STEP_CONFIG_0 Description - Reg Addr --> 0x7A, Bit --> 0 to 7 */
  2825. #define BMI160_USER_STEP_CONFIG_ZERO__POS (0)
  2826. #define BMI160_USER_STEP_CONFIG_ZERO__LEN (7)
  2827. #define BMI160_USER_STEP_CONFIG_ZERO__MSK (0xFF)
  2828. #define BMI160_USER_STEP_CONFIG_ZERO__REG \
  2829. (BMI160_USER_STEP_CONFIG_0_ADDR)
  2830. /* STEP_CONFIG_1 Description - Reg Addr --> 0x7B, Bit --> 0 to 2 and
  2831. 4 to 7 */
  2832. #define BMI160_USER_STEP_CONFIG_ONE_CNF1__POS (0)
  2833. #define BMI160_USER_STEP_CONFIG_ONE_CNF1__LEN (3)
  2834. #define BMI160_USER_STEP_CONFIG_ONE_CNF1__MSK (0x07)
  2835. #define BMI160_USER_STEP_CONFIG_ONE_CNF1__REG \
  2836. (BMI160_USER_STEP_CONFIG_1_ADDR)
  2837. #define BMI160_USER_STEP_CONFIG_ONE_CNF2__POS (4)
  2838. #define BMI160_USER_STEP_CONFIG_ONE_CNF2__LEN (4)
  2839. #define BMI160_USER_STEP_CONFIG_ONE_CNF2__MSK (0xF0)
  2840. #define BMI160_USER_STEP_CONFIG_ONE_CNF2__REG \
  2841. (BMI160_USER_STEP_CONFIG_1_ADDR)
  2842. /**************************************************************/
  2843. /**\name STEP COUNTER ENABLE LENGTH, POSITION AND MASK*/
  2844. /**************************************************************/
  2845. /* STEP_CONFIG_1 Description - Reg Addr --> 0x7B, Bit --> 0 to 2 */
  2846. #define BMI160_USER_STEP_CONFIG_1_STEP_COUNT_ENABLE__POS (3)
  2847. #define BMI160_USER_STEP_CONFIG_1_STEP_COUNT_ENABLE__LEN (1)
  2848. #define BMI160_USER_STEP_CONFIG_1_STEP_COUNT_ENABLE__MSK (0x08)
  2849. #define BMI160_USER_STEP_CONFIG_1_STEP_COUNT_ENABLE__REG \
  2850. (BMI160_USER_STEP_CONFIG_1_ADDR)
  2851. /* USER REGISTERS DEFINITION END */
  2852. /**************************************************************************/
  2853. /* CMD REGISTERS DEFINITION START */
  2854. /**************************************************************/
  2855. /**\name COMMAND REGISTER LENGTH, POSITION AND MASK*/
  2856. /**************************************************************/
  2857. /* Command description address - Reg Addr --> 0x7E, Bit --> 0....7 */
  2858. #define BMI160_CMD_COMMANDS__POS (0)
  2859. #define BMI160_CMD_COMMANDS__LEN (8)
  2860. #define BMI160_CMD_COMMANDS__MSK (0xFF)
  2861. #define BMI160_CMD_COMMANDS__REG (BMI160_CMD_COMMANDS_ADDR)
  2862. /**************************************************************************/
  2863. /* CMD REGISTERS DEFINITION END */
  2864. #ifdef FIFO_ENABLE
  2865. /**************************************************/
  2866. /**\name FIFO FRAME COUNT DEFINITION */
  2867. /*************************************************/
  2868. #define FIFO_FRAME (1024)
  2869. #define FIFO_CONFIG_CHECK1 (0x00)
  2870. #define FIFO_CONFIG_CHECK2 (0x80)
  2871. #endif
  2872. /**************************************************/
  2873. /**\name MAG SENSOR SELECT */
  2874. /*************************************************/
  2875. #define BST_BMM (0)
  2876. #define BST_AKM (1)
  2877. #define BMI160_YAS537_I2C_ADDRESS (0x2E)
  2878. /**************************************************/
  2879. /**\name ACCEL RANGE */
  2880. /*************************************************/
  2881. #define BMI160_ACCEL_RANGE_2G (0X03)
  2882. #define BMI160_ACCEL_RANGE_4G (0X05)
  2883. #define BMI160_ACCEL_RANGE_8G (0X08)
  2884. #define BMI160_ACCEL_RANGE_16G (0X0C)
  2885. /**************************************************/
  2886. /**\name ACCEL ODR */
  2887. /*************************************************/
  2888. #define BMI160_ACCEL_OUTPUT_DATA_RATE_RESERVED (0x00)
  2889. #define BMI160_ACCEL_OUTPUT_DATA_RATE_0_78HZ (0x01)
  2890. #define BMI160_ACCEL_OUTPUT_DATA_RATE_1_56HZ (0x02)
  2891. #define BMI160_ACCEL_OUTPUT_DATA_RATE_3_12HZ (0x03)
  2892. #define BMI160_ACCEL_OUTPUT_DATA_RATE_6_25HZ (0x04)
  2893. #define BMI160_ACCEL_OUTPUT_DATA_RATE_12_5HZ (0x05)
  2894. #define BMI160_ACCEL_OUTPUT_DATA_RATE_25HZ (0x06)
  2895. #define BMI160_ACCEL_OUTPUT_DATA_RATE_50HZ (0x07)
  2896. #define BMI160_ACCEL_OUTPUT_DATA_RATE_100HZ (0x08)
  2897. #define BMI160_ACCEL_OUTPUT_DATA_RATE_200HZ (0x09)
  2898. #define BMI160_ACCEL_OUTPUT_DATA_RATE_400HZ (0x0A)
  2899. #define BMI160_ACCEL_OUTPUT_DATA_RATE_800HZ (0x0B)
  2900. #define BMI160_ACCEL_OUTPUT_DATA_RATE_1600HZ (0x0C)
  2901. #define BMI160_ACCEL_OUTPUT_DATA_RATE_RESERVED0 (0x0D)
  2902. #define BMI160_ACCEL_OUTPUT_DATA_RATE_RESERVED1 (0x0E)
  2903. #define BMI160_ACCEL_OUTPUT_DATA_RATE_RESERVED2 (0x0F)
  2904. /**************************************************/
  2905. /**\name ACCEL BANDWIDTH PARAMETER */
  2906. /*************************************************/
  2907. #define BMI160_ACCEL_OSR4_AVG1 (0)
  2908. #define BMI160_ACCEL_OSR2_AVG2 (1)
  2909. #define BMI160_ACCEL_NORMAL_AVG4 (2)
  2910. #define BMI160_ACCEL_CIC_AVG8 (3)
  2911. #define BMI160_ACCEL_RES_AVG2 (4)
  2912. #define BMI160_ACCEL_RES_AVG4 (5)
  2913. #define BMI160_ACCEL_RES_AVG8 (6)
  2914. #define BMI160_ACCEL_RES_AVG16 (7)
  2915. #define BMI160_ACCEL_RES_AVG32 (8)
  2916. #define BMI160_ACCEL_RES_AVG64 (9)
  2917. #define BMI160_ACCEL_RES_AVG128 (10)
  2918. #define BMI160_US_DISABLE (0)
  2919. #define BMI160_US_ENABLE (1)
  2920. /**************************************************/
  2921. /**\name GYRO ODR */
  2922. /*************************************************/
  2923. #define BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED (0x00)
  2924. #define BMI160_GYRO_OUTPUT_DATA_RATE_25HZ (0x06)
  2925. #define BMI160_GYRO_OUTPUT_DATA_RATE_50HZ (0x07)
  2926. #define BMI160_GYRO_OUTPUT_DATA_RATE_100HZ (0x08)
  2927. #define BMI160_GYRO_OUTPUT_DATA_RATE_200HZ (0x09)
  2928. #define BMI160_GYRO_OUTPUT_DATA_RATE_400HZ (0x0A)
  2929. #define BMI160_GYRO_OUTPUT_DATA_RATE_800HZ (0x0B)
  2930. #define BMI160_GYRO_OUTPUT_DATA_RATE_1600HZ (0x0C)
  2931. #define BMI160_GYRO_OUTPUT_DATA_RATE_3200HZ (0x0D)
  2932. /**************************************************/
  2933. /**\name GYRO BANDWIDTH PARAMETER */
  2934. /*************************************************/
  2935. #define BMI160_GYRO_OSR4_MODE (0x00)
  2936. #define BMI160_GYRO_OSR2_MODE (0x01)
  2937. #define BMI160_GYRO_NORMAL_MODE (0x02)
  2938. #define BMI160_GYRO_CIC_MODE (0x03)
  2939. /**************************************************/
  2940. /**\name GYROSCOPE RANGE PARAMETER */
  2941. /*************************************************/
  2942. #define BMI160_GYRO_RANGE_2000_DEG_SEC (0x00)
  2943. #define BMI160_GYRO_RANGE_1000_DEG_SEC (0x01)
  2944. #define BMI160_GYRO_RANGE_500_DEG_SEC (0x02)
  2945. #define BMI160_GYRO_RANGE_250_DEG_SEC (0x03)
  2946. #define BMI160_GYRO_RANGE_125_DEG_SEC (0x04)
  2947. /**************************************************/
  2948. /**\name MAG ODR */
  2949. /*************************************************/
  2950. #define BMI160_MAG_OUTPUT_DATA_RATE_RESERVED (0x00)
  2951. #define BMI160_MAG_OUTPUT_DATA_RATE_0_78HZ (0x01)
  2952. #define BMI160_MAG_OUTPUT_DATA_RATE_1_56HZ (0x02)
  2953. #define BMI160_MAG_OUTPUT_DATA_RATE_3_12HZ (0x03)
  2954. #define BMI160_MAG_OUTPUT_DATA_RATE_6_25HZ (0x04)
  2955. #define BMI160_MAG_OUTPUT_DATA_RATE_12_5HZ (0x05)
  2956. #define BMI160_MAG_OUTPUT_DATA_RATE_25HZ (0x06)
  2957. #define BMI160_MAG_OUTPUT_DATA_RATE_50HZ (0x07)
  2958. #define BMI160_MAG_OUTPUT_DATA_RATE_100HZ (0x08)
  2959. #define BMI160_MAG_OUTPUT_DATA_RATE_200HZ (0x09)
  2960. #define BMI160_MAG_OUTPUT_DATA_RATE_400HZ (0x0A)
  2961. #define BMI160_MAG_OUTPUT_DATA_RATE_800HZ (0x0B)
  2962. #define BMI160_MAG_OUTPUT_DATA_RATE_1600HZ (0x0C)
  2963. #define BMI160_MAG_OUTPUT_DATA_RATE_RESERVED0 (0x0D)
  2964. #define BMI160_MAG_OUTPUT_DATA_RATE_RESERVED1 (0x0E)
  2965. #define BMI160_MAG_OUTPUT_DATA_RATE_RESERVED2 (0x0F)
  2966. /**************************************************/
  2967. /**\name ENABLE/DISABLE SELECTIONS */
  2968. /*************************************************/
  2969. /* Enable Accel and Gyro offset */
  2970. #define ACCEL_OFFSET_ENABLE (0x01)
  2971. #define GYRO_OFFSET_ENABLE (0x01)
  2972. /* command register definition */
  2973. #define START_FOC_ACCEL_GYRO (0X03)
  2974. /* INT ENABLE 1 */
  2975. #define BMI160_ANY_MOTION_X_ENABLE (0)
  2976. #define BMI160_ANY_MOTION_Y_ENABLE (1)
  2977. #define BMI160_ANY_MOTION_Z_ENABLE (2)
  2978. #define BMI160_DOUBLE_TAP_ENABLE (4)
  2979. #define BMI160_SINGLE_TAP_ENABLE (5)
  2980. #define BMI160_ORIENT_ENABLE (6)
  2981. #define BMI160_FLAT_ENABLE (7)
  2982. /* INT ENABLE 1 */
  2983. #define BMI160_HIGH_G_X_ENABLE (0)
  2984. #define BMI160_HIGH_G_Y_ENABLE (1)
  2985. #define BMI160_HIGH_G_Z_ENABLE (2)
  2986. #define BMI160_LOW_G_ENABLE (3)
  2987. #define BMI160_DATA_RDY_ENABLE (4)
  2988. #define BMI160_FIFO_FULL_ENABLE (5)
  2989. #define BMI160_FIFO_WM_ENABLE (6)
  2990. /* INT ENABLE 2 */
  2991. #define BMI160_NOMOTION_X_ENABLE (0)
  2992. #define BMI160_NOMOTION_Y_ENABLE (1)
  2993. #define BMI160_NOMOTION_Z_ENABLE (2)
  2994. /* FOC axis selection for accel*/
  2995. #define FOC_X_AXIS (0)
  2996. #define FOC_Y_AXIS (1)
  2997. #define FOC_Z_AXIS (2)
  2998. /* IN OUT CONTROL */
  2999. #define BMI160_INTR1_EDGE_CTRL (0)
  3000. #define BMI160_INTR2_EDGE_CTRL (1)
  3001. #define BMI160_INTR1_LEVEL (0)
  3002. #define BMI160_INTR2_LEVEL (1)
  3003. #define BMI160_INTR1_OUTPUT_TYPE (0)
  3004. #define BMI160_INTR2_OUTPUT_TYPE (1)
  3005. #define BMI160_INTR1_OUTPUT_ENABLE (0)
  3006. #define BMI160_INTR2_OUTPUT_ENABLE (1)
  3007. #define BMI160_INTR1_INPUT_ENABLE (0)
  3008. #define BMI160_INTR2_INPUT_ENABLE (1)
  3009. /* INTERRUPT MAPS */
  3010. #define BMI160_INTR1_MAP_LOW_G (0)
  3011. #define BMI160_INTR2_MAP_LOW_G (1)
  3012. #define BMI160_INTR1_MAP_HIGH_G (0)
  3013. #define BMI160_INTR2_MAP_HIGH_G (1)
  3014. #define BMI160_INTR1_MAP_ANY_MOTION (0)
  3015. #define BMI160_INTR2_MAP_ANY_MOTION (1)
  3016. #define BMI160_INTR1_MAP_NOMO (0)
  3017. #define BMI160_INTR2_MAP_NOMO (1)
  3018. #define BMI160_INTR1_MAP_DOUBLE_TAP (0)
  3019. #define BMI160_INTR2_MAP_DOUBLE_TAP (1)
  3020. #define BMI160_INTR1_MAP_SINGLE_TAP (0)
  3021. #define BMI160_INTR2_MAP_SINGLE_TAP (1)
  3022. #define BMI160_INTR1_MAP_ORIENT (0)
  3023. #define BMI160_INTR2_MAP_ORIENT (1)
  3024. #define BMI160_INTR1_MAP_FLAT (0)
  3025. #define BMI160_INTR2_MAP_FLAT (1)
  3026. #define BMI160_INTR1_MAP_DATA_RDY (0)
  3027. #define BMI160_INTR2_MAP_DATA_RDY (1)
  3028. #define BMI160_INTR1_MAP_FIFO_WM (0)
  3029. #define BMI160_INTR2_MAP_FIFO_WM (1)
  3030. #define BMI160_INTR1_MAP_FIFO_FULL (0)
  3031. #define BMI160_INTR2_MAP_FIFO_FULL (1)
  3032. #define BMI160_INTR1_MAP_PMUTRIG (0)
  3033. #define BMI160_INTR2_MAP_PMUTRIG (1)
  3034. /* Interrupt mapping*/
  3035. #define BMI160_MAP_INTR1 (0)
  3036. #define BMI160_MAP_INTR2 (1)
  3037. /**************************************************/
  3038. /**\name TAP DURATION */
  3039. /*************************************************/
  3040. #define BMI160_TAP_DURN_50MS (0x00)
  3041. #define BMI160_TAP_DURN_100MS (0x01)
  3042. #define BMI160_TAP_DURN_150MS (0x02)
  3043. #define BMI160_TAP_DURN_200MS (0x03)
  3044. #define BMI160_TAP_DURN_250MS (0x04)
  3045. #define BMI160_TAP_DURN_375MS (0x05)
  3046. #define BMI160_TAP_DURN_500MS (0x06)
  3047. #define BMI160_TAP_DURN_700MS (0x07)
  3048. /**************************************************/
  3049. /**\name TAP SHOCK */
  3050. /*************************************************/
  3051. #define BMI160_TAP_SHOCK_50MS (0x00)
  3052. #define BMI160_TAP_SHOCK_75MS (0x01)
  3053. /**************************************************/
  3054. /**\name TAP QUIET */
  3055. /*************************************************/
  3056. #define BMI160_TAP_QUIET_30MS (0x00)
  3057. #define BMI160_TAP_QUIET_20MS (0x01)
  3058. /**************************************************/
  3059. /**\name STEP DETECTION SELECTION MODES */
  3060. /*************************************************/
  3061. #define BMI160_STEP_NORMAL_MODE (0)
  3062. #define BMI160_STEP_SENSITIVE_MODE (1)
  3063. #define BMI160_STEP_ROBUST_MODE (2)
  3064. /**************************************************/
  3065. /**\name STEP CONFIGURATION SELECT MODE */
  3066. /*************************************************/
  3067. #define STEP_CONFIG_NORMAL (0X315)
  3068. #define STEP_CONFIG_SENSITIVE (0X2D)
  3069. #define STEP_CONFIG_ROBUST (0X71D)
  3070. /**************************************************/
  3071. /**\name BMM150 TRIM DATA DEFINITIONS */
  3072. /*************************************************/
  3073. #define BMI160_MAG_DIG_X1 (0x5D)
  3074. #define BMI160_MAG_DIG_Y1 (0x5E)
  3075. #define BMI160_MAG_DIG_Z4_LSB (0x62)
  3076. #define BMI160_MAG_DIG_Z4_MSB (0x63)
  3077. #define BMI160_MAG_DIG_X2 (0x64)
  3078. #define BMI160_MAG_DIG_Y2 (0x65)
  3079. #define BMI160_MAG_DIG_Z2_LSB (0x68)
  3080. #define BMI160_MAG_DIG_Z2_MSB (0x69)
  3081. #define BMI160_MAG_DIG_Z1_LSB (0x6A)
  3082. #define BMI160_MAG_DIG_Z1_MSB (0x6B)
  3083. #define BMI160_MAG_DIG_XYZ1_LSB (0x6C)
  3084. #define BMI160_MAG_DIG_XYZ1_MSB (0x6D)
  3085. #define BMI160_MAG_DIG_Z3_LSB (0x6E)
  3086. #define BMI160_MAG_DIG_Z3_MSB (0x6F)
  3087. #define BMI160_MAG_DIG_XY2 (0x70)
  3088. #define BMI160_MAG_DIG_XY1 (0x71)
  3089. /**************************************************/
  3090. /**\name BMM150 PRE-SET MODE DEFINITIONS */
  3091. /*************************************************/
  3092. #define BMI160_MAG_PRESETMODE_LOWPOWER (1)
  3093. #define BMI160_MAG_PRESETMODE_REGULAR (2)
  3094. #define BMI160_MAG_PRESETMODE_HIGHACCURACY (3)
  3095. #define BMI160_MAG_PRESETMODE_ENHANCED (4)
  3096. /**************************************************/
  3097. /**\name BMM150 PRESET MODES - DATA RATES */
  3098. /*************************************************/
  3099. #define BMI160_MAG_LOWPOWER_DR (0x02)
  3100. #define BMI160_MAG_REGULAR_DR (0x02)
  3101. #define BMI160_MAG_HIGHACCURACY_DR (0x2A)
  3102. #define BMI160_MAG_ENHANCED_DR (0x02)
  3103. /**************************************************/
  3104. /**\name BMM150 PRESET MODES - REPETITIONS-XY RATES */
  3105. /*************************************************/
  3106. #define BMI160_MAG_LOWPOWER_REPXY (1)
  3107. #define BMI160_MAG_REGULAR_REPXY (4)
  3108. #define BMI160_MAG_HIGHACCURACY_REPXY (23)
  3109. #define BMI160_MAG_ENHANCED_REPXY (7)
  3110. /**************************************************/
  3111. /**\name BMM150 PRESET MODES - REPETITIONS-Z RATES */
  3112. /*************************************************/
  3113. #define BMI160_MAG_LOWPOWER_REPZ (2)
  3114. #define BMI160_MAG_REGULAR_REPZ (14)
  3115. #define BMI160_MAG_HIGHACCURACY_REPZ (82)
  3116. #define BMI160_MAG_ENHANCED_REPZ (26)
  3117. #define BMI160_MAG_NORMAL_SWITCH_TIMES (5)
  3118. #define MAG_INTERFACE_PMU_ENABLE (1)
  3119. #define MAG_INTERFACE_PMU_DISABLE (0)
  3120. /**************************************************/
  3121. /**\name USED FOR MAG OVERFLOW CHECK FOR BMM150 */
  3122. /*************************************************/
  3123. #define BMI160_MAG_OVERFLOW_OUTPUT ((s16)-32768)
  3124. #define BMI160_MAG_OVERFLOW_OUTPUT_S32 ((s32)(-2147483647-1))
  3125. #define BMI160_MAG_NEGATIVE_SATURATION_Z ((s16)-32767)
  3126. #define BMI160_MAG_POSITIVE_SATURATION_Z ((u16)32767)
  3127. #define BMI160_MAG_FLIP_OVERFLOW_ADCVAL ((s16)-4096)
  3128. #define BMI160_MAG_HALL_OVERFLOW_ADCVAL ((s16)-16384)
  3129. /**************************************************/
  3130. /**\name BMM150 REGISTER DEFINITION */
  3131. /*************************************************/
  3132. #define BMI160_BMM150_CHIP_ID (0x40)
  3133. #define BMI160_BMM150_POWER_CONTROL_REG (0x4B)
  3134. #define BMI160_BMM150_POWER_MODE_REG (0x4C)
  3135. #define BMI160_BMM150_DATA_REG (0x42)
  3136. #define BMI160_BMM150_XY_REP (0x51)
  3137. #define BMI160_BMM150_Z_REP (0x52)
  3138. /**************************************************/
  3139. /**\name AKM COMPENSATING DATA REGISTERS */
  3140. /*************************************************/
  3141. #define BMI160_BST_AKM_ASAX (0x60)
  3142. #define BMI160_BST_AKM_ASAY (0x61)
  3143. #define BMI160_BST_AKM_ASAZ (0x62)
  3144. /**************************************************/
  3145. /**\name AKM POWER MODE SELECTION */
  3146. /*************************************************/
  3147. #define AKM_POWER_DOWN_MODE (0)
  3148. #define AKM_SINGLE_MEAS_MODE (1)
  3149. #define FUSE_ROM_MODE (2)
  3150. /**************************************************/
  3151. /**\name SECONDARY_MAG POWER MODE SELECTION */
  3152. /*************************************************/
  3153. #define BMI160_MAG_FORCE_MODE (0)
  3154. #define BMI160_MAG_SUSPEND_MODE (1)
  3155. /**************************************************/
  3156. /**\name MAG POWER MODE SELECTION */
  3157. /*************************************************/
  3158. #define FORCE_MODE (0)
  3159. #define SUSPEND_MODE (1)
  3160. #define NORMAL_MODE (2)
  3161. #define MAG_SUSPEND_MODE (1)
  3162. #ifdef FIFO_ENABLE
  3163. /**************************************************/
  3164. /**\name FIFO CONFIGURATIONS */
  3165. /*************************************************/
  3166. #define FIFO_HEADER_ENABLE (0x01)
  3167. #define FIFO_MAG_ENABLE (0x01)
  3168. #define FIFO_ACCEL_ENABLE (0x01)
  3169. #define FIFO_GYRO_ENABLE (0x01)
  3170. #define FIFO_TIME_ENABLE (0x01)
  3171. #define FIFO_STOPONFULL_ENABLE (0x01)
  3172. #define FIFO_WM_INTERRUPT_ENABLE (0x01)
  3173. #define BMI160_FIFO_INDEX_LENGTH (1)
  3174. #define BMI160_FIFO_TAG_INTR_MASK (0xFC)
  3175. /* FIFO definitions*/
  3176. #define FIFO_HEAD_A (0x84)
  3177. #define FIFO_HEAD_G (0x88)
  3178. #define FIFO_HEAD_M (0x90)
  3179. #define FIFO_HEAD_G_A (0x8C)
  3180. #define FIFO_HEAD_M_A (0x94)
  3181. #define FIFO_HEAD_M_G (0x98)
  3182. #define FIFO_HEAD_M_G_A (0x9C)
  3183. #define FIFO_HEAD_SENSOR_TIME (0x44)
  3184. #define FIFO_HEAD_INPUT_CONFIG (0x48)
  3185. #define FIFO_HEAD_SKIP_FRAME (0x40)
  3186. #define FIFO_HEAD_OVER_READ_LSB (0x80)
  3187. #define FIFO_HEAD_OVER_READ_MSB (0x00)
  3188. #define FIFO_INPUT_CONFIG_OVER_LEN ((s8)-11)
  3189. #define FIFO_OVER_READ_RETURN ((s8)-10)
  3190. #define FIFO_SENSORTIME_RETURN ((s8)-9)
  3191. #define FIFO_SKIP_OVER_LEN ((s8)-8)
  3192. #define FIFO_M_G_A_OVER_LEN ((s8)-7)
  3193. #define FIFO_M_G_OVER_LEN ((s8)-6)
  3194. #define FIFO_M_A_OVER_LEN ((s8)-5)
  3195. #define FIFO_G_A_OVER_LEN ((s8)-4)
  3196. #define FIFO_M_OVER_LEN ((s8)-3)
  3197. #define FIFO_G_OVER_LEN ((s8)-2)
  3198. #define FIFO_A_OVER_LEN ((s8)-1)
  3199. #endif
  3200. /**************************************************/
  3201. /**\name ACCEL POWER MODE */
  3202. /*************************************************/
  3203. #define ACCEL_MODE_NORMAL (0x11)
  3204. #define ACCEL_LOWPOWER (0X12)
  3205. #define ACCEL_SUSPEND (0X10)
  3206. /* BMI160 Accel power modes*/
  3207. #define BMI160_ACCEL_SUSPEND 0
  3208. #define BMI160_ACCEL_NORMAL_MODE 1
  3209. #define BMI160_ACCEL_LOW_POWER 2
  3210. /**************************************************/
  3211. /**\name GYRO POWER MODE */
  3212. /*************************************************/
  3213. #define GYRO_MODE_SUSPEND (0x14)
  3214. #define GYRO_MODE_NORMAL (0x15)
  3215. #define GYRO_MODE_FASTSTARTUP (0x17)
  3216. /**************************************************/
  3217. /**\name MAG POWER MODE */
  3218. /*************************************************/
  3219. #define MAG_MODE_SUSPEND (0x18)
  3220. #define MAG_MODE_NORMAL (0x19)
  3221. #define MAG_MODE_LOWPOWER (0x1A)
  3222. /**************************************************/
  3223. /**\name ENABLE/DISABLE BIT VALUES */
  3224. /*************************************************/
  3225. #define BMI160_ENABLE (0x01)
  3226. #define BMI160_DISABLE (0x00)
  3227. /**************************************************/
  3228. /**\name INTERRUPT EDGE TRIGGER ENABLE */
  3229. /*************************************************/
  3230. #define BMI160_EDGE (0x01)
  3231. #define BMI160_LEVEL (0x00)
  3232. /**************************************************/
  3233. /**\name INTERRUPT LEVEL ENABLE */
  3234. /*************************************************/
  3235. #define BMI160_LEVEL_LOW (0x00)
  3236. #define BMI160_LEVEL_HIGH (0x01)
  3237. /**************************************************/
  3238. /**\name INTERRUPT OUTPUT ENABLE */
  3239. /*************************************************/
  3240. #define BMI160_OPEN_DRAIN (0x01)
  3241. #define BMI160_PUSH_PULL (0x00)
  3242. /* interrupt output enable*/
  3243. #define BMI160_INPUT (0x01)
  3244. #define BMI160_OUTPUT (0x00)
  3245. /**************************************************/
  3246. /**\name INTERRUPT TAP SOURCE ENABLE */
  3247. /*************************************************/
  3248. #define FILTER_DATA (0x00)
  3249. #define UNFILTER_DATA (0x01)
  3250. /**************************************************/
  3251. /**\name SLOW MOTION/ NO MOTION SELECT */
  3252. /*************************************************/
  3253. #define SLOW_MOTION (0x00)
  3254. #define NO_MOTION (0x01)
  3255. /**************************************************/
  3256. /**\name SIGNIFICANT MOTION SELECTION */
  3257. /*************************************************/
  3258. #define ANY_MOTION (0x00)
  3259. #define SIGNIFICANT_MOTION (0x01)
  3260. /**************************************************/
  3261. /**\name LATCH DURATION */
  3262. /*************************************************/
  3263. #define BMI160_LATCH_DUR_NONE (0x00)
  3264. #define BMI160_LATCH_DUR_312_5_MICRO_SEC (0x01)
  3265. #define BMI160_LATCH_DUR_625_MICRO_SEC (0x02)
  3266. #define BMI160_LATCH_DUR_1_25_MILLI_SEC (0x03)
  3267. #define BMI160_LATCH_DUR_2_5_MILLI_SEC (0x04)
  3268. #define BMI160_LATCH_DUR_5_MILLI_SEC (0x05)
  3269. #define BMI160_LATCH_DUR_10_MILLI_SEC (0x06)
  3270. #define BMI160_LATCH_DUR_20_MILLI_SEC (0x07)
  3271. #define BMI160_LATCH_DUR_40_MILLI_SEC (0x08)
  3272. #define BMI160_LATCH_DUR_80_MILLI_SEC (0x09)
  3273. #define BMI160_LATCH_DUR_160_MILLI_SEC (0x0A)
  3274. #define BMI160_LATCH_DUR_320_MILLI_SEC (0x0B)
  3275. #define BMI160_LATCH_DUR_640_MILLI_SEC (0x0C)
  3276. #define BMI160_LATCH_DUR_1_28_SEC (0x0D)
  3277. #define BMI160_LATCH_DUR_2_56_SEC (0x0E)
  3278. #define BMI160_LATCHED (0x0F)
  3279. /**************************************************/
  3280. /**\name GYRO OFFSET MASK DEFINITION */
  3281. /*************************************************/
  3282. #define BMI160_GYRO_MANUAL_OFFSET_0_7 (0x00FF)
  3283. #define BMI160_GYRO_MANUAL_OFFSET_8_9 (0x0300)
  3284. /**************************************************/
  3285. /**\name STEP CONFIGURATION MASK DEFINITION */
  3286. /*************************************************/
  3287. #define BMI160_STEP_CONFIG_0_7 (0x00FF)
  3288. #define BMI160_STEP_CONFIG_8_10 (0x0700)
  3289. #define BMI160_STEP_CONFIG_11_14 (0xF000)
  3290. /**************************************************/
  3291. /**\name DEFINITION USED FOR DIFFERENT WRITE */
  3292. /*************************************************/
  3293. #define BMI160_MANUAL_DISABLE (0x00)
  3294. #define BMI160_MANUAL_ENABLE (0x01)
  3295. #define BMI160_YAS_DISABLE_RCOIL (0x00)
  3296. #define BMI160_ENABLE_MAG_IF_MODE (0x02)
  3297. #define BMI160_ENABLE_ANY_MOTION_INTR1 (0x04)
  3298. #define BMI160_ENABLE_ANY_MOTION_INTR2 (0x04)
  3299. #define BMI160_MAG_DATA_READ_REG (0x04)
  3300. #define BMI160_BMM_POWER_MODE_REG (0x06)
  3301. #define BMI160_ENABLE_ANY_MOTION_AXIS (0x07)
  3302. #define BMI160_ENABLE_LOW_G (0x08)
  3303. #define BMI160_YAS532_ACQ_START (0x11)
  3304. #define BMI160_YAS_DEVICE_ID_REG (0x80)
  3305. #define BMI160_FIFO_GYRO_ENABLE (0x80)
  3306. #define BMI160_SIG_MOTION_INTR_ENABLE (0x01)
  3307. #define BMI160_STEP_DETECT_INTR_ENABLE (0x01)
  3308. #define BMI160_LOW_G_INTR_STAT (0x01)
  3309. #define BMI160_PULL_UP_DATA (0x30)
  3310. #define BMI160_FIFO_M_G_A_ENABLE (0xE0)
  3311. #define BMI160_FIFO_M_G_ENABLE (0xA0)
  3312. #define BMI160_FIFO_M_A_ENABLE (0x60)
  3313. #define BMI160_FIFO_G_A_ENABLE (0xC0)
  3314. #define BMI160_FIFO_A_ENABLE (0x40)
  3315. #define BMI160_FIFO_M_ENABLE (0x20)
  3316. #define BMI160_SEC_IF_BMM150 (0)
  3317. #define BMI160_SEC_IF_AKM09911 (1)
  3318. #define BMI160_SEC_IF_AKM09912 (2)
  3319. #define BMI160_SEC_IF_YAS532 (3)
  3320. #define BMI160_SEC_IF_YAS537 (4)
  3321. /**************************************************/
  3322. /**\name MAG INIT DEFINITION */
  3323. /*************************************************/
  3324. #define BMI160_COMMAND_REG_ONE (0x37)
  3325. #define BMI160_COMMAND_REG_TWO (0x9A)
  3326. #define BMI160_COMMAND_REG_THREE (0xC0)
  3327. #define RESET_STEP_COUNTER (0xB2)
  3328. /**************************************************/
  3329. /**\name BIT SLICE GET AND SET FUNCTIONS */
  3330. /*************************************************/
  3331. #define BMI160_GET_BITSLICE(regvar, bitname)\
  3332. ((regvar & bitname##__MSK) >> bitname##__POS)
  3333. #define BMI160_SET_BITSLICE(regvar, bitname, val)\
  3334. ((regvar & ~bitname##__MSK) | \
  3335. ((val<<bitname##__POS)&bitname##__MSK))
  3336. /**************************************************/
  3337. /**\name FUNCTION DECLARATIONS */
  3338. /*************************************************/
  3339. /**************************************************/
  3340. /**\name FUNCTION FOR BMI160 INITIALIZE */
  3341. /*************************************************/
  3342. /*!
  3343. * @brief
  3344. * This API is used to initialize
  3345. * bus read and bus write functions
  3346. * assign the chip id and device address.
  3347. * chip id is read in the register 0x00 bit from 0 to 7
  3348. *
  3349. * @param bmi160 : structure pointer of bmi160 instance
  3350. *
  3351. * @return results of bus communication function
  3352. * @retval 0 -> Success
  3353. * @retval -1 -> Error
  3354. *
  3355. * @note
  3356. * While changing the parameter of the bmi160_t
  3357. * consider the following points:
  3358. * Changing the reference value of the parameter
  3359. * will change the local copy or local reference
  3360. * make sure your changes will not
  3361. * affect the reference value of the parameter
  3362. * (Better don't change the reference value of the parameter)
  3363. *
  3364. */
  3365. BMI160_RETURN_FUNCTION_TYPE bmi160_init(struct bmi160_t *bmi160);
  3366. /**************************************************/
  3367. /**\name FUNCTION FOR READ AND WRITE REGISTERS */
  3368. /*************************************************/
  3369. /*!
  3370. * @brief
  3371. * This API writes the data to
  3372. * the given register
  3373. *
  3374. *
  3375. * @param v_addr_u8 -> Address of the register
  3376. * @param v_data_u8 -> The data to write to the register
  3377. * @param v_len_u8 -> no of bytes to write
  3378. *
  3379. *
  3380. * @return results of bus communication function
  3381. * @retval 0 -> Success
  3382. * @retval -1 -> Error
  3383. *
  3384. *
  3385. */
  3386. BMI160_RETURN_FUNCTION_TYPE bmi160_write_reg(u8 v_addr_u8,
  3387. u8 *v_data_u8, u8 v_len_u8);
  3388. /*!
  3389. * @brief
  3390. * This API reads the data from
  3391. * the given register
  3392. *
  3393. *
  3394. * @param v_addr_u8 -> Address of the register
  3395. * @param v_data_u8 -> The data read from the register
  3396. * @param v_len_u8 -> no of bytes to read
  3397. *
  3398. *
  3399. * @return results of bus communication function
  3400. * @retval 0 -> Success
  3401. * @retval -1 -> Error
  3402. *
  3403. *
  3404. */
  3405. BMI160_RETURN_FUNCTION_TYPE bmi160_read_reg(u8 v_addr_u8,
  3406. u8 *v_data_u8, u8 v_len_u8);
  3407. /**************************************************/
  3408. /**\name FUNCTION FOR ERROR CODES */
  3409. /*************************************************/
  3410. /*!
  3411. * @brief This API is used to read the fatal error
  3412. * from the register 0x02 bit 0
  3413. * This flag will be reset only by power-on-reset and soft reset
  3414. *
  3415. *
  3416. * @param v_fatal_err_u8 : The status of fatal error
  3417. *
  3418. *
  3419. *
  3420. * @return results of bus communication function
  3421. * @retval 0 -> Success
  3422. * @retval -1 -> Error
  3423. *
  3424. *
  3425. */
  3426. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fatal_err(u8
  3427. *v_fatal_err_u8);
  3428. /*!
  3429. * @brief This API is used to read the error code
  3430. * from register 0x02 bit 1 to 4
  3431. *
  3432. *
  3433. * @param v_err_code_u8 : The status of error codes
  3434. * error_code | description
  3435. * ------------|---------------
  3436. * 0x00 |no error
  3437. * 0x01 |ACC_CONF error (accel ODR and bandwidth not compatible)
  3438. * 0x02 |GYR_CONF error (Gyroscope ODR and bandwidth not compatible)
  3439. * 0x03 |Under sampling mode and interrupt uses pre filtered data
  3440. * 0x04 |reserved
  3441. * 0x05 |Selected trigger-readout offset in MAG_IF is greater than
  3442. * |selected ODR
  3443. * 0x06 |FIFO configuration error for header less mode
  3444. * 0x07 |Under sampling mode and pre filtered data as FIFO source
  3445. *
  3446. * @return results of bus communication function
  3447. * @retval 0 -> Success
  3448. * @retval -1 -> Error
  3449. *
  3450. *
  3451. */
  3452. BMI160_RETURN_FUNCTION_TYPE bmi160_get_err_code(u8
  3453. *v_error_code_u8);
  3454. /*!
  3455. * @brief This API reads the i2c error code from the
  3456. * Register 0x02 bit 5.
  3457. * This error occurred in I2C master detected
  3458. *
  3459. * @param v_i2c_err_code_u8 : The status of i2c fail error
  3460. *
  3461. *
  3462. *
  3463. * @return results of bus communication function
  3464. * @retval 0 -> Success
  3465. * @retval -1 -> Error
  3466. *
  3467. *
  3468. */
  3469. BMI160_RETURN_FUNCTION_TYPE bmi160_get_i2c_fail_err(u8
  3470. *v_i2c_error_code_u8);
  3471. /*!
  3472. * @brief This API reads the dropped command error
  3473. * from the register 0x02 bit 6
  3474. *
  3475. *
  3476. * @param v_drop_cmd_err_u8 : The status of dropped command error
  3477. *
  3478. *
  3479. *
  3480. * @return results of bus communication function
  3481. * @retval 0 -> Success
  3482. * @retval -1 -> Error
  3483. *
  3484. *
  3485. */
  3486. BMI160_RETURN_FUNCTION_TYPE bmi160_get_drop_cmd_err(u8
  3487. *v_drop_cmd_err_u8);
  3488. /*!
  3489. * @brief This API reads the Mag data ready
  3490. * error interrupt
  3491. * It reads from the error register 0x02 bit 7
  3492. *
  3493. *
  3494. *
  3495. *
  3496. * @param v_mag_data_rdy_err_u8 : The status of Mag data ready error interrupt
  3497. *
  3498. *
  3499. *
  3500. * @return results of bus communication function
  3501. * @retval 0 -> Success
  3502. * @retval -1 -> Error
  3503. *
  3504. *
  3505. */
  3506. BMI160_RETURN_FUNCTION_TYPE bmi160_get_mag_data_rdy_err(u8
  3507. *v_mag_data_rdy_err_u8);
  3508. /*!
  3509. * @brief This API reads the error status
  3510. * from the error register 0x02 bit 0 to 7
  3511. *
  3512. * @param v_mag_data_rdy_err_u8 : The status of Mag data ready interrupt
  3513. * @param v_fatal_err_u8 : The status of fatal error
  3514. * @param v_err_code_u8 : The status of error code
  3515. * @param v_i2c_fail_err_u8 : The status of I2C fail error
  3516. * @param v_drop_cmd_err_u8 : The status of drop command error
  3517. *
  3518. *
  3519. *
  3520. * @return results of bus communication function
  3521. * @retval 0 -> Success
  3522. * @retval -1 -> Error
  3523. *
  3524. *
  3525. */
  3526. BMI160_RETURN_FUNCTION_TYPE bmi160_get_error_status(u8 *v_fatal_err_u8,
  3527. u8 *v_err_code_u8, u8 *v_i2c_fail_err_u8,
  3528. u8 *v_drop_cmd_err_u8, u8 *v_mag_data_rdy_err_u8);
  3529. /******************************************************************/
  3530. /**\name FUNCTIONS FOR MAG,ACCEL AND GYRO POWER MODE STATUS */
  3531. /*****************************************************************/
  3532. /*!
  3533. * @brief This API reads the Mag power mode from
  3534. * PMU status register 0x03 bit 0 and 1
  3535. *
  3536. * @param v_mag_power_mode_stat_u8 : The value of Mag power mode
  3537. * mag_powermode | value
  3538. * ------------------|----------
  3539. * SUSPEND | 0x00
  3540. * NORMAL | 0x01
  3541. * LOW POWER | 0x02
  3542. *
  3543. *
  3544. * @note The power mode of Mag is set by the 0x7E command register
  3545. * using the function "bmi160_set_command_register()"
  3546. * value | mode
  3547. * ---------|----------------
  3548. * 0x18 | MAG_MODE_SUSPEND
  3549. * 0x19 | MAG_MODE_NORMAL
  3550. * 0x1A | MAG_MODE_LOWPOWER
  3551. *
  3552. * @return results of bus communication function
  3553. * @retval 0 -> Success
  3554. * @retval -1 -> Error
  3555. *
  3556. *
  3557. */
  3558. BMI160_RETURN_FUNCTION_TYPE bmi160_get_mag_power_mode_stat(u8
  3559. *v_mag_power_mode_stat_u8);
  3560. /*!
  3561. * @brief This API reads the Gyro power mode from
  3562. * PMU status register 0x03 bit 2 and 3
  3563. *
  3564. * @param v_gyro_power_mode_stat_u8 : The value of Gyro power mode
  3565. * gyro_powermode | value
  3566. * ------------------|----------
  3567. * SUSPEND | 0x00
  3568. * NORMAL | 0x01
  3569. * FAST POWER UP | 0x03
  3570. *
  3571. * @note The power mode of Gyro is set by the 0x7E command register
  3572. * using the function "bmi160_set_command_register()"
  3573. * value | mode
  3574. * ---------|----------------
  3575. * 0x14 | GYRO_MODE_SUSPEND
  3576. * 0x15 | GYRO_MODE_NORMAL
  3577. * 0x17 | GYRO_MODE_FASTSTARTUP
  3578. *
  3579. * @return results of bus communication function
  3580. * @retval 0 -> Success
  3581. * @retval -1 -> Error
  3582. *
  3583. *
  3584. */
  3585. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_power_mode_stat(u8
  3586. *v_gyro_power_mode_stat_u8);
  3587. /*!
  3588. * @brief This API reads the Accel power mode from
  3589. * PMU status register 0x03 bit 4 and 5
  3590. *
  3591. *
  3592. * @param v_accel_power_mode_stat_u8 : The value of Accel power mode
  3593. * accel_powermode | value
  3594. * ------------------|----------
  3595. * SUSPEND | 0x00
  3596. * NORMAL | 0x01
  3597. * LOW POWER | 0x02
  3598. *
  3599. * @note The power mode of Accel is set by the 0x7E command register
  3600. * using the function "bmi160_set_command_register()"
  3601. * value | mode
  3602. * ---------|----------------
  3603. * 0x11 | ACCEL_MODE_NORMAL
  3604. * 0x12 | ACCEL_LOWPOWER
  3605. * 0x10 | ACCEL_SUSPEND
  3606. *
  3607. * @return results of bus communication function
  3608. * @retval 0 -> Success
  3609. * @retval -1 -> Error
  3610. *
  3611. *
  3612. */
  3613. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_power_mode_stat(u8
  3614. *v_accel_power_mode_stat_u8);
  3615. /*!
  3616. * @brief This API switches the Mag interface to normal mode
  3617. * and confirm whether the mode switching is done successfully or not
  3618. *
  3619. * @return results of bus communication function
  3620. * @retval 0 -> Success
  3621. * @retval -1 -> Error
  3622. *
  3623. */
  3624. BMI160_RETURN_FUNCTION_TYPE bmi160_set_mag_interface_normal(void);
  3625. /**************************************************/
  3626. /**\name FUNCTION FOR Mag XYZ data read */
  3627. /*************************************************/
  3628. /*!
  3629. * @brief This API reads Mag data X values
  3630. * from the register 0x04 and 0x05
  3631. * @brief The Mag sensor data read from auxiliary mag
  3632. *
  3633. * @param v_mag_x_s16 : The value of Mag x
  3634. * @param v_sensor_select_u8 : Mag selection value
  3635. * value | sensor
  3636. * ---------|----------------
  3637. * 0 | BMM150
  3638. * 1 | AKM09911 or AKM09912
  3639. *
  3640. * @note For Mag output data rate configuration use the following function
  3641. * bmi160_set_mag_output_data_rate()
  3642. *
  3643. *
  3644. *
  3645. * @return results of bus communication function
  3646. * @retval 0 -> Success
  3647. * @retval -1 -> Error
  3648. *
  3649. */
  3650. BMI160_RETURN_FUNCTION_TYPE bmi160_read_mag_x(s16 *v_mag_x_s16,
  3651. u8 v_sensor_select_u8);
  3652. /*!
  3653. * @brief This API reads Mag data Y values
  3654. * from the register 0x06 and 0x07
  3655. * @brief The Mag sensor data read from auxiliary mag
  3656. *
  3657. * @param v_mag_y_s16 : The value of Mag y
  3658. * @param v_sensor_select_u8 : Mag selection value
  3659. * value | sensor
  3660. * ---------|----------------
  3661. * 0 | BMM150
  3662. * 1 | AKM09911 or AKM09912
  3663. *
  3664. * @note For Mag output data rate configuration use the following function
  3665. * bmi160_set_mag_output_data_rate()
  3666. *
  3667. * @return results of bus communication function
  3668. * @retval 0 -> Success
  3669. * @retval -1 -> Error
  3670. *
  3671. *
  3672. */
  3673. BMI160_RETURN_FUNCTION_TYPE bmi160_read_mag_y(s16 *v_mag_y_s16,
  3674. u8 v_sensor_select_u8);
  3675. /*!
  3676. * @brief This API reads Mag data Z values
  3677. * from the register 0x08 and 0x09
  3678. * @brief The Mag sensor data read from auxiliary mag
  3679. *
  3680. * @param v_mag_z_s16 : The value of Mag z
  3681. * @param v_sensor_select_u8 : Mag selection value
  3682. * value | sensor
  3683. * ---------|----------------
  3684. * 0 | BMM150
  3685. * 1 | AKM09911 or AKM09912
  3686. *
  3687. * @note For Mag output data rate configuration use the following function
  3688. * bmi160_set_mag_output_data_rate()
  3689. *
  3690. * @return results of bus communication function
  3691. * @retval 0 -> Success
  3692. * @retval -1 -> Error
  3693. *
  3694. *
  3695. */
  3696. BMI160_RETURN_FUNCTION_TYPE bmi160_read_mag_z(s16 *v_mag_z_s16,
  3697. u8 v_sensor_select_u8);
  3698. /*!
  3699. * @brief This API reads Mag data RHALL values
  3700. * from the register 0x0A and 0x0B
  3701. *
  3702. *
  3703. * @param v_mag_r_s16 : The value of BMM150 r data
  3704. *
  3705. *
  3706. *
  3707. * @return results of bus communication function
  3708. * @retval 0 -> Success
  3709. * @retval -1 -> Error
  3710. *
  3711. *
  3712. */
  3713. BMI160_RETURN_FUNCTION_TYPE bmi160_read_mag_r(
  3714. s16 *v_mag_r_s16);
  3715. /*!
  3716. * @brief This API reads Mag data X,Y,Z values
  3717. * from the register 0x04 to 0x09
  3718. *
  3719. * @brief The Mag sensor data read from auxiliary mag
  3720. *
  3721. * @param Mag : The value of Mag xyz data
  3722. * @param v_sensor_select_u8 : Mag selection value
  3723. * value | sensor
  3724. * ---------|----------------
  3725. * 0 | BMM150
  3726. * 1 | AKM09911 or AKM09912
  3727. *
  3728. * @note For Mag output data rate configuration use the following function
  3729. * @note bmi160_set_mag_output_data_rate()
  3730. *
  3731. * @return results of bus communication function
  3732. * @retval 0 -> Success
  3733. * @retval -1 -> Error *
  3734. *
  3735. */
  3736. BMI160_RETURN_FUNCTION_TYPE bmi160_read_mag_xyz(
  3737. struct bmi160_mag_t *mag, u8 v_sensor_select_u8);
  3738. /*!*
  3739. * @brief This API reads Mag data X,Y,Z,r
  3740. * values from the register 0x04 to 0x0B.
  3741. *
  3742. * @brief The Mag sensor data read from auxiliary mag.
  3743. *
  3744. * @param Mag : The value of mag-BMM150 xyzr data.
  3745. *
  3746. * @note For Mag data output rate configuration use the following function
  3747. * @note bmi160_set_mag_output_data_rate().
  3748. *
  3749. * @return results of bus communication function.
  3750. * @retval 0 -> Success
  3751. * @retval -1 -> Error
  3752. *
  3753. *
  3754. */
  3755. BMI160_RETURN_FUNCTION_TYPE bmi160_read_mag_xyzr(
  3756. struct bmi160_mag_xyzr_t *mag);
  3757. /**************************************************/
  3758. /**\name FUNCTION FOR GYRO XYZ DATA READ */
  3759. /*************************************************/
  3760. /*!
  3761. * @brief This API reads Gyro data X values
  3762. * from the register 0x0C and 0x0D.
  3763. *
  3764. * @param v_gyro_x_s16 : The value of Gyro x data.
  3765. *
  3766. * @note Gyro configuration use the following functions.
  3767. * @note bmi160_set_gyro_output_data_rate()
  3768. * @note bmi160_set_gyro_bw()
  3769. * @note bmi160_set_gyro_range()
  3770. *
  3771. * @return results of bus communication function.
  3772. * @retval 0 -> Success
  3773. * @retval -1 -> Error
  3774. *
  3775. */
  3776. BMI160_RETURN_FUNCTION_TYPE bmi160_read_gyro_x(
  3777. s16 *v_gyro_x_s16);
  3778. /*!
  3779. * @brief This API reads Gyro data Y values
  3780. * from the register 0x0E and 0x0F.
  3781. *
  3782. * @param v_gyro_y_s16 : The value of Gyro y data.
  3783. *
  3784. * @note Gyro configuration use the following function
  3785. * @note bmi160_set_gyro_output_data_rate()
  3786. * @note bmi160_set_gyro_bw()
  3787. * @note bmi160_set_gyro_range()
  3788. *
  3789. * @return results of bus communication function.
  3790. * @retval 0 -> Success
  3791. * @retval -1 -> Error result of communication routines
  3792. *
  3793. */
  3794. BMI160_RETURN_FUNCTION_TYPE bmi160_read_gyro_y(
  3795. s16 *v_gyro_y_s16);
  3796. /*!
  3797. * @brief This API reads Gyro data Z values
  3798. * from the register 0x10 and 0x11.
  3799. *
  3800. * @param v_gyro_z_s16 : The value of Gyro z data.
  3801. *
  3802. * @note Gyro configuration use the following functions.
  3803. * @note bmi160_set_gyro_output_data_rate()
  3804. * @note bmi160_set_gyro_bw()
  3805. * @note bmi160_set_gyro_range()
  3806. *
  3807. * @return results of the bus communication function
  3808. * @retval 0 -> Success
  3809. * @retval -1 -> Error
  3810. *
  3811. */
  3812. BMI160_RETURN_FUNCTION_TYPE bmi160_read_gyro_z(
  3813. s16 *v_gyro_z_s16);
  3814. /*!
  3815. * @brief This API reads Gyro data X,Y,Z values
  3816. * from the register 0x0C to 0x11.
  3817. *
  3818. * @param Gyro : The value of Gyro xyz.
  3819. *
  3820. * @note Gyro configuration use the following functions.
  3821. * @note bmi160_set_gyro_output_data_rate()
  3822. * @note bmi160_set_gyro_bw()
  3823. * @note bmi160_set_gyro_range()
  3824. *
  3825. * @return results of bus communication function
  3826. * @retval 0 -> Success
  3827. * @retval -1 -> Error
  3828. *
  3829. */
  3830. BMI160_RETURN_FUNCTION_TYPE bmi160_read_gyro_xyz(
  3831. struct bmi160_gyro_t *gyro);
  3832. /**************************************************/
  3833. /**\name FUNCTION FOR ACCEL XYZ DATA READ */
  3834. /*************************************************/
  3835. /*!
  3836. * @brief This API reads the Accel data for X axis
  3837. * from the register 0x12 and 0x13.
  3838. *
  3839. * @param v_accel_x_s16 : The value of Accel x axis.
  3840. *
  3841. * @note For Accel configuration use the following functions.
  3842. * @note bmi160_set_accel_output_data_rate()
  3843. * @note bmi160_set_accel_bw()
  3844. * @note bmi160_set_accel_under_sampling_parameter()
  3845. * @note bmi160_set_accel_range()
  3846. *
  3847. * @return results of bus communication function
  3848. * @retval 0 -> Success
  3849. * @retval -1 -> Error
  3850. *
  3851. */
  3852. BMI160_RETURN_FUNCTION_TYPE bmi160_read_accel_x(
  3853. s16 *v_accel_x_s16);
  3854. /*!
  3855. * @brief This API reads Accel data for Y axis
  3856. * from the register 0x14 and 0x15.
  3857. *
  3858. * @param v_accel_y_s16 : The value of Accel y axis.
  3859. *
  3860. * @note For Accel configuration use the following functions.
  3861. * @note bmi160_set_accel_output_data_rate()
  3862. * @note bmi160_set_accel_bw()
  3863. * @note bmi160_set_accel_under_sampling_parameter()
  3864. * @note bmi160_set_accel_range()
  3865. *
  3866. * @return results of bus communication function
  3867. * @retval 0 -> Success
  3868. * @retval -1 -> Error
  3869. *
  3870. */
  3871. BMI160_RETURN_FUNCTION_TYPE bmi160_read_accel_y(
  3872. s16 *v_accel_y_s16);
  3873. /*!
  3874. * @brief This API reads Accel data Z values
  3875. * from the register 0x16 and 0x17.
  3876. *
  3877. * @param v_accel_z_s16 : The value of Accel z axis.
  3878. *
  3879. * @note For Accel configuration use the following functions.
  3880. * @note bmi160_set_accel_output_data_rate()
  3881. * @note bmi160_set_accel_bw()
  3882. * @note bmi160_set_accel_under_sampling_parameter()
  3883. * @note bmi160_set_accel_range()
  3884. *
  3885. * @return results of bus communication function
  3886. * @retval 0 -> Success
  3887. * @retval -1 -> Error
  3888. *
  3889. */
  3890. BMI160_RETURN_FUNCTION_TYPE bmi160_read_accel_z(
  3891. s16 *v_accel_z_s16);
  3892. /*!
  3893. * @brief This API reads Accel data X,Y,Z values
  3894. * from the register 0x12 to 0x17.
  3895. *
  3896. * @param Accel :The value of Accel xyz axis.
  3897. *
  3898. * @note For Accel configuration use the following functions.
  3899. * @note bmi160_set_accel_output_data_rate()
  3900. * @note bmi160_set_accel_bw()
  3901. * @note bmi160_set_accel_under_sampling_parameter()
  3902. * @note bmi160_set_accel_range()
  3903. *
  3904. * @return results of bus communication function
  3905. * @retval 0 -> Success
  3906. * @retval -1 -> Error
  3907. *
  3908. */
  3909. BMI160_RETURN_FUNCTION_TYPE bmi160_read_accel_xyz(
  3910. struct bmi160_accel_t *accel);
  3911. /**************************************************/
  3912. /**\name FUNCTION FOR SENSOR TIME */
  3913. /*************************************************/
  3914. /*!
  3915. * @brief This API reads sensor_time from the register
  3916. * 0x18 to 0x1A.
  3917. *
  3918. * @param v_sensor_time_u32 : The value of sensor time.
  3919. *
  3920. * @return results of bus communication function
  3921. * @retval 0 -> Success
  3922. * @retval -1 -> Error
  3923. *
  3924. */
  3925. BMI160_RETURN_FUNCTION_TYPE bmi160_get_sensor_time(
  3926. u32 *v_sensor_time_u32);
  3927. /*!
  3928. * @brief This API reads sensor_time, Accel data, Gyro data from the
  3929. * register 0x0C to 0x1A.
  3930. *
  3931. * @param accel_gyro_sensortime_select : to select the configuration
  3932. * value | output
  3933. * ---------|----------------
  3934. * 0 | Accel data and Sensor time
  3935. * 1 | Accel data ,Gyro data and Sensor time
  3936. *
  3937. * @param accel_gyro_sensor_time : the value of Accel data, Gyro data and
  3938. * sensor time data
  3939. *
  3940. * @return results of bus communication function
  3941. * @retval 0 -> Success
  3942. * @retval -1 -> Error
  3943. *
  3944. */
  3945. BMI160_RETURN_FUNCTION_TYPE bmi160_read_accel_gyro_sensor_time
  3946. (u8 accel_gyro_sensortime_select,
  3947. struct bmi160_sensortime_accel_gyro_data *accel_gyro_sensor_time);
  3948. /**************************************************/
  3949. /**\name FUNCTION FOR GYRO SELF TEST */
  3950. /*************************************************/
  3951. /*!
  3952. * @brief This API reads the Gyro self test
  3953. * status from the register 0x1B bit 1
  3954. *
  3955. * @param v_gyro_selftest_u8 : The value of Gyro self test status
  3956. * value | status
  3957. * ---------|----------------
  3958. * 0 | Gyro self test is running or failed
  3959. * 1 | Gyro self test completed successfully
  3960. *
  3961. * @return results of bus communication function
  3962. * @retval 0 -> Success
  3963. * @retval -1 -> Error
  3964. *
  3965. */
  3966. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_selftest(u8
  3967. *v_gyro_selftest_u8);
  3968. /**************************************************/
  3969. /**\name FUNCTION FOR MANUAL INTERFACE */
  3970. /*************************************************/
  3971. /*!
  3972. * @brief This API reads the status of
  3973. * mag manual interface operation from the register 0x1B bit 2.
  3974. *
  3975. * @param v_mag_manual_stat_u8 : The value of Mag manual operation status
  3976. * value | status
  3977. * ---------|----------------
  3978. * 0 | Indicates no manual magnetometer
  3979. * - | interface operation is ongoing
  3980. * 1 | Indicates manual magnetometer
  3981. * - | interface operation is ongoing
  3982. *
  3983. * @return results of bus communication function
  3984. * @retval 0 -> Success
  3985. * @retval -1 -> Error
  3986. *
  3987. */
  3988. BMI160_RETURN_FUNCTION_TYPE bmi160_get_mag_manual_operation_stat(u8
  3989. *v_mag_manual_stat_u8);
  3990. /**************************************************/
  3991. /**\name FUNCTION FOR FAST OFFSET READY */
  3992. /*************************************************/
  3993. /*!
  3994. * @brief This API reads the fast offset compensation
  3995. * status from the register 0x1B bit 3
  3996. *
  3997. *
  3998. * @param v_foc_rdy_u8 : The status of fast compensation
  3999. *
  4000. *
  4001. *
  4002. * @return results of bus communication function
  4003. * @retval 0 -> Success
  4004. * @retval -1 -> Error
  4005. *
  4006. *
  4007. */
  4008. BMI160_RETURN_FUNCTION_TYPE bmi160_get_foc_rdy(u8
  4009. *v_foc_rdy_u8);
  4010. /**************************************************/
  4011. /**\name FUNCTION FOR DATA READY FOR MAG, GYRO, AND ACCEL */
  4012. /*************************************************/
  4013. /*!
  4014. * @brief This API reads the status of Mag data ready
  4015. * from the register 0x1B bit 5
  4016. * The status get reset when one Mag data register is read out
  4017. *
  4018. * @param v_data_rdy_u8 : The value of Mag data ready status
  4019. *
  4020. *
  4021. *
  4022. * @return results of bus communication function
  4023. * @retval 0 -> Success
  4024. * @retval -1 -> Error
  4025. *
  4026. *
  4027. */
  4028. BMI160_RETURN_FUNCTION_TYPE bmi160_get_data_rdy_mag(u8
  4029. *v_data_rdy_u8);
  4030. /*!
  4031. * @brief This API reads the status of Gyro data ready from the
  4032. * register 0x1B bit 6
  4033. * The status get reset when Gyro data register read out
  4034. *
  4035. *
  4036. * @param v_data_rdy_u8 : The value of Gyro data ready
  4037. *
  4038. *
  4039. *
  4040. * @return results of bus communication function
  4041. * @retval 0 -> Success
  4042. * @retval -1 -> Error
  4043. *
  4044. *
  4045. */
  4046. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_data_rdy(u8
  4047. *v_data_rdy_u8);
  4048. /*!
  4049. * @brief This API reads the status of Accel data ready from the
  4050. * register 0x1B bit 7
  4051. * The status get reset when Accel data register is read
  4052. *
  4053. *
  4054. * @param v_data_rdy_u8 : The value of Accel data ready status
  4055. *
  4056. *
  4057. *
  4058. * @return results of bus communication function
  4059. * @retval 0 -> Success
  4060. * @retval -1 -> Error
  4061. *
  4062. *
  4063. */
  4064. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_data_rdy(u8
  4065. *drdy_acc);
  4066. /**************************************************/
  4067. /**\name FUNCTION FOR STEP INTERRUPT STATUS */
  4068. /*************************************************/
  4069. /*!
  4070. * @brief This API reads the step detector interrupt status
  4071. * from the register 0x1C bit 0
  4072. * flag is associated with a specific interrupt function.
  4073. * It is set when the single tab interrupt triggers. The
  4074. * setting of INT_LATCH controls the interrupt
  4075. * signal and hence the
  4076. * respective interrupt flag will be
  4077. * permanently latched, temporarily latched
  4078. * or not latched.
  4079. *
  4080. *
  4081. *
  4082. *
  4083. * @param v_step_intr_u8 : The status of step detector interrupt
  4084. *
  4085. *
  4086. *
  4087. * @return results of bus communication function
  4088. * @retval 0 -> Success
  4089. * @retval -1 -> Error
  4090. *
  4091. *
  4092. */
  4093. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat0_step_intr(u8
  4094. *v_step_intr_u8);
  4095. /**************************************************/
  4096. /**\name FUNCTION FOR SIGNIFICANT INTERRUPT STATUS */
  4097. /*************************************************/
  4098. /*!
  4099. * @brief This API reads the
  4100. * significant motion interrupt status
  4101. * from the register 0x1C bit 1
  4102. * flag is associated with a specific interrupt function.
  4103. * It is set when the single tab interrupt triggers. The
  4104. * setting of INT_LATCH controls the interrupt
  4105. * signal and hence the
  4106. * respective interrupt flag will be
  4107. * permanently latched, temporarily latched
  4108. * or not latched.
  4109. *
  4110. *
  4111. *
  4112. *
  4113. *
  4114. * @param v_significant_intr_u8 : The status of step
  4115. * motion interrupt
  4116. *
  4117. *
  4118. *
  4119. * @return results of bus communication function
  4120. * @retval 0 -> Success
  4121. * @retval -1 -> Error
  4122. *
  4123. *
  4124. */
  4125. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat0_significant_intr(u8
  4126. *sigmot_intr);
  4127. /**************************************************/
  4128. /**\name FUNCTION FOR ANY MOTION INTERRUPT STATUS */
  4129. /*************************************************/
  4130. /*!
  4131. * @brief This API reads the any motion interrupt status
  4132. * from the register 0x1C bit 2
  4133. * flag is associated with a specific interrupt function.
  4134. * It is set when the single tab interrupt triggers. The
  4135. * setting of INT_LATCH controls the interrupt
  4136. * signal and hence the
  4137. * respective interrupt flag will be
  4138. * permanently latched, temporarily latched
  4139. * or not latched.
  4140. *
  4141. *
  4142. *
  4143. * @param v_any_motion_intr_u8 : The status of any-motion interrupt
  4144. *
  4145. *
  4146. *
  4147. * @return results of bus communication function
  4148. * @retval 0 -> Success
  4149. * @retval -1 -> Error
  4150. *
  4151. *
  4152. */
  4153. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat0_any_motion_intr(u8
  4154. *v_any_motion_intr_u8);
  4155. /**************************************************/
  4156. /**\name FUNCTION FOR PMU TRIGGER INTERRUPT STATUS */
  4157. /*************************************************/
  4158. /*!
  4159. * @brief This API reads the power mode trigger interrupt status
  4160. * from the register 0x1C bit 3
  4161. * flag is associated with a specific interrupt function.
  4162. * It is set when the single tab interrupt triggers. The
  4163. * setting of INT_LATCH controls the interrupt
  4164. * signal and hence the
  4165. * respective interrupt flag will be
  4166. * permanently latched, temporarily latched
  4167. * or not latched.
  4168. *
  4169. *
  4170. *
  4171. *
  4172. *
  4173. * @param v_pmu_trigger_intr_u8 : The status of power mode trigger interrupt
  4174. *
  4175. *
  4176. *
  4177. * @return results of bus communication function
  4178. * @retval 0 -> Success
  4179. * @retval -1 -> Error
  4180. *
  4181. *
  4182. */
  4183. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat0_pmu_trigger_intr(u8
  4184. *v_pmu_trigger_intr_u8);
  4185. /**************************************************/
  4186. /**\name FUNCTION FOR DOUBLE TAB STATUS */
  4187. /*************************************************/
  4188. /*!
  4189. * @brief This API reads the double tab status
  4190. * from the register 0x1C bit 4
  4191. * flag is associated with a specific interrupt function.
  4192. * It is set when the single tab interrupt triggers. The
  4193. * setting of INT_LATCH controls the interrupt
  4194. * signal and hence the
  4195. * respective interrupt flag will be
  4196. * permanently latched, temporarily latched
  4197. * or not latched.
  4198. *
  4199. *
  4200. *
  4201. *
  4202. * @param v_double_tap_intr_u8 :The status of double tab interrupt
  4203. *
  4204. * @note Double tap interrupt can be configured by the following functions
  4205. * @note INTERRUPT MAPPING
  4206. * @note bmi160_set_intr_double_tap()
  4207. * @note AXIS MAPPING
  4208. * @note bmi160_get_stat2_tap_first_x()
  4209. * @note bmi160_get_stat2_tap_first_y()
  4210. * @note bmi160_get_stat2_tap_first_z()
  4211. * @note DURATION
  4212. * @note bmi160_set_intr_tap_durn()
  4213. * @note THRESHOLD
  4214. * @note bmi160_set_intr_tap_thres()
  4215. * @note TAP QUIET
  4216. * @note bmi160_set_intr_tap_quiet()
  4217. * @note TAP SHOCK
  4218. * @note bmi160_set_intr_tap_shock()
  4219. * @note TAP SOURCE
  4220. * @note bmi160_set_intr_tap_source()
  4221. *
  4222. * @return results of bus communication function
  4223. * @retval 0 -> Success
  4224. * @retval -1 -> Error
  4225. *
  4226. *
  4227. */
  4228. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat0_double_tap_intr(u8
  4229. *v_double_tap_intr_u8);
  4230. /**************************************************/
  4231. /**\name FUNCTION FOR SINGLE TAB STATUS */
  4232. /*************************************************/
  4233. /*!
  4234. * @brief This API reads the single tab status
  4235. * from the register 0x1C bit 5
  4236. * flag is associated with a specific interrupt function.
  4237. * It is set when the single tab interrupt triggers. The
  4238. * setting of INT_LATCH controls the interrupt
  4239. * signal and hence the
  4240. * respective interrupt flag will be
  4241. * permanently latched, temporarily latched
  4242. * or not latched.
  4243. *
  4244. *
  4245. *
  4246. *
  4247. * @param v_single_tap_intr_u8 :The status of single tap interrupt
  4248. *
  4249. * @note Single tap interrupt can be configured by the following functions
  4250. * @note INTERRUPT MAPPING
  4251. * @note bmi160_set_intr_single_tap()
  4252. * @note AXIS MAPPING
  4253. * @note bmi160_get_stat2_tap_first_x()
  4254. * @note bmi160_get_stat2_tap_first_y()
  4255. * @note bmi160_get_stat2_tap_first_z()
  4256. * @note DURATION
  4257. * @note bmi160_set_intr_tap_durn()
  4258. * @note THRESHOLD
  4259. * @note bmi160_set_intr_tap_thres()
  4260. * @note TAP QUIET
  4261. * @note bmi160_set_intr_tap_quiet()
  4262. * @note TAP SHOCK
  4263. * @note bmi160_set_intr_tap_shock()
  4264. * @note TAP SOURCE
  4265. * @note bmi160_set_intr_tap_source()
  4266. *
  4267. * @return results of bus communication function
  4268. * @retval 0 -> Success
  4269. * @retval -1 -> Error
  4270. *
  4271. *
  4272. */
  4273. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat0_single_tap_intr(u8
  4274. *v_single_tap_intr_u8);
  4275. /**************************************************/
  4276. /**\name FUNCTION FOR ORIENT INTERRUPT STATUS */
  4277. /*************************************************/
  4278. /*!
  4279. * @brief This API reads the orient status
  4280. * from the register 0x1C bit 6
  4281. * flag is associated with a specific interrupt function.
  4282. * It is set when the orient interrupt triggers. The
  4283. * setting of INT_LATCH controls the
  4284. * interrupt signal and hence the
  4285. * respective interrupt flag will be
  4286. * permanently latched, temporarily latched
  4287. * or not latched.
  4288. *
  4289. *
  4290. *
  4291. *
  4292. * @param v_orient_intr_u8 : The status of orient interrupt
  4293. *
  4294. * @note For orient interrupt configuration use the following functions
  4295. * @note STATUS
  4296. * @note bmi160_get_stat0_orient_intr()
  4297. * @note AXIS MAPPING
  4298. * @note bmi160_get_stat3_orient_xy()
  4299. * @note bmi160_get_stat3_orient_z()
  4300. * @note bmi160_set_intr_orient_axes_enable()
  4301. * @note INTERRUPT MAPPING
  4302. * @note bmi160_set_intr_orient()
  4303. * @note INTERRUPT OUTPUT
  4304. * @note bmi160_set_intr_orient_ud_enable()
  4305. * @note THETA
  4306. * @note bmi160_set_intr_orient_theta()
  4307. * @note HYSTERESIS
  4308. * @note bmi160_set_intr_orient_hyst()
  4309. * @note BLOCKING
  4310. * @note bmi160_set_intr_orient_blocking()
  4311. * @note MODE
  4312. * @note bmi160_set_intr_orient_mode()
  4313. *
  4314. * @return results of bus communication function
  4315. * @retval 0 -> Success
  4316. * @retval -1 -> Error
  4317. *
  4318. *
  4319. */
  4320. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat0_orient_intr(u8
  4321. *v_orient_intr_u8);
  4322. /**************************************************/
  4323. /**\name FUNCTION FOR FLAT INTERRUPT STATUS */
  4324. /*************************************************/
  4325. /*!
  4326. * @brief This API reads the flat interrupt status
  4327. * from the register 0x1C bit 7
  4328. * flag is associated with a specific interrupt function.
  4329. * It is set when the flat interrupt triggers. The
  4330. * setting of INT_LATCH controls the
  4331. * interrupt signal and hence the
  4332. * respective interrupt flag will be
  4333. * permanently latched, temporarily latched
  4334. * or not latched.
  4335. *
  4336. *
  4337. *
  4338. *
  4339. * @param v_flat_intr_u8 : The status of flat interrupt
  4340. *
  4341. * @note For flat configuration use the following functions
  4342. * @note STATS
  4343. * @note bmi160_get_stat0_flat_intr()
  4344. * @note bmi160_get_stat3_flat()
  4345. * @note INTERRUPT MAPPING
  4346. * @note bmi160_set_intr_flat()
  4347. * @note THETA
  4348. * @note bmi160_set_intr_flat_theta()
  4349. * @note HOLD TIME
  4350. * @note bmi160_set_intr_flat_hold()
  4351. * @note HYSTERESIS
  4352. * @note bmi160_set_intr_flat_hyst()
  4353. *
  4354. * @return results of bus communication function
  4355. * @retval 0 -> Success
  4356. * @retval -1 -> Error
  4357. *
  4358. *
  4359. */
  4360. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat0_flat_intr(u8
  4361. *v_flat_intr_u8);
  4362. /**************************************************/
  4363. /**\name FUNCTION FOR HIGH_G INTERRUPT STATUS */
  4364. /*************************************************/
  4365. /*!
  4366. * @brief This API reads the high_g interrupt status
  4367. * from the register 0x1D bit 2
  4368. * flag is associated with a specific interrupt function.
  4369. * It is set when the high g interrupt triggers. The
  4370. * setting of INT_LATCH controls the interrupt signal and hence the
  4371. * respective interrupt flag will be permanently
  4372. * latched, temporarily latched
  4373. * or not latched.
  4374. *
  4375. *
  4376. *
  4377. *
  4378. * @param v_high_g_intr_u8 : The status of high_g interrupt
  4379. *
  4380. * @note High_g interrupt configured by following functions
  4381. * @note STATUS
  4382. * @note bmi160_get_stat1_high_g_intr()
  4383. * @note AXIS MAPPING
  4384. * @note bmi160_get_stat3_high_g_first_x()
  4385. * @note bmi160_get_stat3_high_g_first_y()
  4386. * @note bmi160_get_stat3_high_g_first_z()
  4387. * @note SIGN MAPPING
  4388. * @note bmi160_get_stat3_high_g_first_sign()
  4389. * @note INTERRUPT MAPPING
  4390. * @note bmi160_set_intr_high_g()
  4391. * @note HYSTERESIS
  4392. * @note bmi160_set_intr_high_g_hyst()
  4393. * @note DURATION
  4394. * @note bmi160_set_intr_high_g_durn()
  4395. * @note THRESHOLD
  4396. * @note bmi160_set_intr_high_g_thres()
  4397. * @note SOURCE
  4398. * @note bmi160_set_intr_low_high_source()
  4399. *
  4400. * @return results of bus communication function
  4401. * @retval 0 -> Success
  4402. * @retval -1 -> Error
  4403. *
  4404. */
  4405. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat1_high_g_intr(u8
  4406. *v_high_g_intr_u8);
  4407. /**************************************************/
  4408. /**\name FUNCTION FOR LOW_G INTERRUPT STATUS */
  4409. /*************************************************/
  4410. /*!
  4411. * @brief This API reads the low g interrupt status
  4412. * from the register 0x1D bit 3
  4413. * flag is associated with a specific interrupt function.
  4414. * It is set when the low g interrupt triggers. The
  4415. * setting of INT_LATCH controls the interrupt signal and hence the
  4416. * respective interrupt flag will be
  4417. * permanently latched, temporarily latched
  4418. * or not latched.
  4419. *
  4420. *
  4421. *
  4422. *
  4423. * @param v_low_g_intr_u8 : The status of low_g interrupt
  4424. *
  4425. * @note Low_g interrupt configured by following functions
  4426. * @note STATUS
  4427. * @note bmi160_get_stat1_low_g_intr()
  4428. * @note INTERRUPT MAPPING
  4429. * @note bmi160_set_intr_low_g()
  4430. * @note SOURCE
  4431. * @note bmi160_set_intr_low_high_source()
  4432. * @note DURATION
  4433. * @note bmi160_set_intr_low_g_durn()
  4434. * @note THRESHOLD
  4435. * @note bmi160_set_intr_low_g_thres()
  4436. * @note HYSTERESIS
  4437. * @note bmi160_set_intr_low_g_hyst()
  4438. * @note MODE
  4439. * @note bmi160_set_intr_low_g_mode()
  4440. *
  4441. * @return results of bus communication function
  4442. * @retval 0 -> Success
  4443. * @retval -1 -> Error
  4444. *
  4445. *
  4446. */
  4447. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat1_low_g_intr(u8
  4448. *v_low_g_intr_u8);
  4449. /**************************************************/
  4450. /**\name FUNCTION FOR DATA READY INTERRUPT STATUS */
  4451. /*************************************************/
  4452. /*!
  4453. * @brief This API reads data ready interrupt status
  4454. * from the register 0x1D bit 4
  4455. * flag is associated with a specific interrupt function.
  4456. * It is set when the data ready interrupt triggers. The
  4457. * setting of INT_LATCH controls the interrupt signal and hence the
  4458. * respective interrupt flag will be
  4459. * permanently latched, temporarily latched
  4460. * or not latched.
  4461. *
  4462. *
  4463. *
  4464. *
  4465. * @param v_data_rdy_intr_u8 : The status of data ready interrupt
  4466. *
  4467. * @note Data ready interrupt configured by following functions
  4468. * @note STATUS
  4469. * @note bmi160_get_stat1_data_rdy_intr()
  4470. * @note INTERRUPT MAPPING
  4471. * @note bmi160_set_intr_data_rdy()
  4472. *
  4473. * @return results of bus communication function
  4474. * @retval 0 -> Success
  4475. * @retval -1 -> Error
  4476. *
  4477. *
  4478. */
  4479. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat1_data_rdy_intr(u8
  4480. *v_data_rdy_intr_u8);
  4481. #ifdef FIFO_ENABLE
  4482. /**************************************************/
  4483. /**\name FUNCTIONS FOR FIFO FULL AND WATER MARK INTERRUPT STATUS*/
  4484. /*************************************************/
  4485. /*!
  4486. * @brief This API reads data ready FIFO full interrupt status
  4487. * from the register 0x1D bit 5
  4488. * flag is associated with a specific interrupt function.
  4489. * It is set when the FIFO full interrupt triggers. The
  4490. * setting of INT_LATCH controls the
  4491. * interrupt signal and hence the
  4492. * respective interrupt flag will
  4493. * be permanently latched, temporarily latched
  4494. * or not latched.
  4495. *
  4496. *
  4497. *
  4498. *
  4499. * @param v_fifo_full_intr_u8 : The status of FIFO full interrupt
  4500. *
  4501. * @note FIFO full interrupt can be configured by following functions
  4502. * @note bmi160_set_intr_fifo_full()
  4503. *
  4504. * @return results of bus communication function
  4505. * @retval 0 -> Success
  4506. * @retval -1 -> Error
  4507. *
  4508. *
  4509. */
  4510. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat1_fifo_full_intr(u8
  4511. *v_fifo_full_intr_u8);
  4512. /*!
  4513. * @brief This API reads data
  4514. * ready FIFO watermark interrupt status
  4515. * from the register 0x1D bit 6
  4516. * flag is associated with a specific interrupt function.
  4517. * It is set when the FIFO watermark interrupt triggers. The
  4518. * setting of INT_LATCH controls the
  4519. * interrupt signal and hence the
  4520. * respective interrupt flag will be
  4521. * permanently latched, temporarily latched
  4522. * or not latched.
  4523. *
  4524. *
  4525. *
  4526. *
  4527. * @param v_fifo_wm_intr_u8 : The status of FIFO water mark interrupt
  4528. *
  4529. * @note FIFO full interrupt can be configured by following functions
  4530. * @note bmi160_set_intr_fifo_wm()
  4531. *
  4532. * @return results of bus communication function
  4533. * @retval 0 -> Success
  4534. * @retval -1 -> Error
  4535. *
  4536. *
  4537. */
  4538. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat1_fifo_wm_intr(u8
  4539. *v_fifo_wm_intr_u8);
  4540. #endif
  4541. /**************************************************/
  4542. /**\name FUNCTIONS FOR NO MOTION INTERRUPT STATUS*/
  4543. /*************************************************/
  4544. /*!
  4545. * @brief This API reads data ready no motion interrupt status
  4546. * from the register 0x1D bit 7
  4547. * flag is associated with a specific interrupt function.
  4548. * It is set when the no motion interrupt triggers. The
  4549. * setting of INT_LATCH controls the interrupt signal and hence the
  4550. * respective interrupt flag will be permanently
  4551. * latched, temporarily latched
  4552. * or not latched.
  4553. *
  4554. *
  4555. *
  4556. *
  4557. * @param v_nomotion_intr_u8 : The status of no motion interrupt
  4558. *
  4559. * @note No motion interrupt can be configured by following function
  4560. * @note STATUS
  4561. * @note bmi160_get_stat1_nomotion_intr()
  4562. * @note INTERRUPT MAPPING
  4563. * @note bmi160_set_intr_nomotion()
  4564. * @note DURATION
  4565. * @note bmi160_set_intr_slow_no_motion_durn()
  4566. * @note THRESHOLD
  4567. * @note bmi160_set_intr_slow_no_motion_thres()
  4568. * @note SLOW/NO MOTION SELECT
  4569. * @note bmi160_set_intr_slow_no_motion_select()
  4570. *
  4571. * @return results of bus communication function
  4572. * @retval 0 -> Success
  4573. * @retval -1 -> Error
  4574. *
  4575. *
  4576. */
  4577. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat1_nomotion_intr(u8
  4578. *nomo_intr);
  4579. /**************************************************/
  4580. /**\name FUNCTIONS FOR ANY MOTION FIRST XYZ AND SIGN INTERRUPT STATUS*/
  4581. /*************************************************/
  4582. /*!
  4583. *@brief This API reads the status of any motion first x
  4584. * from the register 0x1E bit 0
  4585. *
  4586. *
  4587. *@param v_anymotion_first_x_u8 : The status of any motion first x interrupt
  4588. * value | status
  4589. * -----------|-------------
  4590. * 0 | not triggered
  4591. * 1 | triggered by x axis
  4592. *
  4593. * @return results of bus communication function
  4594. * @retval 0 -> Success
  4595. * @retval -1 -> Error
  4596. *
  4597. *
  4598. */
  4599. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat2_any_motion_first_x(u8
  4600. *v_anymotion_first_x_u8);
  4601. /*!
  4602. * @brief This API reads the status of any motion first y interrupt
  4603. * from the register 0x1E bit 1
  4604. *
  4605. *
  4606. *
  4607. *@param v_any_motion_first_y_u8 : The status of any motion first y interrupt
  4608. * value | status
  4609. * -----------|-------------
  4610. * 0 | not triggered
  4611. * 1 | triggered by y axis
  4612. *
  4613. *
  4614. *
  4615. * @return results of bus communication function
  4616. * @retval 0 -> Success
  4617. * @retval -1 -> Error
  4618. *
  4619. *
  4620. */
  4621. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat2_any_motion_first_y(u8
  4622. *v_any_motion_first_y_u8);
  4623. /*!
  4624. * @brief This API reads the status of any motion first z interrupt
  4625. * from the register 0x1E bit 2
  4626. *
  4627. *
  4628. *
  4629. *
  4630. *@param v_any_motion_first_z_u8 : The status of any motion first z interrupt
  4631. * value | status
  4632. * -----------|-------------
  4633. * 0 | not triggered
  4634. * 1 | triggered by y axis
  4635. *
  4636. *
  4637. *
  4638. * @return results of bus communication function
  4639. * @retval 0 -> Success
  4640. * @retval -1 -> Error
  4641. *
  4642. *
  4643. */
  4644. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat2_any_motion_first_z(u8
  4645. *v_any_motion_first_z_u8);
  4646. /*!
  4647. * @brief This API reads the any motion sign status from the
  4648. * register 0x1E bit 3
  4649. *
  4650. *
  4651. *
  4652. *
  4653. * @param v_anymotion_sign_u8 : The status of any motion sign
  4654. * value | sign
  4655. * -----------|-------------
  4656. * 0 | positive
  4657. * 1 | negative
  4658. *
  4659. *
  4660. * @return results of bus communication function
  4661. * @retval 0 -> Success
  4662. * @retval -1 -> Error
  4663. *
  4664. *
  4665. */
  4666. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat2_any_motion_sign(u8
  4667. *v_anymotion_sign_u8);
  4668. /**************************************************/
  4669. /**\name FUNCTIONS FOR TAP FIRST XYZ AND SIGN INTERRUPT STATUS*/
  4670. /*************************************************/
  4671. /*!
  4672. * @brief This API reads the any motion tap first x status from the
  4673. * register 0x1E bit 4
  4674. *
  4675. *
  4676. *
  4677. *
  4678. * @param v_tap_first_x_u8 :The status of any motion tap first x
  4679. * value | status
  4680. * -----------|-------------
  4681. * 0 | not triggered
  4682. * 1 | triggered by x axis
  4683. *
  4684. * @return results of bus communication function
  4685. * @retval 0 -> Success
  4686. * @retval -1 -> Error
  4687. *
  4688. *
  4689. */
  4690. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat2_tap_first_x(u8
  4691. *v_tap_first_x_u8);
  4692. /*!
  4693. * @brief This API reads the tap first y interrupt status from the
  4694. * register 0x1E bit 5
  4695. *
  4696. *
  4697. *
  4698. *
  4699. * @param v_tap_first_y_u8 :The status of tap first y interrupt
  4700. * value | status
  4701. * -----------|-------------
  4702. * 0 | not triggered
  4703. * 1 | triggered by y axis
  4704. *
  4705. *
  4706. *
  4707. * @return results of bus communication function
  4708. * @retval 0 -> Success
  4709. * @retval -1 -> Error
  4710. *
  4711. *
  4712. */
  4713. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat2_tap_first_y(u8
  4714. *v_tap_first_y_u8);
  4715. /*!
  4716. * @brief This API reads the tap first z interrupt status from the
  4717. * register 0x1E bit 6
  4718. *
  4719. *
  4720. *
  4721. *
  4722. * @param v_tap_first_z_u8 :The status of tap first z interrupt
  4723. * value | status
  4724. * -----------|-------------
  4725. * 0 | not triggered
  4726. * 1 | triggered by z axis
  4727. *
  4728. *
  4729. *
  4730. * @return results of bus communication function
  4731. * @retval 0 -> Success
  4732. * @retval -1 -> Error
  4733. *
  4734. *
  4735. */
  4736. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat2_tap_first_z(u8
  4737. *v_tap_first_z_u8);
  4738. /*!
  4739. * @brief This API reads the tap sign status from the
  4740. * register 0x1E bit 7
  4741. *
  4742. *
  4743. *
  4744. *
  4745. * @param v_tap_sign_u8 : The status of tap sign
  4746. * value | sign
  4747. * -----------|-------------
  4748. * 0 | positive
  4749. * 1 | negative
  4750. *
  4751. *
  4752. * @return results of bus communication function
  4753. * @retval 0 -> Success
  4754. * @retval -1 -> Error
  4755. *
  4756. *
  4757. */
  4758. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat2_tap_sign(u8
  4759. *tap_sign);
  4760. /**************************************************/
  4761. /**\name FUNCTIONS FOR HIGH_G FIRST XYZ AND SIGN INTERRUPT STATUS*/
  4762. /*************************************************/
  4763. /*!
  4764. * @brief This API reads the high_g first x status from the
  4765. * register 0x1F bit 0
  4766. *
  4767. *
  4768. *
  4769. *
  4770. * @param v_high_g_first_x_u8 :The status of high_g first x
  4771. * value | status
  4772. * -----------|-------------
  4773. * 0 | not triggered
  4774. * 1 | triggered by x axis
  4775. *
  4776. *
  4777. *
  4778. * @return results of bus communication function
  4779. * @retval 0 -> Success
  4780. * @retval -1 -> Error
  4781. *
  4782. *
  4783. */
  4784. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat3_high_g_first_x(u8
  4785. *v_high_g_first_x_u8);
  4786. /*!
  4787. * @brief This API reads the high_g first y status from the
  4788. * register 0x1F bit 1
  4789. *
  4790. *
  4791. *
  4792. *
  4793. * @param v_high_g_first_y_u8 : The status of high_g first y
  4794. * value | status
  4795. * -----------|-------------
  4796. * 0 | not triggered
  4797. * 1 | triggered by y axis
  4798. *
  4799. *
  4800. *
  4801. * @return results of bus communication function
  4802. * @retval 0 -> Success
  4803. * @retval -1 -> Error
  4804. *
  4805. *
  4806. */
  4807. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat3_high_g_first_y(u8
  4808. *v_high_g_first_y_u8);
  4809. /*!
  4810. * @brief This API reads the high_g first z status from the
  4811. * register 0x1F bit 3
  4812. *
  4813. *
  4814. *
  4815. *
  4816. * @param v_high_g_first_z_u8 : The status of high_g first z
  4817. * value | status
  4818. * -----------|-------------
  4819. * 0 | not triggered
  4820. * 1 | triggered by z axis
  4821. *
  4822. *
  4823. *
  4824. * @return results of bus communication function
  4825. * @retval 0 -> Success
  4826. * @retval -1 -> Error
  4827. *
  4828. *
  4829. */
  4830. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat3_high_g_first_z(u8
  4831. *v_high_g_first_z_u8);
  4832. /*!
  4833. * @brief This API reads the high g sign status from the
  4834. * register 0x1F bit 3
  4835. *
  4836. *
  4837. *
  4838. *
  4839. * @param v_high_g_sign_u8 :The status of high g sign
  4840. * value | sign
  4841. * -----------|-------------
  4842. * 0 | positive
  4843. * 1 | negative
  4844. *
  4845. *
  4846. *
  4847. * @return results of bus communication function
  4848. * @retval 0 -> Success
  4849. * @retval -1 -> Error
  4850. *
  4851. *
  4852. */
  4853. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat3_high_g_sign(u8
  4854. *v_high_g_sign_u8);
  4855. /**************************************************/
  4856. /**\name FUNCTIONS FOR ORIENT XY AND Z INTERRUPT STATUS*/
  4857. /*************************************************/
  4858. /*!
  4859. * @brief This API reads the status of orient_xy plane
  4860. * from the register 0x1F bit 4 and 5
  4861. *
  4862. *
  4863. * @param v_orient_xy_u8 :The status of orient_xy plane
  4864. * value | status
  4865. * -----------|-------------
  4866. * 0x00 | portrait upright
  4867. * 0x01 | portrait upside down
  4868. * 0x02 | landscape left
  4869. * 0x03 | landscape right
  4870. *
  4871. *
  4872. * @return results of bus communication function
  4873. * @retval 0 -> Success
  4874. * @retval -1 -> Error
  4875. *
  4876. *
  4877. */
  4878. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat3_orient_xy(u8
  4879. *v_orient_xy_u8);
  4880. /*!
  4881. * @brief This API reads the status of orient z plane
  4882. * from the register 0x1F bit 6
  4883. *
  4884. *
  4885. * @param v_orient_z_u8 :The status of orient z
  4886. * value | status
  4887. * -----------|-------------
  4888. * 0x00 | upward looking
  4889. * 0x01 | downward looking
  4890. *
  4891. * @return results of bus communication function
  4892. * @retval 0 -> Success
  4893. * @retval -1 -> Error
  4894. *
  4895. *
  4896. */
  4897. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat3_orient_z(u8
  4898. *v_orient_z_u8);
  4899. /**************************************************/
  4900. /**\name FUNCTIONS FOR FLAT INTERRUPT STATUS*/
  4901. /*************************************************/
  4902. /*!
  4903. * @brief This API reads the flat status from the register
  4904. * 0x1F bit 7
  4905. *
  4906. *
  4907. * @param v_flat_u8 : The status of flat interrupt
  4908. * value | status
  4909. * -----------|-------------
  4910. * 0x00 | non flat
  4911. * 0x01 | flat position
  4912. *
  4913. *
  4914. * @return results of bus communication function
  4915. * @retval 0 -> Success
  4916. * @retval -1 -> Error
  4917. *
  4918. *
  4919. */
  4920. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat3_flat(u8
  4921. *flat);
  4922. /**************************************************/
  4923. /**\name FUNCTION FOR TEMPERATURE READ */
  4924. /*************************************************/
  4925. /*!
  4926. * @brief This API reads the temperature of the sensor
  4927. * from the register 0x21 bit 0 to 7
  4928. *
  4929. *
  4930. *
  4931. * @param v_temp_s16 : The value of temperature
  4932. *
  4933. *
  4934. *
  4935. * @return results of bus communication function
  4936. * @retval 0 -> Success
  4937. * @retval -1 -> Error
  4938. *
  4939. *
  4940. */
  4941. BMI160_RETURN_FUNCTION_TYPE bmi160_get_temp(s16
  4942. *v_temp_s16);
  4943. #ifdef FIFO_ENABLE
  4944. /**************************************************/
  4945. /**\name FUNCTION FOR FIFO LENGTH AND FIFO DATA READ */
  4946. /*************************************************/
  4947. /*!
  4948. * @brief This API reads the FIFO length of the sensor
  4949. * from the register 0x23 and 0x24 bit 0 to 7 and 0 to 2
  4950. * @brief this byte counter is updated each time a complete frame
  4951. * is read or written
  4952. *
  4953. *
  4954. * @param v_fifo_length_u32 : The value of FIFO byte counter
  4955. *
  4956. *
  4957. * @return results of bus communication function
  4958. * @retval 0 -> Success
  4959. * @retval -1 -> Error
  4960. *
  4961. *
  4962. */
  4963. BMI160_RETURN_FUNCTION_TYPE bmi160_fifo_length(
  4964. u32 *v_fifo_length_u32);
  4965. /*!
  4966. * @brief This API reads the FIFO data of the sensor
  4967. * from the register 0x24
  4968. * @brief Data format depends on the setting of register FIFO_CONFIG
  4969. *
  4970. *
  4971. *
  4972. * @param v_fifodata_u8 : Pointer holding the FIFO data
  4973. * @param v_fifo_length_u16 : The value of FIFO length maximum 1024
  4974. *
  4975. * @note For reading FIFO data use the following functions
  4976. *
  4977. * @return results of bus communication function
  4978. * @retval 0 -> Success
  4979. * @retval -1 -> Error
  4980. *
  4981. *
  4982. */
  4983. BMI160_RETURN_FUNCTION_TYPE bmi160_fifo_data(
  4984. u8 *v_fifodata_u8, u16 v_fifo_length_u16);
  4985. #endif
  4986. /**************************************************/
  4987. /**\name FUNCTION FOR ACCEL CONFIGURATIONS */
  4988. /*************************************************/
  4989. /*!
  4990. * @brief This API is used to get the
  4991. * accel output date rate from the register 0x40 bit 0 to 3
  4992. *
  4993. *
  4994. * @param v_output_data_rate_u8 :The value of Accel output date rate
  4995. * value | output data rate
  4996. * -------|--------------------------
  4997. * 0 | BMI160_ACCEL_OUTPUT_DATA_RATE_RESERVED
  4998. * 1 | BMI160_ACCEL_OUTPUT_DATA_RATE_0_78HZ
  4999. * 2 | BMI160_ACCEL_OUTPUT_DATA_RATE_1_56HZ
  5000. * 3 | BMI160_ACCEL_OUTPUT_DATA_RATE_3_12HZ
  5001. * 4 | BMI160_ACCEL_OUTPUT_DATA_RATE_6_25HZ
  5002. * 5 | BMI160_ACCEL_OUTPUT_DATA_RATE_12_5HZ
  5003. * 6 | BMI160_ACCEL_OUTPUT_DATA_RATE_25HZ
  5004. * 7 | BMI160_ACCEL_OUTPUT_DATA_RATE_50HZ
  5005. * 8 | BMI160_ACCEL_OUTPUT_DATA_RATE_100HZ
  5006. * 9 | BMI160_ACCEL_OUTPUT_DATA_RATE_200HZ
  5007. * 10 | BMI160_ACCEL_OUTPUT_DATA_RATE_400HZ
  5008. * 11 | BMI160_ACCEL_OUTPUT_DATA_RATE_800HZ
  5009. * 12 | BMI160_ACCEL_OUTPUT_DATA_RATE_1600HZ
  5010. *
  5011. *
  5012. * @return results of bus communication function
  5013. * @retval 0 -> Success
  5014. * @retval -1 -> Error
  5015. *
  5016. *
  5017. */
  5018. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_output_data_rate(
  5019. u8 *v_output_data_rate_u8);
  5020. /*!
  5021. * @brief This API is used to set the
  5022. * accel output date rate from the register 0x40 bit 0 to 3
  5023. *
  5024. *
  5025. * @param v_output_data_rate_u8 :The value of Accel output date rate
  5026. * value | output data rate
  5027. * -------|--------------------------
  5028. * 0 | BMI160_ACCEL_OUTPUT_DATA_RATE_RESERVED
  5029. * 1 | BMI160_ACCEL_OUTPUT_DATA_RATE_0_78HZ
  5030. * 2 | BMI160_ACCEL_OUTPUT_DATA_RATE_1_56HZ
  5031. * 3 | BMI160_ACCEL_OUTPUT_DATA_RATE_3_12HZ
  5032. * 4 | BMI160_ACCEL_OUTPUT_DATA_RATE_6_25HZ
  5033. * 5 | BMI160_ACCEL_OUTPUT_DATA_RATE_12_5HZ
  5034. * 6 | BMI160_ACCEL_OUTPUT_DATA_RATE_25HZ
  5035. * 7 | BMI160_ACCEL_OUTPUT_DATA_RATE_50HZ
  5036. * 8 | BMI160_ACCEL_OUTPUT_DATA_RATE_100HZ
  5037. * 9 | BMI160_ACCEL_OUTPUT_DATA_RATE_200HZ
  5038. * 10 | BMI160_ACCEL_OUTPUT_DATA_RATE_400HZ
  5039. * 11 | BMI160_ACCEL_OUTPUT_DATA_RATE_800HZ
  5040. * 12 | BMI160_ACCEL_OUTPUT_DATA_RATE_1600HZ
  5041. *
  5042. * @param v_accel_bw_u8 :The value of Accel selected Accel bandwidth
  5043. * value | output data rate
  5044. * -------|--------------------------
  5045. * 0 | BMI160_ACCEL_OSR4_AVG1
  5046. * 1 | BMI160_ACCEL_OSR2_AVG2
  5047. * 2 | BMI160_ACCEL_NORMAL_AVG4
  5048. * 3 | BMI160_ACCEL_CIC_AVG8
  5049. * 4 | BMI160_ACCEL_RES_AVG2
  5050. * 5 | BMI160_ACCEL_RES_AVG4
  5051. * 6 | BMI160_ACCEL_RES_AVG8
  5052. * 7 | BMI160_ACCEL_RES_AVG16
  5053. * 8 | BMI160_ACCEL_RES_AVG32
  5054. * 9 | BMI160_ACCEL_RES_AVG64
  5055. * 10 | BMI160_ACCEL_RES_AVG128
  5056. *
  5057. *
  5058. *
  5059. *
  5060. *
  5061. * @note Verify the Accel bandwidth before setting the
  5062. * output data rate
  5063. * bandwidth | output data rate | under sampling
  5064. *-------------|------------------|----------------
  5065. * OSR4 | 12.5 TO 1600 | 0
  5066. * OSR2 | 12.5 TO 1600 | 0
  5067. * NORMAL | 12.5 TO 1600 | 0
  5068. * CIC | 12.5 TO 1600 | 0
  5069. * AVG2 | 0.78 TO 400 | 1
  5070. * AVG4 | 0.78 TO 200 | 1
  5071. * AVG8 | 0.78 TO 100 | 1
  5072. * AVG16 | 0.78 TO 50 | 1
  5073. * AVG32 | 0.78 TO 25 | 1
  5074. * AVG64 | 0.78 TO 12.5 | 1
  5075. * AVG128 | 0.78 TO 6.25 | 1
  5076. *
  5077. * @return results of bus communication function
  5078. * @retval 0 -> Success
  5079. * @retval -1 -> Error
  5080. *
  5081. *
  5082. */
  5083. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_output_data_rate(
  5084. u8 v_output_data_rate_u8, u8 v_accel_bw_u8);
  5085. /*!
  5086. * @brief This API is used to get the
  5087. * accel bandwidth from the register 0x40 bit 4 to 6
  5088. * @brief bandwidth parameter determines filter configuration(acc_us=0)
  5089. * and averaging for under sampling mode(acc_us=1)
  5090. *
  5091. *
  5092. * @param v_bw_u8 : The value of Accel bandwidth
  5093. *
  5094. * @note Accel bandwidth depends on under sampling parameter
  5095. * @note under sampling parameter cab be set by the function
  5096. * "BMI160_SET_ACCEL_UNDER_SAMPLING_PARAMETER"
  5097. *
  5098. * @note Filter configuration
  5099. * accel_us | Filter configuration
  5100. * -----------|---------------------
  5101. * 0x00 | OSR4 mode
  5102. * 0x01 | OSR2 mode
  5103. * 0x02 | normal mode
  5104. * 0x03 | CIC mode
  5105. * 0x04 | Reserved
  5106. * 0x05 | Reserved
  5107. * 0x06 | Reserved
  5108. * 0x07 | Reserved
  5109. *
  5110. * @note Accel under sampling mode
  5111. * accel_us | Under sampling mode
  5112. * -----------|---------------------
  5113. * 0x00 | no averaging
  5114. * 0x01 | average 2 samples
  5115. * 0x02 | average 4 samples
  5116. * 0x03 | average 8 samples
  5117. * 0x04 | average 16 samples
  5118. * 0x05 | average 32 samples
  5119. * 0x06 | average 64 samples
  5120. * 0x07 | average 128 samples
  5121. *
  5122. *
  5123. *
  5124. * @return results of bus communication function
  5125. * @retval 0 -> Success
  5126. * @retval -1 -> Error
  5127. *
  5128. *
  5129. */
  5130. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_bw(u8 *v_bw_u8);
  5131. /*!
  5132. * @brief This API is used to set the
  5133. * accel bandwidth from the register 0x40 bit 4 to 6
  5134. * @brief bandwidth parameter determines filter configuration(acc_us=0)
  5135. * and averaging for under sampling mode(acc_us=1)
  5136. *
  5137. *
  5138. * @param v_bw_u8 : The value of Accel bandwidth
  5139. *
  5140. * @note Accel bandwidth depends on under sampling parameter
  5141. * @note under sampling parameter cab be set by the function
  5142. * "BMI160_SET_ACCEL_UNDER_SAMPLING_PARAMETER"
  5143. *
  5144. * @note Filter configuration
  5145. * accel_us | Filter configuration
  5146. * -----------|---------------------
  5147. * 0x00 | OSR4 mode
  5148. * 0x01 | OSR2 mode
  5149. * 0x02 | normal mode
  5150. * 0x03 | CIC mode
  5151. * 0x04 | Reserved
  5152. * 0x05 | Reserved
  5153. * 0x06 | Reserved
  5154. * 0x07 | Reserved
  5155. *
  5156. * @note Accel under sampling mode
  5157. * accel_us | Under sampling mode
  5158. * -----------|---------------------
  5159. * 0x00 | no averaging
  5160. * 0x01 | average 2 samples
  5161. * 0x02 | average 4 samples
  5162. * 0x03 | average 8 samples
  5163. * 0x04 | average 16 samples
  5164. * 0x05 | average 32 samples
  5165. * 0x06 | average 64 samples
  5166. * 0x07 | average 128 samples
  5167. *
  5168. *
  5169. *
  5170. * @return results of bus communication function
  5171. * @retval 0 -> Success
  5172. * @retval -1 -> Error
  5173. *
  5174. *
  5175. */
  5176. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_bw(u8 v_bw_u8);
  5177. /*!
  5178. * @brief This API is used to get the accel
  5179. * under sampling parameter from the register 0x40 bit 7
  5180. *
  5181. *
  5182. *
  5183. *
  5184. * @param v_accel_under_sampling_u8 : The value of Accel under sampling
  5185. * value | under_sampling
  5186. * ----------|---------------
  5187. * 0x01 | BMI160_ENABLE
  5188. * 0x00 | BMI160_DISABLE
  5189. *
  5190. *
  5191. *
  5192. * @return results of bus communication function
  5193. * @retval 0 -> Success
  5194. * @retval -1 -> Error
  5195. *
  5196. *
  5197. */
  5198. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_under_sampling_parameter(
  5199. u8 *v_accel_under_sampling_u8);
  5200. /*!
  5201. * @brief This API is used to set the accel
  5202. * under sampling parameter from the register 0x40 bit 7
  5203. *
  5204. *
  5205. *
  5206. *
  5207. * @param v_accel_under_sampling_u8 : The value of Accel under sampling
  5208. * value | under_sampling
  5209. * ----------|---------------
  5210. * 0x01 | BMI160_ENABLE
  5211. * 0x00 | BMI160_DISABLE
  5212. *
  5213. *
  5214. *
  5215. * @return results of bus communication function
  5216. * @retval 0 -> Success
  5217. * @retval -1 -> Error
  5218. *
  5219. *
  5220. */
  5221. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_under_sampling_parameter(
  5222. u8 v_accel_under_sampling_u8);
  5223. /*!
  5224. * @brief This API is used to get the range
  5225. * (g values) of the Accel from the register 0x41 bit 0 to 3
  5226. *
  5227. *
  5228. *
  5229. *
  5230. * @param v_range_u8 : The value of Accel g range
  5231. * value | g_range
  5232. * ----------|-----------
  5233. * 0x03 | BMI160_ACCEL_RANGE_2G
  5234. * 0x05 | BMI160_ACCEL_RANGE_4G
  5235. * 0x08 | BMI160_ACCEL_RANGE_8G
  5236. * 0x0C | BMI160_ACCEL_RANGE_16G
  5237. *
  5238. *
  5239. *
  5240. * @return results of bus communication function
  5241. * @retval 0 -> Success
  5242. * @retval -1 -> Error
  5243. *
  5244. *
  5245. */
  5246. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_range(
  5247. u8 *v_range_u8);
  5248. /*!
  5249. * @brief This API is used to set the range
  5250. * (g values) of the Accel from the register 0x41 bit 0 to 3
  5251. *
  5252. *
  5253. *
  5254. *
  5255. * @param v_range_u8 : The value of Accel g range
  5256. * value | g_range
  5257. * ----------|-----------
  5258. * 0x03 | BMI160_ACCEL_RANGE_2G
  5259. * 0x05 | BMI160_ACCEL_RANGE_4G
  5260. * 0x08 | BMI160_ACCEL_RANGE_8G
  5261. * 0x0C | BMI160_ACCEL_RANGE_16G
  5262. *
  5263. *
  5264. *
  5265. * @return results of bus communication function
  5266. * @retval 0 -> Success
  5267. * @retval -1 -> Error
  5268. *
  5269. *
  5270. */
  5271. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_range(
  5272. u8 v_range_u8);
  5273. /**************************************************/
  5274. /**\name FUNCTION FOR GYRO CONFIGURATIONS */
  5275. /*************************************************/
  5276. /*!
  5277. * @brief This API is used to get the
  5278. * gyroscope output data rate from the register 0x42 bit 0 to 3
  5279. *
  5280. *
  5281. *
  5282. *
  5283. * @param v_output_data_rate_u8 :The value of Gyro output data rate
  5284. * value | Gyro output data rate
  5285. * -----------|-----------------------------
  5286. * 0x00 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5287. * 0x01 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5288. * 0x02 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5289. * 0x03 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5290. * 0x04 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5291. * 0x05 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5292. * 0x06 | BMI160_GYRO_OUTPUT_DATA_RATE_25HZ
  5293. * 0x07 | BMI160_GYRO_OUTPUT_DATA_RATE_50HZ
  5294. * 0x08 | BMI160_GYRO_OUTPUT_DATA_RATE_100HZ
  5295. * 0x09 | BMI160_GYRO_OUTPUT_DATA_RATE_200HZ
  5296. * 0x0A | BMI160_GYRO_OUTPUT_DATA_RATE_400HZ
  5297. * 0x0B | BMI160_GYRO_OUTPUT_DATA_RATE_800HZ
  5298. * 0x0C | BMI160_GYRO_OUTPUT_DATA_RATE_1600HZ
  5299. * 0x0D | BMI160_GYRO_OUTPUT_DATA_RATE_3200HZ
  5300. * 0x0E | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5301. * 0x0F | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5302. *
  5303. * @return results of bus communication function
  5304. * @retval 0 -> Success
  5305. * @retval -1 -> Error
  5306. *
  5307. *
  5308. */
  5309. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_output_data_rate(
  5310. u8 *gyro_output_typer);
  5311. /*!
  5312. * @brief This API is used to set the
  5313. * gyroscope output data rate from the register 0x42 bit 0 to 3
  5314. *
  5315. *
  5316. *
  5317. *
  5318. * @param v_output_data_rate_u8 :The value of Gyro output data rate
  5319. * value | Gyro output data rate
  5320. * -----------|-----------------------------
  5321. * 0x00 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5322. * 0x01 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5323. * 0x02 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5324. * 0x03 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5325. * 0x04 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5326. * 0x05 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5327. * 0x06 | BMI160_GYRO_OUTPUT_DATA_RATE_25HZ
  5328. * 0x07 | BMI160_GYRO_OUTPUT_DATA_RATE_50HZ
  5329. * 0x08 | BMI160_GYRO_OUTPUT_DATA_RATE_100HZ
  5330. * 0x09 | BMI160_GYRO_OUTPUT_DATA_RATE_200HZ
  5331. * 0x0A | BMI160_GYRO_OUTPUT_DATA_RATE_400HZ
  5332. * 0x0B | BMI160_GYRO_OUTPUT_DATA_RATE_800HZ
  5333. * 0x0C | BMI160_GYRO_OUTPUT_DATA_RATE_1600HZ
  5334. * 0x0D | BMI160_GYRO_OUTPUT_DATA_RATE_3200HZ
  5335. * 0x0E | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5336. * 0x0F | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5337. *
  5338. * @return results of bus communication function
  5339. * @retval 0 -> Success
  5340. * @retval -1 -> Error
  5341. *
  5342. *
  5343. */
  5344. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_output_data_rate(
  5345. u8 gyro_output_typer);
  5346. /*!
  5347. * @brief This API is used to get the
  5348. * bandwidth of Gyro from the register 0x42 bit 4 to 5
  5349. *
  5350. *
  5351. *
  5352. *
  5353. * @param v_bw_u8 : The value of Gyro bandwidth
  5354. * value | Gyro bandwidth
  5355. * ----------|----------------
  5356. * 0x00 | BMI160_GYRO_OSR4_MODE
  5357. * 0x01 | BMI160_GYRO_OSR2_MODE
  5358. * 0x02 | BMI160_GYRO_NORMAL_MODE
  5359. * 0x03 | BMI160_GYRO_CIC_MODE
  5360. *
  5361. *
  5362. * @return results of bus communication function
  5363. * @retval 0 -> Success
  5364. * @retval -1 -> Error
  5365. *
  5366. *
  5367. */
  5368. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_bw(u8 *v_bw_u8);
  5369. /*!
  5370. * @brief This API is used to set the
  5371. * bandwidth of Gyro from the register 0x42 bit 4 to 5
  5372. *
  5373. *
  5374. *
  5375. *
  5376. * @param v_bw_u8 : The value of Gyro bandwidth
  5377. * value | Gyro bandwidth
  5378. * ----------|----------------
  5379. * 0x00 | BMI160_GYRO_OSR4_MODE
  5380. * 0x01 | BMI160_GYRO_OSR2_MODE
  5381. * 0x02 | BMI160_GYRO_NORMAL_MODE
  5382. * 0x03 | BMI160_GYRO_CIC_MODE
  5383. *
  5384. *
  5385. * @return results of bus communication function
  5386. * @retval 0 -> Success
  5387. * @retval -1 -> Error
  5388. *
  5389. *
  5390. */
  5391. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_bw(u8 v_bw_u8);
  5392. /*!
  5393. * @brief This API reads the range
  5394. * of Gyro from the register 0x43 bit 0 to 2
  5395. *
  5396. * @param v_range_u8 : The value of Gyro range
  5397. * value | range
  5398. * ----------|-------------------------------
  5399. * 0x00 | BMI160_GYRO_RANGE_2000_DEG_SEC
  5400. * 0x01 | BMI160_GYRO_RANGE_1000_DEG_SEC
  5401. * 0x02 | BMI160_GYRO_RANGE_500_DEG_SEC
  5402. * 0x03 | BMI160_GYRO_RANGE_250_DEG_SEC
  5403. * 0x04 | BMI160_GYRO_RANGE_125_DEG_SEC
  5404. *
  5405. * @return results of bus communication function
  5406. * @retval 0 -> Success
  5407. * @retval -1 -> Error
  5408. *
  5409. *
  5410. */
  5411. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_range(
  5412. u8 *v_range_u8);
  5413. /*!
  5414. * @brief This API sets the range
  5415. * of Gyro from the register 0x43 bit 0 to 2
  5416. *
  5417. * @param v_range_u8 : The value of Gyro range
  5418. * value | range
  5419. * ----------|-------------------------------
  5420. * 0x00 | BMI160_GYRO_RANGE_2000_DEG_SEC
  5421. * 0x01 | BMI160_GYRO_RANGE_1000_DEG_SEC
  5422. * 0x02 | BMI160_GYRO_RANGE_500_DEG_SEC
  5423. * 0x03 | BMI160_GYRO_RANGE_250_DEG_SEC
  5424. * 0x04 | BMI160_GYRO_RANGE_125_DEG_SEC
  5425. *
  5426. * @return results of bus communication function
  5427. * @retval 0 -> Success
  5428. * @retval -1 -> Error
  5429. *
  5430. *
  5431. */
  5432. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_range(
  5433. u8 v_range_u8);
  5434. /**************************************************/
  5435. /**\name FUNCTION FOR MAG CONFIGURATIONS */
  5436. /*************************************************/
  5437. /*!
  5438. * @brief This API is used to get the
  5439. * output data rate of Mag from the register 0x44 bit 0 to 3
  5440. *
  5441. *
  5442. *
  5443. *
  5444. * @param v_output_data_rate_u8 : The value of Mag output data rate
  5445. * value | Mag output data rate
  5446. * ---------|---------------------------
  5447. * 0x00 |BMI160_MAG_OUTPUT_DATA_RATE_RESERVED
  5448. * 0x01 |BMI160_MAG_OUTPUT_DATA_RATE_0_78HZ
  5449. * 0x02 |BMI160_MAG_OUTPUT_DATA_RATE_1_56HZ
  5450. * 0x03 |BMI160_MAG_OUTPUT_DATA_RATE_3_12HZ
  5451. * 0x04 |BMI160_MAG_OUTPUT_DATA_RATE_6_25HZ
  5452. * 0x05 |BMI160_MAG_OUTPUT_DATA_RATE_12_5HZ
  5453. * 0x06 |BMI160_MAG_OUTPUT_DATA_RATE_25HZ
  5454. * 0x07 |BMI160_MAG_OUTPUT_DATA_RATE_50HZ
  5455. * 0x08 |BMI160_MAG_OUTPUT_DATA_RATE_100HZ
  5456. * 0x09 |BMI160_MAG_OUTPUT_DATA_RATE_200HZ
  5457. * 0x0A |BMI160_MAG_OUTPUT_DATA_RATE_400HZ
  5458. * 0x0B |BMI160_MAG_OUTPUT_DATA_RATE_800HZ
  5459. * 0x0C |BMI160_MAG_OUTPUT_DATA_RATE_1600HZ
  5460. * 0x0D |BMI160_MAG_OUTPUT_DATA_RATE_RESERVED0
  5461. * 0x0E |BMI160_MAG_OUTPUT_DATA_RATE_RESERVED1
  5462. * 0x0F |BMI160_MAG_OUTPUT_DATA_RATE_RESERVED2
  5463. *
  5464. *
  5465. *
  5466. * @return results of bus communication function
  5467. * @retval 0 -> Success
  5468. * @retval -1 -> Error
  5469. *
  5470. *
  5471. */
  5472. BMI160_RETURN_FUNCTION_TYPE bmi160_get_mag_output_data_rate(u8 *odr);
  5473. /*!
  5474. * @brief This API is used to set the
  5475. * output data rate of Mag from the register 0x44 bit 0 to 3
  5476. *
  5477. *
  5478. *
  5479. *
  5480. * @param v_output_data_rate_u8 : The value of Mag output data rate
  5481. * value | Mag output data rate
  5482. * ---------|---------------------------
  5483. * 0x00 |BMI160_MAG_OUTPUT_DATA_RATE_RESERVED
  5484. * 0x01 |BMI160_MAG_OUTPUT_DATA_RATE_0_78HZ
  5485. * 0x02 |BMI160_MAG_OUTPUT_DATA_RATE_1_56HZ
  5486. * 0x03 |BMI160_MAG_OUTPUT_DATA_RATE_3_12HZ
  5487. * 0x04 |BMI160_MAG_OUTPUT_DATA_RATE_6_25HZ
  5488. * 0x05 |BMI160_MAG_OUTPUT_DATA_RATE_12_5HZ
  5489. * 0x06 |BMI160_MAG_OUTPUT_DATA_RATE_25HZ
  5490. * 0x07 |BMI160_MAG_OUTPUT_DATA_RATE_50HZ
  5491. * 0x08 |BMI160_MAG_OUTPUT_DATA_RATE_100HZ
  5492. * 0x09 |BMI160_MAG_OUTPUT_DATA_RATE_200HZ
  5493. * 0x0A |BMI160_MAG_OUTPUT_DATA_RATE_400HZ
  5494. * 0x0B |BMI160_MAG_OUTPUT_DATA_RATE_800HZ
  5495. * 0x0C |BMI160_MAG_OUTPUT_DATA_RATE_1600HZ
  5496. * 0x0D |BMI160_MAG_OUTPUT_DATA_RATE_RESERVED0
  5497. * 0x0E |BMI160_MAG_OUTPUT_DATA_RATE_RESERVED1
  5498. * 0x0F |BMI160_MAG_OUTPUT_DATA_RATE_RESERVED2
  5499. *
  5500. *
  5501. *
  5502. * @return results of bus communication function
  5503. * @retval 0 -> Success
  5504. * @retval -1 -> Error
  5505. *
  5506. *
  5507. */
  5508. BMI160_RETURN_FUNCTION_TYPE bmi160_set_mag_output_data_rate(u8 odr);
  5509. #ifdef FIFO_ENABLE
  5510. /**************************************************/
  5511. /**\name FUNCTION FOR FIFO CONFIGURATIONS */
  5512. /*************************************************/
  5513. /*!
  5514. * @brief This API is used to read Down sampling
  5515. * for Gyro (2**downs_gyro) in the register 0x45 bit 0 to 2
  5516. *
  5517. *
  5518. *
  5519. *
  5520. * @param v_fifo_down_gyro_u8 :The value of Gyro FIFO down
  5521. *
  5522. *
  5523. * @return results of bus communication function
  5524. * @retval 0 -> Success
  5525. * @retval -1 -> Error
  5526. *
  5527. *
  5528. */
  5529. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fifo_down_gyro(
  5530. u8 *v_fifo_down_gyro_u8);
  5531. /*!
  5532. * @brief This API is used to set Down sampling
  5533. * for Gyro (2**downs_gyro) in the register 0x45 bit 0 to 2
  5534. *
  5535. *
  5536. *
  5537. *
  5538. * @param v_fifo_down_gyro_u8 :The value of Gyro FIFO down
  5539. *
  5540. *
  5541. * @return results of bus communication function
  5542. * @retval 0 -> Success
  5543. * @retval -1 -> Error
  5544. *
  5545. *
  5546. */
  5547. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_down_gyro(
  5548. u8 v_fifo_down_gyro_u8);
  5549. /*!
  5550. * @brief This API is used to read Gyro FIFO filter data
  5551. * from the register 0x45 bit 3
  5552. *
  5553. *
  5554. *
  5555. * @param v_gyro_fifo_filter_data_u8 :The value of Gyro filter data
  5556. * value | gyro_fifo_filter_data
  5557. * ------------|-------------------------
  5558. * 0x00 | Unfiltered data
  5559. * 0x01 | Filtered data
  5560. *
  5561. * @return results of bus communication function
  5562. * @retval 0 -> Success
  5563. * @retval -1 -> Error
  5564. *
  5565. *
  5566. */
  5567. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_fifo_filter_data(
  5568. u8 *v_gyro_fifo_filter_data_u8);
  5569. /*!
  5570. * @brief This API is used to set Gyro FIFO filter data
  5571. * from the register 0x45 bit 3
  5572. *
  5573. *
  5574. *
  5575. * @param v_gyro_fifo_filter_data_u8 :The value of Gyro filter data
  5576. * value | gyro_fifo_filter_data
  5577. * ------------|-------------------------
  5578. * 0x00 | Unfiltered data
  5579. * 0x01 | Filtered data
  5580. *
  5581. * @return results of bus communication function
  5582. * @retval 0 -> Success
  5583. * @retval -1 -> Error
  5584. *
  5585. *
  5586. */
  5587. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_fifo_filter_data(
  5588. u8 v_gyro_fifo_filter_data_u8);
  5589. /*!
  5590. * @brief This API is used to read Down sampling
  5591. * for Accel (2*downs_accel) from the register 0x45 bit 4 to 6
  5592. *
  5593. *
  5594. *
  5595. *
  5596. * @param v_fifo_down_u8 :The value of Accel FIFO down
  5597. *
  5598. *
  5599. *
  5600. * @return results of bus communication function
  5601. * @retval 0 -> Success
  5602. * @retval -1 -> Error
  5603. *
  5604. *
  5605. */
  5606. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fifo_down_accel(
  5607. u8 *v_fifo_down_u8);
  5608. /*!
  5609. * @brief This API is used to set Down sampling
  5610. * for Accel (2*downs_accel) from the register 0x45 bit 4 to 6
  5611. *
  5612. *
  5613. *
  5614. *
  5615. * @param v_fifo_down_u8 :The value of Accel FIFO down
  5616. *
  5617. *
  5618. *
  5619. * @return results of bus communication function
  5620. * @retval 0 -> Success
  5621. * @retval -1 -> Error
  5622. *
  5623. *
  5624. */
  5625. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_down_accel(
  5626. u8 v_fifo_down_u8);
  5627. /*!
  5628. * @brief This API is used to read Accel FIFO filter data
  5629. * from the register 0x45 bit 7
  5630. *
  5631. *
  5632. *
  5633. * @param accel_fifo_filter_u8 :The value of Accel filter data
  5634. * value | accel_fifo_filter_u8
  5635. * ------------|-------------------------
  5636. * 0x00 | Unfiltered data
  5637. * 0x01 | Filtered data
  5638. *
  5639. *
  5640. * @return results of bus communication function
  5641. * @retval 0 -> Success
  5642. * @retval -1 -> Error
  5643. *
  5644. *
  5645. */
  5646. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_fifo_filter_data(
  5647. u8 *accel_fifo_filter_u8);
  5648. /*!
  5649. * @brief This API is used to set Accel FIFO filter data
  5650. * from the register 0x45 bit 7
  5651. *
  5652. *
  5653. *
  5654. * @param v_accel_fifo_filter_u8 :The value of Accel filter data
  5655. * value | accel_fifo_filter_data
  5656. * ------------|-------------------------
  5657. * 0x00 | Unfiltered data
  5658. * 0x01 | Filtered data
  5659. *
  5660. *
  5661. * @return results of bus communication function
  5662. * @retval 0 -> Success
  5663. * @retval -1 -> Error
  5664. *
  5665. *
  5666. */
  5667. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_fifo_filter_data(
  5668. u8 v_accel_fifo_filter_u8);
  5669. /**************************************************/
  5670. /**\name FUNCTION FOR FIFO WATER MARK ENABLE */
  5671. /*************************************************/
  5672. /*!
  5673. * @brief This API is used to Trigger an interrupt
  5674. * when FIFO contains water mark level from the register 0x46 bit 0 to 7
  5675. *
  5676. *
  5677. *
  5678. * @param v_fifo_wm_u8 : The value of FIFO water mark level
  5679. *
  5680. *
  5681. *
  5682. * @return results of bus communication function
  5683. * @retval 0 -> Success
  5684. * @retval -1 -> Error
  5685. *
  5686. *
  5687. */
  5688. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fifo_wm(
  5689. u8 *v_fifo_wm_u8);
  5690. /*!
  5691. * @brief This API is used to Trigger an interrupt
  5692. * when FIFO contains water mark level from the register 0x46 bit 0 to 7
  5693. *
  5694. *
  5695. *
  5696. * @param v_fifo_wm_u8 : The value of FIFO water mark level
  5697. *
  5698. *
  5699. *
  5700. * @return results of bus communication function
  5701. * @retval 0 -> Success
  5702. * @retval -1 -> Error
  5703. *
  5704. *
  5705. */
  5706. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_wm(
  5707. u8 v_fifo_wm_u8);
  5708. /**************************************************/
  5709. /**\name FUNCTION FOR FIFO CONFIGURATIONS */
  5710. /*************************************************/
  5711. /*!
  5712. * @brief This API reads FIFO sensor time
  5713. * frame after the last valid data frame from the register 0x47 bit 1
  5714. *
  5715. *
  5716. *
  5717. *
  5718. * @param v_fifo_time_enable_u8 : The value of sensor time
  5719. * value | FIFO sensor time
  5720. * ------------|-------------------------
  5721. * 0x00 | do not return sensortime frame
  5722. * 0x01 | return sensortime frame
  5723. *
  5724. * @return results of bus communication function
  5725. * @retval 0 -> Success
  5726. * @retval -1 -> Error
  5727. *
  5728. *
  5729. */
  5730. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fifo_time_enable(
  5731. u8 *v_fifo_time_enable_u8);
  5732. /*!
  5733. * @brief This API sets FIFO sensor time
  5734. * frame after the last valid data frame from the register 0x47 bit 1
  5735. *
  5736. *
  5737. *
  5738. *
  5739. * @param v_fifo_time_enable_u8 : The value of sensor time
  5740. * value | FIFO sensor time
  5741. * ------------|-------------------------
  5742. * 0x00 | do not return sensortime frame
  5743. * 0x01 | return sensortime frame
  5744. *
  5745. * @return results of bus communication function
  5746. * @retval 0 -> Success
  5747. * @retval -1 -> Error
  5748. *
  5749. *
  5750. */
  5751. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_time_enable(
  5752. u8 v_fifo_time_enable_u8);
  5753. /*!
  5754. * @brief This API reads FIFO tag interrupt2 enable status
  5755. * from the register 0x47 bit 2
  5756. *
  5757. * @param v_fifo_tag_intr2_u8 : The value of FIFO tag interrupt
  5758. * value | FIFO tag interrupt
  5759. * ----------|-------------------
  5760. * 0x01 | BMI160_ENABLE
  5761. * 0x00 | BMI160_DISABLE
  5762. *
  5763. *
  5764. *
  5765. *
  5766. * @return results of bus communication function
  5767. * @retval 0 -> Success
  5768. * @retval -1 -> Error
  5769. *
  5770. *
  5771. */
  5772. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fifo_tag_intr2_enable(
  5773. u8 *v_fifo_tag_intr2_u8);
  5774. /*!
  5775. * @brief This API sets FIFO tag interrupt2 enable status
  5776. * from the register 0x47 bit 2
  5777. *
  5778. * @param v_fifo_tag_intr2_u8 : The value of FIFO tag interrupt
  5779. * value | FIFO tag interrupt
  5780. * ----------|-------------------
  5781. * 0x01 | BMI160_ENABLE
  5782. * 0x00 | BMI160_DISABLE
  5783. *
  5784. *
  5785. *
  5786. *
  5787. * @return results of bus communication function
  5788. * @retval 0 -> Success
  5789. * @retval -1 -> Error
  5790. *
  5791. *
  5792. */
  5793. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_tag_intr2_enable(
  5794. u8 v_fifo_tag_intr2_u8);
  5795. /*!
  5796. * @brief This API reads FIFO tag interrupt1 enable status
  5797. * from the register 0x47 bit 3
  5798. *
  5799. * @param v_fifo_tag_intr1_u8 :The value of FIFO tag interrupt1
  5800. * value | FIFO tag interrupt
  5801. * ----------|-------------------
  5802. * 0x01 | BMI160_ENABLE
  5803. * 0x00 | BMI160_DISABLE
  5804. *
  5805. * @return results of bus communication function
  5806. * @retval 0 -> Success
  5807. * @retval -1 -> Error
  5808. *
  5809. *
  5810. */
  5811. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fifo_tag_intr1_enable(
  5812. u8 *v_fifo_tag_intr1_u8);
  5813. /*!
  5814. * @brief This API sets FIFO tag interrupt1 enable status
  5815. * from the register 0x47 bit 3
  5816. *
  5817. * @param v_fifo_tag_intr1_u8 :The value of FIFO tag interrupt1
  5818. * value | FIFO tag interrupt
  5819. * ----------|-------------------
  5820. * 0x01 | BMI160_ENABLE
  5821. * 0x00 | BMI160_DISABLE
  5822. *
  5823. * @return results of bus communication function
  5824. * @retval 0 -> Success
  5825. * @retval -1 -> Error
  5826. *
  5827. *
  5828. */
  5829. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_tag_intr1_enable(
  5830. u8 v_fifo_tag_intr1_u8);
  5831. /*!
  5832. * @brief This API reads FIFO frame
  5833. * header enable from the register 0x47 bit 4
  5834. *
  5835. * @param v_fifo_header_u8 :The value of FIFO header
  5836. * value | FIFO header
  5837. * ----------|-------------------
  5838. * 0x01 | BMI160_ENABLE
  5839. * 0x00 | BMI160_DISABLE
  5840. *
  5841. * @return results of bus communication function
  5842. * @retval 0 -> Success
  5843. * @retval -1 -> Error
  5844. *
  5845. *
  5846. */
  5847. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fifo_header_enable(
  5848. u8 *v_fifo_header_u8);
  5849. /*!
  5850. * @brief This API sets FIFO frame
  5851. * header enable from the register 0x47 bit 4
  5852. *
  5853. * @param v_fifo_header_u8 :The value of FIFO header
  5854. * value | FIFO header
  5855. * ----------|-------------------
  5856. * 0x01 | BMI160_ENABLE
  5857. * 0x00 | BMI160_DISABLE
  5858. *
  5859. * @return results of bus communication function
  5860. * @retval 0 -> Success
  5861. * @retval -1 -> Error
  5862. *
  5863. *
  5864. */
  5865. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_header_enable(
  5866. u8 v_fifo_header_u8);
  5867. /*!
  5868. * @brief This API is used to check whether
  5869. * magnetometer data in FIFO (all 3 axes) or not from the
  5870. * register 0x47 bit 5
  5871. *
  5872. * @param v_fifo_mag_u8 : The value of FIFO Mag enable
  5873. * value | FIFO mag
  5874. * ----------|-------------------
  5875. * 0x00 | no Mag data is stored
  5876. * 0x01 | Mag data is stored
  5877. *
  5878. * @return results of bus communication function
  5879. * @retval 0 -> Success
  5880. * @retval -1 -> Error
  5881. *
  5882. *
  5883. */
  5884. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fifo_mag_enable(
  5885. u8 *v_fifo_mag_u8);
  5886. /*!
  5887. * @brief This API is used to enable
  5888. * magnetometer data in FIFO (all 3 axes) from the register 0x47 bit 5
  5889. *
  5890. * @param v_fifo_mag_u8 : The value of FIFO Mag enable
  5891. * value | FIFO mag
  5892. * ----------|-------------------
  5893. * 0x00 | no Mag data is stored
  5894. * 0x01 | Mag data is stored
  5895. *
  5896. * @return results of bus communication function
  5897. * @retval 0 -> Success
  5898. * @retval -1 -> Error
  5899. *
  5900. *
  5901. */
  5902. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_mag_enable(
  5903. u8 v_fifo_mag_u8);
  5904. /*!
  5905. * @brief This API is used to check whether
  5906. * accel data is stored in FIFO (all 3 axes) or not from the
  5907. * register 0x47 bit 6
  5908. *
  5909. * @param v_fifo_accel_u8 : The value of FIFO Accel enable
  5910. * value | FIFO accel
  5911. * ----------|-------------------
  5912. * 0x00 | no Accel data is stored
  5913. * 0x01 | Accel data is stored
  5914. *
  5915. *
  5916. *
  5917. * @return results of bus communication function
  5918. * @retval 0 -> Success
  5919. * @retval -1 -> Error
  5920. *
  5921. *
  5922. */
  5923. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fifo_accel_enable(
  5924. u8 *v_fifo_accel_u8);
  5925. /*!
  5926. * @brief This API is used to enable
  5927. * accel data in FIFO (all 3 axes) from the register 0x47 bit 6
  5928. *
  5929. * @param v_fifo_accel_u8 : The value of FIFO Accel enable
  5930. * value | FIFO accel
  5931. * ----------|-------------------
  5932. * 0x00 | no Accel data is stored
  5933. * 0x01 | Accel data is stored
  5934. *
  5935. *
  5936. *
  5937. * @return results of bus communication function
  5938. * @retval 0 -> Success
  5939. * @retval -1 -> Error
  5940. *
  5941. *
  5942. */
  5943. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_accel_enable(
  5944. u8 v_fifo_accel_u8);
  5945. /*!
  5946. * @brief This API is used to check whether
  5947. * gyro data is stored in FIFO (all 3 axes) or not from the
  5948. * register 0x47 bit 7
  5949. *
  5950. *
  5951. * @param v_fifo_gyro_u8 : The value of FIFO Gyro enable
  5952. * value | FIFO gyro
  5953. * ----------|-------------------
  5954. * 0x00 | no Gyro data is stored
  5955. * 0x01 | Gyro data is stored
  5956. *
  5957. *
  5958. * @return results of bus communication function
  5959. * @retval 0 -> Success
  5960. * @retval -1 -> Error
  5961. *
  5962. *
  5963. */
  5964. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fifo_gyro_enable(
  5965. u8 *v_fifo_gyro_u8);
  5966. /*!
  5967. * @brief This API is used to enable
  5968. * gyro data in FIFO (all 3 axes) from the register 0x47 bit 7
  5969. *
  5970. *
  5971. * @param v_fifo_gyro_u8 : The value of FIFO Gyro enable
  5972. * value | FIFO gyro
  5973. * ----------|-------------------
  5974. * 0x00 | no Gyro data is stored
  5975. * 0x01 | Gyro data is stored
  5976. *
  5977. *
  5978. * @return results of bus communication function
  5979. * @retval 0 -> Success
  5980. * @retval -1 -> Error
  5981. *
  5982. *
  5983. */
  5984. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_gyro_enable(
  5985. u8 v_fifo_gyro_u8);
  5986. #endif
  5987. /***************************************************************/
  5988. /**\name FUNCTION FOR MAG I2C ADDRESS SELECTION */
  5989. /***************************************************************/
  5990. /*!
  5991. * @brief This API is used to read
  5992. * I2C device address of auxiliary Mag from the register 0x4B bit 1 to 7
  5993. *
  5994. *
  5995. *
  5996. *
  5997. * @param v_i2c_device_addr_u8 : The value of Mag I2C device address
  5998. *
  5999. *
  6000. * @return results of bus communication function
  6001. * @retval 0 -> Success
  6002. * @retval -1 -> Error
  6003. *
  6004. *
  6005. */
  6006. BMI160_RETURN_FUNCTION_TYPE bmi160_get_i2c_device_addr(
  6007. u8 *v_i2c_device_addr_u8);
  6008. /*!
  6009. * @brief This API is used to set
  6010. * I2C device address of auxiliary Mag from the register 0x4B bit 1 to 7
  6011. *
  6012. *
  6013. *
  6014. *
  6015. * @param v_i2c_device_addr_u8 : The value of Mag I2C device address
  6016. *
  6017. *
  6018. * @return results of bus communication function
  6019. * @retval 0 -> Success
  6020. * @retval -1 -> Error
  6021. *
  6022. *
  6023. */
  6024. BMI160_RETURN_FUNCTION_TYPE bmi160_set_i2c_device_addr(
  6025. u8 v_i2c_device_addr_u8);
  6026. /*!
  6027. * @brief This API is used to read the
  6028. * Burst data length (1,2,6,8 byte) from the register 0x4C bit 0 to 1
  6029. *
  6030. *
  6031. *
  6032. *
  6033. * @param v_mag_burst_u8 : The data of Mag burst read length
  6034. *
  6035. *
  6036. *
  6037. * @return results of bus communication function
  6038. * @retval 0 -> Success
  6039. * @retval -1 -> Error
  6040. *
  6041. *
  6042. */
  6043. BMI160_RETURN_FUNCTION_TYPE bmi160_get_mag_burst(
  6044. u8 *v_mag_burst_u8);
  6045. /*!
  6046. * @brief This API is used to set
  6047. * Burst data length (1,2,6,8 byte) from the register 0x4C bit 0 to 1
  6048. *
  6049. *
  6050. *
  6051. *
  6052. * @param v_mag_burst_u8 : The data of Mag burst read length
  6053. *
  6054. *
  6055. *
  6056. * @return results of bus communication function
  6057. * @retval 0 -> Success
  6058. * @retval -1 -> Error
  6059. *
  6060. *
  6061. */
  6062. BMI160_RETURN_FUNCTION_TYPE bmi160_set_mag_burst(
  6063. u8 v_mag_burst_u8);
  6064. /***************************************************************/
  6065. /**\name FUNCTION FOR MAG OFFSET */
  6066. /***************************************************************/
  6067. /*!
  6068. * @brief This API is used to read
  6069. * trigger-readout offset in units of 2.5 ms. If set to zero,
  6070. * the offset is maximum, i.e. after readout a trigger
  6071. * is issued immediately. from the register 0x4C bit 2 to 5
  6072. *
  6073. *
  6074. *
  6075. *
  6076. * @param v_mag_offset_u8 : The value of Mag offset
  6077. *
  6078. *
  6079. *
  6080. * @return results of bus communication function
  6081. * @retval 0 -> Success
  6082. * @retval -1 -> Error
  6083. *
  6084. *
  6085. */
  6086. BMI160_RETURN_FUNCTION_TYPE bmi160_get_mag_offset(
  6087. u8 *v_mag_offset_u8);
  6088. /*!
  6089. * @brief This API is used to set the
  6090. * trigger-readout offset in units of 2.5 ms. If set to zero,
  6091. * the offset is maximum, i.e. after readout a trigger
  6092. * is issued immediately. from the register 0x4C bit 2 to 5
  6093. *
  6094. *
  6095. *
  6096. *
  6097. * @param v_mag_offset_u8 : The value of Mag offset
  6098. *
  6099. *
  6100. *
  6101. * @return results of bus communication function
  6102. * @retval 0 -> Success
  6103. * @retval -1 -> Error
  6104. *
  6105. *
  6106. */
  6107. BMI160_RETURN_FUNCTION_TYPE bmi160_set_mag_offset(
  6108. u8 v_mag_offset_u8);
  6109. /***************************************************************/
  6110. /**\name FUNCTION FOR MAG MANUAL/AUTO MODE SELECTION */
  6111. /***************************************************************/
  6112. /*!
  6113. * @brief This API is used to read the
  6114. * Enable register access on MAG_IF[2] or MAG_IF[3].
  6115. * This implies that the DATA registers are not updated with
  6116. * magnetometer values. Accessing Mag requires
  6117. * the Mag in normal mode in PMU_STATUS.
  6118. * from the register 0x4C bit 7
  6119. *
  6120. *
  6121. *
  6122. * @param v_mag_manual_u8 : The value of Mag manual enable
  6123. * value | Mag manual
  6124. * ----------|-------------------
  6125. * 0x01 | BMI160_ENABLE
  6126. * 0x00 | BMI160_DISABLE
  6127. *
  6128. *
  6129. *
  6130. * @return results of bus communication function
  6131. * @retval 0 -> Success
  6132. * @retval -1 -> Error
  6133. *
  6134. *
  6135. */
  6136. BMI160_RETURN_FUNCTION_TYPE bmi160_get_mag_manual_enable(
  6137. u8 *v_mag_manual_u8);
  6138. /*!
  6139. * @brief This API is used to set the
  6140. * Enable register access of MAG_IF[2] or MAG_IF[3].
  6141. * This implies that the DATA registers are not updated with
  6142. * magnetometer values. Accessing Mag requires
  6143. * the Mag in normal mode in PMU_STATUS.
  6144. * from the register 0x4C bit 7
  6145. *
  6146. *
  6147. *
  6148. * @param v_mag_manual_u8 : The value of Mag manual enable
  6149. * value | Mag manual
  6150. * ----------|-------------------
  6151. * 0x01 | BMI160_ENABLE
  6152. * 0x00 | BMI160_DISABLE
  6153. *
  6154. *
  6155. *
  6156. * @return results of bus communication function
  6157. * @retval 0 -> Success
  6158. * @retval -1 -> Error
  6159. *
  6160. *
  6161. */
  6162. BMI160_RETURN_FUNCTION_TYPE bmi160_set_mag_manual_enable(
  6163. u8 v_mag_manual_u8);
  6164. /***************************************************************/
  6165. /**\name FUNCTIONS FOR MAG READ, WRITE AND WRITE DATA ADDRESS */
  6166. /***************************************************************/
  6167. /*!
  6168. * @brief This API is used to get the
  6169. * magnetometer read address from the register 0x4D bit 0 to 7
  6170. * @brief Mag read address of auxiliary mag
  6171. *
  6172. *
  6173. *
  6174. *
  6175. * @param v_mag_read_addr_u8 : The value of address need to be read
  6176. *
  6177. *
  6178. *
  6179. * @return results of bus communication function
  6180. * @retval 0 -> Success
  6181. * @retval -1 -> Error
  6182. *
  6183. *
  6184. */
  6185. BMI160_RETURN_FUNCTION_TYPE bmi160_get_mag_read_addr(
  6186. u8 *v_mag_read_addr_u8);
  6187. /*!
  6188. * @brief This API is used to set
  6189. * magnetometer read address from the register 0x4D bit 0 to 7
  6190. * @brief address where data will be read from auxiliary mag
  6191. *
  6192. *
  6193. *
  6194. * @param v_mag_read_addr_u8:
  6195. * The data of auxiliary Mag address to write data
  6196. *
  6197. *
  6198. * @return results of bus communication function
  6199. * @retval 0 -> Success
  6200. * @retval -1 -> Error
  6201. *
  6202. *
  6203. */
  6204. BMI160_RETURN_FUNCTION_TYPE bmi160_set_mag_read_addr(
  6205. u8 v_mag_read_addr_u8);
  6206. /*!
  6207. * @brief This API is used to read
  6208. * magnetometer write address from the register 0x4E bit 0 to 7
  6209. * @brief write address where data will be written in magnetometer
  6210. *
  6211. *
  6212. *
  6213. * @param v_mag_write_addr_u8:
  6214. * The data of auxiliary Mag address to write data
  6215. *
  6216. *
  6217. * @return results of bus communication function
  6218. * @retval 0 -> Success
  6219. * @retval -1 -> Error
  6220. *
  6221. *
  6222. */
  6223. BMI160_RETURN_FUNCTION_TYPE bmi160_get_mag_write_addr(
  6224. u8 *v_mag_write_addr_u8);
  6225. /*!
  6226. * @brief This API is used to set
  6227. * magnetometer write address from the register 0x4E bit 0 to 7
  6228. * @brief this is the address in Mag where the data will be written
  6229. *
  6230. *
  6231. *
  6232. * @param v_mag_write_addr_u8:
  6233. * The address which the data will be written to
  6234. *
  6235. *
  6236. * @return results of bus communication function
  6237. * @retval 0 -> Success
  6238. * @retval -1 -> Error
  6239. *
  6240. *
  6241. */
  6242. BMI160_RETURN_FUNCTION_TYPE bmi160_set_mag_write_addr(
  6243. u8 v_mag_write_addr_u8);
  6244. /*!
  6245. * @brief This API is used to read Mag write data
  6246. * from the register 0x4F bit 0 to 7
  6247. * @brief The data will be written to mag
  6248. *
  6249. *
  6250. *
  6251. * @param v_mag_write_data_u8: The value of Mag data
  6252. *
  6253. *
  6254. *
  6255. * @return results of bus communication function
  6256. * @retval 0 -> Success
  6257. * @retval -1 -> Error
  6258. *
  6259. *
  6260. */
  6261. BMI160_RETURN_FUNCTION_TYPE bmi160_get_mag_write_data(
  6262. u8 *v_mag_write_data_u8);
  6263. /*!
  6264. * @brief This API is used to set Mag write data
  6265. * from the register 0x4F bit 0 to 7
  6266. * @brief The data will be written to mag
  6267. *
  6268. *
  6269. *
  6270. * @param v_mag_write_data_u8: The value of Mag data
  6271. *
  6272. *
  6273. *
  6274. * @return results of bus communication function
  6275. * @retval 0 -> Success
  6276. * @retval -1 -> Error
  6277. *
  6278. *
  6279. */
  6280. BMI160_RETURN_FUNCTION_TYPE bmi160_set_mag_write_data(
  6281. u8 v_mag_write_data_u8);
  6282. /***************************************************************/
  6283. /**\name FUNCTION FOR INTERRUPT ENABLE OF
  6284. ANY-MOTION XYZ, DOUBLE AND SINGLE TAP, ORIENT AND FLAT */
  6285. /***************************************************************/
  6286. /*!
  6287. * @brief This API is used to read
  6288. * interrupt enable from the register 0x50 bit 0 to 7
  6289. *
  6290. *
  6291. *
  6292. *
  6293. * @param v_enable_u8 : Value which selects the interrupt
  6294. * v_enable_u8 | interrupt
  6295. * ---------------|---------------
  6296. * 0 | BMI160_ANY_MOTION_X_ENABLE
  6297. * 1 | BMI160_ANY_MOTION_Y_ENABLE
  6298. * 2 | BMI160_ANY_MOTION_Z_ENABLE
  6299. * 3 | BMI160_DOUBLE_TAP_ENABLE
  6300. * 4 | BMI160_SINGLE_TAP_ENABLE
  6301. * 5 | BMI160_ORIENT_ENABLE
  6302. * 6 | BMI160_FLAT_ENABLE
  6303. *
  6304. * @param v_intr_enable_zero_u8 : The interrupt enable value
  6305. * value | interrupt enable
  6306. * ----------|-------------------
  6307. * 0x01 | BMI160_ENABLE
  6308. * 0x00 | BMI160_DISABLE
  6309. *
  6310. *
  6311. *
  6312. * @return results of bus communication function
  6313. * @retval 0 -> Success
  6314. * @retval -1 -> Error
  6315. *
  6316. *
  6317. */
  6318. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_enable_0(
  6319. u8 enable, u8 *v_intr_enable_zero_u8);
  6320. /*!
  6321. * @brief This API is used to set
  6322. * interrupt enable from the register 0x50 bit 0 to 7
  6323. *
  6324. *
  6325. *
  6326. *
  6327. * @param v_enable_u8 : Value which selects the interrupt
  6328. * v_enable_u8 | interrupt
  6329. * ---------------|---------------
  6330. * 0 | BMI160_ANY_MOTION_X_ENABLE
  6331. * 1 | BMI160_ANY_MOTION_Y_ENABLE
  6332. * 2 | BMI160_ANY_MOTION_Z_ENABLE
  6333. * 3 | BMI160_DOUBLE_TAP_ENABLE
  6334. * 4 | BMI160_SINGLE_TAP_ENABLE
  6335. * 5 | BMI160_ORIENT_ENABLE
  6336. * 6 | BMI160_FLAT_ENABLE
  6337. *
  6338. * @param v_intr_enable_zero_u8 : The interrupt enable value
  6339. * value | interrupt enable
  6340. * ----------|-------------------
  6341. * 0x01 | BMI160_ENABLE
  6342. * 0x00 | BMI160_DISABLE
  6343. *
  6344. *
  6345. *
  6346. * @return results of bus communication function
  6347. * @retval 0 -> Success
  6348. * @retval -1 -> Error
  6349. *
  6350. *
  6351. */
  6352. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_enable_0(
  6353. u8 enable, u8 v_intr_enable_zero_u8);
  6354. /***************************************************************/
  6355. /**\name FUNCTION FOR INTERRUPT ENABLE OF
  6356. HIGH_G XYZ, LOW_G, DATA READY, FIFO FULL AND FIFO WATER MARK */
  6357. /***************************************************************/
  6358. /*!
  6359. * @brief This API is used to read
  6360. * interrupt enable byte1 from the register 0x51 bit 0 to 6
  6361. * @brief It read the high_g_x,high_g_y,high_g_z,low_g_enable
  6362. * data ready, FIFO full and FIFO water mark.
  6363. *
  6364. *
  6365. *
  6366. * @param v_enable_u8 : The value of interrupt enable
  6367. * @param v_enable_u8 : Value which selects interrupt
  6368. * v_enable_u8 | interrupt
  6369. * ---------------|---------------
  6370. * 0 | BMI160_HIGH_G_X_ENABLE
  6371. * 1 | BMI160_HIGH_G_Y_ENABLE
  6372. * 2 | BMI160_HIGH_G_Z_ENABLE
  6373. * 3 | BMI160_LOW_G_ENABLE
  6374. * 4 | BMI160_DATA_RDY_ENABLE
  6375. * 5 | BMI160_FIFO_FULL_ENABLE
  6376. * 6 | BMI160_FIFO_WM_ENABLE
  6377. *
  6378. * @param v_intr_enable_1_u8 : The interrupt enable value
  6379. * value | interrupt enable
  6380. * ----------|-------------------
  6381. * 0x01 | BMI160_ENABLE
  6382. * 0x00 | BMI160_DISABLE
  6383. *
  6384. *
  6385. *
  6386. * @return results of bus communication function
  6387. * @retval 0 -> Success
  6388. * @retval -1 -> Error
  6389. *
  6390. *
  6391. */
  6392. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_enable_1(
  6393. u8 enable, u8 *v_intr_enable_1_u8);
  6394. /*!
  6395. * @brief This API is used to set
  6396. * interrupt enable byte1 from the register 0x51 bit 0 to 6
  6397. * @brief It read the high_g_x,high_g_y,high_g_z,low_g_enable
  6398. * data ready, FIFO full and FIFO water mark.
  6399. *
  6400. *
  6401. *
  6402. * @param v_enable_u8 : The value of interrupt enable
  6403. * @param v_enable_u8 : Value to select the interrupt
  6404. * v_enable_u8 | interrupt
  6405. * ---------------|---------------
  6406. * 0 | BMI160_HIGH_G_X_ENABLE
  6407. * 1 | BMI160_HIGH_G_Y_ENABLE
  6408. * 2 | BMI160_HIGH_G_Z_ENABLE
  6409. * 3 | BMI160_LOW_G_ENABLE
  6410. * 4 | BMI160_DATA_RDY_ENABLE
  6411. * 5 | BMI160_FIFO_FULL_ENABLE
  6412. * 6 | BMI160_FIFO_WM_ENABLE
  6413. *
  6414. * @param v_intr_enable_1_u8 : The interrupt enable value
  6415. * value | interrupt enable
  6416. * ----------|-------------------
  6417. * 0x01 | BMI160_ENABLE
  6418. * 0x00 | BMI160_DISABLE
  6419. *
  6420. *
  6421. *
  6422. * @return results of bus communication function
  6423. * @retval 0 -> Success
  6424. * @retval -1 -> Error
  6425. *
  6426. *
  6427. */
  6428. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_enable_1(
  6429. u8 enable, u8 v_intr_enable_1_u8);
  6430. /***************************************************************/
  6431. /**\name FUNCTION FOR INTERRUPT ENABLE OF
  6432. NO MOTION XYZ */
  6433. /***************************************************************/
  6434. /*!
  6435. * @brief This API is used to read
  6436. * interrupt enable byte2 from the register bit 0x52 bit 0 to 3
  6437. * @brief It reads no motion x,y and z
  6438. *
  6439. *
  6440. *
  6441. * @param v_enable_u8: The value of interrupt enable
  6442. * v_enable_u8 | interrupt
  6443. * ---------------|---------------
  6444. * 0 | BMI160_NOMOTION_X_ENABLE
  6445. * 1 | BMI160_NOMOTION_Y_ENABLE
  6446. * 2 | BMI160_NOMOTION_Z_ENABLE
  6447. *
  6448. * @param v_intr_enable_2_u8 : The interrupt enable value
  6449. * value | interrupt enable
  6450. * ----------|-------------------
  6451. * 0x01 | BMI160_ENABLE
  6452. * 0x00 | BMI160_DISABLE
  6453. *
  6454. *
  6455. *
  6456. * @return results of bus communication function
  6457. * @retval 0 -> Success
  6458. * @retval -1 -> Error
  6459. *
  6460. *
  6461. */
  6462. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_enable_2(
  6463. u8 enable, u8 *v_intr_enable_2_u8);
  6464. /*!
  6465. * @brief This API is used to set
  6466. * interrupt enable byte2 from the register bit 0x52 bit 0 to 3
  6467. * @brief It reads no motion x,y and z
  6468. *
  6469. *
  6470. *
  6471. * @param v_enable_u8: The value of interrupt enable
  6472. * v_enable_u8 | interrupt
  6473. * ---------------|---------------
  6474. * 0 | BMI160_NOMOTION_X_ENABLE
  6475. * 1 | BMI160_NOMOTION_Y_ENABLE
  6476. * 2 | BMI160_NOMOTION_Z_ENABLE
  6477. *
  6478. * @param v_intr_enable_2_u8 : The interrupt enable value
  6479. * value | interrupt enable
  6480. * ----------|-------------------
  6481. * 0x01 | BMI160_ENABLE
  6482. * 0x00 | BMI160_DISABLE
  6483. *
  6484. *
  6485. *
  6486. * @return results of bus communication function
  6487. * @retval 0 -> Success
  6488. * @retval -1 -> Error
  6489. *
  6490. *
  6491. */
  6492. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_enable_2(
  6493. u8 enable, u8 v_intr_enable_2_u8);
  6494. /***************************************************************/
  6495. /**\name FUNCTION FOR INTERRUPT ENABLE OF
  6496. STEP DETECTOR */
  6497. /***************************************************************/
  6498. /*!
  6499. * @brief This API is used to read
  6500. * interrupt enable step detector interrupt from
  6501. * the register bit 0x52 bit 3
  6502. *
  6503. *
  6504. *
  6505. *
  6506. * @param v_step_intr_u8 : The value of step detector interrupt enable
  6507. *
  6508. *
  6509. *
  6510. * @return results of bus communication function
  6511. * @retval 0 -> Success
  6512. * @retval -1 -> Error
  6513. *
  6514. *
  6515. */
  6516. BMI160_RETURN_FUNCTION_TYPE bmi160_get_step_detector_enable(
  6517. u8 *v_step_intr_u8);
  6518. /*!
  6519. * @brief This API is used to set
  6520. * interrupt enable step detector interrupt from
  6521. * the register bit 0x52 bit 3
  6522. *
  6523. *
  6524. *
  6525. *
  6526. * @param v_step_intr_u8 : The value of step detector interrupt enable
  6527. *
  6528. *
  6529. *
  6530. * @return results of bus communication function
  6531. * @retval 0 -> Success
  6532. * @retval -1 -> Error
  6533. *
  6534. *
  6535. */
  6536. BMI160_RETURN_FUNCTION_TYPE bmi160_set_step_detector_enable(
  6537. u8 v_step_intr_u8);
  6538. /***************************************************************/
  6539. /**\name FUNCTION FOR INTERRUPT CONTROL */
  6540. /***************************************************************/
  6541. /*!
  6542. * @brief This API reads trigger condition of interrupt1
  6543. * and interrupt2 pin from the register 0x53
  6544. * @brief interrupt1 - bit 0
  6545. * @brief interrupt2 - bit 4
  6546. *
  6547. * @param v_channel_u8: The value of edge trigger selection
  6548. * v_channel_u8 | Edge trigger
  6549. * ---------------|---------------
  6550. * 0 | BMI160_INTR1_EDGE_CTRL
  6551. * 1 | BMI160_INTR2_EDGE_CTRL
  6552. *
  6553. * @param v_intr_edge_ctrl_u8 : The value of edge trigger enable
  6554. * value | interrupt enable
  6555. * ----------|-------------------
  6556. * 0x01 | BMI160_EDGE
  6557. * 0x00 | BMI160_LEVEL
  6558. *
  6559. * @return results of bus communication function
  6560. * @retval 0 -> Success
  6561. * @retval -1 -> Error
  6562. *
  6563. *
  6564. */
  6565. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_edge_ctrl(
  6566. u8 v_channel_u8, u8 *v_intr_edge_ctrl_u8);
  6567. /*!
  6568. * @brief This API configures trigger condition of interrupt1
  6569. * and interrupt2 pin from the register 0x53
  6570. * @brief interrupt1 - bit 0
  6571. * @brief interrupt2 - bit 4
  6572. *
  6573. * @param v_channel_u8: The value of edge trigger selection
  6574. * v_channel_u8 | Edge trigger
  6575. * ---------------|---------------
  6576. * 0 | BMI160_INTR1_EDGE_CTRL
  6577. * 1 | BMI160_INTR2_EDGE_CTRL
  6578. *
  6579. * @param v_intr_edge_ctrl_u8 : The value of edge trigger enable
  6580. * value | interrupt enable
  6581. * ----------|-------------------
  6582. * 0x01 | BMI160_EDGE
  6583. * 0x00 | BMI160_LEVEL
  6584. *
  6585. * @return results of bus communication function
  6586. * @retval 0 -> Success
  6587. * @retval -1 -> Error
  6588. *
  6589. *
  6590. */
  6591. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_edge_ctrl(
  6592. u8 v_channel_u8, u8 v_intr_edge_ctrl_u8);
  6593. /*!
  6594. * @brief This API is used to get the Configure level condition of
  6595. * interrupt1 and interrupt2 pin from the register 0x53
  6596. * @brief interrupt1 - bit 1
  6597. * @brief interrupt2 - bit 5
  6598. *
  6599. * @param v_channel_u8: The value of level condition selection
  6600. * v_channel_u8 | level selection
  6601. * ---------------|---------------
  6602. * 0 | BMI160_INTR1_LEVEL
  6603. * 1 | BMI160_INTR2_LEVEL
  6604. *
  6605. * @param v_intr_level_u8 : The value of level of interrupt enable
  6606. * value | Behaviour
  6607. * ----------|-------------------
  6608. * 0x01 | BMI160_LEVEL_HIGH
  6609. * 0x00 | BMI160_LEVEL_LOW
  6610. *
  6611. * @return results of bus communication function
  6612. * @retval 0 -> Success
  6613. * @retval -1 -> Error
  6614. *
  6615. *
  6616. */
  6617. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_level(
  6618. u8 v_channel_u8, u8 *v_intr_level_u8);
  6619. /*!
  6620. * @brief This API is used to set the configure level condition of
  6621. * interrupt1 and interrupt2 pin from the register 0x53
  6622. * @brief interrupt1 - bit 1
  6623. * @brief interrupt2 - bit 5
  6624. *
  6625. * @param v_channel_u8: The value of level condition selection
  6626. * v_channel_u8 | level selection
  6627. * ---------------|---------------
  6628. * 0 | BMI160_INTR1_LEVEL
  6629. * 1 | BMI160_INTR2_LEVEL
  6630. *
  6631. * @param v_intr_level_u8 : The value of level of interrupt enable
  6632. * value | Behaviour
  6633. * ----------|-------------------
  6634. * 0x01 | BMI160_LEVEL_HIGH
  6635. * 0x00 | BMI160_LEVEL_LOW
  6636. *
  6637. * @return results of bus communication function
  6638. * @retval 0 -> Success
  6639. * @retval -1 -> Error
  6640. *
  6641. *
  6642. */
  6643. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_level(
  6644. u8 v_channel_u8, u8 v_intr_level_u8);
  6645. /*!
  6646. * @brief This API is used to get configured output enable of interrupt1
  6647. * and interrupt2 from the register 0x53
  6648. * @brief interrupt1 - bit 2
  6649. * @brief interrupt2 - bit 6
  6650. *
  6651. *
  6652. * @param v_channel_u8: The value of output type enable selection
  6653. * v_channel_u8 | level selection
  6654. * ---------------|---------------
  6655. * 0 | BMI160_INTR1_OUTPUT_TYPE
  6656. * 1 | BMI160_INTR2_OUTPUT_TYPE
  6657. *
  6658. * @param v_intr_output_type_u8 :
  6659. * The value of output type of interrupt enable
  6660. * value | Behaviour
  6661. * ----------|-------------------
  6662. * 0x01 | BMI160_OPEN_DRAIN
  6663. * 0x00 | BMI160_PUSH_PULL
  6664. *
  6665. *
  6666. * @return results of bus communication function
  6667. * @retval 0 -> Success
  6668. * @retval -1 -> Error
  6669. *
  6670. *
  6671. */
  6672. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_output_type(
  6673. u8 v_channel_u8, u8 *v_intr_output_type_u8);
  6674. /*!
  6675. * @brief This API is used to set output enable of interrupt1
  6676. * and interrupt2 from the register 0x53
  6677. * @brief interrupt1 - bit 2
  6678. * @brief interrupt2 - bit 6
  6679. *
  6680. *
  6681. * @param v_channel_u8: The value of output type enable selection
  6682. * v_channel_u8 | level selection
  6683. * ---------------|---------------
  6684. * 0 | BMI160_INTR1_OUTPUT_TYPE
  6685. * 1 | BMI160_INTR2_OUTPUT_TYPE
  6686. *
  6687. * @param v_intr_output_type_u8 :
  6688. * The value of output type of interrupt enable
  6689. * value | Behaviour
  6690. * ----------|-------------------
  6691. * 0x01 | BMI160_OPEN_DRAIN
  6692. * 0x00 | BMI160_PUSH_PULL
  6693. *
  6694. *
  6695. * @return results of bus communication function
  6696. * @retval 0 -> Success
  6697. * @retval -1 -> Error
  6698. *
  6699. *
  6700. */
  6701. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_output_type(
  6702. u8 v_channel_u8, u8 v_intr_output_type_u8);
  6703. /*!
  6704. * @brief This API is used to get the output enable for interrupt1
  6705. * and interrupt2 pin from the register 0x53
  6706. * @brief interrupt1 - bit 3
  6707. * @brief interrupt2 - bit 7
  6708. *
  6709. * @param v_channel_u8: The value of output enable selection
  6710. * v_channel_u8 | level selection
  6711. * ---------------|---------------
  6712. * 0 | BMI160_INTR1_OUTPUT_ENABLE
  6713. * 1 | BMI160_INTR2_OUTPUT_ENABLE
  6714. *
  6715. * @param v_output_enable_u8 :
  6716. * The value of output enable of interrupt enable
  6717. * value | Behaviour
  6718. * ----------|-------------------
  6719. * 0x01 | INTERRUPT OUTPUT ENABLED
  6720. * 0x00 | INTERRUPT OUTPUT DISABLED
  6721. *
  6722. *
  6723. *
  6724. * @return results of bus communication function
  6725. * @retval 0 -> Success
  6726. * @retval -1 -> Error
  6727. *
  6728. *
  6729. */
  6730. BMI160_RETURN_FUNCTION_TYPE bmi160_get_output_enable(
  6731. u8 v_channel_u8, u8 *v_output_enable_u8);
  6732. /*!
  6733. * @brief This API is used to set the Output enable for interrupt1
  6734. * and interrupt2 pin from the register 0x53
  6735. * @brief interrupt1 - bit 3
  6736. * @brief interrupt2 - bit 7
  6737. *
  6738. * @param v_channel_u8: The value of output enable selection
  6739. * v_channel_u8 | level selection
  6740. * ---------------|---------------
  6741. * 0 | BMI160_INTR1_OUTPUT_ENABLE
  6742. * 1 | BMI160_INTR2_OUTPUT_ENABLE
  6743. *
  6744. * @param v_output_enable_u8 :
  6745. * The value of output enable of interrupt enable
  6746. * value | Behaviour
  6747. * ----------|-------------------
  6748. * 0x01 | INTERRUPT OUTPUT ENABLED
  6749. * 0x00 | INTERRUPT OUTPUT DISABLED
  6750. *
  6751. *
  6752. *
  6753. * @return results of bus communication function
  6754. * @retval 0 -> Success
  6755. * @retval -1 -> Error
  6756. *
  6757. *
  6758. */
  6759. BMI160_RETURN_FUNCTION_TYPE bmi160_set_output_enable(
  6760. u8 v_channel_u8, u8 v_output_enable_u8);
  6761. /***************************************************************/
  6762. /**\name FUNCTION FOR INTERRUPT LATCH INTERRUPT */
  6763. /***************************************************************/
  6764. /*!
  6765. * @brief This API is used to get the latch duration
  6766. * from the register 0x54 bit 0 to 3
  6767. * @brief This latch selection is not applicable for data ready,
  6768. * orientation and flat interrupts.
  6769. *
  6770. *
  6771. *
  6772. * @param v_latch_intr_u8 : The value of latch duration
  6773. * Latch Duration | value
  6774. * --------------------------------------|------------------
  6775. * BMI160_LATCH_DUR_NONE | 0x00
  6776. * BMI160_LATCH_DUR_312_5_MICRO_SEC | 0x01
  6777. * BMI160_LATCH_DUR_625_MICRO_SEC | 0x02
  6778. * BMI160_LATCH_DUR_1_25_MILLI_SEC | 0x03
  6779. * BMI160_LATCH_DUR_2_5_MILLI_SEC | 0x04
  6780. * BMI160_LATCH_DUR_5_MILLI_SEC | 0x05
  6781. * BMI160_LATCH_DUR_10_MILLI_SEC | 0x06
  6782. * BMI160_LATCH_DUR_20_MILLI_SEC | 0x07
  6783. * BMI160_LATCH_DUR_40_MILLI_SEC | 0x08
  6784. * BMI160_LATCH_DUR_80_MILLI_SEC | 0x09
  6785. * BMI160_LATCH_DUR_160_MILLI_SEC | 0x0A
  6786. * BMI160_LATCH_DUR_320_MILLI_SEC | 0x0B
  6787. * BMI160_LATCH_DUR_640_MILLI_SEC | 0x0C
  6788. * BMI160_LATCH_DUR_1_28_SEC | 0x0D
  6789. * BMI160_LATCH_DUR_2_56_SEC | 0x0E
  6790. * BMI160_LATCHED | 0x0F
  6791. *
  6792. *
  6793. *
  6794. * @return results of bus communication function
  6795. * @retval 0 -> Success
  6796. * @retval -1 -> Error
  6797. *
  6798. *
  6799. */
  6800. BMI160_RETURN_FUNCTION_TYPE bmi160_get_latch_intr(
  6801. u8 *v_latch_intr_u8);
  6802. /*!
  6803. * @brief This API is used to set the latch duration
  6804. * from the register 0x54 bit 0 to 3
  6805. * @brief This latch selection is not applicable for data ready,
  6806. * orientation and flat interrupts.
  6807. *
  6808. *
  6809. *
  6810. * @param v_latch_intr_u8 : The value of latch duration
  6811. * Latch Duration | value
  6812. * --------------------------------------|------------------
  6813. * BMI160_LATCH_DUR_NONE | 0x00
  6814. * BMI160_LATCH_DUR_312_5_MICRO_SEC | 0x01
  6815. * BMI160_LATCH_DUR_625_MICRO_SEC | 0x02
  6816. * BMI160_LATCH_DUR_1_25_MILLI_SEC | 0x03
  6817. * BMI160_LATCH_DUR_2_5_MILLI_SEC | 0x04
  6818. * BMI160_LATCH_DUR_5_MILLI_SEC | 0x05
  6819. * BMI160_LATCH_DUR_10_MILLI_SEC | 0x06
  6820. * BMI160_LATCH_DUR_20_MILLI_SEC | 0x07
  6821. * BMI160_LATCH_DUR_40_MILLI_SEC | 0x08
  6822. * BMI160_LATCH_DUR_80_MILLI_SEC | 0x09
  6823. * BMI160_LATCH_DUR_160_MILLI_SEC | 0x0A
  6824. * BMI160_LATCH_DUR_320_MILLI_SEC | 0x0B
  6825. * BMI160_LATCH_DUR_640_MILLI_SEC | 0x0C
  6826. * BMI160_LATCH_DUR_1_28_SEC | 0x0D
  6827. * BMI160_LATCH_DUR_2_56_SEC | 0x0E
  6828. * BMI160_LATCHED | 0x0F
  6829. *
  6830. *
  6831. *
  6832. * @return results of bus communication function
  6833. * @retval 0 -> Success
  6834. * @retval -1 -> Error
  6835. *
  6836. *
  6837. */
  6838. BMI160_RETURN_FUNCTION_TYPE bmi160_set_latch_intr(
  6839. u8 v_latch_intr_u8);
  6840. /*!
  6841. * @brief API is used to get input enable for interrupt1
  6842. * and interrupt2 pin from the register 0x54
  6843. * @brief interrupt1 - bit 4
  6844. * @brief interrupt2 - bit 5
  6845. *
  6846. * @param v_channel_u8: The value of input enable selection
  6847. * v_channel_u8 | input selection
  6848. * ---------------|---------------
  6849. * 0 | BMI160_INTR1_INPUT_ENABLE
  6850. * 1 | BMI160_INTR2_INPUT_ENABLE
  6851. *
  6852. * @param v_input_en_u8 :
  6853. * The value of input enable of interrupt enable
  6854. * value | Behaviour
  6855. * ----------|-------------------
  6856. * 0x01 | BMI160_INPUT_ENABLED
  6857. * 0x00 | BMI160_INPUT_DISABLED
  6858. *
  6859. *
  6860. *
  6861. * @return results of bus communication function
  6862. * @retval 0 -> Success
  6863. * @retval -1 -> Error
  6864. *
  6865. *
  6866. */
  6867. BMI160_RETURN_FUNCTION_TYPE bmi160_get_input_enable(
  6868. u8 v_channel_u8, u8 *v_input_en_u8);
  6869. /*!
  6870. * @brief API is used to set input enable for interrupt1
  6871. * and interrupt2 pin from the register 0x54
  6872. * @brief interrupt1 - bit 4
  6873. * @brief interrupt2 - bit 5
  6874. *
  6875. * @param v_channel_u8: The value of input enable selection
  6876. * v_channel_u8 | input selection
  6877. * ---------------|---------------
  6878. * 0 | BMI160_INTR1_INPUT_ENABLE
  6879. * 1 | BMI160_INTR2_INPUT_ENABLE
  6880. *
  6881. * @param v_input_en_u8 :
  6882. * The value of input enable of interrupt enable
  6883. * value | Behaviour
  6884. * ----------|-------------------
  6885. * 0x01 | BMI160_INPUT_ENABLED
  6886. * 0x00 | BMI160_INPUT_DISABLED
  6887. *
  6888. *
  6889. *
  6890. * @return results of bus communication function
  6891. * @retval 0 -> Success
  6892. * @retval -1 -> Error
  6893. *
  6894. *
  6895. */
  6896. BMI160_RETURN_FUNCTION_TYPE bmi160_set_input_enable(
  6897. u8 v_channel_u8, u8 v_input_en_u8);
  6898. /***************************************************************/
  6899. /**\name FUNCTION FOR INTERRUPT1 AND INTERRUPT2 MAPPING */
  6900. /***************************************************************/
  6901. /*!
  6902. * @brief This API reads the Low g interrupt which is mapped to interrupt1
  6903. * and interrupt2 from the register 0x55 and 0x57
  6904. * @brief interrupt1 bit 0 in the register 0x55
  6905. * @brief interrupt2 bit 0 in the register 0x57
  6906. *
  6907. *
  6908. * @param v_channel_u8: The value of low_g selection
  6909. * v_channel_u8 | interrupt
  6910. * ---------------|---------------
  6911. * 0 | BMI160_INTR1_MAP_LOW_G
  6912. * 1 | BMI160_INTR2_MAP_LOW_G
  6913. *
  6914. * @param v_intr_low_g_u8 : The value of low_g enable
  6915. * value | interrupt enable
  6916. * ----------|-------------------
  6917. * 0x01 | BMI160_ENABLE
  6918. * 0x00 | BMI160_DISABLE
  6919. *
  6920. *
  6921. *
  6922. * @return results of bus communication function
  6923. * @retval 0 -> Success
  6924. * @retval -1 -> Error
  6925. *
  6926. *
  6927. */
  6928. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_low_g(
  6929. u8 v_channel_u8, u8 *v_intr_low_g_u8);
  6930. /*!
  6931. * @brief This API sets the Low g interrupt to be mapped to interrupt1
  6932. * and interrupt2 from the register 0x55 and 0x57
  6933. * @brief interrupt1 bit 0 in the register 0x55
  6934. * @brief interrupt2 bit 0 in the register 0x57
  6935. *
  6936. *
  6937. * @param v_channel_u8: The value of low_g selection
  6938. * v_channel_u8 | interrupt
  6939. * ---------------|---------------
  6940. * 0 | BMI160_INTR1_MAP_LOW_G
  6941. * 1 | BMI160_INTR2_MAP_LOW_G
  6942. *
  6943. * @param v_intr_low_g_u8 : The value of low_g enable
  6944. * value | interrupt enable
  6945. * ----------|-------------------
  6946. * 0x01 | BMI160_ENABLE
  6947. * 0x00 | BMI160_DISABLE
  6948. *
  6949. *
  6950. *
  6951. * @return results of bus communication function
  6952. * @retval 0 -> Success
  6953. * @retval -1 -> Error
  6954. *
  6955. *
  6956. */
  6957. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_low_g(
  6958. u8 v_channel_u8, u8 v_intr_low_g_u8);
  6959. /*!
  6960. * @brief This API reads the HIGH g interrupt which is mapped to interrupt1
  6961. * and interrupt2 from the register 0x55 and 0x57
  6962. * @brief interrupt1 bit 1 in the register 0x55
  6963. * @brief interrupt2 bit 1 in the register 0x57
  6964. *
  6965. *
  6966. * @param v_channel_u8: The value of high_g selection
  6967. * v_channel_u8 | interrupt
  6968. * ---------------|---------------
  6969. * 0 | BMI160_INTR1_MAP_HIGH_G
  6970. * 1 | BMI160_INTR2_MAP_HIGH_G
  6971. *
  6972. * @param v_intr_high_g_u8 : The value of high_g enable
  6973. * value | interrupt enable
  6974. * ----------|-------------------
  6975. * 0x01 | BMI160_ENABLE
  6976. * 0x00 | BMI160_DISABLE
  6977. *
  6978. *
  6979. *
  6980. *
  6981. * @return results of bus communication function
  6982. * @retval 0 -> Success
  6983. * @retval -1 -> Error
  6984. *
  6985. *
  6986. */
  6987. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_high_g(
  6988. u8 v_channel_u8, u8 *v_intr_high_g_u8);
  6989. /*!
  6990. * @brief This API writes the HIGH g interrupt to be mapped to interrupt1
  6991. * and interrupt2 from the register 0x55 and 0x57
  6992. * @brief interrupt1 bit 1 in the register 0x55
  6993. * @brief interrupt2 bit 1 in the register 0x57
  6994. *
  6995. *
  6996. * @param v_channel_u8: The value of high_g selection
  6997. * v_channel_u8 | interrupt
  6998. * ---------------|---------------
  6999. * 0 | BMI160_INTR1_MAP_HIGH_G
  7000. * 1 | BMI160_INTR2_MAP_HIGH_G
  7001. *
  7002. * @param v_intr_high_g_u8 : The value of high_g enable
  7003. * value | interrupt enable
  7004. * ----------|-------------------
  7005. * 0x01 | BMI160_ENABLE
  7006. * 0x00 | BMI160_DISABLE
  7007. *
  7008. *
  7009. *
  7010. *
  7011. * @return results of bus communication function
  7012. * @retval 0 -> Success
  7013. * @retval -1 -> Error
  7014. *
  7015. *
  7016. */
  7017. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_high_g(
  7018. u8 v_channel_u8, u8 v_intr_high_g_u8);
  7019. /*!
  7020. * @brief This API reads the Any motion interrupt which is mapped to
  7021. * interrupt1 and interrupt2 from the register 0x55 and 0x57
  7022. * @brief interrupt1 bit 2 in the register 0x55
  7023. * @brief interrupt2 bit 2 in the register 0x57
  7024. *
  7025. *
  7026. * @param v_channel_u8: The value of any motion selection
  7027. * v_channel_u8 | interrupt
  7028. * ---------------|---------------
  7029. * 0 | BMI160_INTR1_MAP_ANY_MOTION
  7030. * 1 | BMI160_INTR2_MAP_ANY_MOTION
  7031. *
  7032. * @param v_intr_any_motion_u8 : The value of any motion enable
  7033. * value | interrupt enable
  7034. * ----------|-------------------
  7035. * 0x01 | BMI160_ENABLE
  7036. * 0x00 | BMI160_DISABLE
  7037. *
  7038. *
  7039. *
  7040. * @return results of bus communication function
  7041. * @retval 0 -> Success
  7042. * @retval -1 -> Error
  7043. *
  7044. *
  7045. */
  7046. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_any_motion(
  7047. u8 v_channel_u8, u8 *v_intr_any_motion_u8);
  7048. /*!
  7049. * @brief This API writes the Any motion interrupt
  7050. * to be mapped to interrupt1
  7051. * and interrupt2 from the register 0x55 and 0x57
  7052. * @brief interrupt1 bit 2 in the register 0x55
  7053. * @brief interrupt2 bit 2 in the register 0x57
  7054. *
  7055. *
  7056. * @param v_channel_u8: The value of any motion selection
  7057. * v_channel_u8 | interrupt
  7058. * ---------------|---------------
  7059. * 0 | BMI160_INTR1_MAP_ANY_MOTION
  7060. * 1 | BMI160_INTR2_MAP_ANY_MOTION
  7061. *
  7062. * @param v_intr_any_motion_u8 : The value of any motion enable
  7063. * value | interrupt enable
  7064. * ----------|-------------------
  7065. * 0x01 | BMI160_ENABLE
  7066. * 0x00 | BMI160_DISABLE
  7067. *
  7068. *
  7069. *
  7070. * @return results of bus communication function
  7071. * @retval 0 -> Success
  7072. * @retval -1 -> Error
  7073. *
  7074. *
  7075. */
  7076. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_any_motion(
  7077. u8 v_channel_u8, u8 v_intr_any_motion_u8);
  7078. /*!
  7079. * @brief This API reads the No motion interrupt
  7080. * which is mapped to interrupt1
  7081. * and interrupt2 from the register 0x55 and 0x57
  7082. * @brief interrupt1 bit 3 in the register 0x55
  7083. * @brief interrupt2 bit 3 in the register 0x57
  7084. *
  7085. *
  7086. * @param v_channel_u8: The value of no motion selection
  7087. * v_channel_u8 | interrupt
  7088. * ---------------|---------------
  7089. * 0 | BMI160_INTR1_MAP_NOMO
  7090. * 1 | BMI160_INTR2_MAP_NOMO
  7091. *
  7092. * @param v_intr_nomotion_u8 : The value of no motion enable
  7093. * value | interrupt enable
  7094. * ----------|-------------------
  7095. * 0x01 | BMI160_ENABLE
  7096. * 0x00 | BMI160_DISABLE
  7097. *
  7098. *
  7099. * @return results of bus communication function
  7100. * @retval 0 -> Success
  7101. * @retval -1 -> Error
  7102. *
  7103. *
  7104. */
  7105. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_nomotion(
  7106. u8 v_channel_u8, u8 *v_intr_nomotion_u8);
  7107. /*!
  7108. * @brief This API configures the No motion interrupt
  7109. * to be mapped to interrupt1
  7110. * and interrupt2 from the register 0x55 and 0x57
  7111. * @brief interrupt1 bit 3 in the register 0x55
  7112. * @brief interrupt2 bit 3 in the register 0x57
  7113. *
  7114. *
  7115. * @param v_channel_u8: The value of no motion selection
  7116. * v_channel_u8 | interrupt
  7117. * ---------------|---------------
  7118. * 0 | BMI160_INTR1_MAP_NOMO
  7119. * 1 | BMI160_INTR2_MAP_NOMO
  7120. *
  7121. * @param v_intr_nomotion_u8 : The value of no motion enable
  7122. * value | interrupt enable
  7123. * ----------|-------------------
  7124. * 0x01 | BMI160_ENABLE
  7125. * 0x00 | BMI160_DISABLE
  7126. *
  7127. *
  7128. * @return results of bus communication function
  7129. * @retval 0 -> Success
  7130. * @retval -1 -> Error
  7131. *
  7132. *
  7133. */
  7134. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_nomotion(
  7135. u8 v_channel_u8, u8 v_intr_nomotion_u8);
  7136. /*!
  7137. * @brief This API reads the Double Tap interrupt
  7138. * which is mapped to interrupt1
  7139. * and interrupt2 from the register 0x55 and 0x57
  7140. * @brief interrupt1 bit 4 in the register 0x55
  7141. * @brief interrupt2 bit 4 in the register 0x57
  7142. *
  7143. *
  7144. * @param v_channel_u8: The value of double tap interrupt selection
  7145. * v_channel_u8 | interrupt
  7146. * ---------------|---------------
  7147. * 0 | BMI160_INTR1_MAP_DOUBLE_TAP
  7148. * 1 | BMI160_INTR2_MAP_DOUBLE_TAP
  7149. *
  7150. * @param v_intr_double_tap_u8 : The value of double tap enable
  7151. * value | interrupt enable
  7152. * ----------|-------------------
  7153. * 0x01 | BMI160_ENABLE
  7154. * 0x00 | BMI160_DISABLE
  7155. *
  7156. * @return results of bus communication function
  7157. * @retval 0 -> Success
  7158. * @retval -1 -> Error
  7159. *
  7160. *
  7161. */
  7162. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_double_tap(
  7163. u8 v_channel_u8, u8 *v_intr_double_tap_u8);
  7164. /*!
  7165. * @brief This API configures the Double Tap interrupt
  7166. * to be mapped to interrupt1
  7167. * and interrupt2 from the register 0x55 and 0x57
  7168. * @brief interrupt1 bit 4 in the register 0x55
  7169. * @brief interrupt2 bit 4 in the register 0x57
  7170. *
  7171. *
  7172. * @param v_channel_u8: The value of double tap interrupt selection
  7173. * v_channel_u8 | interrupt
  7174. * ---------------|---------------
  7175. * 0 | BMI160_INTR1_MAP_DOUBLE_TAP
  7176. * 1 | BMI160_INTR2_MAP_DOUBLE_TAP
  7177. *
  7178. * @param v_intr_double_tap_u8 : The value of double tap enable
  7179. * value | interrupt enable
  7180. * ----------|-------------------
  7181. * 0x01 | BMI160_ENABLE
  7182. * 0x00 | BMI160_DISABLE
  7183. *
  7184. * @return results of bus communication function
  7185. * @retval 0 -> Success
  7186. * @retval -1 -> Error
  7187. *
  7188. *
  7189. */
  7190. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_double_tap(
  7191. u8 v_channel_u8, u8 v_intr_double_tap_u8);
  7192. /*!
  7193. * @brief This API reads the Single Tap interrupt
  7194. * which is mapped to interrupt1
  7195. * and interrupt2 from the register 0x55 and 0x57
  7196. * @brief interrupt1 bit 5 in the register 0x55
  7197. * @brief interrupt2 bit 5 in the register 0x57
  7198. *
  7199. *
  7200. * @param v_channel_u8: The value of single tap interrupt selection
  7201. * v_channel_u8 | interrupt
  7202. * ---------------|---------------
  7203. * 0 | BMI160_INTR1_MAP_SINGLE_TAP
  7204. * 1 | BMI160_INTR2_MAP_SINGLE_TAP
  7205. *
  7206. * @param v_intr_single_tap_u8 : The value of single tap enable
  7207. * value | interrupt enable
  7208. * ----------|-------------------
  7209. * 0x01 | BMI160_ENABLE
  7210. * 0x00 | BMI160_DISABLE
  7211. *
  7212. *
  7213. * @return results of bus communication function
  7214. * @retval 0 -> Success
  7215. * @retval -1 -> Error
  7216. *
  7217. *
  7218. */
  7219. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_single_tap(
  7220. u8 v_channel_u8, u8 *v_intr_single_tap_u8);
  7221. /*!
  7222. * @brief This API configures the Single Tap interrupt
  7223. * to be mapped to interrupt1
  7224. * and interrupt2 from the register 0x55 and 0x57
  7225. * @brief interrupt1 bit 5 in the register 0x55
  7226. * @brief interrupt2 bit 5 in the register 0x57
  7227. *
  7228. *
  7229. * @param v_channel_u8: The value of single tap interrupt selection
  7230. * v_channel_u8 | interrupt
  7231. * ---------------|---------------
  7232. * 0 | BMI160_INTR1_MAP_SINGLE_TAP
  7233. * 1 | BMI160_INTR2_MAP_SINGLE_TAP
  7234. *
  7235. * @param v_intr_single_tap_u8 : The value of single tap enable
  7236. * value | interrupt enable
  7237. * ----------|-------------------
  7238. * 0x01 | BMI160_ENABLE
  7239. * 0x00 | BMI160_DISABLE
  7240. *
  7241. *
  7242. * @return results of bus communication function
  7243. * @retval 0 -> Success
  7244. * @retval -1 -> Error
  7245. *
  7246. *
  7247. */
  7248. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_single_tap(
  7249. u8 v_channel_u8, u8 v_intr_single_tap_u8);
  7250. /*!
  7251. * @brief This API reads the Orient interrupt which is mapped to interrupt1
  7252. * and interrupt2 from the register 0x55 and 0x57
  7253. * @brief interrupt1 bit 6 in the register 0x55
  7254. * @brief interrupt2 bit 6 in the register 0x57
  7255. *
  7256. *
  7257. * @param v_channel_u8: The value of orient interrupt selection
  7258. * v_channel_u8 | interrupt
  7259. * ---------------|---------------
  7260. * 0 | BMI160_INTR1_MAP_ORIENT
  7261. * 1 | BMI160_INTR2_MAP_ORIENT
  7262. *
  7263. * @param v_intr_orient_u8 : The value of orient enable
  7264. * value | interrupt enable
  7265. * ----------|-------------------
  7266. * 0x01 | BMI160_ENABLE
  7267. * 0x00 | BMI160_DISABLE
  7268. *
  7269. *
  7270. *
  7271. * @return results of bus communication function
  7272. * @retval 0 -> Success
  7273. * @retval -1 -> Error
  7274. *
  7275. *
  7276. */
  7277. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_orient(
  7278. u8 v_channel_u8, u8 *v_intr_orient_u8);
  7279. /*!
  7280. * @brief This API configures the Orient interrupt
  7281. * to be mapped to interrupt1
  7282. * and interrupt2 from the register 0x55 and 0x57
  7283. * @brief interrupt1 bit 6 in the register 0x55
  7284. * @brief interrupt2 bit 6 in the register 0x57
  7285. *
  7286. *
  7287. * @param v_channel_u8: The value of orient interrupt selection
  7288. * v_channel_u8 | interrupt
  7289. * ---------------|---------------
  7290. * 0 | BMI160_INTR1_MAP_ORIENT
  7291. * 1 | BMI160_INTR2_MAP_ORIENT
  7292. *
  7293. * @param v_intr_orient_u8 : The value of orient enable
  7294. * value | interrupt enable
  7295. * ----------|-------------------
  7296. * 0x01 | BMI160_ENABLE
  7297. * 0x00 | BMI160_DISABLE
  7298. *
  7299. *
  7300. *
  7301. * @return results of bus communication function
  7302. * @retval 0 -> Success
  7303. * @retval -1 -> Error
  7304. *
  7305. *
  7306. */
  7307. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_orient(
  7308. u8 v_channel_u8, u8 v_intr_orient_u8);
  7309. /*!
  7310. * @brief This API reads the Flat interrupt which is
  7311. * mapped to interrupt1
  7312. * and interrupt2 from the register 0x55 and 0x57
  7313. * @brief interrupt1 bit 7 in the register 0x55
  7314. * @brief interrupt2 bit 7 in the register 0x57
  7315. *
  7316. *
  7317. * @param v_channel_u8: The value of flat interrupt selection
  7318. * v_channel_u8 | interrupt
  7319. * ---------------|---------------
  7320. * 0 | BMI160_INTR1_MAP_FLAT
  7321. * 1 | BMI160_INTR2_MAP_FLAT
  7322. *
  7323. * @param v_intr_flat_u8 : The value of flat enable
  7324. * value | interrupt enable
  7325. * ----------|-------------------
  7326. * 0x01 | BMI160_ENABLE
  7327. * 0x00 | BMI160_DISABLE
  7328. *
  7329. *
  7330. * @return results of bus communication function
  7331. * @retval 0 -> Success
  7332. * @retval -1 -> Error
  7333. *
  7334. *
  7335. */
  7336. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_flat(
  7337. u8 v_channel_u8, u8 *v_intr_flat_u8);
  7338. /*!
  7339. * @brief This API configures the Flat interrupt to be
  7340. * mapped to interrupt1
  7341. * and interrupt2 from the register 0x55 and 0x57
  7342. * @brief interrupt1 bit 7 in the register 0x55
  7343. * @brief interrupt2 bit 7 in the register 0x57
  7344. *
  7345. *
  7346. * @param v_channel_u8: The value of flat interrupt selection
  7347. * v_channel_u8 | interrupt
  7348. * ---------------|---------------
  7349. * 0 | BMI160_INTR1_MAP_FLAT
  7350. * 1 | BMI160_INTR2_MAP_FLAT
  7351. *
  7352. * @param v_intr_flat_u8 : The value of flat enable
  7353. * value | interrupt enable
  7354. * ----------|-------------------
  7355. * 0x01 | BMI160_ENABLE
  7356. * 0x00 | BMI160_DISABLE
  7357. *
  7358. *
  7359. * @return results of bus communication function
  7360. * @retval 0 -> Success
  7361. * @retval -1 -> Error
  7362. *
  7363. *
  7364. */
  7365. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_flat(
  7366. u8 v_channel_u8, u8 v_intr_flat_u8);
  7367. /*!
  7368. * @brief This API reads the PMU trigger interrupt which is mapped to
  7369. * interrupt1 and interrupt2 from the register 0x56 bit 0 and 4
  7370. * @brief interrupt1 bit 0 in the register 0x56
  7371. * @brief interrupt2 bit 4 in the register 0x56
  7372. *
  7373. *
  7374. * @param v_channel_u8: The value of pmu trigger selection
  7375. * v_channel_u8 | interrupt
  7376. * ---------------|---------------
  7377. * 0 | BMI160_INTR1_MAP_PMUTRIG
  7378. * 1 | BMI160_INTR2_MAP_PMUTRIG
  7379. *
  7380. * @param v_intr_pmu_trig_u8 : The value of pmu trigger enable
  7381. * value | interrupt enable
  7382. * ----------|-------------------
  7383. * 0x01 | BMI160_ENABLE
  7384. * 0x00 | BMI160_DISABLE
  7385. *
  7386. *
  7387. * @return results of bus communication function
  7388. * @retval 0 -> Success
  7389. * @retval -1 -> Error
  7390. *
  7391. *
  7392. */
  7393. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_pmu_trig(
  7394. u8 v_channel_u8, u8 *v_intr_pmu_trig_u8);
  7395. /*!
  7396. * @brief This API configures the PMU trigger interrupt to be mapped to
  7397. * interrupt1 and interrupt2 from the register 0x56 bit 0 and 4
  7398. * @brief interrupt1 bit 0 in the register 0x56
  7399. * @brief interrupt2 bit 4 in the register 0x56
  7400. *
  7401. *
  7402. * @param v_channel_u8: The value of pmu trigger selection
  7403. * v_channel_u8 | interrupt
  7404. * ---------------|---------------
  7405. * 0 | BMI160_INTR1_MAP_PMUTRIG
  7406. * 1 | BMI160_INTR2_MAP_PMUTRIG
  7407. *
  7408. * @param v_intr_pmu_trig_u8 : The value of pmu trigger enable
  7409. * value | trigger enable
  7410. * ----------|-------------------
  7411. * 0x01 | BMI160_ENABLE
  7412. * 0x00 | BMI160_DISABLE
  7413. *
  7414. *
  7415. * @return results of bus communication function
  7416. * @retval 0 -> Success
  7417. * @retval -1 -> Error
  7418. *
  7419. *
  7420. */
  7421. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_pmu_trig(
  7422. u8 v_channel_u8, u8 v_intr_pmu_trig_u8);
  7423. /*!
  7424. * @brief This API reads the FIFO Full interrupt which is mapped to
  7425. * interrupt1 and interrupt2 from the register 0x56 bit 5 and 1
  7426. * @brief interrupt1 bit 5 in the register 0x56
  7427. * @brief interrupt2 bit 1 in the register 0x56
  7428. *
  7429. *
  7430. * @param v_channel_u8: The value of FIFO full interrupt selection
  7431. * v_channel_u8 | interrupt
  7432. * ---------------|---------------
  7433. * 0 | BMI160_INTR1_MAP_FIFO_FULL
  7434. * 1 | BMI160_INTR2_MAP_FIFO_FULL
  7435. *
  7436. * @param v_intr_fifo_full_u8 : The value of FIFO full interrupt enable
  7437. * value | interrupt enable
  7438. * ----------|-------------------
  7439. * 0x01 | BMI160_ENABLE
  7440. * 0x00 | BMI160_DISABLE
  7441. *
  7442. *
  7443. *
  7444. * @return results of bus communication function
  7445. * @retval 0 -> Success
  7446. * @retval -1 -> Error
  7447. *
  7448. *
  7449. */
  7450. #ifdef FIFO_ENABLE
  7451. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_fifo_full(
  7452. u8 v_channel_u8, u8 *v_intr_fifo_full_u8);
  7453. /*!
  7454. * @brief This API configures the FIFO Full interrupt to be mapped to
  7455. * interrupt1 and interrupt2 from the register 0x56 bit 5 and 1
  7456. * @brief interrupt1 bit 5 in the register 0x56
  7457. * @brief interrupt2 bit 1 in the register 0x56
  7458. *
  7459. *
  7460. * @param v_channel_u8: The value of FIFO full interrupt selection
  7461. * v_channel_u8 | interrupt
  7462. * ---------------|---------------
  7463. * 0 | BMI160_INTR1_MAP_FIFO_FULL
  7464. * 1 | BMI160_INTR2_MAP_FIFO_FULL
  7465. *
  7466. * @param v_intr_fifo_full_u8 : The value of FIFO full interrupt enable
  7467. * value | interrupt enable
  7468. * ----------|-------------------
  7469. * 0x01 | BMI160_ENABLE
  7470. * 0x00 | BMI160_DISABLE
  7471. *
  7472. *
  7473. *
  7474. * @return results of bus communication function
  7475. * @retval 0 -> Success
  7476. * @retval -1 -> Error
  7477. *
  7478. *
  7479. */
  7480. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_fifo_full(
  7481. u8 v_channel_u8, u8 v_intr_fifo_full_u8);
  7482. /*!
  7483. * @brief This API reads FIFO Watermark interrupt which is mapped to
  7484. * interrupt1 and interrupt2 from the register 0x56 bit 6 and 2
  7485. * @brief interrupt1 bit 6 in the register 0x56
  7486. * @brief interrupt2 bit 2 in the register 0x56
  7487. *
  7488. *
  7489. * @param v_channel_u8: The value of FIFO Watermark interrupt selection
  7490. * v_channel_u8 | interrupt
  7491. * ---------------|---------------
  7492. * 0 | BMI160_INTR1_MAP_FIFO_WM
  7493. * 1 | BMI160_INTR2_MAP_FIFO_WM
  7494. *
  7495. * @param v_intr_fifo_wm_u8 : The value of FIFO Watermark interrupt enable
  7496. * value | interrupt enable
  7497. * ----------|-------------------
  7498. * 0x01 | BMI160_ENABLE
  7499. * 0x00 | BMI160_DISABLE
  7500. *
  7501. *
  7502. *
  7503. *
  7504. * @return results of bus communication function
  7505. * @retval 0 -> Success
  7506. * @retval -1 -> Error
  7507. *
  7508. *
  7509. */
  7510. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_fifo_wm(
  7511. u8 v_channel_u8, u8 *v_intr_fifo_wm_u8);
  7512. /*!
  7513. * @brief This API configures FIFO Watermark interrupt to be mapped to
  7514. * interrupt1 and interrupt2 from the register 0x56 bit 6 and 2
  7515. * @brief interrupt1 bit 6 in the register 0x56
  7516. * @brief interrupt2 bit 2 in the register 0x56
  7517. *
  7518. *
  7519. * @param v_channel_u8: The value of FIFO Watermark interrupt selection
  7520. * v_channel_u8 | interrupt
  7521. * ---------------|---------------
  7522. * 0 | BMI160_INTR1_MAP_FIFO_WM
  7523. * 1 | BMI160_INTR2_MAP_FIFO_WM
  7524. *
  7525. * @param v_intr_fifo_wm_u8 : The value of FIFO Watermark interrupt enable
  7526. * value | interrupt enable
  7527. * ----------|-------------------
  7528. * 0x01 | BMI160_ENABLE
  7529. * 0x00 | BMI160_DISABLE
  7530. *
  7531. *
  7532. *
  7533. *
  7534. * @return results of bus communication function
  7535. * @retval 0 -> Success
  7536. * @retval -1 -> Error
  7537. *
  7538. *
  7539. */
  7540. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_fifo_wm(
  7541. u8 v_channel_u8, u8 v_intr_fifo_wm_u8);
  7542. #endif
  7543. /*!
  7544. * @brief This API reads Data Ready interrupt which is mapped to interrupt1
  7545. * and interrupt2 from the register 0x56
  7546. * @brief interrupt1 bit 7 in the register 0x56
  7547. * @brief interrupt2 bit 3 in the register 0x56
  7548. *
  7549. *
  7550. * @param v_channel_u8: The value of data ready interrupt selection
  7551. * v_channel_u8 | interrupt
  7552. * ---------------|---------------
  7553. * 0 | BMI160_INTR1_MAP_DATA_RDY
  7554. * 1 | BMI160_INTR2_MAP_DATA_RDY
  7555. *
  7556. * @param v_intr_data_rdy_u8 : The value of data ready interrupt enable
  7557. * value | interrupt enable
  7558. * ----------|-------------------
  7559. * 0x01 | BMI160_ENABLE
  7560. * 0x00 | BMI160_DISABLE
  7561. *
  7562. *
  7563. *
  7564. * @return results of bus communication function
  7565. * @retval 0 -> Success
  7566. * @retval -1 -> Error
  7567. *
  7568. *
  7569. */
  7570. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_data_rdy(
  7571. u8 v_channel_u8, u8 *v_intr_data_rdy_u8);
  7572. /*!
  7573. * @brief This API configures Data Ready interrupt to be mapped to
  7574. * interrupt1 and interrupt2 from the register 0x56
  7575. * @brief interrupt1 bit 7 in the register 0x56
  7576. * @brief interrupt2 bit 3 in the register 0x56
  7577. *
  7578. *
  7579. * @param v_channel_u8: The value of data ready interrupt selection
  7580. * v_channel_u8 | interrupt
  7581. * ---------------|---------------
  7582. * 0 | BMI160_INTR1_MAP_DATA_RDY
  7583. * 1 | BMI160_INTR2_MAP_DATA_RDY
  7584. *
  7585. * @param v_intr_data_rdy_u8 : The value of data ready interrupt enable
  7586. * value | interrupt enable
  7587. * ----------|-------------------
  7588. * 0x01 | BMI160_ENABLE
  7589. * 0x00 | BMI160_DISABLE
  7590. *
  7591. *
  7592. *
  7593. * @return results of bus communication function
  7594. * @retval 0 -> Success
  7595. * @retval -1 -> Error
  7596. *
  7597. *
  7598. */
  7599. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_data_rdy(
  7600. u8 v_channel_u8, u8 v_intr_data_rdy_u8);
  7601. /***************************************************************/
  7602. /**\name FUNCTION FOR TAP SOURCE CONFIGURATION */
  7603. /***************************************************************/
  7604. /*!
  7605. * @brief This API reads data source for the interrupt
  7606. * engine for the single and double tap interrupts from the register
  7607. * 0x58 bit 3
  7608. *
  7609. *
  7610. * @param v_tap_source_u8 : The value of the tap source
  7611. * value | Description
  7612. * ----------|-------------------
  7613. * 0x01 | UNFILTER_DATA
  7614. * 0x00 | FILTER_DATA
  7615. *
  7616. *
  7617. * @return results of bus communication function
  7618. * @retval 0 -> Success
  7619. * @retval -1 -> Error
  7620. *
  7621. *
  7622. */
  7623. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_tap_source(
  7624. u8 *v_tap_source_u8);
  7625. /*!
  7626. * @brief This API writes data source for the interrupt
  7627. * engine for the single and double tap interrupts from the register
  7628. * 0x58 bit 3
  7629. *
  7630. *
  7631. * @param v_tap_source_u8 : The value of the tap source
  7632. * value | Description
  7633. * ----------|-------------------
  7634. * 0x01 | UNFILTER_DATA
  7635. * 0x00 | FILTER_DATA
  7636. *
  7637. *
  7638. * @return results of bus communication function
  7639. * @retval 0 -> Success
  7640. * @retval -1 -> Error
  7641. *
  7642. *
  7643. */
  7644. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_tap_source(
  7645. u8 v_tap_source_u8);
  7646. /***************************************************************/
  7647. /**\name FUNCTION FOR LOW_G AND HIGH_G SOURCE CONFIGURATION */
  7648. /***************************************************************/
  7649. /*!
  7650. * @brief This API reads Data source for the
  7651. * interrupt engine for the low and high g interrupts
  7652. * from the register 0x58 bit 7
  7653. *
  7654. * @param v_low_high_source_u8 : The value of the low-g/high-g source
  7655. * value | Description
  7656. * ----------|-------------------
  7657. * 0x01 | UNFILTER_DATA
  7658. * 0x00 | FILTER_DATA
  7659. *
  7660. *
  7661. * @return results of bus communication function
  7662. * @retval 0 -> Success
  7663. * @retval -1 -> Error
  7664. *
  7665. *
  7666. */
  7667. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_low_high_source(
  7668. u8 *v_low_high_source_u8);
  7669. /*!
  7670. * @brief This API writes Data source for the
  7671. * interrupt engine for the low and high g interrupts
  7672. * from the register 0x58 bit 7
  7673. *
  7674. * @param v_low_high_source_u8 : The value of the low-g/high-g source
  7675. * value | Description
  7676. * ----------|-------------------
  7677. * 0x01 | UNFILTER_DATA
  7678. * 0x00 | FILTER_DATA
  7679. *
  7680. *
  7681. * @return results of bus communication function
  7682. * @retval 0 -> Success
  7683. * @retval -1 -> Error
  7684. *
  7685. *
  7686. */
  7687. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_low_high_source(
  7688. u8 v_low_high_source_u8);
  7689. /***************************************************************/
  7690. /**\name FUNCTION FOR MOTION SOURCE CONFIGURATION */
  7691. /***************************************************************/
  7692. /*!
  7693. * @brief This API reads Data source for the
  7694. * interrupt engine for the nomotion and anymotion interrupts
  7695. * from the register 0x59 bit 7
  7696. *
  7697. * @param v_motion_source_u8 :
  7698. * The value of the any/no motion interrupt source
  7699. * value | Description
  7700. * ----------|-------------------
  7701. * 0x01 | UNFILTER_DATA
  7702. * 0x00 | FILTER_DATA
  7703. *
  7704. * @return results of bus communication function
  7705. * @retval 0 -> Success
  7706. * @retval -1 -> Error
  7707. *
  7708. *
  7709. */
  7710. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_motion_source(
  7711. u8 *v_motion_source_u8);
  7712. /*!
  7713. * @brief This API writes Data source for the
  7714. * interrupt engine for the nomotion and anymotion interrupts
  7715. * from the register 0x59 bit 7
  7716. *
  7717. * @param v_motion_source_u8 :
  7718. * The value of the any/no motion interrupt source
  7719. * value | Description
  7720. * ----------|-------------------
  7721. * 0x01 | UNFILTER_DATA
  7722. * 0x00 | FILTER_DATA
  7723. *
  7724. * @return results of bus communication function
  7725. * @retval 0 -> Success
  7726. * @retval -1 -> Error
  7727. *
  7728. *
  7729. */
  7730. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_motion_source(
  7731. u8 v_motion_source_u8);
  7732. /***************************************************************/
  7733. /**\name FUNCTION FOR LOW_G DURATION CONFIGURATION */
  7734. /***************************************************************/
  7735. /*!
  7736. * @brief This API is used to read the low_g duration from register
  7737. * 0x5A bit 0 to 7
  7738. *
  7739. *
  7740. *
  7741. *
  7742. * @param v_low_g_durn_u8 : The value of low_g duration
  7743. *
  7744. * @note Low_g duration trigger trigger delay according to
  7745. * "(v_low_g_durn_u8 * 2.5)ms" in a range from 2.5ms to 640ms.
  7746. * the default corresponds delay is 20ms
  7747. * @note When low_g data source of interrupt is unfiltered
  7748. * the sensor must not be in low power mode
  7749. *
  7750. * @return results of bus communication function
  7751. * @retval 0 -> Success
  7752. * @retval -1 -> Error
  7753. *
  7754. *
  7755. */
  7756. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_low_g_durn(
  7757. u8 *v_low_durn_u8);
  7758. /*!
  7759. * @brief This API is used to write the low_g duration from register
  7760. * 0x5A bit 0 to 7
  7761. *
  7762. *
  7763. *
  7764. *
  7765. * @param v_low_g_durn_u8 : The value of low_g duration
  7766. *
  7767. * @note Low_g duration trigger trigger delay according to
  7768. * "(v_low_g_durn_u8 * 2.5)ms" in a range from 2.5ms to 640ms.
  7769. * the default corresponds delay is 20ms
  7770. * @note When low_g data source of interrupt is unfiltered
  7771. * the sensor must not be in low power mode
  7772. *
  7773. * @return results of bus communication function
  7774. * @retval 0 -> Success
  7775. * @retval -1 -> Error
  7776. *
  7777. *
  7778. */
  7779. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_low_g_durn(
  7780. u8 v_low_durn_u8);
  7781. /***************************************************************/
  7782. /**\name FUNCTION FOR LOW_G THRESH CONFIGURATION */
  7783. /***************************************************************/
  7784. /*!
  7785. * @brief This API is used to read Threshold
  7786. * definition for the low-g interrupt from the register 0x5B bit 0 to 7
  7787. *
  7788. *
  7789. *
  7790. *
  7791. * @param v_low_g_thres_u8 : The value of low_g threshold
  7792. *
  7793. * @note Low_g interrupt trigger threshold according to
  7794. * (v_low_g_thres_u8 * 7.81)mg for v_low_g_thres_u8 > 0
  7795. * 3.91 mg for v_low_g_thres_u8 = 0
  7796. * The threshold range is from 3.91mg to 2.000mg
  7797. *
  7798. *
  7799. * @return results of bus communication function
  7800. * @retval 0 -> Success
  7801. * @retval -1 -> Error
  7802. *
  7803. *
  7804. */
  7805. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_low_g_thres(
  7806. u8 *v_low_g_thres_u8);
  7807. /*!
  7808. * @brief This API is used to write Threshold
  7809. * definition for the low-g interrupt from the register 0x5B bit 0 to 7
  7810. *
  7811. *
  7812. *
  7813. *
  7814. * @param v_low_g_thres_u8 : The value of low_g threshold
  7815. *
  7816. * @note Low_g interrupt trigger threshold according to
  7817. * (v_low_g_thres_u8 * 7.81)mg for v_low_g_thres_u8 > 0
  7818. * 3.91 mg for v_low_g_thres_u8 = 0
  7819. * The threshold range is from 3.91mg to 2.000mg
  7820. *
  7821. *
  7822. * @return results of bus communication function
  7823. * @retval 0 -> Success
  7824. * @retval -1 -> Error
  7825. *
  7826. *
  7827. */
  7828. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_low_g_thres(
  7829. u8 v_low_g_thres_u8);
  7830. /***************************************************************/
  7831. /**\name FUNCTION FOR LOW_G HYSTERESIS CONFIGURATION */
  7832. /***************************************************************/
  7833. /*!
  7834. * @brief This API reads Low-g interrupt hysteresis
  7835. * from the register 0x5C bit 0 to 1
  7836. *
  7837. * @param v_low_hyst_u8 :The value of low_g hysteresis
  7838. *
  7839. * @note Low_g hysteresis calculated by v_low_hyst_u8*125 mg
  7840. *
  7841. * @return results of bus communication function
  7842. * @retval 0 -> Success
  7843. * @retval -1 -> Error
  7844. *
  7845. *
  7846. */
  7847. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_low_g_hyst(
  7848. u8 *v_low_hyst_u8);
  7849. /*!
  7850. * @brief This API writes Low-g interrupt hysteresis
  7851. * from the register 0x5C bit 0 to 1
  7852. *
  7853. * @param v_low_hyst_u8 :The value of low_g hysteresis
  7854. *
  7855. * @note Low_g hysteresis calculated by v_low_hyst_u8*125 mg
  7856. *
  7857. * @return results of bus communication function
  7858. * @retval 0 -> Success
  7859. * @retval -1 -> Error
  7860. *
  7861. *
  7862. */
  7863. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_low_g_hyst(
  7864. u8 v_low_hyst_u8);
  7865. /***************************************************************/
  7866. /**\name FUNCTION FOR LOW_G MODE CONFIGURATION */
  7867. /***************************************************************/
  7868. /*!
  7869. * @brief This API reads Low-g interrupt mode
  7870. * from the register 0x5C bit 2
  7871. *
  7872. * @param v_low_g_mode_u8 : The value of low_g mode
  7873. * Value | Description
  7874. * ----------|-----------------
  7875. * 0 | single-axis
  7876. * 1 | axis-summing
  7877. *
  7878. *
  7879. * @return results of bus communication function
  7880. * @retval 0 -> Success
  7881. * @retval -1 -> Error
  7882. *
  7883. *
  7884. */
  7885. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_low_g_mode(
  7886. u8 *v_low_g_mode_u8);
  7887. /*!
  7888. * @brief This API writes Low-g interrupt mode
  7889. * from the register 0x5C bit 2
  7890. *
  7891. * @param v_low_g_mode_u8 : The value of low_g mode
  7892. * Value | Description
  7893. * ----------|-----------------
  7894. * 0 | single-axis
  7895. * 1 | axis-summing
  7896. *
  7897. *
  7898. * @return results of bus communication function
  7899. * @retval 0 -> Success
  7900. * @retval -1 -> Error
  7901. *
  7902. *
  7903. */
  7904. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_low_g_mode(
  7905. u8 v_low_g_mode_u8);
  7906. /***************************************************************/
  7907. /**\name FUNCTION FOR HIGH_G HYST CONFIGURATION */
  7908. /***************************************************************/
  7909. /*!
  7910. * @brief This API reads High-g interrupt hysteresis
  7911. * from the register 0x5C bit 6 and 7
  7912. *
  7913. * @param v_high_g_hyst_u8 : The value of high hysteresis
  7914. *
  7915. * @note High_g hysteresis changes according to Accel g range
  7916. * accel g range can be set by the function "bmi160_set_accel_range"
  7917. * accel_range | high_g hysteresis
  7918. * ----------------|---------------------
  7919. * 2g | high_hy*125 mg
  7920. * 4g | high_hy*250 mg
  7921. * 8g | high_hy*500 mg
  7922. * 16g | high_hy*1000 mg
  7923. *
  7924. * @return results of bus communication function
  7925. * @retval 0 -> Success
  7926. * @retval -1 -> Error
  7927. *
  7928. *
  7929. */
  7930. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_high_g_hyst(
  7931. u8 *v_high_g_hyst_u8);
  7932. /*!
  7933. * @brief This API writes High-g interrupt hysteresis
  7934. * from the register 0x5C bit 6 and 7
  7935. *
  7936. * @param v_high_g_hyst_u8 : The value of high hysteresis
  7937. *
  7938. * @note High_g hysteresis changes according to Accel g range
  7939. * accel g range can be set by the function "bmi160_set_accel_range"
  7940. * accel_range | high_g hysteresis
  7941. * ----------------|---------------------
  7942. * 2g | high_hy*125 mg
  7943. * 4g | high_hy*250 mg
  7944. * 8g | high_hy*500 mg
  7945. * 16g | high_hy*1000 mg
  7946. *
  7947. * @return results of bus communication function
  7948. * @retval 0 -> Success
  7949. * @retval -1 -> Error
  7950. *
  7951. *
  7952. */
  7953. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_high_g_hyst(
  7954. u8 v_high_g_hyst_u8);
  7955. /***************************************************************/
  7956. /**\name FUNCTION FOR HIGH_G DURATION CONFIGURATION */
  7957. /***************************************************************/
  7958. /*!
  7959. * @brief This API is used to read Delay
  7960. * time definition for the high-g interrupt from the register
  7961. * 0x5D bit 0 to 7
  7962. *
  7963. *
  7964. *
  7965. * @param v_high_g_durn_u8 : The value of high duration
  7966. *
  7967. * @note High_g interrupt delay triggered according to
  7968. * v_high_g_durn_u8 * 2.5ms in a range from 2.5ms to 640ms
  7969. *
  7970. * @return results of bus communication function
  7971. * @retval 0 -> Success
  7972. * @retval -1 -> Error
  7973. *
  7974. *
  7975. */
  7976. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_high_g_durn(
  7977. u8 *v_high_g_durn_u8);
  7978. /*!
  7979. * @brief This API is used to write Delay
  7980. * time definition for the high-g interrupt from the register
  7981. * 0x5D bit 0 to 7
  7982. *
  7983. *
  7984. *
  7985. * @param v_high_g_durn_u8 : The value of high duration
  7986. *
  7987. * @note High_g interrupt delay triggered according to
  7988. * v_high_g_durn_u8 * 2.5ms in a range from 2.5ms to 640ms
  7989. *
  7990. * @return results of bus communication function
  7991. * @retval 0 -> Success
  7992. * @retval -1 -> Error
  7993. *
  7994. *
  7995. */
  7996. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_high_g_durn(
  7997. u8 v_high_g_durn_u8);
  7998. /***************************************************************/
  7999. /**\name FUNCTION FOR HIGH_G THRESHOLD CONFIGURATION */
  8000. /***************************************************************/
  8001. /*!
  8002. * @brief This API is used to read Threshold
  8003. * definition for the high-g interrupt from the register 0x5E 0 to 7
  8004. *
  8005. *
  8006. *
  8007. *
  8008. * @param v_high_g_thres_u8 : Pointer holding the value of Threshold
  8009. * @note High_g threshold changes according to Accel g range
  8010. * accel g range can be set by the function "bmi160_set_accel_range"
  8011. * accel_range | high_g threshold
  8012. * ----------------|---------------------
  8013. * 2g | v_high_g_thres_u8*7.81 mg
  8014. * 4g | v_high_g_thres_u8*15.63 mg
  8015. * 8g | v_high_g_thres_u8*31.25 mg
  8016. * 16g | v_high_g_thres_u8*62.5 mg
  8017. * @note when v_high_g_thres_u8 = 0
  8018. * accel_range | high_g threshold
  8019. * ----------------|---------------------
  8020. * 2g | 3.91 mg
  8021. * 4g | 7.81 mg
  8022. * 8g | 15.63 mg
  8023. * 16g | 31.25 mg
  8024. *
  8025. *
  8026. * @return results of bus communication function
  8027. * @retval 0 -> Success
  8028. * @retval -1 -> Error
  8029. *
  8030. *
  8031. */
  8032. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_high_g_thres(
  8033. u8 *v_high_g_thres_u8);
  8034. /*!
  8035. * @brief This API is used to write Threshold
  8036. * definition for the high-g interrupt from the register 0x5E 0 to 7
  8037. *
  8038. *
  8039. *
  8040. *
  8041. * @param v_high_g_thres_u8 : Pointer holding the value of Threshold
  8042. * @note High_g threshold changes according to Accel g range
  8043. * accel g range can be set by the function "bmi160_set_accel_range"
  8044. * accel_range | high_g threshold
  8045. * ----------------|---------------------
  8046. * 2g | v_high_g_thres_u8*7.81 mg
  8047. * 4g | v_high_g_thres_u8*15.63 mg
  8048. * 8g | v_high_g_thres_u8*31.25 mg
  8049. * 16g | v_high_g_thres_u8*62.5 mg
  8050. * @note when v_high_g_thres_u8 = 0
  8051. * accel_range | high_g threshold
  8052. * ----------------|---------------------
  8053. * 2g | 3.91 mg
  8054. * 4g | 7.81 mg
  8055. * 8g | 15.63 mg
  8056. * 16g | 31.25 mg
  8057. *
  8058. *
  8059. * @return results of bus communication function
  8060. * @retval 0 -> Success
  8061. * @retval -1 -> Error
  8062. *
  8063. *
  8064. */
  8065. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_high_g_thres(
  8066. u8 v_high_g_thres_u8);
  8067. /***************************************************************/
  8068. /**\name FUNCTION FOR ANY MOTION DURATION CONFIGURATION */
  8069. /***************************************************************/
  8070. /*!
  8071. * @brief This API reads any motion duration
  8072. * from the register 0x5F bit 0 and 1
  8073. *
  8074. * @param v_any_motion_durn_u8 : The value of any motion duration
  8075. *
  8076. * @note Any motion duration can be calculated by "v_any_motion_durn_u8 + 1"
  8077. *
  8078. * @return results of bus communication function
  8079. * @retval 0 -> Success
  8080. * @retval -1 -> Error
  8081. *
  8082. *
  8083. */
  8084. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_any_motion_durn(
  8085. u8 *v_any_motion_durn_u8);
  8086. /*!
  8087. * @brief This API writes any motion duration
  8088. * from the register 0x5F bit 0 and 1
  8089. *
  8090. * @param v_any_motion_durn_u8 : The value of any motion duration
  8091. *
  8092. * @note Any motion duration can be calculated by "v_any_motion_durn_u8 + 1"
  8093. *
  8094. * @return results of bus communication function
  8095. * @retval 0 -> Success
  8096. * @retval -1 -> Error
  8097. *
  8098. *
  8099. */
  8100. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_any_motion_durn(
  8101. u8 nomotion);
  8102. /***************************************************************/
  8103. /**\name FUNCTION FOR SLOW NO MOTION DURATION CONFIGURATION */
  8104. /***************************************************************/
  8105. /*!
  8106. * @brief This API reads Slow/no-motion
  8107. * interrupt trigger delay duration from the register 0x5F bit 2 to 7
  8108. *
  8109. * @param v_slow_no_motion_u8 :The value of slow no motion duration
  8110. *
  8111. *
  8112. *
  8113. * @return results of bus communication function
  8114. * @retval 0 -> Success
  8115. * @retval -1 -> Error
  8116. *
  8117. * @note
  8118. * @note v_slow_no_motion_u8(5:4)=0b00 ->
  8119. * [v_slow_no_motion_u8(3:0) + 1] * 1.28s (1.28s-20.48s)
  8120. * @note v_slow_no_motion_u8(5:4)=1 ->
  8121. * [v_slow_no_motion_u8(3:0)+5] * 5.12s (25.6s-102.4s)
  8122. * @note v_slow_no_motion_u8(5)='1' ->
  8123. * [(v_slow_no_motion_u8:0)+11] * 10.24s (112.64s-430.08s);
  8124. *
  8125. */
  8126. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_slow_no_motion_durn(
  8127. u8 *v_slow_no_motion_u8);
  8128. /*!
  8129. * @brief This API writes Slow/no-motion
  8130. * interrupt trigger delay duration from the register 0x5F bit 2 to 7
  8131. *
  8132. * @param v_slow_no_motion_u8 :The value of slow no motion duration
  8133. *
  8134. *
  8135. *
  8136. * @return results of bus communication function
  8137. * @retval 0 -> Success
  8138. * @retval -1 -> Error
  8139. *
  8140. * @note
  8141. * @note v_slow_no_motion_u8(5:4)=0b00 ->
  8142. * [v_slow_no_motion_u8(3:0) + 1] * 1.28s (1.28s-20.48s)
  8143. * @note v_slow_no_motion_u8(5:4)=1 ->
  8144. * [v_slow_no_motion_u8(3:0)+5] * 5.12s (25.6s-102.4s)
  8145. * @note v_slow_no_motion_u8(5)='1' ->
  8146. * [(v_slow_no_motion_u8:0)+11] * 10.24s (112.64s-430.08s);
  8147. *
  8148. */
  8149. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_slow_no_motion_durn(
  8150. u8 v_slow_no_motion_u8);
  8151. /***************************************************************/
  8152. /**\name FUNCTION FOR ANY MOTION THRESHOLD CONFIGURATION */
  8153. /***************************************************************/
  8154. /*!
  8155. * @brief This API is used to read threshold
  8156. * definition for the any-motion interrupt
  8157. * from the register 0x60 bit 0 to 7
  8158. *
  8159. *
  8160. * @param v_any_motion_thres_u8 : The value of any motion threshold
  8161. *
  8162. * @note any motion threshold changes according to Accel g range
  8163. * accel g range can be set by the function "bmi160_set_accel_range"
  8164. * accel_range | any motion threshold
  8165. * ----------------|---------------------
  8166. * 2g | v_any_motion_thres_u8*3.91 mg
  8167. * 4g | v_any_motion_thres_u8*7.81 mg
  8168. * 8g | v_any_motion_thres_u8*15.63 mg
  8169. * 16g | v_any_motion_thres_u8*31.25 mg
  8170. * @note when v_any_motion_thres_u8 = 0
  8171. * accel_range | any motion threshold
  8172. * ----------------|---------------------
  8173. * 2g | 1.95 mg
  8174. * 4g | 3.91 mg
  8175. * 8g | 7.81 mg
  8176. * 16g | 15.63 mg
  8177. *
  8178. *
  8179. * @return results of bus communication function
  8180. * @retval 0 -> Success
  8181. * @retval -1 -> Error
  8182. *
  8183. *
  8184. */
  8185. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_any_motion_thres(
  8186. u8 *v_any_motion_thres_u8);
  8187. /*!
  8188. * @brief This API is used to write threshold
  8189. * definition for any-motion interrupt
  8190. * from the register 0x60 bit 0 to 7
  8191. *
  8192. *
  8193. * @param v_any_motion_thres_u8 : The value of any motion threshold
  8194. *
  8195. * @note any motion threshold changes according to Accel g range
  8196. * accel g range can be set by the function "bmi160_set_accel_range"
  8197. * accel_range | any motion threshold
  8198. * ----------------|---------------------
  8199. * 2g | v_any_motion_thres_u8*3.91 mg
  8200. * 4g | v_any_motion_thres_u8*7.81 mg
  8201. * 8g | v_any_motion_thres_u8*15.63 mg
  8202. * 16g | v_any_motion_thres_u8*31.25 mg
  8203. * @note when v_any_motion_thres_u8 = 0
  8204. * accel_range | any motion threshold
  8205. * ----------------|---------------------
  8206. * 2g | 1.95 mg
  8207. * 4g | 3.91 mg
  8208. * 8g | 7.81 mg
  8209. * 16g | 15.63 mg
  8210. *
  8211. *
  8212. * @return results of bus communication function
  8213. * @retval 0 -> Success
  8214. * @retval -1 -> Error
  8215. *
  8216. *
  8217. */
  8218. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_any_motion_thres(
  8219. u8 v_any_motion_thres_u8);
  8220. /***************************************************************/
  8221. /**\name FUNCTION FOR SLOW/NO MOTION THRESHOLD CONFIGURATION */
  8222. /***************************************************************/
  8223. /*!
  8224. * @brief This API is used to read threshold
  8225. * for the slow/no-motion interrupt
  8226. * from the register 0x61 bit 0 to 7
  8227. *
  8228. *
  8229. *
  8230. *
  8231. * @param v_slow_no_motion_thres_u8 : The value of slow no motion threshold
  8232. * @note slow no motion threshold changes according to Accel g range
  8233. * accel g range can be set by the function "bmi160_set_accel_range"
  8234. * accel_range | slow no motion threshold
  8235. * ----------------|---------------------
  8236. * 2g | v_slow_no_motion_thres_u8*3.91 mg
  8237. * 4g | v_slow_no_motion_thres_u8*7.81 mg
  8238. * 8g | v_slow_no_motion_thres_u8*15.63 mg
  8239. * 16g | v_slow_no_motion_thres_u8*31.25 mg
  8240. * @note when v_slow_no_motion_thres_u8 = 0
  8241. * accel_range | slow no motion threshold
  8242. * ----------------|---------------------
  8243. * 2g | 1.95 mg
  8244. * 4g | 3.91 mg
  8245. * 8g | 7.81 mg
  8246. * 16g | 15.63 mg
  8247. *
  8248. *
  8249. * @return results of bus communication function
  8250. * @retval 0 -> Success
  8251. * @retval -1 -> Error
  8252. *
  8253. *
  8254. */
  8255. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_slow_no_motion_thres(
  8256. u8 *v_slow_no_motion_thres_u8);
  8257. /*!
  8258. * @brief This API is used to write threshold
  8259. * for the slow/no-motion interrupt
  8260. * in the register 0x61 bit 0 to 7
  8261. *
  8262. *
  8263. *
  8264. *
  8265. * @param v_slow_no_motion_thres_u8 : The value of slow no motion threshold
  8266. * @note slow no motion threshold changes according to Accel g range
  8267. * accel g range can be set by the function "bmi160_set_accel_range"
  8268. * accel_range | slow no motion threshold
  8269. * ----------------|---------------------
  8270. * 2g | v_slow_no_motion_thres_u8*3.91 mg
  8271. * 4g | v_slow_no_motion_thres_u8*7.81 mg
  8272. * 8g | v_slow_no_motion_thres_u8*15.63 mg
  8273. * 16g | v_slow_no_motion_thres_u8*31.25 mg
  8274. * @note when v_slow_no_motion_thres_u8 = 0
  8275. * accel_range | slow no motion threshold
  8276. * ----------------|---------------------
  8277. * 2g | 1.95 mg
  8278. * 4g | 3.91 mg
  8279. * 8g | 7.81 mg
  8280. * 16g | 15.63 mg
  8281. *
  8282. *
  8283. * @return results of bus communication function
  8284. * @retval 0 -> Success
  8285. * @retval -1 -> Error
  8286. *
  8287. *
  8288. */
  8289. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_slow_no_motion_thres(
  8290. u8 v_slow_no_motion_thres_u8);
  8291. /***************************************************************/
  8292. /**\name FUNCTION FOR SLOW/NO MOTION SELECT CONFIGURATION */
  8293. /***************************************************************/
  8294. /*!
  8295. * @brief This API is used to read
  8296. * the slow/no-motion selection from the register 0x62 bit 0
  8297. *
  8298. *
  8299. *
  8300. *
  8301. * @param v_intr_slow_no_motion_select_u8 :
  8302. * The value of slow/no-motion select
  8303. * value | Behaviour
  8304. * ----------|-------------------
  8305. * 0x00 | SLOW_MOTION
  8306. * 0x01 | NO_MOTION
  8307. *
  8308. *
  8309. * @return results of bus communication function
  8310. * @retval 0 -> Success
  8311. * @retval -1 -> Error
  8312. *
  8313. *
  8314. */
  8315. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_slow_no_motion_select(
  8316. u8 *v_intr_slow_no_motion_select_u8);
  8317. /*!
  8318. * @brief This API is used to write
  8319. * the slow/no-motion selection from the register 0x62 bit 0
  8320. *
  8321. *
  8322. *
  8323. *
  8324. * @param v_intr_slow_no_motion_select_u8 :
  8325. * The value of slow/no-motion select
  8326. * value | Behaviour
  8327. * ----------|-------------------
  8328. * 0x00 | SLOW_MOTION
  8329. * 0x01 | NO_MOTION
  8330. *
  8331. *
  8332. * @return results of bus communication function
  8333. * @retval 0 -> Success
  8334. * @retval -1 -> Error
  8335. *
  8336. *
  8337. */
  8338. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_slow_no_motion_select(
  8339. u8 v_intr_slow_no_motion_select_u8);
  8340. /***************************************************************/
  8341. /**\name FUNCTION FOR SIGNIFICANT MOTION SELECT CONFIGURATION*/
  8342. /***************************************************************/
  8343. /*!
  8344. * @brief This API is used to select
  8345. * the significant or any motion interrupt from the register 0x62 bit 1
  8346. *
  8347. *
  8348. *
  8349. *
  8350. * @param v_intr_significant_motion_select_u8 :
  8351. * the value of significant or any motion interrupt selection
  8352. * value | Behaviour
  8353. * ----------|-------------------
  8354. * 0x00 | ANY_MOTION
  8355. * 0x01 | SIGNIFICANT_MOTION
  8356. *
  8357. *
  8358. * @return results of bus communication function
  8359. * @retval 0 -> Success
  8360. * @retval -1 -> Error
  8361. *
  8362. *
  8363. */
  8364. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_significant_motion_select(
  8365. u8 *int_sig_mot_sel);
  8366. /*!
  8367. * @brief This API is used to write, select
  8368. * the significant or any motion interrupt from the register 0x62 bit 1
  8369. *
  8370. *
  8371. *
  8372. *
  8373. * @param v_intr_significant_motion_select_u8 :
  8374. * the value of significant or any motion interrupt selection
  8375. * value | Behaviour
  8376. * ----------|-------------------
  8377. * 0x00 | ANY_MOTION
  8378. * 0x01 | SIGNIFICANT_MOTION
  8379. *
  8380. *
  8381. * @return results of bus communication function
  8382. * @retval 0 -> Success
  8383. * @retval -1 -> Error
  8384. *
  8385. *
  8386. */
  8387. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_significant_motion_select(
  8388. u8 int_sig_mot_sel);
  8389. /*!
  8390. * @brief This API is used to unmap the signification motion
  8391. * interrupt
  8392. *
  8393. *
  8394. * @param v_significant_u8 : The value of interrupt selection
  8395. *
  8396. * BMI160_MAP_INTR1 0
  8397. * BMI160_MAP_INTR2 1
  8398. *
  8399. * \return results of communication routine
  8400. *
  8401. *
  8402. */
  8403. BMI160_RETURN_FUNCTION_TYPE bmi160_unmap_significant_motion_intr(
  8404. u8 v_significant_u8);
  8405. /*!
  8406. * @brief This API is used to read
  8407. * the significant skip time from the register 0x62 bit 2 and 3
  8408. *
  8409. *
  8410. *
  8411. *
  8412. * @param v_int_sig_mot_skip_u8 : the value of significant skip time
  8413. * value | Behaviour
  8414. * ----------|-------------------
  8415. * 0x00 | skip time 1.5 seconds
  8416. * 0x01 | skip time 3 seconds
  8417. * 0x02 | skip time 6 seconds
  8418. * 0x03 | skip time 12 seconds
  8419. *
  8420. *
  8421. * @return results of bus communication function
  8422. * @retval 0 -> Success
  8423. * @retval -1 -> Error
  8424. *
  8425. *
  8426. */
  8427. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_significant_motion_skip(
  8428. u8 *v_int_sig_mot_skip_u8);
  8429. /*!
  8430. * @brief This API is used to write
  8431. * the significant skip time in the register 0x62 bit 2 and 3
  8432. *
  8433. *
  8434. *
  8435. *
  8436. * @param v_int_sig_mot_skip_u8 : the value of significant skip time
  8437. * value | Behaviour
  8438. * ----------|-------------------
  8439. * 0x00 | skip time 1.5 seconds
  8440. * 0x01 | skip time 3 seconds
  8441. * 0x02 | skip time 6 seconds
  8442. * 0x03 | skip time 12 seconds
  8443. *
  8444. *
  8445. * @return results of bus communication function
  8446. * @retval 0 -> Success
  8447. * @retval -1 -> Error
  8448. *
  8449. *
  8450. */
  8451. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_significant_motion_skip(
  8452. u8 v_int_sig_mot_skip_u8);
  8453. /*!
  8454. * @brief This API is used to read
  8455. * the significant proof time from the register 0x62 bit 4 and 5
  8456. *
  8457. *
  8458. *
  8459. *
  8460. * @param v_significant_motion_proof_u8 :
  8461. * the value of significant proof time
  8462. * value | Behaviour
  8463. * ----------|-------------------
  8464. * 0x00 | proof time 0.25 seconds
  8465. * 0x01 | proof time 0.5 seconds
  8466. * 0x02 | proof time 1 seconds
  8467. * 0x03 | proof time 2 seconds
  8468. *
  8469. *
  8470. * @return results of bus communication function
  8471. * @retval 0 -> Success
  8472. * @retval -1 -> Error
  8473. *
  8474. *
  8475. */
  8476. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_significant_motion_proof(
  8477. u8 *int_sig_mot_proof);
  8478. /*!
  8479. * @brief This API is used to write
  8480. * the significant proof time in the register 0x62 bit 4 and 5
  8481. *
  8482. *
  8483. *
  8484. *
  8485. * @param v_significant_motion_proof_u8 :
  8486. * the value of significant proof time
  8487. * value | Behaviour
  8488. * ----------|-------------------
  8489. * 0x00 | proof time 0.25 seconds
  8490. * 0x01 | proof time 0.5 seconds
  8491. * 0x02 | proof time 1 seconds
  8492. * 0x03 | proof time 2 seconds
  8493. *
  8494. *
  8495. * @return results of bus communication function
  8496. * @retval 0 -> Success
  8497. * @retval -1 -> Error
  8498. *
  8499. *
  8500. */
  8501. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_significant_motion_proof(
  8502. u8 int_sig_mot_proof);
  8503. /***************************************************************/
  8504. /**\name FUNCTION FOR TAP DURATION CONFIGURATION*/
  8505. /***************************************************************/
  8506. /*!
  8507. * @brief This API is used to get the tap duration
  8508. * from the register 0x63 bit 0 to 2
  8509. *
  8510. *
  8511. *
  8512. * @param v_tap_durn_u8 : The value of tap duration
  8513. * value | Behaviour
  8514. * ----------|-------------------
  8515. * 0x00 | BMI160_TAP_DURN_50MS
  8516. * 0x01 | BMI160_TAP_DURN_100MS
  8517. * 0x02 | BMI160_TAP_DURN_150MS
  8518. * 0x03 | BMI160_TAP_DURN_200MS
  8519. * 0x04 | BMI160_TAP_DURN_250MS
  8520. * 0x05 | BMI160_TAP_DURN_375MS
  8521. * 0x06 | BMI160_TAP_DURN_500MS
  8522. * 0x07 | BMI160_TAP_DURN_700MS
  8523. *
  8524. *
  8525. *
  8526. * @return results of bus communication function
  8527. * @retval 0 -> Success
  8528. * @retval -1 -> Error
  8529. *
  8530. *
  8531. */
  8532. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_tap_durn(
  8533. u8 *v_tap_durn_u8);
  8534. /*!
  8535. * @brief This API is used to write the tap duration
  8536. * in the register 0x63 bit 0 to 2
  8537. *
  8538. *
  8539. *
  8540. * @param v_tap_durn_u8 : The value of tap duration
  8541. * value | Behaviour
  8542. * ----------|-------------------
  8543. * 0x00 | BMI160_TAP_DURN_50MS
  8544. * 0x01 | BMI160_TAP_DURN_100MS
  8545. * 0x02 | BMI160_TAP_DURN_150MS
  8546. * 0x03 | BMI160_TAP_DURN_200MS
  8547. * 0x04 | BMI160_TAP_DURN_250MS
  8548. * 0x05 | BMI160_TAP_DURN_375MS
  8549. * 0x06 | BMI160_TAP_DURN_500MS
  8550. * 0x07 | BMI160_TAP_DURN_700MS
  8551. *
  8552. *
  8553. *
  8554. * @return results of bus communication function
  8555. * @retval 0 -> Success
  8556. * @retval -1 -> Error
  8557. *
  8558. *
  8559. */
  8560. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_tap_durn(
  8561. u8 v_tap_durn_u8);
  8562. /***************************************************************/
  8563. /**\name FUNCTION FOR TAP SHOCK CONFIGURATION*/
  8564. /***************************************************************/
  8565. /*!
  8566. * @brief This API reads the
  8567. * tap shock duration from the register 0x63 bit 2
  8568. *
  8569. * @param v_tap_shock_u8 :The value of tap shock
  8570. * value | Behaviour
  8571. * ----------|-------------------
  8572. * 0x00 | BMI160_TAP_SHOCK_50MS
  8573. * 0x01 | BMI160_TAP_SHOCK_75MS
  8574. *
  8575. *
  8576. * @return results of bus communication function
  8577. * @retval 0 -> Success
  8578. * @retval -1 -> Error
  8579. *
  8580. *
  8581. */
  8582. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_tap_shock(
  8583. u8 *v_tap_shock_u8);
  8584. /*!
  8585. * @brief This API writes the
  8586. * tap shock duration from the register 0x63 bit 2
  8587. *
  8588. * @param v_tap_shock_u8 :The value of tap shock
  8589. * value | Behaviour
  8590. * ----------|-------------------
  8591. * 0x00 | BMI160_TAP_SHOCK_50MS
  8592. * 0x01 | BMI160_TAP_SHOCK_75MS
  8593. *
  8594. *
  8595. * @return results of bus communication function
  8596. * @retval 0 -> Success
  8597. * @retval -1 -> Error
  8598. *
  8599. *
  8600. */
  8601. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_tap_shock(
  8602. u8 v_tap_shock_u8);
  8603. /***************************************************************/
  8604. /**\name FUNCTION FOR TAP QUIET CONFIGURATION*/
  8605. /***************************************************************/
  8606. /*!
  8607. * @brief This API reads
  8608. * tap quiet duration from the register 0x63 bit 7
  8609. *
  8610. *
  8611. * @param v_tap_quiet_u8 : The value of tap quiet
  8612. * value | Behaviour
  8613. * ----------|-------------------
  8614. * 0x00 | BMI160_TAP_QUIET_30MS
  8615. * 0x01 | BMI160_TAP_QUIET_20MS
  8616. *
  8617. *
  8618. * @return results of bus communication function
  8619. * @retval 0 -> Success
  8620. * @retval -1 -> Error
  8621. *
  8622. *
  8623. */
  8624. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_tap_quiet(
  8625. u8 *v_tap_quiet_u8);
  8626. /*!
  8627. * @brief This API writes
  8628. * tap quiet duration in the register 0x63 bit 7
  8629. *
  8630. *
  8631. * @param v_tap_quiet_u8 : The value of tap quiet
  8632. * value | Behaviour
  8633. * ----------|-------------------
  8634. * 0x00 | BMI160_TAP_QUIET_30MS
  8635. * 0x01 | BMI160_TAP_QUIET_20MS
  8636. *
  8637. *
  8638. * @return results of bus communication function
  8639. * @retval 0 -> Success
  8640. * @retval -1 -> Error
  8641. *
  8642. *
  8643. */
  8644. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_tap_quiet(
  8645. u8 v_tap_quiet_u8);
  8646. /***************************************************************/
  8647. /**\name FUNCTION FOR TAP THRESHOLD CONFIGURATION*/
  8648. /***************************************************************/
  8649. /*!
  8650. * @brief This API reads the threshold of the
  8651. * single/double tap interrupt from the register 0x64 bit 0 to 4
  8652. *
  8653. *
  8654. * @param v_tap_thres_u8 : The value of single/double tap threshold
  8655. *
  8656. * @note single/double tap threshold changes according to Accel g range
  8657. * accel g range can be set by the function "bmi160_set_accel_range"
  8658. * accel_range | single/double tap threshold
  8659. * ----------------|---------------------
  8660. * 2g | ((v_tap_thres_u8 + 1) * 62.5)mg
  8661. * 4g | ((v_tap_thres_u8 + 1) * 125)mg
  8662. * 8g | ((v_tap_thres_u8 + 1) * 250)mg
  8663. * 16g | ((v_tap_thres_u8 + 1) * 500)mg
  8664. *
  8665. * @return results of bus communication function
  8666. * @retval 0 -> Success
  8667. * @retval -1 -> Error
  8668. *
  8669. *
  8670. */
  8671. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_tap_thres(
  8672. u8 *v_tap_thres_u8);
  8673. /*!
  8674. * @brief This API writes the threshold of the
  8675. * single/double tap interrupt in the register 0x64 bit 0 to 4
  8676. *
  8677. *
  8678. * @param v_tap_thres_u8 : The value of single/double tap threshold
  8679. *
  8680. * @note single/double tap threshold changes according to Accel g range
  8681. * accel g range can be set by the function "bmi160_set_accel_range"
  8682. * accel_range | single/double tap threshold
  8683. * ----------------|---------------------
  8684. * 2g | ((v_tap_thres_u8 + 1) * 62.5)mg
  8685. * 4g | ((v_tap_thres_u8 + 1) * 125)mg
  8686. * 8g | ((v_tap_thres_u8 + 1) * 250)mg
  8687. * 16g | ((v_tap_thres_u8 + 1) * 500)mg
  8688. *
  8689. * @return results of bus communication function
  8690. * @retval 0 -> Success
  8691. * @retval -1 -> Error
  8692. *
  8693. *
  8694. */
  8695. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_tap_thres(
  8696. u8 v_tap_thres_u8);
  8697. /***************************************************************/
  8698. /**\name FUNCTION FOR ORIENT MODE CONFIGURATION*/
  8699. /***************************************************************/
  8700. /*!
  8701. * @brief This API reads the threshold for orientation interrupt
  8702. * from the register 0x65 bit 0 and 1
  8703. *
  8704. * @param v_orient_mode_u8 : The value of threshold for orientation
  8705. * value | Behaviour
  8706. * ----------|-------------------
  8707. * 0x00 | symmetrical
  8708. * 0x01 | high-asymmetrical
  8709. * 0x02 | low-asymmetrical
  8710. * 0x03 | symmetrical
  8711. *
  8712. *
  8713. *
  8714. * @return results of bus communication function
  8715. * @retval 0 -> Success
  8716. * @retval -1 -> Error
  8717. *
  8718. *
  8719. */
  8720. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_orient_mode(
  8721. u8 *v_orient_mode_u8);
  8722. /*!
  8723. * @brief This API writes the threshold for orientation interrupt
  8724. * from the register 0x65 bit 0 and 1
  8725. *
  8726. * @param v_orient_mode_u8 : The value of threshold for orientation
  8727. * value | Behaviour
  8728. * ----------|-------------------
  8729. * 0x00 | symmetrical
  8730. * 0x01 | high-asymmetrical
  8731. * 0x02 | low-asymmetrical
  8732. * 0x03 | symmetrical
  8733. *
  8734. *
  8735. *
  8736. * @return results of bus communication function
  8737. * @retval 0 -> Success
  8738. * @retval -1 -> Error
  8739. *
  8740. *
  8741. */
  8742. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_orient_mode(
  8743. u8 v_orient_mode_u8);
  8744. /***************************************************************/
  8745. /**\name FUNCTION FOR ORIENT BLOCKING CONFIGURATION*/
  8746. /***************************************************************/
  8747. /*!
  8748. * @brief This API reads the orientation blocking mode
  8749. * that is used for the generation of the orientation interrupt.
  8750. * from the register 0x65 bit 2 and 3
  8751. *
  8752. * @param v_orient_blocking_u8 : The value of orient blocking mode
  8753. * value | Behaviour
  8754. * ----------|-------------------
  8755. * 0x00 | No blocking
  8756. * 0x01 | Theta blocking or acceleration in any axis > 1.5g
  8757. * 0x02 | Theta blocking or acceleration slope in any axis >
  8758. * - | 0.2g or acceleration in any axis > 1.5g
  8759. * 0x03 | Theta blocking or acceleration slope in any axis >
  8760. * - | 0.4g or acceleration in any axis >
  8761. * - | 1.5g and value of orient is not stable
  8762. * - | for at least 100 ms
  8763. *
  8764. *
  8765. *
  8766. * @return results of bus communication function
  8767. * @retval 0 -> Success
  8768. * @retval -1 -> Error
  8769. *
  8770. *
  8771. */
  8772. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_orient_blocking(
  8773. u8 *v_orient_blocking_u8);
  8774. /*!
  8775. * @brief This API writes the orientation blocking mode
  8776. * that is used for the generation of the orientation interrupt.
  8777. * in the register 0x65 bit 2 and 3
  8778. *
  8779. * @param v_orient_blocking_u8 : The value of orient blocking mode
  8780. * value | Behaviour
  8781. * ----------|-------------------
  8782. * 0x00 | No blocking
  8783. * 0x01 | Theta blocking or acceleration in any axis > 1.5g
  8784. * 0x02 | Theta blocking or acceleration slope in any axis >
  8785. * - | 0.2g or acceleration in any axis > 1.5g
  8786. * 0x03 | Theta blocking or acceleration slope in any axis >
  8787. * - | 0.4g or acceleration in any axis >
  8788. * - | 1.5g and value of orient is not stable
  8789. * - | for at least 100 ms
  8790. *
  8791. *
  8792. *
  8793. * @return results of bus communication function
  8794. * @retval 0 -> Success
  8795. * @retval -1 -> Error
  8796. *
  8797. *
  8798. */
  8799. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_orient_blocking(
  8800. u8 v_orient_blocking_u8);
  8801. /***************************************************************/
  8802. /**\name FUNCTION FOR ORIENT HYSTERESIS CONFIGURATION*/
  8803. /***************************************************************/
  8804. /*!
  8805. * @brief This API reads the orientation interrupt
  8806. * hysteresis, from the register 0x64 bit 4 to 7
  8807. *
  8808. *
  8809. *
  8810. * @param v_orient_hyst_u8 : The value of orient hysteresis
  8811. *
  8812. * @note 1 LSB corresponds to 62.5 mg,
  8813. * irrespective of the selected Accel range
  8814. *
  8815. *
  8816. * @return results of bus communication function
  8817. * @retval 0 -> Success
  8818. * @retval -1 -> Error
  8819. *
  8820. *
  8821. */
  8822. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_orient_hyst(
  8823. u8 *v_orient_hyst_u8);
  8824. /*!
  8825. * @brief This API writes the orientation interrupt
  8826. * hysteresis, in the register 0x64 bit 4 to 7
  8827. *
  8828. *
  8829. *
  8830. * @param v_orient_hyst_u8 : The value of orient hysteresis
  8831. *
  8832. * @note 1 LSB corresponds to 62.5 mg,
  8833. * irrespective of the selected Accel range
  8834. *
  8835. *
  8836. * @return results of bus communication function
  8837. * @retval 0 -> Success
  8838. * @retval -1 -> Error
  8839. *
  8840. *
  8841. */
  8842. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_orient_hyst(
  8843. u8 v_orient_hyst_u8);
  8844. /***************************************************************/
  8845. /**\name FUNCTION FOR ORIENT THETA CONFIGURATION*/
  8846. /***************************************************************/
  8847. /*!
  8848. * @brief This API reads the orientation
  8849. * blocking angle (0 to 44.8) from the register 0x66 bit 0 to 5
  8850. *
  8851. * @param v_orient_theta_u8 : The value of Orient blocking angle
  8852. *
  8853. *
  8854. *
  8855. * @return results of bus communication function
  8856. * @retval 0 -> Success
  8857. * @retval -1 -> Error
  8858. *
  8859. *
  8860. */
  8861. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_orient_theta(
  8862. u8 *v_orient_theta_u8);
  8863. /*!
  8864. * @brief This API writes orientation
  8865. * blocking angle (0 to 44.8) in the register 0x66 bit 0 to 5
  8866. *
  8867. * @param v_orient_theta_u8 : The value of Orient blocking angle
  8868. *
  8869. *
  8870. *
  8871. * @return results of bus communication function
  8872. * @retval 0 -> Success
  8873. * @retval -1 -> Error
  8874. *
  8875. *
  8876. */
  8877. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_orient_theta(
  8878. u8 v_orient_theta_u8);
  8879. /***************************************************************/
  8880. /**\name FUNCTION FOR ORIENT OUTPUT ENABLE CONFIGURATION*/
  8881. /***************************************************************/
  8882. /*!
  8883. * @brief This API reads the orientation change
  8884. * of up/down bit from the register 0x66 bit 6
  8885. *
  8886. * @param v_orient_ud_u8 : The value of orient change of up/down
  8887. * value | Behaviour
  8888. * ----------|-------------------
  8889. * 0x00 | Is ignored
  8890. * 0x01 | Generates orientation interrupt
  8891. *
  8892. *
  8893. * @return results of bus communication function
  8894. * @retval 0 -> Success
  8895. * @retval -1 -> Error
  8896. *
  8897. *
  8898. */
  8899. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_orient_ud_enable(
  8900. u8 *v_orient_ud_u8);
  8901. /*!
  8902. * @brief This API writes orientation change
  8903. * of up/down bit in the register 0x66 bit 6
  8904. *
  8905. * @param v_orient_ud_u8 : The value of orient change of up/down
  8906. * value | Behaviour
  8907. * ----------|-------------------
  8908. * 0x00 | Is ignored
  8909. * 0x01 | Generates orientation interrupt
  8910. *
  8911. *
  8912. * @return results of bus communication function
  8913. * @retval 0 -> Success
  8914. * @retval -1 -> Error
  8915. *
  8916. *
  8917. */
  8918. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_orient_ud_enable(
  8919. u8 v_orient_ud_u8);
  8920. /***************************************************************/
  8921. /**\name FUNCTION FOR ORIENT AXIS ENABLE CONFIGURATION*/
  8922. /***************************************************************/
  8923. /*!
  8924. * @brief This API reads orientation axes changes
  8925. * from the register 0x66 bit 7
  8926. *
  8927. * @param v_orient_axes_u8 : The value of orient axes assignment
  8928. * value | Behaviour | Name
  8929. * ----------|--------------------|------
  8930. * 0x00 | x = x, y = y, z = z|orient_ax_noex
  8931. * 0x01 | x = y, y = z, z = x|orient_ax_ex
  8932. *
  8933. *
  8934. * @return results of bus communication function
  8935. * @retval 0 -> Success
  8936. * @retval -1 -> Error
  8937. *
  8938. *
  8939. */
  8940. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_orient_axes_enable(
  8941. u8 *v_orient_axes_u8);
  8942. /*!
  8943. * @brief This API writes orientation axes changes
  8944. * in the register 0x66 bit 7
  8945. *
  8946. * @param v_orient_axes_u8 : The value of orient axes assignment
  8947. * value | Behaviour | Name
  8948. * ----------|--------------------|------
  8949. * 0x00 | x = x, y = y, z = z|orient_ax_noex
  8950. * 0x01 | x = y, y = z, z = x|orient_ax_ex
  8951. *
  8952. *
  8953. * @return results of bus communication function
  8954. * @retval 0 -> Success
  8955. * @retval -1 -> Error
  8956. *
  8957. *
  8958. */
  8959. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_orient_axes_enable(
  8960. u8 v_orient_axes_u8);
  8961. /***************************************************************/
  8962. /**\name FUNCTION FOR FLAT THETA CONFIGURATION*/
  8963. /***************************************************************/
  8964. /*!
  8965. * @brief This API reads Flat angle (0 to 44.8) for flat interrupt
  8966. * from the register 0x67 bit 0 to 5
  8967. *
  8968. * @param v_flat_theta_u8 : The value of flat angle
  8969. *
  8970. *
  8971. *
  8972. * @return results of bus communication function
  8973. * @retval 0 -> Success
  8974. * @retval -1 -> Error
  8975. *
  8976. *
  8977. */
  8978. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_flat_theta(
  8979. u8 *v_flat_theta_u8);
  8980. /*!
  8981. * @brief This API writes Flat angle (0 to 44.8) for flat interrupt
  8982. * in the register 0x67 bit 0 to 5
  8983. *
  8984. * @param v_flat_theta_u8 : The value of flat angle
  8985. *
  8986. *
  8987. *
  8988. * @return results of bus communication function
  8989. * @retval 0 -> Success
  8990. * @retval -1 -> Error
  8991. *
  8992. *
  8993. */
  8994. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_flat_theta(
  8995. u8 v_flat_theta_u8);
  8996. /***************************************************************/
  8997. /**\name FUNCTION FOR FLAT HOLD CONFIGURATION*/
  8998. /***************************************************************/
  8999. /*!
  9000. * @brief This API reads Flat interrupt hold time;
  9001. * from the register 0x68 bit 4 and 5
  9002. *
  9003. * @param v_flat_hold_u8 : The value of flat hold time
  9004. * value | Behaviour
  9005. * ----------|-------------------
  9006. * 0x00 | 0ms
  9007. * 0x01 | 512ms
  9008. * 0x01 | 1024ms
  9009. * 0x01 | 2048ms
  9010. *
  9011. *
  9012. * @return results of bus communication function
  9013. * @retval 0 -> Success
  9014. * @retval -1 -> Error
  9015. *
  9016. *
  9017. */
  9018. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_flat_hold(
  9019. u8 *v_flat_hold_u8);
  9020. /*!
  9021. * @brief This API writes flat interrupt hold time in
  9022. * the register 0x68 bit 4 and 5
  9023. *
  9024. * @param v_flat_hold_u8 : The value of flat hold time
  9025. * value | Behaviour
  9026. * ----------|-------------------
  9027. * 0x00 | 0ms
  9028. * 0x01 | 512ms
  9029. * 0x01 | 1024ms
  9030. * 0x01 | 2048ms
  9031. *
  9032. *
  9033. * @return results of bus communication function
  9034. * @retval 0 -> Success
  9035. * @retval -1 -> Error
  9036. *
  9037. *
  9038. */
  9039. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_flat_hold(
  9040. u8 v_flat_hold_u8);
  9041. /***************************************************************/
  9042. /**\name FUNCTION FOR FLAT HYSTERESIS CONFIGURATION*/
  9043. /***************************************************************/
  9044. /*!
  9045. * @brief This API reads flat interrupt hysteresis
  9046. * from the register 0x68 bit 0 to 3
  9047. *
  9048. * @param v_flat_hyst_u8 : The value of flat hysteresis
  9049. *
  9050. *
  9051. *
  9052. * @return results of bus communication function
  9053. * @retval 0 -> Success
  9054. * @retval -1 -> Error
  9055. *
  9056. *
  9057. */
  9058. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_flat_hyst(
  9059. u8 *v_flat_hyst_u8);
  9060. /*!
  9061. * @brief This API writes flat interrupt hysteresis
  9062. * in the register 0x68 bit 0 to 3
  9063. *
  9064. * @param v_flat_hyst_u8 : The value of flat hysteresis
  9065. *
  9066. *
  9067. *
  9068. * @return results of bus communication function
  9069. * @retval 0 -> Success
  9070. * @retval -1 -> Error
  9071. *
  9072. *
  9073. */
  9074. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_flat_hyst(
  9075. u8 v_flat_hyst_u8);
  9076. /***************************************************************/
  9077. /**\name FUNCTION FAST OFFSET COMPENSATION FOR ACCEL */
  9078. /***************************************************************/
  9079. /*!
  9080. * @brief This API reads Accel offset compensation
  9081. * target value for z-axis from the register 0x69 bit 0 and 1
  9082. *
  9083. * @param v_foc_accel_z_u8 : the value of Accel offset compensation z axis
  9084. * value | Behaviour
  9085. * ----------|-------------------
  9086. * 0x00 | disable
  9087. * 0x01 | +1g
  9088. * 0x01 | -1g
  9089. * 0x01 | 0g
  9090. *
  9091. * @return results of bus communication function
  9092. * @retval 0 -> Success
  9093. * @retval -1 -> Error
  9094. *
  9095. *
  9096. */
  9097. BMI160_RETURN_FUNCTION_TYPE bmi160_get_foc_accel_z(
  9098. u8 *v_foc_accel_z_u8);
  9099. /*!
  9100. * @brief This API writes Accel offset compensation
  9101. * target value for z-axis in the register 0x69 bit 0 and 1
  9102. *
  9103. * @param v_foc_accel_z_u8 : the value of Accel offset compensation z axis
  9104. * value | Behaviour
  9105. * ----------|-------------------
  9106. * 0x00 | disable
  9107. * 0x01 | +1g
  9108. * 0x01 | -1g
  9109. * 0x01 | 0g
  9110. *
  9111. * @return results of bus communication function
  9112. * @retval 0 -> Success
  9113. * @retval -1 -> Error
  9114. *
  9115. *
  9116. */
  9117. BMI160_RETURN_FUNCTION_TYPE bmi160_set_foc_accel_z(
  9118. u8 v_foc_accel_z_u8);
  9119. /*!
  9120. * @brief This API reads Accel offset compensation
  9121. * target value for y-axis
  9122. * from the register 0x69 bit 2 and 3
  9123. *
  9124. * @param v_foc_accel_y_u8 : the value of Accel offset compensation y axis
  9125. * value | Behaviour
  9126. * ----------|-------------------
  9127. * 0x00 | disable
  9128. * 0x01 | +1g
  9129. * 0x01 | -1g
  9130. * 0x01 | 0g
  9131. *
  9132. *
  9133. *
  9134. * @return results of bus communication function
  9135. * @retval 0 -> Success
  9136. * @retval -1 -> Error
  9137. *
  9138. *
  9139. */
  9140. BMI160_RETURN_FUNCTION_TYPE bmi160_get_foc_accel_y(
  9141. u8 *v_foc_accel_y_u8);
  9142. /*!
  9143. * @brief This API writes Accel offset compensation
  9144. * target value for y-axis in the register 0x69 bit 2 and 3
  9145. *
  9146. * @param v_foc_accel_y_u8 : the value of Accel offset compensation y axis
  9147. * value | Behaviour
  9148. * ----------|-------------------
  9149. * 0x00 | disable
  9150. * 0x01 | +1g
  9151. * 0x02 | -1g
  9152. * 0x03 | 0g
  9153. *
  9154. *
  9155. *
  9156. * @return results of bus communication function
  9157. * @retval 0 -> Success
  9158. * @retval -1 -> Error
  9159. *
  9160. *
  9161. */
  9162. BMI160_RETURN_FUNCTION_TYPE bmi160_set_foc_accel_y(
  9163. u8 v_foc_accel_y_u8);
  9164. /*!
  9165. * @brief This API reads Accel offset compensation
  9166. * target value for x-axis from the register 0x69 bit 4 and 5
  9167. *
  9168. * @param v_foc_accel_x_u8 : the value of Accel offset compensation x axis
  9169. * value | Behaviour
  9170. * ----------|-------------------
  9171. * 0x00 | disable
  9172. * 0x01 | +1g
  9173. * 0x02 | -1g
  9174. * 0x03 | 0g
  9175. *
  9176. *
  9177. *
  9178. * @return results of bus communication function
  9179. * @retval 0 -> Success
  9180. * @retval -1 -> Error
  9181. *
  9182. *
  9183. */
  9184. BMI160_RETURN_FUNCTION_TYPE bmi160_get_foc_accel_x(
  9185. u8 *v_foc_accel_x_u8);
  9186. /*!
  9187. * @brief This API writes Accel offset compensation
  9188. * target value for x-axis in the register 0x69 bit 4 and 5
  9189. *
  9190. * @param v_foc_accel_x_u8 : the value of Accel offset compensation x axis
  9191. * value | Behaviour
  9192. * ----------|-------------------
  9193. * 0x00 | disable
  9194. * 0x01 | +1g
  9195. * 0x01 | -1g
  9196. * 0x01 | 0g
  9197. *
  9198. *
  9199. *
  9200. * @return results of bus communication function
  9201. * @retval 0 -> Success
  9202. * @retval -1 -> Error
  9203. *
  9204. *
  9205. */
  9206. BMI160_RETURN_FUNCTION_TYPE bmi160_set_foc_accel_x(
  9207. u8 v_foc_accel_x_u8);
  9208. /***************************************************************/
  9209. /**\name FUNCTION FAST OFFSET COMPENSATION FOR GYRO */
  9210. /***************************************************************/
  9211. /*!
  9212. * @brief This API writes the Gyro fast offset enable
  9213. * from the register 0x69 bit 6
  9214. *
  9215. * @param v_foc_gyro_u8 : The value of Gyro fast offset enable
  9216. * value | Description
  9217. * ----------|-------------
  9218. * 0 | fast offset compensation disabled
  9219. * 1 | fast offset compensation enabled
  9220. *
  9221. * @param v_gyro_off_x_s16 : The value of Gyro fast offset x axis data
  9222. * @param v_gyro_off_y_s16 : The value of Gyro fast offset y axis data
  9223. * @param v_gyro_off_z_s16 : The value of Gyro fast offset z axis data
  9224. *
  9225. * @return results of bus communication function
  9226. * @retval 0 -> Success
  9227. * @retval -1 -> Error
  9228. *
  9229. *
  9230. */
  9231. BMI160_RETURN_FUNCTION_TYPE bmi160_set_foc_gyro_enable(
  9232. u8 v_foc_gyro_u8, s16 *v_gyro_off_x_s16,
  9233. s16 *v_gyro_off_y_s16, s16 *v_gyro_off_z_s16);
  9234. /***************************************************/
  9235. /**\name FUNCTION FOR SPI MODE*/
  9236. /***************************************************/
  9237. /*!
  9238. * @brief This API reads SPI
  9239. * Interface Mode for primary and OIS interface
  9240. * from the register 0x6B bit 0
  9241. *
  9242. * @param v_spi3_u8 : The value of SPI mode selection
  9243. * Value | Description
  9244. * --------|-------------
  9245. * 0 | SPI 4-wire mode
  9246. * 1 | SPI 3-wire mode
  9247. *
  9248. *
  9249. * @return results of bus communication function
  9250. * @retval 0 -> Success
  9251. * @retval -1 -> Error
  9252. *
  9253. *
  9254. */
  9255. BMI160_RETURN_FUNCTION_TYPE bmi160_get_spi3(
  9256. u8 *v_spi3_u8);
  9257. /*!
  9258. * @brief This API configures SPI
  9259. * Interface Mode for primary and OIS interface
  9260. * in the register 0x6B bit 0
  9261. *
  9262. * @param v_spi3_u8 : The value of SPI mode selection
  9263. * Value | Description
  9264. * --------|-------------
  9265. * 0 | SPI 4-wire mode
  9266. * 1 | SPI 3-wire mode
  9267. *
  9268. *
  9269. * @return results of bus communication function
  9270. * @retval 0 -> Success
  9271. * @retval -1 -> Error
  9272. *
  9273. *
  9274. */
  9275. BMI160_RETURN_FUNCTION_TYPE bmi160_set_spi3(
  9276. u8 v_spi3_u8);
  9277. /***************************************************/
  9278. /**\name FUNCTION FOR FOC GYRO */
  9279. /***************************************************/
  9280. /*!
  9281. * @brief This API reads the Gyro fast offset enable
  9282. * from the register 0x69 bit 6
  9283. *
  9284. * @param v_foc_gyro_u8 : The value of Gyro fast offset enable
  9285. * value | Description
  9286. * ----------|-------------
  9287. * 0 | fast offset compensation disabled
  9288. * 1 | fast offset compensation enabled
  9289. *
  9290. *
  9291. *
  9292. * @return results of bus communication function
  9293. * @retval 0 -> Success
  9294. * @retval -1 -> Error
  9295. *
  9296. *
  9297. */
  9298. BMI160_RETURN_FUNCTION_TYPE bmi160_get_foc_gyro_enable(
  9299. u8 *v_foc_gyro_u8);
  9300. /***************************************************/
  9301. /**\name FUNCTION FOR I2C WATCHDOG TIMBER */
  9302. /***************************************************/
  9303. /*!
  9304. * @brief This API reads I2C Watchdog timer
  9305. * from the register 0x70 bit 1
  9306. *
  9307. * @param v_i2c_wdt_u8 : The value of I2C watch dog timer
  9308. * Value | Description
  9309. * --------|-------------
  9310. * 0 | I2C watchdog v_timeout_u8 after 1 ms
  9311. * 1 | I2C watchdog v_timeout_u8 after 50 ms
  9312. *
  9313. *
  9314. * @return results of bus communication function
  9315. * @retval 0 -> Success
  9316. * @retval -1 -> Error
  9317. *
  9318. *
  9319. */
  9320. BMI160_RETURN_FUNCTION_TYPE bmi160_get_i2c_wdt_select(
  9321. u8 *v_i2c_wdt_u8);
  9322. /*!
  9323. * @brief This API writes the I2C Watchdog timer
  9324. * in the register 0x70 bit 1
  9325. *
  9326. * @param v_i2c_wdt_u8 : The value of I2C watch dog timer
  9327. * Value | Description
  9328. * --------|-------------
  9329. * 0 | I2C watchdog v_timeout_u8 after 1 ms
  9330. * 1 | I2C watchdog v_timeout_u8 after 50 ms
  9331. *
  9332. *
  9333. * @return results of bus communication function
  9334. * @retval 0 -> Success
  9335. * @retval -1 -> Error
  9336. *
  9337. *
  9338. */
  9339. BMI160_RETURN_FUNCTION_TYPE
  9340. bmi160_set_i2c_wdt_select(u8 v_i2c_wdt_u8);
  9341. /*!
  9342. * @brief This API reads the status of I2C watchdog enable
  9343. * from the register 0x70 bit 2
  9344. *
  9345. * @param v_i2c_wdt_u8 : The value of I2C watchdog enable
  9346. * Value | Description
  9347. * --------|-------------
  9348. * 0 | DISABLE
  9349. * 1 | ENABLE
  9350. *
  9351. * @return results of bus communication function
  9352. * @retval 0 -> Success
  9353. * @retval -1 -> Error
  9354. *
  9355. *
  9356. */
  9357. BMI160_RETURN_FUNCTION_TYPE bmi160_get_i2c_wdt_enable(
  9358. u8 *v_i2c_wdt_u8);
  9359. /*!
  9360. * @brief This API enables the I2C watchdog
  9361. * in the register 0x70 bit 2
  9362. *
  9363. * @param v_i2c_wdt_u8 : The value of I2C watchdog enable
  9364. * Value | Description
  9365. * --------|-------------
  9366. * 0 | DISABLE
  9367. * 1 | ENABLE
  9368. *
  9369. * @return results of bus communication function
  9370. * @retval 0 -> Success
  9371. * @retval -1 -> Error
  9372. *
  9373. *
  9374. */
  9375. BMI160_RETURN_FUNCTION_TYPE bmi160_set_i2c_wdt_enable(
  9376. u8 v_i2c_wdt_u8);
  9377. /***************************************************/
  9378. /**\name FUNCTION FOR IF MODE*/
  9379. /***************************************************/
  9380. /*!
  9381. * @brief This API reads the I2C interface configuration(if) mode
  9382. * from the register 0x6B bit 4 and 5
  9383. *
  9384. * @param v_if_mode_u8 : The value of interface configuration mode
  9385. * Value | Description
  9386. * --------|-------------
  9387. * 0x00 | Primary interface:autoconfig / secondary interface:off
  9388. * 0x01 | Primary interface:I2C / secondary interface:OIS
  9389. * 0x02 | Primary interface:autoconfig/secondary interface:Magnetometer
  9390. * 0x03 | Reserved
  9391. *
  9392. *
  9393. * @return results of bus communication function
  9394. * @retval 0 -> Success
  9395. * @retval -1 -> Error
  9396. *
  9397. *
  9398. */
  9399. BMI160_RETURN_FUNCTION_TYPE bmi160_get_if_mode(
  9400. u8 *v_if_mode_u8);
  9401. /*!
  9402. * @brief This API writes the I2C interface configuration(if) mode
  9403. * in the register 0x6B bit 4 and 5
  9404. *
  9405. * @param v_if_mode_u8 : The value of interface configuration mode
  9406. * Value | Description
  9407. * --------|-------------
  9408. * 0x00 | Primary interface:autoconfig / secondary interface:off
  9409. * 0x01 | Primary interface:I2C / secondary interface:OIS
  9410. * 0x02 | Primary interface:autoconfig/secondary interface:Magnetometer
  9411. * 0x03 | Reserved
  9412. *
  9413. *
  9414. * @return results of bus communication function
  9415. * @retval 0 -> Success
  9416. * @retval -1 -> Error
  9417. *
  9418. *
  9419. */
  9420. BMI160_RETURN_FUNCTION_TYPE bmi160_set_if_mode(
  9421. u8 v_if_mode_u8);
  9422. /***************************************************/
  9423. /**\name FUNCTION FOR GYRO SLEEP TRIGGER INTERRUPT CONFIGURATION*/
  9424. /***************************************************/
  9425. /*!
  9426. * @brief This API reads the Gyro sleep trigger
  9427. * from the register 0x6C bit 0 to 2
  9428. *
  9429. * @param v_gyro_sleep_trigger_u8 : The value of Gyro sleep trigger
  9430. * Value | Description
  9431. * --------|-------------
  9432. * 0x00 | nomotion: no / Not INT1 pin: no / INT2 pin: no
  9433. * 0x01 | nomotion: no / Not INT1 pin: no / INT2 pin: yes
  9434. * 0x02 | nomotion: no / Not INT1 pin: yes / INT2 pin: no
  9435. * 0x03 | nomotion: no / Not INT1 pin: yes / INT2 pin: yes
  9436. * 0x04 | nomotion: yes / Not INT1 pin: no / INT2 pin: no
  9437. * 0x05 | anymotion: yes / Not INT1 pin: no / INT2 pin: yes
  9438. * 0x06 | anymotion: yes / Not INT1 pin: yes / INT2 pin: no
  9439. * 0x07 | anymotion: yes / Not INT1 pin: yes / INT2 pin: yes
  9440. *
  9441. *
  9442. *
  9443. * @return results of bus communication function
  9444. * @retval 0 -> Success
  9445. * @retval -1 -> Error
  9446. *
  9447. *
  9448. */
  9449. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_sleep_trigger(
  9450. u8 *v_gyro_sleep_trigger_u8);
  9451. /*!
  9452. * @brief This API writes the Gyro sleep trigger
  9453. * in the register 0x6C bit 0 to 2
  9454. *
  9455. * @param v_gyro_sleep_trigger_u8 : The value of Gyro sleep trigger
  9456. * Value | Description
  9457. * --------|-------------
  9458. * 0x00 | nomotion: no / Not INT1 pin: no / INT2 pin: no
  9459. * 0x01 | nomotion: no / Not INT1 pin: no / INT2 pin: yes
  9460. * 0x02 | nomotion: no / Not INT1 pin: yes / INT2 pin: no
  9461. * 0x03 | nomotion: no / Not INT1 pin: yes / INT2 pin: yes
  9462. * 0x04 | nomotion: yes / Not INT1 pin: no / INT2 pin: no
  9463. * 0x05 | anymotion: yes / Not INT1 pin: no / INT2 pin: yes
  9464. * 0x06 | anymotion: yes / Not INT1 pin: yes / INT2 pin: no
  9465. * 0x07 | anymotion: yes / Not INT1 pin: yes / INT2 pin: yes
  9466. *
  9467. *
  9468. *
  9469. * @return results of bus communication function
  9470. * @retval 0 -> Success
  9471. * @retval -1 -> Error
  9472. *
  9473. *
  9474. */
  9475. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_sleep_trigger(
  9476. u8 v_gyro_sleep_trigger_u8);
  9477. /*!
  9478. * @brief This API reads Gyro wakeup trigger
  9479. * from the register 0x6C bit 3 and 4
  9480. *
  9481. * @param v_gyro_wakeup_trigger_u8 : The value of Gyro wakeup trigger
  9482. * Value | Description
  9483. * --------|-------------
  9484. * 0x00 | anymotion: no / INT1 pin: no
  9485. * 0x01 | anymotion: no / INT1 pin: yes
  9486. * 0x02 | anymotion: yes / INT1 pin: no
  9487. * 0x03 | anymotion: yes / INT1 pin: yes
  9488. *
  9489. *
  9490. * @return results of bus communication function
  9491. * @retval 0 -> Success
  9492. * @retval -1 -> Error
  9493. *
  9494. *
  9495. */
  9496. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_wakeup_trigger(
  9497. u8 *v_gyro_wakeup_trigger_u8);
  9498. /*!
  9499. * @brief This API writes Gyro wakeup trigger
  9500. * in the register 0x6C bit 3 and 4
  9501. *
  9502. * @param v_gyro_wakeup_trigger_u8 : The value of Gyro wakeup trigger
  9503. * Value | Description
  9504. * --------|-------------
  9505. * 0x00 | anymotion: no / INT1 pin: no
  9506. * 0x01 | anymotion: no / INT1 pin: yes
  9507. * 0x02 | anymotion: yes / INT1 pin: no
  9508. * 0x03 | anymotion: yes / INT1 pin: yes
  9509. *
  9510. *
  9511. * @return results of bus communication function
  9512. * @retval 0 -> Success
  9513. * @retval -1 -> Error
  9514. *
  9515. *
  9516. */
  9517. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_wakeup_trigger(
  9518. u8 v_gyro_wakeup_trigger_u8);
  9519. /*!
  9520. * @brief This API reads target state for Gyro sleep mode
  9521. * from the register 0x6C bit 5
  9522. *
  9523. * @param v_gyro_sleep_state_u8 : The value of Gyro sleep mode
  9524. * Value | Description
  9525. * --------|-------------
  9526. * 0x00 | Sleep transition to fast wake up state
  9527. * 0x01 | Sleep transition to suspend state
  9528. *
  9529. *
  9530. * @return results of bus communication function
  9531. * @retval 0 -> Success
  9532. * @retval -1 -> Error
  9533. *
  9534. *
  9535. */
  9536. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_sleep_state(
  9537. u8 *v_gyro_sleep_state_u8);
  9538. /*!
  9539. * @brief This API writes target state for Gyro sleep mode
  9540. * in the register 0x6C bit 5
  9541. *
  9542. * @param v_gyro_sleep_state_u8 : The value of Gyro sleep mode
  9543. * Value | Description
  9544. * --------|-------------
  9545. * 0x00 | Sleep transition to fast wake up state
  9546. * 0x01 | Sleep transition to suspend state
  9547. *
  9548. *
  9549. * @return results of bus communication function
  9550. * @retval 0 -> Success
  9551. * @retval -1 -> Error
  9552. *
  9553. *
  9554. */
  9555. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_sleep_state(
  9556. u8 v_gyro_sleep_state_u8);
  9557. /*!
  9558. * @brief This API reads Gyro wakeup interrupt
  9559. * from the register 0x6C bit 6
  9560. *
  9561. * @param v_gyro_wakeup_intr_u8 : The value of Gyro wakeup interrupt
  9562. * Value | Description
  9563. * --------|-------------
  9564. * 0x00 | DISABLE
  9565. * 0x01 | ENABLE
  9566. *
  9567. *
  9568. * @return results of bus communication function
  9569. * @retval 0 -> Success
  9570. * @retval -1 -> Error
  9571. *
  9572. *
  9573. */
  9574. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_wakeup_intr(
  9575. u8 *v_gyro_wakeup_intr_u8);
  9576. /*!
  9577. * @brief This API writes Gyro wakeup interrupt
  9578. * in the register 0x6C bit 6
  9579. *
  9580. * @param v_gyro_wakeup_intr_u8 : The value of Gyro wakeup interrupt
  9581. * Value | Description
  9582. * --------|-------------
  9583. * 0x00 | DISABLE
  9584. * 0x01 | ENABLE
  9585. *
  9586. *
  9587. * @return results of bus communication function
  9588. * @retval 0 -> Success
  9589. * @retval -1 -> Error
  9590. *
  9591. *
  9592. */
  9593. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_wakeup_intr(
  9594. u8 v_gyro_wakeup_intr_u8);
  9595. /***************************************************/
  9596. /**\name FUNCTION FOR ACCEL SELF TEST */
  9597. /***************************************************/
  9598. /*!
  9599. * @brief This API reads Accel selftest axis selected for self-test
  9600. * functionality.
  9601. *
  9602. * @param v_accel_selftest_axis_u8 :
  9603. * The value of Accel self test axis selection
  9604. * Value | Description
  9605. * --------|-------------
  9606. * 0x00 | disabled
  9607. * 0x01 | x-axis
  9608. * 0x02 | y-axis
  9609. * 0x03 | z-axis
  9610. *
  9611. *
  9612. * @return results of bus communication function
  9613. * @retval 0 -> Success
  9614. * @retval -1 -> Error
  9615. *
  9616. *
  9617. */
  9618. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_selftest_axis(
  9619. u8 *acc_selftest_axis);
  9620. /*!
  9621. * @brief This API writes Accel self test axis for self-test
  9622. * functionality.
  9623. *
  9624. * @param v_accel_selftest_axis_u8 :
  9625. * The value of Accel self test axis selection
  9626. * Value | Description
  9627. * --------|-------------
  9628. * 0x00 | disabled
  9629. * 0x01 | x-axis
  9630. * 0x02 | y-axis
  9631. * 0x03 | z-axis
  9632. *
  9633. *
  9634. * @return results of bus communication function
  9635. * @retval 0 -> Success
  9636. * @retval -1 -> Error
  9637. *
  9638. *
  9639. */
  9640. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_selftest_axis(
  9641. u8 acc_selftest_axis);
  9642. /*!
  9643. * @brief This API reads Accel self test axis sign
  9644. * from the register 0x6D bit 2
  9645. *
  9646. * @param v_accel_selftest_sign_u8: The value of Accel self test axis sign
  9647. * Value | Description
  9648. * --------|-------------
  9649. * 0x00 | negative
  9650. * 0x01 | positive
  9651. *
  9652. *
  9653. * @return results of bus communication function
  9654. * @retval 0 -> Success
  9655. * @retval -1 -> Error
  9656. *
  9657. *
  9658. */
  9659. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_selftest_sign(
  9660. u8 *acc_selftest_sign);
  9661. /*!
  9662. * @brief This API writes Accel self test axis sign
  9663. * in the register 0x6D bit 2
  9664. *
  9665. * @param v_accel_selftest_sign_u8: The value of Accel self test axis sign
  9666. * Value | Description
  9667. * --------|-------------
  9668. * 0x00 | negative
  9669. * 0x01 | positive
  9670. *
  9671. *
  9672. * @return results of bus communication function
  9673. * @retval 0 -> Success
  9674. * @retval -1 -> Error
  9675. *
  9676. *
  9677. */
  9678. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_selftest_sign(
  9679. u8 acc_selftest_sign);
  9680. /*!
  9681. * @brief This API reads Accel self test amplitude
  9682. * from the register 0x6D bit 3
  9683. *
  9684. *
  9685. * @param v_accel_selftest_amp_u8 : The value of Accel self test amplitude
  9686. * Value | Description
  9687. * --------|-------------
  9688. * 0x00 | LOW
  9689. * 0x01 | HIGH
  9690. *
  9691. *
  9692. * @return results of bus communication function
  9693. * @retval 0 -> Success
  9694. * @retval -1 -> Error
  9695. *
  9696. *
  9697. */
  9698. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_selftest_amp(
  9699. u8 *acc_selftest_amp);
  9700. /*!
  9701. * @brief This API writes Accel self test amplitude
  9702. * in the register 0x6D bit 3
  9703. *
  9704. *
  9705. * @param v_accel_selftest_amp_u8 : The value of Accel self test amplitude
  9706. * Value | Description
  9707. * --------|-------------
  9708. * 0x00 | LOW
  9709. * 0x01 | HIGH
  9710. *
  9711. *
  9712. * @return results of bus communication function
  9713. * @retval 0 -> Success
  9714. * @retval -1 -> Error
  9715. *
  9716. *
  9717. */
  9718. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_selftest_amp(
  9719. u8 acc_selftest_amp);
  9720. /***************************************************/
  9721. /**\name FUNCTION FOR GYRO SELF TEST */
  9722. /***************************************************/
  9723. /*!
  9724. * @brief This API reads the Gyro self test trigger
  9725. *
  9726. * @param v_gyro_selftest_start_u8: The value of Gyro self test start
  9727. *
  9728. * @return results of bus communication function
  9729. * @retval 0 -> Success
  9730. * @retval -1 -> Error
  9731. *
  9732. *
  9733. */
  9734. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_selftest_start(
  9735. u8 *v_gyro_selftest_start_u8);
  9736. /*!
  9737. * @brief This API writes the Gyro self test trigger
  9738. *
  9739. * @param v_gyro_selftest_start_u8: The value of Gyro self test start
  9740. *
  9741. * @return results of bus communication function
  9742. * @retval 0 -> Success
  9743. * @retval -1 -> Error
  9744. *
  9745. *
  9746. */
  9747. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_selftest_start(
  9748. u8 v_gyro_selftest_start_u8);
  9749. /***************************************************/
  9750. /**\name FUNCTION FOR SPI/I2C ENABLE */
  9751. /***************************************************/
  9752. /*!
  9753. * @brief This API reads the primary interface selection I2C or SPI
  9754. * from the register 0x70 bit 0
  9755. *
  9756. * @param v_spi_enable_u8: The value of Interface selection
  9757. * Value | Description
  9758. * --------|-------------
  9759. * 0x00 | I2C Enable
  9760. * 0x01 | I2C DISABLE
  9761. *
  9762. *
  9763. * @return results of bus communication function
  9764. * @retval 0 -> Success
  9765. * @retval -1 -> Error
  9766. *
  9767. *
  9768. */
  9769. BMI160_RETURN_FUNCTION_TYPE bmi160_get_spi_enable(
  9770. u8 *v_spi_enable_u8);
  9771. /*!
  9772. * @brief This API writes primary interface selection I2C or SPI
  9773. * in the register 0x70 bit 0
  9774. *
  9775. * @param v_spi_enable_u8: The value of Interface selection
  9776. * Value | Description
  9777. * --------|-------------
  9778. * 0x00 | I2C Enable
  9779. * 0x01 | I2C DISABLE
  9780. *
  9781. *
  9782. * @return results of bus communication function
  9783. * @retval 0 -> Success
  9784. * @retval -1 -> Error
  9785. *
  9786. *
  9787. */
  9788. BMI160_RETURN_FUNCTION_TYPE bmi160_set_spi_enable(
  9789. u8 v_spi_enable_u8);
  9790. /***************************************************/
  9791. /**\name FUNCTION FOR ACCEL MANUAL OFFSET COMPENSATION */
  9792. /***************************************************/
  9793. /*!
  9794. * @brief This API reads the Accel manual offset compensation of x axis
  9795. * from the register 0x71 bit 0 to 7
  9796. *
  9797. *
  9798. *
  9799. * @param v_accel_off_x_s8:
  9800. * The value of Accel manual offset compensation of x axis
  9801. *
  9802. *
  9803. *
  9804. * @return results of bus communication function
  9805. * @retval 0 -> Success
  9806. * @retval -1 -> Error
  9807. *
  9808. *
  9809. */
  9810. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_offset_compensation_xaxis(
  9811. s8 *v_accel_off_x_s8);
  9812. /*!
  9813. * @brief This API writes the Accel manual offset compensation of x axis
  9814. * in the register 0x71 bit 0 to 7
  9815. *
  9816. *
  9817. *
  9818. * @param v_accel_off_x_s8:
  9819. * The value of Accel manual offset compensation of x axis
  9820. *
  9821. *
  9822. *
  9823. * @return results of bus communication function
  9824. * @retval 0 -> Success
  9825. * @retval -1 -> Error
  9826. *
  9827. *
  9828. */
  9829. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_offset_compensation_xaxis(
  9830. s8 v_accel_off_x_s8);
  9831. /*!
  9832. * @brief This API reads the Accel manual offset compensation of y axis
  9833. * from the register 0x72 bit 0 to 7
  9834. *
  9835. *
  9836. *
  9837. * @param v_accel_off_y_s8:
  9838. * The value of Accel manual offset compensation of y axis
  9839. *
  9840. *
  9841. *
  9842. * @return results of bus communication function
  9843. * @retval 0 -> Success
  9844. * @retval -1 -> Error
  9845. *
  9846. *
  9847. */
  9848. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_offset_compensation_yaxis(
  9849. s8 *v_accel_off_y_s8);
  9850. /*!
  9851. * @brief This API writes the Accel manual offset compensation of y axis
  9852. * in the register 0x72 bit 0 to 7
  9853. *
  9854. *
  9855. *
  9856. * @param v_accel_off_y_s8:
  9857. * The value of Accel manual offset compensation of y axis
  9858. *
  9859. *
  9860. *
  9861. * @return results of bus communication function
  9862. * @retval 0 -> Success
  9863. * @retval -1 -> Error
  9864. *
  9865. *
  9866. */
  9867. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_offset_compensation_yaxis(
  9868. s8 v_accel_off_y_s8);
  9869. /*!
  9870. * @brief This API reads the Accel manual offset compensation of z axis
  9871. * from the register 0x73 bit 0 to 7
  9872. *
  9873. *
  9874. *
  9875. * @param v_accel_off_z_s8:
  9876. * The value of Accel manual offset compensation of z axis
  9877. *
  9878. *
  9879. *
  9880. * @return results of bus communication function
  9881. * @retval 0 -> Success
  9882. * @retval -1 -> Error
  9883. *
  9884. *
  9885. */
  9886. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_offset_compensation_zaxis(
  9887. s8 *v_accel_off_z_s8);
  9888. /*!
  9889. * @brief This API writes the Accel manual offset compensation of z axis
  9890. * in the register 0x73 bit 0 to 7
  9891. *
  9892. *
  9893. *
  9894. * @param v_accel_off_z_s8:
  9895. * The value of Accel manual offset compensation of z axis
  9896. *
  9897. *
  9898. *
  9899. * @return results of bus communication function
  9900. * @retval 0 -> Success
  9901. * @retval -1 -> Error
  9902. *
  9903. *
  9904. */
  9905. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_offset_compensation_zaxis(
  9906. s8 v_accel_off_z_s8);
  9907. /***************************************************/
  9908. /**\name FUNCTION FOR GYRO MANUAL OFFSET COMPENSATION */
  9909. /***************************************************/
  9910. /*!
  9911. * @brief This API reads the Gyro manual offset compensation of x axis
  9912. * from the register 0x74 bit 0 to 7 and 0x77 bit 0 and 1
  9913. *
  9914. *
  9915. *
  9916. * @param v_gyro_off_x_s16:
  9917. * The value of Gyro manual offset compensation of x axis
  9918. *
  9919. *
  9920. *
  9921. * @return results of bus communication function
  9922. * @retval 0 -> Success
  9923. * @retval -1 -> Error
  9924. *
  9925. *
  9926. */
  9927. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_offset_compensation_xaxis(
  9928. s16 *v_gyro_off_x_s16);
  9929. /*!
  9930. * @brief This API writes the Gyro manual offset compensation of x axis
  9931. * in the register 0x74 bit 0 to 7 and 0x77 bit 0 and 1
  9932. *
  9933. *
  9934. *
  9935. * @param v_gyro_off_x_s16:
  9936. * The value of Gyro manual offset compensation of x axis
  9937. *
  9938. *
  9939. *
  9940. * @return results of bus communication function
  9941. * @retval 0 -> Success
  9942. * @retval -1 -> Error
  9943. *
  9944. *
  9945. */
  9946. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_offset_compensation_xaxis(
  9947. s16 v_gyro_off_x_s16);
  9948. /*!
  9949. * @brief This API reads the Gyro manual offset compensation of y axis
  9950. * from the register 0x75 bit 0 to 7 and 0x77 bit 2 and 3
  9951. *
  9952. *
  9953. *
  9954. * @param v_gyro_off_y_s16:
  9955. * The value of Gyro manual offset compensation of y axis
  9956. *
  9957. *
  9958. *
  9959. * @return results of bus communication function
  9960. * @retval 0 -> Success
  9961. * @retval -1 -> Error
  9962. *
  9963. *
  9964. */
  9965. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_offset_compensation_yaxis(
  9966. s16 *v_gyro_off_y_s16);
  9967. /*!
  9968. * @brief This API writes Gyro manual offset compensation of y axis
  9969. * in the register 0x75 bit 0 to 7 and 0x77 bit 2 and 3
  9970. *
  9971. *
  9972. *
  9973. * @param v_gyro_off_y_s16:
  9974. * The value of Gyro manual offset compensation of y axis
  9975. *
  9976. *
  9977. *
  9978. * @return results of bus communication function
  9979. * @retval 0 -> Success
  9980. * @retval -1 -> Error
  9981. *
  9982. *
  9983. */
  9984. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_offset_compensation_yaxis(
  9985. s16 v_gyro_off_y_s16);
  9986. /*!
  9987. * @brief This API reads the Gyro manual offset compensation of z axis
  9988. * from the register 0x76 bit 0 to 7 and 0x77 bit 4 and 5
  9989. *
  9990. *
  9991. *
  9992. * @param v_gyro_off_z_s16:
  9993. * The value of Gyro manual offset compensation of z axis
  9994. *
  9995. *
  9996. *
  9997. * @return results of bus communication function
  9998. * @retval 0 -> Success
  9999. * @retval -1 -> Error
  10000. *
  10001. *
  10002. */
  10003. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_offset_compensation_zaxis(
  10004. s16 *v_gyro_off_z_s16);
  10005. /*!
  10006. * @brief This API writes Gyro manual offset compensation of z axis
  10007. * in the register 0x76 bit 0 to 7 and 0x77 bit 4 and 5
  10008. *
  10009. *
  10010. *
  10011. * @param v_gyro_off_z_s16:
  10012. * The value of Gyro manual offset compensation of z axis
  10013. *
  10014. *
  10015. *
  10016. * @return results of bus communication function
  10017. * @retval 0 -> Success
  10018. * @retval -1 -> Error
  10019. *
  10020. *
  10021. */
  10022. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_offset_compensation_zaxis(
  10023. s16 v_gyro_off_z_s16);
  10024. /*!
  10025. * @brief This API writes Accel fast offset compensation
  10026. * from the register 0x69 bit 0 to 5
  10027. * @brief This API writes each axis individually
  10028. * FOC_X_AXIS - bit 4 and 5
  10029. * FOC_Y_AXIS - bit 2 and 3
  10030. * FOC_Z_AXIS - bit 0 and 1
  10031. *
  10032. * @param v_foc_accel_u8: The value of Accel offset compensation
  10033. * value | Behaviour
  10034. * ----------|-------------------
  10035. * 0x00 | disable
  10036. * 0x01 | +1g
  10037. * 0x01 | -1g
  10038. * 0x01 | 0g
  10039. *
  10040. * @param v_axis_u8: The value of Accel offset axis selection
  10041. * value | axis
  10042. * ----------|-------------------
  10043. * 0 | FOC_X_AXIS
  10044. * 1 | FOC_Y_AXIS
  10045. * 2 | FOC_Z_AXIS
  10046. *
  10047. * @param v_accel_offset_s8: The Accel offset value
  10048. *
  10049. * @return results of bus communication function
  10050. * @retval 0 -> Success
  10051. * @retval -1 -> Error
  10052. *
  10053. *
  10054. */
  10055. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_foc_trigger(u8 axis,
  10056. u8 foc_acc, s8 *accel_offset);
  10057. /*!
  10058. * @brief This API writes fast Accel offset compensation
  10059. * for all axis in the register 0x69 bit 0 to 5
  10060. * FOC_X_AXIS - bit 4 and 5
  10061. * FOC_Y_AXIS - bit 2 and 3
  10062. * FOC_Z_AXIS - bit 0 and 1
  10063. *
  10064. * @param v_foc_accel_x_u8: The value of Accel offset x compensation
  10065. * value | Behaviour
  10066. * ----------|-------------------
  10067. * 0x00 | disable
  10068. * 0x01 | +1g
  10069. * 0x01 | -1g
  10070. * 0x01 | 0g
  10071. *
  10072. * @param v_foc_accel_y_u8: The value of Accel offset y compensation
  10073. * value | Behaviour
  10074. * ----------|-------------------
  10075. * 0x00 | disable
  10076. * 0x01 | +1g
  10077. * 0x01 | -1g
  10078. * 0x01 | 0g
  10079. *
  10080. * @param v_foc_accel_z_u8: The value of Accel offset z compensation
  10081. * value | Behaviour
  10082. * ----------|-------------------
  10083. * 0x00 | disable
  10084. * 0x01 | +1g
  10085. * 0x01 | -1g
  10086. * 0x01 | 0g
  10087. *
  10088. * @param v_accel_off_x_s8: The value of Accel offset x axis
  10089. * @param v_accel_off_y_s8: The value of Accel offset y axis
  10090. * @param v_accel_off_z_s8: The value of Accel offset z axis
  10091. *
  10092. *
  10093. * @return results of bus communication function
  10094. * @retval 0 -> Success
  10095. * @retval -1 -> Error
  10096. *
  10097. */
  10098. BMI160_RETURN_FUNCTION_TYPE bmi160_accel_foc_trigger_xyz(u8 v_foc_accel_x_u8,
  10099. u8 v_foc_accel_y_u8, u8 v_foc_accel_z_u8,
  10100. s8 *acc_off_x, s8 *acc_off_y, s8 *acc_off_z);
  10101. /***************************************************/
  10102. /**\name FUNCTION FOR ACCEL AND GYRO OFFSET ENABLE */
  10103. /***************************************************/
  10104. /*!
  10105. * @brief This API reads the Accel offset enable bit
  10106. * from the register 0x77 bit 6
  10107. *
  10108. *
  10109. *
  10110. * @param v_accel_off_enable_u8: The value of Accel offset enable
  10111. * value | Description
  10112. * ----------|--------------
  10113. * 0x01 | ENABLE
  10114. * 0x00 | DISABLE
  10115. *
  10116. *
  10117. * @return results of bus communication function
  10118. * @retval 0 -> Success
  10119. * @retval -1 -> Error
  10120. *
  10121. *
  10122. */
  10123. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_offset_enable(
  10124. u8 *acc_off_en);
  10125. /*!
  10126. * @brief This API writes the Accel offset enable bit
  10127. * in the register 0x77 bit 6
  10128. *
  10129. *
  10130. *
  10131. * @param v_accel_off_enable_u8: The value of Accel offset enable
  10132. * value | Description
  10133. * ----------|--------------
  10134. * 0x01 | ENABLE
  10135. * 0x00 | DISABLE
  10136. *
  10137. *
  10138. * @return results of bus communication function
  10139. * @retval 0 -> Success
  10140. * @retval -1 -> Error
  10141. *
  10142. *
  10143. */
  10144. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_offset_enable(
  10145. u8 acc_off_en);
  10146. /*!
  10147. * @brief This API reads the Accel offset enable bit
  10148. * from the register 0x77 bit 7
  10149. *
  10150. *
  10151. *
  10152. * @param v_gyro_off_enable_u8: The value of Gyro offset enable
  10153. * value | Description
  10154. * ----------|--------------
  10155. * 0x01 | ENABLE
  10156. * 0x00 | DISABLE
  10157. *
  10158. *
  10159. * @return results of bus communication function
  10160. * @retval 0 -> Success
  10161. * @retval -1 -> Error
  10162. *
  10163. *
  10164. */
  10165. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_offset_enable(
  10166. u8 *v_gyro_off_enable_u8);
  10167. /*!
  10168. * @brief This API writes the gyro offset enable bit
  10169. * in the register 0x77 bit 7
  10170. *
  10171. *
  10172. *
  10173. * @param v_gyro_off_enable_u8: The value of Gyro offset enable
  10174. * value | Description
  10175. * ----------|--------------
  10176. * 0x01 | ENABLE
  10177. * 0x00 | DISABLE
  10178. *
  10179. *
  10180. * @return results of bus communication function
  10181. * @retval 0 -> Success
  10182. * @retval -1 -> Error
  10183. *
  10184. *
  10185. */
  10186. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_offset_enable(
  10187. u8 v_gyro_off_enable_u8);
  10188. /***************************************************/
  10189. /**\name FUNCTION FOR STEP COUNTER INTERRUPT */
  10190. /***************************************************/
  10191. /*!
  10192. * @brief This API reads step counter output value
  10193. * from the register 0x78 and 0x79
  10194. *
  10195. *
  10196. *
  10197. *
  10198. * @param v_step_cnt_s16 : The value of step counter output
  10199. *
  10200. *
  10201. *
  10202. * @return results of bus communication function
  10203. * @retval 0 -> Success
  10204. * @retval -1 -> Error
  10205. *
  10206. *
  10207. */
  10208. BMI160_RETURN_FUNCTION_TYPE bmi160_read_step_count(s16 *v_step_cnt_s16);
  10209. /*!
  10210. * @brief This API reads
  10211. * step counter configuration
  10212. * from the register 0x7A bit 0 to 7
  10213. * and also from the register 0x7B bit 0 to 2 and 4 to 7
  10214. *
  10215. *
  10216. * @param v_step_config_u16 : The value of step counter configuration
  10217. *
  10218. * @return results of bus communication function
  10219. * @retval 0 -> Success
  10220. * @retval -1 -> Error
  10221. *
  10222. *
  10223. */
  10224. BMI160_RETURN_FUNCTION_TYPE bmi160_get_step_config(
  10225. u16 *v_step_config_u16);
  10226. /*!
  10227. * @brief This API writes the
  10228. * step counter configuration
  10229. * in the register 0x7A bit 0 to 7
  10230. * and also in the register 0x7B bit 0 to 2 and 4 to 7
  10231. *
  10232. *
  10233. * @param v_step_config_u16 :
  10234. * the value of step configuration
  10235. *
  10236. * @return results of bus communication function
  10237. * @retval 0 -> Success
  10238. * @retval -1 -> Error
  10239. *
  10240. *
  10241. */
  10242. BMI160_RETURN_FUNCTION_TYPE bmi160_set_step_config(
  10243. u16 v_step_config_u16);
  10244. /*!
  10245. * @brief This API is used to get the step counter enable/disable status
  10246. * from the register 0x7B bit 3
  10247. *
  10248. *
  10249. * @param v_step_counter_u8 : The value of step counter enable
  10250. *
  10251. * @return results of bus communication function
  10252. * @retval 0 -> Success
  10253. * @retval -1 -> Error
  10254. *
  10255. *
  10256. */
  10257. BMI160_RETURN_FUNCTION_TYPE bmi160_get_step_counter_enable(
  10258. u8 *v_step_counter_u8);
  10259. /*!
  10260. * @brief This API is used to enable step counter
  10261. * by setting the register 0x7B bit 3
  10262. *
  10263. *
  10264. * @param v_step_counter_u8 : The value of step counter enable
  10265. *
  10266. * @return results of bus communication function
  10267. * @retval 0 -> Success
  10268. * @retval -1 -> Error
  10269. *
  10270. *
  10271. */
  10272. BMI160_RETURN_FUNCTION_TYPE bmi160_set_step_counter_enable(
  10273. u8 v_step_counter_u8);
  10274. /*!
  10275. * @brief This API is used to set step counter modes
  10276. *
  10277. *
  10278. * @param v_step_mode_u8 : The value of step counter mode
  10279. * value | mode
  10280. * ----------|-----------
  10281. * 0 | BMI160_STEP_NORMAL_MODE
  10282. * 1 | BMI160_STEP_SENSITIVE_MODE
  10283. * 2 | BMI160_STEP_ROBUST_MODE
  10284. *
  10285. * @return results of bus communication function
  10286. * @retval 0 -> Success
  10287. * @retval -1 -> Error
  10288. *
  10289. *
  10290. */
  10291. BMI160_RETURN_FUNCTION_TYPE bmi160_set_step_mode(u8 v_step_mode_u8);
  10292. /*!
  10293. * @brief This API is used to trigger the signification motion
  10294. * interrupt
  10295. *
  10296. *
  10297. * @param v_significant_u8 : The value of interrupt selection
  10298. * value | interrupt
  10299. * ----------|-----------
  10300. * 0 | BMI160_MAP_INTR1
  10301. * 1 | BMI160_MAP_INTR2
  10302. *
  10303. * @return results of bus communication function
  10304. * @retval 0 -> Success
  10305. * @retval -1 -> Error
  10306. *
  10307. *
  10308. */
  10309. BMI160_RETURN_FUNCTION_TYPE bmi160_map_significant_motion_intr(
  10310. u8 v_significant_u8);
  10311. /*!
  10312. * @brief This API is used to trigger the step detector
  10313. * interrupt
  10314. *
  10315. *
  10316. * @param v_step_detector_u8 : The value of interrupt selection
  10317. * value | interrupt
  10318. * ----------|-----------
  10319. * 0 | BMI160_MAP_INTR1
  10320. * 1 | BMI160_MAP_INTR2
  10321. *
  10322. * @return results of bus communication function
  10323. * @retval 0 -> Success
  10324. * @retval -1 -> Error
  10325. *
  10326. *
  10327. */
  10328. BMI160_RETURN_FUNCTION_TYPE bmi160_map_step_detector_intr(
  10329. u8 v_step_detector_u8);
  10330. /*!
  10331. * @brief This API is used to clear the step counter interrupt
  10332. *
  10333. *
  10334. * @param : None
  10335. *
  10336. *
  10337. * @return results of bus communication function
  10338. * @retval 0 -> Success
  10339. * @retval -1 -> Error
  10340. *
  10341. *
  10342. */
  10343. BMI160_RETURN_FUNCTION_TYPE bmi160_clear_step_counter(void);
  10344. /***************************************************/
  10345. /**\name FUNCTION FOR STEP COMMAND REGISTER WRITE */
  10346. /***************************************************/
  10347. /*!
  10348. * @brief This API writes the value to the register 0x7E bit 0 to 7
  10349. *
  10350. *
  10351. * @param v_command_reg_u8 : The value to write command register
  10352. * value | Description
  10353. * ---------|--------------------------------------------------------
  10354. * 0x00 | Reserved
  10355. * 0x03 | Starts fast offset calibration for the Accel and gyro
  10356. * 0x10 | Sets the PMU mode for the Accel to suspend
  10357. * 0x11 | Sets the PMU mode for the Accel to normal
  10358. * 0x12 | Sets the PMU mode for the Accel Lowpower
  10359. * 0x14 | Sets the PMU mode for the Gyro to suspend
  10360. * 0x15 | Sets the PMU mode for the Gyro to normal
  10361. * 0x16 | Reserved
  10362. * 0x17 | Sets the PMU mode for the Gyro to fast start-up
  10363. * 0x18 | Sets the PMU mode for the Mag to suspend
  10364. * 0x19 | Sets the PMU mode for the Mag to normal
  10365. * 0x1A | Sets the PMU mode for the Mag to Lowpower
  10366. * 0xB0 | Clears all data in the FIFO
  10367. * 0xB1 | Resets the interrupt engine
  10368. * 0xB2 | step_cnt_clr Clears the step counter
  10369. * 0xB6 | Triggers a reset
  10370. *
  10371. * @return results of bus communication function
  10372. * @retval 0 -> Success
  10373. * @retval -1 -> Error
  10374. *
  10375. *
  10376. */
  10377. BMI160_RETURN_FUNCTION_TYPE bmi160_set_command_register(
  10378. u8 v_command_reg_u8);
  10379. /***************************************************/
  10380. /**\name FUNCTION FOR BMM150 */
  10381. /***************************************************/
  10382. /*!
  10383. * @brief This function is used to initialize the bmm150 sensor
  10384. *
  10385. *
  10386. * @return results of bus communication function
  10387. * @retval 0 -> Success
  10388. * @retval -1 -> Error
  10389. *
  10390. *
  10391. */
  10392. BMI160_RETURN_FUNCTION_TYPE bmi160_bmm150_mag_interface_init(u8 *v_chip_id_u8);
  10393. /*!
  10394. * @brief This function is used to set the Mag power control
  10395. * bit enable
  10396. *
  10397. *
  10398. * @return results of bus communication function
  10399. * @retval 0 -> Success
  10400. * @retval -1 -> Error
  10401. *
  10402. *
  10403. */
  10404. BMI160_RETURN_FUNCTION_TYPE bmi160_bmm150_mag_wakeup(void);
  10405. /*!
  10406. * @brief This function is used to read the trim values of magnetometer
  10407. *
  10408. * @note Before reading the Mag trimming values
  10409. * make sure the following two points are addressed
  10410. * @note
  10411. * 1. Make sure the Mag interface is enabled or not,
  10412. * by using the bmi160_get_if_mode() function.
  10413. * If Mag interface is not enabled set the value of 0x02
  10414. * to the function bmi160_get_if_mode(0x02)
  10415. * @note
  10416. * 2. And also confirm the secondary-interface power mode
  10417. * is not in the SUSPEND mode.
  10418. * by using the function bmi160_get_mag_pmu_status().
  10419. * If the secondary-interface power mode is in SUSPEND mode
  10420. * set the value of 0x19(NORMAL mode)by using the
  10421. * bmi160_set_command_register(0x19) function.
  10422. *
  10423. * @return results of bus communication function
  10424. * @retval 0 -> Success
  10425. * @retval -1 -> Error
  10426. *
  10427. *
  10428. */
  10429. BMI160_RETURN_FUNCTION_TYPE bmi160_read_bmm150_mag_trim(void);
  10430. /*!
  10431. * @brief This function is used to read the compensated value of mag
  10432. * Before start reading the mag compensated data
  10433. * make sure the following two points are addressed
  10434. * @note
  10435. * 1. Make sure the Mag interface is enabled or not,
  10436. * by using the bmi160_get_if_mode() function.
  10437. * If Mag interface is not enabled set the value of 0x02
  10438. * to the function bmi160_get_if_mode(0x02)
  10439. * @note
  10440. * 2. And also confirm the secondary-interface power mode
  10441. * is not in the SUSPEND mode.
  10442. * by using the function bmi160_get_mag_pmu_status().
  10443. * If the secondary-interface power mode is in SUSPEND mode
  10444. * set the value of 0x19(NORMAL mode)by using the
  10445. * bmi160_set_command_register(0x19) function.
  10446. *
  10447. * @return results of bus communication function
  10448. * @retval 0 -> Success
  10449. * @retval -1 -> Error
  10450. *
  10451. *
  10452. */
  10453. BMI160_RETURN_FUNCTION_TYPE bmi160_bmm150_mag_compensate_xyz(
  10454. struct bmi160_mag_xyz_s32_t *mag_comp_xyz);
  10455. /*!
  10456. * @brief This API is used to get the compensated BMM150-X axis data
  10457. *
  10458. * Before start reading the Mag compensated X data
  10459. * make sure the following two points are addressed
  10460. * @note
  10461. * 1. Make sure the Mag interface is enabled or not,
  10462. * by using the bmi160_get_if_mode() function.
  10463. * If Mag interface is not enabled set the value of 0x02
  10464. * to the function bmi160_get_if_mode(0x02)
  10465. * @note
  10466. * 2. And also confirm the secondary-interface power mode
  10467. * is not in the SUSPEND mode.
  10468. * by using the function bmi160_get_mag_pmu_status().
  10469. * If the secondary-interface power mode is in SUSPEND mode
  10470. * set the value of 0x19(NORMAL mode)by using the
  10471. * bmi160_set_command_register(0x19) function.
  10472. *
  10473. *
  10474. *
  10475. * @param v_mag_data_x_s16 : The value of Mag raw X data
  10476. * @param v_data_r_u16 : The value of Mag R data
  10477. *
  10478. * @return compensated X axis data
  10479. *
  10480. */
  10481. s32 bmi160_bmm150_mag_compensate_X(s16 v_mag_data_x_s16, u16 v_data_r_u16);
  10482. /*!
  10483. * @brief This API is used to get the compensated BMM150-Y axis data
  10484. *
  10485. * Before reading the Mag compensated Y axis data
  10486. * make sure the following two points are addressed
  10487. * @note
  10488. * 1. Make sure the Mag interface is enabled or not,
  10489. * by using the bmi160_get_if_mode() function.
  10490. * If Mag interface is not enabled then set the value of 0x02
  10491. * to the function bmi160_get_if_mode(0x02)
  10492. * @note
  10493. * 2. And also confirm the secondary-interface power mode
  10494. * is not in the SUSPEND mode.
  10495. * by using the function bmi160_get_mag_pmu_status().
  10496. * If the secondary-interface power mode is in SUSPEND mode
  10497. * set the value of 0x19(NORMAL mode)by using the
  10498. * bmi160_set_command_register(0x19) function.
  10499. *
  10500. *
  10501. *
  10502. * @param v_mag_data_y_s16 : The value of Mag raw Y axis data
  10503. * @param v_data_r_u16 : The value of Mag R data
  10504. *
  10505. * @return results of compensated Y axis data
  10506. */
  10507. s32 bmi160_bmm150_mag_compensate_Y(s16 v_mag_data_y_s16, u16 v_data_r_u16);
  10508. /*!
  10509. * @brief This API is used to get the compensated BMM150-Z axis data
  10510. *
  10511. * Before reading the Mag compensated Z data
  10512. * make sure the following two points are addressed
  10513. * @note
  10514. * 1. Make sure the Mag interface is enabled or not,
  10515. * by using the bmi160_get_if_mode() function.
  10516. * If Mag interface is not enabled then set the value of 0x02
  10517. * to the function bmi160_get_if_mode(0x02)
  10518. * @note
  10519. * 2. And also confirm the secondary-interface power mode
  10520. * is not in the SUSPEND mode.
  10521. * by using the function bmi160_get_mag_pmu_status().
  10522. * If the secondary-interface power mode is in SUSPEND mode
  10523. * set the value of 0x19(NORMAL mode)by using the
  10524. * bmi160_set_command_register(0x19) function.
  10525. *
  10526. *
  10527. *
  10528. * @param v_mag_data_z_s16 : The value of Mag raw Z data
  10529. * @param v_data_r_u16 : The value of Mag R data
  10530. *
  10531. * @return results of compensated Z axis data
  10532. */
  10533. s32 bmi160_bmm150_mag_compensate_Z(s16 v_mag_data_z_s16, u16 v_data_r_u16);
  10534. /*!
  10535. * @brief This API is used to set the pre-set modes of bmm150
  10536. * The pre-set mode setting depends on the data rate and xy and z
  10537. * repetitions
  10538. *
  10539. * @note
  10540. * Before setting the Mag preset mode
  10541. * make sure the following two points are addressed
  10542. * @note
  10543. * 1. Make sure the Mag interface is enabled or not,
  10544. * by using the bmi160_get_if_mode() function.
  10545. * If Mag interface is not enabled set the value of 0x02
  10546. * to the function bmi160_get_if_mode(0x02)
  10547. * @note
  10548. * 2. And also confirm the secondary-interface power mode
  10549. * is not in the SUSPEND mode by using the function
  10550. * bmi160_get_mag_pmu_status().
  10551. * If the secondary-interface power mode is in SUSPEND mode
  10552. * set the value of 0x19(NORMAL mode)by using the
  10553. * bmi160_set_command_register(0x19) function.
  10554. *
  10555. *
  10556. * @param v_mode_u8: The value of pre-set mode selection value
  10557. * value | pre_set mode
  10558. * ----------|------------
  10559. * 1 | BMI160_MAG_PRESETMODE_LOWPOWER
  10560. * 2 | BMI160_MAG_PRESETMODE_REGULAR
  10561. * 3 | BMI160_MAG_PRESETMODE_HIGHACCURACY
  10562. * 4 | BMI160_MAG_PRESETMODE_ENHANCED
  10563. *
  10564. * @return results of bus communication function
  10565. * @retval 0 -> Success
  10566. * @retval -1 -> Error
  10567. *
  10568. */
  10569. BMI160_RETURN_FUNCTION_TYPE bmi160_set_bmm150_mag_presetmode(u8 mode);
  10570. /*!
  10571. * @brief This function is used to set the magnetometer
  10572. * power mode.
  10573. * @note
  10574. * Before setting the Mag power mode make sure the following
  10575. * two points are addressed
  10576. * @note
  10577. * 1. Make sure the Mag interface is enabled or not,
  10578. * by using the bmi160_get_if_mode() function.
  10579. * If Mag interface is not enabled then set the value of 0x02
  10580. * to the function bmi160_get_if_mode(0x02)
  10581. * @note
  10582. * 2. And also confirm the secondary-interface power mode
  10583. * is not in the SUSPEND mode by using the
  10584. * function bmi160_get_mag_pmu_status().
  10585. * If the secondary-interface power mode is in SUSPEND mode
  10586. * set the value of 0x19(NORMAL mode)by using the
  10587. * bmi160_set_command_register(0x19) function.
  10588. *
  10589. * @param v_mag_pow_mode_u8 : The value of Mag power mode
  10590. * value | mode
  10591. * ----------|------------
  10592. * 0 | FORCE_MODE
  10593. * 1 | SUSPEND_MODE
  10594. *
  10595. *
  10596. * @return results of bus communication function
  10597. * @retval 0 -> Success
  10598. * @retval -1 -> Error
  10599. *
  10600. *
  10601. */
  10602. BMI160_RETURN_FUNCTION_TYPE bmi160_bmm150_mag_set_power_mode(u8 mag_pow_mode);
  10603. /*!
  10604. * @brief This function is used to set the magnetometer
  10605. * power mode.
  10606. * @note Before setting the Mag power mode
  10607. * make sure the following points are addressed
  10608. * Make sure the Mag interface is enabled or not,
  10609. * by using the bmi160_get_if_mode() function.
  10610. * If Mag interface is not enabled set the value of 0x02
  10611. * to the function bmi160_get_if_mode(0x02)
  10612. *
  10613. * @param v_mag_sec_if_pow_mode_u8 : The value of Mag power mode
  10614. * value | mode
  10615. * ----------|------------
  10616. * 0 | BMI160_MAG_FORCE_MODE
  10617. * 1 | BMI160_MAG_SUSPEND_MODE
  10618. *
  10619. *
  10620. * @return results of bus communication function
  10621. * @retval 0 -> Success
  10622. * @retval -1 -> Error
  10623. *
  10624. *
  10625. */
  10626. BMI160_RETURN_FUNCTION_TYPE bmi160_set_bmm150_mag_and_secondary_if_power_mode(
  10627. u8 v_mag_sec_if_pow_mode_u8);
  10628. #if defined AKM09911 || defined AKM09912
  10629. /***************************************************/
  10630. /**\name FUNCTIONS FOR AKM09911 AND AKM09912*/
  10631. /***************************************************/
  10632. /*!
  10633. * @brief Used to read the akm compensated values
  10634. */
  10635. struct bmi160_bst_akm_xyz_t {
  10636. s32 x;/**<AKM09911 and AKM09912 X compensated data*/
  10637. s32 y;/**<AKM09911 and AKM09912 Y compensated data*/
  10638. s32 z;/**<AKM09911 and AKM09912 Z compensated data*/
  10639. };
  10640. /*!
  10641. * @brief Structure for reading AKM compensating data
  10642. */
  10643. struct bst_akm_sensitivity_data_t {
  10644. u8 asax;/**<AKM09911 and AKM09912 X sensitivity data*/
  10645. u8 asay;/**<AKM09911 and AKM09912 Y sensitivity data*/
  10646. u8 asaz;/**<AKM09911 and AKM09912 Z sensitivity data*/
  10647. };
  10648. /*!
  10649. * @brief This function is used to initialize
  10650. * the AKM09911 and AKM09912 sensor
  10651. *
  10652. *
  10653. * @param v_akm_i2c_address_u8: The value of device address
  10654. * AKM sensor | Slave address
  10655. * --------------|---------------------
  10656. * AKM09911 | AKM09911_I2C_ADDR_1
  10657. * - | and AKM09911_I2C_ADDR_2
  10658. * AKM09912 | AKM09912_I2C_ADDR_1
  10659. * - | AKM09912_I2C_ADDR_2
  10660. * - | AKM09912_I2C_ADDR_3
  10661. * - | AKM09912_I2C_ADDR_4
  10662. *
  10663. * @return results of bus communication function
  10664. * @retval 0 -> Success
  10665. * @retval -1 -> Error
  10666. *
  10667. *
  10668. */
  10669. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_akm_mag_interface_init(
  10670. u8 v_akm_i2c_address_u8);
  10671. /*!
  10672. * @brief This function is used to read the sensitivity data of
  10673. * AKM09911 and AKM09912
  10674. *
  10675. * @note Before reading the Mag sensitivity values
  10676. * make sure the following two points are addressed
  10677. * @note 1. Make sure the Mag interface is enabled or not,
  10678. * by using the bmi160_get_if_mode() function.
  10679. * If Mag interface is not enabled set the value of 0x02
  10680. * to the function bmi160_get_if_mode(0x02)
  10681. * @note 2. And also confirm the secondary-interface power mode
  10682. * is not in the SUSPEND mode by using the function
  10683. * bmi160_get_mag_pmu_status().
  10684. * If the secondary-interface power mode is in SUSPEND mode
  10685. * set the value of 0x19(NORMAL mode)by using the
  10686. * bmi160_set_command_register(0x19) function.
  10687. *
  10688. * @return results of bus communication function
  10689. * @retval 0 -> Success
  10690. * @retval -1 -> Error
  10691. *
  10692. *
  10693. */
  10694. BMI160_RETURN_FUNCTION_TYPE bmi160_read_bst_akm_sensitivity_data(void);
  10695. /*!
  10696. * @brief This function is used to set the AKM09911 and AKM09912
  10697. * power mode.
  10698. * @note Before setting the AKM power mode
  10699. * make sure the following two points are addressed
  10700. * @note 1. Make sure the Mag interface is enabled or not,
  10701. * by using the bmi160_get_if_mode() function.
  10702. * If Mag interface is not enabled then set the value of 0x02
  10703. * to the function bmi160_get_if_mode(0x02)
  10704. * @note 2. And also confirm the secondary-interface power mode
  10705. * is not in the SUSPEND mode.
  10706. * by using the function bmi160_get_mag_pmu_status().
  10707. * If the secondary-interface power mode is in SUSPEND mode
  10708. * set the value of 0x19(NORMAL mode)by using the
  10709. * bmi160_set_command_register(0x19) function.
  10710. *
  10711. * @param v_akm_pow_mode_u8 : The value of akm power mode
  10712. * value | Description
  10713. * ---------|--------------------
  10714. * 0 | AKM_POWER_DOWN_MODE
  10715. * 1 | AKM_SINGLE_MEAS_MODE
  10716. * 2 | FUSE_ROM_MODE
  10717. *
  10718. *
  10719. * @return results of bus communication function
  10720. * @retval 0 -> Success
  10721. * @retval -1 -> Error
  10722. *
  10723. *
  10724. */
  10725. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_akm_set_powermode(
  10726. u8 v_akm_pow_mode_u8);
  10727. /*!
  10728. * @brief This function is used to set the magnetometer
  10729. * power mode of AKM09911 and AKM09912
  10730. * @note Before setting the Mag power mode
  10731. * make sure the following two points are addressed
  10732. * Make sure the Mag interface is enabled or not,
  10733. * by using the bmi160_get_if_mode() function.
  10734. * If Mag interface is not enabled then set the value of 0x02
  10735. * to the function bmi160_get_if_mode(0x02)
  10736. *
  10737. * @param v_mag_sec_if_pow_mode_u8 : The value of secondary if power mode
  10738. * value | Description
  10739. * ---------|--------------------
  10740. * 0 | BMI160_MAG_FORCE_MODE
  10741. * 1 | BMI160_MAG_SUSPEND_MODE
  10742. *
  10743. *
  10744. * @return results of bus communication function
  10745. * @retval 0 -> Success
  10746. * @retval -1 -> Error
  10747. *
  10748. *
  10749. */
  10750. BMI160_RETURN_FUNCTION_TYPE
  10751. bmi160_set_bst_akm_and_secondary_if_powermode(
  10752. u8 v_mag_sec_if_pow_mode_u8);
  10753. #endif
  10754. #ifdef AKM09911
  10755. /***************************************************/
  10756. /**\name FUNCTIONS FOR AKM09911 */
  10757. /***************************************************/
  10758. /*!
  10759. * @brief This API is used to get the compensated X data
  10760. * of AKM09911 sensor
  10761. * Output of X is s32
  10762. * @note Before start reading the Mag compensated X data
  10763. * make sure the following two points are addressed
  10764. * @note 1. Make sure the Mag interface is enabled or not,
  10765. * by using the bmi160_get_if_mode() function.
  10766. * If Mag interface is not enabled set the value of 0x02
  10767. * to the function bmi160_get_if_mode(0x02)
  10768. * @note 2. And also confirm the secondary-interface power mode
  10769. * is not in the SUSPEND mode.
  10770. * by using the function bmi160_get_mag_pmu_status().
  10771. * If the secondary-interface power mode is in SUSPEND mode
  10772. * set the value of 0x19(NORMAL mode)by using the
  10773. * bmi160_set_command_register(0x19) function.
  10774. *
  10775. *
  10776. * @param v_bst_akm_x_s16 : The value of X data
  10777. *
  10778. * @return compensated X data value
  10779. *
  10780. */
  10781. s32 bmi160_bst_akm09911_compensate_X(s16 v_bst_akm_x_s16);
  10782. /*!
  10783. * @brief This API is used to get the compensated Y data
  10784. * of AKM09911 sensor
  10785. * Output of Y is s32
  10786. * @note Before start reading the Mag compensated Y data
  10787. * make sure the following two points are addressed
  10788. * @note 1. Make sure the Mag interface is enabled or not,
  10789. * by using the bmi160_get_if_mode() function.
  10790. * If Mag interface is not enabled set the value of 0x02
  10791. * to the function bmi160_get_if_mode(0x02)
  10792. * @note 2. And also confirm the secondary-interface power mode
  10793. * is not in the SUSPEND mode.
  10794. * by using the function bmi160_get_mag_pmu_status().
  10795. * If the secondary-interface power mode is in SUSPEND mode
  10796. * set the value of 0x19(NORMAL mode)by using the
  10797. * bmi160_set_command_register(0x19) function.
  10798. *
  10799. *
  10800. * @param v_bst_akm_y_s16 : The value of Y data
  10801. *
  10802. * @return compensated Y data value
  10803. *
  10804. */
  10805. s32 bmi160_bst_akm09911_compensate_Y(s16 v_bst_akm_y_s16);
  10806. /*!
  10807. * @brief This API is used to get the compensated Z data
  10808. * of AKM09911 sensor
  10809. * Out put of Z is s32
  10810. * @note Before start reading the Mag compensated Z data
  10811. * make sure the following two points are addressed
  10812. * @note 1. Make sure the Mag interface is enabled or not,
  10813. * by using the bmi160_get_if_mode() function.
  10814. * If Mag interface is not enabled set the value of 0x02
  10815. * to the function bmi160_get_if_mode(0x02)
  10816. * @note 2. And also confirm the secondary-interface power mode
  10817. * is not in the SUSPEND mode.
  10818. * by using the function bmi160_get_mag_pmu_status().
  10819. * If the secondary-interface power mode is in SUSPEND mode
  10820. * set the value of 0x19(NORMAL mode)by using the
  10821. * bmi160_set_command_register(0x19) function.
  10822. *
  10823. *
  10824. * @param v_bst_akm_z_s16 : The value of Z data
  10825. *
  10826. * @return compensated Z data value
  10827. *
  10828. */
  10829. s32 bmi160_bst_akm09911_compensate_Z(s16 v_bst_akm_z_s16);
  10830. /*!
  10831. * @brief This function is used to read the compensated value of
  10832. * AKM09911
  10833. * @note Before start reading the Mag compensated data's
  10834. * make sure the following two points are addressed
  10835. * @note 1. Make sure the Mag interface is enabled or not,
  10836. * by using the bmi160_get_if_mode() function.
  10837. * If Mag interface is not enabled set the value of 0x02
  10838. * to the function bmi160_get_if_mode(0x02)
  10839. * @note 2. And also confirm the secondary-interface power mode
  10840. * is not in the SUSPEND mode by using the function
  10841. * bmi160_get_mag_pmu_status().
  10842. * If the secondary-interface power mode is in SUSPEND mode
  10843. * set the value of 0x19(NORMAL mode)by using the
  10844. * bmi160_set_command_register(0x19) function.
  10845. *
  10846. *
  10847. * @return results of bus communication function
  10848. * @retval 0 -> Success
  10849. * @retval -1 -> Error
  10850. *
  10851. *
  10852. */
  10853. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_akm09911_compensate_xyz(
  10854. struct bmi160_bst_akm_xyz_t *bst_akm_xyz);
  10855. #endif
  10856. #ifdef AKM09912
  10857. /***************************************************/
  10858. /**\name FUNCTIONS FOR AKM09912*/
  10859. /***************************************************/
  10860. /*!
  10861. * @brief This API is used to get the compensated X data
  10862. * of AKM09912 sensor
  10863. * Output of X is s32
  10864. * @note Before start reading the Mag compensated X data
  10865. * make sure the following two points are addressed
  10866. * @note 1. Make sure the Mag interface is enabled or not,
  10867. * by using the bmi160_get_if_mode() function.
  10868. * If Mag interface is not enabled set the value of 0x02
  10869. * to the function bmi160_get_if_mode(0x02)
  10870. * @note 2. And also confirm the secondary-interface power mode
  10871. * is not in the SUSPEND mode.
  10872. * by using the function bmi160_get_mag_pmu_status().
  10873. * If the secondary-interface power mode is in SUSPEND mode
  10874. * set the value of 0x19(NORMAL mode)by using the
  10875. * bmi160_set_command_register(0x19) function.
  10876. *
  10877. *
  10878. * @param v_bst_akm_x_s16 : The value of X data
  10879. *
  10880. * @return compensated X data value
  10881. *
  10882. */
  10883. s32 bmi160_bst_akm09912_compensate_X(s16 v_bst_akm_x_s16);
  10884. /*!
  10885. * @brief This API is used to get the compensated Y data
  10886. * of AKM09912 sensor
  10887. * @note Before reading the Mag compensated Y data
  10888. * make sure the following two points are addressed
  10889. * @note 1. Make sure the Mag interface is enabled or not,
  10890. * by using the bmi160_get_if_mode() function.
  10891. * If Mag interface is not enabled set the value of 0x02
  10892. * to the function bmi160_get_if_mode(0x02)
  10893. * @note 2. And also confirm the secondary-interface power mode
  10894. * is not in the SUSPEND mode by using the function
  10895. * bmi160_get_mag_pmu_status().
  10896. * If the secondary-interface power mode is in SUSPEND mode
  10897. * set the value of 0x19(NORMAL mode)by using the
  10898. * bmi160_set_command_register(0x19) function.
  10899. *
  10900. *
  10901. * @param v_bst_akm_y_s16 : The value of Y data
  10902. *
  10903. * @return compensated Y data value
  10904. *
  10905. */
  10906. s32 bmi160_bst_akm09912_compensate_Y(s16 v_bst_akm_y_s16);
  10907. /*!
  10908. * @brief This API is used to get the compensated Z data
  10909. * of AKM09912
  10910. * Output of X is s32
  10911. * @note Before start reading the Mag compensated Z data
  10912. * make sure the following two points are addressed
  10913. * @note 1. Make sure the Mag interface is enabled or not,
  10914. * by using the bmi160_get_if_mode() function.
  10915. * If Mag interface is not enabled set the value of 0x02
  10916. * to the function bmi160_get_if_mode(0x02)
  10917. * @note 2. And also confirm the secondary-interface power mode
  10918. * is not in the SUSPEND mode.
  10919. * by using the function bmi160_get_mag_pmu_status().
  10920. * If the secondary-interface power mode is in SUSPEND mode
  10921. * set the value of 0x19(NORMAL mode)by using the
  10922. * bmi160_set_command_register(0x19) function.
  10923. *
  10924. *
  10925. * @param v_bst_akm_z_s16 : The value of Z data
  10926. *
  10927. * @return compensated Z data value
  10928. *
  10929. */
  10930. s32 bmi160_bst_akm09912_compensate_Z(s16 v_bst_akm_z_s16);
  10931. /*!
  10932. * @brief This function is used to read the compensated value of
  10933. * AKM09912 sensor
  10934. * @note Before start reading the Mag compensated data's
  10935. * make sure the following two points are addressed
  10936. * @note 1. Make sure the Mag interface is enabled or not,
  10937. * by using the bmi160_get_if_mode() function.
  10938. * If Mag interface is not enabled set the value of 0x02
  10939. * to the function bmi160_get_if_mode(0x02)
  10940. * @note 2. And also confirm the secondary-interface power mode
  10941. * is not in the SUSPEND mode by using the function
  10942. * bmi160_get_mag_pmu_status().
  10943. * If the secondary-interface power mode is in SUSPEND mode
  10944. * set the value of 0x19(NORMAL mode)by using the
  10945. * bmi160_set_command_register(0x19) function.
  10946. *
  10947. *
  10948. * @return results of bus communication function
  10949. * @retval 0 -> Success
  10950. * @retval -1 -> Error
  10951. *
  10952. *
  10953. */
  10954. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_akm09912_compensate_xyz(
  10955. struct bmi160_bst_akm_xyz_t *bst_akm_xyz);
  10956. #endif
  10957. #ifdef FIFO_ENABLE
  10958. /***************************************************/
  10959. /**\name FUNCTIONS FOR FIFO DATA READ */
  10960. /***************************************************/
  10961. /*!
  10962. * @brief This function is used to read the
  10963. * fifo data for header less mode
  10964. *
  10965. *
  10966. *
  10967. * @note Configure the below functions for FIFO header less mode
  10968. * @note 1. bmi160_set_fifo_down_gyro
  10969. * @note 2. bmi160_set_gyro_fifo_filter_data
  10970. * @note 3. bmi160_set_fifo_down_accel
  10971. * @note 4. bmi160_set_accel_fifo_filter_dat
  10972. * @note 5. bmi160_set_fifo_mag_enable
  10973. * @note 6. bmi160_set_fifo_accel_enable
  10974. * @note 7. bmi160_set_fifo_gyro_enable
  10975. * @note For interrupt configuration
  10976. * @note 1. bmi160_set_intr_fifo_full
  10977. * @note 2. bmi160_set_intr_fifo_wm
  10978. * @note 3. bmi160_set_fifo_tag_intr2_enable
  10979. * @note 4. bmi160_set_fifo_tag_intr1_enable
  10980. *
  10981. * @note The FIFO reads the whole 1024 bytes of data and
  10982. * processing it.
  10983. *
  10984. * @return results of bus communication function
  10985. * @retval 0 -> Success
  10986. * @retval -1 -> Error
  10987. *
  10988. *
  10989. */
  10990. BMI160_RETURN_FUNCTION_TYPE bmi160_read_fifo_headerless_mode(
  10991. u8 v_mag_if_u8, struct bmi160_fifo_data_header_less_t *headerless_data);
  10992. /*!
  10993. * @brief This function is used to read the
  10994. * fifo data for header less mode according to user defined length
  10995. *
  10996. *
  10997. * @param v_fifo_user_length_u16: length of FIFO data to be read
  10998. * @param v_mag_if_mag_u8 : the Mag interface data
  10999. * @param fifo_data : the pointer to fifo_data_header_less_t structure
  11000. *
  11001. * @note Configure the below functions for FIFO header less mode
  11002. * @note 1. bmi160_set_fifo_down_gyro
  11003. * @note 2. bmi160_set_gyro_fifo_filter_data
  11004. * @note 3. bmi160_set_fifo_down_accel
  11005. * @note 4. bmi160_set_accel_fifo_filter_dat
  11006. * @note 5. bmi160_set_fifo_mag_enable
  11007. * @note 6. bmi160_set_fifo_accel_enable
  11008. * @note 7. bmi160_set_fifo_gyro_enable
  11009. * @note For interrupt configuration
  11010. * @note 1. bmi160_set_intr_fifo_full
  11011. * @note 2. bmi160_set_intr_fifo_wm
  11012. * @note 3. bmi160_set_fifo_tag_intr2_enable
  11013. * @note 4. bmi160_set_fifo_tag_intr1_enable
  11014. *
  11015. * @note The FIFO reads the whole 1024 bytes
  11016. * of data and process it.
  11017. *
  11018. * @return results of bus communication function
  11019. * @retval 0 -> Success
  11020. * @retval -1 -> Error
  11021. *
  11022. *
  11023. */
  11024. BMI160_RETURN_FUNCTION_TYPE
  11025. bmi160_read_fifo_headerless_mode_user_defined_length(
  11026. u16 v_fifo_user_length_u16,
  11027. struct bmi160_fifo_data_header_less_t *fifo_data, u8 v_mag_if_mag_u8);
  11028. /*!
  11029. * @brief This function is used to read the
  11030. * fifo data of header mode
  11031. *
  11032. *
  11033. * @note Configure the below functions for FIFO header mode
  11034. * @note 1. bmi160_set_fifo_down_gyro()
  11035. * @note 2. bmi160_set_gyro_fifo_filter_data()
  11036. * @note 3. bmi160_set_fifo_down_accel()
  11037. * @note 4. bmi160_set_accel_fifo_filter_dat()
  11038. * @note 5. bmi160_set_fifo_mag_enable()
  11039. * @note 6. bmi160_set_fifo_accel_enable()
  11040. * @note 7. bmi160_set_fifo_gyro_enable()
  11041. * @note 8. bmi160_set_fifo_header_enable()
  11042. * @note For interrupt configuration
  11043. * @note 1. bmi160_set_intr_fifo_full()
  11044. * @note 2. bmi160_set_intr_fifo_wm()
  11045. * @note 3. bmi160_set_fifo_tag_intr2_enable()
  11046. * @note 4. bmi160_set_fifo_tag_intr1_enable()
  11047. *
  11048. * @note The FIFO reads the whole 1024 bytes
  11049. * of data and process it.
  11050. *
  11051. * @return results of bus communication function
  11052. * @retval 0 -> Success
  11053. * @retval -1 -> Error
  11054. *
  11055. *
  11056. */
  11057. BMI160_RETURN_FUNCTION_TYPE bmi160_read_fifo_header_data(
  11058. u8 v_mag_if_u8, struct bmi160_fifo_data_header_t *header_data);
  11059. /*!
  11060. * @brief This function is used to read the
  11061. * fifo data of header mode for user defined length
  11062. *
  11063. *
  11064. * @note Configure the below functions for FIFO header mode
  11065. * @note 1. bmi160_set_fifo_down_gyro()
  11066. * @note 2. bmi160_set_gyro_fifo_filter_data()
  11067. * @note 3. bmi160_set_fifo_down_accel()
  11068. * @note 4. bmi160_set_accel_fifo_filter_dat()
  11069. * @note 5. bmi160_set_fifo_mag_enable()
  11070. * @note 6. bmi160_set_fifo_accel_enable()
  11071. * @note 7. bmi160_set_fifo_gyro_enable()
  11072. * @note 8. bmi160_set_fifo_header_enable()
  11073. * @note For interrupt configuration
  11074. * @note 1. bmi160_set_intr_fifo_full()
  11075. * @note 2. bmi160_set_intr_fifo_wm()
  11076. * @note 3. bmi160_set_fifo_tag_intr2_enable()
  11077. * @note 4. bmi160_set_fifo_tag_intr1_enable()
  11078. *
  11079. * @note The FIFO reads the whole 1024 bytes
  11080. * of data and process it.
  11081. *
  11082. * @return results of bus communication function
  11083. * @retval 0 -> Success
  11084. * @retval -1 -> Error
  11085. *
  11086. *
  11087. */
  11088. BMI160_RETURN_FUNCTION_TYPE bmi160_read_fifo_header_data_user_defined_length(
  11089. u16 v_fifo_user_length_u16, u8 v_mag_if_mag_u8,
  11090. struct bmi160_fifo_data_header_t *fifo_header_data);
  11091. #endif
  11092. /*!
  11093. * @brief This function is used to read the compensated xyz axis data of
  11094. * mag secondary interface
  11095. * @note v_mag_x_s16: The value of Mag x data
  11096. * @note v_mag_y_s16: The value of Mag y data
  11097. * @note v_mag_z_s16: The value of Mag z data
  11098. * @note v_mag_r_s16: The value of Mag r data
  11099. * @param v_mag_second_if_u8: The value of Mag selection
  11100. *
  11101. * value | v_mag_second_if_u8
  11102. * ---------|----------------------
  11103. * 0 | BMM150
  11104. * 1 | AKM09911
  11105. * 2 | AKM09912
  11106. * 3 | YAS532
  11107. * 4 | YAS537
  11108. * @param mag_fifo_data: The value of compensated Mag xyz data
  11109. *
  11110. *
  11111. * @return
  11112. *
  11113. *
  11114. */
  11115. BMI160_RETURN_FUNCTION_TYPE bmi160_second_if_mag_compensate_xyz(
  11116. struct bmi160_mag_fifo_data_t mag_fifo_data,
  11117. u8 v_mag_second_if_u8);
  11118. #ifdef YAS537
  11119. /***************************************************/
  11120. /**\name FUNCTIONS FOR YAMAHA-YAS537 */
  11121. /***************************************************/
  11122. /**
  11123. * @struct yas_vector
  11124. * @brief Stores the sensor data
  11125. */
  11126. struct yas_vector {
  11127. s32 yas537_vector_xyz[3]; /*!< vector data */
  11128. };
  11129. /*!
  11130. * @brief YAMAHA-YAS532 struct
  11131. * Calibration YAS532 data struct
  11132. */
  11133. struct bst_yas537_calib_data_t {
  11134. s8 a2;/**<YAS532 calib a2 data */
  11135. s8 a3;/**<YAS532 calib a3 data */
  11136. s8 a4;/**<YAS532 calib a4 data */
  11137. s16 a5;/**<YAS532 calib a5 data */
  11138. s8 a6;/**<YAS532 calib a6 data */
  11139. s8 a7;/**<YAS532 calib a7 data */
  11140. s8 a8;/**<YAS532 calib a8 data */
  11141. s16 a9;/**<YAS532 calib a9 data */
  11142. u8 k;/**<YAS532 calib k data */
  11143. u8 ver;/**<YAS532 calib ver data*/
  11144. };
  11145. /*!
  11146. * @brief YAS537 sensor initialization
  11147. */
  11148. struct yas537_t {
  11149. struct bst_yas537_calib_data_t calib_yas537;/**< calib data */
  11150. s8 measure_state;/**< update measure state */
  11151. s8 hard_offset[3];/**< offset write array*/
  11152. u16 last_after_rcoil[3];/**< rcoil write array*/
  11153. s32 coef[3];/**< coefficient data */
  11154. s8 overflow;/**< over flow condition check */
  11155. u8 dev_id;/**< device id information */
  11156. u8 average;/**<average selection for offset configuration*/
  11157. const s8 *transform;/**< transform condition check */
  11158. u16 last_raw[4];/**< raw data */
  11159. struct yas_vector xyz; /*!< X, Y, Z measurement data of the sensor */
  11160. };
  11161. /*!
  11162. * @brief This function is used to read the
  11163. * YAMAHA YAS537 xy1y2 data of fifo
  11164. *
  11165. * @param a_xy1y2_u16: The value of xyy1 data
  11166. * @param v_over_flow_u8: The value of overflow
  11167. * @param v_rcoil_u8: The value of rcoil
  11168. * @param v_busy_u8: The value of busy flag
  11169. *
  11170. *
  11171. * @return results of bus communication function
  11172. * @retval 0 -> Success
  11173. * @retval -1 -> Error
  11174. *
  11175. *
  11176. */
  11177. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yamaha_yas537_fifo_xyz_data(
  11178. u16 *a_xy1y2_u16, u8 v_over_flow_u8, u8 v_rcoil_u8, u8 v_busy_u8);
  11179. /*!
  11180. * @brief This function used to init the YAMAHA-YAS537
  11181. *
  11182. *
  11183. * @return results of bus communication function
  11184. * @retval 0 -> Success
  11185. * @retval -1 -> Error
  11186. *
  11187. *
  11188. */
  11189. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yamaha_yas537_mag_interface_init(
  11190. void);
  11191. /*!
  11192. * @brief This function is used to read the
  11193. * YAMAHA YAS537 calibration data
  11194. *
  11195. *
  11196. * @param v_rcoil_u8 : The value of r coil
  11197. *
  11198. *
  11199. * @return results of bus communication function
  11200. * @retval 0 -> Success
  11201. * @retval -1 -> Error
  11202. *
  11203. *
  11204. */
  11205. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yamaha_yas537_calib_values(
  11206. u8 v_rcoil_u8);
  11207. /*!
  11208. * @brief This function is used for writing the data acquisition
  11209. * command register write in YAS537
  11210. * @param v_command_reg_data_u8 : the value of data acquisition
  11211. * acquisition_command | operation
  11212. * ---------------------|-------------------------
  11213. * 0x17 | turn on the acquisition coil
  11214. * - | set direction of the coil
  11215. * _ | (x and y as minus(-))
  11216. * _ | Deferred acquisition mode
  11217. * 0x07 | turn on the acquisition coil
  11218. * _ | set direction of the coil
  11219. * _ | (x and y as minus(-))
  11220. * _ | Normal acquisition mode
  11221. * 0x11 | turn OFF the acquisition coil
  11222. * _ | set direction of the coil
  11223. * _ | (x and y as plus(+))
  11224. * _ | Deferred acquisition mode
  11225. * 0x01 | turn OFF the acquisition coil
  11226. * _ | set direction of the coil
  11227. * _ | (x and y as plus(+))
  11228. * _ | Normal acquisition mode
  11229. *
  11230. *
  11231. *
  11232. * @return results of bus communication function
  11233. * @retval 0 -> Success
  11234. * @retval -1 -> Error
  11235. *
  11236. *
  11237. */
  11238. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yas537_acquisition_command_register(
  11239. u8 v_command_reg_data_u8);
  11240. /*!
  11241. * @brief This function is used to read the
  11242. * YAMAHA YAS537 xy1y2 data
  11243. *
  11244. * @param v_coil_stat_u8: The value of R coil status
  11245. * @param v_busy_u8: The value of busy status
  11246. * @param v_temperature_u16: The value of temperature
  11247. * @param xy1y2: The value of raw xy1y2 data
  11248. * @param v_outflow_u8: The value of overflow
  11249. *
  11250. *
  11251. * @return results of bus communication function
  11252. * @retval 0 -> Success
  11253. * @retval -1 -> Error
  11254. *
  11255. *
  11256. */
  11257. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yamaha_yas537_read_xy1y2_data(
  11258. u8 *v_coil_stat_u8, u8 *v_busy_u8,
  11259. u16 *v_temperature_u16, u16 *xy1y2, u8 *v_outflow_u8);
  11260. /*!
  11261. * @brief This function is used to read the
  11262. * YAMAHA YAS537 xy1y2 data
  11263. *
  11264. * @param v_outflow_u8: The value of overflow
  11265. * @param *vector_xyz : yas vector structure pointer
  11266. *
  11267. * @return results of bus communication function
  11268. * @retval 0 -> Success
  11269. * @retval -1 -> Error
  11270. *
  11271. *
  11272. */
  11273. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yamaha_yas537_measure_xyz_data(
  11274. u8 *v_outflow_u8, struct yas_vector *vector_xyz);
  11275. #endif
  11276. #ifdef YAS532
  11277. /***************************************************/
  11278. /**\name FUNCTIONS FOR YAMAHA-YAS532 */
  11279. /***************************************************/
  11280. /*!
  11281. * @brief YAMAHA-YAS532 struct
  11282. * Calibration YAS532 data struct
  11283. */
  11284. struct bst_yas532_calib_data_t {
  11285. s32 cx;/**<YAS532 calib cx data */
  11286. s32 cy1;/**<YAS532 calib cy1 data */
  11287. s32 cy2;/**<YAS532 calib cy2 data */
  11288. s32 a2;/**<YAS532 calib a2 data */
  11289. s32 a3;/**<YAS532 calib a3 data */
  11290. s32 a4;/**<YAS532 calib a4 data */
  11291. s32 a5;/**<YAS532 calib a5 data */
  11292. s32 a6;/**<YAS532 calib a6 data */
  11293. s32 a7;/**<YAS532 calib a7 data */
  11294. s32 a8;/**<YAS532 calib a8 data */
  11295. s32 a9;/**<YAS532 calib a9 data */
  11296. s32 k;/**<YAS532 calib k data */
  11297. s8 rxy1y2[3];/**<YAS532 calib rxy1y2 data */
  11298. u8 fxy1y2[3];/**<YAS532 calib fxy1y2 data */
  11299. };
  11300. /*!
  11301. * @brief YAS532 Temperature structure
  11302. */
  11303. #if 1 < YAS532_MAG_TEMPERATURE_LOG
  11304. struct yas_temp_filter_t {
  11305. u16 log[YAS532_MAG_TEMPERATURE_LOG];/**<YAS532 temp log array */
  11306. u8 num;/**< used to increment the index */
  11307. u8 idx;/**< used to increment the index */
  11308. };
  11309. #endif
  11310. /*!
  11311. * @brief YAS532 sensor initialization
  11312. */
  11313. struct yas532_t {
  11314. struct bst_yas532_calib_data_t calib_yas532;/**< calib data */
  11315. s8 measure_state;/**< update measure state */
  11316. s8 v_hard_offset_s8[3];/**< offset write array*/
  11317. s32 coef[3];/**< co efficient data */
  11318. s8 overflow;/**< over flow condition check */
  11319. u8 dev_id;/**< device id information */
  11320. const s8 *transform;/**< transform condition check */
  11321. #if 1 < YAS532_MAG_TEMPERATURE_LOG
  11322. struct yas_temp_filter_t temp_data;/**< temp data */
  11323. #endif
  11324. u16 last_raw[4];/**< raw data */
  11325. };
  11326. /*!
  11327. * @brief Used for reading the YAS532 XYZ data
  11328. */
  11329. struct yas532_vector {
  11330. s32 yas532_vector_xyz[3];/**< YAS532 compensated xyz data*/
  11331. };
  11332. /*!
  11333. * @struct yas532_data
  11334. * @brief Used for reading the YAS532 XYZ data
  11335. */
  11336. struct yas532_data {
  11337. s32 x;
  11338. s32 y;
  11339. s32 z;
  11340. };
  11341. /*!
  11342. * @brief This function is used to initlalize the YAMAHA-YAS532 sensor
  11343. *
  11344. *
  11345. * @return results of bus communication function
  11346. * @retval 0 -> Success
  11347. * @retval -1 -> Error
  11348. *
  11349. *
  11350. */
  11351. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yamaha_yas532_mag_interface_init(
  11352. void);
  11353. /*!
  11354. * @brief This function used to set the YAS532 initial values
  11355. *
  11356. *
  11357. * @return results of bus communication function
  11358. * @retval 0 -> Success
  11359. * @retval -1 -> Error
  11360. *
  11361. *
  11362. */
  11363. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yas532_set_initial_values(void);
  11364. /*!
  11365. * @brief This function is used to perform YAS532 offset correction
  11366. *
  11367. *
  11368. * @return results of bus communication function
  11369. * @retval 0 -> Success
  11370. * @retval -1 -> Error
  11371. *
  11372. *
  11373. */
  11374. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yas532_magnetic_measure_set_offset(
  11375. void);
  11376. /*!
  11377. * @brief This function used to read the
  11378. * YAMAHA YAS532 calibration data
  11379. *
  11380. *
  11381. * @return results of bus communication function
  11382. * @retval 0 -> Success
  11383. * @retval -1 -> Error
  11384. *
  11385. *
  11386. */
  11387. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yamaha_yas532_calib_values(void);
  11388. /*!
  11389. * @brief This function is used to calculate the
  11390. * linear data in YAS532 sensor.
  11391. *
  11392. *
  11393. * @return results of bus communication function
  11394. * @retval 0 -> Success
  11395. * @retval -1 -> Error
  11396. *
  11397. *
  11398. */
  11399. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yas532_xy1y2_to_linear(
  11400. u16 *v_xy1y2_u16, s32 *xy1y2_linear);
  11401. /*!
  11402. * @brief This function is used to read the YAS532 sensor data
  11403. * @param v_acquisition_command_u8: used to set the data acquisition
  11404. * acquisition_command | operation
  11405. * ---------------------|-------------------------
  11406. * 0x17 | turn on the acquisition coil
  11407. * - | set direction of the coil
  11408. * _ | (x and y as minus(-))
  11409. * _ | Deferred acquisition mode
  11410. * 0x07 | turn on the acquisition coil
  11411. * _ | set direction of the coil
  11412. * _ | (x and y as minus(-))
  11413. * _ | Normal acquisition mode
  11414. * 0x11 | turn OFF the acquisition coil
  11415. * _ | set direction of the coil
  11416. * _ | (x and y as plus(+))
  11417. * _ | Deferred acquisition mode
  11418. * 0x01 | turn OFF the acquisition coil
  11419. * _ | set direction of the coil
  11420. * _ | (x and y as plus(+))
  11421. * _ | Normal acquisition mode
  11422. *
  11423. * @param v_busy_u8 : used to get the busy flag for sensor data read
  11424. * @param v_temp_u16 : used to get the temperature data
  11425. * @param v_xy1y2_u16 : used to get the sensor xy1y2 data
  11426. * @param v_overflow_u8 : used to get the overflow data
  11427. *
  11428. *
  11429. *
  11430. * @return results of bus communication function
  11431. * @retval 0 -> Success
  11432. * @retval -1 -> Error
  11433. *
  11434. *
  11435. */
  11436. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yas532_normal_measurement_data(
  11437. u8 v_acquisition_command_u8, u8 *v_busy_u8,
  11438. u16 *v_temp_u16, u16 *v_xy1y2_u16, u8 *v_overflow_u8);
  11439. /*!
  11440. * @brief This function is used to read the YAS532 sensor data
  11441. * @param v_acquisition_command_u8 : the value of CMDR
  11442. * acquisition_command | operation
  11443. * ---------------------|-------------------------
  11444. * 0x17 | turn on the acquisition coil
  11445. * - | set direction of the coil
  11446. * _ | (x and y as minus(-))
  11447. * _ | Deferred acquisition mode
  11448. * 0x07 | turn on the acquisition coil
  11449. * _ | set direction of the coil
  11450. * _ | (x and y as minus(-))
  11451. * _ | Normal acquisition mode
  11452. * 0x11 | turn OFF the acquisition coil
  11453. * _ | set direction of the coil
  11454. * _ | (x and y as plus(+))
  11455. * _ | Deferred acquisition mode
  11456. * 0x01 | turn OFF the acquisition coil
  11457. * _ | set direction of the coil
  11458. * _ | (x and y as plus(+))
  11459. * _ | Normal acquisition mode
  11460. *
  11461. * @param xyz_data : the vector xyz output
  11462. * @param v_overflow_s8 : the value of overflow
  11463. * @param v_temp_correction_u8 : the value of temperate correction enable
  11464. *
  11465. *
  11466. * @return results of bus communication function
  11467. * @retval 0 -> Success
  11468. * @retval -1 -> Error
  11469. *
  11470. *
  11471. */
  11472. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yas532_measurement_xyz_data(
  11473. struct yas532_vector *xyz_data, u8 *v_overflow_s8, u8 v_temp_correction_u8,
  11474. u8 v_acquisition_command_u8);
  11475. /*!
  11476. * @brief This function is used to write the data acquisition
  11477. * command register in YAS532 sensor.
  11478. * @param v_command_reg_data_u8 : the value of data acquisition
  11479. *
  11480. * acquisition_command | operation
  11481. * ---------------------|-------------------------
  11482. * 0x17 | turn on the acquisition coil
  11483. * - | set direction of the coil
  11484. * _ | (x and y as minus(-))
  11485. * _ | Deferred acquisition mode
  11486. * 0x07 | turn on the acquisition coil
  11487. * _ | set direction of the coil
  11488. * _ | (x and y as minus(-))
  11489. * _ | Normal acquisition mode
  11490. * 0x11 | turn OFF the acquisition coil
  11491. * _ | set direction of the coil
  11492. * _ | (x and y as plus(+))
  11493. * _ | Deferred acquisition mode
  11494. * 0x01 | turn OFF the acquisition coil
  11495. * _ | set direction of the coil
  11496. * _ | (x and y as plus(+))
  11497. * _ | Normal acquisition mode
  11498. *
  11499. *
  11500. *
  11501. * @return results of bus communication function
  11502. * @retval 0 -> Success
  11503. * @retval -1 -> Error
  11504. *
  11505. *
  11506. */
  11507. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yas532_acquisition_command_register(
  11508. u8 v_command_reg_data_u8);
  11509. /*!
  11510. * @brief This function is used write the offset for YAS532 sensor
  11511. *
  11512. * @param p_offset_s8 : The value of offset to write
  11513. *
  11514. *
  11515. * @return results of bus communication function
  11516. * @retval 0 -> Success
  11517. * @retval -1 -> Error
  11518. *
  11519. *
  11520. */
  11521. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yas532_set_offset(
  11522. const s8 *p_offset_s8);
  11523. /*!
  11524. * @brief This function is used to read YAS532 sensor data
  11525. *
  11526. *
  11527. * @param v_xy1y2_u16 : the vector xyz output
  11528. * @param v_overflow_s8 : the value of overflow
  11529. * @param v_temp_correction_u8 : the value of temperate correction enable
  11530. * @param v_temp_u16 : the value of temperature
  11531. * @param v_busy_u8 : the value denoting the sensor is busy
  11532. *
  11533. * @return results of bus communication function
  11534. * @retval 0 -> Success
  11535. * @retval -1 -> Error
  11536. *
  11537. *
  11538. */
  11539. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yas532_fifo_xyz_data(
  11540. u16 *v_xy1y2_u16, u8 v_temp_correction_u8,
  11541. s8 v_overflow_s8, u16 v_temp_u16, u8 v_busy_u8);
  11542. #endif
  11543. #endif