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: sensors/sensor_io_spi.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_c77a8e2546a9c75bbba96be2ef542c8e.html">sensors</a></li>  </ul>
44</div>
45</div><!-- top -->
46<div class="header">
47  <div class="headertitle">
48<div class="title">sensor_io_spi.c</div>  </div>
49</div><!--header-->
50<div class="contents">
51<a href="a00188.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 - 2016, 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">/**</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> * @file sensor_io_spi.c</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> * @brief The sensor_io_spi.c file contains definitions for low-level interface functions</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> * for reading and writing data from/to sensor using CMSIS APIs.</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> */</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;</div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &quot;Driver_SPI.h&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="a00179.html">sensor_drv.h</a>&quot;</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="a00533.html">systick_utils.h</a>&quot;</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="a00191.html">sensor_io_spi.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">/*******************************************************************************</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"> * Functions</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment"> ******************************************************************************/</span><span class="comment"></span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment">/*! The interface function to write register data to a sensor. */</span></div><div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="a00191.html#a6891c5409037ff96ef29750f131f4c00">   24</a></span>&#160;<a class="code" href="a00521.html#a5d7069350a7d7e65686c77a8038f462f">int32_t</a> <a class="code" href="a00188.html#a6891c5409037ff96ef29750f131f4c00">Sensor_SPI_BlockWrite</a>(ARM_DRIVER_SPI *pCommDrv,</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;                              <a class="code" href="a03819.html">registerDeviceInfo_t</a> *devInfo,</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;                              <span class="keywordtype">void</span> *pWriteParams,</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;                              <span class="keyword">const</span> <a class="code" href="a03815.html">registercommandlist_t</a> *pCommandList,</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;                              uint8_t error_mask)</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;    <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="l00031"></a><span class="lineno">   31</span>&#160;    <span class="keywordtype">bool</span> commandComplete;</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    uint8_t cocoBuffer[2] = {0};</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="comment">    /*! Validate for the correct handle.*/</span></div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;    <span class="keywordflow">if</span> ((pCommDrv == NULL) || (pCommandList == NULL))</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;    {</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5aca6c14d92ca22311f1385ad1e251fd47bf">SENSOR_ERROR_BAD_ADDRESS</a>;</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;</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    <span class="keyword">const</span> <a class="code" href="a03815.html">registercommandlist_t</a> *pCmd = pCommandList;<span class="comment"></span></div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="comment">    /*! Update register values based on register write list unless the next Cmd is the list terminator */</span></div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    <span class="keywordflow">do</span></div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;    { <span class="comment">/*! Write the command based on the values in the command and value pair.*/</span></div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;        status =</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;            <a class="code" href="a00173.html#a0662e3575811a227d02c1cfe802744c5">Register_SPI_BlockWrite</a>(pCommDrv, devInfo, pWriteParams, pCmd-&gt;<a class="code" href="a03815.html#a8f4ad863f28f32ae52b7c97ff42bf921">writeTo</a>, pCmd-&gt;<a class="code" href="a03815.html#aff9cc771acb1a281b053ea1551c599be">pWriteBuffer</a>, pCmd-&gt;<a class="code" href="a03815.html#a1440a8efa2f56cded09ced3ff687d32a">numBytes</a>);</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;        <span class="keywordflow">if</span> (ARM_DRIVER_OK != status)</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="keywordflow">return</span> <a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5acae2a1d27a0c4405ab02566a7fc618d193">SENSOR_ERROR_WRITE</a>;</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;</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;        <span class="keywordflow">do</span></div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;        { <span class="comment">/*! Wait for Command Completion. */</span></div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;            <a class="code" href="a00530.html#ab052b802081fd87e1bda8d56e2c0db42">BOARD_DELAY_ms</a>(1);</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;            status = <a class="code" href="a00173.html#a76a3aee498397854509b81ae2da2f85e">Register_SPI_Read</a>(pCommDrv, devInfo, pWriteParams, 0, <span class="keyword">sizeof</span>(cocoBuffer), cocoBuffer);</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;            <span class="keywordflow">if</span> (ARM_DRIVER_OK != status)</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="keywordflow">return</span> <a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5acab93ad77156e08d1bebe52bf46936cccc">SENSOR_ERROR_READ</a>;</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;            }</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;            commandComplete = cocoBuffer[1] &amp; 0x80;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;            <span class="keywordflow">if</span> (commandComplete &amp;&amp; cocoBuffer[1] &amp; error_mask)</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;            {</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;                <span class="keywordflow">return</span> <a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5acae2a1d27a0c4405ab02566a7fc618d193">SENSOR_ERROR_WRITE</a>;</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;            }</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;        } <span class="keywordflow">while</span> (!commandComplete);</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    } <span class="keywordflow">while</span> ((++pCmd)-&gt;writeTo != 0xFFFF);</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5aca961b6871536a27c9e4718100e0024274">SENSOR_ERROR_NONE</a>;</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"></span></div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<span class="comment">/*! The interface function to write register data to a sensor. */</span></div><div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="a00191.html#aaadd5fc1d790e7922e5303b4d61b67b4">   71</a></span>&#160;<a class="code" href="a00521.html#a5d7069350a7d7e65686c77a8038f462f">int32_t</a> <a class="code" href="a00188.html#aaadd5fc1d790e7922e5303b4d61b67b4">Sensor_SPI_Write</a>(ARM_DRIVER_SPI *pCommDrv,</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;                         <a class="code" href="a03819.html">registerDeviceInfo_t</a> *devInfo,</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;                         <span class="keywordtype">void</span> *pWriteParams,</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;                         <span class="keyword">const</span> <a class="code" href="a03807.html">registerwritelist_t</a> *pRegWriteList)</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;{</div><div class="line"><a name="l00076"></a><span class="lineno">   76</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="l00077"></a><span class="lineno">   77</span>&#160;    <span class="keywordtype">bool</span> endDataMarkAwaited;</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;<span class="comment">    /*! Validate for the correct handle.*/</span></div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;    <span class="keywordflow">if</span> ((pCommDrv == NULL) || (pRegWriteList == NULL))</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    {</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5aca6c14d92ca22311f1385ad1e251fd47bf">SENSOR_ERROR_BAD_ADDRESS</a>;</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;    }</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;    <span class="keyword">const</span> <a class="code" href="a03807.html">registerwritelist_t</a> *pCmd = pRegWriteList;</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;<span class="comment">    /*! Update register values based on register write list unless the next Cmd is the list terminator */</span></div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    <span class="keywordflow">do</span></div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    {</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;        endDataMarkAwaited = (pCmd + 1)-&gt;writeTo != 0xFFFF;<span class="comment"></span></div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;<span class="comment">        /*! Set the register based on the values in the register value pair.*/</span></div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;        status = <a class="code" href="a00173.html#ac4eb16e5a939fce81270bab7f6707754">Register_SPI_Write</a>(pCommDrv, devInfo, pWriteParams, pCmd-&gt;<a class="code" href="a03807.html#a8f4ad863f28f32ae52b7c97ff42bf921">writeTo</a>, pCmd-&gt;<a class="code" href="a03807.html#a638e4503e0ae6ce655b7ad2e17e8f0ad">value</a>, pCmd-&gt;<a class="code" href="a03807.html#a8a74907784be6c7786c2d060c8d7e10b">mask</a>);</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;        <span class="keywordflow">if</span> (ARM_DRIVER_OK != status)</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;        {</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;            <span class="keywordflow">return</span> <a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5acae2a1d27a0c4405ab02566a7fc618d193">SENSOR_ERROR_WRITE</a>;</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;        }</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;        ++pCmd;</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;    } <span class="keywordflow">while</span> (endDataMarkAwaited);</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5aca961b6871536a27c9e4718100e0024274">SENSOR_ERROR_NONE</a>;</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;}</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;<span class="comment">/*! The interface function to read register data from a sensor. */</span></div><div class="line"><a name="l00104"></a><span class="lineno"><a class="line" href="a00191.html#a77509913bc008bceacf1e5f500e7499d">  104</a></span>&#160;<a class="code" href="a00521.html#a5d7069350a7d7e65686c77a8038f462f">int32_t</a> <a class="code" href="a00188.html#a77509913bc008bceacf1e5f500e7499d">Sensor_SPI_Read</a>(ARM_DRIVER_SPI *pCommDrv,</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;                        <a class="code" href="a03819.html">registerDeviceInfo_t</a> *devInfo,</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;                        <span class="keywordtype">void</span> *pReadParams,</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;                        <span class="keyword">const</span> <a class="code" href="a03811.html">registerreadlist_t</a> *pReadList,</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;                        uint8_t *pOutBuffer)</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;{</div><div class="line"><a name="l00110"></a><span class="lineno">  110</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="l00111"></a><span class="lineno">  111</span>&#160;    uint8_t *pBuf;</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;<span class="comment">    /*! Validate for the correct handle.*/</span></div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;    <span class="keywordflow">if</span> (pCommDrv == NULL || pReadList == NULL || pOutBuffer == NULL)</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    {</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5aca6c14d92ca22311f1385ad1e251fd47bf">SENSOR_ERROR_BAD_ADDRESS</a>;</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    }</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;    <span class="keyword">const</span> <a class="code" href="a03811.html">registerreadlist_t</a> *pCmd = pReadList;</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;<span class="comment">    /*! Traverse the read list and read the registers one by one unless the register read list numBytes is zero*/</span></div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;    <span class="keywordflow">for</span> (pBuf = pOutBuffer; pCmd-&gt;<a class="code" href="a03811.html#a1440a8efa2f56cded09ced3ff687d32a">numBytes</a> != 0; pCmd++)</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;        status = <a class="code" href="a00173.html#a76a3aee498397854509b81ae2da2f85e">Register_SPI_Read</a>(pCommDrv, devInfo, pReadParams, pCmd-&gt;<a class="code" href="a03811.html#a5fe82375de174c0511ca301fec78e441">readFrom</a>, pCmd-&gt;<a class="code" href="a03811.html#a1440a8efa2f56cded09ced3ff687d32a">numBytes</a>, pBuf);</div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;        <span class="keywordflow">if</span> (ARM_DRIVER_OK != status)</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="keywordflow">return</span> <a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5acab93ad77156e08d1bebe52bf46936cccc">SENSOR_ERROR_READ</a>;</div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;        }</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;        pBuf += pCmd-&gt;<a class="code" href="a03811.html#a1440a8efa2f56cded09ced3ff687d32a">numBytes</a>;</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;    }</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5aca961b6871536a27c9e4718100e0024274">SENSOR_ERROR_NONE</a>;</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;}</div><div class="ttc" id="a00179_html_a18a00cbfd8ad83c7fd229cd0d5fad5acae2a1d27a0c4405ab02566a7fc618d193"><div class="ttname"><a href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5acae2a1d27a0c4405ab02566a7fc618d193">SENSOR_ERROR_WRITE</a></div><div class="ttdef"><b>Definition:</b> <a href="a00179_source.html#l00037">sensor_drv.h:37</a></div></div>
52<div class="ttc" id="a03819_html"><div class="ttname"><a href="a03819.html">registerDeviceInfo_t</a></div><div class="ttdoc">This structure defines the device specific info required by register I/O. </div><div class="ttdef"><b>Definition:</b> <a href="a00179_source.html#l00102">sensor_drv.h:102</a></div></div>
53<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>
54<div class="ttc" id="a00191_html"><div class="ttname"><a href="a00191.html">sensor_io_spi.h</a></div><div class="ttdoc">The sensor_io_spi.h file declares low-level interface functions for reading and writing sensor regist...</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="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>
57<div class="ttc" id="a00530_html_ab052b802081fd87e1bda8d56e2c0db42"><div class="ttname"><a href="a00530.html#ab052b802081fd87e1bda8d56e2c0db42">BOARD_DELAY_ms</a></div><div class="ttdeci">void BOARD_DELAY_ms(uint32_t delay_ms)</div><div class="ttdoc">Function to insert delays. </div><div class="ttdef"><b>Definition:</b> <a href="a00530_source.html#l00081">systick_utils.c:81</a></div></div>
58<div class="ttc" id="a03815_html"><div class="ttname"><a href="a03815.html">registercommandlist_t</a></div><div class="ttdoc">This structure defines the Block command List. </div><div class="ttdef"><b>Definition:</b> <a href="a00179_source.html#l00087">sensor_drv.h:87</a></div></div>
59<div class="ttc" id="a00173_html_ac4eb16e5a939fce81270bab7f6707754"><div class="ttname"><a href="a00173.html#ac4eb16e5a939fce81270bab7f6707754">Register_SPI_Write</a></div><div class="ttdeci">int32_t Register_SPI_Write(ARM_DRIVER_SPI *pCommDrv, registerDeviceInfo_t *devInfo, void *pWriteParams, uint8_t offset, uint8_t value, uint8_t mask)</div><div class="ttdoc">The interface function to write a sensor register. </div><div class="ttdef"><b>Definition:</b> <a href="a00173_source.html#l00216">register_io_spi.c:216</a></div></div>
60<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>
61<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>
62<div class="ttc" id="a00188_html_a77509913bc008bceacf1e5f500e7499d"><div class="ttname"><a href="a00188.html#a77509913bc008bceacf1e5f500e7499d">Sensor_SPI_Read</a></div><div class="ttdeci">int32_t Sensor_SPI_Read(ARM_DRIVER_SPI *pCommDrv, registerDeviceInfo_t *devInfo, void *pReadParams, 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="a00188_source.html#l00104">sensor_io_spi.c:104</a></div></div>
63<div class="ttc" id="a03807_html_a638e4503e0ae6ce655b7ad2e17e8f0ad"><div class="ttname"><a href="a03807.html#a638e4503e0ae6ce655b7ad2e17e8f0ad">registerwritelist_t::value</a></div><div class="ttdeci">uint8_t value</div><div class="ttdef"><b>Definition:</b> <a href="a00179_source.html#l00071">sensor_drv.h:71</a></div></div>
64<div class="ttc" id="a03815_html_a1440a8efa2f56cded09ced3ff687d32a"><div class="ttname"><a href="a03815.html#a1440a8efa2f56cded09ced3ff687d32a">registercommandlist_t::numBytes</a></div><div class="ttdeci">uint8_t numBytes</div><div class="ttdef"><b>Definition:</b> <a href="a00179_source.html#l00091">sensor_drv.h:91</a></div></div>
65<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>
66<div class="ttc" id="a00179_html_a18a00cbfd8ad83c7fd229cd0d5fad5aca6c14d92ca22311f1385ad1e251fd47bf"><div class="ttname"><a href="a00179.html#a18a00cbfd8ad83c7fd229cd0d5fad5aca6c14d92ca22311f1385ad1e251fd47bf">SENSOR_ERROR_BAD_ADDRESS</a></div><div class="ttdef"><b>Definition:</b> <a href="a00179_source.html#l00035">sensor_drv.h:35</a></div></div>
67<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>
68<div class="ttc" id="a03807_html_a8f4ad863f28f32ae52b7c97ff42bf921"><div class="ttname"><a href="a03807.html#a8f4ad863f28f32ae52b7c97ff42bf921">registerwritelist_t::writeTo</a></div><div class="ttdeci">uint16_t writeTo</div><div class="ttdef"><b>Definition:</b> <a href="a00179_source.html#l00070">sensor_drv.h:70</a></div></div>
69<div class="ttc" id="a00188_html_a6891c5409037ff96ef29750f131f4c00"><div class="ttname"><a href="a00188.html#a6891c5409037ff96ef29750f131f4c00">Sensor_SPI_BlockWrite</a></div><div class="ttdeci">int32_t Sensor_SPI_BlockWrite(ARM_DRIVER_SPI *pCommDrv, registerDeviceInfo_t *devInfo, void *pWriteParams, const registercommandlist_t *pCommandList, uint8_t error_mask)</div><div class="ttdoc">Write commands to a sensor. </div><div class="ttdef"><b>Definition:</b> <a href="a00188_source.html#l00024">sensor_io_spi.c:24</a></div></div>
70<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>
71<div class="ttc" id="a03815_html_a8f4ad863f28f32ae52b7c97ff42bf921"><div class="ttname"><a href="a03815.html#a8f4ad863f28f32ae52b7c97ff42bf921">registercommandlist_t::writeTo</a></div><div class="ttdeci">uint16_t writeTo</div><div class="ttdef"><b>Definition:</b> <a href="a00179_source.html#l00090">sensor_drv.h:90</a></div></div>
72<div class="ttc" id="a00173_html_a0662e3575811a227d02c1cfe802744c5"><div class="ttname"><a href="a00173.html#a0662e3575811a227d02c1cfe802744c5">Register_SPI_BlockWrite</a></div><div class="ttdeci">int32_t Register_SPI_BlockWrite(ARM_DRIVER_SPI *pCommDrv, registerDeviceInfo_t *devInfo, void *pWriteParams, uint8_t offset, const uint8_t *pBuffer, uint8_t bytesToWrite)</div><div class="ttdoc">The interface function to block write to a sensor register. </div><div class="ttdef"><b>Definition:</b> <a href="a00173_source.html#l00162">register_io_spi.c:162</a></div></div>
73<div class="ttc" id="a03807_html_a8a74907784be6c7786c2d060c8d7e10b"><div class="ttname"><a href="a03807.html#a8a74907784be6c7786c2d060c8d7e10b">registerwritelist_t::mask</a></div><div class="ttdeci">uint8_t mask</div><div class="ttdef"><b>Definition:</b> <a href="a00179_source.html#l00072">sensor_drv.h:72</a></div></div>
74<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>
75<div class="ttc" id="a00533_html"><div class="ttname"><a href="a00533.html">systick_utils.h</a></div><div class="ttdoc">ARM Systick Utilities. </div></div>
76<div class="ttc" id="a00188_html_aaadd5fc1d790e7922e5303b4d61b67b4"><div class="ttname"><a href="a00188.html#aaadd5fc1d790e7922e5303b4d61b67b4">Sensor_SPI_Write</a></div><div class="ttdeci">int32_t Sensor_SPI_Write(ARM_DRIVER_SPI *pCommDrv, registerDeviceInfo_t *devInfo, void *pWriteParams, const registerwritelist_t *pRegWriteList)</div><div class="ttdoc">Write register data to a sensor. </div><div class="ttdef"><b>Definition:</b> <a href="a00188_source.html#l00071">sensor_io_spi.c:71</a></div></div>
77<div class="ttc" id="a03815_html_aff9cc771acb1a281b053ea1551c599be"><div class="ttname"><a href="a03815.html#aff9cc771acb1a281b053ea1551c599be">registercommandlist_t::pWriteBuffer</a></div><div class="ttdeci">const uint8_t * pWriteBuffer</div><div class="ttdef"><b>Definition:</b> <a href="a00179_source.html#l00089">sensor_drv.h:89</a></div></div>
78<div class="ttc" id="a00173_html_a76a3aee498397854509b81ae2da2f85e"><div class="ttname"><a href="a00173.html#a76a3aee498397854509b81ae2da2f85e">Register_SPI_Read</a></div><div class="ttdeci">int32_t Register_SPI_Read(ARM_DRIVER_SPI *pCommDrv, registerDeviceInfo_t *devInfo, void *pReadParams, 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="a00173_source.html#l00313">register_io_spi.c:313</a></div></div>
79</div><!-- fragment --></div><!-- contents -->
80
81<hr class="footer"/><address class="footer"><small>
82&copy; Copyright 2016-2022 NXP. All Rights Reserved. SPDX-License-Identifier: BSD-3-Clause
83</small></address>
84</body>
85</html>
86