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_FXLS8952.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_FXLS8952.c</div>  </div>
49</div><!--header-->
50<div class="contents">
51<a href="a00806.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_FXLS8952.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 FXLS8952 3-axis accelerometer</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="a00185.html">sensor_io_i2c.h</a>&quot;</span>              <span class="comment">// Required for registerreadlist_t / registerwritelist_t declarations</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="a00179.html">sensor_drv.h</a>&quot;</span>                 <span class="comment">// Contains sensor state and error definitions</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#include &quot;FXLS8952.h&quot;</span>                   <span class="comment">// describes the FXLS8952 register definition and its bit mask</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</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="l00019"></a><span class="lineno"><a class="line" href="a00806.html#a31f854b8f26bf2bdb3c23645760f9903">   19</a></span>&#160;<span class="preprocessor">#define FXLS8952_COUNTSPERG 512</span></div><div class="line"><a name="l00020"></a><span class="lineno"><a class="line" href="a00806.html#a5396302f349853253b5390288ef2e3a6">   20</a></span>&#160;<span class="preprocessor">#define FXLS8952_ACCEL_FIFO_SIZE 32</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="preprocessor">#if F_USING_ACCEL</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment">// Command definition to read the WHO_AM_I value.</span></div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="keyword">const</span> <a class="code" href="a03811.html">registerreadlist_t</a>    FXLS8952_WHO_AM_I_READ[] =</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;{</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;    { .<a class="code" href="a03811.html#a5fe82375de174c0511ca301fec78e441">readFrom</a> = FXLS8952_WHO_AM_I, .numBytes = 1 }, <a class="code" href="a00179.html#aebb58a1bb3df30b7df4f6f14d0f1a81d">__END_READ_DATA__</a></div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;};</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="comment">// Command definition to read the number of entries in the accel FIFO.</span></div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="keyword">const</span> <a class="code" href="a03811.html">registerreadlist_t</a>    FXLS8952_BUF_STATUS_READ[] =</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;{</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    { .<a class="code" href="a03811.html#a5fe82375de174c0511ca301fec78e441">readFrom</a> = FXLS8952_BUF_STATUS, .numBytes = 1 }, <a class="code" href="a00179.html#aebb58a1bb3df30b7df4f6f14d0f1a81d">__END_READ_DATA__</a></div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;};</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 number of entries in the accel FIFO.</span></div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<a class="code" href="a03811.html">registerreadlist_t</a>          FXLS8952_DATA_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> = FXLS8952_BUF_X_LSB, .numBytes = 6 }, <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">// 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="l00043"></a><span class="lineno">   43</span>&#160;<span class="keyword">const</span> <a class="code" href="a03807.html">registerwritelist_t</a>   FXLS8952_Initialization[] =</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;    <span class="comment">// write 0000 0000 = 0x00 to SENS_CONFIG1 to place FXLS8952 into standby</span></div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;    <span class="comment">// [7-1]: Set when taking the part out of standby</span></div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    <span class="comment">// [0]: ACTIVE=0 for standby</span></div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;    { FXLS8952_SENS_CONFIG1, 0x00, 0x00 },</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;    <span class="comment">// write 0010 0000 = 0x20 to BUF_CONFIG1 to enable FIFO in continuous (circular) mode</span></div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;    <span class="comment">// [7]: BUF_TYPE=0 for FIFO (not FILO) operation</span></div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    <span class="comment">// [6-5]: BUF_MODE[1-0]=01 for FIFO continuous mode</span></div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;    <span class="comment">// [4]: BUF_GATE=0 to flush buffer on transitions</span></div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;    <span class="comment">// [3]: TRIG_SDCD_AND=0</span></div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;    <span class="comment">// [2]: TRIG_SDCD_OR=0</span></div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;    <span class="comment">// [1] Reserved=0</span></div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    <span class="comment">// [0]: TRIG_ORIENT=0</span></div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    { FXLS8952_BUF_CONFIG1, 0x20, 0x00 },</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    <span class="comment">// write 0101 0000 = 0x50 to SENS_CONFIG2 register to set High Performance Mode</span></div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;    <span class="comment">// [7-6]: WAKE_PM=01 for High Performance Mode</span></div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    <span class="comment">// [5-4]: SLEEP_PM=01 for High Performance Mode</span></div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    <span class="comment">// [3]: LE_BE=0 for Little Endian</span></div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    <span class="comment">// [2]: BLOCK=0 for normal latching</span></div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    <span class="comment">// [1]: AINC_TEMP=0 to not include temperature in auto increment</span></div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    <span class="comment">// [0]: F_READ=0 for normal 12 bit reads</span></div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    { FXLS8952_SENS_CONFIG2, 0x50, 0x00 },</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;     <span class="comment">// write XXXX 0000 = to SENS_CONFIG3 register to set ODR</span></div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;    <span class="comment">// [7-4]: WAKE_ODR=1100 for 0.781Hz ODR and 4096x decimation from 3200Hz giving 0xC0</span></div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;    <span class="comment">// [7-4]: WAKE_ODR=1011 for 1.56Hz ODR and 12048x decimation from 3200Hz giving 0xB0</span></div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    <span class="comment">// [7-4]: WAKE_ODR=1010 for 3.125Hz ODR and 1024x decimation from 3200Hz giving 0xA0</span></div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;    <span class="comment">// [7-4]: WAKE_ODR=1001 for 6.25Hz ODR and 512x decimation from 3200Hz giving 0x90</span></div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;    <span class="comment">// [7-4]: WAKE_ODR=1000 for 12.5Hz ODR and 256x decimation from 3200Hz giving 0x80</span></div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    <span class="comment">// [7-4]: WAKE_ODR=0111 for 25Hz ODR and 128x decimation from 3200Hz giving 0x70</span></div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    <span class="comment">// [7-4]: WAKE_ODR=0110 for 50Hz ODR and 64x decimation from 3200Hz giving 0x60</span></div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    <span class="comment">// [7-4]: WAKE_ODR=0101 for 100Hz ODR and 32x decimation from 3200Hz giving 0x50</span></div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    <span class="comment">// [7-4]: WAKE_ODR=0100 for 200Hz ODR and 16x decimation from 3200Hz giving 0x40</span></div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    <span class="comment">// [7-4]: WAKE_ODR=0011 for 400Hz ODR and 8x decimation from 3200Hz giving 0x30</span></div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;    <span class="comment">// [7-4]: WAKE_ODR=0010 for 800Hz ODR and 4x decimation from 3200Hz giving 0x20</span></div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    <span class="comment">// [7-4]: WAKE_ODR=0001 for 1600Hz ODR and 2x decimation from 3200Hz giving 0x10</span></div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;    <span class="comment">// [7-4]: WAKE_ODR=0000 for 3200Hz ODR and 1x decimation from 3200Hz giving 0x00</span></div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;    <span class="comment">// [3-0]: SLEEP_ODR=0000</span></div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;<span class="preprocessor">#if   (ACCEL_ODR_HZ &lt;= 1) // select 0.781Hz ODR</span></div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;                { FXLS8952_SENS_CONFIG3, 0xC0, 0x00 },</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;<span class="preprocessor">#elif (ACCEL_ODR_HZ &lt;= 2) // select 1.5625Hz ODR</span></div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;                { FXLS8952_SENS_CONFIG3, 0x80, 0x00 },</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;<span class="preprocessor">#elif (ACCEL_ODR_HZ &lt;= 3) // select 3.125Hz ODR</span></div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;                { FXLS8952_SENS_CONFIG3, 0xA0, 0x00 },</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;<span class="preprocessor">#elif (ACCEL_ODR_HZ &lt;= 6) // select 6.25Hz ODR</span></div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;                { FXLS8952_SENS_CONFIG3, 0x90, 0x00 },</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;<span class="preprocessor">#elif (ACCEL_ODR_HZ &lt;= 12) // select 12.5Hz ODR</span></div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;                { FXLS8952_SENS_CONFIG3, 0x80, 0x00 },</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;<span class="preprocessor">#elif (ACCEL_ODR_HZ &lt;= 25) // select 25Hz ODR</span></div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;                { FXLS8952_SENS_CONFIG3, 0x70, 0x00 },</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;<span class="preprocessor">#elif (ACCEL_ODR_HZ &lt;= 50) // select 50Hz ODR</span></div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;                { FXLS8952_SENS_CONFIG3, 0x60, 0x00 },</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;<span class="preprocessor">#elif (ACCEL_ODR_HZ &lt;= 100) // select 100Hz ODR</span></div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;                { FXLS8952_SENS_CONFIG3, 0x50, 0x00 },</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;<span class="preprocessor">#elif (ACCEL_ODR_HZ &lt;= 200) // select 200Hz ODR</span></div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;                { FXLS8952_SENS_CONFIG3, 0x40, 0x00 },</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;<span class="preprocessor">#elif (ACCEL_ODR_HZ &lt;= 400) // select 400Hz ODR</span></div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;                { FXLS8952_SENS_CONFIG3, 0x30, 0x00 },</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;<span class="preprocessor">#elif (ACCEL_ODR_HZ &lt;= 800) // select 800Hz ODR</span></div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;                { FXLS8952_SENS_CONFIG3, 0x20, 0x00 },</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;<span class="preprocessor">#elif (ACCEL_ODR_HZ &lt;= 1600) // select 1600Hz ODR</span></div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;                { FXLS8952_SENS_CONFIG3, 0x10, 0x00 },</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;<span class="preprocessor">#else  // select 3200Hz ODR</span></div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;                { FXLS8952_SENS_CONFIG3, 0x00, 0x00 },</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;<span class="preprocessor">#endif</span></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">// write 0000 0011 = 0x03 to SENS_CONFIG1 to configure 4g mode and Active mode</span></div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;    <span class="comment">// [7]: RST=0 for no software reset</span></div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;    <span class="comment">// [6-5]: ST_AXIS_SEL=00 to disable self test</span></div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    <span class="comment">// [4]: ST_POL=0 (default)</span></div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;    <span class="comment">// [3]: AWS_EN=0 (default)</span></div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    <span class="comment">// [2-1]: FSR=01 for 4g mode</span></div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;    <span class="comment">// [1]: ACTIVE=1 for standby</span></div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;    { FXLS8952_SENS_CONFIG1, 0x03, 0x00 },</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    <a class="code" href="a00179.html#a2cedde333a6373a3ee274bde6af145d0">__END_WRITE_DATA__</a></div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;};</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;<span class="comment">// All sensor drivers and initialization functions have the same prototype.</span></div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;<span class="comment">// sfg is a pointer to the master &quot;global&quot; sensor fusion structure.</span></div><div class="line"><a name="l00125"></a><span class="lineno">  125</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="l00126"></a><span class="lineno">  126</span>&#160;</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;<span class="comment">// sfg = pointer to top level (generally global) data structure for sensor fusion</span></div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;int8_t <a class="code" href="a00842.html#ae47d028795d19902358ad6644c2995f7">FXLS8952_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="l00129"></a><span class="lineno">  129</span>&#160;{</div><div class="line"><a name="l00130"></a><span class="lineno">  130</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="l00131"></a><span class="lineno">  131</span>&#160;    uint8_t reg;</div><div class="line"><a name="l00132"></a><span class="lineno">  132</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>, FXLS8952_WHO_AM_I, 1, &amp;reg);</div><div class="line"><a name="l00133"></a><span class="lineno">  133</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="l00134"></a><span class="lineno">  134</span>&#160;        <span class="keywordflow">if</span> (reg==FXLS8952_WHOAMI_VALUE) {</div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;            sfg-&gt;Accel.iWhoAmI = reg;</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;        } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;            <span class="keywordflow">return</span>(<a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5aca7f5031b1497c3a8a4bcb78cce879dedd">SENSOR_ERROR_INIT</a>);</div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;        }</div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;      } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;        <span class="keywordflow">return</span>(status);</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;    }</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;    <span class="comment">// Configure and start the FXLS8952 sensor.  This does multiple register writes</span></div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;    <span class="comment">// (see FXLS8952_Initialization definition above)</span></div><div class="line"><a name="l00145"></a><span class="lineno">  145</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>, FXLS8952_Initialization );</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;</div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;    <span class="comment">// Stash some needed constants in the SF data structure for this sensor</span></div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;    sfg-&gt;Accel.iCountsPerg = <a class="code" href="a00806.html#a31f854b8f26bf2bdb3c23645760f9903">FXLS8952_COUNTSPERG</a>;</div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;    sfg-&gt;Accel.fgPerCount = 1.0F / <a class="code" href="a00806.html#a31f854b8f26bf2bdb3c23645760f9903">FXLS8952_COUNTSPERG</a>;</div><div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;    sfg-&gt;Accel.fgPerCount = 1.0F / <a class="code" href="a00806.html#a31f854b8f26bf2bdb3c23645760f9903">FXLS8952_COUNTSPERG</a>;</div><div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;</div><div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;    sensor-&gt;<a class="code" href="a03991.html#a87223885ad859bb82fdc45644bc1f0b2">isInitialized</a> = <a class="code" href="a00917.html#a8f284d04ec459633d30dc85cf0a32a0d">F_USING_ACCEL</a>;</div><div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;    sfg-&gt;Accel.isEnabled = <span class="keyword">true</span>;</div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;</div><div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;    <span class="keywordflow">return</span> (status);</div><div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;}</div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;int8_t <a class="code" href="a00842.html#aed1eb4f64f11c00b221a14839b996d1e">FXLS8952_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="l00159"></a><span class="lineno">  159</span>&#160;{</div><div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;    uint8_t                     I2C_Buffer[6 * <a class="code" href="a00806.html#a5396302f349853253b5390288ef2e3a6">FXLS8952_ACCEL_FIFO_SIZE</a>];    <span class="comment">// I2C read buffer</span></div><div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;    int8_t                      <a class="code" href="a00359.html#a369536ebfe385731562c0b55dd6f3a7c">status</a>;         <span class="comment">// I2C transaction status</span></div><div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;    int8_t                      j;              <span class="comment">// scratch</span></div><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;    uint8_t                     sensor_fifo_count = 1;</div><div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;    int16_t                     sample[3];</div><div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;</div><div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;    <span class="keywordflow">if</span>(sensor-&gt;<a class="code" href="a03991.html#a87223885ad859bb82fdc45644bc1f0b2">isInitialized</a> != <a class="code" href="a00917.html#a8f284d04ec459633d30dc85cf0a32a0d">F_USING_ACCEL</a>)</div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;    {</div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5aca7f5031b1497c3a8a4bcb78cce879dedd">SENSOR_ERROR_INIT</a>;</div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;    }</div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;</div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;    <span class="comment">// read the XLS8952_BUF_STATUS register (mapped to STATUS) and extract number of measurements available (lower 6 bits)</span></div><div class="line"><a name="l00172"></a><span class="lineno">  172</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>, FXLS8952_BUF_STATUS_READ, I2C_Buffer );</div><div class="line"><a name="l00173"></a><span class="lineno">  173</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="l00174"></a><span class="lineno">  174</span>&#160;        sensor_fifo_count = I2C_Buffer[0] &amp; 0x3F;</div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;        <span class="comment">// return if there are no measurements in the sensor FIFO.</span></div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;        <span class="comment">// this will only occur when the FAST_LOOP_HZ equals or exceeds ACCEL_ODR_HZ</span></div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;        <span class="keywordflow">if</span>  (sensor_fifo_count == 0) <span class="keywordflow">return</span> <a class="code" href="a00359.html#a369536ebfe385731562c0b55dd6f3a7c">status</a>;</div><div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;    } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;        <span class="keywordflow">return</span>(status);</div><div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;    }</div><div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;</div><div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;    FXLS8952_DATA_READ[0].<a class="code" href="a03811.html#a1440a8efa2f56cded09ced3ff687d32a">numBytes</a> = 6 * sensor_fifo_count;</div><div class="line"><a name="l00183"></a><span class="lineno">  183</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>, FXLS8952_DATA_READ, I2C_Buffer );</div><div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;</div><div class="line"><a name="l00185"></a><span class="lineno">  185</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="l00186"></a><span class="lineno">  186</span>&#160;        <span class="comment">// process the pthisAccel-&gt;iFIFOCount * three channels of data</span></div><div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;        <span class="keywordflow">for</span> (j = 0; j &lt; sensor_fifo_count; j++)</div><div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;        {</div><div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;            <span class="comment">// place the 6 bytes read into the 16 bit accelerometer structure</span></div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;            sample[<a class="code" href="a00914.html#a48bbd27e913de8d7749dff9dec2fe816">CHX</a>] = (I2C_Buffer[6 * j + 1] &lt;&lt; 8) | I2C_Buffer[6 * j + 0];</div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;            sample[<a class="code" href="a00914.html#a6a25024f52cc6bea13d19f8b68456cea">CHY</a>] = (I2C_Buffer[6 * j + 3] &lt;&lt; 8) | I2C_Buffer[6 * j + 2];</div><div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;            sample[<a class="code" href="a00914.html#a76143891435bdd7248857e45b93521ed">CHZ</a>] = (I2C_Buffer[6 * j + 5] &lt;&lt; 8) | I2C_Buffer[6 * j + 4];</div><div class="line"><a name="l00193"></a><span class="lineno">  193</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="l00194"></a><span class="lineno">  194</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;Accel), <a class="code" href="a00917.html#a4c185218ef46ba2991d62b28e1620539">ACCEL_FIFO_SIZE</a>, sample);</div><div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;        }</div><div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;    }</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">return</span> (status);</div><div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;}</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">// 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="l00203"></a><span class="lineno">  203</span>&#160;<span class="keyword">const</span> <a class="code" href="a03807.html">registerwritelist_t</a>   FXLS8952_IDLE[] =</div><div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;{</div><div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;  <span class="comment">// Set ACTIVE = other bits unchanged</span></div><div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;  { FXLS8952_SENS_CONFIG1, 0x00, 0x01 },</div><div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;    <a class="code" href="a00179.html#a2cedde333a6373a3ee274bde6af145d0">__END_WRITE_DATA__</a></div><div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;};</div><div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;</div><div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;<span class="comment">// FXLS8952_Idle places the sensor into Standby mode (see datasheet for wakeup time)</span></div><div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;int8_t <a class="code" href="a00842.html#ac8224569af04152902ba731876cad491">FXLS8952_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="l00212"></a><span class="lineno">  212</span>&#160;{</div><div class="line"><a name="l00213"></a><span class="lineno">  213</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="l00214"></a><span class="lineno">  214</span>&#160;    <span class="keywordflow">if</span>(sensor-&gt;<a class="code" href="a03991.html#a87223885ad859bb82fdc45644bc1f0b2">isInitialized</a> == <a class="code" href="a00917.html#a8f284d04ec459633d30dc85cf0a32a0d">F_USING_ACCEL</a>) {</div><div class="line"><a name="l00215"></a><span class="lineno">  215</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>, FXLS8952_IDLE );</div><div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;        sensor-&gt;<a class="code" href="a03991.html#a87223885ad859bb82fdc45644bc1f0b2">isInitialized</a> = 0;</div><div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;        sfg-&gt;Accel.isEnabled = <span class="keyword">false</span>;</div><div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;    } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;      <span class="keywordflow">return</span> <a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5aca7f5031b1497c3a8a4bcb78cce879dedd">SENSOR_ERROR_INIT</a>;</div><div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;    }</div><div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="a00359.html#a369536ebfe385731562c0b55dd6f3a7c">status</a>;</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;<span class="preprocessor">#endif // if F_USING_ACCEL</span></div><div class="ttc" id="a00806_html_a5396302f349853253b5390288ef2e3a6"><div class="ttname"><a href="a00806.html#a5396302f349853253b5390288ef2e3a6">FXLS8952_ACCEL_FIFO_SIZE</a></div><div class="ttdeci">#define FXLS8952_ACCEL_FIFO_SIZE</div><div class="ttdef"><b>Definition:</b> <a href="a00806_source.html#l00020">driver_FXLS8952.c:20</a></div></div>
52<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>
53<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>
54<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>
55<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>
56<div class="ttc" id="a00917_html_a8f284d04ec459633d30dc85cf0a32a0d"><div class="ttname"><a href="a00917.html#a8f284d04ec459633d30dc85cf0a32a0d">F_USING_ACCEL</a></div><div class="ttdeci">#define F_USING_ACCEL</div><div class="ttdoc">nominally 0x0001 if an accelerometer is to be used, 0x0000 otherwise </div><div class="ttdef"><b>Definition:</b> <a href="a00917_source.html#l00038">standard_build.h:38</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="a00806_html_a31f854b8f26bf2bdb3c23645760f9903"><div class="ttname"><a href="a00806.html#a31f854b8f26bf2bdb3c23645760f9903">FXLS8952_COUNTSPERG</a></div><div class="ttdeci">#define FXLS8952_COUNTSPERG</div><div class="ttdef"><b>Definition:</b> <a href="a00806_source.html#l00019">driver_FXLS8952.c:19</a></div></div>
61<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>
62<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>
63<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>
64<div class="ttc" id="a00842_html_aed1eb4f64f11c00b221a14839b996d1e"><div class="ttname"><a href="a00842.html#aed1eb4f64f11c00b221a14839b996d1e">FXLS8952_Read</a></div><div class="ttdeci">int8_t FXLS8952_Read(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)</div></div>
65<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>
66<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>
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="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>
71<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>
72<div class="ttc" id="a00917_html_a4c185218ef46ba2991d62b28e1620539"><div class="ttname"><a href="a00917.html#a4c185218ef46ba2991d62b28e1620539">ACCEL_FIFO_SIZE</a></div><div class="ttdeci">#define ACCEL_FIFO_SIZE</div><div class="ttdoc">FXOS8700 (accel), MMA8652, FXLS8952 all have 32 element FIFO. </div><div class="ttdef"><b>Definition:</b> <a href="a00917_source.html#l00062">standard_build.h:62</a></div></div>
73<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>
74<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>
75<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>
76<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>
77<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>
78<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>
79<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>
80<div class="ttc" id="a00842_html_ae47d028795d19902358ad6644c2995f7"><div class="ttname"><a href="a00842.html#ae47d028795d19902358ad6644c2995f7">FXLS8952_Init</a></div><div class="ttdeci">int8_t FXLS8952_Init(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)</div></div>
81<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>
82<div class="ttc" id="a00842_html_ac8224569af04152902ba731876cad491"><div class="ttname"><a href="a00842.html#ac8224569af04152902ba731876cad491">FXLS8952_Idle</a></div><div class="ttdeci">int8_t FXLS8952_Idle(struct PhysicalSensor *sensor, SensorFusionGlobals *sfg)</div></div>
83<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>
84<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>
85<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>
86<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>
87<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>
88</div><!-- fragment --></div><!-- contents -->
89
90<hr class="footer"/><address class="footer"><small>
91&copy; Copyright 2016-2022 NXP. All Rights Reserved. SPDX-License-Identifier: BSD-3-Clause
92</small></address>
93</body>
94</html>
95