1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml">
3<head>
4<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5<meta http-equiv="X-UA-Compatible" content="IE=9"/>
6<meta name="generator" content="Doxygen 1.8.13"/>
7<meta name="viewport" content="width=device-width, initial-scale=1"/>
8<title>ISSDK: algorithms/sensorfusion/sources/driver_FXAS21002.c Source File</title>
9<link href="tabs.css" rel="stylesheet" type="text/css"/>
10<script type="text/javascript" src="jquery.js"></script>
11<script type="text/javascript" src="dynsections.js"></script>
12<link href="issdk_stylesheet.css" rel="stylesheet" type="text/css" />
13</head>
14<body>
15<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
16<div id="titlearea">
17<table cellspacing="0" cellpadding="0">
18 <tbody>
19 <tr style="height: 56px;">
20  <td id="projectlogo"><img alt="Logo" src="nxp_logo_small.png"/></td>
21  <td id="projectalign" style="padding-left: 0.5em;">
22   <div id="projectname">ISSDK
23   &#160;<span id="projectnumber">1.8</span>
24   </div>
25   <div id="projectbrief">IoT Sensing Software Development Kit</div>
26  </td>
27 </tr>
28 </tbody>
29</table>
30</div>
31<!-- end header part -->
32<!-- Generated by Doxygen 1.8.13 -->
33<script type="text/javascript" src="menudata.js"></script>
34<script type="text/javascript" src="menu.js"></script>
35<script type="text/javascript">
36$(function() {
37  initMenu('',false,false,'search.php','Search');
38});
39</script>
40<div id="main-nav"></div>
41<div id="nav-path" class="navpath">
42  <ul>
43<li class="navelem"><a class="el" href="dir_c0ce462e37efe0a8d60c01d75f78f8a0.html">algorithms</a></li><li class="navelem"><a class="el" href="dir_cb8ed5ffd1f20a5af7e420f81f312621.html">sensorfusion</a></li><li class="navelem"><a class="el" href="dir_c60867674b20e7d761cd401b87ce879d.html">sources</a></li>  </ul>
44</div>
45</div><!-- top -->
46<div class="header">
47  <div class="headertitle">
48<div class="title">driver_FXAS21002.c</div>  </div>
49</div><!--header-->
50<div class="contents">
51<a href="a00800.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * Copyright (c) 2015, Freescale Semiconductor, Inc.</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * Copyright 2016-2017 NXP</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * All rights reserved.</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * SPDX-License-Identifier: BSD-3-Clause</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> */</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment">/*! \file driver_FXAS21002.c</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment">    \brief Provides init() and read() functions for the FXAS21002 gyroscope</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment">*/</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;</div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &quot;board.h&quot;</span>          <span class="comment">// generated by Kinetis Expert.  Long term - merge sensor_board.h into this file</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="a00914.html">sensor_fusion.h</a>&quot;</span>  <span class="comment">// Sensor fusion structures and types</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="a00179.html">sensor_drv.h</a>&quot;</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="a00185.html">sensor_io_i2c.h</a>&quot;</span>  <span class="comment">// Low level IS-SDK prototype driver</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="a00842.html">drivers.h</a>&quot;</span>        <span class="comment">// Device specific drivers supplied by NXP (can be replaced with user drivers)</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="a00026.html">fxas21002.h</a>&quot;</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;</div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment">// Includes support for pre-production FXAS21000 registers and constants which are not supported via IS-SDK</span></div><div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="a00800.html#ab8b4c1cfaa54bce37dfd8d16fbad7d14">   21</a></span>&#160;<span class="preprocessor">#define FXAS21000_STATUS                0x00</span></div><div class="line"><a name="l00022"></a><span class="lineno"><a class="line" href="a00800.html#a882286434d0cffca50ee172a7514d04f">   22</a></span>&#160;<span class="preprocessor">#define FXAS21000_F_STATUS              0x08</span></div><div class="line"><a name="l00023"></a><span class="lineno"><a class="line" href="a00800.html#a100ef421feb1ba8269d586eb41ee464a">   23</a></span>&#160;<span class="preprocessor">#define FXAS21000_F_SETUP               0x09</span></div><div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="a00800.html#ac255d24201ab9874d876519d0c77b717">   24</a></span>&#160;<span class="preprocessor">#define FXAS21000_WHO_AM_I              0x0C</span></div><div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="a00800.html#abee9f1d68dad80b6075c2fe493aa6c9e">   25</a></span>&#160;<span class="preprocessor">#define FXAS21000_CTRL_REG0             0x0D</span></div><div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="a00800.html#ac6cb6a8c57c8b6b6e835dd5615dab36c">   26</a></span>&#160;<span class="preprocessor">#define FXAS21000_CTRL_REG1             0x13</span></div><div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="a00800.html#aa64e242b9f373eb454306cb7b1595eee">   27</a></span>&#160;<span class="preprocessor">#define FXAS21000_CTRL_REG2             0x14</span></div><div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="a00800.html#ac021112534d845ac5dd9235c86bb929d">   28</a></span>&#160;<span class="preprocessor">#define FXAS21000_WHO_AM_I_VALUE        0xD1    // engineering and production</span></div><div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="a00800.html#ad729ac3263df225b8ebe64394c06ae5c">   29</a></span>&#160;<span class="preprocessor">#define FXAS21000_COUNTSPERDEGPERSEC    20      // 1600dps range</span></div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="a00800.html#ac4b942f72b2c1d1a0f16d832fcabd716">   30</a></span>&#160;<span class="preprocessor">#define FXAS21002_COUNTSPERDEGPERSEC    16      // for 2000dps=32000 counts</span></div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;</div><div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="a00800.html#a3fe2519a64ebf20f9d3c4648a3bcfc8b">   32</a></span>&#160;<span class="preprocessor">#define FXAS21002_GYRO_FIFO_SIZE  32            </span><span class="comment">///&lt; FXAX21000, FXAS21002 have 32 element FIFO</span></div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="preprocessor">#if F_USING_GYRO</span></div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="comment">// Command definition to read the WHO_AM_I value.</span></div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="keyword">const</span> <a class="code" href="a03811.html">registerreadlist_t</a>    FXAS21002_WHO_AM_I_READ[] =</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;{</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;    { .<a class="code" href="a03811.html#a5fe82375de174c0511ca301fec78e441">readFrom</a> = <a class="code" href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960a9c66d687be93ad245ccc01f865760180">FXAS21002_WHO_AM_I</a>, .numBytes = 1 }, <a class="code" href="a00179.html#aebb58a1bb3df30b7df4f6f14d0f1a81d">__END_READ_DATA__</a></div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;};</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="comment">// Command definition to read the number of entries in the gyro status register.</span></div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="keyword">const</span> <a class="code" href="a03811.html">registerreadlist_t</a>    FXAS21002_F_STATUS_READ[] =</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;{</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    { .<a class="code" href="a03811.html#a5fe82375de174c0511ca301fec78e441">readFrom</a> = <a class="code" href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960ad079911b60aa18a2aaeb622eb7bb96eb">FXAS21002_STATUS</a>, .numBytes = 1 }, <a class="code" href="a00179.html#aebb58a1bb3df30b7df4f6f14d0f1a81d">__END_READ_DATA__</a></div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;};</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="comment">// Command definition to read the number of entries in the accel FIFO.</span></div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;<a class="code" href="a03811.html">registerreadlist_t</a>          FXAS21002_DATA_READ[] =</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;{</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;    { .<a class="code" href="a03811.html#a5fe82375de174c0511ca301fec78e441">readFrom</a> = <a class="code" href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960ace58cd4daacb9bb55fe1e0efd0ae29ef">FXAS21002_OUT_X_MSB</a>, .numBytes = 1 }, <a class="code" href="a00179.html#aebb58a1bb3df30b7df4f6f14d0f1a81d">__END_READ_DATA__</a></div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;};</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="comment">// Each entry in a RegisterWriteList is composed of: register address, value to write, bit-mask to apply to write (0 enables)</span></div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;<span class="keyword">const</span> <a class="code" href="a03807.html">registerwritelist_t</a>   FXAS21000_Initialization[] =</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;{</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    <span class="comment">// write 0000 0000 = 0x00 to CTRL_REG1 to place FXOS21000 in Standby</span></div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    <span class="comment">// [7]: ZR_cond=0</span></div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;    <span class="comment">// [6]: RST=0</span></div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    <span class="comment">// [5]: ST=0 self test disabled</span></div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;    <span class="comment">// [4-2]: DR[2-0]=000 for 200Hz ODR</span></div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    <span class="comment">// [1]: Active=0 for Standby mode</span></div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    <span class="comment">// [0]: Ready=0 but irrelevant since Active bit over-rides</span></div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    { <a class="code" href="a00800.html#ac6cb6a8c57c8b6b6e835dd5615dab36c">FXAS21000_CTRL_REG1</a>, 0x00, 0x00 },        <span class="comment">// write 0100 0000 = 0x40 to F_SETUP to enable FIFO in continuous mode</span></div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    <span class="comment">// [7-6]: F_MODE[1-0]=01 for FIFO continuous mode</span></div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    <span class="comment">// [5-0]: F_WMRK[5-0]=000000 for no FIFO watermark</span></div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    { <a class="code" href="a00800.html#a100ef421feb1ba8269d586eb41ee464a">FXAS21000_F_SETUP</a>, 0x40, 0x00 },</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;    <span class="comment">// write 0000 0000 = 0x00 to CTRL_REG0 to configure range</span></div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;    <span class="comment">// [7-6]: unused=00</span></div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    <span class="comment">// [5]: SPIW=0 4 wire SPI (irrelevant)</span></div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;    <span class="comment">// [4-3]: SEL[1-0]=00 for HPF cutoff but disabled in HPF_EN</span></div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;    <span class="comment">// [2]: HPF_EN=0 disable HPF</span></div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    <span class="comment">// [1-0]: FS[1-0]=00 for 1600dps</span></div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    { <a class="code" href="a00800.html#abee9f1d68dad80b6075c2fe493aa6c9e">FXAS21000_CTRL_REG0</a>, 0x00, 0x00 },</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    <span class="comment">// write 000X XX10 to CTRL_REG1 to configure ODR and enter Active mode</span></div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    <span class="comment">// [7]: Reserved=0</span></div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;    <span class="comment">// [6]: RST=0 for no reset</span></div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    <span class="comment">// [5]: ST=0 self test disabled</span></div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;    <span class="comment">// [4-2]: DR[2-0]=111 also for 12.5Hz ODR giving 0x1E</span></div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;    <span class="comment">// [4-2]: DR[2-0]=110 for 12.5Hz ODR giving 0x1A</span></div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    <span class="comment">// [4-2]: DR[2-0]=101 for 25Hz ODR giving 0x16</span></div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;    <span class="comment">// [4-2]: DR[2-0]=100 for 50Hz ODR giving 0x12</span></div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    <span class="comment">// [4-2]: DR[2-0]=011 for 100Hz ODR giving 0x0E</span></div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    <span class="comment">// [4-2]: DR[2-0]=010 for 200Hz ODR giving 0x0A</span></div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    <span class="comment">// [4-2]: DR[2-0]=001 for 400Hz ODR giving 0x06</span></div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    <span class="comment">// [4-2]: DR[2-0]=000 for 800Hz ODR giving 0x02</span></div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;    <span class="comment">// [1]: Active=1 for Active mode</span></div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;    <span class="comment">// [0]: Ready=0 but irrelevant since Active bit over-rides</span></div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;<span class="preprocessor">#if (GYRO_ODR_HZ &lt;= 1)                      // select 1.5625Hz ODR</span></div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    { <a class="code" href="a00800.html#ac6cb6a8c57c8b6b6e835dd5615dab36c">FXAS21000_CTRL_REG1</a>, 0x1E, 0x00 },</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;<span class="preprocessor">#elif (GYRO_ODR_HZ &lt;= 3)                    // select 3.125Hz ODR</span></div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;    { <a class="code" href="a00800.html#ac6cb6a8c57c8b6b6e835dd5615dab36c">FXAS21000_CTRL_REG1</a>, 0x1A, 0x00 },</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;<span class="preprocessor">#elif (GYRO_ODR_HZ &lt;= 6)                    // select 6.25Hz ODR</span></div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    { <a class="code" href="a00800.html#ac6cb6a8c57c8b6b6e835dd5615dab36c">FXAS21000_CTRL_REG1</a>, 0x16, 0x00 },</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;<span class="preprocessor">#elif (GYRO_ODR_HZ &lt;= 12)                   // select 12.5Hz ODR</span></div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;    { <a class="code" href="a00800.html#ac6cb6a8c57c8b6b6e835dd5615dab36c">FXAS21000_CTRL_REG1</a>, 0x12, 0x00 },</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;<span class="preprocessor">#elif (GYRO_ODR_HZ &lt;= 25)                   // select 25.0Hz ODR</span></div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    { <a class="code" href="a00800.html#ac6cb6a8c57c8b6b6e835dd5615dab36c">FXAS21000_CTRL_REG1</a>, 0x0E, 0x00 },</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;<span class="preprocessor">#elif (GYRO_ODR_HZ &lt;= 50)                   // select 50.0Hz ODR</span></div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;    { <a class="code" href="a00800.html#ac6cb6a8c57c8b6b6e835dd5615dab36c">FXAS21000_CTRL_REG1</a>, 0x0A, 0x00 },</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;<span class="preprocessor">#elif (GYRO_ODR_HZ &lt;= 100)                  // select 100.0Hz ODR</span></div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    { <a class="code" href="a00800.html#ac6cb6a8c57c8b6b6e835dd5615dab36c">FXAS21000_CTRL_REG1</a>, 0x06, 0x00 },</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;<span class="preprocessor">#else // select 200Hz ODR</span></div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    { <a class="code" href="a00800.html#ac6cb6a8c57c8b6b6e835dd5615dab36c">FXAS21000_CTRL_REG1</a>, 0x02, 0x00 },</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;    <a class="code" href="a00179.html#a2cedde333a6373a3ee274bde6af145d0">__END_WRITE_DATA__</a></div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;};</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;<span class="comment">// Each entry in a RegisterWriteList is composed of: register address, value to write, bit-mask to apply to write (0 enables)</span></div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;<span class="keyword">const</span> <a class="code" href="a03807.html">registerwritelist_t</a>   FXAS21002_Initialization[] =</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;{</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    <span class="comment">// write 0000 0000 = 0x00 to CTRL_REG1 to place FXOS21000 in Standby</span></div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;    <span class="comment">// [7]: ZR_cond=0</span></div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    <span class="comment">// [6]: RST=0</span></div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;    <span class="comment">// [5]: ST=0 self test disabled</span></div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;    <span class="comment">// [4-2]: DR[2-0]=000 for 200Hz ODR</span></div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    <span class="comment">// [1]: Active=0 for Standby mode</span></div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;    <span class="comment">// [0]: Ready=0 but irrelevant since Active bit over-rides</span></div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;    { <a class="code" href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960ad939828458795636669a334549deb39d">FXAS21002_CTRL_REG1</a>, 0x00, 0x00 },</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;</div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;    <span class="comment">// [7-6]: F_MODE[1-0]=01 for FIFO continuous mode</span></div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;    <span class="comment">// [5-0]: F_WMRK[5-0]=000000 for no FIFO watermark</span></div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    { <a class="code" href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960a99235fc2aa5beb513d8969d99fb103a0">FXAS21002_F_SETUP</a>, 0x40, 0x00 },</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;</div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;    <span class="comment">// write 0000 0000 = 0x00 to CTRL_REG0 to configure range and LPF</span></div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;    <span class="comment">// [7-6]: BW[1-0]=00 for least aggressive LPF (0.32 * ODR cutoff for all ODR ie 64Hz cutoff at 200Hz ODR)</span></div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;    <span class="comment">// [5]: SPIW=0 4 wire SPI (irrelevant)</span></div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;    <span class="comment">// [4-3]: SEL[1-0]=00 for HPF cutoff but disabled in HPF_EN</span></div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;    <span class="comment">// [2]: HPF_EN=0 to disable HPF</span></div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;    <span class="comment">// [1-0]: FS[1-0]=00 for 2000dps</span></div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;    { <a class="code" href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960a3cf3a9aa10883bc5bc48b8c6d4a93dd4">FXAS21002_CTRL_REG0</a>, 0x00, 0x00 },</div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;    <span class="comment">// write 0000 1000 = 0x08 to CTRL_REG3 to set FIFO address wraparound on read</span></div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;    <span class="comment">// [7-4]: Reserved=0000</span></div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;    <span class="comment">// [3]: WRAPTOONE=1 to permit burst FIFO read with address wrapround to OUT_X_MSB</span></div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;    <span class="comment">// [2]: EXTCTRLEN=0 for default INT2 configuration as output</span></div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;    <span class="comment">// [1]: Reserved=0</span></div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;    <span class="comment">// [0]: FS_DOUBLE=0 for normal 2000dps range</span></div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;    { <a class="code" href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960a345fd7be5bf46d6515984e587441e209">FXAS21002_CTRL_REG3</a>, 0x08, 0x00 },</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;</div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;    <span class="comment">// write 000X XX10 to CTRL_REG1 to configure ODR and enter Active mode</span></div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;    <span class="comment">// [7]: Reserved=0</span></div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;    <span class="comment">// [6]: RST=0 for no reset</span></div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;    <span class="comment">// [5]: ST=0 self test disabled</span></div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;    <span class="comment">// [4-2]: DR[2-0]=111 also for 12.5Hz ODR giving 0x1E</span></div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;    <span class="comment">// [4-2]: DR[2-0]=110 for 12.5Hz ODR giving 0x1A</span></div><div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;    <span class="comment">// [4-2]: DR[2-0]=101 for 25Hz ODR giving 0x16</span></div><div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;    <span class="comment">// [4-2]: DR[2-0]=100 for 50Hz ODR giving 0x12</span></div><div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;    <span class="comment">// [4-2]: DR[2-0]=011 for 100Hz ODR giving 0x0E</span></div><div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;    <span class="comment">// [4-2]: DR[2-0]=010 for 200Hz ODR giving 0x0A</span></div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;    <span class="comment">// [4-2]: DR[2-0]=001 for 400Hz ODR giving 0x06</span></div><div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;    <span class="comment">// [4-2]: DR[2-0]=000 for 800Hz ODR giving 0x02</span></div><div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;    <span class="comment">// [1]: Active=1 for Active mode</span></div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;    <span class="comment">// [0]: Ready=0 but irrelevant since Active bit over-rides</span></div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;    <span class="comment">// These values are different than the FXAS21000 values</span></div><div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;<span class="preprocessor">#if (GYRO_ODR_HZ &lt;= 12)                     // select 12.5Hz ODR</span></div><div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;    { <a class="code" href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960ad939828458795636669a334549deb39d">FXAS21002_CTRL_REG1</a>, 0x1A, 0x00 },</div><div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;<span class="preprocessor">#elif (GYRO_ODR_HZ &lt;= 25)                   // select 25Hz ODR</span></div><div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;    { <a class="code" href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960ad939828458795636669a334549deb39d">FXAS21002_CTRL_REG1</a>, 0x16, 0x00 },</div><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;<span class="preprocessor">#elif (GYRO_ODR_HZ &lt;= 50)                   // select 50Hz ODR</span></div><div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;    { <a class="code" href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960ad939828458795636669a334549deb39d">FXAS21002_CTRL_REG1</a>, 0x12, 0x00 },</div><div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;<span class="preprocessor">#elif (GYRO_ODR_HZ &lt;= 100)                  // select 100Hz ODR</span></div><div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;    { <a class="code" href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960ad939828458795636669a334549deb39d">FXAS21002_CTRL_REG1</a>, 0x0E, 0x00 },</div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;<span class="preprocessor">#elif (GYRO_ODR_HZ &lt;= 200)                  // select 200Hz ODR</span></div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;    { <a class="code" href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960ad939828458795636669a334549deb39d">FXAS21002_CTRL_REG1</a>, 0x0A, 0x00 },</div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;<span class="preprocessor">#elif (GYRO_ODR_HZ &lt;= 400)                  // select 400Hz ODR</span></div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;    { <a class="code" href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960ad939828458795636669a334549deb39d">FXAS21002_CTRL_REG1</a>, 0x06, 0x00 },</div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;<span class="preprocessor">#else // select 800Hz ODR</span></div><div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;    { <a class="code" href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960ad939828458795636669a334549deb39d">FXAS21002_CTRL_REG1</a>, 0x02, 0x00 },</div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;    <a class="code" href="a00179.html#a2cedde333a6373a3ee274bde6af145d0">__END_WRITE_DATA__</a></div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;};</div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;<span class="comment">// All sensor drivers and initialization functions have the same prototype</span></div><div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;<span class="comment">// sensor = pointer to linked list element used by the sensor fusion subsystem to specify required sensors</span></div><div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;</div><div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;<span class="comment">// sfg = pointer to top level (generally global) data structure for sensor fusion</span></div><div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;int8_t <a class="code" href="a00842.html#a81c5b987e709b3991bc7c1bc1e659c1f">FXAS21002_Init</a>(<span class="keyword">struct</span> <a class="code" href="a03991.html">PhysicalSensor</a> *sensor, <a class="code" href="a04047.html">SensorFusionGlobals</a> *<a class="code" href="a00470.html#afa81c629d378fe700f351a1bce411ad5">sfg</a>)</div><div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;{</div><div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;</div><div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;    <a class="code" href="a00521.html#a5d7069350a7d7e65686c77a8038f462f">int32_t</a> <a class="code" href="a00359.html#a369536ebfe385731562c0b55dd6f3a7c">status</a>;</div><div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;    uint8_t reg;</div><div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;</div><div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;    status = <a class="code" href="a00167.html#ac8a60c799d9dbc84531b4680762eb8dc">Register_I2C_Read</a>(sensor-&gt;<a class="code" href="a03991.html#aa7b3c47e2be4d604bc40157d590d09b2">bus_driver</a>, &amp;sensor-&gt;<a class="code" href="a03991.html#ae75b47fd9e098d6bd3b28f6be6586998">deviceInfo</a>, sensor-&gt;<a class="code" href="a03991.html#a41a6aad09727eb120338c35535a652a6">addr</a>, <a class="code" href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960a9c66d687be93ad245ccc01f865760180">FXAS21002_WHO_AM_I</a>, 1, &amp;reg);</div><div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;    <span class="keywordflow">if</span> (status==<a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5aca961b6871536a27c9e4718100e0024274">SENSOR_ERROR_NONE</a>) {</div><div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;        sfg-&gt;Gyro.iWhoAmI = reg;</div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;        <span class="keywordflow">switch</span> (reg) {</div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;        <span class="keywordflow">case</span> <a class="code" href="a00026.html#adaac462191d7b9b2b0e1555f58e3a2c6">FXAS21002_WHO_AM_I_WHOAMI_PROD_VALUE</a>:</div><div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;        <span class="keywordflow">case</span> <a class="code" href="a00026.html#adaef1d893f1cbf72eb0ed76a95ab3947">FXAS21002_WHO_AM_I_WHOAMI_PRE_VALUE</a>:</div><div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;        <span class="keywordflow">case</span> <a class="code" href="a00026.html#a453da16edf0685dc566ef0e6ef86fea7">FXAS21002_WHO_AM_I_WHOAMI_OLD_VALUE</a>: <span class="keywordflow">break</span>;</div><div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;        <span class="keywordflow">default</span>:</div><div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;            <span class="comment">// whoAmI will retain default value of zero</span></div><div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;            <span class="keywordflow">return</span> <a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5aca7f5031b1497c3a8a4bcb78cce879dedd">SENSOR_ERROR_INIT</a>; <span class="comment">// return with error</span></div><div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;        }</div><div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;    } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="a00359.html#a369536ebfe385731562c0b55dd6f3a7c">status</a>; <span class="comment">// return with error</span></div><div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;    }</div><div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;</div><div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;    <span class="comment">// configure FXAS21000 or FXAS21002 depending on WHOAMI value read</span></div><div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;    <span class="keywordflow">switch</span> (sfg-&gt;Gyro.iWhoAmI) {</div><div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;    <span class="keywordflow">case</span> (<a class="code" href="a00800.html#ac021112534d845ac5dd9235c86bb929d">FXAS21000_WHO_AM_I_VALUE</a>):</div><div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;        <span class="comment">// Configure and start the FXAS21000 sensor.  This does multiple register writes</span></div><div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;        <span class="comment">// (see FXAS21009_Initialization definition above)</span></div><div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;        status = <a class="code" href="a00182.html#aaac4c4f34b4dd37d3f202a1dbb4b000b">Sensor_I2C_Write</a>(sensor-&gt;<a class="code" href="a03991.html#aa7b3c47e2be4d604bc40157d590d09b2">bus_driver</a>, &amp;sensor-&gt;<a class="code" href="a03991.html#ae75b47fd9e098d6bd3b28f6be6586998">deviceInfo</a>, sensor-&gt;<a class="code" href="a03991.html#a41a6aad09727eb120338c35535a652a6">addr</a>, FXAS21000_Initialization );</div><div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;        sfg-&gt;Gyro.iCountsPerDegPerSec = <a class="code" href="a00800.html#ad729ac3263df225b8ebe64394c06ae5c">FXAS21000_COUNTSPERDEGPERSEC</a>;</div><div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;        sfg-&gt;Gyro.fDegPerSecPerCount = 1.0F / <a class="code" href="a00800.html#ad729ac3263df225b8ebe64394c06ae5c">FXAS21000_COUNTSPERDEGPERSEC</a>;</div><div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;        <span class="keywordflow">break</span>;</div><div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;    <span class="keywordflow">case</span> (<a class="code" href="a00026.html#adaef1d893f1cbf72eb0ed76a95ab3947">FXAS21002_WHO_AM_I_WHOAMI_PRE_VALUE</a>):</div><div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;    <span class="keywordflow">case</span> (<a class="code" href="a00026.html#adaac462191d7b9b2b0e1555f58e3a2c6">FXAS21002_WHO_AM_I_WHOAMI_PROD_VALUE</a>):</div><div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;        status = <a class="code" href="a00182.html#aaac4c4f34b4dd37d3f202a1dbb4b000b">Sensor_I2C_Write</a>(sensor-&gt;<a class="code" href="a03991.html#aa7b3c47e2be4d604bc40157d590d09b2">bus_driver</a>, &amp;sensor-&gt;<a class="code" href="a03991.html#ae75b47fd9e098d6bd3b28f6be6586998">deviceInfo</a>, sensor-&gt;<a class="code" href="a03991.html#a41a6aad09727eb120338c35535a652a6">addr</a>, FXAS21002_Initialization );</div><div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;        sfg-&gt;Gyro.iCountsPerDegPerSec = <a class="code" href="a00800.html#ac4b942f72b2c1d1a0f16d832fcabd716">FXAS21002_COUNTSPERDEGPERSEC</a>;</div><div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;        sfg-&gt;Gyro.fDegPerSecPerCount = 1.0F / <a class="code" href="a00800.html#ac4b942f72b2c1d1a0f16d832fcabd716">FXAS21002_COUNTSPERDEGPERSEC</a>;</div><div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;        <span class="keywordflow">break</span>;</div><div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;    }</div><div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;    sfg-&gt;Gyro.iFIFOCount=0;</div><div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;    sensor-&gt;<a class="code" href="a03991.html#a87223885ad859bb82fdc45644bc1f0b2">isInitialized</a> = <a class="code" href="a00917.html#aecf1505d7dbaa2569dd3f36bf05ab5a0">F_USING_GYRO</a>;</div><div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;    sfg-&gt;Gyro.isEnabled = <span class="keyword">true</span>;</div><div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;    <span class="keywordflow">return</span> (status);</div><div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;}</div><div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;</div><div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;<span class="comment">// read FXAS21002 gyro over I2C</span></div><div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;int8_t <a class="code" href="a00842.html#a1e2a1a192ed7f150fc24fc11df8d4c1e">FXAS21002_Read</a>(<span class="keyword">struct</span> <a class="code" href="a03991.html">PhysicalSensor</a> *sensor, <a class="code" href="a04047.html">SensorFusionGlobals</a> *sfg)</div><div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;{</div><div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;    uint8_t     I2C_Buffer[6 * <a class="code" href="a00800.html#a3fe2519a64ebf20f9d3c4648a3bcfc8b">FXAS21002_GYRO_FIFO_SIZE</a>]; <span class="comment">// I2C read buffer</span></div><div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;    int8_t      j;                              <span class="comment">// scratch</span></div><div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;    uint8_t     sensor_fifo_count = 1;</div><div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;    <a class="code" href="a00521.html#a5d7069350a7d7e65686c77a8038f462f">int32_t</a>     <a class="code" href="a00359.html#a369536ebfe385731562c0b55dd6f3a7c">status</a>;</div><div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;    int16_t     sample[3];</div><div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;</div><div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;    <span class="keywordflow">if</span>(sensor-&gt;<a class="code" href="a03991.html#a87223885ad859bb82fdc45644bc1f0b2">isInitialized</a> != <a class="code" href="a00917.html#aecf1505d7dbaa2569dd3f36bf05ab5a0">F_USING_GYRO</a>)</div><div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;    {</div><div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5aca7f5031b1497c3a8a4bcb78cce879dedd">SENSOR_ERROR_INIT</a>;</div><div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;    }</div><div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;</div><div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;     <span class="comment">// read the F_STATUS register (mapped to STATUS) and extract number of measurements available (lower 6 bits)</span></div><div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;    status =  <a class="code" href="a00182.html#aa75349faed7c77807cb88d9224aa2636">Sensor_I2C_Read</a>(sensor-&gt;<a class="code" href="a03991.html#aa7b3c47e2be4d604bc40157d590d09b2">bus_driver</a>, &amp;sensor-&gt;<a class="code" href="a03991.html#ae75b47fd9e098d6bd3b28f6be6586998">deviceInfo</a>, sensor-&gt;<a class="code" href="a03991.html#a41a6aad09727eb120338c35535a652a6">addr</a>, FXAS21002_F_STATUS_READ, I2C_Buffer );</div><div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;    <span class="keywordflow">if</span> (status==<a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5aca961b6871536a27c9e4718100e0024274">SENSOR_ERROR_NONE</a>) {</div><div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;<span class="preprocessor">#ifdef SIMULATOR_MODE</span></div><div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;        sensor_fifo_count = 1;</div><div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;<span class="preprocessor">#else</span></div><div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;        sensor_fifo_count = I2C_Buffer[0] &amp; <a class="code" href="a00026.html#ada61c95ee924cd9b5c24c6ccb9e52350">FXAS21002_F_STATUS_F_CNT_MASK</a> ;</div><div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;        <span class="comment">// return if there are no measurements in the FIFO.</span></div><div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;        <span class="comment">// this will only occur when the FAST_LOOP_HZ equals or exceeds GYRO_ODR_HZ</span></div><div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;        <span class="keywordflow">if</span> (sensor_fifo_count == 0) <span class="keywordflow">return</span>(<a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5acab93ad77156e08d1bebe52bf46936cccc">SENSOR_ERROR_READ</a>);</div><div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;    } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;        <span class="keywordflow">return</span>(status);</div><div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;    }</div><div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;</div><div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;    <span class="comment">// at this point there must be at least one measurement in the FIFO available to read.</span></div><div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;    <span class="comment">// handle the FXAS21000 and FXAS21002 differently because only FXAS21002 supports WRAPTOONE feature.</span></div><div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;    <span class="keywordflow">if</span> (sfg-&gt;Gyro.iWhoAmI == <a class="code" href="a00026.html#a453da16edf0685dc566ef0e6ef86fea7">FXAS21002_WHO_AM_I_WHOAMI_OLD_VALUE</a>)</div><div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;    {</div><div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;        <span class="comment">// read six sequential gyro output bytes</span></div><div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;        FXAS21002_DATA_READ[0].<a class="code" href="a03811.html#a5fe82375de174c0511ca301fec78e441">readFrom</a> = <a class="code" href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960ace58cd4daacb9bb55fe1e0efd0ae29ef">FXAS21002_OUT_X_MSB</a>;</div><div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;        FXAS21002_DATA_READ[0].<a class="code" href="a03811.html#a1440a8efa2f56cded09ced3ff687d32a">numBytes</a> = 6;</div><div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;</div><div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;        <span class="comment">// for FXAS21000, perform sequential 6 byte reads</span></div><div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;        <span class="keywordflow">for</span> (j = 0; j &lt; sensor_fifo_count; j++)</div><div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;        {</div><div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;            <span class="comment">// read one set of measurements totalling 6 bytes</span></div><div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;            status =  <a class="code" href="a00182.html#aa75349faed7c77807cb88d9224aa2636">Sensor_I2C_Read</a>(sensor-&gt;<a class="code" href="a03991.html#aa7b3c47e2be4d604bc40157d590d09b2">bus_driver</a>, &amp;sensor-&gt;<a class="code" href="a03991.html#ae75b47fd9e098d6bd3b28f6be6586998">deviceInfo</a>, sensor-&gt;<a class="code" href="a03991.html#a41a6aad09727eb120338c35535a652a6">addr</a>, FXAS21002_DATA_READ, I2C_Buffer );</div><div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;</div><div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;            <span class="keywordflow">if</span> (status==<a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5aca961b6871536a27c9e4718100e0024274">SENSOR_ERROR_NONE</a>) {</div><div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;                <span class="comment">// place the measurements read into the gyroscope buffer structure</span></div><div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;                sample[<a class="code" href="a00914.html#a48bbd27e913de8d7749dff9dec2fe816">CHX</a>] = (I2C_Buffer[0] &lt;&lt; 8) | I2C_Buffer[1];</div><div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;                sample[<a class="code" href="a00914.html#a6a25024f52cc6bea13d19f8b68456cea">CHY</a>] = (I2C_Buffer[2] &lt;&lt; 8) | I2C_Buffer[3];</div><div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;                sample[<a class="code" href="a00914.html#a76143891435bdd7248857e45b93521ed">CHZ</a>] = (I2C_Buffer[4] &lt;&lt; 8) | I2C_Buffer[5];</div><div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160;                <a class="code" href="a00911.html#a2686eeb8ae44e588362478db1f757a0e">conditionSample</a>(sample);  <span class="comment">// truncate negative values to -32767</span></div><div class="line"><a name="l00273"></a><span class="lineno">  273</span>&#160;                <a class="code" href="a00911.html#ae7d2343e9a63bd3879ae477ec4536f6a">addToFifo</a>((<span class="keyword">union</span> <a class="code" href="a04011.html">FifoSensor</a>*) &amp;(sfg-&gt;Gyro), <a class="code" href="a00917.html#a1388c3a115909f2b7e6aff6039e3fe79">GYRO_FIFO_SIZE</a>, sample);</div><div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160;            }</div><div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;        }</div><div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;    }   <span class="comment">// end of FXAS21000 FIFO read</span></div><div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;    <span class="keywordflow">else</span></div><div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;    {</div><div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160;        <span class="comment">// for FXAS21002, clear the FIFO in one using WRAPTOONE feature</span></div><div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;        FXAS21002_DATA_READ[0].<a class="code" href="a03811.html#a5fe82375de174c0511ca301fec78e441">readFrom</a> = <a class="code" href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960ace58cd4daacb9bb55fe1e0efd0ae29ef">FXAS21002_OUT_X_MSB</a>;</div><div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;        FXAS21002_DATA_READ[0].<a class="code" href="a03811.html#a1440a8efa2f56cded09ced3ff687d32a">numBytes</a> = 6 * sensor_fifo_count;</div><div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;        status =  <a class="code" href="a00182.html#aa75349faed7c77807cb88d9224aa2636">Sensor_I2C_Read</a>(sensor-&gt;<a class="code" href="a03991.html#aa7b3c47e2be4d604bc40157d590d09b2">bus_driver</a>, &amp;sensor-&gt;<a class="code" href="a03991.html#ae75b47fd9e098d6bd3b28f6be6586998">deviceInfo</a>, sensor-&gt;<a class="code" href="a03991.html#a41a6aad09727eb120338c35535a652a6">addr</a>, FXAS21002_DATA_READ, I2C_Buffer );</div><div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;</div><div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;        <span class="keywordflow">if</span> (status==<a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5aca961b6871536a27c9e4718100e0024274">SENSOR_ERROR_NONE</a>) {</div><div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;            <span class="keywordflow">for</span> (j = 0; j &lt; sensor_fifo_count; j++) {</div><div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;                <span class="comment">// place the measurements read into the gyroscope buffer structure</span></div><div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;                sample[<a class="code" href="a00914.html#a48bbd27e913de8d7749dff9dec2fe816">CHX</a>] = (I2C_Buffer[6*j + 0] &lt;&lt; 8) | I2C_Buffer[6*j + 1];</div><div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;                sample[<a class="code" href="a00914.html#a6a25024f52cc6bea13d19f8b68456cea">CHY</a>] = (I2C_Buffer[6*j + 2] &lt;&lt; 8) | I2C_Buffer[6*j + 3];</div><div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;                sample[<a class="code" href="a00914.html#a76143891435bdd7248857e45b93521ed">CHZ</a>] = (I2C_Buffer[6*j + 4] &lt;&lt; 8) | I2C_Buffer[6*j + 5];</div><div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;                <a class="code" href="a00911.html#a2686eeb8ae44e588362478db1f757a0e">conditionSample</a>(sample);  <span class="comment">// truncate negative values to -32767</span></div><div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;                <a class="code" href="a00911.html#ae7d2343e9a63bd3879ae477ec4536f6a">addToFifo</a>((<span class="keyword">union</span> <a class="code" href="a04011.html">FifoSensor</a>*) &amp;(sfg-&gt;Gyro), <a class="code" href="a00917.html#a1388c3a115909f2b7e6aff6039e3fe79">GYRO_FIFO_SIZE</a>, sample);</div><div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;            }</div><div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;        }</div><div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160;    }   <span class="comment">// end of optimized FXAS21002 FIFO read</span></div><div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;</div><div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="a00359.html#a369536ebfe385731562c0b55dd6f3a7c">status</a>;</div><div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;}</div><div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;</div><div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;</div><div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;<span class="comment">// Each entry in a RegisterWriteList is composed of: register address, value to write, bit-mask to apply to write (0 enables)</span></div><div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;<span class="keyword">const</span> <a class="code" href="a03807.html">registerwritelist_t</a>   FXAS21002_IDLE[] =</div><div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;{</div><div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;  <span class="comment">// Reset to Standby</span></div><div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;  { <a class="code" href="a00800.html#ac6cb6a8c57c8b6b6e835dd5615dab36c">FXAS21000_CTRL_REG1</a>, 0x00, 0x00 },</div><div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;    <a class="code" href="a00179.html#a2cedde333a6373a3ee274bde6af145d0">__END_WRITE_DATA__</a></div><div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160;};</div><div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;</div><div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;<span class="comment">// FXAS21002_Idle places the gyro into READY mode (wakeup time = 1/ODR+5ms)</span></div><div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160;int8_t <a class="code" href="a00842.html#ab2b8fae18f293a3068dc83760454401d">FXAS21002_Idle</a>(<span class="keyword">struct</span> <a class="code" href="a03991.html">PhysicalSensor</a> *sensor, <a class="code" href="a04047.html">SensorFusionGlobals</a> *sfg)</div><div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;{</div><div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;    <a class="code" href="a00521.html#a5d7069350a7d7e65686c77a8038f462f">int32_t</a>     <a class="code" href="a00359.html#a369536ebfe385731562c0b55dd6f3a7c">status</a>;</div><div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;    <span class="keywordflow">if</span>(sensor-&gt;<a class="code" href="a03991.html#a87223885ad859bb82fdc45644bc1f0b2">isInitialized</a> == <a class="code" href="a00917.html#aecf1505d7dbaa2569dd3f36bf05ab5a0">F_USING_GYRO</a>) {</div><div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;        status = <a class="code" href="a00182.html#aaac4c4f34b4dd37d3f202a1dbb4b000b">Sensor_I2C_Write</a>(sensor-&gt;<a class="code" href="a03991.html#aa7b3c47e2be4d604bc40157d590d09b2">bus_driver</a>, &amp;sensor-&gt;<a class="code" href="a03991.html#ae75b47fd9e098d6bd3b28f6be6586998">deviceInfo</a>, sensor-&gt;<a class="code" href="a03991.html#a41a6aad09727eb120338c35535a652a6">addr</a>, FXAS21002_IDLE );</div><div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;        sensor-&gt;<a class="code" href="a03991.html#a87223885ad859bb82fdc45644bc1f0b2">isInitialized</a> = 0;</div><div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;        sfg-&gt;Gyro.isEnabled = <span class="keyword">false</span>;</div><div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;    } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5aca7f5031b1497c3a8a4bcb78cce879dedd">SENSOR_ERROR_INIT</a>;</div><div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;    }</div><div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="a00359.html#a369536ebfe385731562c0b55dd6f3a7c">status</a>;</div><div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;}</div><div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;<span class="preprocessor">#endif</span></div><div class="ttc" id="a00026_html_adaac462191d7b9b2b0e1555f58e3a2c6"><div class="ttname"><a href="a00026.html#adaac462191d7b9b2b0e1555f58e3a2c6">FXAS21002_WHO_AM_I_WHOAMI_PROD_VALUE</a></div><div class="ttdeci">#define FXAS21002_WHO_AM_I_WHOAMI_PROD_VALUE</div><div class="ttdef"><b>Definition:</b> <a href="a00026_source.html#l00402">fxas21002.h:402</a></div></div>
52<div class="ttc" id="a00917_html_aecf1505d7dbaa2569dd3f36bf05ab5a0"><div class="ttname"><a href="a00917.html#aecf1505d7dbaa2569dd3f36bf05ab5a0">F_USING_GYRO</a></div><div class="ttdeci">#define F_USING_GYRO</div><div class="ttdoc">nominally 0x0004 if a gyro is to be used, 0x0000 otherwise </div><div class="ttdef"><b>Definition:</b> <a href="a00917_source.html#l00040">standard_build.h:40</a></div></div>
53<div class="ttc" id="a00182_html_aa75349faed7c77807cb88d9224aa2636"><div class="ttname"><a href="a00182.html#aa75349faed7c77807cb88d9224aa2636">Sensor_I2C_Read</a></div><div class="ttdeci">int32_t Sensor_I2C_Read(ARM_DRIVER_I2C *pCommDrv, registerDeviceInfo_t *devInfo, uint16_t slaveAddress, const registerreadlist_t *pReadList, uint8_t *pOutBuffer)</div><div class="ttdoc">Read register data from a sensor. </div><div class="ttdef"><b>Definition:</b> <a href="a00182_source.html#l00105">sensor_io_i2c.c:105</a></div></div>
54<div class="ttc" id="a03991_html_aa7b3c47e2be4d604bc40157d590d09b2"><div class="ttname"><a href="a03991.html#aa7b3c47e2be4d604bc40157d590d09b2">PhysicalSensor::bus_driver</a></div><div class="ttdeci">void * bus_driver</div><div class="ttdoc">should be of type (ARM_DRIVER_I2C* for I2C-based sensors, ARM_DRIVER_SPI* for SPI) ...</div><div class="ttdef"><b>Definition:</b> <a href="a00914_source.html#l00157">sensor_fusion.h:157</a></div></div>
55<div class="ttc" id="a03807_html"><div class="ttname"><a href="a03807.html">registerwritelist_t</a></div><div class="ttdoc">This structure defines the Write command List. </div><div class="ttdef"><b>Definition:</b> <a href="a00179_source.html#l00068">sensor_drv.h:68</a></div></div>
56<div class="ttc" id="a00359_html_a369536ebfe385731562c0b55dd6f3a7c"><div class="ttname"><a href="a00359.html#a369536ebfe385731562c0b55dd6f3a7c">status</a></div><div class="ttdeci">int32_t status</div><div class="ttdef"><b>Definition:</b> <a href="a00359_source.html#l00248">fxls896xaf_freemaster_demo.c:248</a></div></div>
57<div class="ttc" id="a00179_html_a18a00cbfd8ad83c7fd229cd0d5fad5aca961b6871536a27c9e4718100e0024274"><div class="ttname"><a href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5aca961b6871536a27c9e4718100e0024274">SENSOR_ERROR_NONE</a></div><div class="ttdef"><b>Definition:</b> <a href="a00179_source.html#l00033">sensor_drv.h:33</a></div></div>
58<div class="ttc" id="a00842_html"><div class="ttname"><a href="a00842.html">drivers.h</a></div><div class="ttdoc">Provides function prototypes for driver level interfaces. </div></div>
59<div class="ttc" id="a00167_html_ac8a60c799d9dbc84531b4680762eb8dc"><div class="ttname"><a href="a00167.html#ac8a60c799d9dbc84531b4680762eb8dc">Register_I2C_Read</a></div><div class="ttdeci">int32_t Register_I2C_Read(ARM_DRIVER_I2C *pCommDrv, registerDeviceInfo_t *devInfo, uint16_t slaveAddress, uint8_t offset, uint8_t length, uint8_t *pOutBuffer)</div><div class="ttdoc">The interface function to read a sensor register. </div><div class="ttdef"><b>Definition:</b> <a href="a00167_source.html#l00310">register_io_i2c.c:310</a></div></div>
60<div class="ttc" id="a00179_html_a18a00cbfd8ad83c7fd229cd0d5fad5aca7f5031b1497c3a8a4bcb78cce879dedd"><div class="ttname"><a href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5aca7f5031b1497c3a8a4bcb78cce879dedd">SENSOR_ERROR_INIT</a></div><div class="ttdef"><b>Definition:</b> <a href="a00179_source.html#l00036">sensor_drv.h:36</a></div></div>
61<div class="ttc" id="a03991_html"><div class="ttname"><a href="a03991.html">PhysicalSensor</a></div><div class="ttdoc">An instance of PhysicalSensor structure type should be allocated for each physical sensors (combo dev...</div><div class="ttdef"><b>Definition:</b> <a href="a00914_source.html#l00155">sensor_fusion.h:155</a></div></div>
62<div class="ttc" id="a00911_html_a2686eeb8ae44e588362478db1f757a0e"><div class="ttname"><a href="a00911.html#a2686eeb8ae44e588362478db1f757a0e">conditionSample</a></div><div class="ttdeci">void conditionSample(int16_t sample[3])</div><div class="ttdoc">conditionSample ensures that we never encounter the maximum negative two&amp;#39;s complement value for a 16-...</div><div class="ttdef"><b>Definition:</b> <a href="a00911_source.html#l00510">sensor_fusion.c:510</a></div></div>
63<div class="ttc" id="a00914_html_a76143891435bdd7248857e45b93521ed"><div class="ttname"><a href="a00914.html#a76143891435bdd7248857e45b93521ed">CHZ</a></div><div class="ttdeci">#define CHZ</div><div class="ttdoc">Used to access Z-channel entries in various data data structures. </div><div class="ttdef"><b>Definition:</b> <a href="a00914_source.html#l00062">sensor_fusion.h:62</a></div></div>
64<div class="ttc" id="a00911_html_ae7d2343e9a63bd3879ae477ec4536f6a"><div class="ttname"><a href="a00911.html#ae7d2343e9a63bd3879ae477ec4536f6a">addToFifo</a></div><div class="ttdeci">void addToFifo(union FifoSensor *sensor, uint16_t maxFifoSize, int16_t sample[3])</div><div class="ttdoc">addToFifo is called from within sensor driver read functions </div><div class="ttdef"><b>Definition:</b> <a href="a00911_source.html#l00522">sensor_fusion.c:522</a></div></div>
65<div class="ttc" id="a00800_html_ad729ac3263df225b8ebe64394c06ae5c"><div class="ttname"><a href="a00800.html#ad729ac3263df225b8ebe64394c06ae5c">FXAS21000_COUNTSPERDEGPERSEC</a></div><div class="ttdeci">#define FXAS21000_COUNTSPERDEGPERSEC</div><div class="ttdef"><b>Definition:</b> <a href="a00800_source.html#l00029">driver_FXAS21002.c:29</a></div></div>
66<div class="ttc" id="a00026_html_ada61c95ee924cd9b5c24c6ccb9e52350"><div class="ttname"><a href="a00026.html#ada61c95ee924cd9b5c24c6ccb9e52350">FXAS21002_F_STATUS_F_CNT_MASK</a></div><div class="ttdeci">#define FXAS21002_F_STATUS_F_CNT_MASK</div><div class="ttdef"><b>Definition:</b> <a href="a00026_source.html#l00231">fxas21002.h:231</a></div></div>
67<div class="ttc" id="a00179_html"><div class="ttname"><a href="a00179.html">sensor_drv.h</a></div><div class="ttdoc">The sensor_drv.h file contains sensor state and error definitions. </div></div>
68<div class="ttc" id="a00179_html_a2cedde333a6373a3ee274bde6af145d0"><div class="ttname"><a href="a00179.html#a2cedde333a6373a3ee274bde6af145d0">__END_WRITE_DATA__</a></div><div class="ttdeci">#define __END_WRITE_DATA__</div><div class="ttdef"><b>Definition:</b> <a href="a00179_source.html#l00045">sensor_drv.h:45</a></div></div>
69<div class="ttc" id="a04047_html"><div class="ttname"><a href="a04047.html">SensorFusionGlobals</a></div><div class="ttdoc">The top level fusion structure. </div><div class="ttdef"><b>Definition:</b> <a href="a00914_source.html#l00454">sensor_fusion.h:454</a></div></div>
70<div class="ttc" id="a00026_html_af9bdc3014f3d54c426b6d2df10de4960ace58cd4daacb9bb55fe1e0efd0ae29ef"><div class="ttname"><a href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960ace58cd4daacb9bb55fe1e0efd0ae29ef">FXAS21002_OUT_X_MSB</a></div><div class="ttdef"><b>Definition:</b> <a href="a00026_source.html#l00028">fxas21002.h:28</a></div></div>
71<div class="ttc" id="a00914_html_a6a25024f52cc6bea13d19f8b68456cea"><div class="ttname"><a href="a00914.html#a6a25024f52cc6bea13d19f8b68456cea">CHY</a></div><div class="ttdeci">#define CHY</div><div class="ttdoc">Used to access Y-channel entries in various data data structures. </div><div class="ttdef"><b>Definition:</b> <a href="a00914_source.html#l00061">sensor_fusion.h:61</a></div></div>
72<div class="ttc" id="a00521_html_a5d7069350a7d7e65686c77a8038f462f"><div class="ttname"><a href="a00521.html#a5d7069350a7d7e65686c77a8038f462f">int32_t</a></div><div class="ttdeci">typedef int32_t(DATA_FORMAT_Append_t))(void *pData</div><div class="ttdoc">The interface function to append the data on the formated stream. </div></div>
73<div class="ttc" id="a00026_html_af9bdc3014f3d54c426b6d2df10de4960a345fd7be5bf46d6515984e587441e209"><div class="ttname"><a href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960a345fd7be5bf46d6515984e587441e209">FXAS21002_CTRL_REG3</a></div><div class="ttdef"><b>Definition:</b> <a href="a00026_source.html#l00048">fxas21002.h:48</a></div></div>
74<div class="ttc" id="a00842_html_a81c5b987e709b3991bc7c1bc1e659c1f"><div class="ttname"><a href="a00842.html#a81c5b987e709b3991bc7c1bc1e659c1f">FXAS21002_Init</a></div><div class="ttdeci">int8_t FXAS21002_Init(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)</div></div>
75<div class="ttc" id="a00026_html_af9bdc3014f3d54c426b6d2df10de4960a3cf3a9aa10883bc5bc48b8c6d4a93dd4"><div class="ttname"><a href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960a3cf3a9aa10883bc5bc48b8c6d4a93dd4">FXAS21002_CTRL_REG0</a></div><div class="ttdef"><b>Definition:</b> <a href="a00026_source.html#l00040">fxas21002.h:40</a></div></div>
76<div class="ttc" id="a00182_html_aaac4c4f34b4dd37d3f202a1dbb4b000b"><div class="ttname"><a href="a00182.html#aaac4c4f34b4dd37d3f202a1dbb4b000b">Sensor_I2C_Write</a></div><div class="ttdeci">int32_t Sensor_I2C_Write(ARM_DRIVER_I2C *pCommDrv, registerDeviceInfo_t *devInfo, uint16_t slaveAddress, const registerwritelist_t *pRegWriteList)</div><div class="ttdoc">Write register data to a sensor. </div><div class="ttdef"><b>Definition:</b> <a href="a00182_source.html#l00071">sensor_io_i2c.c:71</a></div></div>
77<div class="ttc" id="a03991_html_ae75b47fd9e098d6bd3b28f6be6586998"><div class="ttname"><a href="a03991.html#ae75b47fd9e098d6bd3b28f6be6586998">PhysicalSensor::deviceInfo</a></div><div class="ttdeci">registerDeviceInfo_t deviceInfo</div><div class="ttdoc">I2C device context. </div><div class="ttdef"><b>Definition:</b> <a href="a00914_source.html#l00156">sensor_fusion.h:156</a></div></div>
78<div class="ttc" id="a03811_html_a1440a8efa2f56cded09ced3ff687d32a"><div class="ttname"><a href="a03811.html#a1440a8efa2f56cded09ced3ff687d32a">registerreadlist_t::numBytes</a></div><div class="ttdeci">uint8_t numBytes</div><div class="ttdef"><b>Definition:</b> <a href="a00179_source.html#l00081">sensor_drv.h:81</a></div></div>
79<div class="ttc" id="a00026_html"><div class="ttname"><a href="a00026.html">fxas21002.h</a></div><div class="ttdoc">The fxas21002.h contains the fxas21002 sensor register definitions and its bit mask. </div></div>
80<div class="ttc" id="a00179_html_a18a00cbfd8ad83c7fd229cd0d5fad5acab93ad77156e08d1bebe52bf46936cccc"><div class="ttname"><a href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5acab93ad77156e08d1bebe52bf46936cccc">SENSOR_ERROR_READ</a></div><div class="ttdef"><b>Definition:</b> <a href="a00179_source.html#l00038">sensor_drv.h:38</a></div></div>
81<div class="ttc" id="a00914_html"><div class="ttname"><a href="a00914.html">sensor_fusion.h</a></div><div class="ttdoc">The sensor_fusion.h file implements the top level programming interface. </div></div>
82<div class="ttc" id="a00026_html_a453da16edf0685dc566ef0e6ef86fea7"><div class="ttname"><a href="a00026.html#a453da16edf0685dc566ef0e6ef86fea7">FXAS21002_WHO_AM_I_WHOAMI_OLD_VALUE</a></div><div class="ttdeci">#define FXAS21002_WHO_AM_I_WHOAMI_OLD_VALUE</div><div class="ttdef"><b>Definition:</b> <a href="a00026_source.html#l00400">fxas21002.h:400</a></div></div>
83<div class="ttc" id="a00179_html_aebb58a1bb3df30b7df4f6f14d0f1a81d"><div class="ttname"><a href="a00179.html#aebb58a1bb3df30b7df4f6f14d0f1a81d">__END_READ_DATA__</a></div><div class="ttdeci">#define __END_READ_DATA__</div><div class="ttdef"><b>Definition:</b> <a href="a00179_source.html#l00051">sensor_drv.h:51</a></div></div>
84<div class="ttc" id="a00800_html_a3fe2519a64ebf20f9d3c4648a3bcfc8b"><div class="ttname"><a href="a00800.html#a3fe2519a64ebf20f9d3c4648a3bcfc8b">FXAS21002_GYRO_FIFO_SIZE</a></div><div class="ttdeci">#define FXAS21002_GYRO_FIFO_SIZE</div><div class="ttdoc">FXAX21000, FXAS21002 have 32 element FIFO. </div><div class="ttdef"><b>Definition:</b> <a href="a00800_source.html#l00032">driver_FXAS21002.c:32</a></div></div>
85<div class="ttc" id="a00800_html_a100ef421feb1ba8269d586eb41ee464a"><div class="ttname"><a href="a00800.html#a100ef421feb1ba8269d586eb41ee464a">FXAS21000_F_SETUP</a></div><div class="ttdeci">#define FXAS21000_F_SETUP</div><div class="ttdef"><b>Definition:</b> <a href="a00800_source.html#l00023">driver_FXAS21002.c:23</a></div></div>
86<div class="ttc" id="a00842_html_ab2b8fae18f293a3068dc83760454401d"><div class="ttname"><a href="a00842.html#ab2b8fae18f293a3068dc83760454401d">FXAS21002_Idle</a></div><div class="ttdeci">int8_t FXAS21002_Idle(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)</div></div>
87<div class="ttc" id="a00026_html_af9bdc3014f3d54c426b6d2df10de4960ad079911b60aa18a2aaeb622eb7bb96eb"><div class="ttname"><a href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960ad079911b60aa18a2aaeb622eb7bb96eb">FXAS21002_STATUS</a></div><div class="ttdef"><b>Definition:</b> <a href="a00026_source.html#l00027">fxas21002.h:27</a></div></div>
88<div class="ttc" id="a00800_html_ac6cb6a8c57c8b6b6e835dd5615dab36c"><div class="ttname"><a href="a00800.html#ac6cb6a8c57c8b6b6e835dd5615dab36c">FXAS21000_CTRL_REG1</a></div><div class="ttdeci">#define FXAS21000_CTRL_REG1</div><div class="ttdef"><b>Definition:</b> <a href="a00800_source.html#l00026">driver_FXAS21002.c:26</a></div></div>
89<div class="ttc" id="a00800_html_ac021112534d845ac5dd9235c86bb929d"><div class="ttname"><a href="a00800.html#ac021112534d845ac5dd9235c86bb929d">FXAS21000_WHO_AM_I_VALUE</a></div><div class="ttdeci">#define FXAS21000_WHO_AM_I_VALUE</div><div class="ttdef"><b>Definition:</b> <a href="a00800_source.html#l00028">driver_FXAS21002.c:28</a></div></div>
90<div class="ttc" id="a00800_html_ac4b942f72b2c1d1a0f16d832fcabd716"><div class="ttname"><a href="a00800.html#ac4b942f72b2c1d1a0f16d832fcabd716">FXAS21002_COUNTSPERDEGPERSEC</a></div><div class="ttdeci">#define FXAS21002_COUNTSPERDEGPERSEC</div><div class="ttdef"><b>Definition:</b> <a href="a00800_source.html#l00030">driver_FXAS21002.c:30</a></div></div>
91<div class="ttc" id="a00470_html_afa81c629d378fe700f351a1bce411ad5"><div class="ttname"><a href="a00470.html#afa81c629d378fe700f351a1bce411ad5">sfg</a></div><div class="ttdeci">SensorFusionGlobals sfg</div><div class="ttdef"><b>Definition:</b> <a href="a00470_source.html#l00075">orientaion_application_baremetal_agm01.c:75</a></div></div>
92<div class="ttc" id="a00026_html_af9bdc3014f3d54c426b6d2df10de4960a9c66d687be93ad245ccc01f865760180"><div class="ttname"><a href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960a9c66d687be93ad245ccc01f865760180">FXAS21002_WHO_AM_I</a></div><div class="ttdef"><b>Definition:</b> <a href="a00026_source.html#l00039">fxas21002.h:39</a></div></div>
93<div class="ttc" id="a03811_html_a5fe82375de174c0511ca301fec78e441"><div class="ttname"><a href="a03811.html#a5fe82375de174c0511ca301fec78e441">registerreadlist_t::readFrom</a></div><div class="ttdeci">uint16_t readFrom</div><div class="ttdef"><b>Definition:</b> <a href="a00179_source.html#l00080">sensor_drv.h:80</a></div></div>
94<div class="ttc" id="a00026_html_af9bdc3014f3d54c426b6d2df10de4960ad939828458795636669a334549deb39d"><div class="ttname"><a href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960ad939828458795636669a334549deb39d">FXAS21002_CTRL_REG1</a></div><div class="ttdef"><b>Definition:</b> <a href="a00026_source.html#l00046">fxas21002.h:46</a></div></div>
95<div class="ttc" id="a00917_html_a1388c3a115909f2b7e6aff6039e3fe79"><div class="ttname"><a href="a00917.html#a1388c3a115909f2b7e6aff6039e3fe79">GYRO_FIFO_SIZE</a></div><div class="ttdeci">#define GYRO_FIFO_SIZE</div><div class="ttdoc">FXAX21000, FXAS21002 have 32 element FIFO. </div><div class="ttdef"><b>Definition:</b> <a href="a00917_source.html#l00064">standard_build.h:64</a></div></div>
96<div class="ttc" id="a03991_html_a87223885ad859bb82fdc45644bc1f0b2"><div class="ttname"><a href="a03991.html#a87223885ad859bb82fdc45644bc1f0b2">PhysicalSensor::isInitialized</a></div><div class="ttdeci">uint16_t isInitialized</div><div class="ttdoc">Bitfields to indicate sensor is active (use SensorBitFields from build.h) </div><div class="ttdef"><b>Definition:</b> <a href="a00914_source.html#l00160">sensor_fusion.h:160</a></div></div>
97<div class="ttc" id="a00026_html_adaef1d893f1cbf72eb0ed76a95ab3947"><div class="ttname"><a href="a00026.html#adaef1d893f1cbf72eb0ed76a95ab3947">FXAS21002_WHO_AM_I_WHOAMI_PRE_VALUE</a></div><div class="ttdeci">#define FXAS21002_WHO_AM_I_WHOAMI_PRE_VALUE</div><div class="ttdef"><b>Definition:</b> <a href="a00026_source.html#l00401">fxas21002.h:401</a></div></div>
98<div class="ttc" id="a03811_html"><div class="ttname"><a href="a03811.html">registerreadlist_t</a></div><div class="ttdoc">This structure defines the Read command List. </div><div class="ttdef"><b>Definition:</b> <a href="a00179_source.html#l00078">sensor_drv.h:78</a></div></div>
99<div class="ttc" id="a00026_html_af9bdc3014f3d54c426b6d2df10de4960a99235fc2aa5beb513d8969d99fb103a0"><div class="ttname"><a href="a00026.html#af9bdc3014f3d54c426b6d2df10de4960a99235fc2aa5beb513d8969d99fb103a0">FXAS21002_F_SETUP</a></div><div class="ttdef"><b>Definition:</b> <a href="a00026_source.html#l00036">fxas21002.h:36</a></div></div>
100<div class="ttc" id="a00914_html_a48bbd27e913de8d7749dff9dec2fe816"><div class="ttname"><a href="a00914.html#a48bbd27e913de8d7749dff9dec2fe816">CHX</a></div><div class="ttdeci">#define CHX</div><div class="ttdoc">Used to access X-channel entries in various data data structures. </div><div class="ttdef"><b>Definition:</b> <a href="a00914_source.html#l00060">sensor_fusion.h:60</a></div></div>
101<div class="ttc" id="a04011_html"><div class="ttname"><a href="a04011.html">FifoSensor</a></div><div class="ttdoc">The FifoSensor union allows us to use common pointers for Accel, Mag &amp; Gyro logical sensor structures...</div><div class="ttdef"><b>Definition:</b> <a href="a00914_source.html#l00253">sensor_fusion.h:253</a></div></div>
102<div class="ttc" id="a03991_html_a41a6aad09727eb120338c35535a652a6"><div class="ttname"><a href="a03991.html#a41a6aad09727eb120338c35535a652a6">PhysicalSensor::addr</a></div><div class="ttdeci">uint16_t addr</div><div class="ttdoc">I2C address if applicable. </div><div class="ttdef"><b>Definition:</b> <a href="a00914_source.html#l00159">sensor_fusion.h:159</a></div></div>
103<div class="ttc" id="a00842_html_a1e2a1a192ed7f150fc24fc11df8d4c1e"><div class="ttname"><a href="a00842.html#a1e2a1a192ed7f150fc24fc11df8d4c1e">FXAS21002_Read</a></div><div class="ttdeci">int8_t FXAS21002_Read(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)</div></div>
104<div class="ttc" id="a00800_html_abee9f1d68dad80b6075c2fe493aa6c9e"><div class="ttname"><a href="a00800.html#abee9f1d68dad80b6075c2fe493aa6c9e">FXAS21000_CTRL_REG0</a></div><div class="ttdeci">#define FXAS21000_CTRL_REG0</div><div class="ttdef"><b>Definition:</b> <a href="a00800_source.html#l00025">driver_FXAS21002.c:25</a></div></div>
105<div class="ttc" id="a00185_html"><div class="ttname"><a href="a00185.html">sensor_io_i2c.h</a></div><div class="ttdoc">The sensor_io_i2c.h file declares low-level interface functions for reading and writing sensor regist...</div></div>
106</div><!-- fragment --></div><!-- contents -->
107
108<hr class="footer"/><address class="footer"><small>
109&copy; Copyright 2016-2022 NXP. All Rights Reserved. SPDX-License-Identifier: BSD-3-Clause
110</small></address>
111</body>
112</html>
113