bmi160.h 376 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292
  1. /** \mainpage
  2. *
  3. ****************************************************************************
  4. * Copyright (C) 2014 Bosch Sensortec GmbH
  5. *
  6. * File : bmi160.h
  7. *
  8. * Date : 2014/12/12
  9. *
  10. * Revision : 2.0.5 $
  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 uses for 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. * These definition uses for 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 fixed 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 will execute for the compilers
  193. * which are not supported the C standards
  194. * Like C89/C99/C11***/
  195. #else
  196. /*!
  197. * @brief By default it is defined as 32 bit machine configuration
  198. * define your data types based on your
  199. * machine/compiler/controller configuration
  200. */
  201. #define MACHINE_32_BIT
  202. /* If your machine support 16 bit
  203. define the MACHINE_16_BIT*/
  204. #ifdef MACHINE_16_BIT
  205. #include <limits.h>
  206. /*signed integer types*/
  207. typedef signed char s8;/**< used for signed 8bit */
  208. typedef signed short int s16;/**< used for signed 16bit */
  209. typedef signed long int s32;/**< used for signed 32bit */
  210. #if defined(LONG_MAX) && LONG_MAX == 0x7fffffffffffffffL
  211. typedef long int s64;/**< used for signed 64bit */
  212. typedef unsigned long int u64;/**< used for unsigned 64bit */
  213. #elif defined(LLONG_MAX) && (LLONG_MAX == 0x7fffffffffffffffLL)
  214. typedef long long int s64;/**< used for signed 64bit */
  215. typedef unsigned long long int u64;/**< used for unsigned 64bit */
  216. #else
  217. #warning Either the correct data type for signed 64 bit integer \
  218. could not be found, or 64 bit integers are not supported in your environment.
  219. #warning If 64 bit integers are supported on your platform, \
  220. please set s64 manually.
  221. #endif
  222. /*unsigned integer types*/
  223. typedef unsigned char u8;/**< used for unsigned 8bit */
  224. typedef unsigned short int u16;/**< used for unsigned 16bit */
  225. typedef unsigned long int u32;/**< used for unsigned 32bit */
  226. /*! @brief If your machine support 32 bit
  227. define the MACHINE_32_BIT*/
  228. #elif defined MACHINE_32_BIT
  229. /*signed integer types*/
  230. typedef signed char s8;/**< used for signed 8bit */
  231. typedef signed short int s16;/**< used for signed 16bit */
  232. typedef signed int s32;/**< used for signed 32bit */
  233. typedef signed long long int s64;/**< used for signed 64bit */
  234. /*unsigned integer types*/
  235. typedef unsigned char u8;/**< used for unsigned 8bit */
  236. typedef unsigned short int u16;/**< used for unsigned 16bit */
  237. typedef unsigned int u32;/**< used for unsigned 32bit */
  238. typedef unsigned long long int u64;/**< used for unsigned 64bit */
  239. /* If your machine support 64 bit
  240. define the MACHINE_64_BIT*/
  241. #elif defined MACHINE_64_BIT
  242. /*signed integer types*/
  243. typedef signed char s8;/**< used for signed 8bit */
  244. typedef signed short int s16;/**< used for signed 16bit */
  245. typedef signed int s32;/**< used for signed 32bit */
  246. typedef signed long int s64;/**< used for signed 64bit */
  247. /*unsigned integer types*/
  248. typedef unsigned char u8;/**< used for unsigned 8bit */
  249. typedef unsigned short int u16;/**< used for unsigned 16bit */
  250. typedef unsigned int u32;/**< used for unsigned 32bit */
  251. typedef unsigned long int u64;/**< used for unsigned 64bit */
  252. #else
  253. #warning The data types defined above which not supported \
  254. define the data types manually
  255. #endif
  256. #endif
  257. #endif
  258. /***************************************************************/
  259. /**\name BUS READ AND WRITE FUNCTION POINTERS */
  260. /***************************************************************/
  261. /*!
  262. @brief Define the calling convention of YOUR bus communication routine.
  263. @note This includes types of parameters. This example shows the
  264. configuration for an SPI bus link.
  265. If your communication function looks like this:
  266. write_my_bus_xy(u8 device_addr, u8 register_addr,
  267. u8 * data, u8 length);
  268. The BMI160_WR_FUNC_PTR would equal:
  269. BMI160_WR_FUNC_PTR s8 (* bus_write)(u8,
  270. u8, u8 *, u8)
  271. Parameters can be mixed as needed refer to the
  272. @ref BMI160_BUS_WRITE_FUNC macro.
  273. */
  274. #define BMI160_WR_FUNC_PTR s8 (*bus_write)(u8, u8 ,\
  275. u8 *, u8)
  276. /**< link macro between API function calls and bus write function
  277. @note The bus write function can change since this is a
  278. system dependant issue.
  279. If the bus_write parameter calling order is like: reg_addr,
  280. reg_data, wr_len it would be as it is here.
  281. If the parameters are differently ordered or your communication
  282. function like I2C need to know the device address,
  283. you can change this macro accordingly.
  284. BMI160_BUS_WRITE_FUNC(dev_addr, reg_addr, reg_data, wr_len)\
  285. bus_write(dev_addr, reg_addr, reg_data, wr_len)
  286. This macro lets all API functions call YOUR communication routine in a
  287. way that equals your definition in the
  288. @ref BMI160_WR_FUNC_PTR definition.
  289. */
  290. #define BMI160_BUS_WRITE_FUNC(dev_addr, reg_addr, reg_data, wr_len)\
  291. bus_write(dev_addr, reg_addr, reg_data, wr_len)
  292. /**< Define the calling convention of YOUR bus communication routine.
  293. @note This includes types of parameters. This example shows the
  294. configuration for an SPI bus link.
  295. If your communication function looks like this:
  296. read_my_bus_xy(u8 device_addr, u8 register_addr,
  297. u8 * data, u8 length);
  298. The BMI160_RD_FUNC_PTR would equal:
  299. BMI160_RD_FUNC_PTR s8 (* bus_read)(u8,
  300. u8, u8 *, u8)
  301. Parameters can be mixed as needed refer to the
  302. refer BMI160_BUS_READ_FUNC macro.
  303. */
  304. #define BMI160_SPI_RD_MASK 0x80 /* for spi read transactions on SPI the
  305. MSB has to be set */
  306. #define BMI160_RD_FUNC_PTR s8 (*bus_read)(u8,\
  307. u8 , u8 *, u8)
  308. #define BMI160_BRD_FUNC_PTR s8 \
  309. (*burst_read)(u8, u8, u8 *, u32)
  310. /**< link macro between API function calls and bus read function
  311. @note The bus write function can change since this is a
  312. system dependant issue.
  313. If the bus_read parameter calling order is like: reg_addr,
  314. reg_data, wr_len it would be as it is here.
  315. If the parameters are differently ordered or your communication
  316. function like I2C need to know the device address,
  317. you can change this macro accordingly.
  318. BMI160_BUS_READ_FUNC(dev_addr, reg_addr, reg_data, wr_len)\
  319. bus_read(dev_addr, reg_addr, reg_data, wr_len)
  320. This macro lets all API functions call YOUR communication routine in a
  321. way that equals your definition in the
  322. refer BMI160_WR_FUNC_PTR definition.
  323. @note: this macro also includes the "MSB='1'
  324. for reading BMI160 addresses.
  325. */
  326. #define BMI160_BUS_READ_FUNC(dev_addr, reg_addr, reg_data, r_len)\
  327. bus_read(dev_addr, reg_addr, reg_data, r_len)
  328. #define BMI160_BURST_READ_FUNC(device_addr, \
  329. register_addr, register_data, rd_len)\
  330. burst_read(device_addr, register_addr, register_data, rd_len)
  331. #define BMI160_MDELAY_DATA_TYPE u32
  332. /***************************************************************/
  333. /**\name BUS READ AND WRITE FUNCTION POINTERS */
  334. /***************************************************************/
  335. #define BMI160_I2C_ADDR1 0x68 /**< I2C Address needs to be changed */
  336. #define BMI160_I2C_ADDR2 0x69 /**< I2C Address needs to be changed */
  337. #define BMI160_BMM150_I2C_ADDRESS 0x10/**< I2C address of BMM150*/
  338. #define BMI160_AKM09911_I2C_ADDRESS 0x0C/**< I2C address of AKM09911*/
  339. #define BMI160_YAS532_I2C_ADDRESS 0x2E/**< I2C address of YAS532*/
  340. /*******************************************/
  341. /**\name CONSTANTS */
  342. /******************************************/
  343. #define C_BMI160_ZERO_U8X ((u8)0)
  344. #define C_BMI160_ONE_U8X ((u8)1)
  345. #define C_BMI160_TWO_U8X ((u8)2)
  346. #define C_BMI160_THREE_U8X ((u8)3)
  347. #define C_BMI160_FOUR_U8X ((u8)4)
  348. #define C_BMI160_FIVE_U8X ((u8)5)
  349. #define C_BMI160_SIX_U8X ((u8)6)
  350. #define C_BMI160_SEVEN_U8X ((u8)7)
  351. #define C_BMI160_EIGHT_U8X ((u8)8)
  352. #define C_BMI160_NINE_U8X ((u8)9)
  353. #define C_BMI160_TEN_U8X ((u8)10)
  354. #define C_BMI160_ELEVEN_U8X ((u8)11)
  355. #define C_BMI160_TWELVE_U8X ((u8)12)
  356. #define C_BMI160_THIRTEEN_U8X ((u8)13)
  357. #define C_BMI160_FOURTEEN_U8X ((u8)14)
  358. #define C_BMI160_FIVETEEN_U8X ((u8)15)
  359. #define C_BMI160_SEVENTEEN_U8X ((u8)17)
  360. #define C_BMI160_EIGHTEEN_U8X ((u8)18)
  361. #define C_BMI160_NINETEEN_U8X ((u8)19)
  362. #define C_BMI160_TWENTY_U8X ((u8)20)
  363. #define C_BMI160_THIRTY_TWO_U8X ((u8)32)
  364. #define C_BMI160_THIRTY_EIGHT_U8X ((u8)38)
  365. #define C_BMI160_FIVETY_U8X ((u8)50)
  366. #define C_BMI160_SIXTY_U8X ((u8)60)
  367. #define C_BMI160_SIXTY_ONE_U8X ((u8)61)
  368. #define C_BMI160_SIXTY_FOUR_U8X ((u8)64)
  369. #define C_BMI160_HUNDRED_U8X ((u8)100)
  370. #define C_BMI160_TWO_HUNDRED_U8X ((u8)200)
  371. #define C_BMI160_THOUSAND_U8X ((u16)1000)
  372. #define C_BMI160_MINUS_ONE_S8X ((s8)-1)
  373. #define C_BMI160_FIFTEEN_U8X ((u8)15)
  374. #define C_BMI160_SIXTEEN_U8X ((u8)16)
  375. #define C_BMI160_THIRTYONE_U8X ((u8)31)
  376. #define C_BMI160_THIRTYTWO_U8X ((u8)32)
  377. #define BMI160_MAXIMUM_TIMEOUT ((u8)10)
  378. /****************************************************/
  379. /**\name ARRAY SIZE DEFINITIONS */
  380. /***************************************************/
  381. #define ARRAY_SIZE_TWO 2
  382. #define ARRAY_SIZE_THREE 3
  383. #define ARRAY_SIZE_SIX 6
  384. #define ARRAY_SIZE_FIVE 5
  385. #define ARRAY_SIZE_EIGHT 8
  386. #define ARRAY_SIZE_SIXTEEN 16
  387. #define ARRAY_SIZE_FOURTEEN 14
  388. #define INDEX_ZERO 0
  389. #define INDEX_ONE 1
  390. #define INDEX_TWO 2
  391. #define INDEX_THREE 3
  392. #define INDEX_FOUR 4
  393. #define INDEX_FIVE 5
  394. #define INDEX_SIX 6
  395. #define INDEX_SEVEN 7
  396. #define INDEX_EIGHT 8
  397. #define INDEX_NINE 9
  398. #define INDEX_TEN 10
  399. #define INDEX_ELEVEN 11
  400. #define INDEX_TWELVE 12
  401. #define INDEX_THIRTEEN 13
  402. /****************************************************/
  403. /**\name ARRAY PARAMETERS */
  404. /***************************************************/
  405. #define LSB_ZERO 0
  406. #define MSB_ONE 1
  407. #define LSB_TWO 2
  408. #define MSB_THREE 3
  409. #define LSB_FOUR 4
  410. #define MSB_FIVE 5
  411. #define LSB_SIX 6
  412. #define MSB_SEVEN 7
  413. /****************************************************/
  414. /**\name ERROR CODES */
  415. /***************************************************/
  416. #define E_BMI160_NULL_PTR ((s8)-127)
  417. #define E_BMI160_COMM_RES ((s8)-1)
  418. #define E_BMI160_OUT_OF_RANGE ((s8)-2)
  419. #define E_BMI160_BUSY ((s8)-3)
  420. #define SUCCESS ((u8)0)
  421. #define ERROR ((s8)-1)
  422. /* Constants */
  423. #define BMI160_NULL 0
  424. #define BMI160_DELAY_SETTLING_TIME 5
  425. /*This refers BMI160 return type as s8 */
  426. #define BMI160_RETURN_FUNCTION_TYPE s8
  427. /****************************************************/
  428. /**\name REGISTER DEFINITIONS */
  429. /***************************************************/
  430. /*******************/
  431. /**\name CHIP ID */
  432. /*******************/
  433. #define BMI160_USER_CHIP_ID_ADDR 0x00
  434. /*******************/
  435. /**\name ERROR STATUS */
  436. /*******************/
  437. #define BMI160_USER_ERROR_ADDR 0X02
  438. /*******************/
  439. /**\name POWER MODE STATUS */
  440. /*******************/
  441. #define BMI160_USER_PMU_STAT_ADDR 0X03
  442. /*******************/
  443. /**\name MAG DATA REGISTERS */
  444. /*******************/
  445. #define BMI160_USER_DATA_0_ADDR 0X04
  446. #define BMI160_USER_DATA_1_ADDR 0X05
  447. #define BMI160_USER_DATA_2_ADDR 0X06
  448. #define BMI160_USER_DATA_3_ADDR 0X07
  449. #define BMI160_USER_DATA_4_ADDR 0X08
  450. #define BMI160_USER_DATA_5_ADDR 0X09
  451. #define BMI160_USER_DATA_6_ADDR 0X0A
  452. #define BMI160_USER_DATA_7_ADDR 0X0B
  453. /*******************/
  454. /**\name GYRO DATA REGISTERS */
  455. /*******************/
  456. #define BMI160_USER_DATA_8_ADDR 0X0C
  457. #define BMI160_USER_DATA_9_ADDR 0X0D
  458. #define BMI160_USER_DATA_10_ADDR 0X0E
  459. #define BMI160_USER_DATA_11_ADDR 0X0F
  460. #define BMI160_USER_DATA_12_ADDR 0X10
  461. #define BMI160_USER_DATA_13_ADDR 0X11
  462. #define BMI160_USER_DATA_14_ADDR 0X12
  463. #define BMI160_USER_DATA_15_ADDR 0X13
  464. /*******************/
  465. /**\name ACCEL DATA REGISTERS */
  466. /*******************/
  467. #define BMI160_USER_DATA_16_ADDR 0X14
  468. #define BMI160_USER_DATA_17_ADDR 0X15
  469. #define BMI160_USER_DATA_18_ADDR 0X16
  470. #define BMI160_USER_DATA_19_ADDR 0X17
  471. /*******************/
  472. /**\name SENSOR TIME REGISTERS */
  473. /*******************/
  474. #define BMI160_USER_SENSORTIME_0_ADDR 0X18
  475. #define BMI160_USER_SENSORTIME_1_ADDR 0X19
  476. #define BMI160_USER_SENSORTIME_2_ADDR 0X1A
  477. /*******************/
  478. /**\name STATUS REGISTER FOR SENSOR STATUS FLAG */
  479. /*******************/
  480. #define BMI160_USER_STAT_ADDR 0X1B
  481. /*******************/
  482. /**\name INTERRUPY STATUS REGISTERS */
  483. /*******************/
  484. #define BMI160_USER_INTR_STAT_0_ADDR 0X1C
  485. #define BMI160_USER_INTR_STAT_1_ADDR 0X1D
  486. #define BMI160_USER_INTR_STAT_2_ADDR 0X1E
  487. #define BMI160_USER_INTR_STAT_3_ADDR 0X1F
  488. /*******************/
  489. /**\name TEMPERATURE REGISTERS */
  490. /*******************/
  491. #define BMI160_USER_TEMPERATURE_0_ADDR 0X20
  492. #define BMI160_USER_TEMPERATURE_1_ADDR 0X21
  493. /*******************/
  494. /**\name FIFO REGISTERS */
  495. /*******************/
  496. #define BMI160_USER_FIFO_LENGTH_0_ADDR 0X22
  497. #define BMI160_USER_FIFO_LENGTH_1_ADDR 0X23
  498. #define BMI160_USER_FIFO_DATA_ADDR 0X24
  499. /***************************************************/
  500. /**\name ACCEL CONFIG REGISTERS FOR ODR, BANDWIDTH AND UNDERSAMPLING*/
  501. /******************************************************/
  502. #define BMI160_USER_ACCEL_CONFIG_ADDR 0X40
  503. /*******************/
  504. /**\name ACCEL RANGE */
  505. /*******************/
  506. #define BMI160_USER_ACCEL_RANGE_ADDR 0X41
  507. /***************************************************/
  508. /**\name GYRO CONFIG REGISTERS FOR ODR AND BANDWIDTH */
  509. /******************************************************/
  510. #define BMI160_USER_GYRO_CONFIG_ADDR 0X42
  511. /*******************/
  512. /**\name GYRO RANGE */
  513. /*******************/
  514. #define BMI160_USER_GYRO_RANGE_ADDR 0X43
  515. /***************************************************/
  516. /**\name MAG CONFIG REGISTERS FOR ODR*/
  517. /******************************************************/
  518. #define BMI160_USER_MAG_CONFIG_ADDR 0X44
  519. /***************************************************/
  520. /**\name REGISTER FOR GYRO AND ACCEL DOWNSAMPLING RATES FOR FIFO*/
  521. /******************************************************/
  522. #define BMI160_USER_FIFO_DOWN_ADDR 0X45
  523. /***************************************************/
  524. /**\name FIFO CONFIG REGISTERS*/
  525. /******************************************************/
  526. #define BMI160_USER_FIFO_CONFIG_0_ADDR 0X46
  527. #define BMI160_USER_FIFO_CONFIG_1_ADDR 0X47
  528. /***************************************************/
  529. /**\name MAG INTERFACE REGISTERS*/
  530. /******************************************************/
  531. #define BMI160_USER_MAG_IF_0_ADDR 0X4B
  532. #define BMI160_USER_MAG_IF_1_ADDR 0X4C
  533. #define BMI160_USER_MAG_IF_2_ADDR 0X4D
  534. #define BMI160_USER_MAG_IF_3_ADDR 0X4E
  535. #define BMI160_USER_MAG_IF_4_ADDR 0X4F
  536. /***************************************************/
  537. /**\name INTERRUPT ENABLE REGISTERS*/
  538. /******************************************************/
  539. #define BMI160_USER_INTR_ENABLE_0_ADDR 0X50
  540. #define BMI160_USER_INTR_ENABLE_1_ADDR 0X51
  541. #define BMI160_USER_INTR_ENABLE_2_ADDR 0X52
  542. #define BMI160_USER_INTR_OUT_CTRL_ADDR 0X53
  543. /***************************************************/
  544. /**\name LATCH DURATION REGISTERS*/
  545. /******************************************************/
  546. #define BMI160_USER_INTR_LATCH_ADDR 0X54
  547. /***************************************************/
  548. /**\name MAP INTERRUPT 1 and 2 REGISTERS*/
  549. /******************************************************/
  550. #define BMI160_USER_INTR_MAP_0_ADDR 0X55
  551. #define BMI160_USER_INTR_MAP_1_ADDR 0X56
  552. #define BMI160_USER_INTR_MAP_2_ADDR 0X57
  553. /***************************************************/
  554. /**\name DATA SOURCE REGISTERS*/
  555. /******************************************************/
  556. #define BMI160_USER_INTR_DATA_0_ADDR 0X58
  557. #define BMI160_USER_INTR_DATA_1_ADDR 0X59
  558. /***************************************************/
  559. /**\name
  560. INTERRUPT THRESHOLD, HYSTERESIS, DURATION, MODE CONFIGURATION REGISTERS*/
  561. /******************************************************/
  562. #define BMI160_USER_INTR_LOWHIGH_0_ADDR 0X5A
  563. #define BMI160_USER_INTR_LOWHIGH_1_ADDR 0X5B
  564. #define BMI160_USER_INTR_LOWHIGH_2_ADDR 0X5C
  565. #define BMI160_USER_INTR_LOWHIGH_3_ADDR 0X5D
  566. #define BMI160_USER_INTR_LOWHIGH_4_ADDR 0X5E
  567. #define BMI160_USER_INTR_MOTION_0_ADDR 0X5F
  568. #define BMI160_USER_INTR_MOTION_1_ADDR 0X60
  569. #define BMI160_USER_INTR_MOTION_2_ADDR 0X61
  570. #define BMI160_USER_INTR_MOTION_3_ADDR 0X62
  571. #define BMI160_USER_INTR_TAP_0_ADDR 0X63
  572. #define BMI160_USER_INTR_TAP_1_ADDR 0X64
  573. #define BMI160_USER_INTR_ORIENT_0_ADDR 0X65
  574. #define BMI160_USER_INTR_ORIENT_1_ADDR 0X66
  575. #define BMI160_USER_INTR_FLAT_0_ADDR 0X67
  576. #define BMI160_USER_INTR_FLAT_1_ADDR 0X68
  577. /***************************************************/
  578. /**\name FAST OFFSET CONFIGURATION REGISTER*/
  579. /******************************************************/
  580. #define BMI160_USER_FOC_CONFIG_ADDR 0X69
  581. /***************************************************/
  582. /**\name MISCELLANEOUS CONFIGURATION REGISTER*/
  583. /******************************************************/
  584. #define BMI160_USER_CONFIG_ADDR 0X6A
  585. /***************************************************/
  586. /**\name SERIAL INTERFACE SETTINGS REGISTER*/
  587. /******************************************************/
  588. #define BMI160_USER_IF_CONFIG_ADDR 0X6B
  589. /***************************************************/
  590. /**\name GYRO POWER MODE TRIGGER REGISTER */
  591. /******************************************************/
  592. #define BMI160_USER_PMU_TRIGGER_ADDR 0X6C
  593. /***************************************************/
  594. /**\name SELF_TEST REGISTER*/
  595. /******************************************************/
  596. #define BMI160_USER_SELF_TEST_ADDR 0X6D
  597. /***************************************************/
  598. /**\name SPI,I2C SELECTION REGISTER*/
  599. /******************************************************/
  600. #define BMI160_USER_NV_CONFIG_ADDR 0x70
  601. /***************************************************/
  602. /**\name ACCEL AND GYRO OFFSET REGISTERS*/
  603. /******************************************************/
  604. #define BMI160_USER_OFFSET_0_ADDR 0X71
  605. #define BMI160_USER_OFFSET_1_ADDR 0X72
  606. #define BMI160_USER_OFFSET_2_ADDR 0X73
  607. #define BMI160_USER_OFFSET_3_ADDR 0X74
  608. #define BMI160_USER_OFFSET_4_ADDR 0X75
  609. #define BMI160_USER_OFFSET_5_ADDR 0X76
  610. #define BMI160_USER_OFFSET_6_ADDR 0X77
  611. /***************************************************/
  612. /**\name STEP COUNTER INTERRUPT REGISTERS*/
  613. /******************************************************/
  614. #define BMI160_USER_STEP_COUNT_0_ADDR 0X78
  615. #define BMI160_USER_STEP_COUNT_1_ADDR 0X79
  616. /***************************************************/
  617. /**\name STEP COUNTER CONFIGURATION REGISTERS*/
  618. /******************************************************/
  619. #define BMI160_USER_STEP_CONFIG_0_ADDR 0X7A
  620. #define BMI160_USER_STEP_CONFIG_1_ADDR 0X7B
  621. /***************************************************/
  622. /**\name COMMAND REGISTER*/
  623. /******************************************************/
  624. #define BMI160_CMD_COMMANDS_ADDR 0X7E
  625. /***************************************************/
  626. /**\name PAGE REGISTERS*/
  627. /******************************************************/
  628. #define BMI160_CMD_EXT_MODE_ADDR 0X7F
  629. #define BMI160_COM_C_TRIM_FIVE_ADDR 0X85
  630. /****************************************************/
  631. /**\name SHIFT VALUE DEFINITION */
  632. /***************************************************/
  633. #define BMI160_SHIFT_1_POSITION 1
  634. #define BMI160_SHIFT_2_POSITION 2
  635. #define BMI160_SHIFT_3_POSITION 3
  636. #define BMI160_SHIFT_4_POSITION 4
  637. #define BMI160_SHIFT_5_POSITION 5
  638. #define BMI160_SHIFT_6_POSITION 6
  639. #define BMI160_SHIFT_7_POSITION 7
  640. #define BMI160_SHIFT_8_POSITION 8
  641. #define BMI160_SHIFT_9_POSITION 9
  642. #define BMI160_SHIFT_12_POSITION 12
  643. #define BMI160_SHIFT_13_POSITION 13
  644. #define BMI160_SHIFT_14_POSITION 14
  645. #define BMI160_SHIFT_15_POSITION 15
  646. #define BMI160_SHIFT_16_POSITION 16
  647. /****************************************************/
  648. /**\name DEFINITIONS USED FOR YAMAHA-YAS532 */
  649. /***************************************************/
  650. #define YAS532_MAG_STATE_NORMAL (0)
  651. #define YAS532_MAG_STATE_INIT_COIL (1)
  652. #define YAS532_MAG_STATE_MEASURE_OFFSET (2)
  653. #define YAS532_MAG_INITCOIL_TIMEOUT (1000)
  654. #define YAS532_MAG_NOTRANS_POSITION (3)
  655. #define YAS532_DEFAULT_SENSOR_DELAY (50)
  656. #define YAS532_DATA_OVERFLOW (8190)
  657. #define YAS532_DATA_UNDERFLOW (0)
  658. #define YAS532_MAG_TEMPERATURE_LOG (10)
  659. #define YAS532_TEMP20DEGREE_TYPICAL (390)
  660. #define YAS532_VERSION_AC_COEF_X (850)
  661. #define YAS532_VERSION_AC_COEF_Y1 (750)
  662. #define YAS532_VERSION_AC_COEF_Y2 (750)
  663. #define YAS532_DATA_CENTER (4096)
  664. /****************************************************/
  665. /**\name YAMAHA-YAS532 OFFSET DEFINITION */
  666. /***************************************************/
  667. static const s8 INVALID_OFFSET[] = {0x7f, 0x7f, 0x7f};
  668. #define set_vector(to, from) \
  669. {int _l; for (_l = 0; _l < 3; _l++) (to)[_l] = (from)[_l]; }
  670. #define is_valid_offset(a) \
  671. (((a)[0] <= 31) && ((a)[1] <= 31) && ((a)[2] <= 31) \
  672. && (-31 <= (a)[0]) && (-31 <= (a)[1]) && (-31 <= (a)[2]))
  673. /**************************************************/
  674. /**\name YAS532 CALIB DATA DEFINITIONS */
  675. /*************************************************/
  676. #define YAS532_CALIB_THOUSAND_TWO_EIGHTY 1280
  677. #define YAS532_CALIB_HEX_ZERO_THREE_F 0x03F
  678. #define YAS532_CALIB_HEX_ZERO_C 0x0C
  679. #define YAS532_CALIB_HEX_ZERO_THREE 0x03
  680. #define YAS532_CALIB_HEX_THREE_F 0x3F
  681. #define YAS532_CALIB_HEX_THREE_ZERO 0x30
  682. #define YAS532_CALIB_HEX_ZERO_F 0x0F
  683. #define YAS532_CALIB_HEX_SEVEN_EIGHT 0x78
  684. #define YAS532_CALIB_HEX_ZERO_SEVEN 0x07
  685. #define YAS532_CALIB_HEX_THREE_E 0x3E
  686. #define YAS532_CALIB_HEX_ZERO_ONE 0x01
  687. #define YAS532_CALIB_HEX_F_E 0xFE
  688. #define YAS532_CALIB_HEX_ONE_F 0x1F
  689. #define YAS532_CALIB_CX 0
  690. #define YAS532_CALIB_CY1 1
  691. #define YAS532_CALIB_CY2 2
  692. /* register address of YAS532*/
  693. #define BMI160_YAS532_TESTR1 0x88
  694. #define BMI160_YAS532_TESTR2 0x89
  695. #define BMI160_YAS532_RCOIL 0x81
  696. #define BMI160_YAS532_COMMAND_REGISTER 0x82
  697. #define BMI160_YAS532_DATA_REGISTER 0xB0
  698. /* calib data register definition*/
  699. #define BMI160_YAS532_CALIB_CX 0x90
  700. #define BMI160_YAS532_CALIB_CY1 0x91
  701. #define BMI160_YAS532_CALIB_CY2 0x92
  702. #define BMI160_YAS532_CALIB1 0x93
  703. #define BMI160_YAS532_CALIB2 0x94
  704. #define BMI160_YAS532_CALIB3 0x95
  705. #define BMI160_YAS532_CALIB4 0x96
  706. #define BMI160_YAS532_CALIB5 0x97
  707. #define BMI160_YAS532_CLAIB6 0x98
  708. #define BMI160_YAS532_CALIB7 0x99
  709. #define BMI160_YAS532_CALIB8 0x9A
  710. #define BMI160_YAS532_CALIIB9 0x9B
  711. #define BMI160_YAS532_CALIB10 0x9C
  712. #define BMI160_YAS532_CALIB11 0x9D
  713. /* offset definition */
  714. #define BMI160_YAS532_OFFSET_X 0x85
  715. #define BMI160_YAS532_OFFSET_Y 0x86
  716. #define BMI160_YAS532_OFFSET_Z 0x87
  717. /* data to write register for yas532*/
  718. #define BMI160_YAS532_WRITE_DATA_ZERO 0x00
  719. /**************************************************/
  720. /**\name YAS532 DATA REGISTER */
  721. /*************************************************/
  722. #define YAS532_HEX_ZERO_ONE 0x01
  723. #define YAS532_HEX_THREE_F_EIGHT 0x3F8
  724. #define YAS532_HEX_ZERO_SEVEN 0x07
  725. #define YAS532_HEX_ONE_F_C_ZERO 0x1FC0
  726. #define YAS532_HEX_THREE_F 0x3F
  727. /**************************************************/
  728. /**\name YAS532 OFFSET */
  729. /*************************************************/
  730. #define YAS532_CORRECT_OFFSET_16 16
  731. #define YAS532_CORRECT_OFFSET_8 8
  732. #define YAS532_CORRECT_OFFSET_4 4
  733. #define YAS532_CORRECT_OFFSET_2 2
  734. #define YAS532_CORRECT_OFFSET_1 1
  735. #define CALIB_LINEAR_3721 3721
  736. #define CALIB_LINEAR_3971 3971
  737. #define CALIB_LINEAR_4221 4221
  738. #define CALIB_LINEAR_4471 4471
  739. /****************************************************/
  740. /**\name AKM09911 DEFINITION */
  741. /***************************************************/
  742. #define AKM09911_SENSITIVITY_DIV 128
  743. #define AKM_ASAX 0
  744. #define AKM_ASAY 1
  745. #define AKM_ASAZ 2
  746. #define AKM_POWER_DOWN_MODE_DATA 0x00
  747. #define AKM_FUSE_ROM_MODE 0x1F
  748. #define AKM_POWER_MODE_REG 0x31
  749. #define AKM_SINGLE_MEASUREMENT_MODE 0x01
  750. #define AKM_DATA_REGISTER 0x11
  751. /****************************************************/
  752. /**\name BMM150 DEFINITION */
  753. /***************************************************/
  754. #define BMM150_HEX_0_1_DATA 0x01
  755. #define BMM150_HEX_0_0_DATA 0x00
  756. #define BMM150_MAX_RETRY_WAKEUP 5
  757. #define BMM150_POWER_ON 0x01
  758. #define BMM150_POWER_OFF 0x00
  759. #define BMM150_FORCE_MODE 0x02
  760. #define BMM150_POWER_ON_SUCCESS 0
  761. #define BMM150_POWER_ON_FAIL ((s8)-1)
  762. #define BMM150_CALIB_HEX_FOUR_THOUSAND 0x4000
  763. #define BMM150_CALIB_HEX_LACKS 0x100000
  764. #define BMM150_CALIB_HEX_A_ZERO 0xA0
  765. #define BMM150_DIG_X1 0
  766. #define BMM150_DIG_Y1 1
  767. #define BMM150_DIG_X2 2
  768. #define BMM150_DIG_Y3 3
  769. #define BMM150_DIG_XY1 4
  770. #define BMM150_DIG_XY2 5
  771. #define BMM150_DIG_Z1_LSB 6
  772. #define BMM150_DIG_Z1_MSB 7
  773. #define BMM150_DIG_Z2_LSB 8
  774. #define BMM150_DIG_Z2_MSB 9
  775. #define BMM150_DIG_DIG_Z3_LSB 10
  776. #define BMM150_DIG_DIG_Z3_MSB 11
  777. #define BMM150_DIG_DIG_Z4_LSB 12
  778. #define BMM150_DIG_DIG_Z4_MSB 13
  779. #define BMM150_DIG_DIG_XYZ1_LSB 14
  780. #define BMM150_DIG_DIG_XYZ1_MSB 15
  781. /**************************************************************/
  782. /**\name STRUCTURE DEFINITIONS */
  783. /**************************************************************/
  784. /*!
  785. * @brief bmi160 structure
  786. * This structure holds all relevant information about bmi160
  787. */
  788. struct bmi160_t {
  789. u8 chip_id;/**< chip id of BMI160 */
  790. u8 dev_addr;/**< device address of BMI160 */
  791. u8 mag_manual_enable;/**< used for check the mag manual/auto mode status */
  792. BMI160_WR_FUNC_PTR;/**< bus write function pointer */
  793. BMI160_RD_FUNC_PTR;/**< bus read function pointer */
  794. BMI160_BRD_FUNC_PTR;/**< burst write function pointer */
  795. void (*delay_msec)(BMI160_MDELAY_DATA_TYPE);/**< delay function pointer */
  796. };
  797. /*!
  798. * @brief Structure containing bmm150 and akm09911
  799. * magnetometer values for x,y and
  800. * z-axis in s16
  801. */
  802. struct bmi160_mag_t {
  803. s16 x;/**< BMM150 and AKM09911 X raw data*/
  804. s16 y;/**< BMM150 and AKM09911 Y raw data*/
  805. s16 z;/**< BMM150 and AKM09911 Z raw data*/
  806. };
  807. /*!
  808. * @brief Structure containing bmm150 xyz data and temperature
  809. */
  810. struct bmi160_mag_xyzr_t {
  811. s16 x;/**< BMM150 X raw data*/
  812. s16 y;/**< BMM150 Y raw data*/
  813. s16 z;/**<BMM150 Z raw data*/
  814. u16 r;/**<BMM150 R raw data*/
  815. };
  816. /*!
  817. * @brief Structure containing gyro xyz data
  818. */
  819. struct bmi160_gyro_t {
  820. s16 x;/**<gyro X data*/
  821. s16 y;/**<gyro Y data*/
  822. s16 z;/**<gyro Z data*/
  823. };
  824. /*!
  825. * @brief Structure containing accel xyz data
  826. */
  827. struct bmi160_accel_t {
  828. s16 x;/**<accel X data*/
  829. s16 y;/**<accel Y data*/
  830. s16 z;/**<accel Z data*/
  831. };
  832. /*!
  833. * @brief Structure bmm150 mag compensated data with s32 output
  834. */
  835. struct bmi160_mag_xyz_s32_t {
  836. s32 x;/**<BMM150 X compensated data*/
  837. s32 y;/**<BMM150 Y compensated data*/
  838. s32 z;/**<BMM150 Z compensated data*/
  839. };
  840. /*!
  841. * @brief Structure bmm150 mag trim data
  842. */
  843. struct trim_data_t {
  844. s8 dig_x1;/**<BMM150 trim x1 data*/
  845. s8 dig_y1;/**<BMM150 trim y1 data*/
  846. s8 dig_x2;/**<BMM150 trim x2 data*/
  847. s8 dig_y2;/**<BMM150 trim y2 data*/
  848. u16 dig_z1;/**<BMM150 trim z1 data*/
  849. s16 dig_z2;/**<BMM150 trim z2 data*/
  850. s16 dig_z3;/**<BMM150 trim z3 data*/
  851. s16 dig_z4;/**<BMM150 trim z4 data*/
  852. u8 dig_xy1;/**<BMM150 trim xy1 data*/
  853. s8 dig_xy2;/**<BMM150 trim xy2 data*/
  854. u16 dig_xyz1;/**<BMM150 trim xyz1 data*/
  855. };
  856. /*!
  857. * @brief Used to read the akm compensated values
  858. */
  859. struct bmi160_bst_akm_xyz_t {
  860. s16 x;/**<AKM09911 X compensated data*/
  861. s16 y;/**<AKM09911 Y compensated data*/
  862. s16 z;/**<AKM09911 Z compensated data*/
  863. };
  864. /*!
  865. * @brief Structure for reading AKM compensating data
  866. */
  867. struct bst_akm_sensitivity_data_t {
  868. s8 asax;/**<AKM09911 X sensitivity data*/
  869. s8 asay;/**<AKM09911 Y sensitivity data*/
  870. s8 asaz;/**<AKM09911 Z sensitivity data*/
  871. };
  872. /*!
  873. * @brief YAMAHA-YAS532 struct
  874. * Calibration YAS532 data struct
  875. */
  876. struct bst_yas532_calib_data_t {
  877. s32 cx;/**<YAS532 calib cx data */
  878. s32 cy1;/**<YAS532 calib cy1 data */
  879. s32 cy2;/**<YAS532 calib cy2 data */
  880. s32 a2;/**<YAS532 calib a2 data */
  881. s32 a3;/**<YAS532 calib a3 data */
  882. s32 a4;/**<YAS532 calib a4 data */
  883. s32 a5;/**<YAS532 calib a5 data */
  884. s32 a6;/**<YAS532 calib a6 data */
  885. s32 a7;/**<YAS532 calib a7 data */
  886. s32 a8;/**<YAS532 calib a8 data */
  887. s32 a9;/**<YAS532 calib a9 data */
  888. s32 k;/**<YAS532 calib k data */
  889. s8 rxy1y2[3];/**<YAS532 calib rxy1y2 data */
  890. u8 fxy1y2[3];/**<YAS532 calib fxy1y2 data */
  891. };
  892. /*!
  893. * @brief YAS532 Temperature structure
  894. */
  895. #if 1 < YAS532_MAG_TEMPERATURE_LOG
  896. struct yas_temp_filter_t {
  897. u16 log[YAS532_MAG_TEMPERATURE_LOG];/**<YAS532 temp log array */
  898. u8 num;/**< used for increment the index */
  899. u8 idx;/**< used for increment the index */
  900. };
  901. #endif
  902. /*!
  903. * @brief YAS532 sensor initialization
  904. */
  905. struct yas532_t {
  906. struct bst_yas532_calib_data_t calib_yas532;/**< calib data */
  907. s8 measure_state;/**< update measure state */
  908. s8 v_hard_offset_s8[3];/**< offset write array*/
  909. s32 coef[3];/**< co efficient data */
  910. s8 overflow;/**< over flow condition check */
  911. u8 dev_id;/**< device id information */
  912. const s8 *transform;/**< transform condition check */
  913. #if 1 < YAS532_MAG_TEMPERATURE_LOG
  914. struct yas_temp_filter_t temp_data;/**< temp data */
  915. #endif
  916. u16 last_raw[4];/**< raw data */
  917. };
  918. /*!
  919. * @brief Used for reading the YAS532 XYZ data
  920. */
  921. struct yas532_vector {
  922. s32 yas532_vector_xyz[3];/**< YAS532 compensated xyz data*/
  923. };
  924. /**************************************************************/
  925. /**\name USER DATA REGISTERS DEFINITION START */
  926. /**************************************************************/
  927. /**************************************************************/
  928. /**\name CHIP ID LENGTH, POSITION AND MASK */
  929. /**************************************************************/
  930. /* Chip ID Description - Reg Addr --> 0x00, Bit --> 0...7 */
  931. #define BMI160_USER_CHIP_ID__POS 0
  932. #define BMI160_USER_CHIP_ID__MSK 0xFF
  933. #define BMI160_USER_CHIP_ID__LEN 8
  934. #define BMI160_USER_CHIP_ID__REG BMI160_USER_CHIP_ID_ADDR
  935. /**************************************************************/
  936. /**\name ERROR STATUS LENGTH, POSITION AND MASK */
  937. /**************************************************************/
  938. /* Error Description - Reg Addr --> 0x02, Bit --> 0 */
  939. #define BMI160_USER_ERR_STAT__POS 0
  940. #define BMI160_USER_ERR_STAT__LEN 8
  941. #define BMI160_USER_ERR_STAT__MSK 0xFF
  942. #define BMI160_USER_ERR_STAT__REG BMI160_USER_ERROR_ADDR
  943. #define BMI160_USER_FATAL_ERR__POS 0
  944. #define BMI160_USER_FATAL_ERR__LEN 1
  945. #define BMI160_USER_FATAL_ERR__MSK 0x01
  946. #define BMI160_USER_FATAL_ERR__REG BMI160_USER_ERROR_ADDR
  947. /* Error Description - Reg Addr --> 0x02, Bit --> 1...4 */
  948. #define BMI160_USER_ERR_CODE__POS 1
  949. #define BMI160_USER_ERR_CODE__LEN 4
  950. #define BMI160_USER_ERR_CODE__MSK 0x1E
  951. #define BMI160_USER_ERR_CODE__REG BMI160_USER_ERROR_ADDR
  952. /* Error Description - Reg Addr --> 0x02, Bit --> 5 */
  953. #define BMI160_USER_I2C_FAIL_ERR__POS 5
  954. #define BMI160_USER_I2C_FAIL_ERR__LEN 1
  955. #define BMI160_USER_I2C_FAIL_ERR__MSK 0x20
  956. #define BMI160_USER_I2C_FAIL_ERR__REG BMI160_USER_ERROR_ADDR
  957. /* Error Description - Reg Addr --> 0x02, Bit --> 6 */
  958. #define BMI160_USER_DROP_CMD_ERR__POS 6
  959. #define BMI160_USER_DROP_CMD_ERR__LEN 1
  960. #define BMI160_USER_DROP_CMD_ERR__MSK 0x40
  961. #define BMI160_USER_DROP_CMD_ERR__REG BMI160_USER_ERROR_ADDR
  962. /**************************************************************/
  963. /**\name MAG DATA READY LENGTH, POSITION AND MASK */
  964. /**************************************************************/
  965. /* Error Description - Reg Addr --> 0x02, Bit --> 7 */
  966. #define BMI160_USER_MAG_DADA_RDY_ERR__POS 7
  967. #define BMI160_USER_MAG_DADA_RDY_ERR__LEN 1
  968. #define BMI160_USER_MAG_DADA_RDY_ERR__MSK 0x80
  969. #define BMI160_USER_MAG_DADA_RDY_ERR__REG BMI160_USER_ERROR_ADDR
  970. /**************************************************************/
  971. /**\name MAG POWER MODE LENGTH, POSITION AND MASK */
  972. /**************************************************************/
  973. /* PMU_Status Description of MAG - Reg Addr --> 0x03, Bit --> 1..0 */
  974. #define BMI160_USER_MAG_POWER_MODE_STAT__POS 0
  975. #define BMI160_USER_MAG_POWER_MODE_STAT__LEN 2
  976. #define BMI160_USER_MAG_POWER_MODE_STAT__MSK 0x03
  977. #define BMI160_USER_MAG_POWER_MODE_STAT__REG \
  978. BMI160_USER_PMU_STAT_ADDR
  979. /**************************************************************/
  980. /**\name GYRO POWER MODE LENGTH, POSITION AND MASK */
  981. /**************************************************************/
  982. /* PMU_Status Description of GYRO - Reg Addr --> 0x03, Bit --> 3...2 */
  983. #define BMI160_USER_GYRO_POWER_MODE_STAT__POS 2
  984. #define BMI160_USER_GYRO_POWER_MODE_STAT__LEN 2
  985. #define BMI160_USER_GYRO_POWER_MODE_STAT__MSK 0x0C
  986. #define BMI160_USER_GYRO_POWER_MODE_STAT__REG \
  987. BMI160_USER_PMU_STAT_ADDR
  988. /**************************************************************/
  989. /**\name ACCEL POWER MODE LENGTH, POSITION AND MASK */
  990. /**************************************************************/
  991. /* PMU_Status Description of ACCEL - Reg Addr --> 0x03, Bit --> 5...4 */
  992. #define BMI160_USER_ACCEL_POWER_MODE_STAT__POS 4
  993. #define BMI160_USER_ACCEL_POWER_MODE_STAT__LEN 2
  994. #define BMI160_USER_ACCEL_POWER_MODE_STAT__MSK 0x30
  995. #define BMI160_USER_ACCEL_POWER_MODE_STAT__REG \
  996. BMI160_USER_PMU_STAT_ADDR
  997. /**************************************************************/
  998. /**\name MAG DATA XYZ LENGTH, POSITION AND MASK */
  999. /**************************************************************/
  1000. /* Mag_X(LSB) Description - Reg Addr --> 0x04, Bit --> 0...7 */
  1001. #define BMI160_USER_DATA_0_MAG_X_LSB__POS 0
  1002. #define BMI160_USER_DATA_0_MAG_X_LSB__LEN 8
  1003. #define BMI160_USER_DATA_0_MAG_X_LSB__MSK 0xFF
  1004. #define BMI160_USER_DATA_0_MAG_X_LSB__REG BMI160_USER_DATA_0_ADDR
  1005. /* Mag_X(LSB) Description - Reg Addr --> 0x04, Bit --> 3...7 */
  1006. #define BMI160_USER_DATA_MAG_X_LSB__POS 3
  1007. #define BMI160_USER_DATA_MAG_X_LSB__LEN 5
  1008. #define BMI160_USER_DATA_MAG_X_LSB__MSK 0xF8
  1009. #define BMI160_USER_DATA_MAG_X_LSB__REG BMI160_USER_DATA_0_ADDR
  1010. /* Mag_X(MSB) Description - Reg Addr --> 0x05, Bit --> 0...7 */
  1011. #define BMI160_USER_DATA_1_MAG_X_MSB__POS 0
  1012. #define BMI160_USER_DATA_1_MAG_X_MSB__LEN 8
  1013. #define BMI160_USER_DATA_1_MAG_X_MSB__MSK 0xFF
  1014. #define BMI160_USER_DATA_1_MAG_X_MSB__REG BMI160_USER_DATA_1_ADDR
  1015. /* Mag_Y(LSB) Description - Reg Addr --> 0x06, Bit --> 0...7 */
  1016. #define BMI160_USER_DATA_2_MAG_Y_LSB__POS 0
  1017. #define BMI160_USER_DATA_2_MAG_Y_LSB__LEN 8
  1018. #define BMI160_USER_DATA_2_MAG_Y_LSB__MSK 0xFF
  1019. #define BMI160_USER_DATA_2_MAG_Y_LSB__REG BMI160_USER_DATA_2_ADDR
  1020. /* Mag_Y(LSB) Description - Reg Addr --> 0x06, Bit --> 3...7 */
  1021. #define BMI160_USER_DATA_MAG_Y_LSB__POS 3
  1022. #define BMI160_USER_DATA_MAG_Y_LSB__LEN 5
  1023. #define BMI160_USER_DATA_MAG_Y_LSB__MSK 0xF8
  1024. #define BMI160_USER_DATA_MAG_Y_LSB__REG BMI160_USER_DATA_2_ADDR
  1025. /* Mag_Y(MSB) Description - Reg Addr --> 0x07, Bit --> 0...7 */
  1026. #define BMI160_USER_DATA_3_MAG_Y_MSB__POS 0
  1027. #define BMI160_USER_DATA_3_MAG_Y_MSB__LEN 8
  1028. #define BMI160_USER_DATA_3_MAG_Y_MSB__MSK 0xFF
  1029. #define BMI160_USER_DATA_3_MAG_Y_MSB__REG BMI160_USER_DATA_3_ADDR
  1030. /* Mag_Z(LSB) Description - Reg Addr --> 0x08, Bit --> 0...7 */
  1031. #define BMI160_USER_DATA_4_MAG_Z_LSB__POS 0
  1032. #define BMI160_USER_DATA_4_MAG_Z_LSB__LEN 8
  1033. #define BMI160_USER_DATA_4_MAG_Z_LSB__MSK 0xFF
  1034. #define BMI160_USER_DATA_4_MAG_Z_LSB__REG BMI160_USER_DATA_4_ADDR
  1035. /* Mag_X(LSB) Description - Reg Addr --> 0x08, Bit --> 3...7 */
  1036. #define BMI160_USER_DATA_MAG_Z_LSB__POS 1
  1037. #define BMI160_USER_DATA_MAG_Z_LSB__LEN 7
  1038. #define BMI160_USER_DATA_MAG_Z_LSB__MSK 0xFE
  1039. #define BMI160_USER_DATA_MAG_Z_LSB__REG BMI160_USER_DATA_4_ADDR
  1040. /* Mag_Z(MSB) Description - Reg Addr --> 0x09, Bit --> 0...7 */
  1041. #define BMI160_USER_DATA_5_MAG_Z_MSB__POS 0
  1042. #define BMI160_USER_DATA_5_MAG_Z_MSB__LEN 8
  1043. #define BMI160_USER_DATA_5_MAG_Z_MSB__MSK 0xFF
  1044. #define BMI160_USER_DATA_5_MAG_Z_MSB__REG BMI160_USER_DATA_5_ADDR
  1045. /* RHALL(LSB) Description - Reg Addr --> 0x0A, Bit --> 0...7 */
  1046. #define BMI160_USER_DATA_6_RHALL_LSB__POS 0
  1047. #define BMI160_USER_DATA_6_RHALL_LSB__LEN 8
  1048. #define BMI160_USER_DATA_6_RHALL_LSB__MSK 0xFF
  1049. #define BMI160_USER_DATA_6_RHALL_LSB__REG BMI160_USER_DATA_6_ADDR
  1050. /* Mag_R(LSB) Description - Reg Addr --> 0x0A, Bit --> 3...7 */
  1051. #define BMI160_USER_DATA_MAG_R_LSB__POS 2
  1052. #define BMI160_USER_DATA_MAG_R_LSB__LEN 6
  1053. #define BMI160_USER_DATA_MAG_R_LSB__MSK 0xFC
  1054. #define BMI160_USER_DATA_MAG_R_LSB__REG BMI160_USER_DATA_6_ADDR
  1055. /* RHALL(MSB) Description - Reg Addr --> 0x0B, Bit --> 0...7 */
  1056. #define BMI160_USER_DATA_7_RHALL_MSB__POS 0
  1057. #define BMI160_USER_DATA_7_RHALL_MSB__LEN 8
  1058. #define BMI160_USER_DATA_7_RHALL_MSB__MSK 0xFF
  1059. #define BMI160_USER_DATA_7_RHALL_MSB__REG BMI160_USER_DATA_7_ADDR
  1060. /**************************************************************/
  1061. /**\name GYRO DATA XYZ LENGTH, POSITION AND MASK */
  1062. /**************************************************************/
  1063. /* GYR_X (LSB) Description - Reg Addr --> 0x0C, Bit --> 0...7 */
  1064. #define BMI160_USER_DATA_8_GYRO_X_LSB__POS 0
  1065. #define BMI160_USER_DATA_8_GYRO_X_LSB__LEN 8
  1066. #define BMI160_USER_DATA_8_GYRO_X_LSB__MSK 0xFF
  1067. #define BMI160_USER_DATA_8_GYRO_X_LSB__REG BMI160_USER_DATA_8_ADDR
  1068. /* GYR_X (MSB) Description - Reg Addr --> 0x0D, Bit --> 0...7 */
  1069. #define BMI160_USER_DATA_9_GYRO_X_MSB__POS 0
  1070. #define BMI160_USER_DATA_9_GYRO_X_MSB__LEN 8
  1071. #define BMI160_USER_DATA_9_GYRO_X_MSB__MSK 0xFF
  1072. #define BMI160_USER_DATA_9_GYRO_X_MSB__REG BMI160_USER_DATA_9_ADDR
  1073. /* GYR_Y (LSB) Description - Reg Addr --> 0x0E, Bit --> 0...7 */
  1074. #define BMI160_USER_DATA_10_GYRO_Y_LSB__POS 0
  1075. #define BMI160_USER_DATA_10_GYRO_Y_LSB__LEN 8
  1076. #define BMI160_USER_DATA_10_GYRO_Y_LSB__MSK 0xFF
  1077. #define BMI160_USER_DATA_10_GYRO_Y_LSB__REG BMI160_USER_DATA_10_ADDR
  1078. /* GYR_Y (MSB) Description - Reg Addr --> 0x0F, Bit --> 0...7 */
  1079. #define BMI160_USER_DATA_11_GYRO_Y_MSB__POS 0
  1080. #define BMI160_USER_DATA_11_GYRO_Y_MSB__LEN 8
  1081. #define BMI160_USER_DATA_11_GYRO_Y_MSB__MSK 0xFF
  1082. #define BMI160_USER_DATA_11_GYRO_Y_MSB__REG BMI160_USER_DATA_11_ADDR
  1083. /* GYR_Z (LSB) Description - Reg Addr --> 0x10, Bit --> 0...7 */
  1084. #define BMI160_USER_DATA_12_GYRO_Z_LSB__POS 0
  1085. #define BMI160_USER_DATA_12_GYRO_Z_LSB__LEN 8
  1086. #define BMI160_USER_DATA_12_GYRO_Z_LSB__MSK 0xFF
  1087. #define BMI160_USER_DATA_12_GYRO_Z_LSB__REG BMI160_USER_DATA_12_ADDR
  1088. /* GYR_Z (MSB) Description - Reg Addr --> 0x11, Bit --> 0...7 */
  1089. #define BMI160_USER_DATA_13_GYRO_Z_MSB__POS 0
  1090. #define BMI160_USER_DATA_13_GYRO_Z_MSB__LEN 8
  1091. #define BMI160_USER_DATA_13_GYRO_Z_MSB__MSK 0xFF
  1092. #define BMI160_USER_DATA_13_GYRO_Z_MSB__REG BMI160_USER_DATA_13_ADDR
  1093. /**************************************************************/
  1094. /**\name ACCEL DATA XYZ LENGTH, POSITION AND MASK */
  1095. /**************************************************************/
  1096. /* ACC_X (LSB) Description - Reg Addr --> 0x12, Bit --> 0...7 */
  1097. #define BMI160_USER_DATA_14_ACCEL_X_LSB__POS 0
  1098. #define BMI160_USER_DATA_14_ACCEL_X_LSB__LEN 8
  1099. #define BMI160_USER_DATA_14_ACCEL_X_LSB__MSK 0xFF
  1100. #define BMI160_USER_DATA_14_ACCEL_X_LSB__REG BMI160_USER_DATA_14_ADDR
  1101. /* ACC_X (MSB) Description - Reg Addr --> 0x13, Bit --> 0...7 */
  1102. #define BMI160_USER_DATA_15_ACCEL_X_MSB__POS 0
  1103. #define BMI160_USER_DATA_15_ACCEL_X_MSB__LEN 8
  1104. #define BMI160_USER_DATA_15_ACCEL_X_MSB__MSK 0xFF
  1105. #define BMI160_USER_DATA_15_ACCEL_X_MSB__REG BMI160_USER_DATA_15_ADDR
  1106. /* ACC_Y (LSB) Description - Reg Addr --> 0x14, Bit --> 0...7 */
  1107. #define BMI160_USER_DATA_16_ACCEL_Y_LSB__POS 0
  1108. #define BMI160_USER_DATA_16_ACCEL_Y_LSB__LEN 8
  1109. #define BMI160_USER_DATA_16_ACCEL_Y_LSB__MSK 0xFF
  1110. #define BMI160_USER_DATA_16_ACCEL_Y_LSB__REG BMI160_USER_DATA_16_ADDR
  1111. /* ACC_Y (MSB) Description - Reg Addr --> 0x15, Bit --> 0...7 */
  1112. #define BMI160_USER_DATA_17_ACCEL_Y_MSB__POS 0
  1113. #define BMI160_USER_DATA_17_ACCEL_Y_MSB__LEN 8
  1114. #define BMI160_USER_DATA_17_ACCEL_Y_MSB__MSK 0xFF
  1115. #define BMI160_USER_DATA_17_ACCEL_Y_MSB__REG BMI160_USER_DATA_17_ADDR
  1116. /* ACC_Z (LSB) Description - Reg Addr --> 0x16, Bit --> 0...7 */
  1117. #define BMI160_USER_DATA_18_ACCEL_Z_LSB__POS 0
  1118. #define BMI160_USER_DATA_18_ACCEL_Z_LSB__LEN 8
  1119. #define BMI160_USER_DATA_18_ACCEL_Z_LSB__MSK 0xFF
  1120. #define BMI160_USER_DATA_18_ACCEL_Z_LSB__REG BMI160_USER_DATA_18_ADDR
  1121. /* ACC_Z (MSB) Description - Reg Addr --> 0x17, Bit --> 0...7 */
  1122. #define BMI160_USER_DATA_19_ACCEL_Z_MSB__POS 0
  1123. #define BMI160_USER_DATA_19_ACCEL_Z_MSB__LEN 8
  1124. #define BMI160_USER_DATA_19_ACCEL_Z_MSB__MSK 0xFF
  1125. #define BMI160_USER_DATA_19_ACCEL_Z_MSB__REG BMI160_USER_DATA_19_ADDR
  1126. /**************************************************************/
  1127. /**\name SENSOR TIME LENGTH, POSITION AND MASK */
  1128. /**************************************************************/
  1129. /* SENSORTIME_0 (LSB) Description - Reg Addr --> 0x18, Bit --> 0...7 */
  1130. #define BMI160_USER_SENSORTIME_0_SENSOR_TIME_LSB__POS 0
  1131. #define BMI160_USER_SENSORTIME_0_SENSOR_TIME_LSB__LEN 8
  1132. #define BMI160_USER_SENSORTIME_0_SENSOR_TIME_LSB__MSK 0xFF
  1133. #define BMI160_USER_SENSORTIME_0_SENSOR_TIME_LSB__REG \
  1134. BMI160_USER_SENSORTIME_0_ADDR
  1135. /* SENSORTIME_1 (MSB) Description - Reg Addr --> 0x19, Bit --> 0...7 */
  1136. #define BMI160_USER_SENSORTIME_1_SENSOR_TIME_MSB__POS 0
  1137. #define BMI160_USER_SENSORTIME_1_SENSOR_TIME_MSB__LEN 8
  1138. #define BMI160_USER_SENSORTIME_1_SENSOR_TIME_MSB__MSK 0xFF
  1139. #define BMI160_USER_SENSORTIME_1_SENSOR_TIME_MSB__REG \
  1140. BMI160_USER_SENSORTIME_1_ADDR
  1141. /* SENSORTIME_2 (MSB) Description - Reg Addr --> 0x1A, Bit --> 0...7 */
  1142. #define BMI160_USER_SENSORTIME_2_SENSOR_TIME_MSB__POS 0
  1143. #define BMI160_USER_SENSORTIME_2_SENSOR_TIME_MSB__LEN 8
  1144. #define BMI160_USER_SENSORTIME_2_SENSOR_TIME_MSB__MSK 0xFF
  1145. #define BMI160_USER_SENSORTIME_2_SENSOR_TIME_MSB__REG \
  1146. BMI160_USER_SENSORTIME_2_ADDR
  1147. /**************************************************************/
  1148. /**\name GYRO SELF TEST LENGTH, POSITION AND MASK */
  1149. /**************************************************************/
  1150. /* Status Description - Reg Addr --> 0x1B, Bit --> 1 */
  1151. #define BMI160_USER_STAT_GYRO_SELFTEST_OK__POS 1
  1152. #define BMI160_USER_STAT_GYRO_SELFTEST_OK__LEN 1
  1153. #define BMI160_USER_STAT_GYRO_SELFTEST_OK__MSK 0x02
  1154. #define BMI160_USER_STAT_GYRO_SELFTEST_OK__REG \
  1155. BMI160_USER_STAT_ADDR
  1156. /**************************************************************/
  1157. /**\name MAG MANUAL OPERATION LENGTH, POSITION AND MASK */
  1158. /**************************************************************/
  1159. /* Status Description - Reg Addr --> 0x1B, Bit --> 2 */
  1160. #define BMI160_USER_STAT_MAG_MANUAL_OPERATION__POS 2
  1161. #define BMI160_USER_STAT_MAG_MANUAL_OPERATION__LEN 1
  1162. #define BMI160_USER_STAT_MAG_MANUAL_OPERATION__MSK 0x04
  1163. #define BMI160_USER_STAT_MAG_MANUAL_OPERATION__REG \
  1164. BMI160_USER_STAT_ADDR
  1165. /**************************************************************/
  1166. /**\name FOC STATUS LENGTH, POSITION AND MASK */
  1167. /**************************************************************/
  1168. /* Status Description - Reg Addr --> 0x1B, Bit --> 3 */
  1169. #define BMI160_USER_STAT_FOC_RDY__POS 3
  1170. #define BMI160_USER_STAT_FOC_RDY__LEN 1
  1171. #define BMI160_USER_STAT_FOC_RDY__MSK 0x08
  1172. #define BMI160_USER_STAT_FOC_RDY__REG BMI160_USER_STAT_ADDR
  1173. /**************************************************************/
  1174. /**\name NVM READY LENGTH, POSITION AND MASK */
  1175. /**************************************************************/
  1176. /* Status Description - Reg Addr --> 0x1B, Bit --> 4 */
  1177. #define BMI160_USER_STAT_NVM_RDY__POS 4
  1178. #define BMI160_USER_STAT_NVM_RDY__LEN 1
  1179. #define BMI160_USER_STAT_NVM_RDY__MSK 0x10
  1180. #define BMI160_USER_STAT_NVM_RDY__REG BMI160_USER_STAT_ADDR
  1181. /**************************************************************/
  1182. /**\name DATA READY LENGTH, POSITION AND MASK FOR ACCEL, MAG AND GYRO*/
  1183. /**************************************************************/
  1184. /* Status Description - Reg Addr --> 0x1B, Bit --> 5 */
  1185. #define BMI160_USER_STAT_DATA_RDY_MAG__POS 5
  1186. #define BMI160_USER_STAT_DATA_RDY_MAG__LEN 1
  1187. #define BMI160_USER_STAT_DATA_RDY_MAG__MSK 0x20
  1188. #define BMI160_USER_STAT_DATA_RDY_MAG__REG BMI160_USER_STAT_ADDR
  1189. /* Status Description - Reg Addr --> 0x1B, Bit --> 6 */
  1190. #define BMI160_USER_STAT_DATA_RDY_GYRO__POS 6
  1191. #define BMI160_USER_STAT_DATA_RDY_GYRO__LEN 1
  1192. #define BMI160_USER_STAT_DATA_RDY_GYRO__MSK 0x40
  1193. #define BMI160_USER_STAT_DATA_RDY_GYRO__REG BMI160_USER_STAT_ADDR
  1194. /* Status Description - Reg Addr --> 0x1B, Bit --> 7 */
  1195. #define BMI160_USER_STAT_DATA_RDY_ACCEL__POS 7
  1196. #define BMI160_USER_STAT_DATA_RDY_ACCEL__LEN 1
  1197. #define BMI160_USER_STAT_DATA_RDY_ACCEL__MSK 0x80
  1198. #define BMI160_USER_STAT_DATA_RDY_ACCEL__REG BMI160_USER_STAT_ADDR
  1199. /**************************************************************/
  1200. /**\name INTERRUPT STATUS LENGTH, POSITION AND MASK */
  1201. /**************************************************************/
  1202. /* Int_Status_0 Description - Reg Addr --> 0x1C, Bit --> 0 */
  1203. #define BMI160_USER_INTR_STAT_0_STEP_INTR__POS 0
  1204. #define BMI160_USER_INTR_STAT_0_STEP_INTR__LEN 1
  1205. #define BMI160_USER_INTR_STAT_0_STEP_INTR__MSK 0x01
  1206. #define BMI160_USER_INTR_STAT_0_STEP_INTR__REG \
  1207. BMI160_USER_INTR_STAT_0_ADDR
  1208. /**************************************************************/
  1209. /**\name SIGNIFICANT INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1210. /**************************************************************/
  1211. /* Int_Status_0 Description - Reg Addr --> 0x1C, Bit --> 1 */
  1212. #define BMI160_USER_INTR_STAT_0_SIGNIFICANT_INTR__POS 1
  1213. #define BMI160_USER_INTR_STAT_0_SIGNIFICANT_INTR__LEN 1
  1214. #define BMI160_USER_INTR_STAT_0_SIGNIFICANT_INTR__MSK 0x02
  1215. #define BMI160_USER_INTR_STAT_0_SIGNIFICANT_INTR__REG \
  1216. BMI160_USER_INTR_STAT_0_ADDR
  1217. /**************************************************************/
  1218. /**\name ANY_MOTION INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1219. /**************************************************************/
  1220. /* Int_Status_0 Description - Reg Addr --> 0x1C, Bit --> 2 */
  1221. #define BMI160_USER_INTR_STAT_0_ANY_MOTION__POS 2
  1222. #define BMI160_USER_INTR_STAT_0_ANY_MOTION__LEN 1
  1223. #define BMI160_USER_INTR_STAT_0_ANY_MOTION__MSK 0x04
  1224. #define BMI160_USER_INTR_STAT_0_ANY_MOTION__REG \
  1225. BMI160_USER_INTR_STAT_0_ADDR
  1226. /**************************************************************/
  1227. /**\name PMU TRIGGER INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1228. /**************************************************************/
  1229. /* Int_Status_0 Description - Reg Addr --> 0x1C, Bit --> 3 */
  1230. #define BMI160_USER_INTR_STAT_0_PMU_TRIGGER__POS 3
  1231. #define BMI160_USER_INTR_STAT_0_PMU_TRIGGER__LEN 1
  1232. #define BMI160_USER_INTR_STAT_0_PMU_TRIGGER__MSK 0x08
  1233. #define BMI160_USER_INTR_STAT_0_PMU_TRIGGER__REG \
  1234. BMI160_USER_INTR_STAT_0_ADDR
  1235. /**************************************************************/
  1236. /**\name DOUBLE TAP INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1237. /**************************************************************/
  1238. /* Int_Status_0 Description - Reg Addr --> 0x1C, Bit --> 4 */
  1239. #define BMI160_USER_INTR_STAT_0_DOUBLE_TAP_INTR__POS 4
  1240. #define BMI160_USER_INTR_STAT_0_DOUBLE_TAP_INTR__LEN 1
  1241. #define BMI160_USER_INTR_STAT_0_DOUBLE_TAP_INTR__MSK 0x10
  1242. #define BMI160_USER_INTR_STAT_0_DOUBLE_TAP_INTR__REG \
  1243. BMI160_USER_INTR_STAT_0_ADDR
  1244. /**************************************************************/
  1245. /**\name SINGLE TAP INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1246. /**************************************************************/
  1247. /* Int_Status_0 Description - Reg Addr --> 0x1C, Bit --> 5 */
  1248. #define BMI160_USER_INTR_STAT_0_SINGLE_TAP_INTR__POS 5
  1249. #define BMI160_USER_INTR_STAT_0_SINGLE_TAP_INTR__LEN 1
  1250. #define BMI160_USER_INTR_STAT_0_SINGLE_TAP_INTR__MSK 0x20
  1251. #define BMI160_USER_INTR_STAT_0_SINGLE_TAP_INTR__REG \
  1252. BMI160_USER_INTR_STAT_0_ADDR
  1253. /**************************************************************/
  1254. /**\name ORIENT INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1255. /**************************************************************/
  1256. /* Int_Status_0 Description - Reg Addr --> 0x1C, Bit --> 6 */
  1257. #define BMI160_USER_INTR_STAT_0_ORIENT__POS 6
  1258. #define BMI160_USER_INTR_STAT_0_ORIENT__LEN 1
  1259. #define BMI160_USER_INTR_STAT_0_ORIENT__MSK 0x40
  1260. #define BMI160_USER_INTR_STAT_0_ORIENT__REG \
  1261. BMI160_USER_INTR_STAT_0_ADDR
  1262. /**************************************************************/
  1263. /**\name FLAT INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1264. /**************************************************************/
  1265. /* Int_Status_0 Description - Reg Addr --> 0x1C, Bit --> 7 */
  1266. #define BMI160_USER_INTR_STAT_0_FLAT__POS 7
  1267. #define BMI160_USER_INTR_STAT_0_FLAT__LEN 1
  1268. #define BMI160_USER_INTR_STAT_0_FLAT__MSK 0x80
  1269. #define BMI160_USER_INTR_STAT_0_FLAT__REG \
  1270. BMI160_USER_INTR_STAT_0_ADDR
  1271. /**************************************************************/
  1272. /**\name HIGH_G INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1273. /**************************************************************/
  1274. /* Int_Status_1 Description - Reg Addr --> 0x1D, Bit --> 2 */
  1275. #define BMI160_USER_INTR_STAT_1_HIGH_G_INTR__POS 2
  1276. #define BMI160_USER_INTR_STAT_1_HIGH_G_INTR__LEN 1
  1277. #define BMI160_USER_INTR_STAT_1_HIGH_G_INTR__MSK 0x04
  1278. #define BMI160_USER_INTR_STAT_1_HIGH_G_INTR__REG \
  1279. BMI160_USER_INTR_STAT_1_ADDR
  1280. /**************************************************************/
  1281. /**\name LOW_G INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1282. /**************************************************************/
  1283. /* Int_Status_1 Description - Reg Addr --> 0x1D, Bit --> 3 */
  1284. #define BMI160_USER_INTR_STAT_1_LOW_G_INTR__POS 3
  1285. #define BMI160_USER_INTR_STAT_1_LOW_G_INTR__LEN 1
  1286. #define BMI160_USER_INTR_STAT_1_LOW_G_INTR__MSK 0x08
  1287. #define BMI160_USER_INTR_STAT_1_LOW_G_INTR__REG \
  1288. BMI160_USER_INTR_STAT_1_ADDR
  1289. /**************************************************************/
  1290. /**\name DATA READY INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1291. /**************************************************************/
  1292. /* Int_Status_1 Description - Reg Addr --> 0x1D, Bit --> 4 */
  1293. #define BMI160_USER_INTR_STAT_1_DATA_RDY_INTR__POS 4
  1294. #define BMI160_USER_INTR_STAT_1_DATA_RDY_INTR__LEN 1
  1295. #define BMI160_USER_INTR_STAT_1_DATA_RDY_INTR__MSK 0x10
  1296. #define BMI160_USER_INTR_STAT_1_DATA_RDY_INTR__REG \
  1297. BMI160_USER_INTR_STAT_1_ADDR
  1298. /**************************************************************/
  1299. /**\name FIFO FULL INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1300. /**************************************************************/
  1301. /* Int_Status_1 Description - Reg Addr --> 0x1D, Bit --> 5 */
  1302. #define BMI160_USER_INTR_STAT_1_FIFO_FULL_INTR__POS 5
  1303. #define BMI160_USER_INTR_STAT_1_FIFO_FULL_INTR__LEN 1
  1304. #define BMI160_USER_INTR_STAT_1_FIFO_FULL_INTR__MSK 0x20
  1305. #define BMI160_USER_INTR_STAT_1_FIFO_FULL_INTR__REG \
  1306. BMI160_USER_INTR_STAT_1_ADDR
  1307. /**************************************************************/
  1308. /**\name FIFO WATERMARK INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1309. /**************************************************************/
  1310. /* Int_Status_1 Description - Reg Addr --> 0x1D, Bit --> 6 */
  1311. #define BMI160_USER_INTR_STAT_1_FIFO_WM_INTR__POS 6
  1312. #define BMI160_USER_INTR_STAT_1_FIFO_WM_INTR__LEN 1
  1313. #define BMI160_USER_INTR_STAT_1_FIFO_WM_INTR__MSK 0x40
  1314. #define BMI160_USER_INTR_STAT_1_FIFO_WM_INTR__REG \
  1315. BMI160_USER_INTR_STAT_1_ADDR
  1316. /**************************************************************/
  1317. /**\name NO MOTION INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1318. /**************************************************************/
  1319. /* Int_Status_1 Description - Reg Addr --> 0x1D, Bit --> 7 */
  1320. #define BMI160_USER_INTR_STAT_1_NOMOTION_INTR__POS 7
  1321. #define BMI160_USER_INTR_STAT_1_NOMOTION_INTR__LEN 1
  1322. #define BMI160_USER_INTR_STAT_1_NOMOTION_INTR__MSK 0x80
  1323. #define BMI160_USER_INTR_STAT_1_NOMOTION_INTR__REG \
  1324. BMI160_USER_INTR_STAT_1_ADDR
  1325. /**************************************************************/
  1326. /**\name ANY MOTION-XYZ AXIS INTERRUPT STATUS LENGTH, POSITION AND MASK*/
  1327. /**************************************************************/
  1328. /* Int_Status_2 Description - Reg Addr --> 0x1E, Bit --> 0 */
  1329. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_X__POS 0
  1330. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_X__LEN 1
  1331. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_X__MSK 0x01
  1332. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_X__REG \
  1333. BMI160_USER_INTR_STAT_2_ADDR
  1334. /* Int_Status_2 Description - Reg Addr --> 0x1E, Bit --> 1 */
  1335. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_Y__POS 1
  1336. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_Y__LEN 1
  1337. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_Y__MSK 0x02
  1338. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_Y__REG \
  1339. BMI160_USER_INTR_STAT_2_ADDR
  1340. /* Int_Status_2 Description - Reg Addr --> 0x1E, Bit --> 2 */
  1341. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_Z__POS 2
  1342. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_Z__LEN 1
  1343. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_Z__MSK 0x04
  1344. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_FIRST_Z__REG \
  1345. BMI160_USER_INTR_STAT_2_ADDR
  1346. /**************************************************************/
  1347. /**\name ANY MOTION SIGN LENGTH, POSITION AND MASK*/
  1348. /**************************************************************/
  1349. /* Int_Status_2 Description - Reg Addr --> 0x1E, Bit --> 3 */
  1350. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_SIGN__POS 3
  1351. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_SIGN__LEN 1
  1352. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_SIGN__MSK 0x08
  1353. #define BMI160_USER_INTR_STAT_2_ANY_MOTION_SIGN__REG \
  1354. BMI160_USER_INTR_STAT_2_ADDR
  1355. /**************************************************************/
  1356. /**\name TAP_XYZ AND SIGN LENGTH, POSITION AND MASK*/
  1357. /**************************************************************/
  1358. /* Int_Status_2 Description - Reg Addr --> 0x1E, Bit --> 4 */
  1359. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_X__POS 4
  1360. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_X__LEN 1
  1361. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_X__MSK 0x10
  1362. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_X__REG \
  1363. BMI160_USER_INTR_STAT_2_ADDR
  1364. /* Int_Status_2 Description - Reg Addr --> 0x1E, Bit --> 5 */
  1365. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_Y__POS 5
  1366. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_Y__LEN 1
  1367. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_Y__MSK 0x20
  1368. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_Y__REG \
  1369. BMI160_USER_INTR_STAT_2_ADDR
  1370. /* Int_Status_2 Description - Reg Addr --> 0x1E, Bit --> 6 */
  1371. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_Z__POS 6
  1372. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_Z__LEN 1
  1373. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_Z__MSK 0x40
  1374. #define BMI160_USER_INTR_STAT_2_TAP_FIRST_Z__REG \
  1375. BMI160_USER_INTR_STAT_2_ADDR
  1376. /* Int_Status_2 Description - Reg Addr --> 0x1E, Bit --> 7 */
  1377. #define BMI160_USER_INTR_STAT_2_TAP_SIGN__POS 7
  1378. #define BMI160_USER_INTR_STAT_2_TAP_SIGN__LEN 1
  1379. #define BMI160_USER_INTR_STAT_2_TAP_SIGN__MSK 0x80
  1380. #define BMI160_USER_INTR_STAT_2_TAP_SIGN__REG \
  1381. BMI160_USER_INTR_STAT_2_ADDR
  1382. /**************************************************************/
  1383. /**\name INTERRUPT SATAUS FOR WHOLE 0x1E LENGTH, POSITION AND MASK*/
  1384. /**************************************************************/
  1385. /* Int_Status_2 Description - Reg Addr --> 0x1E, Bit --> 0...7 */
  1386. #define BMI160_USER_INTR_STAT_2__POS 0
  1387. #define BMI160_USER_INTR_STAT_2__LEN 8
  1388. #define BMI160_USER_INTR_STAT_2__MSK 0xFF
  1389. #define BMI160_USER_INTR_STAT_2__REG \
  1390. BMI160_USER_INTR_STAT_2_ADDR
  1391. /**************************************************************/
  1392. /**\name HIGH_G-XYZ AND SIGN LENGTH, POSITION AND MASK*/
  1393. /**************************************************************/
  1394. /* Int_Status_3 Description - Reg Addr --> 0x1F, Bit --> 0 */
  1395. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_X__POS 0
  1396. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_X__LEN 1
  1397. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_X__MSK 0x01
  1398. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_X__REG \
  1399. BMI160_USER_INTR_STAT_3_ADDR
  1400. /* Int_Status_3 Description - Reg Addr --> 0x1E, Bit --> 1 */
  1401. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_Y__POS 1
  1402. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_Y__LEN 1
  1403. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_Y__MSK 0x02
  1404. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_Y__REG \
  1405. BMI160_USER_INTR_STAT_3_ADDR
  1406. /* Int_Status_3 Description - Reg Addr --> 0x1F, Bit --> 2 */
  1407. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_Z__POS 2
  1408. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_Z__LEN 1
  1409. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_Z__MSK 0x04
  1410. #define BMI160_USER_INTR_STAT_3_HIGH_G_FIRST_Z__REG \
  1411. BMI160_USER_INTR_STAT_3_ADDR
  1412. /* Int_Status_3 Description - Reg Addr --> 0x1F, Bit --> 3 */
  1413. #define BMI160_USER_INTR_STAT_3_HIGH_G_SIGN__POS 3
  1414. #define BMI160_USER_INTR_STAT_3_HIGH_G_SIGN__LEN 1
  1415. #define BMI160_USER_INTR_STAT_3_HIGH_G_SIGN__MSK 0x08
  1416. #define BMI160_USER_INTR_STAT_3_HIGH_G_SIGN__REG \
  1417. BMI160_USER_INTR_STAT_3_ADDR
  1418. /**************************************************************/
  1419. /**\name ORIENT XY and Z AXIS LENGTH, POSITION AND MASK*/
  1420. /**************************************************************/
  1421. /* Int_Status_3 Description - Reg Addr --> 0x1F, Bit --> 4...5 */
  1422. #define BMI160_USER_INTR_STAT_3_ORIENT_XY__POS 4
  1423. #define BMI160_USER_INTR_STAT_3_ORIENT_XY__LEN 2
  1424. #define BMI160_USER_INTR_STAT_3_ORIENT_XY__MSK 0x30
  1425. #define BMI160_USER_INTR_STAT_3_ORIENT_XY__REG \
  1426. BMI160_USER_INTR_STAT_3_ADDR
  1427. /* Int_Status_3 Description - Reg Addr --> 0x1F, Bit --> 6 */
  1428. #define BMI160_USER_INTR_STAT_3_ORIENT_Z__POS 6
  1429. #define BMI160_USER_INTR_STAT_3_ORIENT_Z__LEN 1
  1430. #define BMI160_USER_INTR_STAT_3_ORIENT_Z__MSK 0x40
  1431. #define BMI160_USER_INTR_STAT_3_ORIENT_Z__REG \
  1432. BMI160_USER_INTR_STAT_3_ADDR
  1433. /**************************************************************/
  1434. /**\name FLAT LENGTH, POSITION AND MASK*/
  1435. /**************************************************************/
  1436. /* Int_Status_3 Description - Reg Addr --> 0x1F, Bit --> 7 */
  1437. #define BMI160_USER_INTR_STAT_3_FLAT__POS 7
  1438. #define BMI160_USER_INTR_STAT_3_FLAT__LEN 1
  1439. #define BMI160_USER_INTR_STAT_3_FLAT__MSK 0x80
  1440. #define BMI160_USER_INTR_STAT_3_FLAT__REG \
  1441. BMI160_USER_INTR_STAT_3_ADDR
  1442. /**************************************************************/
  1443. /**\name 0x1F LENGTH, POSITION AND MASK*/
  1444. /**************************************************************/
  1445. /* Int_Status_3 Description - Reg Addr --> 0x1F, Bit --> 0...7 */
  1446. #define BMI160_USER_INTR_STAT_3__POS 0
  1447. #define BMI160_USER_INTR_STAT_3__LEN 8
  1448. #define BMI160_USER_INTR_STAT_3__MSK 0xFF
  1449. #define BMI160_USER_INTR_STAT_3__REG \
  1450. BMI160_USER_INTR_STAT_3_ADDR
  1451. /**************************************************************/
  1452. /**\name TEMPERATURE LENGTH, POSITION AND MASK*/
  1453. /**************************************************************/
  1454. /* Temperature Description - LSB Reg Addr --> 0x20, Bit --> 0...7 */
  1455. #define BMI160_USER_TEMP_LSB_VALUE__POS 0
  1456. #define BMI160_USER_TEMP_LSB_VALUE__LEN 8
  1457. #define BMI160_USER_TEMP_LSB_VALUE__MSK 0xFF
  1458. #define BMI160_USER_TEMP_LSB_VALUE__REG \
  1459. BMI160_USER_TEMPERATURE_0_ADDR
  1460. /* Temperature Description - LSB Reg Addr --> 0x21, Bit --> 0...7 */
  1461. #define BMI160_USER_TEMP_MSB_VALUE__POS 0
  1462. #define BMI160_USER_TEMP_MSB_VALUE__LEN 8
  1463. #define BMI160_USER_TEMP_MSB_VALUE__MSK 0xFF
  1464. #define BMI160_USER_TEMP_MSB_VALUE__REG \
  1465. BMI160_USER_TEMPERATURE_1_ADDR
  1466. /**************************************************************/
  1467. /**\name FIFO BYTE COUNTER LENGTH, POSITION AND MASK*/
  1468. /**************************************************************/
  1469. /* Fifo_Length0 Description - Reg Addr --> 0x22, Bit --> 0...7 */
  1470. #define BMI160_USER_FIFO_BYTE_COUNTER_LSB__POS 0
  1471. #define BMI160_USER_FIFO_BYTE_COUNTER_LSB__LEN 8
  1472. #define BMI160_USER_FIFO_BYTE_COUNTER_LSB__MSK 0xFF
  1473. #define BMI160_USER_FIFO_BYTE_COUNTER_LSB__REG \
  1474. BMI160_USER_FIFO_LENGTH_0_ADDR
  1475. /*Fifo_Length1 Description - Reg Addr --> 0x23, Bit --> 0...2 */
  1476. #define BMI160_USER_FIFO_BYTE_COUNTER_MSB__POS 0
  1477. #define BMI160_USER_FIFO_BYTE_COUNTER_MSB__LEN 3
  1478. #define BMI160_USER_FIFO_BYTE_COUNTER_MSB__MSK 0x07
  1479. #define BMI160_USER_FIFO_BYTE_COUNTER_MSB__REG \
  1480. BMI160_USER_FIFO_LENGTH_1_ADDR
  1481. /**************************************************************/
  1482. /**\name FIFO DATA LENGTH, POSITION AND MASK*/
  1483. /**************************************************************/
  1484. /* Fifo_Data Description - Reg Addr --> 0x24, Bit --> 0...7 */
  1485. #define BMI160_USER_FIFO_DATA__POS 0
  1486. #define BMI160_USER_FIFO_DATA__LEN 8
  1487. #define BMI160_USER_FIFO_DATA__MSK 0xFF
  1488. #define BMI160_USER_FIFO_DATA__REG BMI160_USER_FIFO_DATA_ADDR
  1489. /**************************************************************/
  1490. /**\name ACCEL CONFIGURATION LENGTH, POSITION AND MASK*/
  1491. /**************************************************************/
  1492. /* Acc_Conf Description - Reg Addr --> 0x40, Bit --> 0...3 */
  1493. #define BMI160_USER_ACCEL_CONFIG_OUTPUT_DATA_RATE__POS 0
  1494. #define BMI160_USER_ACCEL_CONFIG_OUTPUT_DATA_RATE__LEN 4
  1495. #define BMI160_USER_ACCEL_CONFIG_OUTPUT_DATA_RATE__MSK 0x0F
  1496. #define BMI160_USER_ACCEL_CONFIG_OUTPUT_DATA_RATE__REG \
  1497. BMI160_USER_ACCEL_CONFIG_ADDR
  1498. /* Acc_Conf Description - Reg Addr --> 0x40, Bit --> 4...6 */
  1499. #define BMI160_USER_ACCEL_CONFIG_ACCEL_BW__POS 4
  1500. #define BMI160_USER_ACCEL_CONFIG_ACCEL_BW__LEN 3
  1501. #define BMI160_USER_ACCEL_CONFIG_ACCEL_BW__MSK 0x70
  1502. #define BMI160_USER_ACCEL_CONFIG_ACCEL_BW__REG BMI160_USER_ACCEL_CONFIG_ADDR
  1503. /* Acc_Conf Description - Reg Addr --> 0x40, Bit --> 7 */
  1504. #define BMI160_USER_ACCEL_CONFIG_ACCEL_UNDER_SAMPLING__POS 7
  1505. #define BMI160_USER_ACCEL_CONFIG_ACCEL_UNDER_SAMPLING__LEN 1
  1506. #define BMI160_USER_ACCEL_CONFIG_ACCEL_UNDER_SAMPLING__MSK 0x80
  1507. #define BMI160_USER_ACCEL_CONFIG_ACCEL_UNDER_SAMPLING__REG \
  1508. BMI160_USER_ACCEL_CONFIG_ADDR
  1509. /* Acc_Range Description - Reg Addr --> 0x41, Bit --> 0...3 */
  1510. #define BMI160_USER_ACCEL_RANGE__POS 0
  1511. #define BMI160_USER_ACCEL_RANGE__LEN 4
  1512. #define BMI160_USER_ACCEL_RANGE__MSK 0x0F
  1513. #define BMI160_USER_ACCEL_RANGE__REG BMI160_USER_ACCEL_RANGE_ADDR
  1514. /**************************************************************/
  1515. /**\name GYRO CONFIGURATION LENGTH, POSITION AND MASK*/
  1516. /**************************************************************/
  1517. /* Gyro_Conf Description - Reg Addr --> 0x42, Bit --> 0...3 */
  1518. #define BMI160_USER_GYRO_CONFIG_OUTPUT_DATA_RATE__POS 0
  1519. #define BMI160_USER_GYRO_CONFIG_OUTPUT_DATA_RATE__LEN 4
  1520. #define BMI160_USER_GYRO_CONFIG_OUTPUT_DATA_RATE__MSK 0x0F
  1521. #define BMI160_USER_GYRO_CONFIG_OUTPUT_DATA_RATE__REG \
  1522. BMI160_USER_GYRO_CONFIG_ADDR
  1523. /* Gyro_Conf Description - Reg Addr --> 0x42, Bit --> 4...5 */
  1524. #define BMI160_USER_GYRO_CONFIG_BW__POS 4
  1525. #define BMI160_USER_GYRO_CONFIG_BW__LEN 2
  1526. #define BMI160_USER_GYRO_CONFIG_BW__MSK 0x30
  1527. #define BMI160_USER_GYRO_CONFIG_BW__REG \
  1528. BMI160_USER_GYRO_CONFIG_ADDR
  1529. /* Gyr_Range Description - Reg Addr --> 0x43, Bit --> 0...2 */
  1530. #define BMI160_USER_GYRO_RANGE__POS 0
  1531. #define BMI160_USER_GYRO_RANGE__LEN 3
  1532. #define BMI160_USER_GYRO_RANGE__MSK 0x07
  1533. #define BMI160_USER_GYRO_RANGE__REG BMI160_USER_GYRO_RANGE_ADDR
  1534. /**************************************************************/
  1535. /**\name MAG CONFIGURATION LENGTH, POSITION AND MASK*/
  1536. /**************************************************************/
  1537. /* Mag_Conf Description - Reg Addr --> 0x44, Bit --> 0...3 */
  1538. #define BMI160_USER_MAG_CONFIG_OUTPUT_DATA_RATE__POS 0
  1539. #define BMI160_USER_MAG_CONFIG_OUTPUT_DATA_RATE__LEN 4
  1540. #define BMI160_USER_MAG_CONFIG_OUTPUT_DATA_RATE__MSK 0x0F
  1541. #define BMI160_USER_MAG_CONFIG_OUTPUT_DATA_RATE__REG \
  1542. BMI160_USER_MAG_CONFIG_ADDR
  1543. /**************************************************************/
  1544. /**\name FIFO DOWNS LENGTH, POSITION AND MASK*/
  1545. /**************************************************************/
  1546. /* Fifo_Downs Description - Reg Addr --> 0x45, Bit --> 0...2 */
  1547. #define BMI160_USER_FIFO_DOWN_GYRO__POS 0
  1548. #define BMI160_USER_FIFO_DOWN_GYRO__LEN 3
  1549. #define BMI160_USER_FIFO_DOWN_GYRO__MSK 0x07
  1550. #define BMI160_USER_FIFO_DOWN_GYRO__REG BMI160_USER_FIFO_DOWN_ADDR
  1551. /**************************************************************/
  1552. /**\name FIFO FILTER FOR ACCEL AND GYRO LENGTH, POSITION AND MASK*/
  1553. /**************************************************************/
  1554. /* Fifo_filt Description - Reg Addr --> 0x45, Bit --> 3 */
  1555. #define BMI160_USER_FIFO_FILTER_GYRO__POS 3
  1556. #define BMI160_USER_FIFO_FILTER_GYRO__LEN 1
  1557. #define BMI160_USER_FIFO_FILTER_GYRO__MSK 0x08
  1558. #define BMI160_USER_FIFO_FILTER_GYRO__REG BMI160_USER_FIFO_DOWN_ADDR
  1559. /* Fifo_Downs Description - Reg Addr --> 0x45, Bit --> 4...6 */
  1560. #define BMI160_USER_FIFO_DOWN_ACCEL__POS 4
  1561. #define BMI160_USER_FIFO_DOWN_ACCEL__LEN 3
  1562. #define BMI160_USER_FIFO_DOWN_ACCEL__MSK 0x70
  1563. #define BMI160_USER_FIFO_DOWN_ACCEL__REG BMI160_USER_FIFO_DOWN_ADDR
  1564. /* Fifo_FILT Description - Reg Addr --> 0x45, Bit --> 7 */
  1565. #define BMI160_USER_FIFO_FILTER_ACCEL__POS 7
  1566. #define BMI160_USER_FIFO_FILTER_ACCEL__LEN 1
  1567. #define BMI160_USER_FIFO_FILTER_ACCEL__MSK 0x80
  1568. #define BMI160_USER_FIFO_FILTER_ACCEL__REG BMI160_USER_FIFO_DOWN_ADDR
  1569. /**************************************************************/
  1570. /**\name FIFO WATER MARK LENGTH, POSITION AND MASK*/
  1571. /**************************************************************/
  1572. /* Fifo_Config_0 Description - Reg Addr --> 0x46, Bit --> 0...7 */
  1573. #define BMI160_USER_FIFO_WM__POS 0
  1574. #define BMI160_USER_FIFO_WM__LEN 8
  1575. #define BMI160_USER_FIFO_WM__MSK 0xFF
  1576. #define BMI160_USER_FIFO_WM__REG BMI160_USER_FIFO_CONFIG_0_ADDR
  1577. /**************************************************************/
  1578. /**\name FIFO STOP ON FULL LENGTH, POSITION AND MASK*/
  1579. /**************************************************************/
  1580. /* Fifo_Config_1 Description - Reg Addr --> 0x47, Bit --> 0 */
  1581. #define BMI160_USER_FIFO_STOP_ON_FULL__POS 0
  1582. #define BMI160_USER_FIFO_STOP_ON_FULL__LEN 1
  1583. #define BMI160_USER_FIFO_STOP_ON_FULL__MSK 0x01
  1584. #define BMI160_USER_FIFO_STOP_ON_FULL__REG BMI160_USER_FIFO_CONFIG_1_ADDR
  1585. /**************************************************************/
  1586. /**\name FIFO TIME LENGTH, POSITION AND MASK*/
  1587. /**************************************************************/
  1588. /* Fifo_Config_1 Description - Reg Addr --> 0x47, Bit --> 1 */
  1589. #define BMI160_USER_FIFO_TIME_ENABLE__POS 1
  1590. #define BMI160_USER_FIFO_TIME_ENABLE__LEN 1
  1591. #define BMI160_USER_FIFO_TIME_ENABLE__MSK 0x02
  1592. #define BMI160_USER_FIFO_TIME_ENABLE__REG BMI160_USER_FIFO_CONFIG_1_ADDR
  1593. /**************************************************************/
  1594. /**\name FIFO TAG INTERRUPT LENGTH, POSITION AND MASK*/
  1595. /**************************************************************/
  1596. /* Fifo_Config_1 Description - Reg Addr --> 0x47, Bit --> 2 */
  1597. #define BMI160_USER_FIFO_TAG_INTR2_ENABLE__POS 2
  1598. #define BMI160_USER_FIFO_TAG_INTR2_ENABLE__LEN 1
  1599. #define BMI160_USER_FIFO_TAG_INTR2_ENABLE__MSK 0x04
  1600. #define BMI160_USER_FIFO_TAG_INTR2_ENABLE__REG BMI160_USER_FIFO_CONFIG_1_ADDR
  1601. /* Fifo_Config_1 Description - Reg Addr --> 0x47, Bit --> 3 */
  1602. #define BMI160_USER_FIFO_TAG_INTR1_ENABLE__POS 3
  1603. #define BMI160_USER_FIFO_TAG_INTR1_ENABLE__LEN 1
  1604. #define BMI160_USER_FIFO_TAG_INTR1_ENABLE__MSK 0x08
  1605. #define BMI160_USER_FIFO_TAG_INTR1_ENABLE__REG BMI160_USER_FIFO_CONFIG_1_ADDR
  1606. /**************************************************************/
  1607. /**\name FIFO HEADER LENGTH, POSITION AND MASK*/
  1608. /**************************************************************/
  1609. /* Fifo_Config_1 Description - Reg Addr --> 0x47, Bit --> 4 */
  1610. #define BMI160_USER_FIFO_HEADER_ENABLE__POS 4
  1611. #define BMI160_USER_FIFO_HEADER_ENABLE__LEN 1
  1612. #define BMI160_USER_FIFO_HEADER_ENABLE__MSK 0x10
  1613. #define BMI160_USER_FIFO_HEADER_ENABLE__REG \
  1614. BMI160_USER_FIFO_CONFIG_1_ADDR
  1615. /**************************************************************/
  1616. /**\name FIFO MAG ENABLE LENGTH, POSITION AND MASK*/
  1617. /**************************************************************/
  1618. /* Fifo_Config_1 Description - Reg Addr --> 0x47, Bit --> 5 */
  1619. #define BMI160_USER_FIFO_MAG_ENABLE__POS 5
  1620. #define BMI160_USER_FIFO_MAG_ENABLE__LEN 1
  1621. #define BMI160_USER_FIFO_MAG_ENABLE__MSK 0x20
  1622. #define BMI160_USER_FIFO_MAG_ENABLE__REG \
  1623. BMI160_USER_FIFO_CONFIG_1_ADDR
  1624. /**************************************************************/
  1625. /**\name FIFO ACCEL ENABLE LENGTH, POSITION AND MASK*/
  1626. /**************************************************************/
  1627. /* Fifo_Config_1 Description - Reg Addr --> 0x47, Bit --> 6 */
  1628. #define BMI160_USER_FIFO_ACCEL_ENABLE__POS 6
  1629. #define BMI160_USER_FIFO_ACCEL_ENABLE__LEN 1
  1630. #define BMI160_USER_FIFO_ACCEL_ENABLE__MSK 0x40
  1631. #define BMI160_USER_FIFO_ACCEL_ENABLE__REG \
  1632. BMI160_USER_FIFO_CONFIG_1_ADDR
  1633. /**************************************************************/
  1634. /**\name FIFO GYRO ENABLE LENGTH, POSITION AND MASK*/
  1635. /**************************************************************/
  1636. /* Fifo_Config_1 Description - Reg Addr --> 0x47, Bit --> 7 */
  1637. #define BMI160_USER_FIFO_GYRO_ENABLE__POS 7
  1638. #define BMI160_USER_FIFO_GYRO_ENABLE__LEN 1
  1639. #define BMI160_USER_FIFO_GYRO_ENABLE__MSK 0x80
  1640. #define BMI160_USER_FIFO_GYRO_ENABLE__REG \
  1641. BMI160_USER_FIFO_CONFIG_1_ADDR
  1642. /**************************************************************/
  1643. /**\name MAG I2C ADDRESS SELECTION LENGTH, POSITION AND MASK*/
  1644. /**************************************************************/
  1645. /* Mag_IF_0 Description - Reg Addr --> 0x4b, Bit --> 1...7 */
  1646. #define BMI160_USER_I2C_DEVICE_ADDR__POS 1
  1647. #define BMI160_USER_I2C_DEVICE_ADDR__LEN 7
  1648. #define BMI160_USER_I2C_DEVICE_ADDR__MSK 0xFE
  1649. #define BMI160_USER_I2C_DEVICE_ADDR__REG BMI160_USER_MAG_IF_0_ADDR
  1650. /**************************************************************/
  1651. /**\name MAG CONFIGURATION FOR SECONDARY
  1652. INTERFACE LENGTH, POSITION AND MASK*/
  1653. /**************************************************************/
  1654. /* Mag_IF_1 Description - Reg Addr --> 0x4c, Bit --> 0...1 */
  1655. #define BMI160_USER_MAG_BURST__POS 0
  1656. #define BMI160_USER_MAG_BURST__LEN 2
  1657. #define BMI160_USER_MAG_BURST__MSK 0x03
  1658. #define BMI160_USER_MAG_BURST__REG BMI160_USER_MAG_IF_1_ADDR
  1659. /* Mag_IF_1 Description - Reg Addr --> 0x4c, Bit --> 2...5 */
  1660. #define BMI160_USER_MAG_OFFSET__POS 2
  1661. #define BMI160_USER_MAG_OFFSET__LEN 4
  1662. #define BMI160_USER_MAG_OFFSET__MSK 0x3C
  1663. #define BMI160_USER_MAG_OFFSET__REG BMI160_USER_MAG_IF_1_ADDR
  1664. /* Mag_IF_1 Description - Reg Addr --> 0x4c, Bit --> 7 */
  1665. #define BMI160_USER_MAG_MANUAL_ENABLE__POS 7
  1666. #define BMI160_USER_MAG_MANUAL_ENABLE__LEN 1
  1667. #define BMI160_USER_MAG_MANUAL_ENABLE__MSK 0x80
  1668. #define BMI160_USER_MAG_MANUAL_ENABLE__REG \
  1669. BMI160_USER_MAG_IF_1_ADDR
  1670. /* Mag_IF_2 Description - Reg Addr --> 0x4d, Bit -->0... 7 */
  1671. #define BMI160_USER_READ_ADDR__POS 0
  1672. #define BMI160_USER_READ_ADDR__LEN 8
  1673. #define BMI160_USER_READ_ADDR__MSK 0xFF
  1674. #define BMI160_USER_READ_ADDR__REG BMI160_USER_MAG_IF_2_ADDR
  1675. /* Mag_IF_3 Description - Reg Addr --> 0x4e, Bit -->0... 7 */
  1676. #define BMI160_USER_WRITE_ADDR__POS 0
  1677. #define BMI160_USER_WRITE_ADDR__LEN 8
  1678. #define BMI160_USER_WRITE_ADDR__MSK 0xFF
  1679. #define BMI160_USER_WRITE_ADDR__REG BMI160_USER_MAG_IF_3_ADDR
  1680. /* Mag_IF_4 Description - Reg Addr --> 0x4f, Bit -->0... 7 */
  1681. #define BMI160_USER_WRITE_DATA__POS 0
  1682. #define BMI160_USER_WRITE_DATA__LEN 8
  1683. #define BMI160_USER_WRITE_DATA__MSK 0xFF
  1684. #define BMI160_USER_WRITE_DATA__REG BMI160_USER_MAG_IF_4_ADDR
  1685. /**************************************************************/
  1686. /**\name ANY MOTION XYZ AXIS ENABLE LENGTH, POSITION AND MASK*/
  1687. /**************************************************************/
  1688. /* Int_En_0 Description - Reg Addr --> 0x50, Bit -->0 */
  1689. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_X_ENABLE__POS 0
  1690. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_X_ENABLE__LEN 1
  1691. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_X_ENABLE__MSK 0x01
  1692. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_X_ENABLE__REG \
  1693. BMI160_USER_INTR_ENABLE_0_ADDR
  1694. /* Int_En_0 Description - Reg Addr --> 0x50, Bit -->1 */
  1695. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_Y_ENABLE__POS 1
  1696. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_Y_ENABLE__LEN 1
  1697. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_Y_ENABLE__MSK 0x02
  1698. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_Y_ENABLE__REG \
  1699. BMI160_USER_INTR_ENABLE_0_ADDR
  1700. /* Int_En_0 Description - Reg Addr --> 0x50, Bit -->2 */
  1701. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_Z_ENABLE__POS 2
  1702. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_Z_ENABLE__LEN 1
  1703. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_Z_ENABLE__MSK 0x04
  1704. #define BMI160_USER_INTR_ENABLE_0_ANY_MOTION_Z_ENABLE__REG \
  1705. BMI160_USER_INTR_ENABLE_0_ADDR
  1706. /**************************************************************/
  1707. /**\name DOUBLE TAP ENABLE LENGTH, POSITION AND MASK*/
  1708. /**************************************************************/
  1709. /* Int_En_0 Description - Reg Addr --> 0x50, Bit -->4 */
  1710. #define BMI160_USER_INTR_ENABLE_0_DOUBLE_TAP_ENABLE__POS 4
  1711. #define BMI160_USER_INTR_ENABLE_0_DOUBLE_TAP_ENABLE__LEN 1
  1712. #define BMI160_USER_INTR_ENABLE_0_DOUBLE_TAP_ENABLE__MSK 0x10
  1713. #define BMI160_USER_INTR_ENABLE_0_DOUBLE_TAP_ENABLE__REG \
  1714. BMI160_USER_INTR_ENABLE_0_ADDR
  1715. /**************************************************************/
  1716. /**\name SINGLE TAP ENABLE LENGTH, POSITION AND MASK*/
  1717. /**************************************************************/
  1718. /* Int_En_0 Description - Reg Addr --> 0x50, Bit -->5 */
  1719. #define BMI160_USER_INTR_ENABLE_0_SINGLE_TAP_ENABLE__POS 5
  1720. #define BMI160_USER_INTR_ENABLE_0_SINGLE_TAP_ENABLE__LEN 1
  1721. #define BMI160_USER_INTR_ENABLE_0_SINGLE_TAP_ENABLE__MSK 0x20
  1722. #define BMI160_USER_INTR_ENABLE_0_SINGLE_TAP_ENABLE__REG \
  1723. BMI160_USER_INTR_ENABLE_0_ADDR
  1724. /**************************************************************/
  1725. /**\name ORIENT ENABLE LENGTH, POSITION AND MASK*/
  1726. /**************************************************************/
  1727. /* Int_En_0 Description - Reg Addr --> 0x50, Bit -->6 */
  1728. #define BMI160_USER_INTR_ENABLE_0_ORIENT_ENABLE__POS 6
  1729. #define BMI160_USER_INTR_ENABLE_0_ORIENT_ENABLE__LEN 1
  1730. #define BMI160_USER_INTR_ENABLE_0_ORIENT_ENABLE__MSK 0x40
  1731. #define BMI160_USER_INTR_ENABLE_0_ORIENT_ENABLE__REG \
  1732. BMI160_USER_INTR_ENABLE_0_ADDR
  1733. /**************************************************************/
  1734. /**\name FLAT ENABLE LENGTH, POSITION AND MASK*/
  1735. /**************************************************************/
  1736. /* Int_En_0 Description - Reg Addr --> 0x50, Bit -->7 */
  1737. #define BMI160_USER_INTR_ENABLE_0_FLAT_ENABLE__POS 7
  1738. #define BMI160_USER_INTR_ENABLE_0_FLAT_ENABLE__LEN 1
  1739. #define BMI160_USER_INTR_ENABLE_0_FLAT_ENABLE__MSK 0x80
  1740. #define BMI160_USER_INTR_ENABLE_0_FLAT_ENABLE__REG \
  1741. BMI160_USER_INTR_ENABLE_0_ADDR
  1742. /**************************************************************/
  1743. /**\name HIGH_G XYZ ENABLE LENGTH, POSITION AND MASK*/
  1744. /**************************************************************/
  1745. /* Int_En_1 Description - Reg Addr --> 0x51, Bit -->0 */
  1746. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_X_ENABLE__POS 0
  1747. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_X_ENABLE__LEN 1
  1748. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_X_ENABLE__MSK 0x01
  1749. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_X_ENABLE__REG \
  1750. BMI160_USER_INTR_ENABLE_1_ADDR
  1751. /* Int_En_1 Description - Reg Addr --> 0x51, Bit -->1 */
  1752. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_Y_ENABLE__POS 1
  1753. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_Y_ENABLE__LEN 1
  1754. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_Y_ENABLE__MSK 0x02
  1755. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_Y_ENABLE__REG \
  1756. BMI160_USER_INTR_ENABLE_1_ADDR
  1757. /* Int_En_1 Description - Reg Addr --> 0x51, Bit -->2 */
  1758. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_Z_ENABLE__POS 2
  1759. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_Z_ENABLE__LEN 1
  1760. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_Z_ENABLE__MSK 0x04
  1761. #define BMI160_USER_INTR_ENABLE_1_HIGH_G_Z_ENABLE__REG \
  1762. BMI160_USER_INTR_ENABLE_1_ADDR
  1763. /**************************************************************/
  1764. /**\name LOW_G ENABLE LENGTH, POSITION AND MASK*/
  1765. /**************************************************************/
  1766. /* Int_En_1 Description - Reg Addr --> 0x51, Bit -->3 */
  1767. #define BMI160_USER_INTR_ENABLE_1_LOW_G_ENABLE__POS 3
  1768. #define BMI160_USER_INTR_ENABLE_1_LOW_G_ENABLE__LEN 1
  1769. #define BMI160_USER_INTR_ENABLE_1_LOW_G_ENABLE__MSK 0x08
  1770. #define BMI160_USER_INTR_ENABLE_1_LOW_G_ENABLE__REG \
  1771. BMI160_USER_INTR_ENABLE_1_ADDR
  1772. /**************************************************************/
  1773. /**\name DATA READY ENABLE LENGTH, POSITION AND MASK*/
  1774. /**************************************************************/
  1775. /* Int_En_1 Description - Reg Addr --> 0x51, Bit -->4 */
  1776. #define BMI160_USER_INTR_ENABLE_1_DATA_RDY_ENABLE__POS 4
  1777. #define BMI160_USER_INTR_ENABLE_1_DATA_RDY_ENABLE__LEN 1
  1778. #define BMI160_USER_INTR_ENABLE_1_DATA_RDY_ENABLE__MSK 0x10
  1779. #define BMI160_USER_INTR_ENABLE_1_DATA_RDY_ENABLE__REG \
  1780. BMI160_USER_INTR_ENABLE_1_ADDR
  1781. /**************************************************************/
  1782. /**\name FIFO FULL AND WATER MARK ENABLE LENGTH, POSITION AND MASK*/
  1783. /**************************************************************/
  1784. /* Int_En_1 Description - Reg Addr --> 0x51, Bit -->5 */
  1785. #define BMI160_USER_INTR_ENABLE_1_FIFO_FULL_ENABLE__POS 5
  1786. #define BMI160_USER_INTR_ENABLE_1_FIFO_FULL_ENABLE__LEN 1
  1787. #define BMI160_USER_INTR_ENABLE_1_FIFO_FULL_ENABLE__MSK 0x20
  1788. #define BMI160_USER_INTR_ENABLE_1_FIFO_FULL_ENABLE__REG \
  1789. BMI160_USER_INTR_ENABLE_1_ADDR
  1790. /* Int_En_1 Description - Reg Addr --> 0x51, Bit -->6 */
  1791. #define BMI160_USER_INTR_ENABLE_1_FIFO_WM_ENABLE__POS 6
  1792. #define BMI160_USER_INTR_ENABLE_1_FIFO_WM_ENABLE__LEN 1
  1793. #define BMI160_USER_INTR_ENABLE_1_FIFO_WM_ENABLE__MSK 0x40
  1794. #define BMI160_USER_INTR_ENABLE_1_FIFO_WM_ENABLE__REG \
  1795. BMI160_USER_INTR_ENABLE_1_ADDR
  1796. /**************************************************************/
  1797. /**\name NO MOTION XYZ ENABLE LENGTH, POSITION AND MASK*/
  1798. /**************************************************************/
  1799. /* Int_En_2 Description - Reg Addr --> 0x52, Bit -->0 */
  1800. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_X_ENABLE__POS 0
  1801. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_X_ENABLE__LEN 1
  1802. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_X_ENABLE__MSK 0x01
  1803. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_X_ENABLE__REG \
  1804. BMI160_USER_INTR_ENABLE_2_ADDR
  1805. /* Int_En_2 Description - Reg Addr --> 0x52, Bit -->1 */
  1806. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_Y_ENABLE__POS 1
  1807. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_Y_ENABLE__LEN 1
  1808. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_Y_ENABLE__MSK 0x02
  1809. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_Y_ENABLE__REG \
  1810. BMI160_USER_INTR_ENABLE_2_ADDR
  1811. /* Int_En_2 Description - Reg Addr --> 0x52, Bit -->2 */
  1812. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_Z_ENABLE__POS 2
  1813. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_Z_ENABLE__LEN 1
  1814. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_Z_ENABLE__MSK 0x04
  1815. #define BMI160_USER_INTR_ENABLE_2_NOMOTION_Z_ENABLE__REG \
  1816. BMI160_USER_INTR_ENABLE_2_ADDR
  1817. /**************************************************************/
  1818. /**\name STEP DETECTOR ENABLE LENGTH, POSITION AND MASK*/
  1819. /**************************************************************/
  1820. /* Int_En_2 Description - Reg Addr --> 0x52, Bit -->3 */
  1821. #define BMI160_USER_INTR_ENABLE_2_STEP_DETECTOR_ENABLE__POS 3
  1822. #define BMI160_USER_INTR_ENABLE_2_STEP_DETECTOR_ENABLE__LEN 1
  1823. #define BMI160_USER_INTR_ENABLE_2_STEP_DETECTOR_ENABLE__MSK 0x08
  1824. #define BMI160_USER_INTR_ENABLE_2_STEP_DETECTOR_ENABLE__REG \
  1825. BMI160_USER_INTR_ENABLE_2_ADDR
  1826. /**************************************************************/
  1827. /**\name EDGE CONTROL ENABLE LENGTH, POSITION AND MASK*/
  1828. /**************************************************************/
  1829. /* Int_Out_Ctrl Description - Reg Addr --> 0x53, Bit -->0 */
  1830. #define BMI160_USER_INTR1_EDGE_CTRL__POS 0
  1831. #define BMI160_USER_INTR1_EDGE_CTRL__LEN 1
  1832. #define BMI160_USER_INTR1_EDGE_CTRL__MSK 0x01
  1833. #define BMI160_USER_INTR1_EDGE_CTRL__REG \
  1834. BMI160_USER_INTR_OUT_CTRL_ADDR
  1835. /**************************************************************/
  1836. /**\name LEVEL CONTROL ENABLE LENGTH, POSITION AND MASK*/
  1837. /**************************************************************/
  1838. /* Int_Out_Ctrl Description - Reg Addr --> 0x53, Bit -->1 */
  1839. #define BMI160_USER_INTR1_LEVEL__POS 1
  1840. #define BMI160_USER_INTR1_LEVEL__LEN 1
  1841. #define BMI160_USER_INTR1_LEVEL__MSK 0x02
  1842. #define BMI160_USER_INTR1_LEVEL__REG \
  1843. BMI160_USER_INTR_OUT_CTRL_ADDR
  1844. /**************************************************************/
  1845. /**\name OUTPUT TYPE ENABLE LENGTH, POSITION AND MASK*/
  1846. /**************************************************************/
  1847. /* Int_Out_Ctrl Description - Reg Addr --> 0x53, Bit -->2 */
  1848. #define BMI160_USER_INTR1_OUTPUT_TYPE__POS 2
  1849. #define BMI160_USER_INTR1_OUTPUT_TYPE__LEN 1
  1850. #define BMI160_USER_INTR1_OUTPUT_TYPE__MSK 0x04
  1851. #define BMI160_USER_INTR1_OUTPUT_TYPE__REG \
  1852. BMI160_USER_INTR_OUT_CTRL_ADDR
  1853. /**************************************************************/
  1854. /**\name OUTPUT TYPE ENABLE LENGTH, POSITION AND MASK*/
  1855. /**************************************************************/
  1856. /* Int_Out_Ctrl Description - Reg Addr --> 0x53, Bit -->3 */
  1857. #define BMI160_USER_INTR1_OUTPUT_ENABLE__POS 3
  1858. #define BMI160_USER_INTR1_OUTPUT_ENABLE__LEN 1
  1859. #define BMI160_USER_INTR1_OUTPUT_ENABLE__MSK 0x08
  1860. #define BMI160_USER_INTR1_OUTPUT_ENABLE__REG \
  1861. BMI160_USER_INTR_OUT_CTRL_ADDR
  1862. /**************************************************************/
  1863. /**\name EDGE CONTROL ENABLE LENGTH, POSITION AND MASK*/
  1864. /**************************************************************/
  1865. /* Int_Out_Ctrl Description - Reg Addr --> 0x53, Bit -->4 */
  1866. #define BMI160_USER_INTR2_EDGE_CTRL__POS 4
  1867. #define BMI160_USER_INTR2_EDGE_CTRL__LEN 1
  1868. #define BMI160_USER_INTR2_EDGE_CTRL__MSK 0x10
  1869. #define BMI160_USER_INTR2_EDGE_CTRL__REG \
  1870. BMI160_USER_INTR_OUT_CTRL_ADDR
  1871. /**************************************************************/
  1872. /**\name LEVEL CONTROL ENABLE LENGTH, POSITION AND MASK*/
  1873. /**************************************************************/
  1874. /* Int_Out_Ctrl Description - Reg Addr --> 0x53, Bit -->5 */
  1875. #define BMI160_USER_INTR2_LEVEL__POS 5
  1876. #define BMI160_USER_INTR2_LEVEL__LEN 1
  1877. #define BMI160_USER_INTR2_LEVEL__MSK 0x20
  1878. #define BMI160_USER_INTR2_LEVEL__REG \
  1879. BMI160_USER_INTR_OUT_CTRL_ADDR
  1880. /**************************************************************/
  1881. /**\name OUTPUT TYPE ENABLE LENGTH, POSITION AND MASK*/
  1882. /**************************************************************/
  1883. /* Int_Out_Ctrl Description - Reg Addr --> 0x53, Bit -->6 */
  1884. #define BMI160_USER_INTR2_OUTPUT_TYPE__POS 6
  1885. #define BMI160_USER_INTR2_OUTPUT_TYPE__LEN 1
  1886. #define BMI160_USER_INTR2_OUTPUT_TYPE__MSK 0x40
  1887. #define BMI160_USER_INTR2_OUTPUT_TYPE__REG \
  1888. BMI160_USER_INTR_OUT_CTRL_ADDR
  1889. /* Int_Out_Ctrl Description - Reg Addr --> 0x53, Bit -->7 */
  1890. #define BMI160_USER_INTR2_OUTPUT_EN__POS 7
  1891. #define BMI160_USER_INTR2_OUTPUT_EN__LEN 1
  1892. #define BMI160_USER_INTR2_OUTPUT_EN__MSK 0x80
  1893. #define BMI160_USER_INTR2_OUTPUT_EN__REG \
  1894. BMI160_USER_INTR_OUT_CTRL_ADDR
  1895. /**************************************************************/
  1896. /**\name LATCH INTERRUPT LENGTH, POSITION AND MASK*/
  1897. /**************************************************************/
  1898. /* Int_Latch Description - Reg Addr --> 0x54, Bit -->0...3 */
  1899. #define BMI160_USER_INTR_LATCH__POS 0
  1900. #define BMI160_USER_INTR_LATCH__LEN 4
  1901. #define BMI160_USER_INTR_LATCH__MSK 0x0F
  1902. #define BMI160_USER_INTR_LATCH__REG BMI160_USER_INTR_LATCH_ADDR
  1903. /**************************************************************/
  1904. /**\name INPUT ENABLE LENGTH, POSITION AND MASK*/
  1905. /**************************************************************/
  1906. /* Int_Latch Description - Reg Addr --> 0x54, Bit -->4 */
  1907. #define BMI160_USER_INTR1_INPUT_ENABLE__POS 4
  1908. #define BMI160_USER_INTR1_INPUT_ENABLE__LEN 1
  1909. #define BMI160_USER_INTR1_INPUT_ENABLE__MSK 0x10
  1910. #define BMI160_USER_INTR1_INPUT_ENABLE__REG \
  1911. BMI160_USER_INTR_LATCH_ADDR
  1912. /* Int_Latch Description - Reg Addr --> 0x54, Bit -->5*/
  1913. #define BMI160_USER_INTR2_INPUT_ENABLE__POS 5
  1914. #define BMI160_USER_INTR2_INPUT_ENABLE__LEN 1
  1915. #define BMI160_USER_INTR2_INPUT_ENABLE__MSK 0x20
  1916. #define BMI160_USER_INTR2_INPUT_ENABLE__REG \
  1917. BMI160_USER_INTR_LATCH_ADDR
  1918. /**************************************************************/
  1919. /**\name INTERRUPT1 MAPPIONG OF LOW_G LENGTH, POSITION AND MASK*/
  1920. /**************************************************************/
  1921. /* Int_Map_0 Description - Reg Addr --> 0x55, Bit -->0 */
  1922. #define BMI160_USER_INTR_MAP_0_INTR1_LOW_G__POS 0
  1923. #define BMI160_USER_INTR_MAP_0_INTR1_LOW_G__LEN 1
  1924. #define BMI160_USER_INTR_MAP_0_INTR1_LOW_G__MSK 0x01
  1925. #define BMI160_USER_INTR_MAP_0_INTR1_LOW_G__REG BMI160_USER_INTR_MAP_0_ADDR
  1926. /**************************************************************/
  1927. /**\name INTERRUPT1 MAPPIONG OF HIGH_G LENGTH, POSITION AND MASK*/
  1928. /**************************************************************/
  1929. /* Int_Map_0 Description - Reg Addr --> 0x55, Bit -->1 */
  1930. #define BMI160_USER_INTR_MAP_0_INTR1_HIGH_G__POS 1
  1931. #define BMI160_USER_INTR_MAP_0_INTR1_HIGH_G__LEN 1
  1932. #define BMI160_USER_INTR_MAP_0_INTR1_HIGH_G__MSK 0x02
  1933. #define BMI160_USER_INTR_MAP_0_INTR1_HIGH_G__REG \
  1934. BMI160_USER_INTR_MAP_0_ADDR
  1935. /**************************************************************/
  1936. /**\name INTERRUPT MAPPIONG OF ANY MOTION_G LENGTH, POSITION AND MASK*/
  1937. /**************************************************************/
  1938. /* Int_Map_0 Description - Reg Addr --> 0x55, Bit -->2 */
  1939. #define BMI160_USER_INTR_MAP_0_INTR1_ANY_MOTION__POS 2
  1940. #define BMI160_USER_INTR_MAP_0_INTR1_ANY_MOTION__LEN 1
  1941. #define BMI160_USER_INTR_MAP_0_INTR1_ANY_MOTION__MSK 0x04
  1942. #define BMI160_USER_INTR_MAP_0_INTR1_ANY_MOTION__REG BMI160_USER_INTR_MAP_0_ADDR
  1943. /**************************************************************/
  1944. /**\name INTERRUPT1 MAPPIONG OF NO MOTION LENGTH, POSITION AND MASK*/
  1945. /**************************************************************/
  1946. /* Int_Map_0 Description - Reg Addr --> 0x55, Bit -->3 */
  1947. #define BMI160_USER_INTR_MAP_0_INTR1_NOMOTION__POS 3
  1948. #define BMI160_USER_INTR_MAP_0_INTR1_NOMOTION__LEN 1
  1949. #define BMI160_USER_INTR_MAP_0_INTR1_NOMOTION__MSK 0x08
  1950. #define BMI160_USER_INTR_MAP_0_INTR1_NOMOTION__REG BMI160_USER_INTR_MAP_0_ADDR
  1951. /**************************************************************/
  1952. /**\name INTERRUPT1 MAPPIONG OF DOUBLE TAP LENGTH, POSITION AND MASK*/
  1953. /**************************************************************/
  1954. /* Int_Map_0 Description - Reg Addr --> 0x55, Bit -->4 */
  1955. #define BMI160_USER_INTR_MAP_0_INTR1_DOUBLE_TAP__POS 4
  1956. #define BMI160_USER_INTR_MAP_0_INTR1_DOUBLE_TAP__LEN 1
  1957. #define BMI160_USER_INTR_MAP_0_INTR1_DOUBLE_TAP__MSK 0x10
  1958. #define BMI160_USER_INTR_MAP_0_INTR1_DOUBLE_TAP__REG \
  1959. BMI160_USER_INTR_MAP_0_ADDR
  1960. /**************************************************************/
  1961. /**\name INTERRUPT1 MAPPIONG OF SINGLE TAP LENGTH, POSITION AND MASK*/
  1962. /**************************************************************/
  1963. /* Int_Map_0 Description - Reg Addr --> 0x55, Bit -->5 */
  1964. #define BMI160_USER_INTR_MAP_0_INTR1_SINGLE_TAP__POS 5
  1965. #define BMI160_USER_INTR_MAP_0_INTR1_SINGLE_TAP__LEN 1
  1966. #define BMI160_USER_INTR_MAP_0_INTR1_SINGLE_TAP__MSK 0x20
  1967. #define BMI160_USER_INTR_MAP_0_INTR1_SINGLE_TAP__REG \
  1968. BMI160_USER_INTR_MAP_0_ADDR
  1969. /**************************************************************/
  1970. /**\name INTERRUPT1 MAPPIONG OF ORIENT LENGTH, POSITION AND MASK*/
  1971. /**************************************************************/
  1972. /* Int_Map_0 Description - Reg Addr --> 0x55, Bit -->6 */
  1973. #define BMI160_USER_INTR_MAP_0_INTR1_ORIENT__POS 6
  1974. #define BMI160_USER_INTR_MAP_0_INTR1_ORIENT__LEN 1
  1975. #define BMI160_USER_INTR_MAP_0_INTR1_ORIENT__MSK 0x40
  1976. #define BMI160_USER_INTR_MAP_0_INTR1_ORIENT__REG \
  1977. BMI160_USER_INTR_MAP_0_ADDR
  1978. /**************************************************************/
  1979. /**\name INTERRUPT MAPPIONG OF FLAT LENGTH, POSITION AND MASK*/
  1980. /**************************************************************/
  1981. /* Int_Map_0 Description - Reg Addr --> 0x56, Bit -->7 */
  1982. #define BMI160_USER_INTR_MAP_0_INTR1_FLAT__POS 7
  1983. #define BMI160_USER_INTR_MAP_0_INTR1_FLAT__LEN 1
  1984. #define BMI160_USER_INTR_MAP_0_INTR1_FLAT__MSK 0x80
  1985. #define BMI160_USER_INTR_MAP_0_INTR1_FLAT__REG BMI160_USER_INTR_MAP_0_ADDR
  1986. /**************************************************************/
  1987. /**\name INTERRUPT1 MAPPIONG OF PMU TRIGGER LENGTH, POSITION AND MASK*/
  1988. /**************************************************************/
  1989. /* Int_Map_1 Description - Reg Addr --> 0x56, Bit -->0 */
  1990. #define BMI160_USER_INTR_MAP_1_INTR2_PMU_TRIG__POS 0
  1991. #define BMI160_USER_INTR_MAP_1_INTR2_PMU_TRIG__LEN 1
  1992. #define BMI160_USER_INTR_MAP_1_INTR2_PMU_TRIG__MSK 0x01
  1993. #define BMI160_USER_INTR_MAP_1_INTR2_PMU_TRIG__REG BMI160_USER_INTR_MAP_1_ADDR
  1994. /**************************************************************/
  1995. /**\name INTERRUPT1 MAPPIONG OF FIFO FULL AND
  1996. WATER MARK LENGTH, POSITION AND MASK*/
  1997. /**************************************************************/
  1998. /* Int_Map_1 Description - Reg Addr --> 0x56, Bit -->1 */
  1999. #define BMI160_USER_INTR_MAP_1_INTR2_FIFO_FULL__POS 1
  2000. #define BMI160_USER_INTR_MAP_1_INTR2_FIFO_FULL__LEN 1
  2001. #define BMI160_USER_INTR_MAP_1_INTR2_FIFO_FULL__MSK 0x02
  2002. #define BMI160_USER_INTR_MAP_1_INTR2_FIFO_FULL__REG \
  2003. BMI160_USER_INTR_MAP_1_ADDR
  2004. /* Int_Map_1 Description - Reg Addr --> 0x56, Bit -->2 */
  2005. #define BMI160_USER_INTR_MAP_1_INTR2_FIFO_WM__POS 2
  2006. #define BMI160_USER_INTR_MAP_1_INTR2_FIFO_WM__LEN 1
  2007. #define BMI160_USER_INTR_MAP_1_INTR2_FIFO_WM__MSK 0x04
  2008. #define BMI160_USER_INTR_MAP_1_INTR2_FIFO_WM__REG \
  2009. BMI160_USER_INTR_MAP_1_ADDR
  2010. /**************************************************************/
  2011. /**\name INTERRUPT1 MAPPIONG OF DATA READY LENGTH, POSITION AND MASK*/
  2012. /**************************************************************/
  2013. /* Int_Map_1 Description - Reg Addr --> 0x56, Bit -->3 */
  2014. #define BMI160_USER_INTR_MAP_1_INTR2_DATA_RDY__POS 3
  2015. #define BMI160_USER_INTR_MAP_1_INTR2_DATA_RDY__LEN 1
  2016. #define BMI160_USER_INTR_MAP_1_INTR2_DATA_RDY__MSK 0x08
  2017. #define BMI160_USER_INTR_MAP_1_INTR2_DATA_RDY__REG \
  2018. BMI160_USER_INTR_MAP_1_ADDR
  2019. /**************************************************************/
  2020. /**\name INTERRUPT1 MAPPIONG OF PMU TRIGGER LENGTH, POSITION AND MASK*/
  2021. /**************************************************************/
  2022. /* Int_Map_1 Description - Reg Addr --> 0x56, Bit -->4 */
  2023. #define BMI160_USER_INTR_MAP_1_INTR1_PMU_TRIG__POS 4
  2024. #define BMI160_USER_INTR_MAP_1_INTR1_PMU_TRIG__LEN 1
  2025. #define BMI160_USER_INTR_MAP_1_INTR1_PMU_TRIG__MSK 0x10
  2026. #define BMI160_USER_INTR_MAP_1_INTR1_PMU_TRIG__REG BMI160_USER_INTR_MAP_1_ADDR
  2027. /**************************************************************/
  2028. /**\name INTERRUPT1 MAPPIONG OF FIFO FULL AND
  2029. WATER MARK LENGTH, POSITION AND MASK*/
  2030. /**************************************************************/
  2031. /* Int_Map_1 Description - Reg Addr --> 0x56, Bit -->5 */
  2032. #define BMI160_USER_INTR_MAP_1_INTR1_FIFO_FULL__POS 5
  2033. #define BMI160_USER_INTR_MAP_1_INTR1_FIFO_FULL__LEN 1
  2034. #define BMI160_USER_INTR_MAP_1_INTR1_FIFO_FULL__MSK 0x20
  2035. #define BMI160_USER_INTR_MAP_1_INTR1_FIFO_FULL__REG \
  2036. BMI160_USER_INTR_MAP_1_ADDR
  2037. /* Int_Map_1 Description - Reg Addr --> 0x56, Bit -->6 */
  2038. #define BMI160_USER_INTR_MAP_1_INTR1_FIFO_WM__POS 6
  2039. #define BMI160_USER_INTR_MAP_1_INTR1_FIFO_WM__LEN 1
  2040. #define BMI160_USER_INTR_MAP_1_INTR1_FIFO_WM__MSK 0x40
  2041. #define BMI160_USER_INTR_MAP_1_INTR1_FIFO_WM__REG \
  2042. BMI160_USER_INTR_MAP_1_ADDR
  2043. /**************************************************************/
  2044. /**\name INTERRUPT1 MAPPIONG OF DATA READY LENGTH, POSITION AND MASK*/
  2045. /**************************************************************/
  2046. /* Int_Map_1 Description - Reg Addr --> 0x56, Bit -->7 */
  2047. #define BMI160_USER_INTR_MAP_1_INTR1_DATA_RDY__POS 7
  2048. #define BMI160_USER_INTR_MAP_1_INTR1_DATA_RDY__LEN 1
  2049. #define BMI160_USER_INTR_MAP_1_INTR1_DATA_RDY__MSK 0x80
  2050. #define BMI160_USER_INTR_MAP_1_INTR1_DATA_RDY__REG \
  2051. BMI160_USER_INTR_MAP_1_ADDR
  2052. /**************************************************************/
  2053. /**\name INTERRUPT2 MAPPIONG OF LOW_G LENGTH, POSITION AND MASK*/
  2054. /**************************************************************/
  2055. /* Int_Map_2 Description - Reg Addr --> 0x57, Bit -->0 */
  2056. #define BMI160_USER_INTR_MAP_2_INTR2_LOW_G__POS 0
  2057. #define BMI160_USER_INTR_MAP_2_INTR2_LOW_G__LEN 1
  2058. #define BMI160_USER_INTR_MAP_2_INTR2_LOW_G__MSK 0x01
  2059. #define BMI160_USER_INTR_MAP_2_INTR2_LOW_G__REG BMI160_USER_INTR_MAP_2_ADDR
  2060. /**************************************************************/
  2061. /**\name INTERRUPT2 MAPPIONG OF HIGH_G LENGTH, POSITION AND MASK*/
  2062. /**************************************************************/
  2063. /* Int_Map_2 Description - Reg Addr --> 0x57, Bit -->1 */
  2064. #define BMI160_USER_INTR_MAP_2_INTR2_HIGH_G__POS 1
  2065. #define BMI160_USER_INTR_MAP_2_INTR2_HIGH_G__LEN 1
  2066. #define BMI160_USER_INTR_MAP_2_INTR2_HIGH_G__MSK 0x02
  2067. #define BMI160_USER_INTR_MAP_2_INTR2_HIGH_G__REG \
  2068. BMI160_USER_INTR_MAP_2_ADDR
  2069. /**************************************************************/
  2070. /**\name INTERRUPT2 MAPPIONG OF ANY MOTION LENGTH, POSITION AND MASK*/
  2071. /**************************************************************/
  2072. /* Int_Map_2 Description - Reg Addr --> 0x57, Bit -->2 */
  2073. #define BMI160_USER_INTR_MAP_2_INTR2_ANY_MOTION__POS 2
  2074. #define BMI160_USER_INTR_MAP_2_INTR2_ANY_MOTION__LEN 1
  2075. #define BMI160_USER_INTR_MAP_2_INTR2_ANY_MOTION__MSK 0x04
  2076. #define BMI160_USER_INTR_MAP_2_INTR2_ANY_MOTION__REG BMI160_USER_INTR_MAP_2_ADDR
  2077. /**************************************************************/
  2078. /**\name INTERRUPT2 MAPPIONG OF NO MOTION LENGTH, POSITION AND MASK*/
  2079. /**************************************************************/
  2080. /* Int_Map_2 Description - Reg Addr --> 0x57, Bit -->3 */
  2081. #define BMI160_USER_INTR_MAP_2_INTR2_NOMOTION__POS 3
  2082. #define BMI160_USER_INTR_MAP_2_INTR2_NOMOTION__LEN 1
  2083. #define BMI160_USER_INTR_MAP_2_INTR2_NOMOTION__MSK 0x08
  2084. #define BMI160_USER_INTR_MAP_2_INTR2_NOMOTION__REG BMI160_USER_INTR_MAP_2_ADDR
  2085. /**************************************************************/
  2086. /**\name INTERRUPT2 MAPPIONG OF DOUBLE TAP LENGTH, POSITION AND MASK*/
  2087. /**************************************************************/
  2088. /* Int_Map_2 Description - Reg Addr --> 0x57, Bit -->4 */
  2089. #define BMI160_USER_INTR_MAP_2_INTR2_DOUBLE_TAP__POS 4
  2090. #define BMI160_USER_INTR_MAP_2_INTR2_DOUBLE_TAP__LEN 1
  2091. #define BMI160_USER_INTR_MAP_2_INTR2_DOUBLE_TAP__MSK 0x10
  2092. #define BMI160_USER_INTR_MAP_2_INTR2_DOUBLE_TAP__REG \
  2093. BMI160_USER_INTR_MAP_2_ADDR
  2094. /**************************************************************/
  2095. /**\name INTERRUPT2 MAPPIONG OF SINGLE TAP LENGTH, POSITION AND MASK*/
  2096. /**************************************************************/
  2097. /* Int_Map_2 Description - Reg Addr --> 0x57, Bit -->5 */
  2098. #define BMI160_USER_INTR_MAP_2_INTR2_SINGLE_TAP__POS 5
  2099. #define BMI160_USER_INTR_MAP_2_INTR2_SINGLE_TAP__LEN 1
  2100. #define BMI160_USER_INTR_MAP_2_INTR2_SINGLE_TAP__MSK 0x20
  2101. #define BMI160_USER_INTR_MAP_2_INTR2_SINGLE_TAP__REG \
  2102. BMI160_USER_INTR_MAP_2_ADDR
  2103. /**************************************************************/
  2104. /**\name INTERRUPT2 MAPPIONG OF ORIENT LENGTH, POSITION AND MASK*/
  2105. /**************************************************************/
  2106. /* Int_Map_2 Description - Reg Addr --> 0x57, Bit -->6 */
  2107. #define BMI160_USER_INTR_MAP_2_INTR2_ORIENT__POS 6
  2108. #define BMI160_USER_INTR_MAP_2_INTR2_ORIENT__LEN 1
  2109. #define BMI160_USER_INTR_MAP_2_INTR2_ORIENT__MSK 0x40
  2110. #define BMI160_USER_INTR_MAP_2_INTR2_ORIENT__REG \
  2111. BMI160_USER_INTR_MAP_2_ADDR
  2112. /**************************************************************/
  2113. /**\name INTERRUPT2 MAPPIONG OF FLAT LENGTH, POSITION AND MASK*/
  2114. /**************************************************************/
  2115. /* Int_Map_2 Description - Reg Addr --> 0x57, Bit -->7 */
  2116. #define BMI160_USER_INTR_MAP_2_INTR2_FLAT__POS 7
  2117. #define BMI160_USER_INTR_MAP_2_INTR2_FLAT__LEN 1
  2118. #define BMI160_USER_INTR_MAP_2_INTR2_FLAT__MSK 0x80
  2119. #define BMI160_USER_INTR_MAP_2_INTR2_FLAT__REG BMI160_USER_INTR_MAP_2_ADDR
  2120. /**************************************************************/
  2121. /**\name TAP SOURCE LENGTH, POSITION AND MASK*/
  2122. /**************************************************************/
  2123. /* Int_Data_0 Description - Reg Addr --> 0x58, Bit --> 3 */
  2124. #define BMI160_USER_INTR_DATA_0_INTR_TAP_SOURCE__POS 3
  2125. #define BMI160_USER_INTR_DATA_0_INTR_TAP_SOURCE__LEN 1
  2126. #define BMI160_USER_INTR_DATA_0_INTR_TAP_SOURCE__MSK 0x08
  2127. #define BMI160_USER_INTR_DATA_0_INTR_TAP_SOURCE__REG \
  2128. BMI160_USER_INTR_DATA_0_ADDR
  2129. /**************************************************************/
  2130. /**\name HIGH SOURCE LENGTH, POSITION AND MASK*/
  2131. /**************************************************************/
  2132. /* Int_Data_0 Description - Reg Addr --> 0x58, Bit --> 7 */
  2133. #define BMI160_USER_INTR_DATA_0_INTR_LOW_HIGH_SOURCE__POS 7
  2134. #define BMI160_USER_INTR_DATA_0_INTR_LOW_HIGH_SOURCE__LEN 1
  2135. #define BMI160_USER_INTR_DATA_0_INTR_LOW_HIGH_SOURCE__MSK 0x80
  2136. #define BMI160_USER_INTR_DATA_0_INTR_LOW_HIGH_SOURCE__REG \
  2137. BMI160_USER_INTR_DATA_0_ADDR
  2138. /**************************************************************/
  2139. /**\name MOTION SOURCE LENGTH, POSITION AND MASK*/
  2140. /**************************************************************/
  2141. /* Int_Data_1 Description - Reg Addr --> 0x59, Bit --> 7 */
  2142. #define BMI160_USER_INTR_DATA_1_INTR_MOTION_SOURCE__POS 7
  2143. #define BMI160_USER_INTR_DATA_1_INTR_MOTION_SOURCE__LEN 1
  2144. #define BMI160_USER_INTR_DATA_1_INTR_MOTION_SOURCE__MSK 0x80
  2145. #define BMI160_USER_INTR_DATA_1_INTR_MOTION_SOURCE__REG \
  2146. BMI160_USER_INTR_DATA_1_ADDR
  2147. /**************************************************************/
  2148. /**\name LOW HIGH DURATION LENGTH, POSITION AND MASK*/
  2149. /**************************************************************/
  2150. /* Int_LowHigh_0 Description - Reg Addr --> 0x5a, Bit --> 0...7 */
  2151. #define BMI160_USER_INTR_LOWHIGH_0_INTR_LOW_DURN__POS 0
  2152. #define BMI160_USER_INTR_LOWHIGH_0_INTR_LOW_DURN__LEN 8
  2153. #define BMI160_USER_INTR_LOWHIGH_0_INTR_LOW_DURN__MSK 0xFF
  2154. #define BMI160_USER_INTR_LOWHIGH_0_INTR_LOW_DURN__REG \
  2155. BMI160_USER_INTR_LOWHIGH_0_ADDR
  2156. /**************************************************************/
  2157. /**\name LOW THRESHOLD LENGTH, POSITION AND MASK*/
  2158. /**************************************************************/
  2159. /* Int_LowHigh_1 Description - Reg Addr --> 0x5b, Bit --> 0...7 */
  2160. #define BMI160_USER_INTR_LOWHIGH_1_INTR_LOW_THRES__POS 0
  2161. #define BMI160_USER_INTR_LOWHIGH_1_INTR_LOW_THRES__LEN 8
  2162. #define BMI160_USER_INTR_LOWHIGH_1_INTR_LOW_THRES__MSK 0xFF
  2163. #define BMI160_USER_INTR_LOWHIGH_1_INTR_LOW_THRES__REG \
  2164. BMI160_USER_INTR_LOWHIGH_1_ADDR
  2165. /**************************************************************/
  2166. /**\name LOW HYSTERESIS LENGTH, POSITION AND MASK*/
  2167. /**************************************************************/
  2168. /* Int_LowHigh_2 Description - Reg Addr --> 0x5c, Bit --> 0...1 */
  2169. #define BMI160_USER_INTR_LOWHIGH_2_INTR_LOW_G_HYST__POS 0
  2170. #define BMI160_USER_INTR_LOWHIGH_2_INTR_LOW_G_HYST__LEN 2
  2171. #define BMI160_USER_INTR_LOWHIGH_2_INTR_LOW_G_HYST__MSK 0x03
  2172. #define BMI160_USER_INTR_LOWHIGH_2_INTR_LOW_G_HYST__REG \
  2173. BMI160_USER_INTR_LOWHIGH_2_ADDR
  2174. /**************************************************************/
  2175. /**\name LOW MODE LENGTH, POSITION AND MASK*/
  2176. /**************************************************************/
  2177. /* Int_LowHigh_2 Description - Reg Addr --> 0x5c, Bit --> 2 */
  2178. #define BMI160_USER_INTR_LOWHIGH_2_INTR_LOW_G_MODE__POS 2
  2179. #define BMI160_USER_INTR_LOWHIGH_2_INTR_LOW_G_MODE__LEN 1
  2180. #define BMI160_USER_INTR_LOWHIGH_2_INTR_LOW_G_MODE__MSK 0x04
  2181. #define BMI160_USER_INTR_LOWHIGH_2_INTR_LOW_G_MODE__REG \
  2182. BMI160_USER_INTR_LOWHIGH_2_ADDR
  2183. /**************************************************************/
  2184. /**\name HIGH_G HYSTERESIS LENGTH, POSITION AND MASK*/
  2185. /**************************************************************/
  2186. /* Int_LowHigh_2 Description - Reg Addr --> 0x5c, Bit --> 6...7 */
  2187. #define BMI160_USER_INTR_LOWHIGH_2_INTR_HIGH_G_HYST__POS 6
  2188. #define BMI160_USER_INTR_LOWHIGH_2_INTR_HIGH_G_HYST__LEN 2
  2189. #define BMI160_USER_INTR_LOWHIGH_2_INTR_HIGH_G_HYST__MSK 0xC0
  2190. #define BMI160_USER_INTR_LOWHIGH_2_INTR_HIGH_G_HYST__REG \
  2191. BMI160_USER_INTR_LOWHIGH_2_ADDR
  2192. /**************************************************************/
  2193. /**\name HIGH_G DURATION LENGTH, POSITION AND MASK*/
  2194. /**************************************************************/
  2195. /* Int_LowHigh_3 Description - Reg Addr --> 0x5d, Bit --> 0...7 */
  2196. #define BMI160_USER_INTR_LOWHIGH_3_INTR_HIGH_G_DURN__POS 0
  2197. #define BMI160_USER_INTR_LOWHIGH_3_INTR_HIGH_G_DURN__LEN 8
  2198. #define BMI160_USER_INTR_LOWHIGH_3_INTR_HIGH_G_DURN__MSK 0xFF
  2199. #define BMI160_USER_INTR_LOWHIGH_3_INTR_HIGH_G_DURN__REG \
  2200. BMI160_USER_INTR_LOWHIGH_3_ADDR
  2201. /**************************************************************/
  2202. /**\name HIGH_G THRESHOLD LENGTH, POSITION AND MASK*/
  2203. /**************************************************************/
  2204. /* Int_LowHigh_4 Description - Reg Addr --> 0x5e, Bit --> 0...7 */
  2205. #define BMI160_USER_INTR_LOWHIGH_4_INTR_HIGH_THRES__POS 0
  2206. #define BMI160_USER_INTR_LOWHIGH_4_INTR_HIGH_THRES__LEN 8
  2207. #define BMI160_USER_INTR_LOWHIGH_4_INTR_HIGH_THRES__MSK 0xFF
  2208. #define BMI160_USER_INTR_LOWHIGH_4_INTR_HIGH_THRES__REG \
  2209. BMI160_USER_INTR_LOWHIGH_4_ADDR
  2210. /**************************************************************/
  2211. /**\name ANY MOTION DURATION LENGTH, POSITION AND MASK*/
  2212. /**************************************************************/
  2213. /* Int_Motion_0 Description - Reg Addr --> 0x5f, Bit --> 0...1 */
  2214. #define BMI160_USER_INTR_MOTION_0_INTR_ANY_MOTION_DURN__POS 0
  2215. #define BMI160_USER_INTR_MOTION_0_INTR_ANY_MOTION_DURN__LEN 2
  2216. #define BMI160_USER_INTR_MOTION_0_INTR_ANY_MOTION_DURN__MSK 0x03
  2217. #define BMI160_USER_INTR_MOTION_0_INTR_ANY_MOTION_DURN__REG \
  2218. BMI160_USER_INTR_MOTION_0_ADDR
  2219. /**************************************************************/
  2220. /**\name SLOW/NO MOTION DURATION LENGTH, POSITION AND MASK*/
  2221. /**************************************************************/
  2222. /* Int_Motion_0 Description - Reg Addr --> 0x5f, Bit --> 2...7 */
  2223. #define BMI160_USER_INTR_MOTION_0_INTR_SLOW_NO_MOTION_DURN__POS 2
  2224. #define BMI160_USER_INTR_MOTION_0_INTR_SLOW_NO_MOTION_DURN__LEN 6
  2225. #define BMI160_USER_INTR_MOTION_0_INTR_SLOW_NO_MOTION_DURN__MSK 0xFC
  2226. #define BMI160_USER_INTR_MOTION_0_INTR_SLOW_NO_MOTION_DURN__REG \
  2227. BMI160_USER_INTR_MOTION_0_ADDR
  2228. /**************************************************************/
  2229. /**\name ANY MOTION THRESHOLD LENGTH, POSITION AND MASK*/
  2230. /**************************************************************/
  2231. /* Int_Motion_1 Description - Reg Addr --> 0x60, Bit --> 0...7 */
  2232. #define BMI160_USER_INTR_MOTION_1_INTR_ANY_MOTION_THRES__POS 0
  2233. #define BMI160_USER_INTR_MOTION_1_INTR_ANY_MOTION_THRES__LEN 8
  2234. #define BMI160_USER_INTR_MOTION_1_INTR_ANY_MOTION_THRES__MSK 0xFF
  2235. #define BMI160_USER_INTR_MOTION_1_INTR_ANY_MOTION_THRES__REG \
  2236. BMI160_USER_INTR_MOTION_1_ADDR
  2237. /**************************************************************/
  2238. /**\name SLOW/NO MOTION THRESHOLD LENGTH, POSITION AND MASK*/
  2239. /**************************************************************/
  2240. /* Int_Motion_2 Description - Reg Addr --> 0x61, Bit --> 0...7 */
  2241. #define BMI160_USER_INTR_MOTION_2_INTR_SLOW_NO_MOTION_THRES__POS 0
  2242. #define BMI160_USER_INTR_MOTION_2_INTR_SLOW_NO_MOTION_THRES__LEN 8
  2243. #define BMI160_USER_INTR_MOTION_2_INTR_SLOW_NO_MOTION_THRES__MSK 0xFF
  2244. #define BMI160_USER_INTR_MOTION_2_INTR_SLOW_NO_MOTION_THRES__REG \
  2245. BMI160_USER_INTR_MOTION_2_ADDR
  2246. /**************************************************************/
  2247. /**\name SLOW/NO MOTION SELECT LENGTH, POSITION AND MASK*/
  2248. /**************************************************************/
  2249. /* Int_Motion_3 Description - Reg Addr --> 0x62, Bit --> 0 */
  2250. #define BMI160_USER_INTR_MOTION_3_INTR_SLOW_NO_MOTION_SELECT__POS 0
  2251. #define BMI160_USER_INTR_MOTION_3_INTR_SLOW_NO_MOTION_SELECT__LEN 1
  2252. #define BMI160_USER_INTR_MOTION_3_INTR_SLOW_NO_MOTION_SELECT__MSK 0x01
  2253. #define BMI160_USER_INTR_MOTION_3_INTR_SLOW_NO_MOTION_SELECT__REG \
  2254. BMI160_USER_INTR_MOTION_3_ADDR
  2255. /**************************************************************/
  2256. /**\name SIGNIFICANT MOTION SELECT LENGTH, POSITION AND MASK*/
  2257. /**************************************************************/
  2258. /* Int_Motion_3 Description - Reg Addr --> 0x62, Bit --> 1 */
  2259. #define BMI160_USER_INTR_SIGNIFICATION_MOTION_SELECT__POS 1
  2260. #define BMI160_USER_INTR_SIGNIFICATION_MOTION_SELECT__LEN 1
  2261. #define BMI160_USER_INTR_SIGNIFICATION_MOTION_SELECT__MSK 0x02
  2262. #define BMI160_USER_INTR_SIGNIFICATION_MOTION_SELECT__REG \
  2263. BMI160_USER_INTR_MOTION_3_ADDR
  2264. /* Int_Motion_3 Description - Reg Addr --> 0x62, Bit --> 3..2 */
  2265. #define BMI160_USER_INTR_SIGNIFICANT_MOTION_SKIP__POS 2
  2266. #define BMI160_USER_INTR_SIGNIFICANT_MOTION_SKIP__LEN 2
  2267. #define BMI160_USER_INTR_SIGNIFICANT_MOTION_SKIP__MSK 0x0C
  2268. #define BMI160_USER_INTR_SIGNIFICANT_MOTION_SKIP__REG \
  2269. BMI160_USER_INTR_MOTION_3_ADDR
  2270. /* Int_Motion_3 Description - Reg Addr --> 0x62, Bit --> 5..4 */
  2271. #define BMI160_USER_INTR_SIGNIFICANT_MOTION_PROOF__POS 4
  2272. #define BMI160_USER_INTR_SIGNIFICANT_MOTION_PROOF__LEN 2
  2273. #define BMI160_USER_INTR_SIGNIFICANT_MOTION_PROOF__MSK 0x30
  2274. #define BMI160_USER_INTR_SIGNIFICANT_MOTION_PROOF__REG \
  2275. BMI160_USER_INTR_MOTION_3_ADDR
  2276. /**************************************************************/
  2277. /**\name TAP DURATION LENGTH, POSITION AND MASK*/
  2278. /**************************************************************/
  2279. /* INT_TAP_0 Description - Reg Addr --> 0x63, Bit --> 0..2*/
  2280. #define BMI160_USER_INTR_TAP_0_INTR_TAP_DURN__POS 0
  2281. #define BMI160_USER_INTR_TAP_0_INTR_TAP_DURN__LEN 3
  2282. #define BMI160_USER_INTR_TAP_0_INTR_TAP_DURN__MSK 0x07
  2283. #define BMI160_USER_INTR_TAP_0_INTR_TAP_DURN__REG \
  2284. BMI160_USER_INTR_TAP_0_ADDR
  2285. /**************************************************************/
  2286. /**\name TAP SHOCK LENGTH, POSITION AND MASK*/
  2287. /**************************************************************/
  2288. /* Int_Tap_0 Description - Reg Addr --> 0x63, Bit --> 6 */
  2289. #define BMI160_USER_INTR_TAP_0_INTR_TAP_SHOCK__POS 6
  2290. #define BMI160_USER_INTR_TAP_0_INTR_TAP_SHOCK__LEN 1
  2291. #define BMI160_USER_INTR_TAP_0_INTR_TAP_SHOCK__MSK 0x40
  2292. #define BMI160_USER_INTR_TAP_0_INTR_TAP_SHOCK__REG BMI160_USER_INTR_TAP_0_ADDR
  2293. /**************************************************************/
  2294. /**\name TAP QUIET LENGTH, POSITION AND MASK*/
  2295. /**************************************************************/
  2296. /* Int_Tap_0 Description - Reg Addr --> 0x63, Bit --> 7 */
  2297. #define BMI160_USER_INTR_TAP_0_INTR_TAP_QUIET__POS 7
  2298. #define BMI160_USER_INTR_TAP_0_INTR_TAP_QUIET__LEN 1
  2299. #define BMI160_USER_INTR_TAP_0_INTR_TAP_QUIET__MSK 0x80
  2300. #define BMI160_USER_INTR_TAP_0_INTR_TAP_QUIET__REG BMI160_USER_INTR_TAP_0_ADDR
  2301. /**************************************************************/
  2302. /**\name TAP THRESHOLD LENGTH, POSITION AND MASK*/
  2303. /**************************************************************/
  2304. /* Int_Tap_1 Description - Reg Addr --> 0x64, Bit --> 0...4 */
  2305. #define BMI160_USER_INTR_TAP_1_INTR_TAP_THRES__POS 0
  2306. #define BMI160_USER_INTR_TAP_1_INTR_TAP_THRES__LEN 5
  2307. #define BMI160_USER_INTR_TAP_1_INTR_TAP_THRES__MSK 0x1F
  2308. #define BMI160_USER_INTR_TAP_1_INTR_TAP_THRES__REG BMI160_USER_INTR_TAP_1_ADDR
  2309. /**************************************************************/
  2310. /**\name ORIENT MODE LENGTH, POSITION AND MASK*/
  2311. /**************************************************************/
  2312. /* Int_Orient_0 Description - Reg Addr --> 0x65, Bit --> 0...1 */
  2313. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_MODE__POS 0
  2314. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_MODE__LEN 2
  2315. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_MODE__MSK 0x03
  2316. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_MODE__REG \
  2317. BMI160_USER_INTR_ORIENT_0_ADDR
  2318. /**************************************************************/
  2319. /**\name ORIENT BLOCKING LENGTH, POSITION AND MASK*/
  2320. /**************************************************************/
  2321. /* Int_Orient_0 Description - Reg Addr --> 0x65, Bit --> 2...3 */
  2322. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_BLOCKING__POS 2
  2323. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_BLOCKING__LEN 2
  2324. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_BLOCKING__MSK 0x0C
  2325. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_BLOCKING__REG \
  2326. BMI160_USER_INTR_ORIENT_0_ADDR
  2327. /**************************************************************/
  2328. /**\name ORIENT HYSTERESIS LENGTH, POSITION AND MASK*/
  2329. /**************************************************************/
  2330. /* Int_Orient_0 Description - Reg Addr --> 0x65, Bit --> 4...7 */
  2331. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_HYST__POS 4
  2332. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_HYST__LEN 4
  2333. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_HYST__MSK 0xF0
  2334. #define BMI160_USER_INTR_ORIENT_0_INTR_ORIENT_HYST__REG \
  2335. BMI160_USER_INTR_ORIENT_0_ADDR
  2336. /**************************************************************/
  2337. /**\name ORIENT THETA LENGTH, POSITION AND MASK*/
  2338. /**************************************************************/
  2339. /* Int_Orient_1 Description - Reg Addr --> 0x66, Bit --> 0...5 */
  2340. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_THETA__POS 0
  2341. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_THETA__LEN 6
  2342. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_THETA__MSK 0x3F
  2343. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_THETA__REG \
  2344. BMI160_USER_INTR_ORIENT_1_ADDR
  2345. /**************************************************************/
  2346. /**\name ORIENT UD LENGTH, POSITION AND MASK*/
  2347. /**************************************************************/
  2348. /* Int_Orient_1 Description - Reg Addr --> 0x66, Bit --> 6 */
  2349. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_UD_ENABLE__POS 6
  2350. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_UD_ENABLE__LEN 1
  2351. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_UD_ENABLE__MSK 0x40
  2352. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_UD_ENABLE__REG \
  2353. BMI160_USER_INTR_ORIENT_1_ADDR
  2354. /**************************************************************/
  2355. /**\name ORIENT AXIS LENGTH, POSITION AND MASK*/
  2356. /**************************************************************/
  2357. /* Int_Orient_1 Description - Reg Addr --> 0x66, Bit --> 7 */
  2358. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_AXES_EX__POS 7
  2359. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_AXES_EX__LEN 1
  2360. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_AXES_EX__MSK 0x80
  2361. #define BMI160_USER_INTR_ORIENT_1_INTR_ORIENT_AXES_EX__REG \
  2362. BMI160_USER_INTR_ORIENT_1_ADDR
  2363. /**************************************************************/
  2364. /**\name FLAT THETA LENGTH, POSITION AND MASK*/
  2365. /**************************************************************/
  2366. /* Int_Flat_0 Description - Reg Addr --> 0x67, Bit --> 0...5 */
  2367. #define BMI160_USER_INTR_FLAT_0_INTR_FLAT_THETA__POS 0
  2368. #define BMI160_USER_INTR_FLAT_0_INTR_FLAT_THETA__LEN 6
  2369. #define BMI160_USER_INTR_FLAT_0_INTR_FLAT_THETA__MSK 0x3F
  2370. #define BMI160_USER_INTR_FLAT_0_INTR_FLAT_THETA__REG \
  2371. BMI160_USER_INTR_FLAT_0_ADDR
  2372. /**************************************************************/
  2373. /**\name FLAT HYSTERESIS LENGTH, POSITION AND MASK*/
  2374. /**************************************************************/
  2375. /* Int_Flat_1 Description - Reg Addr --> 0x68, Bit --> 0...3 */
  2376. #define BMI160_USER_INTR_FLAT_1_INTR_FLAT_HYST__POS 0
  2377. #define BMI160_USER_INTR_FLAT_1_INTR_FLAT_HYST__LEN 4
  2378. #define BMI160_USER_INTR_FLAT_1_INTR_FLAT_HYST__MSK 0x0F
  2379. #define BMI160_USER_INTR_FLAT_1_INTR_FLAT_HYST__REG \
  2380. BMI160_USER_INTR_FLAT_1_ADDR
  2381. /**************************************************************/
  2382. /**\name FLAT HOLD LENGTH, POSITION AND MASK*/
  2383. /**************************************************************/
  2384. /* Int_Flat_1 Description - Reg Addr --> 0x68, Bit --> 4...5 */
  2385. #define BMI160_USER_INTR_FLAT_1_INTR_FLAT_HOLD__POS 4
  2386. #define BMI160_USER_INTR_FLAT_1_INTR_FLAT_HOLD__LEN 2
  2387. #define BMI160_USER_INTR_FLAT_1_INTR_FLAT_HOLD__MSK 0x30
  2388. #define BMI160_USER_INTR_FLAT_1_INTR_FLAT_HOLD__REG \
  2389. BMI160_USER_INTR_FLAT_1_ADDR
  2390. /**************************************************************/
  2391. /**\name FOC ACCEL XYZ LENGTH, POSITION AND MASK*/
  2392. /**************************************************************/
  2393. /* Foc_Conf Description - Reg Addr --> 0x69, Bit --> 0...1 */
  2394. #define BMI160_USER_FOC_ACCEL_Z__POS 0
  2395. #define BMI160_USER_FOC_ACCEL_Z__LEN 2
  2396. #define BMI160_USER_FOC_ACCEL_Z__MSK 0x03
  2397. #define BMI160_USER_FOC_ACCEL_Z__REG BMI160_USER_FOC_CONFIG_ADDR
  2398. /* Foc_Conf Description - Reg Addr --> 0x69, Bit --> 2...3 */
  2399. #define BMI160_USER_FOC_ACCEL_Y__POS 2
  2400. #define BMI160_USER_FOC_ACCEL_Y__LEN 2
  2401. #define BMI160_USER_FOC_ACCEL_Y__MSK 0x0C
  2402. #define BMI160_USER_FOC_ACCEL_Y__REG BMI160_USER_FOC_CONFIG_ADDR
  2403. /* Foc_Conf Description - Reg Addr --> 0x69, Bit --> 4...5 */
  2404. #define BMI160_USER_FOC_ACCEL_X__POS 4
  2405. #define BMI160_USER_FOC_ACCEL_X__LEN 2
  2406. #define BMI160_USER_FOC_ACCEL_X__MSK 0x30
  2407. #define BMI160_USER_FOC_ACCEL_X__REG BMI160_USER_FOC_CONFIG_ADDR
  2408. /**************************************************************/
  2409. /**\name FOC GYRO LENGTH, POSITION AND MASK*/
  2410. /**************************************************************/
  2411. /* Foc_Conf Description - Reg Addr --> 0x69, Bit --> 6 */
  2412. #define BMI160_USER_FOC_GYRO_ENABLE__POS 6
  2413. #define BMI160_USER_FOC_GYRO_ENABLE__LEN 1
  2414. #define BMI160_USER_FOC_GYRO_ENABLE__MSK 0x40
  2415. #define BMI160_USER_FOC_GYRO_ENABLE__REG \
  2416. BMI160_USER_FOC_CONFIG_ADDR
  2417. /**************************************************************/
  2418. /**\name NVM PROGRAM LENGTH, POSITION AND MASK*/
  2419. /**************************************************************/
  2420. /* CONF Description - Reg Addr --> 0x6A, Bit --> 1 */
  2421. #define BMI160_USER_CONFIG_NVM_PROG_ENABLE__POS 1
  2422. #define BMI160_USER_CONFIG_NVM_PROG_ENABLE__LEN 1
  2423. #define BMI160_USER_CONFIG_NVM_PROG_ENABLE__MSK 0x02
  2424. #define BMI160_USER_CONFIG_NVM_PROG_ENABLE__REG \
  2425. BMI160_USER_CONFIG_ADDR
  2426. /*IF_CONF Description - Reg Addr --> 0x6B, Bit --> 0 */
  2427. #define BMI160_USER_IF_CONFIG_SPI3__POS 0
  2428. #define BMI160_USER_IF_CONFIG_SPI3__LEN 1
  2429. #define BMI160_USER_IF_CONFIG_SPI3__MSK 0x01
  2430. #define BMI160_USER_IF_CONFIG_SPI3__REG BMI160_USER_IF_CONFIG_ADDR
  2431. /*IF_CONF Description - Reg Addr --> 0x6B, Bit --> 5..4 */
  2432. #define BMI160_USER_IF_CONFIG_IF_MODE__POS 4
  2433. #define BMI160_USER_IF_CONFIG_IF_MODE__LEN 2
  2434. #define BMI160_USER_IF_CONFIG_IF_MODE__MSK 0x30
  2435. #define BMI160_USER_IF_CONFIG_IF_MODE__REG \
  2436. BMI160_USER_IF_CONFIG_ADDR
  2437. /**************************************************************/
  2438. /**\name GYRO SLEEP CONFIGURATION LENGTH, POSITION AND MASK*/
  2439. /**************************************************************/
  2440. /* Pmu_Trigger Description - Reg Addr --> 0x6c, Bit --> 0...2 */
  2441. #define BMI160_USER_GYRO_SLEEP_TRIGGER__POS 0
  2442. #define BMI160_USER_GYRO_SLEEP_TRIGGER__LEN 3
  2443. #define BMI160_USER_GYRO_SLEEP_TRIGGER__MSK 0x07
  2444. #define BMI160_USER_GYRO_SLEEP_TRIGGER__REG BMI160_USER_PMU_TRIGGER_ADDR
  2445. /* Pmu_Trigger Description - Reg Addr --> 0x6c, Bit --> 3...4 */
  2446. #define BMI160_USER_GYRO_WAKEUP_TRIGGER__POS 3
  2447. #define BMI160_USER_GYRO_WAKEUP_TRIGGER__LEN 2
  2448. #define BMI160_USER_GYRO_WAKEUP_TRIGGER__MSK 0x18
  2449. #define BMI160_USER_GYRO_WAKEUP_TRIGGER__REG BMI160_USER_PMU_TRIGGER_ADDR
  2450. /* Pmu_Trigger Description - Reg Addr --> 0x6c, Bit --> 5 */
  2451. #define BMI160_USER_GYRO_SLEEP_STATE__POS 5
  2452. #define BMI160_USER_GYRO_SLEEP_STATE__LEN 1
  2453. #define BMI160_USER_GYRO_SLEEP_STATE__MSK 0x20
  2454. #define BMI160_USER_GYRO_SLEEP_STATE__REG BMI160_USER_PMU_TRIGGER_ADDR
  2455. /* Pmu_Trigger Description - Reg Addr --> 0x6c, Bit --> 6 */
  2456. #define BMI160_USER_GYRO_WAKEUP_INTR__POS 6
  2457. #define BMI160_USER_GYRO_WAKEUP_INTR__LEN 1
  2458. #define BMI160_USER_GYRO_WAKEUP_INTR__MSK 0x40
  2459. #define BMI160_USER_GYRO_WAKEUP_INTR__REG BMI160_USER_PMU_TRIGGER_ADDR
  2460. /**************************************************************/
  2461. /**\name ACCEL SELF TEST LENGTH, POSITION AND MASK*/
  2462. /**************************************************************/
  2463. /* Self_Test Description - Reg Addr --> 0x6d, Bit --> 0...1 */
  2464. #define BMI160_USER_ACCEL_SELFTEST_AXIS__POS 0
  2465. #define BMI160_USER_ACCEL_SELFTEST_AXIS__LEN 2
  2466. #define BMI160_USER_ACCEL_SELFTEST_AXIS__MSK 0x03
  2467. #define BMI160_USER_ACCEL_SELFTEST_AXIS__REG BMI160_USER_SELF_TEST_ADDR
  2468. /* Self_Test Description - Reg Addr --> 0x6d, Bit --> 2 */
  2469. #define BMI160_USER_ACCEL_SELFTEST_SIGN__POS 2
  2470. #define BMI160_USER_ACCEL_SELFTEST_SIGN__LEN 1
  2471. #define BMI160_USER_ACCEL_SELFTEST_SIGN__MSK 0x04
  2472. #define BMI160_USER_ACCEL_SELFTEST_SIGN__REG BMI160_USER_SELF_TEST_ADDR
  2473. /* Self_Test Description - Reg Addr --> 0x6d, Bit --> 3 */
  2474. #define BMI160_USER_SELFTEST_AMP__POS 3
  2475. #define BMI160_USER_SELFTEST_AMP__LEN 1
  2476. #define BMI160_USER_SELFTEST_AMP__MSK 0x08
  2477. #define BMI160_USER_SELFTEST_AMP__REG BMI160_USER_SELF_TEST_ADDR
  2478. /**************************************************************/
  2479. /**\name GYRO SELF TEST LENGTH, POSITION AND MASK*/
  2480. /**************************************************************/
  2481. /* Self_Test Description - Reg Addr --> 0x6d, Bit --> 4 */
  2482. #define BMI160_USER_GYRO_SELFTEST_START__POS 4
  2483. #define BMI160_USER_GYRO_SELFTEST_START__LEN 1
  2484. #define BMI160_USER_GYRO_SELFTEST_START__MSK 0x10
  2485. #define BMI160_USER_GYRO_SELFTEST_START__REG \
  2486. BMI160_USER_SELF_TEST_ADDR
  2487. /**************************************************************/
  2488. /**\name NV_CONFIG LENGTH, POSITION AND MASK*/
  2489. /**************************************************************/
  2490. /* NV_CONF Description - Reg Addr --> 0x70, Bit --> 0 */
  2491. #define BMI160_USER_NV_CONFIG_SPI_ENABLE__POS 0
  2492. #define BMI160_USER_NV_CONFIG_SPI_ENABLE__LEN 1
  2493. #define BMI160_USER_NV_CONFIG_SPI_ENABLE__MSK 0x01
  2494. #define BMI160_USER_NV_CONFIG_SPI_ENABLE__REG BMI160_USER_NV_CONFIG_ADDR
  2495. /*IF_CONF Description - Reg Addr --> 0x70, Bit --> 1 */
  2496. #define BMI160_USER_IF_CONFIG_I2C_WDT_SELECT__POS 1
  2497. #define BMI160_USER_IF_CONFIG_I2C_WDT_SELECT__LEN 1
  2498. #define BMI160_USER_IF_CONFIG_I2C_WDT_SELECT__MSK 0x02
  2499. #define BMI160_USER_IF_CONFIG_I2C_WDT_SELECT__REG \
  2500. BMI160_USER_NV_CONFIG_ADDR
  2501. /*IF_CONF Description - Reg Addr --> 0x70, Bit --> 2 */
  2502. #define BMI160_USER_IF_CONFIG_I2C_WDT_ENABLE__POS 2
  2503. #define BMI160_USER_IF_CONFIG_I2C_WDT_ENABLE__LEN 1
  2504. #define BMI160_USER_IF_CONFIG_I2C_WDT_ENABLE__MSK 0x04
  2505. #define BMI160_USER_IF_CONFIG_I2C_WDT_ENABLE__REG \
  2506. BMI160_USER_NV_CONFIG_ADDR
  2507. /* NV_CONF Description - Reg Addr --> 0x70, Bit --> 3 */
  2508. #define BMI160_USER_NV_CONFIG_SPARE0__POS 3
  2509. #define BMI160_USER_NV_CONFIG_SPARE0__LEN 1
  2510. #define BMI160_USER_NV_CONFIG_SPARE0__MSK 0x08
  2511. #define BMI160_USER_NV_CONFIG_SPARE0__REG BMI160_USER_NV_CONFIG_ADDR
  2512. /* NV_CONF Description - Reg Addr --> 0x70, Bit --> 4...7 */
  2513. #define BMI160_USER_NV_CONFIG_NVM_COUNTER__POS 4
  2514. #define BMI160_USER_NV_CONFIG_NVM_COUNTER__LEN 4
  2515. #define BMI160_USER_NV_CONFIG_NVM_COUNTER__MSK 0xF0
  2516. #define BMI160_USER_NV_CONFIG_NVM_COUNTER__REG BMI160_USER_NV_CONFIG_ADDR
  2517. /**************************************************************/
  2518. /**\name ACCEL MANUAL OFFSET LENGTH, POSITION AND MASK*/
  2519. /**************************************************************/
  2520. /* Offset_0 Description - Reg Addr --> 0x71, Bit --> 0...7 */
  2521. #define BMI160_USER_OFFSET_0_ACCEL_OFF_X__POS 0
  2522. #define BMI160_USER_OFFSET_0_ACCEL_OFF_X__LEN 8
  2523. #define BMI160_USER_OFFSET_0_ACCEL_OFF_X__MSK 0xFF
  2524. #define BMI160_USER_OFFSET_0_ACCEL_OFF_X__REG BMI160_USER_OFFSET_0_ADDR
  2525. /* Offset_1 Description - Reg Addr --> 0x72, Bit --> 0...7 */
  2526. #define BMI160_USER_OFFSET_1_ACCEL_OFF_Y__POS 0
  2527. #define BMI160_USER_OFFSET_1_ACCEL_OFF_Y__LEN 8
  2528. #define BMI160_USER_OFFSET_1_ACCEL_OFF_Y__MSK 0xFF
  2529. #define BMI160_USER_OFFSET_1_ACCEL_OFF_Y__REG BMI160_USER_OFFSET_1_ADDR
  2530. /* Offset_2 Description - Reg Addr --> 0x73, Bit --> 0...7 */
  2531. #define BMI160_USER_OFFSET_2_ACCEL_OFF_Z__POS 0
  2532. #define BMI160_USER_OFFSET_2_ACCEL_OFF_Z__LEN 8
  2533. #define BMI160_USER_OFFSET_2_ACCEL_OFF_Z__MSK 0xFF
  2534. #define BMI160_USER_OFFSET_2_ACCEL_OFF_Z__REG BMI160_USER_OFFSET_2_ADDR
  2535. /**************************************************************/
  2536. /**\name GYRO MANUAL OFFSET LENGTH, POSITION AND MASK*/
  2537. /**************************************************************/
  2538. /* Offset_3 Description - Reg Addr --> 0x74, Bit --> 0...7 */
  2539. #define BMI160_USER_OFFSET_3_GYRO_OFF_X__POS 0
  2540. #define BMI160_USER_OFFSET_3_GYRO_OFF_X__LEN 8
  2541. #define BMI160_USER_OFFSET_3_GYRO_OFF_X__MSK 0xFF
  2542. #define BMI160_USER_OFFSET_3_GYRO_OFF_X__REG BMI160_USER_OFFSET_3_ADDR
  2543. /* Offset_4 Description - Reg Addr --> 0x75, Bit --> 0...7 */
  2544. #define BMI160_USER_OFFSET_4_GYRO_OFF_Y__POS 0
  2545. #define BMI160_USER_OFFSET_4_GYRO_OFF_Y__LEN 8
  2546. #define BMI160_USER_OFFSET_4_GYRO_OFF_Y__MSK 0xFF
  2547. #define BMI160_USER_OFFSET_4_GYRO_OFF_Y__REG BMI160_USER_OFFSET_4_ADDR
  2548. /* Offset_5 Description - Reg Addr --> 0x76, Bit --> 0...7 */
  2549. #define BMI160_USER_OFFSET_5_GYRO_OFF_Z__POS 0
  2550. #define BMI160_USER_OFFSET_5_GYRO_OFF_Z__LEN 8
  2551. #define BMI160_USER_OFFSET_5_GYRO_OFF_Z__MSK 0xFF
  2552. #define BMI160_USER_OFFSET_5_GYRO_OFF_Z__REG BMI160_USER_OFFSET_5_ADDR
  2553. /* Offset_6 Description - Reg Addr --> 0x77, Bit --> 0..1 */
  2554. #define BMI160_USER_OFFSET_6_GYRO_OFF_X__POS 0
  2555. #define BMI160_USER_OFFSET_6_GYRO_OFF_X__LEN 2
  2556. #define BMI160_USER_OFFSET_6_GYRO_OFF_X__MSK 0x03
  2557. #define BMI160_USER_OFFSET_6_GYRO_OFF_X__REG BMI160_USER_OFFSET_6_ADDR
  2558. /* Offset_6 Description - Reg Addr --> 0x77, Bit --> 2...3 */
  2559. #define BMI160_USER_OFFSET_6_GYRO_OFF_Y__POS 2
  2560. #define BMI160_USER_OFFSET_6_GYRO_OFF_Y__LEN 2
  2561. #define BMI160_USER_OFFSET_6_GYRO_OFF_Y__MSK 0x0C
  2562. #define BMI160_USER_OFFSET_6_GYRO_OFF_Y__REG BMI160_USER_OFFSET_6_ADDR
  2563. /* Offset_6 Description - Reg Addr --> 0x77, Bit --> 4...5 */
  2564. #define BMI160_USER_OFFSET_6_GYRO_OFF_Z__POS 4
  2565. #define BMI160_USER_OFFSET_6_GYRO_OFF_Z__LEN 2
  2566. #define BMI160_USER_OFFSET_6_GYRO_OFF_Z__MSK 0x30
  2567. #define BMI160_USER_OFFSET_6_GYRO_OFF_Z__REG BMI160_USER_OFFSET_6_ADDR
  2568. /**************************************************************/
  2569. /**\name ACCEL OFFSET ENABLE LENGTH, POSITION AND MASK*/
  2570. /**************************************************************/
  2571. /* Offset_6 Description - Reg Addr --> 0x77, Bit --> 6 */
  2572. #define BMI160_USER_OFFSET_6_ACCEL_OFF_ENABLE__POS 6
  2573. #define BMI160_USER_OFFSET_6_ACCEL_OFF_ENABLE__LEN 1
  2574. #define BMI160_USER_OFFSET_6_ACCEL_OFF_ENABLE__MSK 0x40
  2575. #define BMI160_USER_OFFSET_6_ACCEL_OFF_ENABLE__REG \
  2576. BMI160_USER_OFFSET_6_ADDR
  2577. /**************************************************************/
  2578. /**\name GYRO OFFSET ENABLE LENGTH, POSITION AND MASK*/
  2579. /**************************************************************/
  2580. /* Offset_6 Description - Reg Addr --> 0x77, Bit --> 7 */
  2581. #define BMI160_USER_OFFSET_6_GYRO_OFF_EN__POS 7
  2582. #define BMI160_USER_OFFSET_6_GYRO_OFF_EN__LEN 1
  2583. #define BMI160_USER_OFFSET_6_GYRO_OFF_EN__MSK 0x80
  2584. #define BMI160_USER_OFFSET_6_GYRO_OFF_EN__REG BMI160_USER_OFFSET_6_ADDR
  2585. /**************************************************************/
  2586. /**\name STEP COUNTER LENGTH, POSITION AND MASK*/
  2587. /**************************************************************/
  2588. /* STEP_CNT_0 Description - Reg Addr --> 0x78, Bit --> 0 to 7 */
  2589. #define BMI160_USER_STEP_COUNT_LSB__POS 0
  2590. #define BMI160_USER_STEP_COUNT_LSB__LEN 7
  2591. #define BMI160_USER_STEP_COUNT_LSB__MSK 0xFF
  2592. #define BMI160_USER_STEP_COUNT_LSB__REG BMI160_USER_STEP_COUNT_0_ADDR
  2593. /* STEP_CNT_1 Description - Reg Addr --> 0x79, Bit --> 0 to 7 */
  2594. #define BMI160_USER_STEP_COUNT_MSB__POS 0
  2595. #define BMI160_USER_STEP_COUNT_MSB__LEN 7
  2596. #define BMI160_USER_STEP_COUNT_MSB__MSK 0xFF
  2597. #define BMI160_USER_STEP_COUNT_MSB__REG BMI160_USER_STEP_COUNT_1_ADDR
  2598. /**************************************************************/
  2599. /**\name STEP COUNTER CONFIGURATION LENGTH, POSITION AND MASK*/
  2600. /**************************************************************/
  2601. /* STEP_CONFIG_0 Description - Reg Addr --> 0x7A, Bit --> 0 to 7 */
  2602. #define BMI160_USER_STEP_CONFIG_ZERO__POS 0
  2603. #define BMI160_USER_STEP_CONFIG_ZERO__LEN 7
  2604. #define BMI160_USER_STEP_CONFIG_ZERO__MSK 0xFF
  2605. #define BMI160_USER_STEP_CONFIG_ZERO__REG BMI160_USER_STEP_CONFIG_0_ADDR
  2606. /* STEP_CONFIG_1 Description - Reg Addr --> 0x7B, Bit --> 0 to 2 and
  2607. 4 to 7 */
  2608. #define BMI160_USER_STEP_CONFIG_ONE_CNF1__POS 0
  2609. #define BMI160_USER_STEP_CONFIG_ONE_CNF1__LEN 3
  2610. #define BMI160_USER_STEP_CONFIG_ONE_CNF1__MSK 0x07
  2611. #define BMI160_USER_STEP_CONFIG_ONE_CNF1__REG BMI160_USER_STEP_CONFIG_1_ADDR
  2612. #define BMI160_USER_STEP_CONFIG_ONE_CNF2__POS 4
  2613. #define BMI160_USER_STEP_CONFIG_ONE_CNF2__LEN 4
  2614. #define BMI160_USER_STEP_CONFIG_ONE_CNF2__MSK 0xF0
  2615. #define BMI160_USER_STEP_CONFIG_ONE_CNF2__REG BMI160_USER_STEP_CONFIG_1_ADDR
  2616. /**************************************************************/
  2617. /**\name STEP COUNTER ENABLE LENGTH, POSITION AND MASK*/
  2618. /**************************************************************/
  2619. /* STEP_CONFIG_1 Description - Reg Addr --> 0x7B, Bit --> 0 to 2 */
  2620. #define BMI160_USER_STEP_CONFIG_1_STEP_COUNT_ENABLE__POS 3
  2621. #define BMI160_USER_STEP_CONFIG_1_STEP_COUNT_ENABLE__LEN 1
  2622. #define BMI160_USER_STEP_CONFIG_1_STEP_COUNT_ENABLE__MSK 0x08
  2623. #define BMI160_USER_STEP_CONFIG_1_STEP_COUNT_ENABLE__REG \
  2624. BMI160_USER_STEP_CONFIG_1_ADDR
  2625. /* USER REGISTERS DEFINITION END */
  2626. /**************************************************************************/
  2627. /* CMD REGISTERS DEFINITION START */
  2628. /**************************************************************/
  2629. /**\name COMMAND REGISTER LENGTH, POSITION AND MASK*/
  2630. /**************************************************************/
  2631. /* Command description address - Reg Addr --> 0x7E, Bit --> 0....7 */
  2632. #define BMI160_CMD_COMMANDS__POS 0
  2633. #define BMI160_CMD_COMMANDS__LEN 8
  2634. #define BMI160_CMD_COMMANDS__MSK 0xFF
  2635. #define BMI160_CMD_COMMANDS__REG BMI160_CMD_COMMANDS_ADDR
  2636. /**************************************************************/
  2637. /**\name PAGE ENABLE LENGTH, POSITION AND MASK*/
  2638. /**************************************************************/
  2639. /* Target page address - Reg Addr --> 0x7F, Bit --> 4....5 */
  2640. #define BMI160_CMD_TARGET_PAGE__POS 4
  2641. #define BMI160_CMD_TARGET_PAGE__LEN 2
  2642. #define BMI160_CMD_TARGET_PAGE__MSK 0x30
  2643. #define BMI160_CMD_TARGET_PAGE__REG BMI160_CMD_EXT_MODE_ADDR
  2644. /* Target page address - Reg Addr --> 0x7F, Bit --> 4....5 */
  2645. #define BMI160_CMD_PAGING_EN__POS 7
  2646. #define BMI160_CMD_PAGING_EN__LEN 1
  2647. #define BMI160_CMD_PAGING_EN__MSK 0x80
  2648. #define BMI160_CMD_PAGING_EN__REG BMI160_CMD_EXT_MODE_ADDR
  2649. /* Target page address - Reg Addr --> 0x7F, Bit --> 4....5 */
  2650. #define BMI160_COM_C_TRIM_FIVE__POS 4
  2651. #define BMI160_COM_C_TRIM_FIVE__LEN 2
  2652. #define BMI160_COM_C_TRIM_FIVE__MSK 0x30
  2653. #define BMI160_COM_C_TRIM_FIVE__REG BMI160_COM_C_TRIM_FIVE_ADDR
  2654. /**************************************************************************/
  2655. /* CMD REGISTERS DEFINITION END */
  2656. /**************************************************/
  2657. /**\name FIFO FRAME COUNT DEFINITION */
  2658. /*************************************************/
  2659. #define FIFO_FRAME 1024
  2660. #define FIFO_CONFIG_CHECK1 0x00
  2661. #define FIFO_CONFIG_CHECK2 0x80
  2662. /**************************************************/
  2663. /**\name MAG SENSOR SELECT */
  2664. /*************************************************/
  2665. #define BST_BMM 0
  2666. #define BST_AKM 1
  2667. /**************************************************/
  2668. /**\name ACCEL RANGE */
  2669. /*************************************************/
  2670. #define BMI160_ACCEL_RANGE_2G 0X03
  2671. #define BMI160_ACCEL_RANGE_4G 0X05
  2672. #define BMI160_ACCEL_RANGE_8G 0X08
  2673. #define BMI160_ACCEL_RANGE_16G 0X0C
  2674. /**************************************************/
  2675. /**\name ACCEL ODR */
  2676. /*************************************************/
  2677. #define BMI160_ACCEL_OUTPUT_DATA_RATE_RESERVED 0x00
  2678. #define BMI160_ACCEL_OUTPUT_DATA_RATE_0_78HZ 0x01
  2679. #define BMI160_ACCEL_OUTPUT_DATA_RATE_1_56HZ 0x02
  2680. #define BMI160_ACCEL_OUTPUT_DATA_RATE_3_12HZ 0x03
  2681. #define BMI160_ACCEL_OUTPUT_DATA_RATE_6_25HZ 0x04
  2682. #define BMI160_ACCEL_OUTPUT_DATA_RATE_12_5HZ 0x05
  2683. #define BMI160_ACCEL_OUTPUT_DATA_RATE_25HZ 0x06
  2684. #define BMI160_ACCEL_OUTPUT_DATA_RATE_50HZ 0x07
  2685. #define BMI160_ACCEL_OUTPUT_DATA_RATE_100HZ 0x08
  2686. #define BMI160_ACCEL_OUTPUT_DATA_RATE_200HZ 0x09
  2687. #define BMI160_ACCEL_OUTPUT_DATA_RATE_400HZ 0x0A
  2688. #define BMI160_ACCEL_OUTPUT_DATA_RATE_800HZ 0x0B
  2689. #define BMI160_ACCEL_OUTPUT_DATA_RATE_1600HZ 0x0C
  2690. #define BMI160_ACCEL_OUTPUT_DATA_RATE_RESERVED0 0x0D
  2691. #define BMI160_ACCEL_OUTPUT_DATA_RATE_RESERVED1 0x0E
  2692. #define BMI160_ACCEL_OUTPUT_DATA_RATE_RESERVED2 0x0F
  2693. /**************************************************/
  2694. /**\name ACCEL BANDWIDTH PARAMETER */
  2695. /*************************************************/
  2696. #define BMI160_ACCEL_OSR4_AVG1 0x00
  2697. #define BMI160_ACCEL_OSR2_AVG2 0x01
  2698. #define BMI160_ACCEL_NORMAL_AVG4 0x02
  2699. #define BMI160_ACCEL_CIC_AVG8 0x03
  2700. #define BMI160_ACCEL_RES_AVG16 0x04
  2701. #define BMI160_ACCEL_RES_AVG32 0x05
  2702. #define BMI160_ACCEL_RES_AVG64 0x06
  2703. #define BMI160_ACCEL_RES_AVG128 0x07
  2704. /**************************************************/
  2705. /**\name GYRO ODR */
  2706. /*************************************************/
  2707. #define BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED 0x00
  2708. #define BMI160_GYRO_OUTPUT_DATA_RATE_25HZ 0x06
  2709. #define BMI160_GYRO_OUTPUT_DATA_RATE_50HZ 0x07
  2710. #define BMI160_GYRO_OUTPUT_DATA_RATE_100HZ 0x08
  2711. #define BMI160_GYRO_OUTPUT_DATA_RATE_200HZ 0x09
  2712. #define BMI160_GYRO_OUTPUT_DATA_RATE_400HZ 0x0A
  2713. #define BMI160_GYRO_OUTPUT_DATA_RATE_800HZ 0x0B
  2714. #define BMI160_GYRO_OUTPUT_DATA_RATE_1600HZ 0x0C
  2715. #define BMI160_GYRO_OUTPUT_DATA_RATE_3200HZ 0x0D
  2716. /**************************************************/
  2717. /**\name GYRO BANDWIDTH PARAMETER */
  2718. /*************************************************/
  2719. #define BMI160_GYRO_OSR4_MODE 0x00
  2720. #define BMI160_GYRO_OSR2_MODE 0x01
  2721. #define BMI160_GYRO_NORMAL_MODE 0x02
  2722. #define BMI160_GYRO_CIC_MODE 0x03
  2723. /**************************************************/
  2724. /**\name GYROSCOPE RANGE PARAMETER */
  2725. /*************************************************/
  2726. #define BMI160_GYRO_RANGE_2000_DEG_SEC 0x00
  2727. #define BMI160_GYRO_RANGE_1000_DEG_SEC 0x01
  2728. #define BMI160_GYRO_RANGE_500_DEG_SEC 0x02
  2729. #define BMI160_GYRO_RANGE_250_DEG_SEC 0x03
  2730. #define BMI160_GYRO_RANGE_125_DEG_SEC 0x04
  2731. /**************************************************/
  2732. /**\name MAG ODR */
  2733. /*************************************************/
  2734. #define BMI160_MAG_OUTPUT_DATA_RATE_RESERVED 0x00
  2735. #define BMI160_MAG_OUTPUT_DATA_RATE_0_78HZ 0x01
  2736. #define BMI160_MAG_OUTPUT_DATA_RATE_1_56HZ 0x02
  2737. #define BMI160_MAG_OUTPUT_DATA_RATE_3_12HZ 0x03
  2738. #define BMI160_MAG_OUTPUT_DATA_RATE_6_25HZ 0x04
  2739. #define BMI160_MAG_OUTPUT_DATA_RATE_12_5HZ 0x05
  2740. #define BMI160_MAG_OUTPUT_DATA_RATE_25HZ 0x06
  2741. #define BMI160_MAG_OUTPUT_DATA_RATE_50HZ 0x07
  2742. #define BMI160_MAG_OUTPUT_DATA_RATE_100HZ 0x08
  2743. #define BMI160_MAG_OUTPUT_DATA_RATE_200HZ 0x09
  2744. #define BMI160_MAG_OUTPUT_DATA_RATE_400HZ 0x0A
  2745. #define BMI160_MAG_OUTPUT_DATA_RATE_800HZ 0x0B
  2746. #define BMI160_MAG_OUTPUT_DATA_RATE_1600HZ 0x0C
  2747. #define BMI160_MAG_OUTPUT_DATA_RATE_RESERVED0 0x0D
  2748. #define BMI160_MAG_OUTPUT_DATA_RATE_RESERVED1 0x0E
  2749. #define BMI160_MAG_OUTPUT_DATA_RATE_RESERVED2 0x0F
  2750. /**************************************************/
  2751. /**\name ENABLE/DISABLE SELECTIONS */
  2752. /*************************************************/
  2753. /* Enable accel and gyro offset */
  2754. #define ACCEL_OFFSET_ENABLE 0x01
  2755. #define GYRO_OFFSET_ENABLE 0x01
  2756. /* command register definition */
  2757. #define START_FOC_ACCEL_GYRO 0X03
  2758. /* INT ENABLE 1 */
  2759. #define BMI160_ANY_MOTION_X_ENABLE 0
  2760. #define BMI160_ANY_MOTION_Y_ENABLE 1
  2761. #define BMI160_ANY_MOTION_Z_ENABLE 2
  2762. #define BMI160_DOUBLE_TAP_ENABLE 4
  2763. #define BMI160_SINGLE_TAP_ENABLE 5
  2764. #define BMI160_ORIENT_ENABLE 6
  2765. #define BMI160_FLAT_ENABLE 7
  2766. /* INT ENABLE 1 */
  2767. #define BMI160_HIGH_G_X_ENABLE 0
  2768. #define BMI160_HIGH_G_Y_ENABLE 1
  2769. #define BMI160_HIGH_G_Z_ENABLE 2
  2770. #define BMI160_LOW_G_ENABLE 3
  2771. #define BMI160_DATA_RDY_ENABLE 4
  2772. #define BMI160_FIFO_FULL_ENABLE 5
  2773. #define BMI160_FIFO_WM_ENABLE 6
  2774. /* INT ENABLE 2 */
  2775. #define BMI160_NOMOTION_X_ENABLE 0
  2776. #define BMI160_NOMOTION_Y_ENABLE 1
  2777. #define BMI160_NOMOTION_Z_ENABLE 2
  2778. /* FOC axis selection for accel*/
  2779. #define FOC_X_AXIS 0
  2780. #define FOC_Y_AXIS 1
  2781. #define FOC_Z_AXIS 2
  2782. /* IN OUT CONTROL */
  2783. #define BMI160_INTR1_EDGE_CTRL 0
  2784. #define BMI160_INTR2_EDGE_CTRL 1
  2785. #define BMI160_INTR1_LEVEL 0
  2786. #define BMI160_INTR2_LEVEL 1
  2787. #define BMI160_INTR1_OUTPUT_TYPE 0
  2788. #define BMI160_INTR2_OUTPUT_TYPE 1
  2789. #define BMI160_INTR1_OUTPUT_ENABLE 0
  2790. #define BMI160_INTR2_OUTPUT_ENABLE 1
  2791. #define BMI160_INTR1_INPUT_ENABLE 0
  2792. #define BMI160_INTR2_INPUT_ENABLE 1
  2793. /* INTERRUPT MAPS */
  2794. #define BMI160_INTR1_MAP_LOW_G 0
  2795. #define BMI160_INTR2_MAP_LOW_G 1
  2796. #define BMI160_INTR1_MAP_HIGH_G 0
  2797. #define BMI160_INTR2_MAP_HIGH_G 1
  2798. #define BMI160_INTR1_MAP_ANY_MOTION 0
  2799. #define BMI160_INTR2_MAP_ANY_MOTION 1
  2800. #define BMI160_INTR1_MAP_NOMO 0
  2801. #define BMI160_INTR2_MAP_NOMO 1
  2802. #define BMI160_INTR1_MAP_DOUBLE_TAP 0
  2803. #define BMI160_INTR2_MAP_DOUBLE_TAP 1
  2804. #define BMI160_INTR1_MAP_SINGLE_TAP 0
  2805. #define BMI160_INTR2_MAP_SINGLE_TAP 1
  2806. #define BMI160_INTR1_MAP_ORIENT 0
  2807. #define BMI160_INTR2_MAP_ORIENT 1
  2808. #define BMI160_INTR1_MAP_FLAT 0
  2809. #define BMI160_INTR2_MAP_FLAT 1
  2810. #define BMI160_INTR1_MAP_DATA_RDY 0
  2811. #define BMI160_INTR2_MAP_DATA_RDY 1
  2812. #define BMI160_INTR1_MAP_FIFO_WM 0
  2813. #define BMI160_INTR2_MAP_FIFO_WM 1
  2814. #define BMI160_INTR1_MAP_FIFO_FULL 0
  2815. #define BMI160_INTR2_MAP_FIFO_FULL 1
  2816. #define BMI160_INTR1_MAP_PMUTRIG 0
  2817. #define BMI160_INTR2_MAP_PMUTRIG 1
  2818. /* Interrupt mapping*/
  2819. #define BMI160_MAP_INTR1 0
  2820. #define BMI160_MAP_INTR2 1
  2821. /**************************************************/
  2822. /**\name TAP DURATION */
  2823. /*************************************************/
  2824. #define BMI160_TAP_DURN_50MS 0x00
  2825. #define BMI160_TAP_DURN_100MS 0x01
  2826. #define BMI160_TAP_DURN_150MS 0x02
  2827. #define BMI160_TAP_DURN_200MS 0x03
  2828. #define BMI160_TAP_DURN_250MS 0x04
  2829. #define BMI160_TAP_DURN_375MS 0x05
  2830. #define BMI160_TAP_DURN_500MS 0x06
  2831. #define BMI160_TAP_DURN_700MS 0x07
  2832. /**************************************************/
  2833. /**\name TAP SHOCK */
  2834. /*************************************************/
  2835. #define BMI160_TAP_SHOCK_50MS 0x00
  2836. #define BMI160_TAP_SHOCK_75MS 0x01
  2837. /**************************************************/
  2838. /**\name TAP QUIET */
  2839. /*************************************************/
  2840. #define BMI160_TAP_QUIET_30MS 0x00
  2841. #define BMI160_TAP_QUIET_20MS 0x01
  2842. /**************************************************/
  2843. /**\name STEP DETECTION SELECTION MODES */
  2844. /*************************************************/
  2845. #define BMI160_STEP_NORMAL_MODE 0
  2846. #define BMI160_STEP_SENSITIVE_MODE 1
  2847. #define BMI160_STEP_ROBUST_MODE 2
  2848. /**************************************************/
  2849. /**\name STEP CONFIGURATION SELECT MODE */
  2850. /*************************************************/
  2851. #define STEP_CONFIG_NORMAL 0X315
  2852. #define STEP_CONFIG_SENSITIVE 0X2D
  2853. #define STEP_CONFIG_ROBUST 0X71D
  2854. /**************************************************/
  2855. /**\name BMM150 TRIM DATA DEFINITIONS */
  2856. /*************************************************/
  2857. #define BMI160_MAG_DIG_X1 0x5D
  2858. #define BMI160_MAG_DIG_Y1 0x5E
  2859. #define BMI160_MAG_DIG_Z4_LSB 0x62
  2860. #define BMI160_MAG_DIG_Z4_MSB 0x63
  2861. #define BMI160_MAG_DIG_X2 0x64
  2862. #define BMI160_MAG_DIG_Y2 0x65
  2863. #define BMI160_MAG_DIG_Z2_LSB 0x68
  2864. #define BMI160_MAG_DIG_Z2_MSB 0x69
  2865. #define BMI160_MAG_DIG_Z1_LSB 0x6A
  2866. #define BMI160_MAG_DIG_Z1_MSB 0x6B
  2867. #define BMI160_MAG_DIG_XYZ1_LSB 0x6C
  2868. #define BMI160_MAG_DIG_XYZ1_MSB 0x6D
  2869. #define BMI160_MAG_DIG_Z3_LSB 0x6E
  2870. #define BMI160_MAG_DIG_Z3_MSB 0x6F
  2871. #define BMI160_MAG_DIG_XY2 0x70
  2872. #define BMI160_MAG_DIG_XY1 0x71
  2873. /**************************************************/
  2874. /**\name BMM150 PRE-SET MODE DEFINITIONS */
  2875. /*************************************************/
  2876. #define BMI160_MAG_PRESETMODE_LOWPOWER 1
  2877. #define BMI160_MAG_PRESETMODE_REGULAR 2
  2878. #define BMI160_MAG_PRESETMODE_HIGHACCURACY 3
  2879. #define BMI160_MAG_PRESETMODE_ENHANCED 4
  2880. /**************************************************/
  2881. /**\name BMM150 PRESET MODES - DATA RATES */
  2882. /*************************************************/
  2883. #define BMI160_MAG_LOWPOWER_DR 0x02
  2884. #define BMI160_MAG_REGULAR_DR 0x02
  2885. #define BMI160_MAG_HIGHACCURACY_DR 0x2A
  2886. #define BMI160_MAG_ENHANCED_DR 0x02
  2887. /**************************************************/
  2888. /**\name BMM150 PRESET MODES - REPETITIONS-XY RATES */
  2889. /*************************************************/
  2890. #define BMI160_MAG_LOWPOWER_REPXY 1
  2891. #define BMI160_MAG_REGULAR_REPXY 4
  2892. #define BMI160_MAG_HIGHACCURACY_REPXY 23
  2893. #define BMI160_MAG_ENHANCED_REPXY 7
  2894. /**************************************************/
  2895. /**\name BMM150 PRESET MODES - REPETITIONS-Z RATES */
  2896. /*************************************************/
  2897. #define BMI160_MAG_LOWPOWER_REPZ 2
  2898. #define BMI160_MAG_REGULAR_REPZ 14
  2899. #define BMI160_MAG_HIGHACCURACY_REPZ 82
  2900. #define BMI160_MAG_ENHANCED_REPZ 26
  2901. /**************************************************/
  2902. /**\name USED FOR MAG OVERFLOW CHECK FOR BMM150 */
  2903. /*************************************************/
  2904. #define BMI160_MAG_OVERFLOW_OUTPUT ((s16)-32768)
  2905. #define BMI160_MAG_OVERFLOW_OUTPUT_S32 ((s32)(-2147483647-1))
  2906. #define BMI160_MAG_NEGATIVE_SATURATION_Z ((s16)-32767)
  2907. #define BMI160_MAG_POSITIVE_SATURATION_Z ((u16)32767)
  2908. #define BMI160_MAG_FLIP_OVERFLOW_ADCVAL ((s16)-4096)
  2909. #define BMI160_MAG_HALL_OVERFLOW_ADCVAL ((s16)-16384)
  2910. /**************************************************/
  2911. /**\name BMM150 REGISTER DEFINITION */
  2912. /*************************************************/
  2913. #define BMI160_BMM150_POWE_CONTROL_REG 0x4B
  2914. #define BMI160_BMM150_POWE_MODE_REG 0x4C
  2915. #define BMI160_BMM150_DATA_REG 0x42
  2916. #define BMI160_BMM150_XY_REP 0x51
  2917. #define BMI160_BMM150_Z_REP 0x52
  2918. /**************************************************/
  2919. /**\name AKM COMPENSATING DATA REGISTERS */
  2920. /*************************************************/
  2921. #define BMI160_BST_AKM_ASAX 0x60
  2922. #define BMI160_BST_AKM_ASAY 0x61
  2923. #define BMI160_BST_AKM_ASAZ 0x62
  2924. /**************************************************/
  2925. /**\name AKM POWER MODE SELECTION */
  2926. /*************************************************/
  2927. #define AKM_POWER_DOWN_MODE 0
  2928. #define AKM_SINGLE_MEAS_MODE 1
  2929. #define FUSE_ROM_MODE 2
  2930. /**************************************************/
  2931. /**\name SECONDARY_MAG POWER MODE SELECTION */
  2932. /*************************************************/
  2933. #define BMI160_MAG_FORCE_MODE 0
  2934. #define BMI160_MAG_SUSPEND_MODE 1
  2935. /**************************************************/
  2936. /**\name MAG POWER MODE SELECTION */
  2937. /*************************************************/
  2938. #define FORCE_MODE 0
  2939. #define SUSPEND_MODE 1
  2940. #define NORMAL_MODE 2
  2941. #define MAG_SUSPEND_MODE 1
  2942. /**************************************************/
  2943. /**\name FIFO CONFIGURATIONS */
  2944. /*************************************************/
  2945. #define FIFO_HEADER_ENABLE 0X01
  2946. #define FIFO_MAG_ENABLE 0X01
  2947. #define FIFO_ACCEL_ENABLE 0X01
  2948. #define FIFO_GYRO_ENABLE 0X01
  2949. #define FIFO_TIME_ENABLE 0X01
  2950. #define FIFO_STOPONFULL_ENABLE 0X01
  2951. #define FIFO_WM_INTERRUPT_ENABLE 0X01
  2952. /* FIFO definitions*/
  2953. #define FIFO_HEAD_A 0x84
  2954. #define FIFO_HEAD_G 0x88
  2955. #define FIFO_HEAD_M 0x90
  2956. #define FIFO_HEAD_G_A 0x8C
  2957. #define FIFO_HEAD_M_A 0x94
  2958. #define FIFO_HEAD_M_G 0x98
  2959. #define FIFO_HEAD_M_G_A 0x9C
  2960. #define FIFO_HEAD_SENSOR_TIME 0x44
  2961. #define FIFO_HEAD_SKIP_FRAME 0x40
  2962. #define FIFO_HEAD_OVER_READ_LSB 0x80
  2963. #define FIFO_HEAD_OVER_READ_MSB 0x00
  2964. /* FIFO 1024 byte, max fifo frame count not over 150 */
  2965. #define FIFO_FRAME_CNT 146
  2966. #define FIFO_OVER_READ_RETURN ((s8)-10)
  2967. #define FIFO_SENSORTIME_RETURN ((s8)-9)
  2968. #define FIFO_SKIP_OVER_LEN ((s8)-8)
  2969. #define FIFO_M_G_A_OVER_LEN ((s8)-7)
  2970. #define FIFO_M_G_OVER_LEN ((s8)-6)
  2971. #define FIFO_M_A_OVER_LEN ((s8)-5)
  2972. #define FIFO_G_A_OVER_LEN ((s8)-4)
  2973. #define FIFO_M_OVER_LEN ((s8)-3)
  2974. #define FIFO_G_OVER_LEN ((s8)-2)
  2975. #define FIFO_A_OVER_LEN ((s8)-1)
  2976. /**************************************************/
  2977. /**\name ACCEL POWER MODE */
  2978. /*************************************************/
  2979. #define ACCEL_MODE_NORMAL 0x11
  2980. #define ACCEL_LOWPOWER 0X12
  2981. #define ACCEL_SUSPEND 0X10
  2982. /**************************************************/
  2983. /**\name GYRO POWER MODE */
  2984. /*************************************************/
  2985. #define GYRO_MODE_SUSPEND 0x14
  2986. #define GYRO_MODE_NORMAL 0x15
  2987. #define GYRO_MODE_FASTSTARTUP 0x17
  2988. /**************************************************/
  2989. /**\name MAG POWER MODE */
  2990. /*************************************************/
  2991. #define MAG_MODE_SUSPEND 0x18
  2992. #define MAG_MODE_NORMAL 0x19
  2993. #define MAG_MODE_LOWPOWER 0x1A
  2994. /**************************************************/
  2995. /**\name ENABLE/DISABLE BIT VALUES */
  2996. /*************************************************/
  2997. #define BMI160_ENABLE 0x01
  2998. #define BMI160_DISABLE 0x00
  2999. /**************************************************/
  3000. /**\name INTERRUPT EDGE TRIGGER ENABLE */
  3001. /*************************************************/
  3002. #define BMI160_EDGE 0x01
  3003. #define BMI160_LEVEL 0x00
  3004. /**************************************************/
  3005. /**\name INTERRUPT LEVEL ENABLE */
  3006. /*************************************************/
  3007. #define BMI160_LEVEL_LOW 0x00
  3008. #define BMI160_LEVEL_HIGH 0x01
  3009. /**************************************************/
  3010. /**\name INTERRUPT OUTPUT ENABLE */
  3011. /*************************************************/
  3012. #define BMI160_OPEN_DRAIN 0x01
  3013. #define BMI160_PUSH_PULL 0x00
  3014. /* interrupt output enable*/
  3015. #define BMI160_INPUT 0x01
  3016. #define BMI160_OUTPUT 0x00
  3017. /**************************************************/
  3018. /**\name INTERRUPT TAP SOURCE ENABLE */
  3019. /*************************************************/
  3020. #define FILTER_DATA 0x00
  3021. #define UNFILTER_DATA 0x01
  3022. /**************************************************/
  3023. /**\name SLOW MOTION/ NO MOTION SELECT */
  3024. /*************************************************/
  3025. #define SLOW_MOTION 0x00
  3026. #define NO_MOTION 0x01
  3027. /**************************************************/
  3028. /**\name SIGNIFICANT MOTION SELECTION */
  3029. /*************************************************/
  3030. #define ANY_MOTION 0x00
  3031. #define SIGNIFICANT_MOTION 0x01
  3032. /**************************************************/
  3033. /**\name LATCH DURATION */
  3034. /*************************************************/
  3035. #define BMI160_LATCH_DUR_NONE 0x00
  3036. #define BMI160_LATCH_DUR_312_5_MICRO_SEC 0x01
  3037. #define BMI160_LATCH_DUR_625_MICRO_SEC 0x02
  3038. #define BMI160_LATCH_DUR_1_25_MILLI_SEC 0x03
  3039. #define BMI160_LATCH_DUR_2_5_MILLI_SEC 0x04
  3040. #define BMI160_LATCH_DUR_5_MILLI_SEC 0x05
  3041. #define BMI160_LATCH_DUR_10_MILLI_SEC 0x06
  3042. #define BMI160_LATCH_DUR_20_MILLI_SEC 0x07
  3043. #define BMI160_LATCH_DUR_40_MILLI_SEC 0x08
  3044. #define BMI160_LATCH_DUR_80_MILLI_SEC 0x09
  3045. #define BMI160_LATCH_DUR_160_MILLI_SEC 0x0A
  3046. #define BMI160_LATCH_DUR_320_MILLI_SEC 0x0B
  3047. #define BMI160_LATCH_DUR_640_MILLI_SEC 0x0C
  3048. #define BMI160_LATCH_DUR_1_28_SEC 0x0D
  3049. #define BMI160_LATCH_DUR_2_56_SEC 0x0E
  3050. #define BMI160_LATCHED 0x0F
  3051. /**************************************************/
  3052. /**\name GYRO OFFSET MASK DEFINITION */
  3053. /*************************************************/
  3054. #define BMI160_GYRO_MANUAL_OFFSET_0_7 0x00FF
  3055. #define BMI160_GYRO_MANUAL_OFFSET_8_9 0x0300
  3056. /**************************************************/
  3057. /**\name STEP CONFIGURATION MASK DEFINITION */
  3058. /*************************************************/
  3059. #define BMI160_STEP_CONFIG_0_7 0x00FF
  3060. #define BMI160_STEP_CONFIG_8_10 0x0700
  3061. #define BMI160_STEP_CONFIG_11_14 0xF000
  3062. /**************************************************/
  3063. /**\name DEFINITION USED FOR DIFFERENT WRITE */
  3064. /*************************************************/
  3065. #define BMI160_HEX_0_0_DATA 0x00
  3066. #define BMI160_HEX_0_2_DATA 0x02
  3067. #define BMI160_HEX_0_3_DATA 0x03
  3068. #define BMI160_HEX_0_4_DATA 0x04
  3069. #define BMI160_HEX_0_6_DATA 0x06
  3070. #define BMI160_HEX_0_7_DATA 0x07
  3071. #define BMI160_HEX_0_8_DATA 0x08
  3072. #define BMI160_HEX_0_9_DATA 0x09
  3073. #define BMI160_HEX_1_0_DATA 0x10
  3074. #define BMI160_HEX_1_1_DATA 0x11
  3075. #define BMI160_HEX_3_1_DATA 0x31
  3076. #define BMI160_HEX_1_F_DATA 0x1F
  3077. #define BMI160_HEX_8_0_DATA 0x80
  3078. #define BMI160_HEX_0_1_DATA 0x01
  3079. /**************************************************/
  3080. /**\name MAG INIT DEFINITION */
  3081. /*************************************************/
  3082. #define BMI160_COMMAND_REG_ONE 0x37
  3083. #define BMI160_COMMAND_REG_TWO 0x9A
  3084. #define BMI160_COMMAND_REG_THREE 0xC0
  3085. #define RESET_STEP_COUNTER 0xB2
  3086. /**************************************************/
  3087. /**\name BIT SLICE GET AND SET FUNCTIONS */
  3088. /*************************************************/
  3089. #define BMI160_GET_BITSLICE(regvar, bitname)\
  3090. ((regvar & bitname##__MSK) >> bitname##__POS)
  3091. #define BMI160_SET_BITSLICE(regvar, bitname, val)\
  3092. ((regvar & ~bitname##__MSK) | \
  3093. ((val<<bitname##__POS)&bitname##__MSK))
  3094. /**************************************************/
  3095. /**\name FUNCTION DECLARATIONS */
  3096. /*************************************************/
  3097. /**************************************************/
  3098. /**\name FUNCTION FOR BMI160 INITIALIZE */
  3099. /*************************************************/
  3100. /*!
  3101. * @brief
  3102. * This function is used for initialize
  3103. * bus read and bus write functions
  3104. * assign the chip id and device address
  3105. * chip id is read in the register 0x00 bit from 0 to 7
  3106. *
  3107. * @param bmi160 : structure pointer
  3108. *
  3109. * @return results of bus communication function
  3110. * @retval 0 -> Success
  3111. * @retval -1 -> Error
  3112. *
  3113. * @note
  3114. * While changing the parameter of the bmi160_t
  3115. * consider the following point:
  3116. * Changing the reference value of the parameter
  3117. * will changes the local copy or local reference
  3118. * make sure your changes will not
  3119. * affect the reference value of the parameter
  3120. * (Better case don't change the reference value of the parameter)
  3121. *
  3122. */
  3123. BMI160_RETURN_FUNCTION_TYPE bmi160_init(struct bmi160_t *bmi160);
  3124. /**************************************************/
  3125. /**\name FUNCTION FOR READ AND WRITE REGISTERS */
  3126. /*************************************************/
  3127. /*!
  3128. * @brief
  3129. * This API write the data to
  3130. * the given register
  3131. *
  3132. *
  3133. * @param v_addr_u8 -> Address of the register
  3134. * @param v_data_u8 -> The data from the register
  3135. * @param v_len_u8 -> no of bytes to read
  3136. *
  3137. *
  3138. * @return results of bus communication function
  3139. * @retval 0 -> Success
  3140. * @retval -1 -> Error
  3141. *
  3142. *
  3143. */
  3144. BMI160_RETURN_FUNCTION_TYPE bmi160_write_reg(u8 v_addr_u8,
  3145. u8 *v_data_u8, u8 v_len_u8);
  3146. /*!
  3147. * @brief
  3148. * This API reads the data from
  3149. * the given register
  3150. *
  3151. *
  3152. * @param v_addr_u8 -> Address of the register
  3153. * @param v_data_u8 -> The data from the register
  3154. * @param v_len_u8 -> no of bytes to read
  3155. *
  3156. *
  3157. * @return results of bus communication function
  3158. * @retval 0 -> Success
  3159. * @retval -1 -> Error
  3160. *
  3161. *
  3162. */
  3163. BMI160_RETURN_FUNCTION_TYPE bmi160_read_reg(u8 v_addr_u8,
  3164. u8 *v_data_u8, u8 v_len_u8);
  3165. /**************************************************/
  3166. /**\name FUNCTION FOR ERROR CODES */
  3167. /*************************************************/
  3168. /*!
  3169. * @brief This API used to reads the fatal error
  3170. * from the Register 0x02 bit 0
  3171. * This flag will be reset only by power-on-reset and soft reset
  3172. *
  3173. *
  3174. * @param v_fatal_err_u8 : The status of fatal error
  3175. *
  3176. *
  3177. *
  3178. * @return results of bus communication function
  3179. * @retval 0 -> Success
  3180. * @retval -1 -> Error
  3181. *
  3182. *
  3183. */
  3184. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fatal_err(u8
  3185. *v_fatal_err_u8);
  3186. /*!
  3187. * @brief This API used to read the error code
  3188. * from register 0x02 bit 1 to 4
  3189. *
  3190. *
  3191. * @param v_err_code_u8 : The status of error codes
  3192. * error_code | description
  3193. * ------------|---------------
  3194. * 0x00 |no error
  3195. * 0x01 |ACC_CONF error (accel ODR and bandwidth not compatible)
  3196. * 0x02 |GYR_CONF error (Gyroscope ODR and bandwidth not compatible)
  3197. * 0x03 |Under sampling mode and interrupt uses pre filtered data
  3198. * 0x04 |reserved
  3199. * 0x05 |Selected trigger-readout offset in
  3200. * - |MAG_IF greater than selected ODR
  3201. * 0x06 |FIFO configuration error for header less mode
  3202. * 0x07 |Under sampling mode and pre filtered data as FIFO source
  3203. *
  3204. * @return results of bus communication function
  3205. * @retval 0 -> Success
  3206. * @retval -1 -> Error
  3207. *
  3208. *
  3209. */
  3210. BMI160_RETURN_FUNCTION_TYPE bmi160_get_err_code(u8
  3211. *v_error_code_u8);
  3212. /*!
  3213. * @brief This API Reads the i2c error code from the
  3214. * Register 0x02 bit 5.
  3215. * This error occurred in I2C master detected
  3216. *
  3217. * @param v_i2c_err_code_u8 : The status of i2c fail error
  3218. *
  3219. *
  3220. *
  3221. * @return results of bus communication function
  3222. * @retval 0 -> Success
  3223. * @retval -1 -> Error
  3224. *
  3225. *
  3226. */
  3227. BMI160_RETURN_FUNCTION_TYPE bmi160_get_i2c_fail_err(u8
  3228. *v_i2c_error_code_u8);
  3229. /*!
  3230. * @brief This API Reads the dropped command error
  3231. * from the register 0x02 bit 6
  3232. *
  3233. *
  3234. * @param v_drop_cmd_err_u8 : The status of drop command error
  3235. *
  3236. *
  3237. *
  3238. * @return results of bus communication function
  3239. * @retval 0 -> Success
  3240. * @retval -1 -> Error
  3241. *
  3242. *
  3243. */
  3244. BMI160_RETURN_FUNCTION_TYPE bmi160_get_drop_cmd_err(u8
  3245. *v_drop_cmd_err_u8);
  3246. /*!
  3247. * @brief This API reads the magnetometer data ready
  3248. * interrupt not active.
  3249. * It reads from the error register 0x0x2 bit 7
  3250. *
  3251. *
  3252. *
  3253. *
  3254. * @param v_mag_data_rdy_err_u8 : The status of mag data ready interrupt
  3255. *
  3256. *
  3257. *
  3258. * @return results of bus communication function
  3259. * @retval 0 -> Success
  3260. * @retval -1 -> Error
  3261. *
  3262. *
  3263. */
  3264. BMI160_RETURN_FUNCTION_TYPE bmi160_get_mag_dada_rdy_err(u8
  3265. *v_mag_data_rdy_err_u8);
  3266. /*!
  3267. * @brief This API reads the error status
  3268. * from the error register 0x02 bit 0 to 7
  3269. *
  3270. * @param v_mag_data_rdy_err_u8 : The status of mag data ready interrupt
  3271. * @param v_fatal_er_u8r : The status of fatal error
  3272. * @param v_err_code_u8 : The status of error code
  3273. * @param v_i2c_fail_err_u8 : The status of I2C fail error
  3274. * @param v_drop_cmd_err_u8 : The status of drop command error
  3275. *
  3276. *
  3277. *
  3278. * @return results of bus communication function
  3279. * @retval 0 -> Success
  3280. * @retval -1 -> Error
  3281. *
  3282. *
  3283. */
  3284. BMI160_RETURN_FUNCTION_TYPE bmi160_get_error_status(u8 *v_fatal_er_u8r,
  3285. u8 *v_err_code_u8, u8 *v_i2c_fail_err_u8,
  3286. u8 *v_drop_cmd_err_u8, u8 *v_mag_data_rdy_err_u8);
  3287. /******************************************************************/
  3288. /**\name FUNCTIONS FOR MAG,ACCEL AND GYRO POWER MODE STATUS */
  3289. /*****************************************************************/
  3290. /*!
  3291. * @brief This API reads the magnetometer power mode from
  3292. * PMU status register 0x03 bit 0 and 1
  3293. *
  3294. * @param v_mag_power_mode_stat_u8 : The value of mag power mode
  3295. * mag_powermode | value
  3296. * ------------------|----------
  3297. * SUSPEND | 0x00
  3298. * NORMAL | 0x01
  3299. * LOW POWER | 0x02
  3300. *
  3301. *
  3302. * @note The power mode of mag set by the 0x7E command register
  3303. * @note using the function "bmi160_set_command_register()"
  3304. * value | mode
  3305. * ---------|----------------
  3306. * 0x18 | MAG_MODE_SUSPEND
  3307. * 0x19 | MAG_MODE_NORMAL
  3308. * 0x1A | MAG_MODE_LOWPOWER
  3309. *
  3310. * @return results of bus communication function
  3311. * @retval 0 -> Success
  3312. * @retval -1 -> Error
  3313. *
  3314. *
  3315. */
  3316. BMI160_RETURN_FUNCTION_TYPE bmi160_get_mag_power_mode_stat(u8
  3317. *v_mag_power_mode_stat_u8);
  3318. /*!
  3319. * @brief This API reads the gyroscope power mode from
  3320. * PMU status register 0x03 bit 2 and 3
  3321. *
  3322. * @param v_gyro_power_mode_stat_u8 : The value of gyro power mode
  3323. * gyro_powermode | value
  3324. * ------------------|----------
  3325. * SUSPEND | 0x00
  3326. * NORMAL | 0x01
  3327. * FAST POWER UP | 0x03
  3328. *
  3329. * @note The power mode of gyro set by the 0x7E command register
  3330. * @note using the function "bmi160_set_command_register()"
  3331. * value | mode
  3332. * ---------|----------------
  3333. * 0x14 | GYRO_MODE_SUSPEND
  3334. * 0x15 | GYRO_MODE_NORMAL
  3335. * 0x17 | GYRO_MODE_FASTSTARTUP
  3336. *
  3337. * @return results of bus communication function
  3338. * @retval 0 -> Success
  3339. * @retval -1 -> Error
  3340. *
  3341. *
  3342. */
  3343. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_power_mode_stat(u8
  3344. *v_gyro_power_mode_stat_u8);
  3345. /*!
  3346. * @brief This API reads the accelerometer power mode from
  3347. * PMU status register 0x03 bit 4 and 5
  3348. *
  3349. *
  3350. * @param v_accel_power_mode_stat_u8 : The value of accel power mode
  3351. * accel_powermode | value
  3352. * ------------------|----------
  3353. * SUSPEND | 0x00
  3354. * NORMAL | 0x01
  3355. * LOW POWER | 0x03
  3356. *
  3357. * @note The power mode of accel set by the 0x7E command register
  3358. * @note using the function "bmi160_set_command_register()"
  3359. * value | mode
  3360. * ---------|----------------
  3361. * 0x11 | ACCEL_MODE_NORMAL
  3362. * 0x12 | ACCEL_LOWPOWER
  3363. * 0x10 | ACCEL_SUSPEND
  3364. *
  3365. * @return results of bus communication function
  3366. * @retval 0 -> Success
  3367. * @retval -1 -> Error
  3368. *
  3369. *
  3370. */
  3371. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_power_mode_stat(u8
  3372. *v_accel_power_mode_stat_u8);
  3373. /**************************************************/
  3374. /**\name FUNCTION FOR Mag XYZ data read */
  3375. /*************************************************/
  3376. /*!
  3377. * @brief This API reads magnetometer data X values
  3378. * from the register 0x04 and 0x05
  3379. * @brief The mag sensor data read form auxiliary mag
  3380. *
  3381. * @param v_mag_x_s16 : The value of mag x
  3382. * @param v_sensor_select_u8 : Mag selection value
  3383. * value | sensor
  3384. * ---------|----------------
  3385. * 0 | BMM150
  3386. * 1 | AKM09911
  3387. *
  3388. * @note For mag data output rate configuration use the following function
  3389. * @note bmi160_set_mag_output_data_rate()
  3390. *
  3391. *
  3392. *
  3393. * @return results of bus communication function
  3394. * @retval 0 -> Success
  3395. * @retval -1 -> Error
  3396. *
  3397. */
  3398. BMI160_RETURN_FUNCTION_TYPE bmi160_read_mag_x(s16 *v_mag_x_s16,
  3399. u8 v_sensor_select_u8);
  3400. /*!
  3401. * @brief This API reads magnetometer data Y values
  3402. * from the register 0x06 and 0x07
  3403. * @brief The mag sensor data read form auxiliary mag
  3404. *
  3405. * @param v_mag_y_s16 : The value of mag y
  3406. * @param v_sensor_select_u8 : Mag selection value
  3407. * value | sensor
  3408. * ---------|----------------
  3409. * 0 | BMM150
  3410. * 1 | AKM09911
  3411. *
  3412. * @note For mag data output rate configuration use the following function
  3413. * @note bmi160_set_mag_output_data_rate()
  3414. *
  3415. * @return results of bus communication function
  3416. * @retval 0 -> Success
  3417. * @retval -1 -> Error
  3418. *
  3419. *
  3420. */
  3421. BMI160_RETURN_FUNCTION_TYPE bmi160_read_mag_y(s16 *v_mag_y_s16,
  3422. u8 v_sensor_select_u8);
  3423. /*!
  3424. * @brief This API reads magnetometer data Z values
  3425. * from the register 0x08 and 0x09
  3426. * @brief The mag sensor data read form auxiliary mag
  3427. *
  3428. * @param v_mag_z_s16 : The value of mag z
  3429. * @param v_sensor_select_u8 : Mag selection value
  3430. * value | sensor
  3431. * ---------|----------------
  3432. * 0 | BMM150
  3433. * 1 | AKM09911
  3434. *
  3435. * @note For mag data output rate configuration use the following function
  3436. * @note bmi160_set_mag_output_data_rate()
  3437. *
  3438. * @return results of bus communication function
  3439. * @retval 0 -> Success
  3440. * @retval -1 -> Error
  3441. *
  3442. *
  3443. */
  3444. BMI160_RETURN_FUNCTION_TYPE bmi160_read_mag_z(s16 *v_mag_z_s16,
  3445. u8 v_sensor_select_u8);
  3446. /*!
  3447. * @brief This API reads magnetometer data RHALL values
  3448. * from the register 0x0A and 0x0B
  3449. *
  3450. *
  3451. * @param v_mag_r_s16 : The value of BMM150 r data
  3452. *
  3453. *
  3454. *
  3455. * @return results of bus communication function
  3456. * @retval 0 -> Success
  3457. * @retval -1 -> Error
  3458. *
  3459. *
  3460. */
  3461. BMI160_RETURN_FUNCTION_TYPE bmi160_read_mag_r(
  3462. s16 *v_mag_r_s16);
  3463. /*!
  3464. * @brief This API reads magnetometer data X,Y,Z values
  3465. * from the register 0x04 to 0x09
  3466. *
  3467. * @brief The mag sensor data read form auxiliary mag
  3468. *
  3469. * @param mag : The value of mag xyz data
  3470. * @param v_sensor_select_u8 : Mag selection value
  3471. * value | sensor
  3472. * ---------|----------------
  3473. * 0 | BMM150
  3474. * 1 | AKM09911
  3475. *
  3476. * @note For mag data output rate configuration use the following function
  3477. * @note bmi160_set_mag_output_data_rate()
  3478. *
  3479. * @return results of bus communication function
  3480. * @retval 0 -> Success
  3481. * @retval -1 -> Error *
  3482. *
  3483. */
  3484. BMI160_RETURN_FUNCTION_TYPE bmi160_read_mag_xyz(
  3485. struct bmi160_mag_t *mag, u8 v_sensor_select_u8);
  3486. /*!*
  3487. * @brief This API reads magnetometer data X,Y,Z,r
  3488. * values from the register 0x04 to 0x0B
  3489. *
  3490. * @brief The mag sensor data read form auxiliary mag
  3491. *
  3492. * @param mag : The value of mag-BMM150 xyzr data
  3493. *
  3494. * @note For mag data output rate configuration use the following function
  3495. * @note bmi160_set_mag_output_data_rate()
  3496. *
  3497. * @return results of bus communication function
  3498. * @retval 0 -> Success
  3499. * @retval -1 -> Error
  3500. *
  3501. *
  3502. */
  3503. BMI160_RETURN_FUNCTION_TYPE bmi160_read_mag_xyzr(
  3504. struct bmi160_mag_xyzr_t *mag);
  3505. /**************************************************/
  3506. /**\name FUNCTION FOR GYRO XYZ DATA READ */
  3507. /*************************************************/
  3508. /*!
  3509. * @brief This API reads gyro data X values
  3510. * form the register 0x0C and 0x0D
  3511. *
  3512. *
  3513. *
  3514. *
  3515. * @param v_gyro_x_s16 : The value of gyro x data
  3516. *
  3517. * @note Gyro Configuration use the following function
  3518. * @note bmi160_set_gyro_output_data_rate()
  3519. * @note bmi160_set_gyro_bw()
  3520. * @note bmi160_set_gyro_range()
  3521. *
  3522. * @return results of bus communication function
  3523. * @retval 0 -> Success
  3524. * @retval -1 -> Error
  3525. *
  3526. */
  3527. BMI160_RETURN_FUNCTION_TYPE bmi160_read_gyro_x(
  3528. s16 *v_gyro_x_s16);
  3529. /*!
  3530. * @brief This API reads gyro data Y values
  3531. * form the register 0x0E and 0x0F
  3532. *
  3533. *
  3534. *
  3535. *
  3536. * @param v_gyro_y_s16 : The value of gyro y data
  3537. *
  3538. * @note Gyro Configuration use the following function
  3539. * @note bmi160_set_gyro_output_data_rate()
  3540. * @note bmi160_set_gyro_bw()
  3541. * @note bmi160_set_gyro_range()
  3542. *
  3543. * @return results of bus communication function
  3544. * @retval 0 -> Success
  3545. * @retval -1 -> Error result of communication routines
  3546. *
  3547. *
  3548. */
  3549. BMI160_RETURN_FUNCTION_TYPE bmi160_read_gyro_y(
  3550. s16 *v_gyro_y_s16);
  3551. /*!
  3552. * @brief This API reads gyro data Z values
  3553. * form the register 0x10 and 0x11
  3554. *
  3555. *
  3556. *
  3557. *
  3558. * @param v_gyro_z_s16 : The value of gyro z data
  3559. *
  3560. * @note Gyro Configuration use the following function
  3561. * @note bmi160_set_gyro_output_data_rate()
  3562. * @note bmi160_set_gyro_bw()
  3563. * @note bmi160_set_gyro_range()
  3564. *
  3565. * @return results of bus communication function
  3566. * @retval 0 -> Success
  3567. * @retval -1 -> Error
  3568. *
  3569. *
  3570. */
  3571. BMI160_RETURN_FUNCTION_TYPE bmi160_read_gyro_z(
  3572. s16 *v_gyro_z_s16);
  3573. /*!
  3574. * @brief This API reads gyro data X,Y,Z values
  3575. * from the register 0x0C to 0x11
  3576. *
  3577. *
  3578. *
  3579. *
  3580. * @param gyro : The value of gyro xyz
  3581. *
  3582. * @note Gyro Configuration use the following function
  3583. * @note bmi160_set_gyro_output_data_rate()
  3584. * @note bmi160_set_gyro_bw()
  3585. * @note bmi160_set_gyro_range()
  3586. *
  3587. * @return results of bus communication function
  3588. * @retval 0 -> Success
  3589. * @retval -1 -> Error
  3590. *
  3591. *
  3592. */
  3593. BMI160_RETURN_FUNCTION_TYPE bmi160_read_gyro_xyz(
  3594. struct bmi160_gyro_t *gyro);
  3595. /**************************************************/
  3596. /**\name FUNCTION FOR ACCEL XYZ DATA READ */
  3597. /*************************************************/
  3598. /*!
  3599. * @brief This API reads accelerometer data X values
  3600. * form the register 0x12 and 0x13
  3601. *
  3602. *
  3603. *
  3604. *
  3605. * @param v_accel_x_s16 : The value of accel x
  3606. *
  3607. * @note For accel configuration use the following functions
  3608. * @note bmi160_set_accel_output_data_rate()
  3609. * @note bmi160_set_accel_bw()
  3610. * @note bmi160_set_accel_under_sampling_parameter()
  3611. * @note bmi160_set_accel_range()
  3612. *
  3613. * @return results of bus communication function
  3614. * @retval 0 -> Success
  3615. * @retval -1 -> Error
  3616. *
  3617. *
  3618. */
  3619. BMI160_RETURN_FUNCTION_TYPE bmi160_read_accel_x(
  3620. s16 *v_accel_x_s16);
  3621. /*!
  3622. * @brief This API reads accelerometer data Y values
  3623. * form the register 0x14 and 0x15
  3624. *
  3625. *
  3626. *
  3627. *
  3628. * @param v_accel_y_s16 : The value of accel y
  3629. *
  3630. * @note For accel configuration use the following functions
  3631. * @note bmi160_set_accel_output_data_rate()
  3632. * @note bmi160_set_accel_bw()
  3633. * @note bmi160_set_accel_under_sampling_parameter()
  3634. * @note bmi160_set_accel_range()
  3635. *
  3636. * @return results of bus communication function
  3637. * @retval 0 -> Success
  3638. * @retval -1 -> Error
  3639. *
  3640. *
  3641. */
  3642. BMI160_RETURN_FUNCTION_TYPE bmi160_read_accel_y(
  3643. s16 *v_accel_y_s16);
  3644. /*!
  3645. * @brief This API reads accelerometer data Z values
  3646. * form the register 0x16 and 0x17
  3647. *
  3648. *
  3649. *
  3650. *
  3651. * @param v_accel_z_s16 : The value of accel z
  3652. *
  3653. * @note For accel configuration use the following functions
  3654. * @note bmi160_set_accel_output_data_rate()
  3655. * @note bmi160_set_accel_bw()
  3656. * @note bmi160_set_accel_under_sampling_parameter()
  3657. * @note bmi160_set_accel_range()
  3658. *
  3659. * @return results of bus communication function
  3660. * @retval 0 -> Success
  3661. * @retval -1 -> Error
  3662. *
  3663. *
  3664. */
  3665. BMI160_RETURN_FUNCTION_TYPE bmi160_read_accel_z(
  3666. s16 *v_accel_z_s16);
  3667. /*!
  3668. * @brief This API reads accelerometer data X,Y,Z values
  3669. * from the register 0x12 to 0x17
  3670. *
  3671. *
  3672. *
  3673. *
  3674. * @param accel :The value of accel xyz
  3675. *
  3676. * @note For accel configuration use the following functions
  3677. * @note bmi160_set_accel_output_data_rate()
  3678. * @note bmi160_set_accel_bw()
  3679. * @note bmi160_set_accel_under_sampling_parameter()
  3680. * @note bmi160_set_accel_range()
  3681. *
  3682. * @return results of bus communication function
  3683. * @retval 0 -> Success
  3684. * @retval -1 -> Error
  3685. *
  3686. *
  3687. */
  3688. BMI160_RETURN_FUNCTION_TYPE bmi160_read_accel_xyz(
  3689. struct bmi160_accel_t *accel);
  3690. /**************************************************/
  3691. /**\name FUNCTION FOR SENSOR TIME */
  3692. /*************************************************/
  3693. /*!
  3694. * @brief This API reads sensor_time from the register
  3695. * 0x18 to 0x1A
  3696. *
  3697. *
  3698. * @param v_sensor_time_u32 : The value of sensor time
  3699. *
  3700. *
  3701. *
  3702. * @return results of bus communication function
  3703. * @retval 0 -> Success
  3704. * @retval -1 -> Error
  3705. *
  3706. *
  3707. */
  3708. BMI160_RETURN_FUNCTION_TYPE bmi160_get_sensor_time(
  3709. u32 *v_sensor_time_u32);
  3710. /**************************************************/
  3711. /**\name FUNCTION FOR GYRO SLEF TEST */
  3712. /*************************************************/
  3713. /*!
  3714. * @brief This API reads the Gyroscope self test
  3715. * status from the register 0x1B bit 1
  3716. *
  3717. *
  3718. * @param v_gyro_selftest_u8 : The value of gyro self test status
  3719. * value | status
  3720. * ---------|----------------
  3721. * 0 | Gyroscope self test is running or failed
  3722. * 1 | Gyroscope self test completed successfully
  3723. *
  3724. *
  3725. * @return results of bus communication function
  3726. * @retval 0 -> Success
  3727. * @retval -1 -> Error
  3728. *
  3729. *
  3730. */
  3731. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_selftest(u8
  3732. *v_gyro_selftest_u8);
  3733. /**************************************************/
  3734. /**\name FUNCTION FOR MANUAL INTERFACE */
  3735. /*************************************************/
  3736. /*!
  3737. * @brief This API reads the status of
  3738. * mag manual interface operation form the register 0x1B bit 2
  3739. *
  3740. *
  3741. *
  3742. * @param v_mag_manual_stat_u8 : The value of mag manual operation status
  3743. * value | status
  3744. * ---------|----------------
  3745. * 0 | Indicates no manual magnetometer
  3746. * - | interface operation is ongoing
  3747. * 1 | Indicates manual magnetometer
  3748. * - | interface operation is ongoing
  3749. *
  3750. * @return results of bus communication function
  3751. * @retval 0 -> Success
  3752. * @retval -1 -> Error
  3753. *
  3754. *
  3755. */
  3756. BMI160_RETURN_FUNCTION_TYPE bmi160_get_mag_manual_operation_stat(u8
  3757. *v_mag_manual_stat_u8);
  3758. /**************************************************/
  3759. /**\name FUNCTION FOR FAST OFFSET READY */
  3760. /*************************************************/
  3761. /*!
  3762. * @brief This API reads the fast offset compensation
  3763. * status form the register 0x1B bit 3
  3764. *
  3765. *
  3766. * @param v_foc_rdy_u8 : The status of fast compensation
  3767. *
  3768. *
  3769. *
  3770. * @return results of bus communication function
  3771. * @retval 0 -> Success
  3772. * @retval -1 -> Error
  3773. *
  3774. *
  3775. */
  3776. BMI160_RETURN_FUNCTION_TYPE bmi160_get_foc_rdy(u8
  3777. *v_foc_rdy_u8);
  3778. /**************************************************/
  3779. /**\name FUNCTION FOR NVM READY */
  3780. /*************************************************/
  3781. /*!
  3782. * @brief This API Reads the nvm_rdy status from the
  3783. * resister 0x1B bit 4
  3784. *
  3785. *
  3786. * @param v_nvm_rdy_u8 : The value of NVM ready status
  3787. * value | status
  3788. * ---------|----------------
  3789. * 0 | NVM write operation in progress
  3790. * 1 | NVM is ready to accept a new write trigger
  3791. *
  3792. *
  3793. * @return results of bus communication function
  3794. * @retval 0 -> Success
  3795. * @retval -1 -> Error
  3796. *
  3797. *
  3798. */
  3799. BMI160_RETURN_FUNCTION_TYPE bmi160_get_nvm_rdy(u8
  3800. *v_nvm_rdy_u8);
  3801. /**************************************************/
  3802. /**\name FUNCTION FOR DATA READY FOR MAG, GYRO, AND ACCEL */
  3803. /*************************************************/
  3804. /*!
  3805. * @brief This API reads the status of mag data ready
  3806. * from the register 0x1B bit 5
  3807. * The status get reset when one mag data register is read out
  3808. *
  3809. * @param v_data_rdy_u8 : The value of mag data ready status
  3810. *
  3811. *
  3812. *
  3813. * @return results of bus communication function
  3814. * @retval 0 -> Success
  3815. * @retval -1 -> Error
  3816. *
  3817. *
  3818. */
  3819. BMI160_RETURN_FUNCTION_TYPE bmi160_get_data_rdy_mag(u8
  3820. *v_data_rdy_u8);
  3821. /*!
  3822. * @brief This API reads the status of gyro data ready form the
  3823. * register 0x1B bit 6
  3824. * The status get reset when gyro data register read out
  3825. *
  3826. *
  3827. * @param v_data_rdy_u8 : The value of gyro data ready
  3828. *
  3829. *
  3830. *
  3831. * @return results of bus communication function
  3832. * @retval 0 -> Success
  3833. * @retval -1 -> Error
  3834. *
  3835. *
  3836. */
  3837. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_data_rdy(u8
  3838. *v_data_rdy_u8);
  3839. /*!
  3840. * @brief This API reads the status of accel data ready form the
  3841. * register 0x1B bit 7
  3842. * The status get reset when accel data register read out
  3843. *
  3844. *
  3845. * @param v_data_rdy_u8 : The value of accel data ready status
  3846. *
  3847. *
  3848. *
  3849. * @return results of bus communication function
  3850. * @retval 0 -> Success
  3851. * @retval -1 -> Error
  3852. *
  3853. *
  3854. */
  3855. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_data_rdy(u8
  3856. *drdy_acc);
  3857. /**************************************************/
  3858. /**\name FUNCTION FOR STEP INTERRUPT STATUS */
  3859. /*************************************************/
  3860. /*!
  3861. * @brief This API reads the step detector interrupt status
  3862. * from the register 0x1C bit 0
  3863. * flag is associated with a specific interrupt function.
  3864. * It is set when the single tab interrupt triggers. The
  3865. * setting of INT_LATCH controls if the interrupt
  3866. * signal and hence the
  3867. * respective interrupt flag will be
  3868. * permanently latched, temporarily latched
  3869. * or not latched.
  3870. *
  3871. *
  3872. *
  3873. *
  3874. * @param v_step_intr_u8 : The status of step detector interrupt
  3875. *
  3876. *
  3877. *
  3878. * @return results of bus communication function
  3879. * @retval 0 -> Success
  3880. * @retval -1 -> Error
  3881. *
  3882. *
  3883. */
  3884. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat0_step_intr(u8
  3885. *v_step_intr_u8);
  3886. /**************************************************/
  3887. /**\name FUNCTION FOR SIGNIFICANT INTERRUPT STATUS */
  3888. /*************************************************/
  3889. /*!
  3890. * @brief This API reads the
  3891. * significant motion interrupt status
  3892. * from the register 0x1C bit 1
  3893. * flag is associated with a specific interrupt function.
  3894. * It is set when the single tab interrupt triggers. The
  3895. * setting of INT_LATCH controls if the interrupt
  3896. * signal and hence the
  3897. * respective interrupt flag will be
  3898. * permanently latched, temporarily latched
  3899. * or not latched.
  3900. *
  3901. *
  3902. *
  3903. *
  3904. *
  3905. * @param v_significant_intr_u8 : The status of step
  3906. * motion interrupt
  3907. *
  3908. *
  3909. *
  3910. * @return results of bus communication function
  3911. * @retval 0 -> Success
  3912. * @retval -1 -> Error
  3913. *
  3914. *
  3915. */
  3916. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat0_significant_intr(u8
  3917. *sigmot_intr);
  3918. /**************************************************/
  3919. /**\name FUNCTION FOR ANY MOTION INTERRUPT STATUS */
  3920. /*************************************************/
  3921. /*!
  3922. * @brief This API reads the any motion interrupt status
  3923. * from the register 0x1C bit 2
  3924. * flag is associated with a specific interrupt function.
  3925. * It is set when the single tab interrupt triggers. The
  3926. * setting of INT_LATCH controls if the interrupt
  3927. * signal and hence the
  3928. * respective interrupt flag will be
  3929. * permanently latched, temporarily latched
  3930. * or not latched.
  3931. *
  3932. *
  3933. *
  3934. * @param v_any_motion_intr_u8 : The status of any-motion interrupt
  3935. *
  3936. *
  3937. *
  3938. * @return results of bus communication function
  3939. * @retval 0 -> Success
  3940. * @retval -1 -> Error
  3941. *
  3942. *
  3943. */
  3944. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat0_any_motion_intr(u8
  3945. *v_any_motion_intr_u8);
  3946. /**************************************************/
  3947. /**\name FUNCTION FOR PMU TRIGGER INTERRUPT STATUS */
  3948. /*************************************************/
  3949. /*!
  3950. * @brief This API reads the power mode trigger interrupt status
  3951. * from the register 0x1C bit 3
  3952. * flag is associated with a specific interrupt function.
  3953. * It is set when the single tab interrupt triggers. The
  3954. * setting of INT_LATCH controls if the interrupt
  3955. * signal and hence the
  3956. * respective interrupt flag will be
  3957. * permanently latched, temporarily latched
  3958. * or not latched.
  3959. *
  3960. *
  3961. *
  3962. *
  3963. *
  3964. * @param v_pmu_trigger_intr_u8 : The status of power mode trigger interrupt
  3965. *
  3966. *
  3967. *
  3968. * @return results of bus communication function
  3969. * @retval 0 -> Success
  3970. * @retval -1 -> Error
  3971. *
  3972. *
  3973. */
  3974. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat0_pmu_trigger_intr(u8
  3975. *v_pmu_trigger_intr_u8);
  3976. /**************************************************/
  3977. /**\name FUNCTION FOR DOUBLE TAB STATUS */
  3978. /*************************************************/
  3979. /*!
  3980. * @brief This API reads the double tab status
  3981. * from the register 0x1C bit 4
  3982. * flag is associated with a specific interrupt function.
  3983. * It is set when the single tab interrupt triggers. The
  3984. * setting of INT_LATCH controls if the interrupt
  3985. * signal and hence the
  3986. * respective interrupt flag will be
  3987. * permanently latched, temporarily latched
  3988. * or not latched.
  3989. *
  3990. *
  3991. *
  3992. *
  3993. * @param v_double_tap_intr_u8 :The status of double tab interrupt
  3994. *
  3995. * @note Double tap interrupt can be configured by the following functions
  3996. * @note INTERRUPT MAPPING
  3997. * @note bmi160_set_intr_double_tap()
  3998. * @note AXIS MAPPING
  3999. * @note bmi160_get_stat2_tap_first_x()
  4000. * @note bmi160_get_stat2_tap_first_y()
  4001. * @note bmi160_get_stat2_tap_first_z()
  4002. * @note DURATION
  4003. * @note bmi160_set_intr_tap_durn()
  4004. * @note THRESHOLD
  4005. * @note bmi160_set_intr_tap_thres()
  4006. * @note TAP QUIET
  4007. * @note bmi160_set_intr_tap_quiet()
  4008. * @note TAP SHOCK
  4009. * @note bmi160_set_intr_tap_shock()
  4010. * @note TAP SOURCE
  4011. * @note bmi160_set_intr_tap_source()
  4012. *
  4013. * @return results of bus communication function
  4014. * @retval 0 -> Success
  4015. * @retval -1 -> Error
  4016. *
  4017. *
  4018. */
  4019. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat0_double_tap_intr(u8
  4020. *v_double_tap_intr_u8);
  4021. /**************************************************/
  4022. /**\name FUNCTION FOR SINGLE TAB STATUS */
  4023. /*************************************************/
  4024. /*!
  4025. * @brief This API reads the single tab status
  4026. * from the register 0x1C bit 5
  4027. * flag is associated with a specific interrupt function.
  4028. * It is set when the single tab interrupt triggers. The
  4029. * setting of INT_LATCH controls if the interrupt
  4030. * signal and hence the
  4031. * respective interrupt flag will be
  4032. * permanently latched, temporarily latched
  4033. * or not latched.
  4034. *
  4035. *
  4036. *
  4037. *
  4038. * @param v_single_tap_intr_u8 :The status of single tap interrupt
  4039. *
  4040. * @note Single tap interrupt can be configured by the following functions
  4041. * @note INTERRUPT MAPPING
  4042. * @note bmi160_set_intr_single_tap()
  4043. * @note AXIS MAPPING
  4044. * @note bmi160_get_stat2_tap_first_x()
  4045. * @note bmi160_get_stat2_tap_first_y()
  4046. * @note bmi160_get_stat2_tap_first_z()
  4047. * @note DURATION
  4048. * @note bmi160_set_intr_tap_durn()
  4049. * @note THRESHOLD
  4050. * @note bmi160_set_intr_tap_thres()
  4051. * @note TAP QUIET
  4052. * @note bmi160_set_intr_tap_quiet()
  4053. * @note TAP SHOCK
  4054. * @note bmi160_set_intr_tap_shock()
  4055. * @note TAP SOURCE
  4056. * @note bmi160_set_intr_tap_source()
  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_stat0_single_tap_intr(u8
  4065. *v_single_tap_intr_u8);
  4066. /**************************************************/
  4067. /**\name FUNCTION FOR ORIENT INTERRUPT STATUS */
  4068. /*************************************************/
  4069. /*!
  4070. * @brief This API reads the orient status
  4071. * from the register 0x1C bit 6
  4072. * flag is associated with a specific interrupt function.
  4073. * It is set when the orient interrupt triggers. The
  4074. * setting of INT_LATCH controls if the
  4075. * interrupt 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_orient_intr_u8 : The status of orient interrupt
  4084. *
  4085. * @note For orient interrupt configuration use the following functions
  4086. * @note STATUS
  4087. * @note bmi160_get_stat0_orient_intr()
  4088. * @note AXIS MAPPING
  4089. * @note bmi160_get_stat3_orient_xy()
  4090. * @note bmi160_get_stat3_orient_z()
  4091. * @note bmi160_set_intr_orient_axes_enable()
  4092. * @note INTERRUPT MAPPING
  4093. * @note bmi160_set_intr_orient()
  4094. * @note INTERRUPT OUTPUT
  4095. * @note bmi160_set_intr_orient_ud_enable()
  4096. * @note THETA
  4097. * @note bmi160_set_intr_orient_theta()
  4098. * @note HYSTERESIS
  4099. * @note bmi160_set_intr_orient_hyst()
  4100. * @note BLOCKING
  4101. * @note bmi160_set_intr_orient_blocking()
  4102. * @note MODE
  4103. * @note bmi160_set_intr_orient_mode()
  4104. *
  4105. * @return results of bus communication function
  4106. * @retval 0 -> Success
  4107. * @retval -1 -> Error
  4108. *
  4109. *
  4110. */
  4111. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat0_orient_intr(u8
  4112. *v_orient_intr_u8);
  4113. /**************************************************/
  4114. /**\name FUNCTION FOR FLAT INTERRUPT STATUS */
  4115. /*************************************************/
  4116. /*!
  4117. * @brief This API reads the flat interrupt status
  4118. * from the register 0x1C bit 7
  4119. * flag is associated with a specific interrupt function.
  4120. * It is set when the flat interrupt triggers. The
  4121. * setting of INT_LATCH controls if the
  4122. * interrupt signal and hence the
  4123. * respective interrupt flag will be
  4124. * permanently latched, temporarily latched
  4125. * or not latched.
  4126. *
  4127. *
  4128. *
  4129. *
  4130. * @param v_flat_intr_u8 : The status of flat interrupt
  4131. *
  4132. * @note For flat configuration use the following functions
  4133. * @note STATS
  4134. * @note bmi160_get_stat0_flat_intr()
  4135. * @note bmi160_get_stat3_flat()
  4136. * @note INTERRUPT MAPPING
  4137. * @note bmi160_set_intr_flat()
  4138. * @note THETA
  4139. * @note bmi160_set_intr_flat_theta()
  4140. * @note HOLD TIME
  4141. * @note bmi160_set_intr_flat_hold()
  4142. * @note HYSTERESIS
  4143. * @note bmi160_set_intr_flat_hyst()
  4144. *
  4145. * @return results of bus communication function
  4146. * @retval 0 -> Success
  4147. * @retval -1 -> Error
  4148. *
  4149. *
  4150. */
  4151. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat0_flat_intr(u8
  4152. *v_flat_intr_u8);
  4153. /**************************************************/
  4154. /**\name FUNCTION FOR HIGH_G INTERRUPT STATUS */
  4155. /*************************************************/
  4156. /*!
  4157. * @brief This API reads the high_g interrupt status
  4158. * from the register 0x1D bit 2
  4159. * flag is associated with a specific interrupt function.
  4160. * It is set when the high g interrupt triggers. The
  4161. * setting of INT_LATCH controls if the interrupt signal and hence the
  4162. * respective interrupt flag will be permanently
  4163. * latched, temporarily latched
  4164. * or not latched.
  4165. *
  4166. *
  4167. *
  4168. *
  4169. * @param v_high_g_intr_u8 : The status of high_g interrupt
  4170. *
  4171. * @note High_g interrupt configured by following functions
  4172. * @note STATUS
  4173. * @note bmi160_get_stat1_high_g_intr()
  4174. * @note AXIS MAPPING
  4175. * @note bmi160_get_stat3_high_g_first_x()
  4176. * @note bmi160_get_stat3_high_g_first_y()
  4177. * @note bmi160_get_stat3_high_g_first_z()
  4178. * @note SIGN MAPPING
  4179. * @note bmi160_get_stat3_high_g_first_sign()
  4180. * @note INTERRUPT MAPPING
  4181. * @note bmi160_set_intr_high_g()
  4182. * @note HYSTERESIS
  4183. * @note bmi160_set_intr_high_g_hyst()
  4184. * @note DURATION
  4185. * @note bmi160_set_intr_high_g_durn()
  4186. * @note THRESHOLD
  4187. * @note bmi160_set_intr_high_g_thres()
  4188. * @note SOURCE
  4189. * @note bmi160_set_intr_low_high_source()
  4190. *
  4191. * @return results of bus communication function
  4192. * @retval 0 -> Success
  4193. * @retval -1 -> Error
  4194. *
  4195. */
  4196. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat1_high_g_intr(u8
  4197. *v_high_g_intr_u8);
  4198. /**************************************************/
  4199. /**\name FUNCTION FOR LOW_G INTERRUPT STATUS */
  4200. /*************************************************/
  4201. /*!
  4202. * @brief This API reads the low g interrupt status
  4203. * from the register 0x1D bit 3
  4204. * flag is associated with a specific interrupt function.
  4205. * It is set when the low g interrupt triggers. The
  4206. * setting of INT_LATCH controls if the interrupt signal and hence the
  4207. * respective interrupt flag will be
  4208. * permanently latched, temporarily latched
  4209. * or not latched.
  4210. *
  4211. *
  4212. *
  4213. *
  4214. * @param v_low_g_intr_u8 : The status of low_g interrupt
  4215. *
  4216. * @note Low_g interrupt configured by following functions
  4217. * @note STATUS
  4218. * @note bmi160_get_stat1_low_g_intr()
  4219. * @note INTERRUPT MAPPING
  4220. * @note bmi160_set_intr_low_g()
  4221. * @note SOURCE
  4222. * @note bmi160_set_intr_low_high_source()
  4223. * @note DURATION
  4224. * @note bmi160_set_intr_low_g_durn()
  4225. * @note THRESHOLD
  4226. * @note bmi160_set_intr_low_g_thres()
  4227. * @note HYSTERESIS
  4228. * @note bmi160_set_intr_low_g_hyst()
  4229. * @note MODE
  4230. * @note bmi160_set_intr_low_g_mode()
  4231. *
  4232. * @return results of bus communication function
  4233. * @retval 0 -> Success
  4234. * @retval -1 -> Error
  4235. *
  4236. *
  4237. */
  4238. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat1_low_g_intr(u8
  4239. *v_low_g_intr_u8);
  4240. /**************************************************/
  4241. /**\name FUNCTION FOR DATA READY INTERRUPT STATUS */
  4242. /*************************************************/
  4243. /*!
  4244. * @brief This API reads data ready interrupt status
  4245. * from the register 0x1D bit 4
  4246. * flag is associated with a specific interrupt function.
  4247. * It is set when the data ready interrupt triggers. The
  4248. * setting of INT_LATCH controls if the interrupt signal and hence the
  4249. * respective interrupt flag will be
  4250. * permanently latched, temporarily latched
  4251. * or not latched.
  4252. *
  4253. *
  4254. *
  4255. *
  4256. * @param v_data_rdy_intr_u8 : The status of data ready interrupt
  4257. *
  4258. * @note Data ready interrupt configured by following functions
  4259. * @note STATUS
  4260. * @note bmi160_get_stat1_data_rdy_intr()
  4261. * @note INTERRUPT MAPPING
  4262. * @note bmi160_set_intr_data_rdy()
  4263. *
  4264. * @return results of bus communication function
  4265. * @retval 0 -> Success
  4266. * @retval -1 -> Error
  4267. *
  4268. *
  4269. */
  4270. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat1_data_rdy_intr(u8
  4271. *v_data_rdy_intr_u8);
  4272. /**************************************************/
  4273. /**\name FUNCTIONS FOR FIFO FULL AND WATER MARK INTERRUPT STATUS*/
  4274. /*************************************************/
  4275. /*!
  4276. * @brief This API reads data ready FIFO full interrupt status
  4277. * from the register 0x1D bit 5
  4278. * flag is associated with a specific interrupt function.
  4279. * It is set when the FIFO full interrupt triggers. The
  4280. * setting of INT_LATCH controls if the
  4281. * interrupt signal and hence the
  4282. * respective interrupt flag will
  4283. * be permanently latched, temporarily latched
  4284. * or not latched.
  4285. *
  4286. *
  4287. *
  4288. *
  4289. * @param v_fifo_full_intr_u8 : The status of fifo full interrupt
  4290. *
  4291. * @note FIFO full interrupt can be configured by following functions
  4292. * @note bmi160_set_intr_fifo_full()
  4293. *
  4294. * @return results of bus communication function
  4295. * @retval 0 -> Success
  4296. * @retval -1 -> Error
  4297. *
  4298. *
  4299. */
  4300. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat1_fifo_full_intr(u8
  4301. *v_fifo_full_intr_u8);
  4302. /*!
  4303. * @brief This API reads data
  4304. * ready FIFO watermark interrupt status
  4305. * from the register 0x1D bit 6
  4306. * flag is associated with a specific interrupt function.
  4307. * It is set when the FIFO watermark interrupt triggers. The
  4308. * setting of INT_LATCH controls if the
  4309. * interrupt signal and hence the
  4310. * respective interrupt flag will be
  4311. * permanently latched, temporarily latched
  4312. * or not latched.
  4313. *
  4314. *
  4315. *
  4316. *
  4317. * @param v_fifo_wm_intr_u8 : The status of fifo water mark interrupt
  4318. *
  4319. * @note FIFO full interrupt can be configured by following functions
  4320. * @note bmi160_set_intr_fifo_wm()
  4321. *
  4322. * @return results of bus communication function
  4323. * @retval 0 -> Success
  4324. * @retval -1 -> Error
  4325. *
  4326. *
  4327. */
  4328. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat1_fifo_wm_intr(u8
  4329. *v_fifo_wm_intr_u8);
  4330. /**************************************************/
  4331. /**\name FUNCTIONS FOR NO MOTION INTERRUPT STATUS*/
  4332. /*************************************************/
  4333. /*!
  4334. * @brief This API reads data ready no motion interrupt status
  4335. * from the register 0x1D bit 7
  4336. * flag is associated with a specific interrupt function.
  4337. * It is set when the no motion interrupt triggers. The
  4338. * setting of INT_LATCH controls if the interrupt signal and hence the
  4339. * respective interrupt flag will be permanently
  4340. * latched, temporarily latched
  4341. * or not latched.
  4342. *
  4343. *
  4344. *
  4345. *
  4346. * @param v_nomotion_intr_u8 : The status of no motion interrupt
  4347. *
  4348. * @note No motion interrupt can be configured by following function
  4349. * @note STATUS
  4350. * @note bmi160_get_stat1_nomotion_intr()
  4351. * @note INTERRUPT MAPPING
  4352. * @note bmi160_set_intr_nomotion()
  4353. * @note DURATION
  4354. * @note bmi160_set_intr_slow_no_motion_durn()
  4355. * @note THRESHOLD
  4356. * @note bmi160_set_intr_slow_no_motion_thres()
  4357. * @note SLOW/NO MOTION SELECT
  4358. * @note bmi160_set_intr_slow_no_motion_select()
  4359. *
  4360. * @return results of bus communication function
  4361. * @retval 0 -> Success
  4362. * @retval -1 -> Error
  4363. *
  4364. *
  4365. */
  4366. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat1_nomotion_intr(u8
  4367. *nomo_intr);
  4368. /**************************************************/
  4369. /**\name FUNCTIONS FOR ANY MOTION FIRST XYZ AND SIGN INTERRUPT STATUS*/
  4370. /*************************************************/
  4371. /*!
  4372. * @brief This API reads the status of any motion first x
  4373. * from the register 0x1E bit 0
  4374. *
  4375. *
  4376. * @param v_anymotion_first_x_u8 : The status of any motion first x interrupt
  4377. * value | status
  4378. * -----------|-------------
  4379. * 0 | not triggered
  4380. * 1 | triggered by x axis
  4381. *
  4382. * @return results of bus communication function
  4383. * @retval 0 -> Success
  4384. * @retval -1 -> Error
  4385. *
  4386. *
  4387. */
  4388. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat2_any_motion_first_x(u8
  4389. *v_anymotion_first_x_u8);
  4390. /*!
  4391. * @brief This API reads the status of any motion first y interrupt
  4392. * from the register 0x1E bit 1
  4393. *
  4394. *
  4395. *
  4396. *@param v_any_motion_first_y_u8 : The status of any motion first y interrupt
  4397. * value | status
  4398. * -----------|-------------
  4399. * 0 | not triggered
  4400. * 1 | triggered by y axis
  4401. *
  4402. *
  4403. *
  4404. * @return results of bus communication function
  4405. * @retval 0 -> Success
  4406. * @retval -1 -> Error
  4407. *
  4408. *
  4409. */
  4410. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat2_any_motion_first_y(u8
  4411. *v_any_motion_first_y_u8);
  4412. /*!
  4413. * @brief This API reads the status of any motion first z interrupt
  4414. * from the register 0x1E bit 2
  4415. *
  4416. *
  4417. *
  4418. *
  4419. *@param v_any_motion_first_z_u8 : The status of any motion first z interrupt
  4420. * value | status
  4421. * -----------|-------------
  4422. * 0 | not triggered
  4423. * 1 | triggered by y axis
  4424. *
  4425. *
  4426. *
  4427. * @return results of bus communication function
  4428. * @retval 0 -> Success
  4429. * @retval -1 -> Error
  4430. *
  4431. *
  4432. */
  4433. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat2_any_motion_first_z(u8
  4434. *v_any_motion_first_z_u8);
  4435. /*!
  4436. * @brief This API reads the any motion sign status from the
  4437. * register 0x1E bit 3
  4438. *
  4439. *
  4440. *
  4441. *
  4442. * @param v_anymotion_sign_u8 : The status of any motion sign
  4443. * value | sign
  4444. * -----------|-------------
  4445. * 0 | positive
  4446. * 1 | negative
  4447. *
  4448. *
  4449. * @return results of bus communication function
  4450. * @retval 0 -> Success
  4451. * @retval -1 -> Error
  4452. *
  4453. *
  4454. */
  4455. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat2_any_motion_sign(u8
  4456. *v_anymotion_sign_u8);
  4457. /**************************************************/
  4458. /**\name FUNCTIONS FOR TAP FIRST XYZ AND SIGN INTERRUPT STATUS*/
  4459. /*************************************************/
  4460. /*!
  4461. * @brief This API reads the any motion tap first x status from the
  4462. * register 0x1E bit 4
  4463. *
  4464. *
  4465. *
  4466. *
  4467. * @param v_tap_first_x_u8 :The status of any motion tap first x
  4468. * value | status
  4469. * -----------|-------------
  4470. * 0 | not triggered
  4471. * 1 | triggered by x axis
  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_stat2_tap_first_x(u8
  4480. *v_tap_first_x_u8);
  4481. /*!
  4482. * @brief This API reads the tap first y interrupt status from the
  4483. * register 0x1E bit 5
  4484. *
  4485. *
  4486. *
  4487. *
  4488. * @param v_tap_first_y_u8 :The status of tap first y interrupt
  4489. * value | status
  4490. * -----------|-------------
  4491. * 0 | not triggered
  4492. * 1 | triggered by y axis
  4493. *
  4494. *
  4495. *
  4496. * @return results of bus communication function
  4497. * @retval 0 -> Success
  4498. * @retval -1 -> Error
  4499. *
  4500. *
  4501. */
  4502. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat2_tap_first_y(u8
  4503. *v_tap_first_y_u8);
  4504. /*!
  4505. * @brief This API reads the tap first z interrupt status from the
  4506. * register 0x1E bit 6
  4507. *
  4508. *
  4509. *
  4510. *
  4511. * @param v_tap_first_z_u8 :The status of tap first z interrupt
  4512. * value | status
  4513. * -----------|-------------
  4514. * 0 | not triggered
  4515. * 1 | triggered by z axis
  4516. *
  4517. *
  4518. *
  4519. * @return results of bus communication function
  4520. * @retval 0 -> Success
  4521. * @retval -1 -> Error
  4522. *
  4523. *
  4524. */
  4525. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat2_tap_first_z(u8
  4526. *v_tap_first_z_u8);
  4527. /*!
  4528. * @brief This API reads the tap sign status from the
  4529. * register 0x1E bit 7
  4530. *
  4531. *
  4532. *
  4533. *
  4534. * @param v_tap_sign_u8 : The status of tap sign
  4535. * value | sign
  4536. * -----------|-------------
  4537. * 0 | positive
  4538. * 1 | negative
  4539. *
  4540. *
  4541. * @return results of bus communication function
  4542. * @retval 0 -> Success
  4543. * @retval -1 -> Error
  4544. *
  4545. *
  4546. */
  4547. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat2_tap_sign(u8
  4548. *tap_sign);
  4549. /**************************************************/
  4550. /**\name FUNCTIONS FOR HIGH_G FIRST XYZ AND SIGN INTERRUPT STATUS*/
  4551. /*************************************************/
  4552. /*!
  4553. * @brief This API reads the high_g first x status from the
  4554. * register 0x1F bit 0
  4555. *
  4556. *
  4557. *
  4558. *
  4559. * @param v_high_g_first_x_u8 :The status of high_g first x
  4560. * value | status
  4561. * -----------|-------------
  4562. * 0 | not triggered
  4563. * 1 | triggered by x axis
  4564. *
  4565. *
  4566. *
  4567. * @return results of bus communication function
  4568. * @retval 0 -> Success
  4569. * @retval -1 -> Error
  4570. *
  4571. *
  4572. */
  4573. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat3_high_g_first_x(u8
  4574. *v_high_g_first_x_u8);
  4575. /*!
  4576. * @brief This API reads the high_g first y status from the
  4577. * register 0x1F bit 1
  4578. *
  4579. *
  4580. *
  4581. *
  4582. * @param v_high_g_first_y_u8 : The status of high_g first y
  4583. * value | status
  4584. * -----------|-------------
  4585. * 0 | not triggered
  4586. * 1 | triggered by y axis
  4587. *
  4588. *
  4589. *
  4590. * @return results of bus communication function
  4591. * @retval 0 -> Success
  4592. * @retval -1 -> Error
  4593. *
  4594. *
  4595. */
  4596. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat3_high_g_first_y(u8
  4597. *v_high_g_first_y_u8);
  4598. /*!
  4599. * @brief This API reads the high_g first z status from the
  4600. * register 0x1F bit 3
  4601. *
  4602. *
  4603. *
  4604. *
  4605. * @param v_high_g_first_z_u8 : The status of high_g first z
  4606. * value | status
  4607. * -----------|-------------
  4608. * 0 | not triggered
  4609. * 1 | triggered by z axis
  4610. *
  4611. *
  4612. *
  4613. * @return results of bus communication function
  4614. * @retval 0 -> Success
  4615. * @retval -1 -> Error
  4616. *
  4617. *
  4618. */
  4619. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat3_high_g_first_z(u8
  4620. *v_high_g_first_z_u8);
  4621. /*!
  4622. * @brief This API reads the high sign status from the
  4623. * register 0x1F bit 3
  4624. *
  4625. *
  4626. *
  4627. *
  4628. * @param v_high_g_sign_u8 :The status of high sign
  4629. * value | sign
  4630. * -----------|-------------
  4631. * 0 | positive
  4632. * 1 | negative
  4633. *
  4634. *
  4635. *
  4636. * @return results of bus communication function
  4637. * @retval 0 -> Success
  4638. * @retval -1 -> Error
  4639. *
  4640. *
  4641. */
  4642. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat3_high_g_sign(u8
  4643. *v_high_g_sign_u8);
  4644. /**************************************************/
  4645. /**\name FUNCTIONS FOR ORIENT XY AND Z INTERRUPT STATUS*/
  4646. /*************************************************/
  4647. /*!
  4648. * @brief This API reads the status of orient_xy plane
  4649. * from the register 0x1F bit 4 and 5
  4650. *
  4651. *
  4652. * @param v_orient_xy_u8 :The status of orient_xy plane
  4653. * value | status
  4654. * -----------|-------------
  4655. * 0x00 | portrait upright
  4656. * 0x01 | portrait upside down
  4657. * 0x02 | landscape left
  4658. * 0x03 | landscape right
  4659. *
  4660. *
  4661. * @return results of bus communication function
  4662. * @retval 0 -> Success
  4663. * @retval -1 -> Error
  4664. *
  4665. *
  4666. */
  4667. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat3_orient_xy(u8
  4668. *v_orient_xy_u8);
  4669. /*!
  4670. * @brief This API reads the status of orient z plane
  4671. * from the register 0x1F bit 6
  4672. *
  4673. *
  4674. * @param v_orient_z_u8 :The status of orient z
  4675. * value | status
  4676. * -----------|-------------
  4677. * 0x00 | upward looking
  4678. * 0x01 | downward looking
  4679. *
  4680. * @return results of bus communication function
  4681. * @retval 0 -> Success
  4682. * @retval -1 -> Error
  4683. *
  4684. *
  4685. */
  4686. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat3_orient_z(u8
  4687. *v_orient_z_u8);
  4688. /**************************************************/
  4689. /**\name FUNCTIONS FOR FLAT INTERRUPT STATUS*/
  4690. /*************************************************/
  4691. /*!
  4692. * @brief This API reads the flat status from the register
  4693. * 0x1F bit 7
  4694. *
  4695. *
  4696. * @param v_flat_u8 : The status of flat interrupt
  4697. * value | status
  4698. * -----------|-------------
  4699. * 0x00 | non flat
  4700. * 0x01 | flat position
  4701. *
  4702. *
  4703. * @return results of bus communication function
  4704. * @retval 0 -> Success
  4705. * @retval -1 -> Error
  4706. *
  4707. *
  4708. */
  4709. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stat3_flat(u8
  4710. *flat);
  4711. /**************************************************/
  4712. /**\name FUNCTION FOR TEMPERATUE READ */
  4713. /*************************************************/
  4714. /*!
  4715. * @brief This API reads the temperature of the sensor
  4716. * from the register 0x21 bit 0 to 7
  4717. *
  4718. *
  4719. *
  4720. * @param v_temp_s16 : The value of temperature
  4721. *
  4722. *
  4723. *
  4724. * @return results of bus communication function
  4725. * @retval 0 -> Success
  4726. * @retval -1 -> Error
  4727. *
  4728. *
  4729. */
  4730. BMI160_RETURN_FUNCTION_TYPE bmi160_get_temp(s16
  4731. *v_temp_s16);
  4732. /**************************************************/
  4733. /**\name FUNCTION FOR FIFO LENGTH AND FIFO DATA READ */
  4734. /*************************************************/
  4735. /*!
  4736. * @brief This API reads the of the sensor
  4737. * form the register 0x23 and 0x24 bit 0 to 7 and 0 to 2
  4738. * @brief this byte counter is updated each time a complete frame
  4739. * was read or writtern
  4740. *
  4741. *
  4742. * @param v_fifo_length_u32 : The value of fifo byte counter
  4743. *
  4744. *
  4745. * @return results of bus communication function
  4746. * @retval 0 -> Success
  4747. * @retval -1 -> Error
  4748. *
  4749. *
  4750. */
  4751. BMI160_RETURN_FUNCTION_TYPE bmi160_fifo_length(
  4752. u32 *v_fifo_length_u32);
  4753. /*!
  4754. * @brief This API reads the fifo data of the sensor
  4755. * from the register 0x24
  4756. * @brief Data format depends on the setting of register FIFO_CONFIG
  4757. *
  4758. *
  4759. *
  4760. * @param v_fifo_data_u8 : Pointer holding the fifo data
  4761. *
  4762. * @note For reading FIFO data use the following functions
  4763. *
  4764. * @return results of bus communication function
  4765. * @retval 0 -> Success
  4766. * @retval -1 -> Error
  4767. *
  4768. *
  4769. */
  4770. BMI160_RETURN_FUNCTION_TYPE bmi160_fifo_data(
  4771. u8 *v_fifo_data_u8);
  4772. /**************************************************/
  4773. /**\name FUNCTION FOR ACCEL CONFIGURATIONS */
  4774. /*************************************************/
  4775. /*!
  4776. * @brief This API is used to get the
  4777. * accel output date rate form the register 0x40 bit 0 to 3
  4778. *
  4779. *
  4780. * @param v_output_data_rate_u8 :The value of accel output date rate
  4781. * value | output data rate
  4782. * -------|--------------------------
  4783. * 0 | BMI160_ACCEL_OUTPUT_DATA_RATE_RESERVED
  4784. * 1 | BMI160_ACCEL_OUTPUT_DATA_RATE_0_78HZ
  4785. * 2 | BMI160_ACCEL_OUTPUT_DATA_RATE_1_56HZ
  4786. * 3 | BMI160_ACCEL_OUTPUT_DATA_RATE_3_12HZ
  4787. * 4 | BMI160_ACCEL_OUTPUT_DATA_RATE_6_25HZ
  4788. * 5 | BMI160_ACCEL_OUTPUT_DATA_RATE_12_5HZ
  4789. * 6 | BMI160_ACCEL_OUTPUT_DATA_RATE_25HZ
  4790. * 7 | BMI160_ACCEL_OUTPUT_DATA_RATE_50HZ
  4791. * 8 | BMI160_ACCEL_OUTPUT_DATA_RATE_100HZ
  4792. * 9 | BMI160_ACCEL_OUTPUT_DATA_RATE_200HZ
  4793. * 10 | BMI160_ACCEL_OUTPUT_DATA_RATE_400HZ
  4794. * 11 | BMI160_ACCEL_OUTPUT_DATA_RATE_800HZ
  4795. * 12 | BMI160_ACCEL_OUTPUT_DATA_RATE_1600HZ
  4796. *
  4797. *
  4798. * @return results of bus communication function
  4799. * @retval 0 -> Success
  4800. * @retval -1 -> Error
  4801. *
  4802. *
  4803. */
  4804. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_output_data_rate(
  4805. u8 *v_output_data_rate_u8);
  4806. /*!
  4807. * @brief This API is used to set the
  4808. * accel output date rate form the register 0x40 bit 0 to 3
  4809. *
  4810. *
  4811. * @param v_output_data_rate_u8 :The value of accel output date rate
  4812. * value | output data rate
  4813. * -------|--------------------------
  4814. * 0 | BMI160_ACCEL_OUTPUT_DATA_RATE_RESERVED
  4815. * 1 | BMI160_ACCEL_OUTPUT_DATA_RATE_0_78HZ
  4816. * 2 | BMI160_ACCEL_OUTPUT_DATA_RATE_1_56HZ
  4817. * 3 | BMI160_ACCEL_OUTPUT_DATA_RATE_3_12HZ
  4818. * 4 | BMI160_ACCEL_OUTPUT_DATA_RATE_6_25HZ
  4819. * 5 | BMI160_ACCEL_OUTPUT_DATA_RATE_12_5HZ
  4820. * 6 | BMI160_ACCEL_OUTPUT_DATA_RATE_25HZ
  4821. * 7 | BMI160_ACCEL_OUTPUT_DATA_RATE_50HZ
  4822. * 8 | BMI160_ACCEL_OUTPUT_DATA_RATE_100HZ
  4823. * 9 | BMI160_ACCEL_OUTPUT_DATA_RATE_200HZ
  4824. * 10 | BMI160_ACCEL_OUTPUT_DATA_RATE_400HZ
  4825. * 11 | BMI160_ACCEL_OUTPUT_DATA_RATE_800HZ
  4826. * 12 | BMI160_ACCEL_OUTPUT_DATA_RATE_1600HZ
  4827. *
  4828. *
  4829. * @return results of bus communication function
  4830. * @retval 0 -> Success
  4831. * @retval -1 -> Error
  4832. *
  4833. *
  4834. */
  4835. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_output_data_rate(u8 odr);
  4836. /*!
  4837. * @brief This API is used to get the
  4838. * accel bandwidth from the register 0x40 bit 4 to 6
  4839. * @brief bandwidth parameter determines filter configuration(acc_us=0)
  4840. * and averaging for under sampling mode(acc_us=1)
  4841. *
  4842. *
  4843. * @param v_bw_u8 : The value of accel bandwidth
  4844. *
  4845. * @note accel bandwidth depends on under sampling parameter
  4846. * @note under sampling parameter cab be set by the function
  4847. * "BMI160_SET_ACCEL_UNDER_SAMPLING_PARAMETER"
  4848. *
  4849. * @note Filter configuration
  4850. * accel_us | Filter configuration
  4851. * -----------|---------------------
  4852. * 0x00 | OSR4 mode
  4853. * 0x01 | OSR2 mode
  4854. * 0x02 | normal mode
  4855. * 0x03 | CIC mode
  4856. * 0x04 | Reserved
  4857. * 0x05 | Reserved
  4858. * 0x06 | Reserved
  4859. * 0x07 | Reserved
  4860. *
  4861. * @note accel under sampling mode
  4862. * accel_us | Under sampling mode
  4863. * -----------|---------------------
  4864. * 0x00 | no averaging
  4865. * 0x01 | average 2 samples
  4866. * 0x02 | average 4 samples
  4867. * 0x03 | average 8 samples
  4868. * 0x04 | average 16 samples
  4869. * 0x05 | average 32 samples
  4870. * 0x06 | average 64 samples
  4871. * 0x07 | average 128 samples
  4872. *
  4873. *
  4874. *
  4875. * @return results of bus communication function
  4876. * @retval 0 -> Success
  4877. * @retval -1 -> Error
  4878. *
  4879. *
  4880. */
  4881. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_bw(u8 *v_bw_u8);
  4882. /*!
  4883. * @brief This API is used to set the
  4884. * accel bandwidth from the register 0x40 bit 4 to 6
  4885. * @brief bandwidth parameter determines filter configuration(acc_us=0)
  4886. * and averaging for under sampling mode(acc_us=1)
  4887. *
  4888. *
  4889. * @param v_bw_u8 : The value of accel bandwidth
  4890. *
  4891. * @note accel bandwidth depends on under sampling parameter
  4892. * @note under sampling parameter cab be set by the function
  4893. * "BMI160_SET_ACCEL_UNDER_SAMPLING_PARAMETER"
  4894. *
  4895. * @note Filter configuration
  4896. * accel_us | Filter configuration
  4897. * -----------|---------------------
  4898. * 0x00 | OSR4 mode
  4899. * 0x01 | OSR2 mode
  4900. * 0x02 | normal mode
  4901. * 0x03 | CIC mode
  4902. * 0x04 | Reserved
  4903. * 0x05 | Reserved
  4904. * 0x06 | Reserved
  4905. * 0x07 | Reserved
  4906. *
  4907. * @note accel under sampling mode
  4908. * accel_us | Under sampling mode
  4909. * -----------|---------------------
  4910. * 0x00 | no averaging
  4911. * 0x01 | average 2 samples
  4912. * 0x02 | average 4 samples
  4913. * 0x03 | average 8 samples
  4914. * 0x04 | average 16 samples
  4915. * 0x05 | average 32 samples
  4916. * 0x06 | average 64 samples
  4917. * 0x07 | average 128 samples
  4918. *
  4919. *
  4920. *
  4921. * @return results of bus communication function
  4922. * @retval 0 -> Success
  4923. * @retval -1 -> Error
  4924. *
  4925. *
  4926. */
  4927. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_bw(u8 v_bw_u8);
  4928. /*!
  4929. * @brief This API is used to get the accel
  4930. * under sampling parameter form the register 0x40 bit 7
  4931. *
  4932. *
  4933. *
  4934. *
  4935. * @param v_accel_under_sampling_u8 : The value of accel under sampling
  4936. * value | under_sampling
  4937. * ----------|---------------
  4938. * 0x01 | BMI160_ENABLE
  4939. * 0x00 | BMI160_DISABLE
  4940. *
  4941. *
  4942. *
  4943. * @return results of bus communication function
  4944. * @retval 0 -> Success
  4945. * @retval -1 -> Error
  4946. *
  4947. *
  4948. */
  4949. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_under_sampling_parameter(
  4950. u8 *v_accel_under_sampling_u8);
  4951. /*!
  4952. * @brief This API is used to set the accel
  4953. * under sampling parameter form the register 0x40 bit 7
  4954. *
  4955. *
  4956. *
  4957. *
  4958. * @param v_accel_under_sampling_u8 : The value of accel under sampling
  4959. * value | under_sampling
  4960. * ----------|---------------
  4961. * 0x01 | BMI160_ENABLE
  4962. * 0x00 | BMI160_DISABLE
  4963. *
  4964. *
  4965. *
  4966. * @return results of bus communication function
  4967. * @retval 0 -> Success
  4968. * @retval -1 -> Error
  4969. *
  4970. *
  4971. */
  4972. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_under_sampling_parameter(
  4973. u8 v_accel_under_sampling_u8);
  4974. /*!
  4975. * @brief This API is used to get the ranges
  4976. * (g values) of the accel from the register 0x41 bit 0 to 3
  4977. *
  4978. *
  4979. *
  4980. *
  4981. * @param v_range_u8 : The value of accel g range
  4982. * value | g_range
  4983. * ----------|-----------
  4984. * 0x03 | BMI160_ACCEL_RANGE_2G
  4985. * 0x05 | BMI160_ACCEL_RANGE_4G
  4986. * 0x08 | BMI160_ACCEL_RANGE_8G
  4987. * 0x0C | BMI160_ACCEL_RANGE_16G
  4988. *
  4989. *
  4990. *
  4991. * @return results of bus communication function
  4992. * @retval 0 -> Success
  4993. * @retval -1 -> Error
  4994. *
  4995. *
  4996. */
  4997. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_range(
  4998. u8 *v_range_u8);
  4999. /*!
  5000. * @brief This API is used to set the ranges
  5001. * (g values) of the accel from the register 0x41 bit 0 to 3
  5002. *
  5003. *
  5004. *
  5005. *
  5006. * @param v_range_u8 : The value of accel g range
  5007. * value | g_range
  5008. * ----------|-----------
  5009. * 0x03 | BMI160_ACCEL_RANGE_2G
  5010. * 0x05 | BMI160_ACCEL_RANGE_4G
  5011. * 0x08 | BMI160_ACCEL_RANGE_8G
  5012. * 0x0C | BMI160_ACCEL_RANGE_16G
  5013. *
  5014. *
  5015. *
  5016. * @return results of bus communication function
  5017. * @retval 0 -> Success
  5018. * @retval -1 -> Error
  5019. *
  5020. *
  5021. */
  5022. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_range(
  5023. u8 v_range_u8);
  5024. /**************************************************/
  5025. /**\name FUNCTION FOR GYRO CONFIGURATIONS */
  5026. /*************************************************/
  5027. /*!
  5028. * @brief This API is used to get the
  5029. * gyroscope output data rate from the register 0x42 bit 0 to 3
  5030. *
  5031. *
  5032. *
  5033. *
  5034. * @param v_output_data_rate_u8 :The value of gyro output data rate
  5035. * value | gyro output data rate
  5036. * -----------|-----------------------------
  5037. * 0x00 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5038. * 0x01 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5039. * 0x02 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5040. * 0x03 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5041. * 0x04 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5042. * 0x05 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5043. * 0x06 | BMI160_GYRO_OUTPUT_DATA_RATE_25HZ
  5044. * 0x07 | BMI160_GYRO_OUTPUT_DATA_RATE_50HZ
  5045. * 0x08 | BMI160_GYRO_OUTPUT_DATA_RATE_100HZ
  5046. * 0x09 | BMI160_GYRO_OUTPUT_DATA_RATE_200HZ
  5047. * 0x0A | BMI160_GYRO_OUTPUT_DATA_RATE_400HZ
  5048. * 0x0B | BMI160_GYRO_OUTPUT_DATA_RATE_800HZ
  5049. * 0x0C | BMI160_GYRO_OUTPUT_DATA_RATE_1600HZ
  5050. * 0x0D | BMI160_GYRO_OUTPUT_DATA_RATE_3200HZ
  5051. * 0x0E | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5052. * 0x0F | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5053. *
  5054. * @return results of bus communication function
  5055. * @retval 0 -> Success
  5056. * @retval -1 -> Error
  5057. *
  5058. *
  5059. */
  5060. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_output_data_rate(
  5061. u8 *gyro_output_typer);
  5062. /*!
  5063. * @brief This API is used to set the
  5064. * gyroscope output data rate from the register 0x42 bit 0 to 3
  5065. *
  5066. *
  5067. *
  5068. *
  5069. * @param v_output_data_rate_u8 :The value of gyro output data rate
  5070. * value | gyro output data rate
  5071. * -----------|-----------------------------
  5072. * 0x00 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5073. * 0x01 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5074. * 0x02 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5075. * 0x03 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5076. * 0x04 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5077. * 0x05 | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5078. * 0x06 | BMI160_GYRO_OUTPUT_DATA_RATE_25HZ
  5079. * 0x07 | BMI160_GYRO_OUTPUT_DATA_RATE_50HZ
  5080. * 0x08 | BMI160_GYRO_OUTPUT_DATA_RATE_100HZ
  5081. * 0x09 | BMI160_GYRO_OUTPUT_DATA_RATE_200HZ
  5082. * 0x0A | BMI160_GYRO_OUTPUT_DATA_RATE_400HZ
  5083. * 0x0B | BMI160_GYRO_OUTPUT_DATA_RATE_800HZ
  5084. * 0x0C | BMI160_GYRO_OUTPUT_DATA_RATE_1600HZ
  5085. * 0x0D | BMI160_GYRO_OUTPUT_DATA_RATE_3200HZ
  5086. * 0x0E | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5087. * 0x0F | BMI160_GYRO_OUTPUT_DATA_RATE_RESERVED
  5088. *
  5089. * @return results of bus communication function
  5090. * @retval 0 -> Success
  5091. * @retval -1 -> Error
  5092. *
  5093. *
  5094. */
  5095. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_output_data_rate(
  5096. u8 gyro_output_typer);
  5097. /*!
  5098. * @brief This API is used to get the
  5099. * data of gyro from the register 0x42 bit 4 to 5
  5100. *
  5101. *
  5102. *
  5103. *
  5104. * @param v_bw_u8 : The value of gyro bandwidth
  5105. * value | gyro bandwidth
  5106. * ----------|----------------
  5107. * 0x00 | BMI160_GYRO_OSR4_MODE
  5108. * 0x01 | BMI160_GYRO_OSR2_MODE
  5109. * 0x02 | BMI160_GYRO_NORMAL_MODE
  5110. * 0x03 | BMI160_GYRO_CIC_MODE
  5111. *
  5112. *
  5113. * @return results of bus communication function
  5114. * @retval 0 -> Success
  5115. * @retval -1 -> Error
  5116. *
  5117. *
  5118. */
  5119. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_bw(u8 *v_bw_u8);
  5120. /*!
  5121. * @brief This API is used to set the
  5122. * data of gyro from the register 0x42 bit 4 to 5
  5123. *
  5124. *
  5125. *
  5126. *
  5127. * @param v_bw_u8 : The value of gyro bandwidth
  5128. * value | gyro bandwidth
  5129. * ----------|----------------
  5130. * 0x00 | BMI160_GYRO_OSR4_MODE
  5131. * 0x01 | BMI160_GYRO_OSR2_MODE
  5132. * 0x02 | BMI160_GYRO_NORMAL_MODE
  5133. * 0x03 | BMI160_GYRO_CIC_MODE
  5134. *
  5135. *
  5136. * @return results of bus communication function
  5137. * @retval 0 -> Success
  5138. * @retval -1 -> Error
  5139. *
  5140. *
  5141. */
  5142. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_bw(u8 v_bw_u8);
  5143. /*!
  5144. * @brief This API reads the range
  5145. * of gyro from the register 0x43 bit 0 to 2
  5146. *
  5147. * @param v_range_u8 : The value of gyro range
  5148. * value | range
  5149. * ----------|-------------------------------
  5150. * 0x00 | BMI160_GYRO_RANGE_2000_DEG_SEC
  5151. * 0x01 | BMI160_GYRO_RANGE_1000_DEG_SEC
  5152. * 0x02 | BMI160_GYRO_RANGE_500_DEG_SEC
  5153. * 0x03 | BMI160_GYRO_RANGE_250_DEG_SEC
  5154. * 0x04 | BMI160_GYRO_RANGE_125_DEG_SEC
  5155. *
  5156. * @return results of bus communication function
  5157. * @retval 0 -> Success
  5158. * @retval -1 -> Error
  5159. *
  5160. *
  5161. */
  5162. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_range(
  5163. u8 *v_range_u8);
  5164. /*!
  5165. * @brief This API set the range
  5166. * of gyro from the register 0x43 bit 0 to 2
  5167. *
  5168. * @param v_range_u8 : The value of gyro range
  5169. * value | range
  5170. * ----------|-------------------------------
  5171. * 0x00 | BMI160_GYRO_RANGE_2000_DEG_SEC
  5172. * 0x01 | BMI160_GYRO_RANGE_1000_DEG_SEC
  5173. * 0x02 | BMI160_GYRO_RANGE_500_DEG_SEC
  5174. * 0x03 | BMI160_GYRO_RANGE_250_DEG_SEC
  5175. * 0x04 | BMI160_GYRO_RANGE_125_DEG_SEC
  5176. *
  5177. * @return results of bus communication function
  5178. * @retval 0 -> Success
  5179. * @retval -1 -> Error
  5180. *
  5181. *
  5182. */
  5183. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_range(
  5184. u8 v_range_u8);
  5185. /**************************************************/
  5186. /**\name FUNCTION FOR MAG CONFIGURATIONS */
  5187. /*************************************************/
  5188. /*!
  5189. * @brief This API is used to get the
  5190. * output data rate of magnetometer from the register 0x44 bit 0 to 3
  5191. *
  5192. *
  5193. *
  5194. *
  5195. * @param v_output_data_rat_u8e : The value of mag output data rate
  5196. * value | mag output data rate
  5197. * ---------|---------------------------
  5198. * 0x00 |BMI160_MAG_OUTPUT_DATA_RATE_RESERVED
  5199. * 0x01 |BMI160_MAG_OUTPUT_DATA_RATE_0_78HZ
  5200. * 0x02 |BMI160_MAG_OUTPUT_DATA_RATE_1_56HZ
  5201. * 0x03 |BMI160_MAG_OUTPUT_DATA_RATE_3_12HZ
  5202. * 0x04 |BMI160_MAG_OUTPUT_DATA_RATE_6_25HZ
  5203. * 0x05 |BMI160_MAG_OUTPUT_DATA_RATE_12_5HZ
  5204. * 0x06 |BMI160_MAG_OUTPUT_DATA_RATE_25HZ
  5205. * 0x07 |BMI160_MAG_OUTPUT_DATA_RATE_50HZ
  5206. * 0x08 |BMI160_MAG_OUTPUT_DATA_RATE_100HZ
  5207. * 0x09 |BMI160_MAG_OUTPUT_DATA_RATE_200HZ
  5208. * 0x0A |BMI160_MAG_OUTPUT_DATA_RATE_400HZ
  5209. * 0x0B |BMI160_MAG_OUTPUT_DATA_RATE_800HZ
  5210. * 0x0C |BMI160_MAG_OUTPUT_DATA_RATE_1600HZ
  5211. * 0x0D |BMI160_MAG_OUTPUT_DATA_RATE_RESERVED0
  5212. * 0x0E |BMI160_MAG_OUTPUT_DATA_RATE_RESERVED1
  5213. * 0x0F |BMI160_MAG_OUTPUT_DATA_RATE_RESERVED2
  5214. *
  5215. *
  5216. *
  5217. * @return results of bus communication function
  5218. * @retval 0 -> Success
  5219. * @retval -1 -> Error
  5220. *
  5221. *
  5222. */
  5223. BMI160_RETURN_FUNCTION_TYPE bmi160_get_mag_output_data_rate(u8 *odr);
  5224. /*!
  5225. * @brief This API is used to set the
  5226. * output data rate of magnetometer from the register 0x44 bit 0 to 3
  5227. *
  5228. *
  5229. *
  5230. *
  5231. * @param v_output_data_rat_u8e : The value of mag output data rate
  5232. * value | mag output data rate
  5233. * ---------|---------------------------
  5234. * 0x00 |BMI160_MAG_OUTPUT_DATA_RATE_RESERVED
  5235. * 0x01 |BMI160_MAG_OUTPUT_DATA_RATE_0_78HZ
  5236. * 0x02 |BMI160_MAG_OUTPUT_DATA_RATE_1_56HZ
  5237. * 0x03 |BMI160_MAG_OUTPUT_DATA_RATE_3_12HZ
  5238. * 0x04 |BMI160_MAG_OUTPUT_DATA_RATE_6_25HZ
  5239. * 0x05 |BMI160_MAG_OUTPUT_DATA_RATE_12_5HZ
  5240. * 0x06 |BMI160_MAG_OUTPUT_DATA_RATE_25HZ
  5241. * 0x07 |BMI160_MAG_OUTPUT_DATA_RATE_50HZ
  5242. * 0x08 |BMI160_MAG_OUTPUT_DATA_RATE_100HZ
  5243. * 0x09 |BMI160_MAG_OUTPUT_DATA_RATE_200HZ
  5244. * 0x0A |BMI160_MAG_OUTPUT_DATA_RATE_400HZ
  5245. * 0x0B |BMI160_MAG_OUTPUT_DATA_RATE_800HZ
  5246. * 0x0C |BMI160_MAG_OUTPUT_DATA_RATE_1600HZ
  5247. * 0x0D |BMI160_MAG_OUTPUT_DATA_RATE_RESERVED0
  5248. * 0x0E |BMI160_MAG_OUTPUT_DATA_RATE_RESERVED1
  5249. * 0x0F |BMI160_MAG_OUTPUT_DATA_RATE_RESERVED2
  5250. *
  5251. *
  5252. *
  5253. * @return results of bus communication function
  5254. * @retval 0 -> Success
  5255. * @retval -1 -> Error
  5256. *
  5257. *
  5258. */
  5259. BMI160_RETURN_FUNCTION_TYPE bmi160_set_mag_output_data_rate(u8 odr);
  5260. /**************************************************/
  5261. /**\name FUNCTION FOR FIFO CONFIGURATIONS */
  5262. /*************************************************/
  5263. /*!
  5264. * @brief This API is used to read Down sampling
  5265. * for gyro (2**downs_gyro) in the register 0x45 bit 0 to 2
  5266. *
  5267. *
  5268. *
  5269. *
  5270. * @param v_fifo_down_gyro_u8 :The value of gyro fifo down
  5271. *
  5272. *
  5273. * @return results of bus communication function
  5274. * @retval 0 -> Success
  5275. * @retval -1 -> Error
  5276. *
  5277. *
  5278. */
  5279. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fifo_down_gyro(
  5280. u8 *v_fifo_down_gyro_u8);
  5281. /*!
  5282. * @brief This API is used to set Down sampling
  5283. * for gyro (2**downs_gyro) in the register 0x45 bit 0 to 2
  5284. *
  5285. *
  5286. *
  5287. *
  5288. * @param v_fifo_down_gyro_u8 :The value of gyro fifo down
  5289. *
  5290. *
  5291. * @return results of bus communication function
  5292. * @retval 0 -> Success
  5293. * @retval -1 -> Error
  5294. *
  5295. *
  5296. */
  5297. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_down_gyro(
  5298. u8 v_fifo_down_gyro_u8);
  5299. /*!
  5300. * @brief This API is used to read gyro fifo filter data
  5301. * from the register 0x45 bit 3
  5302. *
  5303. *
  5304. *
  5305. * @param v_gyro_fifo_filter_data_u8 :The value of gyro filter data
  5306. * value | gyro_fifo_filter_data
  5307. * ------------|-------------------------
  5308. * 0x00 | Unfiltered data
  5309. * 0x01 | Filtered data
  5310. *
  5311. * @return results of bus communication function
  5312. * @retval 0 -> Success
  5313. * @retval -1 -> Error
  5314. *
  5315. *
  5316. */
  5317. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_fifo_filter_data(
  5318. u8 *v_gyro_fifo_filter_data_u8);
  5319. /*!
  5320. * @brief This API is used to set gyro fifo filter data
  5321. * from the register 0x45 bit 3
  5322. *
  5323. *
  5324. *
  5325. * @param v_gyro_fifo_filter_data_u8 :The value of gyro filter data
  5326. * value | gyro_fifo_filter_data
  5327. * ------------|-------------------------
  5328. * 0x00 | Unfiltered data
  5329. * 0x01 | Filtered data
  5330. *
  5331. * @return results of bus communication function
  5332. * @retval 0 -> Success
  5333. * @retval -1 -> Error
  5334. *
  5335. *
  5336. */
  5337. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_fifo_filter_data(
  5338. u8 v_gyro_fifo_filter_data_u8);
  5339. /*!
  5340. * @brief This API is used to read Down sampling
  5341. * for accel (2*downs_accel) from the register 0x45 bit 4 to 6
  5342. *
  5343. *
  5344. *
  5345. *
  5346. * @param v_fifo_down_u8 :The value of accel fifo down
  5347. *
  5348. *
  5349. *
  5350. * @return results of bus communication function
  5351. * @retval 0 -> Success
  5352. * @retval -1 -> Error
  5353. *
  5354. *
  5355. */
  5356. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fifo_down_accel(
  5357. u8 *v_fifo_down_u8);
  5358. /*!
  5359. * @brief This API is used to set Down sampling
  5360. * for accel (2*downs_accel) from the register 0x45 bit 4 to 6
  5361. *
  5362. *
  5363. *
  5364. *
  5365. * @param v_fifo_down_u8 :The value of accel fifo down
  5366. *
  5367. *
  5368. *
  5369. * @return results of bus communication function
  5370. * @retval 0 -> Success
  5371. * @retval -1 -> Error
  5372. *
  5373. *
  5374. */
  5375. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_down_accel(
  5376. u8 v_fifo_down_u8);
  5377. /*!
  5378. * @brief This API is used to read accel fifo filter data
  5379. * from the register 0x45 bit 7
  5380. *
  5381. *
  5382. *
  5383. * @param v_accel_fifo_filter_u8 :The value of accel filter data
  5384. * value | accel_fifo_filter_data
  5385. * ------------|-------------------------
  5386. * 0x00 | Unfiltered data
  5387. * 0x01 | Filtered data
  5388. *
  5389. *
  5390. * @return results of bus communication function
  5391. * @retval 0 -> Success
  5392. * @retval -1 -> Error
  5393. *
  5394. *
  5395. */
  5396. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_fifo_filter_data(
  5397. u8 *v_accel_fifo_filter_u8);
  5398. /*!
  5399. * @brief This API is used to set accel fifo filter data
  5400. * from the register 0x45 bit 7
  5401. *
  5402. *
  5403. *
  5404. * @param v_accel_fifo_filter_u8 :The value of accel filter data
  5405. * value | accel_fifo_filter_data
  5406. * ------------|-------------------------
  5407. * 0x00 | Unfiltered data
  5408. * 0x01 | Filtered data
  5409. *
  5410. *
  5411. * @return results of bus communication function
  5412. * @retval 0 -> Success
  5413. * @retval -1 -> Error
  5414. *
  5415. *
  5416. */
  5417. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_fifo_filter_data(
  5418. u8 v_accel_fifo_filter_u8);
  5419. /**************************************************/
  5420. /**\name FUNCTION FOR FIFO WATER MARK ENABLE */
  5421. /*************************************************/
  5422. /*!
  5423. * @brief This API is used to Trigger an interrupt
  5424. * when FIFO contains water mark level from the register 0x46 bit 0 to 7
  5425. *
  5426. *
  5427. *
  5428. * @param v_fifo_wm_u8 : The value of fifo water mark level
  5429. *
  5430. *
  5431. *
  5432. * @return results of bus communication function
  5433. * @retval 0 -> Success
  5434. * @retval -1 -> Error
  5435. *
  5436. *
  5437. */
  5438. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fifo_wm(
  5439. u8 *v_fifo_wm_u8);
  5440. /*!
  5441. * @brief This API is used to Trigger an interrupt
  5442. * when FIFO contains water mark level from the register 0x46 bit 0 to 7
  5443. *
  5444. *
  5445. *
  5446. * @param v_fifo_wm_u8 : The value of fifo water mark level
  5447. *
  5448. *
  5449. *
  5450. * @return results of bus communication function
  5451. * @retval 0 -> Success
  5452. * @retval -1 -> Error
  5453. *
  5454. *
  5455. */
  5456. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_wm(
  5457. u8 v_fifo_wm_u8);
  5458. /**************************************************/
  5459. /**\name FUNCTION FOR FIFO CONFIGURATIONS */
  5460. /*************************************************/
  5461. /*!
  5462. * @brief This API reads the fifo stop on full in the register 0x47 bit 0
  5463. * @brief It stop writing samples into FIFO when FIFO is full
  5464. *
  5465. *
  5466. *
  5467. * @param v_fifo_stop_on_full_u8 :The value of fifo stop on full
  5468. * value | fifo stop on full
  5469. * ------------|-------------------------
  5470. * 0x00 | do not stop writing to FIFO when full
  5471. * 0x01 | Stop writing into FIFO when full.
  5472. *
  5473. * @return results of bus communication function
  5474. * @retval 0 -> Success
  5475. * @retval -1 -> Error
  5476. *
  5477. *
  5478. */
  5479. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fifo_stop_on_full(
  5480. u8 *v_fifo_stop_on_full_u8);
  5481. /*!
  5482. * @brief This API sey the fifo stop on full in the register 0x47 bit 0
  5483. * @brief It stop writing samples into FIFO when FIFO is full
  5484. *
  5485. *
  5486. *
  5487. * @param v_fifo_stop_on_full_u8 :The value of fifo stop on full
  5488. * value | fifo stop on full
  5489. * ------------|-------------------------
  5490. * 0x00 | do not stop writing to FIFO when full
  5491. * 0x01 | Stop writing into FIFO when full.
  5492. *
  5493. * @return results of bus communication function
  5494. * @retval 0 -> Success
  5495. * @retval -1 -> Error
  5496. *
  5497. *
  5498. */
  5499. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_stop_on_full(
  5500. u8 v_fifo_stop_on_full_u8);
  5501. /*!
  5502. * @brief This API reads fifo sensor time
  5503. * frame after the last valid data frame form the register 0x47 bit 1
  5504. *
  5505. *
  5506. *
  5507. *
  5508. * @param v_fifo_time_enable_u8 : The value of sensor time
  5509. * value | fifo sensor time
  5510. * ------------|-------------------------
  5511. * 0x00 | do not return sensortime frame
  5512. * 0x01 | return sensortime frame
  5513. *
  5514. * @return results of bus communication function
  5515. * @retval 0 -> Success
  5516. * @retval -1 -> Error
  5517. *
  5518. *
  5519. */
  5520. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fifo_time_enable(
  5521. u8 *v_fifo_time_enable_u8);
  5522. /*!
  5523. * @brief This API set fifo sensor time
  5524. * frame after the last valid data frame form the register 0x47 bit 1
  5525. *
  5526. *
  5527. *
  5528. *
  5529. * @param v_fifo_time_enable_u8 : The value of sensor time
  5530. * value | fifo sensor time
  5531. * ------------|-------------------------
  5532. * 0x00 | do not return sensortime frame
  5533. * 0x01 | return sensortime frame
  5534. *
  5535. * @return results of bus communication function
  5536. * @retval 0 -> Success
  5537. * @retval -1 -> Error
  5538. *
  5539. *
  5540. */
  5541. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_time_enable(
  5542. u8 v_fifo_time_enable_u8);
  5543. /*!
  5544. * @brief This API reads FIFO tag interrupt2 enable status
  5545. * from the resister 0x47 bit 2
  5546. *
  5547. * @param v_fifo_tag_intr2_u8 : The value of fifo tag interrupt
  5548. * value | fifo tag interrupt
  5549. * ----------|-------------------
  5550. * 0x01 | BMI160_ENABLE
  5551. * 0x00 | BMI160_DISABLE
  5552. *
  5553. *
  5554. *
  5555. *
  5556. * @return results of bus communication function
  5557. * @retval 0 -> Success
  5558. * @retval -1 -> Error
  5559. *
  5560. *
  5561. */
  5562. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fifo_tag_intr2_enable(
  5563. u8 *v_fifo_tag_intr2_u8);
  5564. /*!
  5565. * @brief This API set FIFO tag interrupt2 enable status
  5566. * from the resister 0x47 bit 2
  5567. *
  5568. * @param v_fifo_tag_intr2_u8 : The value of fifo tag interrupt
  5569. * value | fifo tag interrupt
  5570. * ----------|-------------------
  5571. * 0x01 | BMI160_ENABLE
  5572. * 0x00 | BMI160_DISABLE
  5573. *
  5574. *
  5575. *
  5576. *
  5577. * @return results of bus communication function
  5578. * @retval 0 -> Success
  5579. * @retval -1 -> Error
  5580. *
  5581. *
  5582. */
  5583. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_tag_intr2_enable(
  5584. u8 v_fifo_tag_intr2_u8);
  5585. /*!
  5586. * @brief This API get FIFO tag interrupt1 enable status
  5587. * from the resister 0x47 bit 3
  5588. *
  5589. * @param v_fifo_tag_intr1_u8 :The value of fifo tag interrupt1
  5590. * value | fifo tag interrupt
  5591. * ----------|-------------------
  5592. * 0x01 | BMI160_ENABLE
  5593. * 0x00 | BMI160_DISABLE
  5594. *
  5595. * @return results of bus communication function
  5596. * @retval 0 -> Success
  5597. * @retval -1 -> Error
  5598. *
  5599. *
  5600. */
  5601. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fifo_tag_intr1_enable(
  5602. u8 *v_fifo_tag_intr1_u8);
  5603. /*!
  5604. * @brief This API set FIFO tag interrupt1 enable status
  5605. * from the resister 0x47 bit 3
  5606. *
  5607. * @param v_fifo_tag_intr1_u8 :The value of fifo tag interrupt1
  5608. * value | fifo tag interrupt
  5609. * ----------|-------------------
  5610. * 0x01 | BMI160_ENABLE
  5611. * 0x00 | BMI160_DISABLE
  5612. *
  5613. * @return results of bus communication function
  5614. * @retval 0 -> Success
  5615. * @retval -1 -> Error
  5616. *
  5617. *
  5618. */
  5619. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_tag_intr1_enable(
  5620. u8 v_fifo_tag_intr1_u8);
  5621. /*!
  5622. * @brief This API reads FIFO frame
  5623. * header enable from the register 0x47 bit 4
  5624. *
  5625. * @param v_fifo_header_u8 :The value of fifo header
  5626. * value | fifo header
  5627. * ----------|-------------------
  5628. * 0x01 | BMI160_ENABLE
  5629. * 0x00 | BMI160_DISABLE
  5630. *
  5631. * @return results of bus communication function
  5632. * @retval 0 -> Success
  5633. * @retval -1 -> Error
  5634. *
  5635. *
  5636. */
  5637. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fifo_header_enable(
  5638. u8 *v_fifo_header_u8);
  5639. /*!
  5640. * @brief This API set FIFO frame
  5641. * header enable from the register 0x47 bit 4
  5642. *
  5643. * @param v_fifo_header_u8 :The value of fifo header
  5644. * value | fifo header
  5645. * ----------|-------------------
  5646. * 0x01 | BMI160_ENABLE
  5647. * 0x00 | BMI160_DISABLE
  5648. *
  5649. * @return results of bus communication function
  5650. * @retval 0 -> Success
  5651. * @retval -1 -> Error
  5652. *
  5653. *
  5654. */
  5655. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_header_enable(
  5656. u8 v_fifo_header_u8);
  5657. /*!
  5658. * @brief This API is used to read stored
  5659. * magnetometer data in FIFO (all 3 axes) from the register 0x47 bit 5
  5660. *
  5661. * @param v_fifo_mag_u8 : The value of fifo mag enble
  5662. * value | fifo mag
  5663. * ----------|-------------------
  5664. * 0x00 | no magnetometer data is stored
  5665. * 0x01 | magnetometer data is stored
  5666. *
  5667. * @return results of bus communication function
  5668. * @retval 0 -> Success
  5669. * @retval -1 -> Error
  5670. *
  5671. *
  5672. */
  5673. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fifo_mag_enable(
  5674. u8 *v_fifo_mag_u8);
  5675. /*!
  5676. * @brief This API is used to set stored
  5677. * magnetometer data in FIFO (all 3 axes) from the register 0x47 bit 5
  5678. *
  5679. * @param v_fifo_mag_u8 : The value of fifo mag enble
  5680. * value | fifo mag
  5681. * ----------|-------------------
  5682. * 0x00 | no magnetometer data is stored
  5683. * 0x01 | magnetometer data is stored
  5684. *
  5685. * @return results of bus communication function
  5686. * @retval 0 -> Success
  5687. * @retval -1 -> Error
  5688. *
  5689. *
  5690. */
  5691. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_mag_enable(
  5692. u8 v_fifo_mag_u8);
  5693. /*!
  5694. * @brief This API is used to read stored
  5695. * accel data in FIFO (all 3 axes) from the register 0x47 bit 6
  5696. *
  5697. * @param v_fifo_accel_u8 : The value of fifo accel enble
  5698. * value | fifo accel
  5699. * ----------|-------------------
  5700. * 0x00 | no accel data is stored
  5701. * 0x01 | accel data is stored
  5702. *
  5703. *
  5704. *
  5705. * @return results of bus communication function
  5706. * @retval 0 -> Success
  5707. * @retval -1 -> Error
  5708. *
  5709. *
  5710. */
  5711. BMI160_RETURN_FUNCTION_TYPE bmi160_get_fifo_accel_enable(
  5712. u8 *v_fifo_accel_u8);
  5713. /*!
  5714. * @brief This API is used to set stored
  5715. * accel data in FIFO (all 3 axes) from the register 0x47 bit 6
  5716. *
  5717. * @param v_fifo_accel_u8 : The value of fifo accel enble
  5718. * value | fifo accel
  5719. * ----------|-------------------
  5720. * 0x00 | no accel data is stored
  5721. * 0x01 | accel data is stored
  5722. *
  5723. *
  5724. *
  5725. * @return results of bus communication function
  5726. * @retval 0 -> Success
  5727. * @retval -1 -> Error
  5728. *
  5729. *
  5730. */
  5731. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_accel_enable(
  5732. u8 v_fifo_accel_u8);
  5733. /*!
  5734. * @brief This API is used to read stored
  5735. * gyro data in FIFO (all 3 axes) from the resister 0x47 bit 7
  5736. *
  5737. *
  5738. * @param v_fifo_gyro_u8 : The value of fifo gyro enble
  5739. * value | fifo gyro
  5740. * ----------|-------------------
  5741. * 0x00 | no gyro data is stored
  5742. * 0x01 | gyro data is stored
  5743. *
  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_get_fifo_gyro_enable(
  5752. u8 *v_fifo_gyro_u8);
  5753. /*!
  5754. * @brief This API is used to set stored
  5755. * gyro data in FIFO (all 3 axes) from the resister 0x47 bit 7
  5756. *
  5757. *
  5758. * @param v_fifo_gyro_u8 : The value of fifo gyro enble
  5759. * value | fifo gyro
  5760. * ----------|-------------------
  5761. * 0x00 | no gyro data is stored
  5762. * 0x01 | gyro data is stored
  5763. *
  5764. *
  5765. * @return results of bus communication function
  5766. * @retval 0 -> Success
  5767. * @retval -1 -> Error
  5768. *
  5769. *
  5770. */
  5771. BMI160_RETURN_FUNCTION_TYPE bmi160_set_fifo_gyro_enable(
  5772. u8 v_fifo_gyro_u8);
  5773. /***************************************************************/
  5774. /**\name FUNCTION FOR MAG I2C ADDRESS SELECTION */
  5775. /***************************************************************/
  5776. /*!
  5777. * @brief This API is used to read
  5778. * I2C device address of auxiliary mag from the register 0x4B bit 1 to 7
  5779. *
  5780. *
  5781. *
  5782. *
  5783. * @param v_i2c_device_addr_u8 : The value of mag I2C device address
  5784. *
  5785. *
  5786. * @return results of bus communication function
  5787. * @retval 0 -> Success
  5788. * @retval -1 -> Error
  5789. *
  5790. *
  5791. */
  5792. BMI160_RETURN_FUNCTION_TYPE bmi160_get_i2c_device_addr(
  5793. u8 *v_i2c_device_addr_u8);
  5794. /*!
  5795. * @brief This API is used to set
  5796. * I2C device address of auxiliary mag from the register 0x4B bit 1 to 7
  5797. *
  5798. *
  5799. *
  5800. *
  5801. * @param v_i2c_device_addr_u8 : The value of mag I2C device address
  5802. *
  5803. *
  5804. * @return results of bus communication function
  5805. * @retval 0 -> Success
  5806. * @retval -1 -> Error
  5807. *
  5808. *
  5809. */
  5810. BMI160_RETURN_FUNCTION_TYPE bmi160_set_i2c_device_addr(
  5811. u8 v_i2c_device_addr_u8);
  5812. /*!
  5813. * @brief This API is used to read
  5814. * Burst data length (1,2,6,8 byte) from the register 0x4C bit 0 to 1
  5815. *
  5816. *
  5817. *
  5818. *
  5819. * @param v_mag_burst_u8 : The data of mag burst read lenth
  5820. *
  5821. *
  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_get_mag_burst(
  5830. u8 *v_mag_burst_u8);
  5831. /*!
  5832. * @brief This API is used to set
  5833. * Burst data length (1,2,6,8 byte) from the register 0x4C bit 0 to 1
  5834. *
  5835. *
  5836. *
  5837. *
  5838. * @param v_mag_burst_u8 : The data of mag burst read lenth
  5839. *
  5840. *
  5841. *
  5842. * @return results of bus communication function
  5843. * @retval 0 -> Success
  5844. * @retval -1 -> Error
  5845. *
  5846. *
  5847. */
  5848. BMI160_RETURN_FUNCTION_TYPE bmi160_set_mag_burst(
  5849. u8 v_mag_burst_u8);
  5850. /***************************************************************/
  5851. /**\name FUNCTION FOR MAG OFFSET */
  5852. /***************************************************************/
  5853. /*!
  5854. * @brief This API is used to read
  5855. * trigger-readout offset in units of 2.5 ms. If set to zero,
  5856. * the offset is maximum, i.e. after readout a trigger
  5857. * is issued immediately. from the register 0x4C bit 2 to 5
  5858. *
  5859. *
  5860. *
  5861. *
  5862. * @param v_mag_offset_u8 : The value of mag offset
  5863. *
  5864. *
  5865. *
  5866. * @return results of bus communication function
  5867. * @retval 0 -> Success
  5868. * @retval -1 -> Error
  5869. *
  5870. *
  5871. */
  5872. BMI160_RETURN_FUNCTION_TYPE bmi160_get_mag_offset(
  5873. u8 *v_mag_offset_u8);
  5874. /*!
  5875. * @brief This API is used to set
  5876. * trigger-readout offset in units of 2.5 ms. If set to zero,
  5877. * the offset is maximum, i.e. after readout a trigger
  5878. * is issued immediately. from the register 0x4C bit 2 to 5
  5879. *
  5880. *
  5881. *
  5882. *
  5883. * @param v_mag_offset_u8 : The value of mag offset
  5884. *
  5885. *
  5886. *
  5887. * @return results of bus communication function
  5888. * @retval 0 -> Success
  5889. * @retval -1 -> Error
  5890. *
  5891. *
  5892. */
  5893. BMI160_RETURN_FUNCTION_TYPE bmi160_set_mag_offset(
  5894. u8 v_mag_offset_u8);
  5895. /***************************************************************/
  5896. /**\name FUNCTION FOR MAG MANUAL/AUTO MODE SELECTION */
  5897. /***************************************************************/
  5898. /*!
  5899. * @brief This API is used to read
  5900. * Enable register access on MAG_IF[2] or MAG_IF[3] writes.
  5901. * This implies that the DATA registers are not updated with
  5902. * magnetometer values. Accessing magnetometer requires
  5903. * the magnetometer in normal mode in PMU_STATUS.
  5904. * from the register 0x4C bit 7
  5905. *
  5906. *
  5907. *
  5908. * @param v_mag_manual_u8 : The value of mag manual enable
  5909. * value | mag manual
  5910. * ----------|-------------------
  5911. * 0x01 | BMI160_ENABLE
  5912. * 0x00 | BMI160_DISABLE
  5913. *
  5914. *
  5915. *
  5916. * @return results of bus communication function
  5917. * @retval 0 -> Success
  5918. * @retval -1 -> Error
  5919. *
  5920. *
  5921. */
  5922. BMI160_RETURN_FUNCTION_TYPE bmi160_get_mag_manual_enable(
  5923. u8 *v_mag_manual_u8);
  5924. /*!
  5925. * @brief This API is used to set
  5926. * Enable register access on MAG_IF[2] or MAG_IF[3] writes.
  5927. * This implies that the DATA registers are not updated with
  5928. * magnetometer values. Accessing magnetometer requires
  5929. * the magnetometer in normal mode in PMU_STATUS.
  5930. * from the register 0x4C bit 7
  5931. *
  5932. *
  5933. *
  5934. * @param v_mag_manual_u8 : The value of mag manual enable
  5935. * value | mag manual
  5936. * ----------|-------------------
  5937. * 0x01 | BMI160_ENABLE
  5938. * 0x00 | BMI160_DISABLE
  5939. *
  5940. *
  5941. *
  5942. * @return results of bus communication function
  5943. * @retval 0 -> Success
  5944. * @retval -1 -> Error
  5945. *
  5946. *
  5947. */
  5948. BMI160_RETURN_FUNCTION_TYPE bmi160_set_mag_manual_enable(
  5949. u8 v_mag_manual_u8);
  5950. /***************************************************************/
  5951. /**\name FUNCTIONS FOR MAG READ, WRITE AND WRITE DATA ADDRESS */
  5952. /***************************************************************/
  5953. /*!
  5954. * @brief This API is used to read data
  5955. * magnetometer address to read from the register 0x4D bit 0 to 7
  5956. * @brief It used to provide mag read address of auxiliary mag
  5957. *
  5958. *
  5959. *
  5960. *
  5961. * @param v_mag_read_addr_u8 : The value of address need to be read
  5962. *
  5963. *
  5964. *
  5965. * @return results of bus communication function
  5966. * @retval 0 -> Success
  5967. * @retval -1 -> Error
  5968. *
  5969. *
  5970. */
  5971. BMI160_RETURN_FUNCTION_TYPE bmi160_get_mag_read_addr(
  5972. u8 *v_mag_read_addr_u8);
  5973. /*!
  5974. * @brief This API is used to set
  5975. * magnetometer write address from the register 0x4D bit 0 to 7
  5976. * @brief mag write address writes the address of auxiliary mag to write
  5977. *
  5978. *
  5979. *
  5980. * @param v_mag_read_addr_u8:
  5981. * The data of auxiliary mag address to write data
  5982. *
  5983. *
  5984. * @return results of bus communication function
  5985. * @retval 0 -> Success
  5986. * @retval -1 -> Error
  5987. *
  5988. *
  5989. */
  5990. BMI160_RETURN_FUNCTION_TYPE bmi160_set_mag_read_addr(
  5991. u8 v_mag_read_addr_u8);
  5992. /*!
  5993. * @brief This API is used to read
  5994. * magnetometer write address from the register 0x4E bit 0 to 7
  5995. * @brief mag write address writes the address of auxiliary mag to write
  5996. *
  5997. *
  5998. *
  5999. * @param v_mag_write_addr_u8:
  6000. * The data of auxiliary mag address to write data
  6001. *
  6002. *
  6003. * @return results of bus communication function
  6004. * @retval 0 -> Success
  6005. * @retval -1 -> Error
  6006. *
  6007. *
  6008. */
  6009. BMI160_RETURN_FUNCTION_TYPE bmi160_get_mag_write_addr(
  6010. u8 *v_mag_write_addr_u8);
  6011. /*!
  6012. * @brief This API is used to set
  6013. * magnetometer write address from the register 0x4E bit 0 to 7
  6014. * @brief mag write address writes the address of auxiliary mag to write
  6015. *
  6016. *
  6017. *
  6018. * @param v_mag_write_addr_u8:
  6019. * The data of auxiliary mag address to write data
  6020. *
  6021. *
  6022. * @return results of bus communication function
  6023. * @retval 0 -> Success
  6024. * @retval -1 -> Error
  6025. *
  6026. *
  6027. */
  6028. BMI160_RETURN_FUNCTION_TYPE bmi160_set_mag_write_addr(
  6029. u8 v_mag_write_addr_u8);
  6030. /*!
  6031. * @brief This API is used to read magnetometer write data
  6032. * form the resister 0x4F bit 0 to 7
  6033. * @brief This writes the data will be wrote to mag
  6034. *
  6035. *
  6036. *
  6037. * @param v_mag_write_data_u8: The value of mag data
  6038. *
  6039. *
  6040. *
  6041. * @return results of bus communication function
  6042. * @retval 0 -> Success
  6043. * @retval -1 -> Error
  6044. *
  6045. *
  6046. */
  6047. BMI160_RETURN_FUNCTION_TYPE bmi160_get_mag_write_data(
  6048. u8 *v_mag_write_data_u8);
  6049. /*!
  6050. * @brief This API is used to set magnetometer write data
  6051. * form the resister 0x4F bit 0 to 7
  6052. * @brief This writes the data will be wrote to mag
  6053. *
  6054. *
  6055. *
  6056. * @param v_mag_write_data_u8: The value of mag data
  6057. *
  6058. *
  6059. *
  6060. * @return results of bus communication function
  6061. * @retval 0 -> Success
  6062. * @retval -1 -> Error
  6063. *
  6064. *
  6065. */
  6066. BMI160_RETURN_FUNCTION_TYPE bmi160_set_mag_write_data(
  6067. u8 v_mag_write_data_u8);
  6068. /***************************************************************/
  6069. /**\name FUNCTION FOR INTERRUPT ENABLE OF
  6070. ANY-MOTION XYZ, DOUBLE AND SINGLE TAP, ORIENT AND FLAT */
  6071. /***************************************************************/
  6072. /*!
  6073. * @brief This API is used to read
  6074. * interrupt enable from the register 0x50 bit 0 to 7
  6075. *
  6076. *
  6077. *
  6078. *
  6079. * @param v_enable_u8 : Value to decided to select interrupt
  6080. * v_enable_u8 | interrupt
  6081. * ---------------|---------------
  6082. * 0 | BMI160_ANY_MOTION_X_ENABLE
  6083. * 1 | BMI160_ANY_MOTION_Y_ENABLE
  6084. * 2 | BMI160_ANY_MOTION_Z_ENABLE
  6085. * 3 | BMI160_DOUBLE_TAP_ENABLE
  6086. * 4 | BMI160_SINGLE_TAP_ENABLE
  6087. * 5 | BMI160_ORIENT_ENABLE
  6088. * 6 | BMI160_FLAT_ENABLE
  6089. *
  6090. * @param v_intr_enable_zero_u8 : The interrupt enable value
  6091. * value | interrupt enable
  6092. * ----------|-------------------
  6093. * 0x01 | BMI160_ENABLE
  6094. * 0x00 | BMI160_DISABLE
  6095. *
  6096. *
  6097. *
  6098. * @return results of bus communication function
  6099. * @retval 0 -> Success
  6100. * @retval -1 -> Error
  6101. *
  6102. *
  6103. */
  6104. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_enable_0(
  6105. u8 enable, u8 *v_intr_enable_zero_u8);
  6106. /*!
  6107. * @brief This API is used to set
  6108. * interrupt enable from the register 0x50 bit 0 to 7
  6109. *
  6110. *
  6111. *
  6112. *
  6113. * @param v_enable_u8 : Value to decided to select interrupt
  6114. * v_enable_u8 | interrupt
  6115. * ---------------|---------------
  6116. * 0 | BMI160_ANY_MOTION_X_ENABLE
  6117. * 1 | BMI160_ANY_MOTION_Y_ENABLE
  6118. * 2 | BMI160_ANY_MOTION_Z_ENABLE
  6119. * 3 | BMI160_DOUBLE_TAP_ENABLE
  6120. * 4 | BMI160_SINGLE_TAP_ENABLE
  6121. * 5 | BMI160_ORIENT_ENABLE
  6122. * 6 | BMI160_FLAT_ENABLE
  6123. *
  6124. * @param v_intr_enable_zero_u8 : The interrupt enable value
  6125. * value | interrupt enable
  6126. * ----------|-------------------
  6127. * 0x01 | BMI160_ENABLE
  6128. * 0x00 | BMI160_DISABLE
  6129. *
  6130. *
  6131. *
  6132. * @return results of bus communication function
  6133. * @retval 0 -> Success
  6134. * @retval -1 -> Error
  6135. *
  6136. *
  6137. */
  6138. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_enable_0(
  6139. u8 enable, u8 v_intr_enable_zero_u8);
  6140. /***************************************************************/
  6141. /**\name FUNCTION FOR INTERRUPT ENABLE OF
  6142. HIGH_G XYZ, LOW_G, DATA READY, FIFO FULL AND FIFO WATER MARK */
  6143. /***************************************************************/
  6144. /*!
  6145. * @brief This API is used to read
  6146. * interrupt enable byte1 from the register 0x51 bit 0 to 6
  6147. * @brief It read the high_g_x,high_g_y,high_g_z,low_g_enable
  6148. * data ready, fifo full and fifo water mark.
  6149. *
  6150. *
  6151. *
  6152. * @param v_enable_u8 : The value of interrupt enable
  6153. * @param v_enable_u8 : Value to decided to select interrupt
  6154. * v_enable_u8 | interrupt
  6155. * ---------------|---------------
  6156. * 0 | BMI160_HIGH_G_X_ENABLE
  6157. * 1 | BMI160_HIGH_G_Y_ENABLE
  6158. * 2 | BMI160_HIGH_G_Z_ENABLE
  6159. * 3 | BMI160_LOW_G_ENABLE
  6160. * 4 | BMI160_DATA_RDY_ENABLE
  6161. * 5 | BMI160_FIFO_FULL_ENABLE
  6162. * 6 | BMI160_FIFO_WM_ENABLE
  6163. *
  6164. * @param v_intr_enable_1_u8 : The interrupt enable value
  6165. * value | interrupt enable
  6166. * ----------|-------------------
  6167. * 0x01 | BMI160_ENABLE
  6168. * 0x00 | BMI160_DISABLE
  6169. *
  6170. *
  6171. *
  6172. * @return results of bus communication function
  6173. * @retval 0 -> Success
  6174. * @retval -1 -> Error
  6175. *
  6176. *
  6177. */
  6178. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_enable_1(
  6179. u8 enable, u8 *v_intr_enable_1_u8);
  6180. /*!
  6181. * @brief This API is used to set
  6182. * interrupt enable byte1 from the register 0x51 bit 0 to 6
  6183. * @brief It read the high_g_x,high_g_y,high_g_z,low_g_enable
  6184. * data ready, fifo full and fifo water mark.
  6185. *
  6186. *
  6187. *
  6188. * @param v_enable_u8 : The value of interrupt enable
  6189. * @param v_enable_u8 : Value to decided to select interrupt
  6190. * v_enable_u8 | interrupt
  6191. * ---------------|---------------
  6192. * 0 | BMI160_HIGH_G_X_ENABLE
  6193. * 1 | BMI160_HIGH_G_Y_ENABLE
  6194. * 2 | BMI160_HIGH_G_Z_ENABLE
  6195. * 3 | BMI160_LOW_G_ENABLE
  6196. * 4 | BMI160_DATA_RDY_ENABLE
  6197. * 5 | BMI160_FIFO_FULL_ENABLE
  6198. * 6 | BMI160_FIFO_WM_ENABLE
  6199. *
  6200. * @param v_intr_enable_1_u8 : The interrupt enable value
  6201. * value | interrupt enable
  6202. * ----------|-------------------
  6203. * 0x01 | BMI160_ENABLE
  6204. * 0x00 | BMI160_DISABLE
  6205. *
  6206. *
  6207. *
  6208. * @return results of bus communication function
  6209. * @retval 0 -> Success
  6210. * @retval -1 -> Error
  6211. *
  6212. *
  6213. */
  6214. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_enable_1(
  6215. u8 enable, u8 v_intr_enable_1_u8);
  6216. /***************************************************************/
  6217. /**\name FUNCTION FOR INTERRUPT ENABLE OF
  6218. NO MOTION XYZ */
  6219. /***************************************************************/
  6220. /*!
  6221. * @brief This API is used to read
  6222. * interrupt enable byte2 from the register bit 0x52 bit 0 to 3
  6223. * @brief It reads no motion x,y and z
  6224. *
  6225. *
  6226. *
  6227. * @param v_enable_u8: The value of interrupt enable
  6228. * v_enable_u8 | interrupt
  6229. * ---------------|---------------
  6230. * 0 | BMI160_NOMOTION_X_ENABLE
  6231. * 1 | BMI160_NOMOTION_Y_ENABLE
  6232. * 2 | BMI160_NOMOTION_Z_ENABLE
  6233. *
  6234. * @param v_intr_enable_2_u8 : The interrupt enable value
  6235. * value | interrupt enable
  6236. * ----------|-------------------
  6237. * 0x01 | BMI160_ENABLE
  6238. * 0x00 | BMI160_DISABLE
  6239. *
  6240. *
  6241. *
  6242. * @return results of bus communication function
  6243. * @retval 0 -> Success
  6244. * @retval -1 -> Error
  6245. *
  6246. *
  6247. */
  6248. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_enable_2(
  6249. u8 enable, u8 *v_intr_enable_2_u8);
  6250. /*!
  6251. * @brief This API is used to set
  6252. * interrupt enable byte2 from the register bit 0x52 bit 0 to 3
  6253. * @brief It reads no motion x,y and z
  6254. *
  6255. *
  6256. *
  6257. * @param v_enable_u8: The value of interrupt enable
  6258. * v_enable_u8 | interrupt
  6259. * ---------------|---------------
  6260. * 0 | BMI160_NOMOTION_X_ENABLE
  6261. * 1 | BMI160_NOMOTION_Y_ENABLE
  6262. * 2 | BMI160_NOMOTION_Z_ENABLE
  6263. *
  6264. * @param v_intr_enable_2_u8 : The interrupt enable value
  6265. * value | interrupt enable
  6266. * ----------|-------------------
  6267. * 0x01 | BMI160_ENABLE
  6268. * 0x00 | BMI160_DISABLE
  6269. *
  6270. *
  6271. *
  6272. * @return results of bus communication function
  6273. * @retval 0 -> Success
  6274. * @retval -1 -> Error
  6275. *
  6276. *
  6277. */
  6278. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_enable_2(
  6279. u8 enable, u8 v_intr_enable_2_u8);
  6280. /***************************************************************/
  6281. /**\name FUNCTION FOR INTERRUPT ENABLE OF
  6282. STEP DETECTOR */
  6283. /***************************************************************/
  6284. /*!
  6285. * @brief This API is used to read
  6286. * interrupt enable step detector interrupt from
  6287. * the register bit 0x52 bit 3
  6288. *
  6289. *
  6290. *
  6291. *
  6292. * @param v_step_intr_u8 : The value of step detector interrupt enable
  6293. *
  6294. *
  6295. *
  6296. * @return results of bus communication function
  6297. * @retval 0 -> Success
  6298. * @retval -1 -> Error
  6299. *
  6300. *
  6301. */
  6302. BMI160_RETURN_FUNCTION_TYPE bmi160_get_stepdetector_enable(
  6303. u8 *v_step_intr_u8);
  6304. /*!
  6305. * @brief This API is used to set
  6306. * interrupt enable step detector interrupt from
  6307. * the register bit 0x52 bit 3
  6308. *
  6309. *
  6310. *
  6311. *
  6312. * @param v_step_intr_u8 : The value of step detector interrupt enable
  6313. *
  6314. *
  6315. *
  6316. * @return results of bus communication function
  6317. * @retval 0 -> Success
  6318. * @retval -1 -> Error
  6319. *
  6320. *
  6321. */
  6322. BMI160_RETURN_FUNCTION_TYPE bmi160_set_step_detector_enable(
  6323. u8 v_step_intr_u8);
  6324. /***************************************************************/
  6325. /**\name FUNCTION FOR INTERRUPT CONTROL */
  6326. /***************************************************************/
  6327. /*!
  6328. * @brief Configure trigger condition of interrupt1
  6329. * and interrupt2 pin from the register 0x53
  6330. * @brief interrupt1 - bit 0
  6331. * @brief interrupt2 - bit 4
  6332. *
  6333. * @param v_channel_u8: The value of edge trigger selection
  6334. * v_channel_u8 | Edge trigger
  6335. * ---------------|---------------
  6336. * 0 | BMI160_INTR1_EDGE_CTRL
  6337. * 1 | BMI160_INTR2_EDGE_CTRL
  6338. *
  6339. * @param v_intr_edge_ctrl_u8 : The value of edge trigger enable
  6340. * value | interrupt enable
  6341. * ----------|-------------------
  6342. * 0x01 | BMI160_EDGE
  6343. * 0x00 | BMI160_LEVEL
  6344. *
  6345. * @return results of bus communication function
  6346. * @retval 0 -> Success
  6347. * @retval -1 -> Error
  6348. *
  6349. *
  6350. */
  6351. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_edge_ctrl(
  6352. u8 v_channel_u8, u8 *v_intr_edge_ctrl_u8);
  6353. /*!
  6354. * @brief Configure trigger condition of interrupt1
  6355. * and interrupt2 pin from the register 0x53
  6356. * @brief interrupt1 - bit 0
  6357. * @brief interrupt2 - bit 4
  6358. *
  6359. * @param v_channel_u8: The value of edge trigger selection
  6360. * v_channel_u8 | Edge trigger
  6361. * ---------------|---------------
  6362. * 0 | BMI160_INTR1_EDGE_CTRL
  6363. * 1 | BMI160_INTR2_EDGE_CTRL
  6364. *
  6365. * @param v_intr_edge_ctrl_u8 : The value of edge trigger enable
  6366. * value | interrupt enable
  6367. * ----------|-------------------
  6368. * 0x01 | BMI160_EDGE
  6369. * 0x00 | BMI160_LEVEL
  6370. *
  6371. * @return results of bus communication function
  6372. * @retval 0 -> Success
  6373. * @retval -1 -> Error
  6374. *
  6375. *
  6376. */
  6377. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_edge_ctrl(
  6378. u8 v_channel_u8, u8 v_intr_edge_ctrl_u8);
  6379. /*!
  6380. * @brief API used for get the Configure level condition of interrupt1
  6381. * and interrupt2 pin form the register 0x53
  6382. * @brief interrupt1 - bit 1
  6383. * @brief interrupt2 - bit 5
  6384. *
  6385. * @param v_channel_u8: The value of level condition selection
  6386. * v_channel_u8 | level selection
  6387. * ---------------|---------------
  6388. * 0 | BMI160_INTR1_LEVEL
  6389. * 1 | BMI160_INTR2_LEVEL
  6390. *
  6391. * @param v_intr_level_u8 : The value of level of interrupt enable
  6392. * value | Behaviour
  6393. * ----------|-------------------
  6394. * 0x01 | BMI160_LEVEL_HIGH
  6395. * 0x00 | BMI160_LEVEL_LOW
  6396. *
  6397. * @return results of bus communication function
  6398. * @retval 0 -> Success
  6399. * @retval -1 -> Error
  6400. *
  6401. *
  6402. */
  6403. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_level(
  6404. u8 v_channel_u8, u8 *v_intr_level_u8);
  6405. /*!
  6406. * @brief API used for set the Configure level condition of interrupt1
  6407. * and interrupt2 pin form the register 0x53
  6408. * @brief interrupt1 - bit 1
  6409. * @brief interrupt2 - bit 5
  6410. *
  6411. * @param v_channel_u8: The value of level condition selection
  6412. * v_channel_u8 | level selection
  6413. * ---------------|---------------
  6414. * 0 | BMI160_INTR1_LEVEL
  6415. * 1 | BMI160_INTR2_LEVEL
  6416. *
  6417. * @param v_intr_level_u8 : The value of level of interrupt enable
  6418. * value | Behaviour
  6419. * ----------|-------------------
  6420. * 0x01 | BMI160_LEVEL_HIGH
  6421. * 0x00 | BMI160_LEVEL_LOW
  6422. *
  6423. * @return results of bus communication function
  6424. * @retval 0 -> Success
  6425. * @retval -1 -> Error
  6426. *
  6427. *
  6428. */
  6429. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_level(
  6430. u8 v_channel_u8, u8 v_intr_level_u8);
  6431. /*!
  6432. * @brief API used to get configured output enable of interrupt1
  6433. * and interrupt2 from the register 0x53
  6434. * @brief interrupt1 - bit 2
  6435. * @brief interrupt2 - bit 6
  6436. *
  6437. *
  6438. * @param v_channel_u8: The value of output type enable selection
  6439. * v_channel_u8 | level selection
  6440. * ---------------|---------------
  6441. * 0 | BMI160_INTR1_OUTPUT_TYPE
  6442. * 1 | BMI160_INTR2_OUTPUT_TYPE
  6443. *
  6444. * @param v_intr_output_type_u8 :
  6445. * The value of output type of interrupt enable
  6446. * value | Behaviour
  6447. * ----------|-------------------
  6448. * 0x01 | BMI160_OPEN_DRAIN
  6449. * 0x00 | BMI160_PUSH_PULL
  6450. *
  6451. *
  6452. * @return results of bus communication function
  6453. * @retval 0 -> Success
  6454. * @retval -1 -> Error
  6455. *
  6456. *
  6457. */
  6458. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_output_type(
  6459. u8 v_channel_u8, u8 *v_intr_output_type_u8);
  6460. /*!
  6461. * @brief API used to set output enable of interrupt1
  6462. * and interrupt2 from the register 0x53
  6463. * @brief interrupt1 - bit 2
  6464. * @brief interrupt2 - bit 6
  6465. *
  6466. *
  6467. * @param v_channel_u8: The value of output type enable selection
  6468. * v_channel_u8 | level selection
  6469. * ---------------|---------------
  6470. * 0 | BMI160_INTR1_OUTPUT_TYPE
  6471. * 1 | BMI160_INTR2_OUTPUT_TYPE
  6472. *
  6473. * @param v_intr_output_type_u8 :
  6474. * The value of output type of interrupt enable
  6475. * value | Behaviour
  6476. * ----------|-------------------
  6477. * 0x01 | BMI160_OPEN_DRAIN
  6478. * 0x00 | BMI160_PUSH_PULL
  6479. *
  6480. *
  6481. * @return results of bus communication function
  6482. * @retval 0 -> Success
  6483. * @retval -1 -> Error
  6484. *
  6485. *
  6486. */
  6487. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_output_type(
  6488. u8 v_channel_u8, u8 v_intr_output_type_u8);
  6489. /*!
  6490. * @brief API used to get the Output enable for interrupt1
  6491. * and interrupt1 pin from the register 0x53
  6492. * @brief interrupt1 - bit 3
  6493. * @brief interrupt2 - bit 7
  6494. *
  6495. * @param v_channel_u8: The value of output enable selection
  6496. * v_channel_u8 | level selection
  6497. * ---------------|---------------
  6498. * 0 | BMI160_INTR1_OUTPUT_TYPE
  6499. * 1 | BMI160_INTR2_OUTPUT_TYPE
  6500. *
  6501. * @param v_output_enable_u8 :
  6502. * The value of output enable of interrupt enable
  6503. * value | Behaviour
  6504. * ----------|-------------------
  6505. * 0x01 | BMI160_INPUT
  6506. * 0x00 | BMI160_OUTPUT
  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_output_enable(
  6517. u8 v_channel_u8, u8 *v_output_enable_u8);
  6518. /*!
  6519. * @brief API used to set the Output enable for interrupt1
  6520. * and interrupt1 pin from the register 0x53
  6521. * @brief interrupt1 - bit 3
  6522. * @brief interrupt2 - bit 7
  6523. *
  6524. * @param v_channel_u8: The value of output enable selection
  6525. * v_channel_u8 | level selection
  6526. * ---------------|---------------
  6527. * 0 | BMI160_INTR1_OUTPUT_TYPE
  6528. * 1 | BMI160_INTR2_OUTPUT_TYPE
  6529. *
  6530. * @param v_output_enable_u8 :
  6531. * The value of output enable of interrupt enable
  6532. * value | Behaviour
  6533. * ----------|-------------------
  6534. * 0x01 | BMI160_INPUT
  6535. * 0x00 | BMI160_OUTPUT
  6536. *
  6537. *
  6538. *
  6539. * @return results of bus communication function
  6540. * @retval 0 -> Success
  6541. * @retval -1 -> Error
  6542. *
  6543. *
  6544. */
  6545. BMI160_RETURN_FUNCTION_TYPE bmi160_set_output_enable(
  6546. u8 v_channel_u8, u8 v_output_enable_u8);
  6547. /***************************************************************/
  6548. /**\name FUNCTION FOR INTERRUPT LATCH INTERRUPT */
  6549. /***************************************************************/
  6550. /*!
  6551. * @brief This API is used to get the latch duration
  6552. * from the register 0x54 bit 0 to 3
  6553. * @brief This latch selection is not applicable for data ready,
  6554. * orientation and flat interrupts.
  6555. *
  6556. *
  6557. *
  6558. * @param v_latch_intr_u8 : The value of latch duration
  6559. * Latch Duration | value
  6560. * --------------------------------------|------------------
  6561. * BMI160_LATCH_DUR_NONE | 0x00
  6562. * BMI160_LATCH_DUR_312_5_MICRO_SEC | 0x01
  6563. * BMI160_LATCH_DUR_625_MICRO_SEC | 0x02
  6564. * BMI160_LATCH_DUR_1_25_MILLI_SEC | 0x03
  6565. * BMI160_LATCH_DUR_2_5_MILLI_SEC | 0x04
  6566. * BMI160_LATCH_DUR_5_MILLI_SEC | 0x05
  6567. * BMI160_LATCH_DUR_10_MILLI_SEC | 0x06
  6568. * BMI160_LATCH_DUR_20_MILLI_SEC | 0x07
  6569. * BMI160_LATCH_DUR_40_MILLI_SEC | 0x08
  6570. * BMI160_LATCH_DUR_80_MILLI_SEC | 0x09
  6571. * BMI160_LATCH_DUR_160_MILLI_SEC | 0x0A
  6572. * BMI160_LATCH_DUR_320_MILLI_SEC | 0x0B
  6573. * BMI160_LATCH_DUR_640_MILLI_SEC | 0x0C
  6574. * BMI160_LATCH_DUR_1_28_SEC | 0x0D
  6575. * BMI160_LATCH_DUR_2_56_SEC | 0x0E
  6576. * BMI160_LATCHED | 0x0F
  6577. *
  6578. *
  6579. *
  6580. * @return results of bus communication function
  6581. * @retval 0 -> Success
  6582. * @retval -1 -> Error
  6583. *
  6584. *
  6585. */
  6586. BMI160_RETURN_FUNCTION_TYPE bmi160_get_latch_intr(
  6587. u8 *v_latch_intr_u8);
  6588. /*!
  6589. * @brief This API is used to set the latch duration
  6590. * from the register 0x54 bit 0 to 3
  6591. * @brief This latch selection is not applicable for data ready,
  6592. * orientation and flat interrupts.
  6593. *
  6594. *
  6595. *
  6596. * @param v_latch_intr_u8 : The value of latch duration
  6597. * Latch Duration | value
  6598. * --------------------------------------|------------------
  6599. * BMI160_LATCH_DUR_NONE | 0x00
  6600. * BMI160_LATCH_DUR_312_5_MICRO_SEC | 0x01
  6601. * BMI160_LATCH_DUR_625_MICRO_SEC | 0x02
  6602. * BMI160_LATCH_DUR_1_25_MILLI_SEC | 0x03
  6603. * BMI160_LATCH_DUR_2_5_MILLI_SEC | 0x04
  6604. * BMI160_LATCH_DUR_5_MILLI_SEC | 0x05
  6605. * BMI160_LATCH_DUR_10_MILLI_SEC | 0x06
  6606. * BMI160_LATCH_DUR_20_MILLI_SEC | 0x07
  6607. * BMI160_LATCH_DUR_40_MILLI_SEC | 0x08
  6608. * BMI160_LATCH_DUR_80_MILLI_SEC | 0x09
  6609. * BMI160_LATCH_DUR_160_MILLI_SEC | 0x0A
  6610. * BMI160_LATCH_DUR_320_MILLI_SEC | 0x0B
  6611. * BMI160_LATCH_DUR_640_MILLI_SEC | 0x0C
  6612. * BMI160_LATCH_DUR_1_28_SEC | 0x0D
  6613. * BMI160_LATCH_DUR_2_56_SEC | 0x0E
  6614. * BMI160_LATCHED | 0x0F
  6615. *
  6616. *
  6617. *
  6618. * @return results of bus communication function
  6619. * @retval 0 -> Success
  6620. * @retval -1 -> Error
  6621. *
  6622. *
  6623. */
  6624. BMI160_RETURN_FUNCTION_TYPE bmi160_set_latch_intr(
  6625. u8 v_latch_intr_u8);
  6626. /*!
  6627. * @brief API used to get input enable for interrupt1
  6628. * and interrupt2 pin from the register 0x54
  6629. * @brief interrupt1 - bit 4
  6630. * @brief interrupt2 - bit 5
  6631. *
  6632. * @param v_channel_u8: The value of input enable selection
  6633. * v_channel_u8 | input selection
  6634. * ---------------|---------------
  6635. * 0 | BMI160_INTR1_INPUT_ENABLE
  6636. * 1 | BMI160_INTR2_INPUT_ENABLE
  6637. *
  6638. * @param v_input_en_u8 :
  6639. * The value of input enable of interrupt enable
  6640. * value | Behaviour
  6641. * ----------|-------------------
  6642. * 0x01 | BMI160_INPUT
  6643. * 0x00 | BMI160_OUTPUT
  6644. *
  6645. *
  6646. *
  6647. * @return results of bus communication function
  6648. * @retval 0 -> Success
  6649. * @retval -1 -> Error
  6650. *
  6651. *
  6652. */
  6653. BMI160_RETURN_FUNCTION_TYPE bmi160_get_input_enable(
  6654. u8 v_channel_u8, u8 *v_input_en_u8);
  6655. /*!
  6656. * @brief API used to set input enable for interrupt1
  6657. * and interrupt2 pin from the register 0x54
  6658. * @brief interrupt1 - bit 4
  6659. * @brief interrupt2 - bit 5
  6660. *
  6661. * @param v_channel_u8: The value of input enable selection
  6662. * v_channel_u8 | input selection
  6663. * ---------------|---------------
  6664. * 0 | BMI160_INTR1_INPUT_ENABLE
  6665. * 1 | BMI160_INTR2_INPUT_ENABLE
  6666. *
  6667. * @param v_input_en_u8 :
  6668. * The value of input enable of interrupt enable
  6669. * value | Behaviour
  6670. * ----------|-------------------
  6671. * 0x01 | BMI160_INPUT
  6672. * 0x00 | BMI160_OUTPUT
  6673. *
  6674. *
  6675. *
  6676. * @return results of bus communication function
  6677. * @retval 0 -> Success
  6678. * @retval -1 -> Error
  6679. *
  6680. *
  6681. */
  6682. BMI160_RETURN_FUNCTION_TYPE bmi160_set_input_enable(
  6683. u8 v_channel_u8, u8 v_input_en_u8);
  6684. /***************************************************************/
  6685. /**\name FUNCTION FOR INTERRUPT1 AND INTERRUPT2 MAPPING */
  6686. /***************************************************************/
  6687. /*!
  6688. * @brief reads the Low g interrupt mapped to interrupt1
  6689. * and interrupt2 from the register 0x55 and 0x57
  6690. * @brief interrupt1 bit 0 in the register 0x55
  6691. * @brief interrupt2 bit 0 in the register 0x57
  6692. *
  6693. *
  6694. * @param v_channel_u8: The value of low_g selection
  6695. * v_channel_u8 | interrupt
  6696. * ---------------|---------------
  6697. * 0 | BMI160_INTR1_MAP_LOW_G
  6698. * 1 | BMI160_INTR2_MAP_LOW_G
  6699. *
  6700. * @param v_intr_low_g_u8 : The value of low_g enable
  6701. * value | interrupt enable
  6702. * ----------|-------------------
  6703. * 0x01 | BMI160_ENABLE
  6704. * 0x00 | BMI160_DISABLE
  6705. *
  6706. *
  6707. *
  6708. * @return results of bus communication function
  6709. * @retval 0 -> Success
  6710. * @retval -1 -> Error
  6711. *
  6712. *
  6713. */
  6714. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_low_g(
  6715. u8 v_channel_u8, u8 *v_intr_low_g_u8);
  6716. /*!
  6717. * @brief set the Low g interrupt mapped to interrupt1
  6718. * and interrupt2 from the register 0x55 and 0x57
  6719. * @brief interrupt1 bit 0 in the register 0x55
  6720. * @brief interrupt2 bit 0 in the register 0x57
  6721. *
  6722. *
  6723. * @param v_channel_u8: The value of low_g selection
  6724. * v_channel_u8 | interrupt
  6725. * ---------------|---------------
  6726. * 0 | BMI160_INTR1_MAP_LOW_G
  6727. * 1 | BMI160_INTR2_MAP_LOW_G
  6728. *
  6729. * @param v_intr_low_g_u8 : The value of low_g enable
  6730. * value | interrupt enable
  6731. * ----------|-------------------
  6732. * 0x01 | BMI160_ENABLE
  6733. * 0x00 | BMI160_DISABLE
  6734. *
  6735. *
  6736. *
  6737. * @return results of bus communication function
  6738. * @retval 0 -> Success
  6739. * @retval -1 -> Error
  6740. *
  6741. *
  6742. */
  6743. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_low_g(
  6744. u8 v_channel_u8, u8 v_intr_low_g_u8);
  6745. /*!
  6746. * @brief Reads the HIGH g interrupt mapped to interrupt1
  6747. * and interrupt2 from the register 0x55 and 0x57
  6748. * @brief interrupt1 bit 1 in the register 0x55
  6749. * @brief interrupt2 bit 1 in the register 0x57
  6750. *
  6751. *
  6752. * @param v_channel_u8: The value of high_g selection
  6753. * v_channel_u8 | interrupt
  6754. * ---------------|---------------
  6755. * 0 | BMI160_INTR1_MAP_HIGH_G
  6756. * 1 | BMI160_INTR2_MAP_HIGH_G
  6757. *
  6758. * @param v_intr_high_g_u8 : The value of high_g enable
  6759. * value | interrupt enable
  6760. * ----------|-------------------
  6761. * 0x01 | BMI160_ENABLE
  6762. * 0x00 | BMI160_DISABLE
  6763. *
  6764. *
  6765. *
  6766. *
  6767. * @return results of bus communication function
  6768. * @retval 0 -> Success
  6769. * @retval -1 -> Error
  6770. *
  6771. *
  6772. */
  6773. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_high_g(
  6774. u8 v_channel_u8, u8 *v_intr_high_g_u8);
  6775. /*!
  6776. * @brief Write the HIGH g interrupt mapped to interrupt1
  6777. * and interrupt2 from the register 0x55 and 0x57
  6778. * @brief interrupt1 bit 1 in the register 0x55
  6779. * @brief interrupt2 bit 1 in the register 0x57
  6780. *
  6781. *
  6782. * @param v_channel_u8: The value of high_g selection
  6783. * v_channel_u8 | interrupt
  6784. * ---------------|---------------
  6785. * 0 | BMI160_INTR1_MAP_HIGH_G
  6786. * 1 | BMI160_INTR2_MAP_HIGH_G
  6787. *
  6788. * @param v_intr_high_g_u8 : The value of high_g enable
  6789. * value | interrupt enable
  6790. * ----------|-------------------
  6791. * 0x01 | BMI160_ENABLE
  6792. * 0x00 | BMI160_DISABLE
  6793. *
  6794. *
  6795. *
  6796. *
  6797. * @return results of bus communication function
  6798. * @retval 0 -> Success
  6799. * @retval -1 -> Error
  6800. *
  6801. *
  6802. */
  6803. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_high_g(
  6804. u8 v_channel_u8, u8 v_intr_high_g_u8);
  6805. /*!
  6806. * @brief Reads the Any motion interrupt
  6807. * interrupt mapped to interrupt1
  6808. * and interrupt2 from the register 0x55 and 0x57
  6809. * @brief interrupt1 bit 2 in the register 0x55
  6810. * @brief interrupt2 bit 2 in the register 0x57
  6811. *
  6812. *
  6813. * @param v_channel_u8: The value of any motion selection
  6814. * v_channel_u8 | interrupt
  6815. * ---------------|---------------
  6816. * 0 | BMI160_INTR1_MAP_ANY_MOTION
  6817. * 1 | BMI160_INTR2_MAP_ANY_MOTION
  6818. *
  6819. * @param v_intr_any_motion_u8 : The value of any motion enable
  6820. * value | interrupt enable
  6821. * ----------|-------------------
  6822. * 0x01 | BMI160_ENABLE
  6823. * 0x00 | BMI160_DISABLE
  6824. *
  6825. *
  6826. *
  6827. * @return results of bus communication function
  6828. * @retval 0 -> Success
  6829. * @retval -1 -> Error
  6830. *
  6831. *
  6832. */
  6833. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_any_motion(
  6834. u8 v_channel_u8, u8 *v_intr_any_motion_u8);
  6835. /*!
  6836. * @brief Write the Any motion interrupt
  6837. * interrupt mapped to interrupt1
  6838. * and interrupt2 from the register 0x55 and 0x57
  6839. * @brief interrupt1 bit 2 in the register 0x55
  6840. * @brief interrupt2 bit 2 in the register 0x57
  6841. *
  6842. *
  6843. * @param v_channel_u8: The value of any motion selection
  6844. * v_channel_u8 | interrupt
  6845. * ---------------|---------------
  6846. * 0 | BMI160_INTR1_MAP_ANY_MOTION
  6847. * 1 | BMI160_INTR2_MAP_ANY_MOTION
  6848. *
  6849. * @param v_intr_any_motion_u8 : The value of any motion enable
  6850. * value | interrupt enable
  6851. * ----------|-------------------
  6852. * 0x01 | BMI160_ENABLE
  6853. * 0x00 | BMI160_DISABLE
  6854. *
  6855. *
  6856. *
  6857. * @return results of bus communication function
  6858. * @retval 0 -> Success
  6859. * @retval -1 -> Error
  6860. *
  6861. *
  6862. */
  6863. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_any_motion(
  6864. u8 v_channel_u8, u8 v_intr_any_motion_u8);
  6865. /*!
  6866. * @brief Reads the No motion interrupt
  6867. * interrupt mapped to interrupt1
  6868. * and interrupt2 from the register 0x55 and 0x57
  6869. * @brief interrupt1 bit 3 in the register 0x55
  6870. * @brief interrupt2 bit 3 in the register 0x57
  6871. *
  6872. *
  6873. * @param v_channel_u8: The value of no motion selection
  6874. * v_channel_u8 | interrupt
  6875. * ---------------|---------------
  6876. * 0 | BMI160_INTR1_MAP_NOMO
  6877. * 1 | BMI160_INTR2_MAP_NOMO
  6878. *
  6879. * @param v_intr_nomotion_u8 : The value of no motion enable
  6880. * value | interrupt enable
  6881. * ----------|-------------------
  6882. * 0x01 | BMI160_ENABLE
  6883. * 0x00 | BMI160_DISABLE
  6884. *
  6885. *
  6886. * @return results of bus communication function
  6887. * @retval 0 -> Success
  6888. * @retval -1 -> Error
  6889. *
  6890. *
  6891. */
  6892. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_nomotion(
  6893. u8 v_channel_u8, u8 *v_intr_nomotion_u8);
  6894. /*!
  6895. * @brief Write the No motion interrupt
  6896. * interrupt mapped to interrupt1
  6897. * and interrupt2 from the register 0x55 and 0x57
  6898. * @brief interrupt1 bit 3 in the register 0x55
  6899. * @brief interrupt2 bit 3 in the register 0x57
  6900. *
  6901. *
  6902. * @param v_channel_u8: The value of no motion selection
  6903. * v_channel_u8 | interrupt
  6904. * ---------------|---------------
  6905. * 0 | BMI160_INTR1_MAP_NOMO
  6906. * 1 | BMI160_INTR2_MAP_NOMO
  6907. *
  6908. * @param v_intr_nomotion_u8 : The value of no motion enable
  6909. * value | interrupt enable
  6910. * ----------|-------------------
  6911. * 0x01 | BMI160_ENABLE
  6912. * 0x00 | BMI160_DISABLE
  6913. *
  6914. *
  6915. * @return results of bus communication function
  6916. * @retval 0 -> Success
  6917. * @retval -1 -> Error
  6918. *
  6919. *
  6920. */
  6921. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_nomotion(
  6922. u8 v_channel_u8, u8 v_intr_nomotion_u8);
  6923. /*!
  6924. * @brief Reads the Double Tap interrupt
  6925. * interrupt mapped to interrupt1
  6926. * and interrupt2 from the register 0x55 and 0x57
  6927. * @brief interrupt1 bit 4 in the register 0x55
  6928. * @brief interrupt2 bit 4 in the register 0x57
  6929. *
  6930. *
  6931. * @param v_channel_u8: The value of double tap interrupt selection
  6932. * v_channel_u8 | interrupt
  6933. * ---------------|---------------
  6934. * 0 | BMI160_INTR1_MAP_DOUBLE_TAP
  6935. * 1 | BMI160_INTR2_MAP_DOUBLE_TAP
  6936. *
  6937. * @param v_intr_double_tap_u8 : The value of double tap enable
  6938. * value | interrupt enable
  6939. * ----------|-------------------
  6940. * 0x01 | BMI160_ENABLE
  6941. * 0x00 | BMI160_DISABLE
  6942. *
  6943. * @return results of bus communication function
  6944. * @retval 0 -> Success
  6945. * @retval -1 -> Error
  6946. *
  6947. *
  6948. */
  6949. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_double_tap(
  6950. u8 v_channel_u8, u8 *v_intr_double_tap_u8);
  6951. /*!
  6952. * @brief Write the Double Tap interrupt
  6953. * interrupt mapped to interrupt1
  6954. * and interrupt2 from the register 0x55 and 0x57
  6955. * @brief interrupt1 bit 4 in the register 0x55
  6956. * @brief interrupt2 bit 4 in the register 0x57
  6957. *
  6958. *
  6959. * @param v_channel_u8: The value of double tap interrupt selection
  6960. * v_channel_u8 | interrupt
  6961. * ---------------|---------------
  6962. * 0 | BMI160_INTR1_MAP_DOUBLE_TAP
  6963. * 1 | BMI160_INTR2_MAP_DOUBLE_TAP
  6964. *
  6965. * @param v_intr_double_tap_u8 : The value of double tap enable
  6966. * value | interrupt enable
  6967. * ----------|-------------------
  6968. * 0x01 | BMI160_ENABLE
  6969. * 0x00 | BMI160_DISABLE
  6970. *
  6971. * @return results of bus communication function
  6972. * @retval 0 -> Success
  6973. * @retval -1 -> Error
  6974. *
  6975. *
  6976. */
  6977. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_double_tap(
  6978. u8 v_channel_u8, u8 v_intr_double_tap_u8);
  6979. /*!
  6980. * @brief Reads the Single Tap interrupt
  6981. * interrupt mapped to interrupt1
  6982. * and interrupt2 from the register 0x55 and 0x57
  6983. * @brief interrupt1 bit 5 in the register 0x55
  6984. * @brief interrupt2 bit 5 in the register 0x57
  6985. *
  6986. *
  6987. * @param v_channel_u8: The value of single tap interrupt selection
  6988. * v_channel_u8 | interrupt
  6989. * ---------------|---------------
  6990. * 0 | BMI160_INTR1_MAP_SINGLE_TAP
  6991. * 1 | BMI160_INTR2_MAP_SINGLE_TAP
  6992. *
  6993. * @param v_intr_single_tap_u8 : The value of single tap enable
  6994. * value | interrupt enable
  6995. * ----------|-------------------
  6996. * 0x01 | BMI160_ENABLE
  6997. * 0x00 | BMI160_DISABLE
  6998. *
  6999. *
  7000. * @return results of bus communication function
  7001. * @retval 0 -> Success
  7002. * @retval -1 -> Error
  7003. *
  7004. *
  7005. */
  7006. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_single_tap(
  7007. u8 v_channel_u8, u8 *v_intr_single_tap_u8);
  7008. /*!
  7009. * @brief Write the Single Tap interrupt
  7010. * interrupt mapped to interrupt1
  7011. * and interrupt2 from the register 0x55 and 0x57
  7012. * @brief interrupt1 bit 5 in the register 0x55
  7013. * @brief interrupt2 bit 5 in the register 0x57
  7014. *
  7015. *
  7016. * @param v_channel_u8: The value of single tap interrupt selection
  7017. * v_channel_u8 | interrupt
  7018. * ---------------|---------------
  7019. * 0 | BMI160_INTR1_MAP_SINGLE_TAP
  7020. * 1 | BMI160_INTR2_MAP_SINGLE_TAP
  7021. *
  7022. * @param v_intr_single_tap_u8 : The value of single tap enable
  7023. * value | interrupt enable
  7024. * ----------|-------------------
  7025. * 0x01 | BMI160_ENABLE
  7026. * 0x00 | BMI160_DISABLE
  7027. *
  7028. *
  7029. * @return results of bus communication function
  7030. * @retval 0 -> Success
  7031. * @retval -1 -> Error
  7032. *
  7033. *
  7034. */
  7035. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_single_tap(
  7036. u8 v_channel_u8, u8 v_intr_single_tap_u8);
  7037. /*!
  7038. * @brief Reads the Orient interrupt
  7039. * interrupt mapped to interrupt1
  7040. * and interrupt2 from the register 0x55 and 0x57
  7041. * @brief interrupt1 bit 6 in the register 0x55
  7042. * @brief interrupt2 bit 6 in the register 0x57
  7043. *
  7044. *
  7045. * @param v_channel_u8: The value of orient interrupt selection
  7046. * v_channel_u8 | interrupt
  7047. * ---------------|---------------
  7048. * 0 | BMI160_INTR1_MAP_ORIENT
  7049. * 1 | BMI160_INTR2_MAP_ORIENT
  7050. *
  7051. * @param v_intr_orient_u8 : The value of orient enable
  7052. * value | interrupt enable
  7053. * ----------|-------------------
  7054. * 0x01 | BMI160_ENABLE
  7055. * 0x00 | BMI160_DISABLE
  7056. *
  7057. *
  7058. *
  7059. * @return results of bus communication function
  7060. * @retval 0 -> Success
  7061. * @retval -1 -> Error
  7062. *
  7063. *
  7064. */
  7065. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_orient(
  7066. u8 v_channel_u8, u8 *v_intr_orient_u8);
  7067. /*!
  7068. * @brief Write the Orient interrupt
  7069. * interrupt mapped to interrupt1
  7070. * and interrupt2 from the register 0x55 and 0x57
  7071. * @brief interrupt1 bit 6 in the register 0x55
  7072. * @brief interrupt2 bit 6 in the register 0x57
  7073. *
  7074. *
  7075. * @param v_channel_u8: The value of orient interrupt selection
  7076. * v_channel_u8 | interrupt
  7077. * ---------------|---------------
  7078. * 0 | BMI160_INTR1_MAP_ORIENT
  7079. * 1 | BMI160_INTR2_MAP_ORIENT
  7080. *
  7081. * @param v_intr_orient_u8 : The value of orient enable
  7082. * value | interrupt enable
  7083. * ----------|-------------------
  7084. * 0x01 | BMI160_ENABLE
  7085. * 0x00 | BMI160_DISABLE
  7086. *
  7087. *
  7088. *
  7089. * @return results of bus communication function
  7090. * @retval 0 -> Success
  7091. * @retval -1 -> Error
  7092. *
  7093. *
  7094. */
  7095. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_orient(
  7096. u8 v_channel_u8, u8 v_intr_orient_u8);
  7097. /*!
  7098. * @brief Reads the Flat interrupt
  7099. * mapped to interrupt1
  7100. * and interrupt2 from the register 0x55 and 0x57
  7101. * @brief interrupt1 bit 7 in the register 0x55
  7102. * @brief interrupt2 bit 7 in the register 0x57
  7103. *
  7104. *
  7105. * @param v_channel_u8: The value of flat interrupt selection
  7106. * v_channel_u8 | interrupt
  7107. * ---------------|---------------
  7108. * 0 | BMI160_INTR1_MAP_FLAT
  7109. * 1 | BMI160_INTR2_MAP_FLAT
  7110. *
  7111. * @param v_intr_flat_u8 : The value of flat enable
  7112. * value | interrupt enable
  7113. * ----------|-------------------
  7114. * 0x01 | BMI160_ENABLE
  7115. * 0x00 | BMI160_DISABLE
  7116. *
  7117. *
  7118. * @return results of bus communication function
  7119. * @retval 0 -> Success
  7120. * @retval -1 -> Error
  7121. *
  7122. *
  7123. */
  7124. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_flat(
  7125. u8 v_channel_u8, u8 *v_intr_flat_u8);
  7126. /*!
  7127. * @brief Write the Flat interrupt
  7128. * mapped to interrupt1
  7129. * and interrupt2 from the register 0x55 and 0x57
  7130. * @brief interrupt1 bit 7 in the register 0x55
  7131. * @brief interrupt2 bit 7 in the register 0x57
  7132. *
  7133. *
  7134. * @param v_channel_u8: The value of flat interrupt selection
  7135. * v_channel_u8 | interrupt
  7136. * ---------------|---------------
  7137. * 0 | BMI160_INTR1_MAP_FLAT
  7138. * 1 | BMI160_INTR2_MAP_FLAT
  7139. *
  7140. * @param v_intr_flat_u8 : The value of flat enable
  7141. * value | interrupt enable
  7142. * ----------|-------------------
  7143. * 0x01 | BMI160_ENABLE
  7144. * 0x00 | BMI160_DISABLE
  7145. *
  7146. *
  7147. * @return results of bus communication function
  7148. * @retval 0 -> Success
  7149. * @retval -1 -> Error
  7150. *
  7151. *
  7152. */
  7153. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_flat(
  7154. u8 v_channel_u8, u8 v_intr_flat_u8);
  7155. /*!
  7156. * @brief Reads PMU trigger interrupt mapped to interrupt1
  7157. * and interrupt2 form the register 0x56 bit 0 and 4
  7158. * @brief interrupt1 bit 0 in the register 0x56
  7159. * @brief interrupt2 bit 4 in the register 0x56
  7160. *
  7161. *
  7162. * @param v_channel_u8: The value of pmu trigger selection
  7163. * v_channel_u8 | interrupt
  7164. * ---------------|---------------
  7165. * 0 | BMI160_INTR1_MAP_PMUTRIG
  7166. * 1 | BMI160_INTR2_MAP_PMUTRIG
  7167. *
  7168. * @param v_intr_pmu_trig_u8 : The value of pmu trigger enable
  7169. * value | interrupt enable
  7170. * ----------|-------------------
  7171. * 0x01 | BMI160_ENABLE
  7172. * 0x00 | BMI160_DISABLE
  7173. *
  7174. *
  7175. * @return results of bus communication function
  7176. * @retval 0 -> Success
  7177. * @retval -1 -> Error
  7178. *
  7179. *
  7180. */
  7181. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_pmu_trig(
  7182. u8 v_channel_u8, u8 *v_intr_pmu_trig_u8);
  7183. /*!
  7184. * @brief Write PMU trigger interrupt mapped to interrupt1
  7185. * and interrupt2 form the register 0x56 bit 0 and 4
  7186. * @brief interrupt1 bit 0 in the register 0x56
  7187. * @brief interrupt2 bit 4 in the register 0x56
  7188. *
  7189. *
  7190. * @param v_channel_u8: The value of pmu trigger selection
  7191. * v_channel_u8 | interrupt
  7192. * ---------------|---------------
  7193. * 0 | BMI160_INTR1_MAP_PMUTRIG
  7194. * 1 | BMI160_INTR2_MAP_PMUTRIG
  7195. *
  7196. * @param v_intr_pmu_trig_u8 : The value of pmu trigger enable
  7197. * value | trigger enable
  7198. * ----------|-------------------
  7199. * 0x01 | BMI160_ENABLE
  7200. * 0x00 | BMI160_DISABLE
  7201. *
  7202. *
  7203. * @return results of bus communication function
  7204. * @retval 0 -> Success
  7205. * @retval -1 -> Error
  7206. *
  7207. *
  7208. */
  7209. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_pmu_trig(
  7210. u8 v_channel_u8, u8 v_intr_pmu_trig_u8);
  7211. /*!
  7212. * @brief Reads FIFO Full interrupt mapped to interrupt1
  7213. * and interrupt2 form the register 0x56 bit 5 and 1
  7214. * @brief interrupt1 bit 5 in the register 0x56
  7215. * @brief interrupt2 bit 1 in the register 0x56
  7216. *
  7217. *
  7218. * @param v_channel_u8: The value of fifo full interrupt selection
  7219. * v_channel_u8 | interrupt
  7220. * ---------------|---------------
  7221. * 0 | BMI160_INTR1_MAP_FIFO_FULL
  7222. * 1 | BMI160_INTR2_MAP_FIFO_FULL
  7223. *
  7224. * @param v_intr_fifo_full_u8 : The value of fifo full interrupt enable
  7225. * value | interrupt enable
  7226. * ----------|-------------------
  7227. * 0x01 | BMI160_ENABLE
  7228. * 0x00 | BMI160_DISABLE
  7229. *
  7230. *
  7231. *
  7232. * @return results of bus communication function
  7233. * @retval 0 -> Success
  7234. * @retval -1 -> Error
  7235. *
  7236. *
  7237. */
  7238. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_fifo_full(
  7239. u8 v_channel_u8, u8 *v_intr_fifo_full_u8);
  7240. /*!
  7241. * @brief Write FIFO Full interrupt mapped to interrupt1
  7242. * and interrupt2 form the register 0x56 bit 5 and 1
  7243. * @brief interrupt1 bit 5 in the register 0x56
  7244. * @brief interrupt2 bit 1 in the register 0x56
  7245. *
  7246. *
  7247. * @param v_channel_u8: The value of fifo full interrupt selection
  7248. * v_channel_u8 | interrupt
  7249. * ---------------|---------------
  7250. * 0 | BMI160_INTR1_MAP_FIFO_FULL
  7251. * 1 | BMI160_INTR2_MAP_FIFO_FULL
  7252. *
  7253. * @param v_intr_fifo_full_u8 : The value of fifo full interrupt enable
  7254. * value | interrupt enable
  7255. * ----------|-------------------
  7256. * 0x01 | BMI160_ENABLE
  7257. * 0x00 | BMI160_DISABLE
  7258. *
  7259. *
  7260. *
  7261. * @return results of bus communication function
  7262. * @retval 0 -> Success
  7263. * @retval -1 -> Error
  7264. *
  7265. *
  7266. */
  7267. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_fifo_full(
  7268. u8 v_channel_u8, u8 v_intr_fifo_full_u8);
  7269. /*!
  7270. * @brief Reads FIFO Watermark interrupt mapped to interrupt1
  7271. * and interrupt2 form the register 0x56 bit 6 and 2
  7272. * @brief interrupt1 bit 6 in the register 0x56
  7273. * @brief interrupt2 bit 2 in the register 0x56
  7274. *
  7275. *
  7276. * @param v_channel_u8: The value of fifo Watermark interrupt selection
  7277. * v_channel_u8 | interrupt
  7278. * ---------------|---------------
  7279. * 0 | BMI160_INTR1_MAP_FIFO_WM
  7280. * 1 | BMI160_INTR2_MAP_FIFO_WM
  7281. *
  7282. * @param v_intr_fifo_wm_u8 : The value of fifo Watermark interrupt enable
  7283. * value | interrupt enable
  7284. * ----------|-------------------
  7285. * 0x01 | BMI160_ENABLE
  7286. * 0x00 | BMI160_DISABLE
  7287. *
  7288. *
  7289. *
  7290. *
  7291. * @return results of bus communication function
  7292. * @retval 0 -> Success
  7293. * @retval -1 -> Error
  7294. *
  7295. *
  7296. */
  7297. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_fifo_wm(
  7298. u8 v_channel_u8, u8 *v_intr_fifo_wm_u8);
  7299. /*!
  7300. * @brief Write FIFO Watermark interrupt mapped to interrupt1
  7301. * and interrupt2 form the register 0x56 bit 6 and 2
  7302. * @brief interrupt1 bit 6 in the register 0x56
  7303. * @brief interrupt2 bit 2 in the register 0x56
  7304. *
  7305. *
  7306. * @param v_channel_u8: The value of fifo Watermark interrupt selection
  7307. * v_channel_u8 | interrupt
  7308. * ---------------|---------------
  7309. * 0 | BMI160_INTR1_MAP_FIFO_WM
  7310. * 1 | BMI160_INTR2_MAP_FIFO_WM
  7311. *
  7312. * @param v_intr_fifo_wm_u8 : The value of fifo Watermark interrupt enable
  7313. * value | interrupt enable
  7314. * ----------|-------------------
  7315. * 0x01 | BMI160_ENABLE
  7316. * 0x00 | BMI160_DISABLE
  7317. *
  7318. *
  7319. *
  7320. *
  7321. * @return results of bus communication function
  7322. * @retval 0 -> Success
  7323. * @retval -1 -> Error
  7324. *
  7325. *
  7326. */
  7327. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_fifo_wm(
  7328. u8 v_channel_u8, u8 v_intr_fifo_wm_u8);
  7329. /*!
  7330. * @brief Reads Data Ready interrupt mapped to interrupt1
  7331. * and interrupt2 form the register 0x56
  7332. * @brief interrupt1 bit 7 in the register 0x56
  7333. * @brief interrupt2 bit 3 in the register 0x56
  7334. *
  7335. *
  7336. * @param v_channel_u8: The value of data ready interrupt selection
  7337. * v_channel_u8 | interrupt
  7338. * ---------------|---------------
  7339. * 0 | BMI160_INTR1_MAP_DATA_RDY
  7340. * 1 | BMI160_INTR2_MAP_DATA_RDY
  7341. *
  7342. * @param v_intr_data_rdy_u8 : The value of data ready interrupt enable
  7343. * value | interrupt enable
  7344. * ----------|-------------------
  7345. * 0x01 | BMI160_ENABLE
  7346. * 0x00 | BMI160_DISABLE
  7347. *
  7348. *
  7349. *
  7350. * @return results of bus communication function
  7351. * @retval 0 -> Success
  7352. * @retval -1 -> Error
  7353. *
  7354. *
  7355. */
  7356. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_data_rdy(
  7357. u8 v_channel_u8, u8 *v_intr_data_rdy_u8);
  7358. /*!
  7359. * @brief Write Data Ready interrupt mapped to interrupt1
  7360. * and interrupt2 form the register 0x56
  7361. * @brief interrupt1 bit 7 in the register 0x56
  7362. * @brief interrupt2 bit 3 in the register 0x56
  7363. *
  7364. *
  7365. * @param v_channel_u8: The value of data ready interrupt selection
  7366. * v_channel_u8 | interrupt
  7367. * ---------------|---------------
  7368. * 0 | BMI160_INTR1_MAP_DATA_RDY
  7369. * 1 | BMI160_INTR2_MAP_DATA_RDY
  7370. *
  7371. * @param v_intr_data_rdy_u8 : The value of data ready interrupt enable
  7372. * value | interrupt enable
  7373. * ----------|-------------------
  7374. * 0x01 | BMI160_ENABLE
  7375. * 0x00 | BMI160_DISABLE
  7376. *
  7377. *
  7378. *
  7379. * @return results of bus communication function
  7380. * @retval 0 -> Success
  7381. * @retval -1 -> Error
  7382. *
  7383. *
  7384. */
  7385. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_data_rdy(
  7386. u8 v_channel_u8, u8 v_intr_data_rdy_u8);
  7387. /***************************************************************/
  7388. /**\name FUNCTION FOR TAP SOURCE CONFIGURATION */
  7389. /***************************************************************/
  7390. /*!
  7391. * @brief This API reads data source for the interrupt
  7392. * engine for the single and double tap interrupts from the register
  7393. * 0x58 bit 3
  7394. *
  7395. *
  7396. * @param v_tap_source_u8 : The value of the tap source
  7397. * value | Description
  7398. * ----------|-------------------
  7399. * 0x01 | UNFILTER_DATA
  7400. * 0x00 | FILTER_DATA
  7401. *
  7402. *
  7403. * @return results of bus communication function
  7404. * @retval 0 -> Success
  7405. * @retval -1 -> Error
  7406. *
  7407. *
  7408. */
  7409. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_tap_source(
  7410. u8 *v_tap_source_u8);
  7411. /*!
  7412. * @brief This API write data source for the interrupt
  7413. * engine for the single and double tap interrupts from the register
  7414. * 0x58 bit 3
  7415. *
  7416. *
  7417. * @param v_tap_source_u8 : The value of the tap source
  7418. * value | Description
  7419. * ----------|-------------------
  7420. * 0x01 | UNFILTER_DATA
  7421. * 0x00 | FILTER_DATA
  7422. *
  7423. *
  7424. * @return results of bus communication function
  7425. * @retval 0 -> Success
  7426. * @retval -1 -> Error
  7427. *
  7428. *
  7429. */
  7430. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_tap_source(
  7431. u8 v_tap_source_u8);
  7432. /***************************************************************/
  7433. /**\name FUNCTION FOR LOW_G AND HIGH_G SOURCE CONFIGURATION */
  7434. /***************************************************************/
  7435. /*!
  7436. * @brief This API Reads Data source for the
  7437. * interrupt engine for the low and high g interrupts
  7438. * from the register 0x58 bit 7
  7439. *
  7440. * @param v_low_high_source_u8 : The value of the tap source
  7441. * value | Description
  7442. * ----------|-------------------
  7443. * 0x01 | UNFILTER_DATA
  7444. * 0x00 | FILTER_DATA
  7445. *
  7446. *
  7447. * @return results of bus communication function
  7448. * @retval 0 -> Success
  7449. * @retval -1 -> Error
  7450. *
  7451. *
  7452. */
  7453. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_low_high_source(
  7454. u8 *v_low_high_source_u8);
  7455. /*!
  7456. * @brief This API write Data source for the
  7457. * interrupt engine for the low and high g interrupts
  7458. * from the register 0x58 bit 7
  7459. *
  7460. * @param v_low_high_source_u8 : The value of the tap source
  7461. * value | Description
  7462. * ----------|-------------------
  7463. * 0x01 | UNFILTER_DATA
  7464. * 0x00 | FILTER_DATA
  7465. *
  7466. *
  7467. * @return results of bus communication function
  7468. * @retval 0 -> Success
  7469. * @retval -1 -> Error
  7470. *
  7471. *
  7472. */
  7473. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_low_high_source(
  7474. u8 v_low_high_source_u8);
  7475. /***************************************************************/
  7476. /**\name FUNCTION FOR MOTION SOURCE CONFIGURATION */
  7477. /***************************************************************/
  7478. /*!
  7479. * @brief This API reads Data source for the
  7480. * interrupt engine for the nomotion and anymotion interrupts
  7481. * from the register 0x59 bit 7
  7482. *
  7483. * @param v_motion_source_u8 :
  7484. * The value of the any/no motion interrupt source
  7485. * value | Description
  7486. * ----------|-------------------
  7487. * 0x01 | UNFILTER_DATA
  7488. * 0x00 | FILTER_DATA
  7489. *
  7490. * @return results of bus communication function
  7491. * @retval 0 -> Success
  7492. * @retval -1 -> Error
  7493. *
  7494. *
  7495. */
  7496. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_motion_source(
  7497. u8 *v_motion_source_u8);
  7498. /*!
  7499. * @brief This API write Data source for the
  7500. * interrupt engine for the nomotion and anymotion interrupts
  7501. * from the register 0x59 bit 7
  7502. *
  7503. * @param v_motion_source_u8 :
  7504. * The value of the any/no motion interrupt source
  7505. * value | Description
  7506. * ----------|-------------------
  7507. * 0x01 | UNFILTER_DATA
  7508. * 0x00 | FILTER_DATA
  7509. *
  7510. * @return results of bus communication function
  7511. * @retval 0 -> Success
  7512. * @retval -1 -> Error
  7513. *
  7514. *
  7515. */
  7516. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_motion_source(
  7517. u8 v_motion_source_u8);
  7518. /***************************************************************/
  7519. /**\name FUNCTION FOR LOW_G DURATION CONFIGURATION */
  7520. /***************************************************************/
  7521. /*!
  7522. * @brief This API is used to read the low_g duration from register
  7523. * 0x5A bit 0 to 7
  7524. *
  7525. *
  7526. *
  7527. *
  7528. * @param v_low_g_durn_u8 : The value of low_g duration
  7529. *
  7530. * @note Low_g duration trigger trigger delay according to
  7531. * "(v_low_g_durn_u8 * 2.5)ms" in a range from 2.5ms to 640ms.
  7532. * the default corresponds delay is 20ms
  7533. * @note When low_g data source of interrupt is unfiltered
  7534. * the sensor must not be in low power mode
  7535. *
  7536. * @return results of bus communication function
  7537. * @retval 0 -> Success
  7538. * @retval -1 -> Error
  7539. *
  7540. *
  7541. */
  7542. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_low_g_durn(
  7543. u8 *v_low_durn_u8);
  7544. /*!
  7545. * @brief This API is used to write the low_g duration from register
  7546. * 0x5A bit 0 to 7
  7547. *
  7548. *
  7549. *
  7550. *
  7551. * @param v_low_g_durn_u8 : The value of low_g duration
  7552. *
  7553. * @note Low_g duration trigger trigger delay according to
  7554. * "(v_low_g_durn_u8 * 2.5)ms" in a range from 2.5ms to 640ms.
  7555. * the default corresponds delay is 20ms
  7556. * @note When low_g data source of interrupt is unfiltered
  7557. * the sensor must not be in low power mode
  7558. *
  7559. * @return results of bus communication function
  7560. * @retval 0 -> Success
  7561. * @retval -1 -> Error
  7562. *
  7563. *
  7564. */
  7565. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_low_g_durn(
  7566. u8 v_low_durn_u8);
  7567. /***************************************************************/
  7568. /**\name FUNCTION FOR LOW_G THRESH CONFIGURATION */
  7569. /***************************************************************/
  7570. /*!
  7571. * @brief This API is used to read Threshold
  7572. * definition for the low-g interrupt from the register 0x5B bit 0 to 7
  7573. *
  7574. *
  7575. *
  7576. *
  7577. * @param v_low_g_thres_u8 : The value of low_g threshold
  7578. *
  7579. * @note Low_g interrupt trigger threshold according to
  7580. * (v_low_g_thres_u8 * 7.81)mg for v_low_g_thres_u8 > 0
  7581. * 3.91 mg for v_low_g_thres_u8 = 0
  7582. * The threshold range is form 3.91mg to 2.000mg
  7583. *
  7584. *
  7585. * @return results of bus communication function
  7586. * @retval 0 -> Success
  7587. * @retval -1 -> Error
  7588. *
  7589. *
  7590. */
  7591. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_low_g_thres(
  7592. u8 *v_low_g_thres_u8);
  7593. /*!
  7594. * @brief This API is used to write Threshold
  7595. * definition for the low-g interrupt from the register 0x5B bit 0 to 7
  7596. *
  7597. *
  7598. *
  7599. *
  7600. * @param v_low_g_thres_u8 : The value of low_g threshold
  7601. *
  7602. * @note Low_g interrupt trigger threshold according to
  7603. * (v_low_g_thres_u8 * 7.81)mg for v_low_g_thres_u8 > 0
  7604. * 3.91 mg for v_low_g_thres_u8 = 0
  7605. * The threshold range is form 3.91mg to 2.000mg
  7606. *
  7607. *
  7608. * @return results of bus communication function
  7609. * @retval 0 -> Success
  7610. * @retval -1 -> Error
  7611. *
  7612. *
  7613. */
  7614. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_low_g_thres(
  7615. u8 v_low_g_thres_u8);
  7616. /***************************************************************/
  7617. /**\name FUNCTION FOR LOW_G HYSTERESIS CONFIGURATION */
  7618. /***************************************************************/
  7619. /*!
  7620. * @brief This API Reads Low-g interrupt hysteresis
  7621. * from the register 0x5C bit 0 to 1
  7622. *
  7623. * @param v_low_hyst_u8 :The value of low_g hysteresis
  7624. *
  7625. * @note Low_g hysteresis calculated by v_low_hyst_u8*125 mg
  7626. *
  7627. * @return results of bus communication function
  7628. * @retval 0 -> Success
  7629. * @retval -1 -> Error
  7630. *
  7631. *
  7632. */
  7633. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_low_g_hyst(
  7634. u8 *v_low_hyst_u8);
  7635. /*!
  7636. * @brief This API write Low-g interrupt hysteresis
  7637. * from the register 0x5C bit 0 to 1
  7638. *
  7639. * @param v_low_hyst_u8 :The value of low_g hysteresis
  7640. *
  7641. * @note Low_g hysteresis calculated by v_low_hyst_u8*125 mg
  7642. *
  7643. * @return results of bus communication function
  7644. * @retval 0 -> Success
  7645. * @retval -1 -> Error
  7646. *
  7647. *
  7648. */
  7649. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_low_g_hyst(
  7650. u8 v_low_hyst_u8);
  7651. /***************************************************************/
  7652. /**\name FUNCTION FOR LOW_G MODE CONFIGURATION */
  7653. /***************************************************************/
  7654. /*!
  7655. * @brief This API reads Low-g interrupt mode
  7656. * from the register 0x5C bit 2
  7657. *
  7658. * @param v_low_g_mode_u8 : The value of low_g mode
  7659. * Value | Description
  7660. * ----------|-----------------
  7661. * 0 | single-axis
  7662. * 1 | axis-summing
  7663. *
  7664. *
  7665. * @return results of bus communication function
  7666. * @retval 0 -> Success
  7667. * @retval -1 -> Error
  7668. *
  7669. *
  7670. */
  7671. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_low_g_mode(
  7672. u8 *v_low_g_mode_u8);
  7673. /*!
  7674. * @brief This API write Low-g interrupt mode
  7675. * from the register 0x5C bit 2
  7676. *
  7677. * @param v_low_g_mode_u8 : The value of low_g mode
  7678. * Value | Description
  7679. * ----------|-----------------
  7680. * 0 | single-axis
  7681. * 1 | axis-summing
  7682. *
  7683. *
  7684. * @return results of bus communication function
  7685. * @retval 0 -> Success
  7686. * @retval -1 -> Error
  7687. *
  7688. *
  7689. */
  7690. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_low_g_mode(
  7691. u8 v_low_g_mode_u8);
  7692. /***************************************************************/
  7693. /**\name FUNCTION FOR HIGH_G HYST CONFIGURATION */
  7694. /***************************************************************/
  7695. /*!
  7696. * @brief This API reads High-g interrupt hysteresis
  7697. * from the register 0x5C bit 6 and 7
  7698. *
  7699. * @param v_high_g_hyst_u8 : The value of high hysteresis
  7700. *
  7701. * @note High_g hysteresis changes according to accel g range
  7702. * accel g range can be set by the function ""
  7703. * accel_range | high_g hysteresis
  7704. * ----------------|---------------------
  7705. * 2g | high_hy*125 mg
  7706. * 4g | high_hy*250 mg
  7707. * 8g | high_hy*500 mg
  7708. * 16g | high_hy*1000 mg
  7709. *
  7710. * @return results of bus communication function
  7711. * @retval 0 -> Success
  7712. * @retval -1 -> Error
  7713. *
  7714. *
  7715. */
  7716. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_high_g_hyst(
  7717. u8 *v_high_g_hyst_u8);
  7718. /*!
  7719. * @brief This API write High-g interrupt hysteresis
  7720. * from the register 0x5C bit 6 and 7
  7721. *
  7722. * @param v_high_g_hyst_u8 : The value of high hysteresis
  7723. *
  7724. * @note High_g hysteresis changes according to accel g range
  7725. * accel g range can be set by the function ""
  7726. * accel_range | high_g hysteresis
  7727. * ----------------|---------------------
  7728. * 2g | high_hy*125 mg
  7729. * 4g | high_hy*250 mg
  7730. * 8g | high_hy*500 mg
  7731. * 16g | high_hy*1000 mg
  7732. *
  7733. * @return results of bus communication function
  7734. * @retval 0 -> Success
  7735. * @retval -1 -> Error
  7736. *
  7737. *
  7738. */
  7739. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_high_g_hyst(
  7740. u8 v_high_g_hyst_u8);
  7741. /***************************************************************/
  7742. /**\name FUNCTION FOR HIGH_G DURATION CONFIGURATION */
  7743. /***************************************************************/
  7744. /*!
  7745. * @brief This API is used to read Delay
  7746. * time definition for the high-g interrupt from the register
  7747. * 0x5D bit 0 to 7
  7748. *
  7749. *
  7750. *
  7751. * @param v_high_g_durn_u8 : The value of high duration
  7752. *
  7753. * @note High_g interrupt delay triggered according to
  7754. * v_high_g_durn_u8 * 2.5ms in a range from 2.5ms to 640ms
  7755. *
  7756. * @return results of bus communication function
  7757. * @retval 0 -> Success
  7758. * @retval -1 -> Error
  7759. *
  7760. *
  7761. */
  7762. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_high_g_durn(
  7763. u8 *v_high_g_durn_u8);
  7764. /*!
  7765. * @brief This API is used to write Delay
  7766. * time definition for the high-g interrupt from the register
  7767. * 0x5D bit 0 to 7
  7768. *
  7769. *
  7770. *
  7771. * @param v_high_g_durn_u8 : The value of high duration
  7772. *
  7773. * @note High_g interrupt delay triggered according to
  7774. * v_high_g_durn_u8 * 2.5ms in a range from 2.5ms to 640ms
  7775. *
  7776. * @return results of bus communication function
  7777. * @retval 0 -> Success
  7778. * @retval -1 -> Error
  7779. *
  7780. *
  7781. */
  7782. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_high_g_durn(
  7783. u8 v_high_g_durn_u8);
  7784. /***************************************************************/
  7785. /**\name FUNCTION FOR HIGH_G THRESHOLD CONFIGURATION */
  7786. /***************************************************************/
  7787. /*!
  7788. * @brief This API is used to read Threshold
  7789. * definition for the high-g interrupt from the register 0x5E 0 to 7
  7790. *
  7791. *
  7792. *
  7793. *
  7794. * @param v_high_g_thres_u8 : Pointer holding the value of Threshold
  7795. * @note High_g threshold changes according to accel g range
  7796. * accel g range can be set by the function ""
  7797. * accel_range | high_g threshold
  7798. * ----------------|---------------------
  7799. * 2g | v_high_g_thres_u8*7.81 mg
  7800. * 4g | v_high_g_thres_u8*15.63 mg
  7801. * 8g | v_high_g_thres_u8*31.25 mg
  7802. * 16g | v_high_g_thres_u8*62.5 mg
  7803. * @note when v_high_g_thres_u8 = 0
  7804. * accel_range | high_g threshold
  7805. * ----------------|---------------------
  7806. * 2g | 3.91 mg
  7807. * 4g | 7.81 mg
  7808. * 8g | 15.63 mg
  7809. * 16g | 31.25 mg
  7810. *
  7811. *
  7812. * @return results of bus communication function
  7813. * @retval 0 -> Success
  7814. * @retval -1 -> Error
  7815. *
  7816. *
  7817. */
  7818. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_high_g_thres(
  7819. u8 *v_high_g_thres_u8);
  7820. /*!
  7821. * @brief This API is used to write Threshold
  7822. * definition for the high-g interrupt from the register 0x5E 0 to 7
  7823. *
  7824. *
  7825. *
  7826. *
  7827. * @param v_high_g_thres_u8 : Pointer holding the value of Threshold
  7828. * @note High_g threshold changes according to accel g range
  7829. * accel g range can be set by the function ""
  7830. * accel_range | high_g threshold
  7831. * ----------------|---------------------
  7832. * 2g | v_high_g_thres_u8*7.81 mg
  7833. * 4g | v_high_g_thres_u8*15.63 mg
  7834. * 8g | v_high_g_thres_u8*31.25 mg
  7835. * 16g | v_high_g_thres_u8*62.5 mg
  7836. * @note when v_high_g_thres_u8 = 0
  7837. * accel_range | high_g threshold
  7838. * ----------------|---------------------
  7839. * 2g | 3.91 mg
  7840. * 4g | 7.81 mg
  7841. * 8g | 15.63 mg
  7842. * 16g | 31.25 mg
  7843. *
  7844. *
  7845. * @return results of bus communication function
  7846. * @retval 0 -> Success
  7847. * @retval -1 -> Error
  7848. *
  7849. *
  7850. */
  7851. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_high_g_thres(
  7852. u8 v_high_g_thres_u8);
  7853. /***************************************************************/
  7854. /**\name FUNCTION FOR ANY MOTION DURATION CONFIGURATION */
  7855. /***************************************************************/
  7856. /*!
  7857. * @brief This API reads any motion duration
  7858. * from the register 0x5F bit 0 and 1
  7859. *
  7860. * @param v_any_motion_durn_u8 : The value of any motion duration
  7861. *
  7862. * @note Any motion duration can be calculated by "v_any_motion_durn_u8 + 1"
  7863. *
  7864. * @return results of bus communication function
  7865. * @retval 0 -> Success
  7866. * @retval -1 -> Error
  7867. *
  7868. *
  7869. */
  7870. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_any_motion_durn(
  7871. u8 *v_any_motion_durn_u8);
  7872. /*!
  7873. * @brief This API write any motion duration
  7874. * from the register 0x5F bit 0 and 1
  7875. *
  7876. * @param v_any_motion_durn_u8 : The value of any motion duration
  7877. *
  7878. * @note Any motion duration can be calculated by "v_any_motion_durn_u8 + 1"
  7879. *
  7880. * @return results of bus communication function
  7881. * @retval 0 -> Success
  7882. * @retval -1 -> Error
  7883. *
  7884. *
  7885. */
  7886. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_any_motion_durn(
  7887. u8 nomotion);
  7888. /***************************************************************/
  7889. /**\name FUNCTION FOR SLOW NO MOTION DURATION CONFIGURATION */
  7890. /***************************************************************/
  7891. /*!
  7892. * @brief This API read Slow/no-motion
  7893. * interrupt trigger delay duration from the register 0x5F bit 2 to 7
  7894. *
  7895. * @param v_slow_no_motion_u8 :The value of slow no motion duration
  7896. *
  7897. *
  7898. *
  7899. * @return results of bus communication function
  7900. * @retval 0 -> Success
  7901. * @retval -1 -> Error
  7902. *
  7903. * @note
  7904. * @note v_slow_no_motion_u8(5:4)=0b00 ->
  7905. * [v_slow_no_motion_u8(3:0) + 1] * 1.28s (1.28s-20.48s)
  7906. * @note v_slow_no_motion_u8(5:4)=1 ->
  7907. * [v_slow_no_motion_u8(3:0)+5] * 5.12s (25.6s-102.4s)
  7908. * @note v_slow_no_motion_u8(5)='1' ->
  7909. * [(v_slow_no_motion_u8:0)+11] * 10.24s (112.64s-430.08s);
  7910. *
  7911. */
  7912. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_slow_no_motion_durn(
  7913. u8 *v_slow_no_motion_u8);
  7914. /*!
  7915. * @brief This API write Slow/no-motion
  7916. * interrupt trigger delay duration from the register 0x5F bit 2 to 7
  7917. *
  7918. * @param v_slow_no_motion_u8 :The value of slow no motion duration
  7919. *
  7920. *
  7921. *
  7922. * @return results of bus communication function
  7923. * @retval 0 -> Success
  7924. * @retval -1 -> Error
  7925. *
  7926. * @note
  7927. * @note v_slow_no_motion_u8(5:4)=0b00 ->
  7928. * [v_slow_no_motion_u8(3:0) + 1] * 1.28s (1.28s-20.48s)
  7929. * @note v_slow_no_motion_u8(5:4)=1 ->
  7930. * [v_slow_no_motion_u8(3:0)+5] * 5.12s (25.6s-102.4s)
  7931. * @note v_slow_no_motion_u8(5)='1' ->
  7932. * [(v_slow_no_motion_u8:0)+11] * 10.24s (112.64s-430.08s);
  7933. *
  7934. */
  7935. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_slow_no_motion_durn(
  7936. u8 v_slow_no_motion_u8);
  7937. /***************************************************************/
  7938. /**\name FUNCTION FOR ANY MOTION THRESHOLD CONFIGURATION */
  7939. /***************************************************************/
  7940. /*!
  7941. * @brief This API is used to read threshold
  7942. * definition for the any-motion interrupt
  7943. * from the register 0x60 bit 0 to 7
  7944. *
  7945. *
  7946. * @param v_any_motion_thres_u8 : The value of any motion threshold
  7947. *
  7948. * @note any motion threshold changes according to accel g range
  7949. * accel g range can be set by the function ""
  7950. * accel_range | any motion threshold
  7951. * ----------------|---------------------
  7952. * 2g | v_any_motion_thres_u8*3.91 mg
  7953. * 4g | v_any_motion_thres_u8*7.81 mg
  7954. * 8g | v_any_motion_thres_u8*15.63 mg
  7955. * 16g | v_any_motion_thres_u8*31.25 mg
  7956. * @note when v_any_motion_thres_u8 = 0
  7957. * accel_range | any motion threshold
  7958. * ----------------|---------------------
  7959. * 2g | 1.95 mg
  7960. * 4g | 3.91 mg
  7961. * 8g | 7.81 mg
  7962. * 16g | 15.63 mg
  7963. *
  7964. *
  7965. * @return results of bus communication function
  7966. * @retval 0 -> Success
  7967. * @retval -1 -> Error
  7968. *
  7969. *
  7970. */
  7971. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_any_motion_thres(
  7972. u8 *v_any_motion_thres_u8);
  7973. /*!
  7974. * @brief This API is used to write threshold
  7975. * definition for the any-motion interrupt
  7976. * from the register 0x60 bit 0 to 7
  7977. *
  7978. *
  7979. * @param v_any_motion_thres_u8 : The value of any motion threshold
  7980. *
  7981. * @note any motion threshold changes according to accel g range
  7982. * accel g range can be set by the function ""
  7983. * accel_range | any motion threshold
  7984. * ----------------|---------------------
  7985. * 2g | v_any_motion_thres_u8*3.91 mg
  7986. * 4g | v_any_motion_thres_u8*7.81 mg
  7987. * 8g | v_any_motion_thres_u8*15.63 mg
  7988. * 16g | v_any_motion_thres_u8*31.25 mg
  7989. * @note when v_any_motion_thres_u8 = 0
  7990. * accel_range | any motion threshold
  7991. * ----------------|---------------------
  7992. * 2g | 1.95 mg
  7993. * 4g | 3.91 mg
  7994. * 8g | 7.81 mg
  7995. * 16g | 15.63 mg
  7996. *
  7997. *
  7998. * @return results of bus communication function
  7999. * @retval 0 -> Success
  8000. * @retval -1 -> Error
  8001. *
  8002. *
  8003. */
  8004. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_any_motion_thres(
  8005. u8 v_any_motion_thres_u8);
  8006. /***************************************************************/
  8007. /**\name FUNCTION FOR SLO/NO MOTION THRESHOLD CONFIGURATION */
  8008. /***************************************************************/
  8009. /*!
  8010. * @brief This API is used to read threshold
  8011. * for the slow/no-motion interrupt
  8012. * from the register 0x61 bit 0 to 7
  8013. *
  8014. *
  8015. *
  8016. *
  8017. * @param v_slow_no_motion_thres_u8 : The value of slow no motion threshold
  8018. * @note slow no motion threshold changes according to accel g range
  8019. * accel g range can be set by the function ""
  8020. * accel_range | slow no motion threshold
  8021. * ----------------|---------------------
  8022. * 2g | v_slow_no_motion_thres_u8*3.91 mg
  8023. * 4g | v_slow_no_motion_thres_u8*7.81 mg
  8024. * 8g | v_slow_no_motion_thres_u8*15.63 mg
  8025. * 16g | v_slow_no_motion_thres_u8*31.25 mg
  8026. * @note when v_slow_no_motion_thres_u8 = 0
  8027. * accel_range | slow no motion threshold
  8028. * ----------------|---------------------
  8029. * 2g | 1.95 mg
  8030. * 4g | 3.91 mg
  8031. * 8g | 7.81 mg
  8032. * 16g | 15.63 mg
  8033. *
  8034. *
  8035. * @return results of bus communication function
  8036. * @retval 0 -> Success
  8037. * @retval -1 -> Error
  8038. *
  8039. *
  8040. */
  8041. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_slow_no_motion_thres(
  8042. u8 *v_slow_no_motion_thres_u8);
  8043. /*!
  8044. * @brief This API is used to write threshold
  8045. * for the slow/no-motion interrupt
  8046. * from the register 0x61 bit 0 to 7
  8047. *
  8048. *
  8049. *
  8050. *
  8051. * @param v_slow_no_motion_thres_u8 : The value of slow no motion threshold
  8052. * @note slow no motion threshold changes according to accel g range
  8053. * accel g range can be set by the function ""
  8054. * accel_range | slow no motion threshold
  8055. * ----------------|---------------------
  8056. * 2g | v_slow_no_motion_thres_u8*3.91 mg
  8057. * 4g | v_slow_no_motion_thres_u8*7.81 mg
  8058. * 8g | v_slow_no_motion_thres_u8*15.63 mg
  8059. * 16g | v_slow_no_motion_thres_u8*31.25 mg
  8060. * @note when v_slow_no_motion_thres_u8 = 0
  8061. * accel_range | slow no motion threshold
  8062. * ----------------|---------------------
  8063. * 2g | 1.95 mg
  8064. * 4g | 3.91 mg
  8065. * 8g | 7.81 mg
  8066. * 16g | 15.63 mg
  8067. *
  8068. *
  8069. * @return results of bus communication function
  8070. * @retval 0 -> Success
  8071. * @retval -1 -> Error
  8072. *
  8073. *
  8074. */
  8075. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_slow_no_motion_thres(
  8076. u8 v_slow_no_motion_thres_u8);
  8077. /***************************************************************/
  8078. /**\name FUNCTION FOR SLO/NO MOTION SELECT CONFIGURATION */
  8079. /***************************************************************/
  8080. /*!
  8081. * @brief This API is used to read
  8082. * the slow/no-motion selection from the register 0x62 bit 0
  8083. *
  8084. *
  8085. *
  8086. *
  8087. * @param v_intr_slow_no_motion_select_u8 :
  8088. * The value of slow/no-motion select
  8089. * value | Behaviour
  8090. * ----------|-------------------
  8091. * 0x00 | SLOW_MOTION
  8092. * 0x01 | NO_MOTION
  8093. *
  8094. *
  8095. * @return results of bus communication function
  8096. * @retval 0 -> Success
  8097. * @retval -1 -> Error
  8098. *
  8099. *
  8100. */
  8101. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_slow_no_motion_select(
  8102. u8 *v_intr_slow_no_motion_select_u8);
  8103. /*!
  8104. * @brief This API is used to write
  8105. * the slow/no-motion selection from the register 0x62 bit 0
  8106. *
  8107. *
  8108. *
  8109. *
  8110. * @param v_intr_slow_no_motion_select_u8 :
  8111. * The value of slow/no-motion select
  8112. * value | Behaviour
  8113. * ----------|-------------------
  8114. * 0x00 | SLOW_MOTION
  8115. * 0x01 | NO_MOTION
  8116. *
  8117. *
  8118. * @return results of bus communication function
  8119. * @retval 0 -> Success
  8120. * @retval -1 -> Error
  8121. *
  8122. *
  8123. */
  8124. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_slow_no_motion_select(
  8125. u8 v_intr_slow_no_motion_select_u8);
  8126. /***************************************************************/
  8127. /**\name FUNCTION FOR SIGNIFICANT MOTION SELECT CONFIGURATION*/
  8128. /***************************************************************/
  8129. /*!
  8130. * @brief This API is used to select
  8131. * the significant or any motion interrupt from the register 0x62 bit 1
  8132. *
  8133. *
  8134. *
  8135. *
  8136. * @param v_intr_significant_motion_select_u8 :
  8137. * the value of significant or any motion interrupt selection
  8138. * value | Behaviour
  8139. * ----------|-------------------
  8140. * 0x00 | ANY_MOTION
  8141. * 0x01 | SIGNIFICANT_MOTION
  8142. *
  8143. *
  8144. * @return results of bus communication function
  8145. * @retval 0 -> Success
  8146. * @retval -1 -> Error
  8147. *
  8148. *
  8149. */
  8150. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_significant_motion_select(
  8151. u8 *int_sig_mot_sel);
  8152. /*!
  8153. * @brief This API is used to write, select
  8154. * the significant or any motion interrupt from the register 0x62 bit 1
  8155. *
  8156. *
  8157. *
  8158. *
  8159. * @param v_intr_significant_motion_select_u8 :
  8160. * the value of significant or any motion interrupt selection
  8161. * value | Behaviour
  8162. * ----------|-------------------
  8163. * 0x00 | ANY_MOTION
  8164. * 0x01 | SIGNIFICANT_MOTION
  8165. *
  8166. *
  8167. * @return results of bus communication function
  8168. * @retval 0 -> Success
  8169. * @retval -1 -> Error
  8170. *
  8171. *
  8172. */
  8173. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_significant_motion_select(
  8174. u8 int_sig_mot_sel);
  8175. /*!
  8176. * @brief This API is used to read
  8177. * the significant skip time from the register 0x62 bit 2 and 3
  8178. *
  8179. *
  8180. *
  8181. *
  8182. * @param v_int_sig_mot_skip_u8 : the value of significant skip time
  8183. * value | Behaviour
  8184. * ----------|-------------------
  8185. * 0x00 | skip time 1.5 seconds
  8186. * 0x01 | skip time 3 seconds
  8187. * 0x02 | skip time 6 seconds
  8188. * 0x03 | skip time 12 seconds
  8189. *
  8190. *
  8191. * @return results of bus communication function
  8192. * @retval 0 -> Success
  8193. * @retval -1 -> Error
  8194. *
  8195. *
  8196. */
  8197. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_significant_motion_skip(
  8198. u8 *v_int_sig_mot_skip_u8);
  8199. /*!
  8200. * @brief This API is used to write
  8201. * the significant skip time from the register 0x62 bit 2 and 3
  8202. *
  8203. *
  8204. *
  8205. *
  8206. * @param v_int_sig_mot_skip_u8 : the value of significant skip time
  8207. * value | Behaviour
  8208. * ----------|-------------------
  8209. * 0x00 | skip time 1.5 seconds
  8210. * 0x01 | skip time 3 seconds
  8211. * 0x02 | skip time 6 seconds
  8212. * 0x03 | skip time 12 seconds
  8213. *
  8214. *
  8215. * @return results of bus communication function
  8216. * @retval 0 -> Success
  8217. * @retval -1 -> Error
  8218. *
  8219. *
  8220. */
  8221. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_significant_motion_skip(
  8222. u8 v_int_sig_mot_skip_u8);
  8223. /*!
  8224. * @brief This API is used to read
  8225. * the significant proof time from the register 0x62 bit 4 and 5
  8226. *
  8227. *
  8228. *
  8229. *
  8230. * @param v_significant_motion_proof_u8 :
  8231. * the value of significant proof time
  8232. * value | Behaviour
  8233. * ----------|-------------------
  8234. * 0x00 | proof time 0.25 seconds
  8235. * 0x01 | proof time 0.5 seconds
  8236. * 0x02 | proof time 1 seconds
  8237. * 0x03 | proof time 2 seconds
  8238. *
  8239. *
  8240. * @return results of bus communication function
  8241. * @retval 0 -> Success
  8242. * @retval -1 -> Error
  8243. *
  8244. *
  8245. */
  8246. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_significant_motion_proof(
  8247. u8 *int_sig_mot_proof);
  8248. /*!
  8249. * @brief This API is used to write
  8250. * the significant proof time from the register 0x62 bit 4 and 5
  8251. *
  8252. *
  8253. *
  8254. *
  8255. * @param v_significant_motion_proof_u8 :
  8256. * the value of significant proof time
  8257. * value | Behaviour
  8258. * ----------|-------------------
  8259. * 0x00 | proof time 0.25 seconds
  8260. * 0x01 | proof time 0.5 seconds
  8261. * 0x02 | proof time 1 seconds
  8262. * 0x03 | proof time 2 seconds
  8263. *
  8264. *
  8265. * @return results of bus communication function
  8266. * @retval 0 -> Success
  8267. * @retval -1 -> Error
  8268. *
  8269. *
  8270. */
  8271. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_significant_motion_proof(
  8272. u8 int_sig_mot_proof);
  8273. /***************************************************************/
  8274. /**\name FUNCTION FOR TAP DURATION CONFIGURATION*/
  8275. /***************************************************************/
  8276. /*!
  8277. * @brief This API is used to get the tap duration
  8278. * from the register 0x63 bit 0 to 2
  8279. *
  8280. *
  8281. *
  8282. * @param v_tap_durn_u8 : The value of tap duration
  8283. * value | Behaviour
  8284. * ----------|-------------------
  8285. * 0x00 | BMI160_TAP_DURN_50MS
  8286. * 0x01 | BMI160_TAP_DURN_100MS
  8287. * 0x03 | BMI160_TAP_DURN_150MS
  8288. * 0x04 | BMI160_TAP_DURN_200MS
  8289. * 0x05 | BMI160_TAP_DURN_250MS
  8290. * 0x06 | BMI160_TAP_DURN_375MS
  8291. * 0x07 | BMI160_TAP_DURN_700MS
  8292. *
  8293. *
  8294. *
  8295. * @return results of bus communication function
  8296. * @retval 0 -> Success
  8297. * @retval -1 -> Error
  8298. *
  8299. *
  8300. */
  8301. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_tap_durn(
  8302. u8 *v_tap_durn_u8);
  8303. /*!
  8304. * @brief This API is used to write the tap duration
  8305. * from the register 0x63 bit 0 to 2
  8306. *
  8307. *
  8308. *
  8309. * @param v_tap_durn_u8 : The value of tap duration
  8310. * value | Behaviour
  8311. * ----------|-------------------
  8312. * 0x00 | BMI160_TAP_DURN_50MS
  8313. * 0x01 | BMI160_TAP_DURN_100MS
  8314. * 0x03 | BMI160_TAP_DURN_150MS
  8315. * 0x04 | BMI160_TAP_DURN_200MS
  8316. * 0x05 | BMI160_TAP_DURN_250MS
  8317. * 0x06 | BMI160_TAP_DURN_375MS
  8318. * 0x07 | BMI160_TAP_DURN_700MS
  8319. *
  8320. *
  8321. *
  8322. * @return results of bus communication function
  8323. * @retval 0 -> Success
  8324. * @retval -1 -> Error
  8325. *
  8326. *
  8327. */
  8328. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_tap_durn(
  8329. u8 v_tap_durn_u8);
  8330. /***************************************************************/
  8331. /**\name FUNCTION FOR TAP SHOCK CONFIGURATION*/
  8332. /***************************************************************/
  8333. /*!
  8334. * @brief This API read the
  8335. * tap shock duration from the register 0x63 bit 2
  8336. *
  8337. * @param v_tap_shock_u8 :The value of tap shock
  8338. * value | Behaviour
  8339. * ----------|-------------------
  8340. * 0x00 | BMI160_TAP_SHOCK_50MS
  8341. * 0x01 | BMI160_TAP_SHOCK_75MS
  8342. *
  8343. *
  8344. * @return results of bus communication function
  8345. * @retval 0 -> Success
  8346. * @retval -1 -> Error
  8347. *
  8348. *
  8349. */
  8350. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_tap_shock(
  8351. u8 *v_tap_shock_u8);
  8352. /*!
  8353. * @brief This API write the
  8354. * tap shock duration from the register 0x63 bit 2
  8355. *
  8356. * @param v_tap_shock_u8 :The value of tap shock
  8357. * value | Behaviour
  8358. * ----------|-------------------
  8359. * 0x00 | BMI160_TAP_SHOCK_50MS
  8360. * 0x01 | BMI160_TAP_SHOCK_75MS
  8361. *
  8362. *
  8363. * @return results of bus communication function
  8364. * @retval 0 -> Success
  8365. * @retval -1 -> Error
  8366. *
  8367. *
  8368. */
  8369. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_tap_shock(
  8370. u8 v_tap_shock_u8);
  8371. /***************************************************************/
  8372. /**\name FUNCTION FOR TAP QUIET CONFIGURATION*/
  8373. /***************************************************************/
  8374. /*!
  8375. * @brief This API read
  8376. * tap quiet duration from the register 0x63 bit 7
  8377. *
  8378. *
  8379. * @param v_tap_quiet_u8 : The value of tap quiet
  8380. * value | Behaviour
  8381. * ----------|-------------------
  8382. * 0x00 | BMI160_TAP_QUIET_30MS
  8383. * 0x01 | BMI160_TAP_QUIET_20MS
  8384. *
  8385. *
  8386. * @return results of bus communication function
  8387. * @retval 0 -> Success
  8388. * @retval -1 -> Error
  8389. *
  8390. *
  8391. */
  8392. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_tap_quiet(
  8393. u8 *v_tap_quiet_u8);
  8394. /*!
  8395. * @brief This API write
  8396. * tap quiet duration from the register 0x63 bit 7
  8397. *
  8398. *
  8399. * @param v_tap_quiet_u8 : The value of tap quiet
  8400. * value | Behaviour
  8401. * ----------|-------------------
  8402. * 0x00 | BMI160_TAP_QUIET_30MS
  8403. * 0x01 | BMI160_TAP_QUIET_20MS
  8404. *
  8405. *
  8406. * @return results of bus communication function
  8407. * @retval 0 -> Success
  8408. * @retval -1 -> Error
  8409. *
  8410. *
  8411. */
  8412. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_tap_quiet(
  8413. u8 v_tap_quiet_u8);
  8414. /***************************************************************/
  8415. /**\name FUNCTION FOR TAP THRESHOLD CONFIGURATION*/
  8416. /***************************************************************/
  8417. /*!
  8418. * @brief This API read Threshold of the
  8419. * single/double tap interrupt from the register 0x64 bit 0 to 4
  8420. *
  8421. *
  8422. * @param v_tap_thres_u8 : The value of single/double tap threshold
  8423. *
  8424. * @note single/double tap threshold changes according to accel g range
  8425. * accel g range can be set by the function ""
  8426. * accel_range | single/double tap threshold
  8427. * ----------------|---------------------
  8428. * 2g | ((v_tap_thres_u8 + 1) * 62.5)mg
  8429. * 4g | ((v_tap_thres_u8 + 1) * 125)mg
  8430. * 8g | ((v_tap_thres_u8 + 1) * 250)mg
  8431. * 16g | ((v_tap_thres_u8 + 1) * 500)mg
  8432. *
  8433. * @return results of bus communication function
  8434. * @retval 0 -> Success
  8435. * @retval -1 -> Error
  8436. *
  8437. *
  8438. */
  8439. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_tap_thres(
  8440. u8 *v_tap_thres_u8);
  8441. /*!
  8442. * @brief This API write Threshold of the
  8443. * single/double tap interrupt from the register 0x64 bit 0 to 4
  8444. *
  8445. *
  8446. * @param v_tap_thres_u8 : The value of single/double tap threshold
  8447. *
  8448. * @note single/double tap threshold changes according to accel g range
  8449. * accel g range can be set by the function ""
  8450. * accel_range | single/double tap threshold
  8451. * ----------------|---------------------
  8452. * 2g | ((v_tap_thres_u8 + 1) * 62.5)mg
  8453. * 4g | ((v_tap_thres_u8 + 1) * 125)mg
  8454. * 8g | ((v_tap_thres_u8 + 1) * 250)mg
  8455. * 16g | ((v_tap_thres_u8 + 1) * 500)mg
  8456. *
  8457. * @return results of bus communication function
  8458. * @retval 0 -> Success
  8459. * @retval -1 -> Error
  8460. *
  8461. *
  8462. */
  8463. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_tap_thres(
  8464. u8 v_tap_thres_u8);
  8465. /***************************************************************/
  8466. /**\name FUNCTION FOR ORIENT MODE CONFIGURATION*/
  8467. /***************************************************************/
  8468. /*!
  8469. * @brief This API read the threshold for orientation interrupt
  8470. * from the register 0x65 bit 0 and 1
  8471. *
  8472. * @param v_orient_mode_u8 : The value of threshold for orientation
  8473. * value | Behaviour
  8474. * ----------|-------------------
  8475. * 0x00 | symmetrical
  8476. * 0x01 | high-asymmetrical
  8477. * 0x02 | low-asymmetrical
  8478. * 0x03 | symmetrical
  8479. *
  8480. *
  8481. *
  8482. * @return results of bus communication function
  8483. * @retval 0 -> Success
  8484. * @retval -1 -> Error
  8485. *
  8486. *
  8487. */
  8488. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_orient_mode(
  8489. u8 *v_orient_mode_u8);
  8490. /*!
  8491. * @brief This API write the threshold for orientation interrupt
  8492. * from the register 0x65 bit 0 and 1
  8493. *
  8494. * @param v_orient_mode_u8 : The value of threshold for orientation
  8495. * value | Behaviour
  8496. * ----------|-------------------
  8497. * 0x00 | symmetrical
  8498. * 0x01 | high-asymmetrical
  8499. * 0x02 | low-asymmetrical
  8500. * 0x03 | symmetrical
  8501. *
  8502. *
  8503. *
  8504. * @return results of bus communication function
  8505. * @retval 0 -> Success
  8506. * @retval -1 -> Error
  8507. *
  8508. *
  8509. */
  8510. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_orient_mode(
  8511. u8 v_orient_mode_u8);
  8512. /***************************************************************/
  8513. /**\name FUNCTION FOR ORIENT BLOCKING CONFIGURATION*/
  8514. /***************************************************************/
  8515. /*!
  8516. * @brief This API read the orient blocking mode
  8517. * that is used for the generation of the orientation interrupt.
  8518. * from the register 0x65 bit 2 and 3
  8519. *
  8520. * @param v_orient_blocking_u8 : The value of orient blocking mode
  8521. * value | Behaviour
  8522. * ----------|-------------------
  8523. * 0x00 | No blocking
  8524. * 0x01 | Theta blocking or acceleration in any axis > 1.5g
  8525. * 0x02 | Theta blocking or acceleration slope in any axis >
  8526. * - | 0.2g or acceleration in any axis > 1.5g
  8527. * 0x03 | Theta blocking or acceleration slope in any axis >
  8528. * - | 0.4g or acceleration in any axis >
  8529. * - | 1.5g and value of orient is not stable
  8530. * - | for at least 100 ms
  8531. *
  8532. *
  8533. *
  8534. * @return results of bus communication function
  8535. * @retval 0 -> Success
  8536. * @retval -1 -> Error
  8537. *
  8538. *
  8539. */
  8540. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_orient_blocking(
  8541. u8 *v_orient_blocking_u8);
  8542. /*!
  8543. * @brief This API write the orient blocking mode
  8544. * that is used for the generation of the orientation interrupt.
  8545. * from the register 0x65 bit 2 and 3
  8546. *
  8547. * @param v_orient_blocking_u8 : The value of orient blocking mode
  8548. * value | Behaviour
  8549. * ----------|-------------------
  8550. * 0x00 | No blocking
  8551. * 0x01 | Theta blocking or acceleration in any axis > 1.5g
  8552. * 0x02 | Theta blocking or acceleration slope in any axis >
  8553. * - | 0.2g or acceleration in any axis > 1.5g
  8554. * 0x03 | Theta blocking or acceleration slope in any axis >
  8555. * - | 0.4g or acceleration in any axis >
  8556. * - | 1.5g and value of orient is not stable
  8557. * - | for at least 100 ms
  8558. *
  8559. *
  8560. *
  8561. * @return results of bus communication function
  8562. * @retval 0 -> Success
  8563. * @retval -1 -> Error
  8564. *
  8565. *
  8566. */
  8567. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_orient_blocking(
  8568. u8 v_orient_blocking_u8);
  8569. /***************************************************************/
  8570. /**\name FUNCTION FOR ORIENT HYSTERESIS CONFIGURATION*/
  8571. /***************************************************************/
  8572. /*!
  8573. * @brief This API read Orient interrupt
  8574. * hysteresis, from the register 0x64 bit 4 to 7
  8575. *
  8576. *
  8577. *
  8578. * @param v_orient_hyst_u8 : The value of orient hysteresis
  8579. *
  8580. * @note 1 LSB corresponds to 62.5 mg,
  8581. * irrespective of the selected accel range
  8582. *
  8583. *
  8584. * @return results of bus communication function
  8585. * @retval 0 -> Success
  8586. * @retval -1 -> Error
  8587. *
  8588. *
  8589. */
  8590. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_orient_hyst(
  8591. u8 *v_orient_hyst_u8);
  8592. /*!
  8593. * @brief This API write Orient interrupt
  8594. * hysteresis, from the register 0x64 bit 4 to 7
  8595. *
  8596. *
  8597. *
  8598. * @param v_orient_hyst_u8 : The value of orient hysteresis
  8599. *
  8600. * @note 1 LSB corresponds to 62.5 mg,
  8601. * irrespective of the selected accel range
  8602. *
  8603. *
  8604. * @return results of bus communication function
  8605. * @retval 0 -> Success
  8606. * @retval -1 -> Error
  8607. *
  8608. *
  8609. */
  8610. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_orient_hyst(
  8611. u8 v_orient_hyst_u8);
  8612. /***************************************************************/
  8613. /**\name FUNCTION FOR ORIENT THETA CONFIGURATION*/
  8614. /***************************************************************/
  8615. /*!
  8616. * @brief This API read Orient
  8617. * blocking angle (0 to 44.8) from the register 0x66 bit 0 to 5
  8618. *
  8619. * @param v_orient_theta_u8 : The value of Orient blocking angle
  8620. *
  8621. *
  8622. *
  8623. * @return results of bus communication function
  8624. * @retval 0 -> Success
  8625. * @retval -1 -> Error
  8626. *
  8627. *
  8628. */
  8629. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_orient_theta(
  8630. u8 *v_orient_theta_u8);
  8631. /*!
  8632. * @brief This API write Orient
  8633. * blocking angle (0 to 44.8) from the register 0x66 bit 0 to 5
  8634. *
  8635. * @param v_orient_theta_u8 : The value of Orient blocking angle
  8636. *
  8637. *
  8638. *
  8639. * @return results of bus communication function
  8640. * @retval 0 -> Success
  8641. * @retval -1 -> Error
  8642. *
  8643. *
  8644. */
  8645. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_orient_theta(
  8646. u8 v_orient_theta_u8);
  8647. /***************************************************************/
  8648. /**\name FUNCTION FOR ORIENT OUTPUT ENABLE CONFIGURATION*/
  8649. /***************************************************************/
  8650. /*!
  8651. * @brief This API read orient change
  8652. * of up/down bit from the register 0x66 bit 6
  8653. *
  8654. * @param v_orient_ud_u8 : The value of orient change of up/down
  8655. * value | Behaviour
  8656. * ----------|-------------------
  8657. * 0x00 | Is ignored
  8658. * 0x01 | Generates orientation interrupt
  8659. *
  8660. *
  8661. * @return results of bus communication function
  8662. * @retval 0 -> Success
  8663. * @retval -1 -> Error
  8664. *
  8665. *
  8666. */
  8667. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_orient_ud_enable(
  8668. u8 *v_orient_ud_u8);
  8669. /*!
  8670. * @brief This API write orient change
  8671. * of up/down bit from the register 0x66 bit 6
  8672. *
  8673. * @param v_orient_ud_u8 : The value of orient change of up/down
  8674. * value | Behaviour
  8675. * ----------|-------------------
  8676. * 0x00 | Is ignored
  8677. * 0x01 | Generates orientation interrupt
  8678. *
  8679. *
  8680. * @return results of bus communication function
  8681. * @retval 0 -> Success
  8682. * @retval -1 -> Error
  8683. *
  8684. *
  8685. */
  8686. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_orient_ud_enable(
  8687. u8 v_orient_ud_u8);
  8688. /***************************************************************/
  8689. /**\name FUNCTION FOR ORIENT AXIS ENABLE CONFIGURATION*/
  8690. /***************************************************************/
  8691. /*!
  8692. * @brief This API read orientation axes changes
  8693. * from the register 0x66 bit 7
  8694. *
  8695. * @param v_orient_axes_u8 : The value of orient axes assignment
  8696. * value | Behaviour | Name
  8697. * ----------|--------------------|------
  8698. * 0x00 | x = x, y = y, z = z|orient_ax_noex
  8699. * 0x01 | x = y, y = z, z = x|orient_ax_ex
  8700. *
  8701. *
  8702. * @return results of bus communication function
  8703. * @retval 0 -> Success
  8704. * @retval -1 -> Error
  8705. *
  8706. *
  8707. */
  8708. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_orient_axes_enable(
  8709. u8 *v_orient_axes_u8);
  8710. /*!
  8711. * @brief This API write orientation axes changes
  8712. * from the register 0x66 bit 7
  8713. *
  8714. * @param v_orient_axes_u8 : The value of orient axes assignment
  8715. * value | Behaviour | Name
  8716. * ----------|--------------------|------
  8717. * 0x00 | x = x, y = y, z = z|orient_ax_noex
  8718. * 0x01 | x = y, y = z, z = x|orient_ax_ex
  8719. *
  8720. *
  8721. * @return results of bus communication function
  8722. * @retval 0 -> Success
  8723. * @retval -1 -> Error
  8724. *
  8725. *
  8726. */
  8727. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_orient_axes_enable(
  8728. u8 v_orient_axes_u8);
  8729. /***************************************************************/
  8730. /**\name FUNCTION FOR FLAT THETA CONFIGURATION*/
  8731. /***************************************************************/
  8732. /*!
  8733. * @brief This API read Flat angle (0 to 44.8) for flat interrupt
  8734. * from the register 0x67 bit 0 to 5
  8735. *
  8736. * @param v_flat_theta_u8 : The value of flat angle
  8737. *
  8738. *
  8739. *
  8740. * @return results of bus communication function
  8741. * @retval 0 -> Success
  8742. * @retval -1 -> Error
  8743. *
  8744. *
  8745. */
  8746. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_flat_theta(
  8747. u8 *v_flat_theta_u8);
  8748. /*!
  8749. * @brief This API write Flat angle (0 to 44.8) for flat interrupt
  8750. * from the register 0x67 bit 0 to 5
  8751. *
  8752. * @param v_flat_theta_u8 : The value of flat angle
  8753. *
  8754. *
  8755. *
  8756. * @return results of bus communication function
  8757. * @retval 0 -> Success
  8758. * @retval -1 -> Error
  8759. *
  8760. *
  8761. */
  8762. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_flat_theta(
  8763. u8 v_flat_theta_u8);
  8764. /***************************************************************/
  8765. /**\name FUNCTION FOR FLAT HOLD CONFIGURATION*/
  8766. /***************************************************************/
  8767. /*!
  8768. * @brief This API read Flat interrupt hold time;
  8769. * from the register 0x68 bit 4 and 5
  8770. *
  8771. * @param v_flat_hold_u8 : The value of flat hold time
  8772. * value | Behaviour
  8773. * ----------|-------------------
  8774. * 0x00 | 0ms
  8775. * 0x01 | 512ms
  8776. * 0x01 | 1024ms
  8777. * 0x01 | 2048ms
  8778. *
  8779. *
  8780. * @return results of bus communication function
  8781. * @retval 0 -> Success
  8782. * @retval -1 -> Error
  8783. *
  8784. *
  8785. */
  8786. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_flat_hold(
  8787. u8 *v_flat_hold_u8);
  8788. /*!
  8789. * @brief This API write Flat interrupt hold time;
  8790. * from the register 0x68 bit 4 and 5
  8791. *
  8792. * @param v_flat_hold_u8 : The value of flat hold time
  8793. * value | Behaviour
  8794. * ----------|-------------------
  8795. * 0x00 | 0ms
  8796. * 0x01 | 512ms
  8797. * 0x01 | 1024ms
  8798. * 0x01 | 2048ms
  8799. *
  8800. *
  8801. * @return results of bus communication function
  8802. * @retval 0 -> Success
  8803. * @retval -1 -> Error
  8804. *
  8805. *
  8806. */
  8807. BMI160_RETURN_FUNCTION_TYPE bmi160_set_intr_flat_hold(
  8808. u8 v_flat_hold_u8);
  8809. /***************************************************************/
  8810. /**\name FUNCTION FOR FLAT HYSTERESIS CONFIGURATION*/
  8811. /***************************************************************/
  8812. /*!
  8813. * @brief This API read flat interrupt hysteresis
  8814. * from the register 0x68 bit 0 to 3
  8815. *
  8816. * @param v_flat_hyst_u8 : The value of flat hysteresis
  8817. *
  8818. *
  8819. *
  8820. * @return results of bus communication function
  8821. * @retval 0 -> Success
  8822. * @retval -1 -> Error
  8823. *
  8824. *
  8825. */
  8826. BMI160_RETURN_FUNCTION_TYPE bmi160_get_intr_flat_hyst(
  8827. u8 *v_flat_hyst_u8);
  8828. /*!
  8829. * @brief This API write flat interrupt hysteresis
  8830. * from the register 0x68 bit 0 to 3
  8831. *
  8832. * @param v_flat_hyst_u8 : The value of flat hysteresis
  8833. *
  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_flat_hyst(
  8843. u8 v_flat_hyst_u8);
  8844. /***************************************************************/
  8845. /**\name FUNCTION FAST OFFSET COMPENSATION FOR ACCEL */
  8846. /***************************************************************/
  8847. /*!
  8848. * @brief This API read accel offset compensation
  8849. * target value for z-axis from the register 0x69 bit 0 and 1
  8850. *
  8851. * @param v_foc_accel_z_u8 : the value of accel offset compensation z axis
  8852. * value | Behaviour
  8853. * ----------|-------------------
  8854. * 0x00 | disable
  8855. * 0x01 | +1g
  8856. * 0x01 | -1g
  8857. * 0x01 | 0g
  8858. *
  8859. * @return results of bus communication function
  8860. * @retval 0 -> Success
  8861. * @retval -1 -> Error
  8862. *
  8863. *
  8864. */
  8865. BMI160_RETURN_FUNCTION_TYPE bmi160_get_foc_accel_z(
  8866. u8 *v_foc_accel_z_u8);
  8867. /*!
  8868. * @brief This API write accel offset compensation
  8869. * target value for z-axis from the register 0x69 bit 0 and 1
  8870. *
  8871. * @param v_foc_accel_z_u8 : the value of accel offset compensation z axis
  8872. * value | Behaviour
  8873. * ----------|-------------------
  8874. * 0x00 | disable
  8875. * 0x01 | +1g
  8876. * 0x01 | -1g
  8877. * 0x01 | 0g
  8878. *
  8879. * @return results of bus communication function
  8880. * @retval 0 -> Success
  8881. * @retval -1 -> Error
  8882. *
  8883. *
  8884. */
  8885. BMI160_RETURN_FUNCTION_TYPE bmi160_set_foc_accel_z(
  8886. u8 v_foc_accel_z_u8);
  8887. /*!
  8888. * @brief This API read accel offset compensation
  8889. * target value for y-axis
  8890. * from the register 0x69 bit 2 and 3
  8891. *
  8892. * @param v_foc_accel_y_u8 : the value of accel offset compensation y axis
  8893. * value | Behaviour
  8894. * ----------|-------------------
  8895. * 0x00 | disable
  8896. * 0x01 | +1g
  8897. * 0x01 | -1g
  8898. * 0x01 | 0g
  8899. *
  8900. *
  8901. *
  8902. * @return results of bus communication function
  8903. * @retval 0 -> Success
  8904. * @retval -1 -> Error
  8905. *
  8906. *
  8907. */
  8908. BMI160_RETURN_FUNCTION_TYPE bmi160_get_foc_accel_y(
  8909. u8 *v_foc_accel_y_u8);
  8910. /*!
  8911. * @brief This API write accel offset compensation
  8912. * target value for y-axis
  8913. * from the register 0x69 bit 2 and 3
  8914. *
  8915. * @param v_foc_accel_y_u8 : the value of accel offset compensation y axis
  8916. * value | Behaviour
  8917. * ----------|-------------------
  8918. * 0x00 | disable
  8919. * 0x01 | +1g
  8920. * 0x01 | -1g
  8921. * 0x01 | 0g
  8922. *
  8923. *
  8924. *
  8925. * @return results of bus communication function
  8926. * @retval 0 -> Success
  8927. * @retval -1 -> Error
  8928. *
  8929. *
  8930. */
  8931. BMI160_RETURN_FUNCTION_TYPE bmi160_set_foc_accel_y(
  8932. u8 v_foc_accel_y_u8);
  8933. /*!
  8934. * @brief This API read accel offset compensation
  8935. * target value for x-axis is
  8936. * from the register 0x69 bit 4 and 5
  8937. *
  8938. * @param v_foc_accel_x_u8 : the value of accel offset compensation x axis
  8939. * value | Behaviour
  8940. * ----------|-------------------
  8941. * 0x00 | disable
  8942. * 0x01 | +1g
  8943. * 0x01 | -1g
  8944. * 0x01 | 0g
  8945. *
  8946. *
  8947. *
  8948. * @return results of bus communication function
  8949. * @retval 0 -> Success
  8950. * @retval -1 -> Error
  8951. *
  8952. *
  8953. */
  8954. BMI160_RETURN_FUNCTION_TYPE bmi160_get_foc_accel_x(
  8955. u8 *v_foc_accel_x_u8);
  8956. /*!
  8957. * @brief This API write accel offset compensation
  8958. * target value for x-axis is
  8959. * from the register 0x69 bit 4 and 5
  8960. *
  8961. * @param v_foc_accel_x_u8 : the value of accel offset compensation x axis
  8962. * value | Behaviour
  8963. * ----------|-------------------
  8964. * 0x00 | disable
  8965. * 0x01 | +1g
  8966. * 0x01 | -1g
  8967. * 0x01 | 0g
  8968. *
  8969. *
  8970. *
  8971. * @return results of bus communication function
  8972. * @retval 0 -> Success
  8973. * @retval -1 -> Error
  8974. *
  8975. *
  8976. */
  8977. BMI160_RETURN_FUNCTION_TYPE bmi160_set_foc_accel_x(
  8978. u8 v_foc_accel_x_u8);
  8979. /***************************************************************/
  8980. /**\name FUNCTION FAST OFFSET COMPENSATION FOR GYRO */
  8981. /***************************************************************/
  8982. /*!
  8983. * @brief This API write gyro fast offset enable
  8984. * from the register 0x69 bit 6
  8985. *
  8986. * @param v_foc_gyro_u8 : The value of gyro fast offset enable
  8987. * value | Description
  8988. * ----------|-------------
  8989. * 0 | fast offset compensation disabled
  8990. * 1 | fast offset compensation enabled
  8991. *
  8992. * @param v_gyro_off_x_s16 : The value of gyro fast offset x axis data
  8993. * @param v_gyro_off_y_s16 : The value of gyro fast offset y axis data
  8994. * @param v_gyro_off_z_s16 : The value of gyro fast offset z axis data
  8995. *
  8996. * @return results of bus communication function
  8997. * @retval 0 -> Success
  8998. * @retval -1 -> Error
  8999. *
  9000. *
  9001. */
  9002. BMI160_RETURN_FUNCTION_TYPE bmi160_set_foc_gyro_enable(
  9003. u8 v_foc_gyro_u8, s16 *v_gyro_off_x_s16,
  9004. s16 *v_gyro_off_y_s16, s16 *v_gyro_off_z_s16);
  9005. /***************************************************/
  9006. /**\name FUNCTION FOR NVM*/
  9007. /***************************************************/
  9008. /*!
  9009. * @brief This API read NVM program enable
  9010. * from the register 0x6A bit 1
  9011. *
  9012. * @param v_nvm_prog_u8 : The value of NVM program enable
  9013. * Value | Description
  9014. * --------|-------------
  9015. * 0 | DISABLE
  9016. * 1 | ENABLE
  9017. *
  9018. * @return results of bus communication function
  9019. * @retval 0 -> Success
  9020. * @retval -1 -> Error
  9021. *
  9022. *
  9023. */
  9024. BMI160_RETURN_FUNCTION_TYPE bmi160_get_nvm_prog_enable(
  9025. u8 *v_nvm_prog_u8);
  9026. /*!
  9027. * @brief This API write NVM program enable
  9028. * from the register 0x6A bit 1
  9029. *
  9030. * @param v_nvm_prog_u8 : The value of NVM program enable
  9031. * Value | Description
  9032. * --------|-------------
  9033. * 0 | DISABLE
  9034. * 1 | ENABLE
  9035. *
  9036. * @return results of bus communication function
  9037. * @retval 0 -> Success
  9038. * @retval -1 -> Error
  9039. *
  9040. *
  9041. */
  9042. BMI160_RETURN_FUNCTION_TYPE bmi160_set_nvm_prog_enable(
  9043. u8 v_nvm_prog_u8);
  9044. /***************************************************/
  9045. /**\name FUNCTION FOR SPI MODE*/
  9046. /***************************************************/
  9047. /*!
  9048. * @brief This API read to configure SPI
  9049. * Interface Mode for primary and OIS interface
  9050. * from the register 0x6B bit 0
  9051. *
  9052. * @param v_spi3_u8 : The value of SPI mode selection
  9053. * Value | Description
  9054. * --------|-------------
  9055. * 0 | SPI 4-wire mode
  9056. * 1 | SPI 3-wire mode
  9057. *
  9058. *
  9059. * @return results of bus communication function
  9060. * @retval 0 -> Success
  9061. * @retval -1 -> Error
  9062. *
  9063. *
  9064. */
  9065. BMI160_RETURN_FUNCTION_TYPE bmi160_get_spi3(
  9066. u8 *v_spi3_u8);
  9067. /*!
  9068. * @brief This API write to configure SPI
  9069. * Interface Mode for primary and OIS interface
  9070. * from the register 0x6B bit 0
  9071. *
  9072. * @param v_spi3_u8 : The value of SPI mode selection
  9073. * Value | Description
  9074. * --------|-------------
  9075. * 0 | SPI 4-wire mode
  9076. * 1 | SPI 3-wire mode
  9077. *
  9078. *
  9079. * @return results of bus communication function
  9080. * @retval 0 -> Success
  9081. * @retval -1 -> Error
  9082. *
  9083. *
  9084. */
  9085. BMI160_RETURN_FUNCTION_TYPE bmi160_set_spi3(
  9086. u8 v_spi3_u8);
  9087. /***************************************************/
  9088. /**\name FUNCTION FOR FOC GYRO */
  9089. /***************************************************/
  9090. /*!
  9091. * @brief This API read gyro fast offset enable
  9092. * from the register 0x69 bit 6
  9093. *
  9094. * @param v_foc_gyro_u8 : The value of gyro fast offset enable
  9095. * value | Description
  9096. * ----------|-------------
  9097. * 0 | fast offset compensation disabled
  9098. * 1 | fast offset compensation enabled
  9099. *
  9100. *
  9101. *
  9102. * @return results of bus communication function
  9103. * @retval 0 -> Success
  9104. * @retval -1 -> Error
  9105. *
  9106. *
  9107. */
  9108. BMI160_RETURN_FUNCTION_TYPE bmi160_get_foc_gyro_enable(
  9109. u8 *v_foc_gyro_u8);
  9110. /***************************************************/
  9111. /**\name FUNCTION FOR I2C WATCHDOG TIMBER */
  9112. /***************************************************/
  9113. /*!
  9114. * @brief This API read I2C Watchdog timer
  9115. * from the register 0x70 bit 1
  9116. *
  9117. * @param v_i2c_wdt_u8 : The value of I2C watch dog timer
  9118. * Value | Description
  9119. * --------|-------------
  9120. * 0 | I2C watchdog v_timeout_u8 after 1 ms
  9121. * 1 | I2C watchdog v_timeout_u8 after 50 ms
  9122. *
  9123. *
  9124. * @return results of bus communication function
  9125. * @retval 0 -> Success
  9126. * @retval -1 -> Error
  9127. *
  9128. *
  9129. */
  9130. BMI160_RETURN_FUNCTION_TYPE bmi160_get_i2c_wdt_select(
  9131. u8 *v_i2c_wdt_u8);
  9132. /*!
  9133. * @brief This API write I2C Watchdog timer
  9134. * from the register 0x70 bit 1
  9135. *
  9136. * @param v_i2c_wdt_u8 : The value of I2C watch dog timer
  9137. * Value | Description
  9138. * --------|-------------
  9139. * 0 | I2C watchdog v_timeout_u8 after 1 ms
  9140. * 1 | I2C watchdog v_timeout_u8 after 50 ms
  9141. *
  9142. *
  9143. * @return results of bus communication function
  9144. * @retval 0 -> Success
  9145. * @retval -1 -> Error
  9146. *
  9147. *
  9148. */
  9149. BMI160_RETURN_FUNCTION_TYPE
  9150. bmi160_set_i2c_wdt_select(u8 v_i2c_wdt_u8);
  9151. /*!
  9152. * @brief This API read I2C watchdog enable
  9153. * from the register 0x70 bit 2
  9154. *
  9155. * @param v_i2c_wdt_u8 : The value of I2C watchdog enable
  9156. * Value | Description
  9157. * --------|-------------
  9158. * 0 | DISABLE
  9159. * 1 | ENABLE
  9160. *
  9161. * @return results of bus communication function
  9162. * @retval 0 -> Success
  9163. * @retval -1 -> Error
  9164. *
  9165. *
  9166. */
  9167. BMI160_RETURN_FUNCTION_TYPE bmi160_get_i2c_wdt_enable(
  9168. u8 *v_i2c_wdt_u8);
  9169. /*!
  9170. * @brief This API write I2C watchdog enable
  9171. * from the register 0x70 bit 2
  9172. *
  9173. * @param v_i2c_wdt_u8 : The value of I2C watchdog enable
  9174. * Value | Description
  9175. * --------|-------------
  9176. * 0 | DISABLE
  9177. * 1 | ENABLE
  9178. *
  9179. * @return results of bus communication function
  9180. * @retval 0 -> Success
  9181. * @retval -1 -> Error
  9182. *
  9183. *
  9184. */
  9185. BMI160_RETURN_FUNCTION_TYPE bmi160_set_i2c_wdt_enable(
  9186. u8 v_i2c_wdt_u8);
  9187. /***************************************************/
  9188. /**\name FUNCTION FOR IF MODE*/
  9189. /***************************************************/
  9190. /*!
  9191. * @brief This API read I2C interface configuration(if) moe
  9192. * from the register 0x6B bit 4 and 5
  9193. *
  9194. * @param v_if_mode_u8 : The value of interface configuration mode
  9195. * Value | Description
  9196. * --------|-------------
  9197. * 0x00 | Primary interface:autoconfig / secondary interface:off
  9198. * 0x01 | Primary interface:I2C / secondary interface:OIS
  9199. * 0x02 | Primary interface:autoconfig/secondary interface:Magnetometer
  9200. * 0x03 | Reserved
  9201. *
  9202. *
  9203. * @return results of bus communication function
  9204. * @retval 0 -> Success
  9205. * @retval -1 -> Error
  9206. *
  9207. *
  9208. */
  9209. BMI160_RETURN_FUNCTION_TYPE bmi160_get_if_mode(
  9210. u8 *v_if_mode_u8);
  9211. /*!
  9212. * @brief This API write I2C interface configuration(if) moe
  9213. * from the register 0x6B bit 4 and 5
  9214. *
  9215. * @param v_if_mode_u8 : The value of interface configuration mode
  9216. * Value | Description
  9217. * --------|-------------
  9218. * 0x00 | Primary interface:autoconfig / secondary interface:off
  9219. * 0x01 | Primary interface:I2C / secondary interface:OIS
  9220. * 0x02 | Primary interface:autoconfig/secondary interface:Magnetometer
  9221. * 0x03 | Reserved
  9222. *
  9223. *
  9224. * @return results of bus communication function
  9225. * @retval 0 -> Success
  9226. * @retval -1 -> Error
  9227. *
  9228. *
  9229. */
  9230. BMI160_RETURN_FUNCTION_TYPE bmi160_set_if_mode(
  9231. u8 v_if_mode_u8);
  9232. /***************************************************/
  9233. /**\name FUNCTION FOR GYRO SLEEP TRIGGER INTERRUPT CONFIGURATION*/
  9234. /***************************************************/
  9235. /*!
  9236. * @brief This API read gyro sleep trigger
  9237. * from the register 0x6C bit 0 to 2
  9238. *
  9239. * @param v_gyro_sleep_trigger_u8 : The value of gyro sleep trigger
  9240. * Value | Description
  9241. * --------|-------------
  9242. * 0x00 | nomotion: no / Not INT1 pin: no / INT2 pin: no
  9243. * 0x01 | nomotion: no / Not INT1 pin: no / INT2 pin: yes
  9244. * 0x02 | nomotion: no / Not INT1 pin: yes / INT2 pin: no
  9245. * 0x03 | nomotion: no / Not INT1 pin: yes / INT2 pin: yes
  9246. * 0x04 | nomotion: yes / Not INT1 pin: no / INT2 pin: no
  9247. * 0x05 | anymotion: yes / Not INT1 pin: no / INT2 pin: yes
  9248. * 0x06 | anymotion: yes / Not INT1 pin: yes / INT2 pin: no
  9249. * 0x07 | anymotion: yes / Not INT1 pin: yes / INT2 pin: yes
  9250. *
  9251. *
  9252. *
  9253. * @return results of bus communication function
  9254. * @retval 0 -> Success
  9255. * @retval -1 -> Error
  9256. *
  9257. *
  9258. */
  9259. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_sleep_trigger(
  9260. u8 *v_gyro_sleep_trigger_u8);
  9261. /*!
  9262. * @brief This API write gyro sleep trigger
  9263. * from the register 0x6C bit 0 to 2
  9264. *
  9265. * @param v_gyro_sleep_trigger_u8 : The value of gyro sleep trigger
  9266. * Value | Description
  9267. * --------|-------------
  9268. * 0x00 | nomotion: no / Not INT1 pin: no / INT2 pin: no
  9269. * 0x01 | nomotion: no / Not INT1 pin: no / INT2 pin: yes
  9270. * 0x02 | nomotion: no / Not INT1 pin: yes / INT2 pin: no
  9271. * 0x03 | nomotion: no / Not INT1 pin: yes / INT2 pin: yes
  9272. * 0x04 | nomotion: yes / Not INT1 pin: no / INT2 pin: no
  9273. * 0x05 | anymotion: yes / Not INT1 pin: no / INT2 pin: yes
  9274. * 0x06 | anymotion: yes / Not INT1 pin: yes / INT2 pin: no
  9275. * 0x07 | anymotion: yes / Not INT1 pin: yes / INT2 pin: yes
  9276. *
  9277. *
  9278. *
  9279. * @return results of bus communication function
  9280. * @retval 0 -> Success
  9281. * @retval -1 -> Error
  9282. *
  9283. *
  9284. */
  9285. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_sleep_trigger(
  9286. u8 v_gyro_sleep_trigger_u8);
  9287. /*!
  9288. * @brief This API read gyro wakeup trigger
  9289. * from the register 0x6C bit 3 and 4
  9290. *
  9291. * @param v_gyro_wakeup_trigger_u8 : The value of gyro wakeup trigger
  9292. * Value | Description
  9293. * --------|-------------
  9294. * 0x00 | anymotion: no / INT1 pin: no
  9295. * 0x01 | anymotion: no / INT1 pin: yes
  9296. * 0x02 | anymotion: yes / INT1 pin: no
  9297. * 0x03 | anymotion: yes / INT1 pin: yes
  9298. *
  9299. *
  9300. * @return results of bus communication function
  9301. * @retval 0 -> Success
  9302. * @retval -1 -> Error
  9303. *
  9304. *
  9305. */
  9306. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_wakeup_trigger(
  9307. u8 *v_gyro_wakeup_trigger_u8);
  9308. /*!
  9309. * @brief This API write gyro wakeup trigger
  9310. * from the register 0x6C bit 3 and 4
  9311. *
  9312. * @param v_gyro_wakeup_trigger_u8 : The value of gyro wakeup trigger
  9313. * Value | Description
  9314. * --------|-------------
  9315. * 0x00 | anymotion: no / INT1 pin: no
  9316. * 0x01 | anymotion: no / INT1 pin: yes
  9317. * 0x02 | anymotion: yes / INT1 pin: no
  9318. * 0x03 | anymotion: yes / INT1 pin: yes
  9319. *
  9320. *
  9321. * @return results of bus communication function
  9322. * @retval 0 -> Success
  9323. * @retval -1 -> Error
  9324. *
  9325. *
  9326. */
  9327. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_wakeup_trigger(
  9328. u8 v_gyro_wakeup_trigger_u8);
  9329. /*!
  9330. * @brief This API read Target state for gyro sleep mode
  9331. * from the register 0x6C bit 5
  9332. *
  9333. * @param v_gyro_sleep_state_u8 : The value of gyro sleep mode
  9334. * Value | Description
  9335. * --------|-------------
  9336. * 0x00 | Sleep transition to fast wake up state
  9337. * 0x01 | Sleep transition to suspend state
  9338. *
  9339. *
  9340. * @return results of bus communication function
  9341. * @retval 0 -> Success
  9342. * @retval -1 -> Error
  9343. *
  9344. *
  9345. */
  9346. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_sleep_state(
  9347. u8 *v_gyro_sleep_state_u8);
  9348. /*!
  9349. * @brief This API write Target state for gyro sleep mode
  9350. * from the register 0x6C bit 5
  9351. *
  9352. * @param v_gyro_sleep_state_u8 : The value of gyro sleep mode
  9353. * Value | Description
  9354. * --------|-------------
  9355. * 0x00 | Sleep transition to fast wake up state
  9356. * 0x01 | Sleep transition to suspend state
  9357. *
  9358. *
  9359. * @return results of bus communication function
  9360. * @retval 0 -> Success
  9361. * @retval -1 -> Error
  9362. *
  9363. *
  9364. */
  9365. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_sleep_state(
  9366. u8 v_gyro_sleep_state_u8);
  9367. /*!
  9368. * @brief This API read gyro wakeup interrupt
  9369. * from the register 0x6C bit 6
  9370. *
  9371. * @param v_gyro_wakeup_intr_u8 : The valeu of gyro wakeup interrupt
  9372. * Value | Description
  9373. * --------|-------------
  9374. * 0x00 | DISABLE
  9375. * 0x01 | ENABLE
  9376. *
  9377. *
  9378. * @return results of bus communication function
  9379. * @retval 0 -> Success
  9380. * @retval -1 -> Error
  9381. *
  9382. *
  9383. */
  9384. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_wakeup_intr(
  9385. u8 *v_gyro_wakeup_intr_u8);
  9386. /*!
  9387. * @brief This API write gyro wakeup interrupt
  9388. * from the register 0x6C bit 6
  9389. *
  9390. * @param v_gyro_wakeup_intr_u8 : The valeu of gyro wakeup interrupt
  9391. * Value | Description
  9392. * --------|-------------
  9393. * 0x00 | DISABLE
  9394. * 0x01 | ENABLE
  9395. *
  9396. *
  9397. * @return results of bus communication function
  9398. * @retval 0 -> Success
  9399. * @retval -1 -> Error
  9400. *
  9401. *
  9402. */
  9403. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_wakeup_intr(
  9404. u8 v_gyro_wakeup_intr_u8);
  9405. /***************************************************/
  9406. /**\name FUNCTION FOR ACCEL SELF TEST */
  9407. /***************************************************/
  9408. /*!
  9409. * @brief This API read accel select axis to be self-test
  9410. *
  9411. * @param v_accel_selftest_axis_u8 :
  9412. * The value of accel self test axis selection
  9413. * Value | Description
  9414. * --------|-------------
  9415. * 0x00 | disabled
  9416. * 0x01 | x-axis
  9417. * 0x02 | y-axis
  9418. * 0x03 | z-axis
  9419. *
  9420. *
  9421. * @return results of bus communication function
  9422. * @retval 0 -> Success
  9423. * @retval -1 -> Error
  9424. *
  9425. *
  9426. */
  9427. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_selftest_axis(
  9428. u8 *acc_selftest_axis);
  9429. /*!
  9430. * @brief This API write accel select axis to be self-test
  9431. *
  9432. * @param v_accel_selftest_axis_u8 :
  9433. * The value of accel self test axis selection
  9434. * Value | Description
  9435. * --------|-------------
  9436. * 0x00 | disabled
  9437. * 0x01 | x-axis
  9438. * 0x02 | y-axis
  9439. * 0x03 | z-axis
  9440. *
  9441. *
  9442. * @return results of bus communication function
  9443. * @retval 0 -> Success
  9444. * @retval -1 -> Error
  9445. *
  9446. *
  9447. */
  9448. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_selftest_axis(
  9449. u8 acc_selftest_axis);
  9450. /*!
  9451. * @brief This API read accel self test axis sign
  9452. * from the register 0x6D bit 2
  9453. *
  9454. * @param v_accel_selftest_sign_u8: The value of accel self test axis sign
  9455. * Value | Description
  9456. * --------|-------------
  9457. * 0x00 | negative
  9458. * 0x01 | positive
  9459. *
  9460. *
  9461. * @return results of bus communication function
  9462. * @retval 0 -> Success
  9463. * @retval -1 -> Error
  9464. *
  9465. *
  9466. */
  9467. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_selftest_sign(
  9468. u8 *acc_selftest_sign);
  9469. /*!
  9470. * @brief This API write accel self test axis sign
  9471. * from the register 0x6D bit 2
  9472. *
  9473. * @param v_accel_selftest_sign_u8: The value of accel self test axis sign
  9474. * Value | Description
  9475. * --------|-------------
  9476. * 0x00 | negative
  9477. * 0x01 | positive
  9478. *
  9479. *
  9480. * @return results of bus communication function
  9481. * @retval 0 -> Success
  9482. * @retval -1 -> Error
  9483. *
  9484. *
  9485. */
  9486. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_selftest_sign(
  9487. u8 acc_selftest_sign);
  9488. /*!
  9489. * @brief This API read accel self test amplitude
  9490. * from the register 0x6D bit 3
  9491. * select amplitude of the selftest deflection:
  9492. *
  9493. * @param v_accel_selftest_amp_u8 : The value of accel self test amplitude
  9494. * Value | Description
  9495. * --------|-------------
  9496. * 0x00 | LOW
  9497. * 0x01 | HIGH
  9498. *
  9499. *
  9500. * @return results of bus communication function
  9501. * @retval 0 -> Success
  9502. * @retval -1 -> Error
  9503. *
  9504. *
  9505. */
  9506. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_selftest_amp(
  9507. u8 *acc_selftest_amp);
  9508. /*!
  9509. * @brief This API write accel self test amplitude
  9510. * from the register 0x6D bit 3
  9511. * select amplitude of the selftest deflection:
  9512. *
  9513. * @param v_accel_selftest_amp_u8 : The value of accel self test amplitude
  9514. * Value | Description
  9515. * --------|-------------
  9516. * 0x00 | LOW
  9517. * 0x01 | HIGH
  9518. *
  9519. *
  9520. * @return results of bus communication function
  9521. * @retval 0 -> Success
  9522. * @retval -1 -> Error
  9523. *
  9524. *
  9525. */
  9526. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_selftest_amp(
  9527. u8 acc_selftest_amp);
  9528. /***************************************************/
  9529. /**\name FUNCTION FOR GYRO SELF TEST */
  9530. /***************************************************/
  9531. /*!
  9532. * @brief This API read gyro self test trigger
  9533. *
  9534. * @param v_gyro_selftest_start_u8: The value of gyro self test start
  9535. *
  9536. * @return results of bus communication function
  9537. * @retval 0 -> Success
  9538. * @retval -1 -> Error
  9539. *
  9540. *
  9541. */
  9542. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_selftest_start(
  9543. u8 *v_gyro_selftest_start_u8);
  9544. /*!
  9545. * @brief This API write gyro self test trigger
  9546. *
  9547. * @param v_gyro_selftest_start_u8: The value of gyro self test start
  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_selftest_start(
  9556. u8 v_gyro_selftest_start_u8);
  9557. /***************************************************/
  9558. /**\name FUNCTION FOR SPI/I2C ENABLE */
  9559. /***************************************************/
  9560. /*!
  9561. * @brief This API read primary interface selection I2C or SPI
  9562. * from the register 0x70 bit 0
  9563. *
  9564. * @param v_spi_enable_u8: The value of Interface selection
  9565. * Value | Description
  9566. * --------|-------------
  9567. * 0x00 | I2C Enable
  9568. * 0x01 | I2C DISBALE
  9569. *
  9570. *
  9571. * @return results of bus communication function
  9572. * @retval 0 -> Success
  9573. * @retval -1 -> Error
  9574. *
  9575. *
  9576. */
  9577. BMI160_RETURN_FUNCTION_TYPE bmi160_get_spi_enable(
  9578. u8 *v_spi_enable_u8);
  9579. /*!
  9580. * @brief This API write primary interface selection I2C or SPI
  9581. * from the register 0x70 bit 0
  9582. *
  9583. * @param v_spi_enable_u8: The value of Interface selection
  9584. * Value | Description
  9585. * --------|-------------
  9586. * 0x00 | I2C Enable
  9587. * 0x01 | I2C DISBALE
  9588. *
  9589. *
  9590. * @return results of bus communication function
  9591. * @retval 0 -> Success
  9592. * @retval -1 -> Error
  9593. *
  9594. *
  9595. */
  9596. BMI160_RETURN_FUNCTION_TYPE bmi160_set_spi_enable(
  9597. u8 v_spi_enable_u8);
  9598. /*!
  9599. * @brief This API read the spare zero
  9600. * form register 0x70 bit 3
  9601. *
  9602. *
  9603. * @param v_spare0_trim_u8: The value of spare zero
  9604. *
  9605. *
  9606. *
  9607. * @return results of bus communication function
  9608. * @retval 0 -> Success
  9609. * @retval -1 -> Error
  9610. *
  9611. *
  9612. */
  9613. BMI160_RETURN_FUNCTION_TYPE bmi160_get_spare0_trim
  9614. (u8 *v_spare0_trim_u8);
  9615. /*!
  9616. * @brief This API write the spare zero
  9617. * form register 0x70 bit 3
  9618. *
  9619. *
  9620. * @param v_spare0_trim_u8: The value of spare zero
  9621. *
  9622. *
  9623. *
  9624. * @return results of bus communication function
  9625. * @retval 0 -> Success
  9626. * @retval -1 -> Error
  9627. *
  9628. *
  9629. */
  9630. BMI160_RETURN_FUNCTION_TYPE bmi160_set_spare0_trim
  9631. (u8 v_spare0_trim_u8);
  9632. /***************************************************/
  9633. /**\name FUNCTION FOR NVM COUNTER */
  9634. /***************************************************/
  9635. /*!
  9636. * @brief This API read the NVM counter
  9637. * form register 0x70 bit 4 to 7
  9638. *
  9639. *
  9640. * @param v_nvm_counter_u8: The value of NVM counter
  9641. *
  9642. *
  9643. *
  9644. * @return results of bus communication function
  9645. * @retval 0 -> Success
  9646. * @retval -1 -> Error
  9647. *
  9648. *
  9649. */
  9650. BMI160_RETURN_FUNCTION_TYPE bmi160_get_nvm_counter(
  9651. u8 *v_nvm_counter_u8);
  9652. /*!
  9653. * @brief This API write the NVM counter
  9654. * form register 0x70 bit 4 to 7
  9655. *
  9656. *
  9657. * @param v_nvm_counter_u8: The value of NVM counter
  9658. *
  9659. *
  9660. *
  9661. * @return results of bus communication function
  9662. * @retval 0 -> Success
  9663. * @retval -1 -> Error
  9664. *
  9665. *
  9666. */
  9667. BMI160_RETURN_FUNCTION_TYPE bmi160_set_nvm_counter(
  9668. u8 v_nvm_counter_u8);
  9669. /***************************************************/
  9670. /**\name FUNCTION FOR ACCEL MANUAL OFFSET COMPENSATION */
  9671. /***************************************************/
  9672. /*!
  9673. * @brief This API read accel manual offset compensation of x axis
  9674. * from the register 0x71 bit 0 to 7
  9675. *
  9676. *
  9677. *
  9678. * @param v_accel_off_x_s8:
  9679. * The value of accel manual offset compensation of x axis
  9680. *
  9681. *
  9682. *
  9683. * @return results of bus communication function
  9684. * @retval 0 -> Success
  9685. * @retval -1 -> Error
  9686. *
  9687. *
  9688. */
  9689. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_offset_compensation_xaxis(
  9690. s8 *v_accel_off_x_s8);
  9691. /*!
  9692. * @brief This API write accel manual offset compensation of x axis
  9693. * from the register 0x71 bit 0 to 7
  9694. *
  9695. *
  9696. *
  9697. * @param v_accel_off_x_s8:
  9698. * The value of accel manual offset compensation of x axis
  9699. *
  9700. *
  9701. *
  9702. * @return results of bus communication function
  9703. * @retval 0 -> Success
  9704. * @retval -1 -> Error
  9705. *
  9706. *
  9707. */
  9708. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_offset_compensation_xaxis(
  9709. s8 v_accel_off_x_s8);
  9710. /*!
  9711. * @brief This API read accel manual offset compensation of y axis
  9712. * from the register 0x72 bit 0 to 7
  9713. *
  9714. *
  9715. *
  9716. * @param v_accel_off_y_s8:
  9717. * The value of accel manual offset compensation of y axis
  9718. *
  9719. *
  9720. *
  9721. * @return results of bus communication function
  9722. * @retval 0 -> Success
  9723. * @retval -1 -> Error
  9724. *
  9725. *
  9726. */
  9727. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_offset_compensation_yaxis(
  9728. s8 *v_accel_off_y_s8);
  9729. /*!
  9730. * @brief This API write accel manual offset compensation of y axis
  9731. * from the register 0x72 bit 0 to 7
  9732. *
  9733. *
  9734. *
  9735. * @param v_accel_off_y_s8:
  9736. * The value of accel manual offset compensation of y axis
  9737. *
  9738. *
  9739. *
  9740. * @return results of bus communication function
  9741. * @retval 0 -> Success
  9742. * @retval -1 -> Error
  9743. *
  9744. *
  9745. */
  9746. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_offset_compensation_yaxis(
  9747. s8 v_accel_off_y_s8);
  9748. /*!
  9749. * @brief This API read accel manual offset compensation of z axis
  9750. * from the register 0x73 bit 0 to 7
  9751. *
  9752. *
  9753. *
  9754. * @param v_accel_off_z_s8:
  9755. * The value of accel manual offset compensation of z axis
  9756. *
  9757. *
  9758. *
  9759. * @return results of bus communication function
  9760. * @retval 0 -> Success
  9761. * @retval -1 -> Error
  9762. *
  9763. *
  9764. */
  9765. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_offset_compensation_zaxis(
  9766. s8 *v_accel_off_z_s8);
  9767. /*!
  9768. * @brief This API write accel manual offset compensation of z axis
  9769. * from the register 0x73 bit 0 to 7
  9770. *
  9771. *
  9772. *
  9773. * @param v_accel_off_z_s8:
  9774. * The value of accel manual offset compensation of z axis
  9775. *
  9776. *
  9777. *
  9778. * @return results of bus communication function
  9779. * @retval 0 -> Success
  9780. * @retval -1 -> Error
  9781. *
  9782. *
  9783. */
  9784. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_offset_compensation_zaxis(
  9785. s8 v_accel_off_z_s8);
  9786. /***************************************************/
  9787. /**\name FUNCTION FOR GYRO MANUAL OFFSET COMPENSATION */
  9788. /***************************************************/
  9789. /*!
  9790. * @brief This API read gyro manual offset compensation of x axis
  9791. * from the register 0x74 bit 0 to 7 and 0x77 bit 0 and 1
  9792. *
  9793. *
  9794. *
  9795. * @param v_gyro_off_x_s16:
  9796. * The value of gyro manual offset compensation of x axis
  9797. *
  9798. *
  9799. *
  9800. * @return results of bus communication function
  9801. * @retval 0 -> Success
  9802. * @retval -1 -> Error
  9803. *
  9804. *
  9805. */
  9806. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_offset_compensation_xaxis(
  9807. s16 *v_gyro_off_x_s16);
  9808. /*!
  9809. * @brief This API write gyro manual offset compensation of x axis
  9810. * from the register 0x74 bit 0 to 7 and 0x77 bit 0 and 1
  9811. *
  9812. *
  9813. *
  9814. * @param v_gyro_off_x_s16:
  9815. * The value of gyro manual offset compensation of x axis
  9816. *
  9817. *
  9818. *
  9819. * @return results of bus communication function
  9820. * @retval 0 -> Success
  9821. * @retval -1 -> Error
  9822. *
  9823. *
  9824. */
  9825. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_offset_compensation_xaxis(
  9826. s16 v_gyro_off_x_s16);
  9827. /*!
  9828. * @brief This API read gyro manual offset compensation of y axis
  9829. * from the register 0x75 bit 0 to 7 and 0x77 bit 2 and 3
  9830. *
  9831. *
  9832. *
  9833. * @param v_gyro_off_y_s16:
  9834. * The value of gyro manual offset compensation of y axis
  9835. *
  9836. *
  9837. *
  9838. * @return results of bus communication function
  9839. * @retval 0 -> Success
  9840. * @retval -1 -> Error
  9841. *
  9842. *
  9843. */
  9844. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_offset_compensation_yaxis(
  9845. s16 *v_gyro_off_y_s16);
  9846. /*!
  9847. * @brief This API write gyro manual offset compensation of y axis
  9848. * from the register 0x75 bit 0 to 7 and 0x77 bit 2 and 3
  9849. *
  9850. *
  9851. *
  9852. * @param v_gyro_off_y_s16:
  9853. * The value of gyro manual offset compensation of y axis
  9854. *
  9855. *
  9856. *
  9857. * @return results of bus communication function
  9858. * @retval 0 -> Success
  9859. * @retval -1 -> Error
  9860. *
  9861. *
  9862. */
  9863. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_offset_compensation_yaxis(
  9864. s16 v_gyro_off_y_s16);
  9865. /*!
  9866. * @brief This API read gyro manual offset compensation of z axis
  9867. * from the register 0x76 bit 0 to 7 and 0x77 bit 4 and 5
  9868. *
  9869. *
  9870. *
  9871. * @param v_gyro_off_z_s16:
  9872. * The value of gyro manual offset compensation of z axis
  9873. *
  9874. *
  9875. *
  9876. * @return results of bus communication function
  9877. * @retval 0 -> Success
  9878. * @retval -1 -> Error
  9879. *
  9880. *
  9881. */
  9882. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_offset_compensation_zaxis(
  9883. s16 *v_gyro_off_z_s16);
  9884. /*!
  9885. * @brief This API write gyro manual offset compensation of z axis
  9886. * from the register 0x76 bit 0 to 7 and 0x77 bit 4 and 5
  9887. *
  9888. *
  9889. *
  9890. * @param v_gyro_off_z_s16:
  9891. * The value of gyro manual offset compensation of z axis
  9892. *
  9893. *
  9894. *
  9895. * @return results of bus communication function
  9896. * @retval 0 -> Success
  9897. * @retval -1 -> Error
  9898. *
  9899. *
  9900. */
  9901. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_offset_compensation_zaxis(
  9902. s16 v_gyro_off_z_s16);
  9903. /*!
  9904. * @brief This API writes accel fast offset compensation
  9905. * from the register 0x69 bit 0 to 5
  9906. * @brief This API writes each axis individually
  9907. * FOC_X_AXIS - bit 4 and 5
  9908. * FOC_Y_AXIS - bit 2 and 3
  9909. * FOC_Z_AXIS - bit 0 and 1
  9910. *
  9911. * @param v_foc_accel_u8: The value of accel offset compensation
  9912. * value | Behaviour
  9913. * ----------|-------------------
  9914. * 0x00 | disable
  9915. * 0x01 | +1g
  9916. * 0x01 | -1g
  9917. * 0x01 | 0g
  9918. *
  9919. * @param v_axis_u8: The value of accel offset axis selection
  9920. * value | axis
  9921. * ----------|-------------------
  9922. * 0 | FOC_X_AXIS
  9923. * 1 | FOC_Y_AXIS
  9924. * 2 | FOC_Z_AXIS
  9925. *
  9926. * @param v_accel_offset_s8: The accel offset value
  9927. *
  9928. * @return results of bus communication function
  9929. * @retval 0 -> Success
  9930. * @retval -1 -> Error
  9931. *
  9932. *
  9933. */
  9934. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_foc_trigger(u8 axis,
  9935. u8 foc_acc, s8 *accel_offset);
  9936. /*!
  9937. * @brief This API write fast accel offset compensation
  9938. * it writes all axis together.To the register 0x69 bit 0 to 5
  9939. * FOC_X_AXIS - bit 4 and 5
  9940. * FOC_Y_AXIS - bit 2 and 3
  9941. * FOC_Z_AXIS - bit 0 and 1
  9942. *
  9943. * @param v_foc_accel_x_u8: The value of accel offset x compensation
  9944. * value | Behaviour
  9945. * ----------|-------------------
  9946. * 0x00 | disable
  9947. * 0x01 | +1g
  9948. * 0x01 | -1g
  9949. * 0x01 | 0g
  9950. *
  9951. * @param v_foc_accel_y_u8: The value of accel offset y compensation
  9952. * value | Behaviour
  9953. * ----------|-------------------
  9954. * 0x00 | disable
  9955. * 0x01 | +1g
  9956. * 0x01 | -1g
  9957. * 0x01 | 0g
  9958. *
  9959. * @param v_foc_accel_z_u8: The value of accel offset z compensation
  9960. * value | Behaviour
  9961. * ----------|-------------------
  9962. * 0x00 | disable
  9963. * 0x01 | +1g
  9964. * 0x01 | -1g
  9965. * 0x01 | 0g
  9966. *
  9967. * @param v_accel_off_x_s8: The value of accel offset x axis
  9968. * @param v_accel_off_y_s8: The value of accel offset y axis
  9969. * @param v_accel_off_z_s8: The value of accel offset z axis
  9970. *
  9971. *
  9972. * @return results of bus communication function
  9973. * @retval 0 -> Success
  9974. * @retval -1 -> Error
  9975. *
  9976. */
  9977. BMI160_RETURN_FUNCTION_TYPE bmi160_accel_foc_trigger_xyz(u8 v_foc_accel_x_u8,
  9978. u8 v_foc_accel_y_u8, u8 v_foc_accel_z_u8,
  9979. s8 *acc_off_x, s8 *acc_off_y, s8 *acc_off_z);
  9980. /***************************************************/
  9981. /**\name FUNCTION FOR ACEL AND GYRO OFFSET ENABLE */
  9982. /***************************************************/
  9983. /*!
  9984. * @brief This API read the accel offset enable bit
  9985. * from the register 0x77 bit 6
  9986. *
  9987. *
  9988. *
  9989. * @param v_accel_off_enable_u8: The value of accel offset enable
  9990. * value | Description
  9991. * ----------|--------------
  9992. * 0x01 | ENABLE
  9993. * 0x00 | DISABLE
  9994. *
  9995. *
  9996. * @return results of bus communication function
  9997. * @retval 0 -> Success
  9998. * @retval -1 -> Error
  9999. *
  10000. *
  10001. */
  10002. BMI160_RETURN_FUNCTION_TYPE bmi160_get_accel_offset_enable(
  10003. u8 *acc_off_en);
  10004. /*!
  10005. * @brief This API write the accel offset enable bit
  10006. * from the register 0x77 bit 6
  10007. *
  10008. *
  10009. *
  10010. * @param v_accel_off_enable_u8: The value of accel offset enable
  10011. * value | Description
  10012. * ----------|--------------
  10013. * 0x01 | ENABLE
  10014. * 0x00 | DISABLE
  10015. *
  10016. *
  10017. * @return results of bus communication function
  10018. * @retval 0 -> Success
  10019. * @retval -1 -> Error
  10020. *
  10021. *
  10022. */
  10023. BMI160_RETURN_FUNCTION_TYPE bmi160_set_accel_offset_enable(
  10024. u8 acc_off_en);
  10025. /*!
  10026. * @brief This API read the accel offset enable bit
  10027. * from the register 0x77 bit 7
  10028. *
  10029. *
  10030. *
  10031. * @param v_gyro_off_enable_u8: The value of gyro offset enable
  10032. * value | Description
  10033. * ----------|--------------
  10034. * 0x01 | ENABLE
  10035. * 0x00 | DISABLE
  10036. *
  10037. *
  10038. * @return results of bus communication function
  10039. * @retval 0 -> Success
  10040. * @retval -1 -> Error
  10041. *
  10042. *
  10043. */
  10044. BMI160_RETURN_FUNCTION_TYPE bmi160_get_gyro_offset_enable(
  10045. u8 *v_gyro_off_enable_u8);
  10046. /*!
  10047. * @brief This API write the accel offset enable bit
  10048. * from the register 0x77 bit 7
  10049. *
  10050. *
  10051. *
  10052. * @param v_gyro_off_enable_u8: The value of gyro offset enable
  10053. * value | Description
  10054. * ----------|--------------
  10055. * 0x01 | ENABLE
  10056. * 0x00 | DISABLE
  10057. *
  10058. *
  10059. * @return results of bus communication function
  10060. * @retval 0 -> Success
  10061. * @retval -1 -> Error
  10062. *
  10063. *
  10064. */
  10065. BMI160_RETURN_FUNCTION_TYPE bmi160_set_gyro_offset_enable(
  10066. u8 v_gyro_off_enable_u8);
  10067. /***************************************************/
  10068. /**\name FUNCTION FOR STEP COUNTER INTERRUPT */
  10069. /***************************************************/
  10070. /*!
  10071. * @brief This API reads step counter value
  10072. * form the register 0x78 and 0x79
  10073. *
  10074. *
  10075. *
  10076. *
  10077. * @param v_step_cnt_s16 : The value of step counter
  10078. *
  10079. *
  10080. *
  10081. * @return results of bus communication function
  10082. * @retval 0 -> Success
  10083. * @retval -1 -> Error
  10084. *
  10085. */
  10086. BMI160_RETURN_FUNCTION_TYPE bmi160_read_step_count(s16 *v_step_cnt_s16);
  10087. /*!
  10088. * @brief This API Reads
  10089. * step counter configuration
  10090. * from the register 0x7A bit 0 to 7
  10091. * and from the register 0x7B bit 0 to 2 and 4 to 7
  10092. *
  10093. *
  10094. * @param v_step_config_u16 : The value of step configuration
  10095. *
  10096. * @return results of bus communication function
  10097. * @retval 0 -> Success
  10098. * @retval -1 -> Error
  10099. *
  10100. *
  10101. */
  10102. BMI160_RETURN_FUNCTION_TYPE bmi160_get_step_config(
  10103. u16 *v_step_config_u16);
  10104. /*!
  10105. * @brief This API write
  10106. * step counter configuration
  10107. * from the register 0x7A bit 0 to 7
  10108. * and from the register 0x7B bit 0 to 2 and 4 to 7
  10109. *
  10110. *
  10111. * @param v_step_config_u16 :
  10112. * the value of Enable step configuration
  10113. *
  10114. * @return results of bus communication function
  10115. * @retval 0 -> Success
  10116. * @retval -1 -> Error
  10117. *
  10118. *
  10119. */
  10120. BMI160_RETURN_FUNCTION_TYPE bmi160_set_step_config(
  10121. u16 v_step_config_u16);
  10122. /*!
  10123. * @brief This API read enable step counter
  10124. * from the register 0x7B bit 3
  10125. *
  10126. *
  10127. * @param v_step_counter_u8 : The value of step counter enable
  10128. *
  10129. * @return results of bus communication function
  10130. * @retval 0 -> Success
  10131. * @retval -1 -> Error
  10132. *
  10133. *
  10134. */
  10135. BMI160_RETURN_FUNCTION_TYPE bmi160_get_step_counter_enable(
  10136. u8 *v_step_counter_u8);
  10137. /*!
  10138. * @brief This API write enable step counter
  10139. * from the register 0x7B bit 3
  10140. *
  10141. *
  10142. * @param v_step_counter_u8 : The value of step counter enable
  10143. *
  10144. * @return results of bus communication function
  10145. * @retval 0 -> Success
  10146. * @retval -1 -> Error
  10147. *
  10148. *
  10149. */
  10150. BMI160_RETURN_FUNCTION_TYPE bmi160_set_step_counter_enable(
  10151. u8 v_step_counter_u8);
  10152. /*!
  10153. * @brief This API set Step counter modes
  10154. *
  10155. *
  10156. * @param v_step_mode_u8 : The value of step counter mode
  10157. * value | mode
  10158. * ----------|-----------
  10159. * 0 | BMI160_STEP_NORMAL_MODE
  10160. * 1 | BMI160_STEP_SENSITIVE_MODE
  10161. * 2 | BMI160_STEP_ROBUST_MODE
  10162. *
  10163. * @return results of bus communication function
  10164. * @retval 0 -> Success
  10165. * @retval -1 -> Error
  10166. *
  10167. *
  10168. */
  10169. BMI160_RETURN_FUNCTION_TYPE bmi160_set_step_mode(u8 v_step_mode_u8);
  10170. /*!
  10171. * @brief This API used to trigger the signification motion
  10172. * interrupt
  10173. *
  10174. *
  10175. * @param v_significant_u8 : The value of interrupt selection
  10176. * value | interrupt
  10177. * ----------|-----------
  10178. * 0 | BMI160_MAP_INTR1
  10179. * 1 | BMI160_MAP_INTR2
  10180. *
  10181. * @return results of bus communication function
  10182. * @retval 0 -> Success
  10183. * @retval -1 -> Error
  10184. *
  10185. *
  10186. */
  10187. BMI160_RETURN_FUNCTION_TYPE bmi160_map_significant_motion_intr(
  10188. u8 v_significant_u8);
  10189. /*!
  10190. * @brief This API used to trigger the step detector
  10191. * interrupt
  10192. *
  10193. *
  10194. * @param v_step_detector_u8 : The value of interrupt selection
  10195. * value | interrupt
  10196. * ----------|-----------
  10197. * 0 | BMI160_MAP_INTR1
  10198. * 1 | BMI160_MAP_INTR2
  10199. *
  10200. * @return results of bus communication function
  10201. * @retval 0 -> Success
  10202. * @retval -1 -> Error
  10203. *
  10204. *
  10205. */
  10206. BMI160_RETURN_FUNCTION_TYPE bmi160_map_step_detector_intr(
  10207. u8 v_step_detector_u8);
  10208. /*!
  10209. * @brief This API used to clear the step counter interrupt
  10210. * interrupt
  10211. *
  10212. *
  10213. * @param : None
  10214. *
  10215. *
  10216. * @return results of bus communication function
  10217. * @retval 0 -> Success
  10218. * @retval -1 -> Error
  10219. *
  10220. *
  10221. */
  10222. BMI160_RETURN_FUNCTION_TYPE bmi160_clear_step_counter(void);
  10223. /***************************************************/
  10224. /**\name FUNCTION FOR STEP COMMAND REGISTER WRITE */
  10225. /***************************************************/
  10226. /*!
  10227. * @brief This API writes value to the register 0x7E bit 0 to 7
  10228. *
  10229. *
  10230. * @param v_command_reg_u8 : The value to write command register
  10231. * value | Description
  10232. * ---------|--------------------------------------------------------
  10233. * 0x00 | Reserved
  10234. * 0x03 | Starts fast offset calibration for the accel and gyro
  10235. * 0x10 | Sets the PMU mode for the Accelerometer to suspend
  10236. * 0x11 | Sets the PMU mode for the Accelerometer to normal
  10237. * 0x12 | Sets the PMU mode for the Accelerometer Lowpower
  10238. * 0x14 | Sets the PMU mode for the Gyroscope to suspend
  10239. * 0x15 | Sets the PMU mode for the Gyroscope to normal
  10240. * 0x16 | Reserved
  10241. * 0x17 | Sets the PMU mode for the Gyroscope to fast start-up
  10242. * 0x18 | Sets the PMU mode for the Magnetometer to suspend
  10243. * 0x19 | Sets the PMU mode for the Magnetometer to normal
  10244. * 0x1A | Sets the PMU mode for the Magnetometer to Lowpower
  10245. * 0xB0 | Clears all data in the FIFO
  10246. * 0xB1 | Resets the interrupt engine
  10247. * 0xB2 | step_cnt_clr Clears the step counter
  10248. * 0xB6 | Triggers a reset
  10249. * 0x37 | See extmode_en_last
  10250. * 0x9A | See extmode_en_last
  10251. * 0xC0 | Enable the extended mode
  10252. * 0xC4 | Erase NVM cell
  10253. * 0xC8 | Load NVM cell
  10254. * 0xF0 | Reset acceleration data path
  10255. *
  10256. *
  10257. *
  10258. * @return results of bus communication function
  10259. * @retval 0 -> Success
  10260. * @retval -1 -> Error
  10261. *
  10262. *
  10263. */
  10264. BMI160_RETURN_FUNCTION_TYPE bmi160_set_command_register(
  10265. u8 v_command_reg_u8);
  10266. /***************************************************/
  10267. /**\name FUNCTION FOR PAGE ENABLE */
  10268. /***************************************************/
  10269. /*!
  10270. * @brief This API read target page from the register 0x7F bit 4 and 5
  10271. *
  10272. * @param v_target_page_u8: The value of target page
  10273. * value | page
  10274. * ---------|-----------
  10275. * 0 | User data/configure page
  10276. * 1 | Chip level trim/test page
  10277. *
  10278. * @return results of bus communication function
  10279. * @retval 0 -> Success
  10280. * @retval -1 -> Error
  10281. *
  10282. *
  10283. */
  10284. BMI160_RETURN_FUNCTION_TYPE bmi160_get_target_page(
  10285. u8 *v_target_page_u8);
  10286. /*!
  10287. * @brief This API write target page from the register 0x7F bit 4 and 5
  10288. *
  10289. * @param v_target_page_u8: The value of target page
  10290. * value | page
  10291. * ---------|-----------
  10292. * 0 | User data/configure page
  10293. * 1 | Chip level trim/test page
  10294. *
  10295. * @return results of bus communication function
  10296. * @retval 0 -> Success
  10297. * @retval -1 -> Error
  10298. *
  10299. *
  10300. */
  10301. BMI160_RETURN_FUNCTION_TYPE bmi160_set_target_page(
  10302. u8 v_target_page_u8);
  10303. /*!
  10304. * @brief This API read page enable from the register 0x7F bit 7
  10305. *
  10306. *
  10307. *
  10308. * @param v_page_enable_u8: The value of page enable
  10309. * value | page
  10310. * ---------|-----------
  10311. * 0 | DISABLE
  10312. * 1 | ENABLE
  10313. *
  10314. *
  10315. *
  10316. * @return results of bus communication function
  10317. * @retval 0 -> Success
  10318. * @retval -1 -> Error
  10319. *
  10320. *
  10321. */
  10322. BMI160_RETURN_FUNCTION_TYPE bmi160_get_paging_enable(
  10323. u8 *v_page_enable_u8);
  10324. /*!
  10325. * @brief This API write page enable from the register 0x7F bit 7
  10326. *
  10327. *
  10328. *
  10329. * @param v_page_enable_u8: The value of page enable
  10330. * value | page
  10331. * ---------|-----------
  10332. * 0 | DISABLE
  10333. * 1 | ENABLE
  10334. *
  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_set_paging_enable(
  10344. u8 v_page_enable_u8);
  10345. /*!
  10346. * @brief This API read
  10347. * pull up configuration from the register 0X85 bit 4 an 5
  10348. *
  10349. *
  10350. *
  10351. * @param v_control_pullup_u8: The value of pull up register
  10352. *
  10353. *
  10354. *
  10355. * @return results of bus communication function
  10356. * @retval 0 -> Success
  10357. * @retval -1 -> Error
  10358. *
  10359. *
  10360. */
  10361. BMI160_RETURN_FUNCTION_TYPE bmi160_get_pullup_configuration(
  10362. u8 *v_control_pullup_u8);
  10363. /*!
  10364. * @brief This API write
  10365. * pull up configuration from the register 0X85 bit 4 an 5
  10366. *
  10367. *
  10368. *
  10369. * @param v_control_pullup_u8: The value of pull up register
  10370. *
  10371. *
  10372. *
  10373. * @return results of bus communication function
  10374. * @retval 0 -> Success
  10375. * @retval -1 -> Error
  10376. *
  10377. *
  10378. */
  10379. BMI160_RETURN_FUNCTION_TYPE bmi160_set_pullup_configuration(
  10380. u8 v_control_pullup_u8);
  10381. /***************************************************/
  10382. /**\name FUNCTION FOR BMM150 */
  10383. /***************************************************/
  10384. /*!
  10385. * @brief This function used for initialize the bmm150 sensor
  10386. *
  10387. *
  10388. * @return results of bus communication function
  10389. * @retval 0 -> Success
  10390. * @retval -1 -> Error
  10391. *
  10392. *
  10393. */
  10394. BMI160_RETURN_FUNCTION_TYPE bmi160_bmm150_mag_interface_init(void);
  10395. /*!
  10396. * @brief This function used for set the mag power control
  10397. * bit enable
  10398. *
  10399. *
  10400. * @return results of bus communication function
  10401. * @retval 0 -> Success
  10402. * @retval -1 -> Error
  10403. *
  10404. *
  10405. */
  10406. BMI160_RETURN_FUNCTION_TYPE bmi160_bmm150_mag_wakeup(void);
  10407. /*!
  10408. * @brief This function used for read the trim values of magnetometer
  10409. *
  10410. * @note
  10411. * Before reading the mag trimming values
  10412. * make sure the following two points are addressed
  10413. * @note
  10414. * 1. Make sure the mag interface is enabled or not,
  10415. * by using the bmi160_get_if_mode() function.
  10416. * If mag interface is not enabled set the value of 0x02
  10417. * to the function bmi160_get_if_mode(0x02)
  10418. * @note
  10419. * 2. And also confirm the secondary-interface power mode
  10420. * is not in the SUSPEND mode.
  10421. * by using the function bmi160_get_mag_pmu_status().
  10422. * If the secondary-interface power mode is in SUSPEND mode
  10423. * set the value of 0x19(NORMAL mode)by using the
  10424. * bmi160_set_command_register(0x19) function.
  10425. *
  10426. * @return results of bus communication function
  10427. * @retval 0 -> Success
  10428. * @retval -1 -> Error
  10429. *
  10430. *
  10431. */
  10432. BMI160_RETURN_FUNCTION_TYPE bmi160_read_bmm150_mag_trim(void);
  10433. /*!
  10434. * @brief This function used for read the compensated value of mag
  10435. * Before start reading the mag compensated data's
  10436. * make sure the following two points are addressed
  10437. * @note
  10438. * 1. Make sure the mag interface is enabled or not,
  10439. * by using the bmi160_get_if_mode() function.
  10440. * If mag interface is not enabled set the value of 0x02
  10441. * to the function bmi160_get_if_mode(0x02)
  10442. * @note
  10443. * 2. And also confirm the secondary-interface power mode
  10444. * is not in the SUSPEND mode.
  10445. * by using the function bmi160_get_mag_pmu_status().
  10446. * If the secondary-interface power mode is in SUSPEND mode
  10447. * set the value of 0x19(NORMAL mode)by using the
  10448. * bmi160_set_command_register(0x19) function.
  10449. *
  10450. * @return results of bus communication function
  10451. * @retval 0 -> Success
  10452. * @retval -1 -> Error
  10453. *
  10454. *
  10455. */
  10456. BMI160_RETURN_FUNCTION_TYPE bmi160_bmm150_mag_compensate_xyz(
  10457. struct bmi160_mag_xyz_s32_t *mag_comp_xyz);
  10458. /*!
  10459. * @brief This API used to get the compensated BMM150-X data
  10460. * the out put of X as s32
  10461. * Before start reading the mag compensated X data
  10462. * make sure the following two points are addressed
  10463. * @note
  10464. * 1. Make sure the mag interface is enabled or not,
  10465. * by using the bmi160_get_if_mode() function.
  10466. * If mag interface is not enabled set the value of 0x02
  10467. * to the function bmi160_get_if_mode(0x02)
  10468. * @note
  10469. * 2. And also confirm the secondary-interface power mode
  10470. * is not in the SUSPEND mode.
  10471. * by using the function bmi160_get_mag_pmu_status().
  10472. * If the secondary-interface power mode is in SUSPEND mode
  10473. * set the value of 0x19(NORMAL mode)by using the
  10474. * bmi160_set_command_register(0x19) function.
  10475. *
  10476. *
  10477. *
  10478. * @param v_mag_data_x_s16 : The value of mag raw X data
  10479. * @param v_data_r_u16 : The value of mag R data
  10480. *
  10481. * @return results of compensated X data value output as s32
  10482. *
  10483. */
  10484. s32 bmi160_bmm150_mag_compensate_X(s16 v_mag_data_x_s16, u16 v_data_r_u16);
  10485. /*!
  10486. * @brief This API used to get the compensated BMM150-Y data
  10487. * the out put of Y as s32
  10488. * Before start reading the mag compensated Y data
  10489. * make sure the following two points are addressed
  10490. * @note
  10491. * 1. Make sure the mag interface is enabled or not,
  10492. * by using the bmi160_get_if_mode() function.
  10493. * If mag interface is not enabled set the value of 0x02
  10494. * to the function bmi160_get_if_mode(0x02)
  10495. * @note
  10496. * 2. And also confirm the secondary-interface power mode
  10497. * is not in the SUSPEND mode.
  10498. * by using the function bmi160_get_mag_pmu_status().
  10499. * If the secondary-interface power mode is in SUSPEND mode
  10500. * set the value of 0x19(NORMAL mode)by using the
  10501. * bmi160_set_command_register(0x19) function.
  10502. *
  10503. *
  10504. *
  10505. * @param v_mag_data_y_s16 : The value of mag raw Y data
  10506. * @param v_data_r_u16 : The value of mag R data
  10507. *
  10508. * @return results of compensated Y data value output as s32
  10509. */
  10510. s32 bmi160_bmm150_mag_compensate_Y(s16 v_mag_data_y_s16, u16 v_data_r_u16);
  10511. /*!
  10512. * @brief This API used to get the compensated BMM150-Z data
  10513. * the out put of Z as s32
  10514. * Before start reading the mag compensated Z data
  10515. * make sure the following two points are addressed
  10516. * @note
  10517. * 1. Make sure the mag interface is enabled or not,
  10518. * by using the bmi160_get_if_mode() function.
  10519. * If mag interface is not enabled set the value of 0x02
  10520. * to the function bmi160_get_if_mode(0x02)
  10521. * @note
  10522. * 2. And also confirm the secondary-interface power mode
  10523. * is not in the SUSPEND mode.
  10524. * by using the function bmi160_get_mag_pmu_status().
  10525. * If the secondary-interface power mode is in SUSPEND mode
  10526. * set the value of 0x19(NORMAL mode)by using the
  10527. * bmi160_set_command_register(0x19) function.
  10528. *
  10529. *
  10530. *
  10531. * @param v_mag_data_z_s16 : The value of mag raw Z data
  10532. * @param v_data_r_u16 : The value of mag R data
  10533. *
  10534. * @return results of compensated Z data value output as s32
  10535. */
  10536. s32 bmi160_bmm150_mag_compensate_Z(s16 v_mag_data_z_s16, u16 v_data_r_u16);
  10537. /*!
  10538. * @brief This API used to set the pre-set modes of bmm150
  10539. * The pre-set mode setting is depend on data rate and xy and z repetitions
  10540. *
  10541. * @note
  10542. * Before set the mag preset mode
  10543. * make sure the following two points are addressed
  10544. * @note
  10545. * 1. Make sure the mag interface is enabled or not,
  10546. * by using the bmi160_get_if_mode() function.
  10547. * If mag interface is not enabled set the value of 0x02
  10548. * to the function bmi160_get_if_mode(0x02)
  10549. * @note
  10550. * 2. And also confirm the secondary-interface power mode
  10551. * is not in the SUSPEND mode.
  10552. * by using the function bmi160_get_mag_pmu_status().
  10553. * If the secondary-interface power mode is in SUSPEND mode
  10554. * set the value of 0x19(NORMAL mode)by using the
  10555. * bmi160_set_command_register(0x19) function.
  10556. *
  10557. *
  10558. * @param v_mode_u8: The value of pre-set mode selection value
  10559. * value | pre_set mode
  10560. * ----------|------------
  10561. * 1 | BMI160_MAG_PRESETMODE_LOWPOWER
  10562. * 2 | BMI160_MAG_PRESETMODE_REGULAR
  10563. * 3 | BMI160_MAG_PRESETMODE_HIGHACCURACY
  10564. * 4 | BMI160_MAG_PRESETMODE_ENHANCED
  10565. *
  10566. * @return results of bus communication function
  10567. * @retval 0 -> Success
  10568. * @retval -1 -> Error
  10569. *
  10570. */
  10571. BMI160_RETURN_FUNCTION_TYPE bmi160_set_bmm150_mag_presetmode(u8 mode);
  10572. /*!
  10573. * @brief This function used for set the magnetometer
  10574. * power mode.
  10575. * @note
  10576. * Before set the mag power mode
  10577. * make sure the following two points are addressed
  10578. * @note
  10579. * 1. Make sure the mag interface is enabled or not,
  10580. * by using the bmi160_get_if_mode() function.
  10581. * If mag interface is not enabled set the value of 0x02
  10582. * to the function bmi160_get_if_mode(0x02)
  10583. * @note
  10584. * 2. And also confirm the secondary-interface power mode
  10585. * is not in the SUSPEND mode.
  10586. * by using the function bmi160_get_mag_pmu_status().
  10587. * If the secondary-interface power mode is in SUSPEND mode
  10588. * set the value of 0x19(NORMAL mode)by using the
  10589. * bmi160_set_command_register(0x19) function.
  10590. *
  10591. * @param v_mag_pow_mode_u8 : The value of mag power mode
  10592. * value | mode
  10593. * ----------|------------
  10594. * 0 | FORCE_MODE
  10595. * 1 | SUSPEND_MODE
  10596. *
  10597. *
  10598. * @return results of bus communication function
  10599. * @retval 0 -> Success
  10600. * @retval -1 -> Error
  10601. *
  10602. *
  10603. */
  10604. BMI160_RETURN_FUNCTION_TYPE bmi160_bmm150_mag_set_power_mode(u8 mag_pow_mode);
  10605. /*!
  10606. * @brief This function used for set the magnetometer
  10607. * power mode.
  10608. * @note
  10609. * Before set the mag power mode
  10610. * make sure the following two point is addressed
  10611. * Make sure the mag interface is enabled or not,
  10612. * by using the bmi160_get_if_mode() function.
  10613. * If mag interface is not enabled set the value of 0x02
  10614. * to the function bmi160_get_if_mode(0x02)
  10615. *
  10616. * @param v_mag_sec_if_pow_mode_u8 : The value of mag power mode
  10617. * value | mode
  10618. * ----------|------------
  10619. * 0 | BMI160_MAG_FORCE_MODE
  10620. * 1 | BMI160_MAG_SUSPEND_MODE
  10621. *
  10622. *
  10623. * @return results of bus communication function
  10624. * @retval 0 -> Success
  10625. * @retval -1 -> Error
  10626. *
  10627. *
  10628. */
  10629. BMI160_RETURN_FUNCTION_TYPE bmi160_set_bmm150_mag_and_secondary_if_power_mode(
  10630. u8 v_mag_sec_if_pow_mode_u8);
  10631. /***************************************************/
  10632. /**\name FUNCTIONS FOR AKM09911 */
  10633. /***************************************************/
  10634. /*!
  10635. * Description: This function used for initialize the AKM09911 sensor
  10636. *
  10637. *
  10638. * @return results of bus communication function
  10639. * @retval 0 -> Success
  10640. * @retval -1 -> Error
  10641. *
  10642. *
  10643. */
  10644. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_akm_mag_interface_init(void);
  10645. /*!
  10646. * @brief This function used for read the sensitivity data of
  10647. * AKM09911
  10648. *
  10649. * @note Before reading the mag sensitivity values
  10650. * make sure the following two points are addressed
  10651. * @note 1. Make sure the mag interface is enabled or not,
  10652. * by using the bmi160_get_if_mode() function.
  10653. * If mag interface is not enabled set the value of 0x02
  10654. * to the function bmi160_get_if_mode(0x02)
  10655. * @note 2. And also confirm the secondary-interface power mode
  10656. * is not in the SUSPEND mode.
  10657. * by using the function bmi160_get_mag_pmu_status().
  10658. * If the secondary-interface power mode is in SUSPEND mode
  10659. * set the value of 0x19(NORMAL mode)by using the
  10660. * bmi160_set_command_register(0x19) function.
  10661. *
  10662. * @return results of bus communication function
  10663. * @retval 0 -> Success
  10664. * @retval -1 -> Error
  10665. *
  10666. *
  10667. */
  10668. BMI160_RETURN_FUNCTION_TYPE bmi160_read_bst_akm_sensitivity_data(void);
  10669. /*!
  10670. * @brief This API used to get the compensated X data
  10671. * of AKM09911 the out put of X as s16
  10672. * @note Before start reading the mag compensated X data
  10673. * make sure the following two points are addressed
  10674. * @note 1. Make sure the mag interface is enabled or not,
  10675. * by using the bmi160_get_if_mode() function.
  10676. * If mag interface is not enabled set the value of 0x02
  10677. * to the function bmi160_get_if_mode(0x02)
  10678. * @note 2. And also confirm the secondary-interface power mode
  10679. * is not in the SUSPEND mode.
  10680. * by using the function bmi160_get_mag_pmu_status().
  10681. * If the secondary-interface power mode is in SUSPEND mode
  10682. * set the value of 0x19(NORMAL mode)by using the
  10683. * bmi160_set_command_register(0x19) function.
  10684. *
  10685. *
  10686. * @param v_bst_akm_x_s16 : The value of X data
  10687. *
  10688. * @return results of compensated X data value output as s16
  10689. *
  10690. */
  10691. s16 bmi160_bst_akm_compensate_X(s16 v_bst_akm_x_s16);
  10692. /*!
  10693. * @brief This API used to get the compensated Y data
  10694. * of AKM09911 the out put of Y as s16
  10695. * @note Before start reading the mag compensated Y data
  10696. * make sure the following two points are addressed
  10697. * @note 1. Make sure the mag interface is enabled or not,
  10698. * by using the bmi160_get_if_mode() function.
  10699. * If mag interface is not enabled set the value of 0x02
  10700. * to the function bmi160_get_if_mode(0x02)
  10701. * @note 2. And also confirm the secondary-interface power mode
  10702. * is not in the SUSPEND mode.
  10703. * by using the function bmi160_get_mag_pmu_status().
  10704. * If the secondary-interface power mode is in SUSPEND mode
  10705. * set the value of 0x19(NORMAL mode)by using the
  10706. * bmi160_set_command_register(0x19) function.
  10707. *
  10708. *
  10709. * @param v_bst_akm_y_s16 : The value of Y data
  10710. *
  10711. * @return results of compensated Y data value output as s16
  10712. *
  10713. */
  10714. s16 bmi160_bst_akm_compensate_Y(s16 v_bst_akm_y_s16);
  10715. /*!
  10716. * @brief This API used to get the compensated Z data
  10717. * of AKM09911 the out put of Z as s16
  10718. * @note Before start reading the mag compensated Z data
  10719. * make sure the following two points are addressed
  10720. * @note 1. Make sure the mag interface is enabled or not,
  10721. * by using the bmi160_get_if_mode() function.
  10722. * If mag interface is not enabled set the value of 0x02
  10723. * to the function bmi160_get_if_mode(0x02)
  10724. * @note 2. And also confirm the secondary-interface power mode
  10725. * is not in the SUSPEND mode.
  10726. * by using the function bmi160_get_mag_pmu_status().
  10727. * If the secondary-interface power mode is in SUSPEND mode
  10728. * set the value of 0x19(NORMAL mode)by using the
  10729. * bmi160_set_command_register(0x19) function.
  10730. *
  10731. *
  10732. * @param v_bst_akm_z_s16 : The value of Z data
  10733. *
  10734. * @return results of compensated Z data value output as s16
  10735. *
  10736. */
  10737. s16 bmi160_bst_akm_compensate_Z(s16 v_bst_akm_z_s16);
  10738. /*!
  10739. * @brief This function used for read the compensated value of
  10740. * AKM09911
  10741. * @note Before start reading the mag compensated v_data_u8's
  10742. * make sure the following two points are addressed
  10743. * @note 1. Make sure the mag interface is enabled or not,
  10744. * by using the bmi160_get_if_mode() function.
  10745. * If mag interface is not enabled set the value of 0x02
  10746. * to the function bmi160_get_if_mode(0x02)
  10747. * @note 2. And also confirm the secondary-interface power mode
  10748. * is not in the SUSPEND mode.
  10749. * by using the function bmi160_get_mag_pmu_status().
  10750. * If the secondary-interface power mode is in SUSPEND mode
  10751. * set the value of 0x19(NORMAL mode)by using the
  10752. * bmi160_set_command_register(0x19) function.
  10753. *
  10754. * @return results of bus communication function
  10755. * @retval 0 -> Success
  10756. * @retval -1 -> Error
  10757. *
  10758. *
  10759. */
  10760. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_akm_compensate_xyz(
  10761. struct bmi160_bst_akm_xyz_t *bst_akm_xyz);
  10762. /*!
  10763. * @brief This function used for set the AKM09911
  10764. * power mode.
  10765. * @note Before set the AKM power mode
  10766. * make sure the following two points are addressed
  10767. * @note 1. Make sure the mag interface is enabled or not,
  10768. * by using the bmi160_get_if_mode() function.
  10769. * If mag interface is not enabled set the value of 0x02
  10770. * to the function bmi160_get_if_mode(0x02)
  10771. * @note 2. And also confirm the secondary-interface power mode
  10772. * is not in the SUSPEND mode.
  10773. * by using the function bmi160_get_mag_pmu_status().
  10774. * If the secondary-interface power mode is in SUSPEND mode
  10775. * set the value of 0x19(NORMAL mode)by using the
  10776. * bmi160_set_command_register(0x19) function.
  10777. *
  10778. * @param v_akm_pow_mode_u8 : The value of akm power mode
  10779. * value | Description
  10780. * ---------|--------------------
  10781. * 0 | AKM_POWER_DOWN_MODE
  10782. * 1 | AKM_SINGLE_MEAS_MODE
  10783. * 2 | FUSE_ROM_MODE
  10784. *
  10785. *
  10786. * @return results of bus communication function
  10787. * @retval 0 -> Success
  10788. * @retval -1 -> Error
  10789. *
  10790. *
  10791. */
  10792. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_akm_set_powermode(u8 v_akm_pow_mode_u8);
  10793. /*!
  10794. * @brief This function used for set the magnetometer
  10795. * power mode.
  10796. * @note Before set the mag power mode
  10797. * make sure the following two point is addressed
  10798. * Make sure the mag interface is enabled or not,
  10799. * by using the bmi160_get_if_mode() function.
  10800. * If mag interface is not enabled set the value of 0x02
  10801. * to the function bmi160_get_if_mode(0x02)
  10802. *
  10803. * @param v_mag_sec_if_pow_mode_u8 : The value of secondary if power mode
  10804. * value | Description
  10805. * ---------|--------------------
  10806. * 0 | BMI160_MAG_FORCE_MODE
  10807. * 1 | BMI160_MAG_SUSPEND_MODE
  10808. *
  10809. *
  10810. * @return results of bus communication function
  10811. * @retval 0 -> Success
  10812. * @retval -1 -> Error
  10813. *
  10814. *
  10815. */
  10816. BMI160_RETURN_FUNCTION_TYPE bmi160_set_bst_akm_and_secondary_if_powermode(
  10817. u8 v_mag_sec_if_pow_mode_u8);
  10818. /***************************************************/
  10819. /**\name FUNCTIONS FOR YAMAH-YAS532 */
  10820. /***************************************************/
  10821. /*!
  10822. * @brief This function used for read the YAMAH-YAS532 init
  10823. *
  10824. *
  10825. * @return results of bus communication function
  10826. * @retval 0 -> Success
  10827. * @retval -1 -> Error
  10828. *
  10829. *
  10830. */
  10831. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yamaha_yas532_mag_interface_init(
  10832. void);
  10833. /*!
  10834. * @brief This function used to set the YAS532 initial values
  10835. *
  10836. *
  10837. * @return results of bus communication function
  10838. * @retval 0 -> Success
  10839. * @retval -1 -> Error
  10840. *
  10841. *
  10842. */
  10843. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yas532_set_initial_values(void);
  10844. /*!
  10845. * @brief This function used for YAS532 offset correction
  10846. *
  10847. *
  10848. * @return results of bus communication function
  10849. * @retval 0 -> Success
  10850. * @retval -1 -> Error
  10851. *
  10852. *
  10853. */
  10854. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yas532_magnetic_measure_set_offset(
  10855. void);
  10856. /*!
  10857. * @brief This function used for read the
  10858. * YAMAHA YAS532 calibration data
  10859. *
  10860. *
  10861. * @return results of bus communication function
  10862. * @retval 0 -> Success
  10863. * @retval -1 -> Error
  10864. *
  10865. *
  10866. */
  10867. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yamaha_yas532_calib_values(void);
  10868. /*!
  10869. * @brief This function used for calculate the
  10870. * YAS532 read the linear data
  10871. *
  10872. *
  10873. * @return results of bus communication function
  10874. * @retval 0 -> Success
  10875. * @retval -1 -> Error
  10876. *
  10877. *
  10878. */
  10879. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yas532_xy1y2_to_linear(
  10880. u16 *v_xy1y2_u16, s32 *xy1y2_linear);
  10881. /*!
  10882. * @brief This function used for read the YAS532 sensor data
  10883. * @param v_acquisition_command_u8: used to set the data acquisition
  10884. * acquisition_command | operation
  10885. * ---------------------|-------------------------
  10886. * 0x17 | turn on the acquisition coil
  10887. * - | set direction of the coil
  10888. * _ | (x and y as minus(-))
  10889. * _ | Deferred acquisition mode
  10890. * 0x07 | turn on the acquisition coil
  10891. * _ | set direction of the coil
  10892. * _ | (x and y as minus(-))
  10893. * _ | Normal acquisition mode
  10894. * 0x11 | turn OFF the acquisition coil
  10895. * _ | set direction of the coil
  10896. * _ | (x and y as plus(+))
  10897. * _ | Deferred acquisition mode
  10898. * 0x01 | turn OFF the acquisition coil
  10899. * _ | set direction of the coil
  10900. * _ | (x and y as plus(+))
  10901. * _ | Normal acquisition mode
  10902. *
  10903. * @param v_busy_u8 : used to get the busy flay for sensor data read
  10904. * @param v_temp_u16 : used to get the temperature data
  10905. * @param v_xy1y2_u16 : used to get the sensor xy1y2 data
  10906. * @param v_overflow_u8 : used to get the overflow data
  10907. *
  10908. *
  10909. *
  10910. * @return results of bus communication function
  10911. * @retval 0 -> Success
  10912. * @retval -1 -> Error
  10913. *
  10914. *
  10915. */
  10916. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yas532_normal_measurement_data(
  10917. u8 v_acquisition_command_u8, u8 *v_busy_u8,
  10918. u16 *v_temp_u16, u16 *v_xy1y2_u16, u8 *v_overflow_u8);
  10919. /*!
  10920. * @brief This function used for YAS532 sensor data
  10921. * @param v_acquisition_command_u8 : the value of CMDR
  10922. * acquisition_command | operation
  10923. * ---------------------|-------------------------
  10924. * 0x17 | turn on the acquisition coil
  10925. * - | set direction of the coil
  10926. * _ | (x and y as minus(-))
  10927. * _ | Deferred acquisition mode
  10928. * 0x07 | turn on the acquisition coil
  10929. * _ | set direction of the coil
  10930. * _ | (x and y as minus(-))
  10931. * _ | Normal acquisition mode
  10932. * 0x11 | turn OFF the acquisition coil
  10933. * _ | set direction of the coil
  10934. * _ | (x and y as plus(+))
  10935. * _ | Deferred acquisition mode
  10936. * 0x01 | turn OFF the acquisition coil
  10937. * _ | set direction of the coil
  10938. * _ | (x and y as plus(+))
  10939. * _ | Normal acquisition mode
  10940. *
  10941. * @param xyz_data : the vector xyz output
  10942. * @param v_overflow_s8 : the value of overflow
  10943. * @param v_temp_correction_u8 : the value of temperate correction enable
  10944. *
  10945. *
  10946. * @return results of bus communication function
  10947. * @retval 0 -> Success
  10948. * @retval -1 -> Error
  10949. *
  10950. *
  10951. */
  10952. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yas532_measurement_xyz_data(
  10953. struct yas532_vector *xyz_data, u8 *v_overflow_s8, u8 v_temp_correction_u8,
  10954. u8 v_acquisition_command_u8);
  10955. /*!
  10956. * @brief This function used for YAS532 write data acquisition
  10957. * command register write
  10958. * @param v_command_reg_data_u8 : the value of data acquisition
  10959. * acquisition_command | operation
  10960. * ---------------------|-------------------------
  10961. * 0x17 | turn on the acquisition coil
  10962. * - | set direction of the coil
  10963. * _ | (x and y as minus(-))
  10964. * _ | Deferred acquisition mode
  10965. * 0x07 | turn on the acquisition coil
  10966. * _ | set direction of the coil
  10967. * _ | (x and y as minus(-))
  10968. * _ | Normal acquisition mode
  10969. * 0x11 | turn OFF the acquisition coil
  10970. * _ | set direction of the coil
  10971. * _ | (x and y as plus(+))
  10972. * _ | Deferred acquisition mode
  10973. * 0x01 | turn OFF the acquisition coil
  10974. * _ | set direction of the coil
  10975. * _ | (x and y as plus(+))
  10976. * _ | Normal acquisition mode
  10977. *
  10978. *
  10979. *
  10980. * @return results of bus communication function
  10981. * @retval 0 -> Success
  10982. * @retval -1 -> Error
  10983. *
  10984. *
  10985. */
  10986. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yas532_acquisition_command_register(
  10987. u8 v_command_reg_data_u8);
  10988. /*!
  10989. * @brief This function used write offset of YAS532
  10990. *
  10991. * @param p_offset_s8 : The value of offset to write
  10992. *
  10993. *
  10994. * @return results of bus communication function
  10995. * @retval 0 -> Success
  10996. * @retval -1 -> Error
  10997. *
  10998. *
  10999. */
  11000. BMI160_RETURN_FUNCTION_TYPE bmi160_bst_yas532_set_offset(
  11001. const s8 *p_offset_s8);
  11002. /***************************************************/
  11003. /**\name FUNCTIONS FOR FIFO DATA READ */
  11004. /***************************************************/
  11005. /*!
  11006. * @brief This function used for reading the
  11007. * fifo data of header less mode
  11008. *
  11009. * @param v_fifo_length_u32 : The value of FIFO length
  11010. *
  11011. *
  11012. * @note Configure the below functions for FIFO header less mode
  11013. * @note 1. bmi160_set_fifo_down_gyro()
  11014. * @note 2. bmi160_set_gyro_fifo_filter_data()
  11015. * @note 3. bmi160_set_fifo_down_accel()
  11016. * @note 4. bmi160_set_accel_fifo_filter_dat()
  11017. * @note 5. bmi160_set_fifo_mag_enable()
  11018. * @note 6. bmi160_set_fifo_accel_enable()
  11019. * @note 7. bmi160_set_fifo_gyro_enable()
  11020. * @note For interrupt configuration
  11021. * @note 1. bmi160_set_intr_fifo_full()
  11022. * @note 2. bmi160_set_intr_fifo_wm()
  11023. * @note 3. bmi160_set_fifo_tag_intr2_enable()
  11024. * @note 4. bmi160_set_fifo_tag_intr1_enable()
  11025. *
  11026. *
  11027. * @return results of bus communication function
  11028. * @retval 0 -> Success
  11029. * @retval -1 -> Error
  11030. *
  11031. *
  11032. */
  11033. BMI160_RETURN_FUNCTION_TYPE bmi160_read_fifo_headerless_mode(
  11034. u32 v_fifo_length_u32);
  11035. /*!
  11036. * @brief This function used for reading the
  11037. * fifo data of header mode
  11038. *
  11039. * @param v_fifo_length_u32 : The value of FIFO length
  11040. *
  11041. * @note Configure the below functions for FIFO header mode
  11042. * @note 1. bmi160_set_fifo_down_gyro()
  11043. * @note 2. bmi160_set_gyro_fifo_filter_data()
  11044. * @note 3. bmi160_set_fifo_down_accel()
  11045. * @note 4. bmi160_set_accel_fifo_filter_dat()
  11046. * @note 5. bmi160_set_fifo_mag_enable()
  11047. * @note 6. bmi160_set_fifo_accel_enable()
  11048. * @note 7. bmi160_set_fifo_gyro_enable()
  11049. * @note 8. bmi160_set_fifo_header_enable()
  11050. * @note For interrupt configuration
  11051. * @note 1. bmi160_set_intr_fifo_full()
  11052. * @note 2. bmi160_set_intr_fifo_wm()
  11053. * @note 3. bmi160_set_fifo_tag_intr2_enable()
  11054. * @note 4. bmi160_set_fifo_tag_intr1_enable()
  11055. * @return results of bus communication function
  11056. * @retval 0 -> Success
  11057. * @retval -1 -> Error
  11058. *
  11059. *
  11060. */
  11061. BMI160_RETURN_FUNCTION_TYPE bmi160_read_fifo_header_data(u32 v_fifo_length_u32);
  11062. //add by lwy
  11063. BMI160_RETURN_FUNCTION_TYPE bmi160_read_accel_gyro_fifo_data(u8 *r_v_accel_index_u8, struct bmi160_accel_t **r_accel_fifo, u8 *r_v_gyro_index_u8,struct bmi160_gyro_t **r_gyro_fifo);
  11064. BMI160_RETURN_FUNCTION_TYPE bmi160_fifo_data_get_set_integration(u8 *v_fifo_data_u8, u32 *fifo_len_u32);
  11065. /*!
  11066. * @brief This function used for reading
  11067. * bmi160_t structure
  11068. *
  11069. * @return the reference and values of bmi160_t
  11070. *
  11071. *
  11072. */
  11073. struct bmi160_t *bmi160_get_ptr(void);
  11074. #endif