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/pedometer/source/pedometer.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  <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_fee404f6f831fcfa321ee67f90b1e1c1.html">pedometer</a></li><li class="navelem"><a class="el" href="dir_8691356da0b74e268280f1013043f75b.html">source</a></li> </ul> 44</div> 45</div><!-- top --> 46<div class="header"> 47 <div class="headertitle"> 48<div class="title">pedometer.c</div> </div> 49</div><!--header--> 50<div class="contents"> 51<a href="a00926.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> * Copyright (c) 2015, Freescale Semiconductor, Inc.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> * Copyright 2016-2017 NXP</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> * All rights reserved.</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> *</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> * SPDX-License-Identifier: BSD-3-Clause</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> */</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"></span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment">/** </span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> * @file pedometer.c</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">* @brief The pedometer.c file contains the interface definitions for</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">* pedometer application.</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">*/</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> </div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">/*******************************************************************************</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> * Includes</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> ******************************************************************************/</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#include "<a class="code" href="a00956.html">pedometer.h</a>"</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> </div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment">/*******************************************************************************</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="comment"> * Macros, globals</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="comment"> ******************************************************************************/</span></div><div class="line"><a name="l00023"></a><span class="lineno"><a class="line" href="a00926.html#a9eab5efe6197a175d923d43c6e9b57d5"> 23</a></span> <span class="preprocessor">#define PEDOMETER_STATUS_ACTIVITY_BITNUM 0</span></div><div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="a00926.html#acae87033b8ace5856bda1489cde9e55f"> 24</a></span> <span class="preprocessor">#define PEDOMETER_STATUS_SUSPEND_BITNUM 3</span></div><div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="a00926.html#ae85ba3a5b1342417a926f4ae7d54397b"> 25</a></span> <span class="preprocessor">#define PEDOMETER_STATUS_ACTCHG_BITNUM 4</span></div><div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="a00926.html#a70f91d4ec3d1c940ede399eb7f355bf9"> 26</a></span> <span class="preprocessor">#define PEDOMETER_STATUS_STEPCHG_BITNUM 5</span></div><div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="a00926.html#ada43b47a42793f574f9aeaecf86863df"> 27</a></span> <span class="preprocessor">#define PEDOMETER_STATUS_SUSPCHG_BITNUM 6</span></div><div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="a00926.html#a3ba34d00549dc1e6bd53d4c27cdf115c"> 28</a></span> <span class="preprocessor">#define PEDOMETER_STATUS_MRGFLG_BITNUM 7</span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> </div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="a00926.html#ad46eaac8679ad478fb74d51c3f78ed23"> 30</a></span> <span class="preprocessor">#define PEDOMETER_STATUS_ACTIVITY_MASK (7 << PEDOMETER_STATUS_ACTIVITY_BITNUM)</span></div><div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="a00926.html#ac257ef2728cd16f47f860c0e7266092c"> 31</a></span> <span class="preprocessor">#define PEDOMETER_STATUS_SUSPEND_MASK (1 << PEDOMETER_STATUS_SUSPEND_BITNUM)</span></div><div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="a00926.html#adeeafda7d7bc523470e84dca8e12f6d6"> 32</a></span> <span class="preprocessor">#define PEDOMETER_STATUS_ACTCHG_MASK (1 << PEDOMETER_STATUS_ACTCHG_BITNUM)</span></div><div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="a00926.html#a463b24c49f5bb96ea8b05d7541861e1f"> 33</a></span> <span class="preprocessor">#define PEDOMETER_STATUS_STEPCHG_MASK (1 << PEDOMETER_STATUS_STEPCHG_BITNUM)</span></div><div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="a00926.html#a9914acab9d20e47b8786047c36a813d2"> 34</a></span> <span class="preprocessor">#define PEDOMETER_STATUS_SUSPCHG_MASK (1 << PEDOMETER_STATUS_SUSPCHG_BITNUM)</span></div><div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="a00926.html#a9c0193830ee00d081526140807baac64"> 35</a></span> <span class="preprocessor">#define PEDOMETER_STATUS_MRGFLG_MASK (1 << PEDOMETER_STATUS_MRGFLG_BITNUM)</span></div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span> </div><div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="a00926.html#a8a105cdee6d7b88c2c6fbf596230ccfb"> 37</a></span> <span class="preprocessor">#define PEDOMETER_STATUS_CHG_MASK \</span></div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> <span class="preprocessor"> (PEDOMETER_STATUS_ACTCHG_MASK | PEDOMETER_STATUS_STEPCHG_MASK | PEDOMETER_STATUS_SUSPCHG_MASK)</span></div><div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="a00926.html#a6205f84a9ef9dc5da8bc39a7d812cd96"> 39</a></span> <span class="preprocessor">#define SQUARED(x) ((x) * (x))</span></div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="comment">/* below values are the best set of value for the algorthm and computed during the algorithm definition.*/</span></div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span> <span class="comment">/******************************************************************************</span></div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span> <span class="comment"> * Private Function Declarations</span></div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span> <span class="comment"> *****************************************************************************/</span></div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span> </div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span> <span class="comment">/* Update status variables */</span></div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span> <span class="keyword">static</span> <span class="keywordtype">void</span> status_update(<a class="code" href="a04067.html">pedometer_t</a> *pedometer, uint32_t events, <span class="keywordtype">bool</span> suspend);</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span> </div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span> <span class="comment">/* Determine autonomous suspend state */</span></div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span> <span class="keyword">static</span> <span class="keywordtype">bool</span> suspend_compute(<a class="code" href="a04067.html">pedometer_t</a> *pPedometer, <a class="code" href="a04055.html">ped_accel_t</a> *pData);</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span> </div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span> <span class="comment">/* compute the debounce. */</span></div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span> <span class="keyword">static</span> <span class="keywordtype">bool</span> debounce_count(<span class="keywordtype">bool</span> dbcntm, <span class="keywordtype">bool</span> condition, <a class="code" href="a00956.html#a00fabbe7008a793b4929533264562c79">debounce_count_t</a> *count, <a class="code" href="a00956.html#a00fabbe7008a793b4929533264562c79">debounce_count_t</a> threshold);</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> </div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> <span class="comment">/* Cast uint32_t to uint16_t with saturate */</span></div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span> <span class="keyword">static</span> uint16_t uint32_to_uint16(uint32_t val);</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span> </div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span> <span class="comment">/******************************************************************************</span></div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span> <span class="comment"> * Private Variable Definitions</span></div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span> <span class="comment"> ******************************************************************************/</span></div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span> </div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span> <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="a04067.html">pedometer_t</a> pedometer_default = {.<a class="code" href="a04067.html#a57ce58a7b7cf3e03dc10aca88b0edcd5">status</a> =</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  {</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  .<a class="code" href="a04071.html#ab22abc2906422da61885ac6c8e6a1a59">version</a> = 2,</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  },</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  .config = {</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  .sleepcount_threshold = 1,</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  .bits = {.config = 1},</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  .keynetik =</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  {</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  .height = 175,</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  .weight = 80,</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  .filtersteps = <a class="code" href="a00956.html#ab257f08978fd8335aad1859c1c9905e3">PEDO_FILTER_STEPS_DEFAULT</a>,</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  .bits =</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  {</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  .filtertime = <a class="code" href="a00956.html#acc76895a3812c086ea1cc0e665075103">PEDO_FILTER_TIME_DEFAULT</a>,</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  },</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  .speedperiod = <a class="code" href="a00956.html#a9b92edaeb7dec66a37b4c4689a8c1d42">PEDO_SPEED_PERIOD_DEFAULT</a>,</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  .stepthreshold = <a class="code" href="a00956.html#a7aa4476f16cc506cd6353a5f367dbe43">PEDO_STEP_THRESHOLD_DEFAULT</a>,</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  },</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  .stepcoalesce = 1,</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  .oneG = <a class="code" href="a00956.html#a50d24b234d9d75077968d54a23baac13">PEDO_ONEG_8G</a>,</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  .frequency = <a class="code" href="a00956.html#a3cc9f28cb35404b33588dde34f3ff99f">PEDO_FREQHZ_DEFAULT</a>,</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  }};</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span> </div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span> <span class="comment">/*******************************************************************************</span></div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span> <span class="comment"> * Code</span></div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span> <span class="comment"> ******************************************************************************/</span></div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span> </div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span> <span class="comment">/*</span></div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span> <span class="comment">** ===================================================================</span></div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span> <span class="comment">** Method : pedometer_init</span></div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span> <span class="comment">** brief : The interface function initialize the pedometer.</span></div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span> <span class="comment">** params[in] : pedometer_t *pPedometer, handle to the pedometer.</span></div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span> <span class="comment">**</span></div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span> <span class="comment">** ===================================================================</span></div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span> <span class="comment">*/</span></div><div class="line"><a name="l00097"></a><span class="lineno"><a class="line" href="a00956.html#a594d690252fcfc6713fe8374f384fe69"> 97</a></span> <span class="keywordtype">void</span> <a class="code" href="a00926.html#a594d690252fcfc6713fe8374f384fe69">pedometer_init</a>(<a class="code" href="a04067.html">pedometer_t</a> *pPedometer)</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span> {</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  *pPedometer = pedometer_default;</div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  KeynetikInitialize(pPedometer-><a class="code" href="a04067.html#a2f1259e55605da0fb4eed707f775c170">config</a>.<a class="code" href="a04059.html#a0afa045b0bbb9be99912c04821d883f6">oneG</a>, pPedometer-><a class="code" href="a04067.html#a2f1259e55605da0fb4eed707f775c170">config</a>.<a class="code" href="a04059.html#aea762e0e67fcafaf5b3cd61201769926">frequency</a>, &pPedometer-><a class="code" href="a04067.html#a2f1259e55605da0fb4eed707f775c170">config</a>.<a class="code" href="a04059.html#a31a77bbdd26e32b3982f054d600f7d9a">keynetik</a>);</div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  pPedometer-><a class="code" href="a04067.html#aa49c2e033986e920aff4252b22d1a137">private</a>.<a class="code" href="a04083.html#ae71e38a7c4c0d6be723c1bc142d988f3">stepchg_stepcount</a> = 0;</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span> }</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span> </div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span> <span class="comment">/*** ===================================================================</span></div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span> <span class="comment">** Method : pedometer_configure</span></div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span> <span class="comment">** brief : The interface function to configure the pedometer</span></div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span> <span class="comment">** params[in] : pedometer_t *pPedometer, handle to the pedometer.</span></div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span> <span class="comment">** params[in] : pedometer_config_t configuration parameter.</span></div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span> <span class="comment">** ===================================================================</span></div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span> <span class="comment">*/</span></div><div class="line"><a name="l00111"></a><span class="lineno"><a class="line" href="a00956.html#a5ea8580b8a07ce9ece550f8b6fd37ced"> 111</a></span> <span class="keywordtype">void</span> <a class="code" href="a00926.html#a5ea8580b8a07ce9ece550f8b6fd37ced">pedometer_configure</a>(<a class="code" href="a04067.html">pedometer_t</a> *pPedometer, <span class="keyword">const</span> <a class="code" href="a04059.html">pedometer_config_t</a> *pConfig)</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span> {</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  pPedometer-><a class="code" href="a04067.html#a2f1259e55605da0fb4eed707f775c170">config</a> = *pConfig;</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  KeynetikInitialize(pPedometer-><a class="code" href="a04067.html#a2f1259e55605da0fb4eed707f775c170">config</a>.<a class="code" href="a04059.html#a0afa045b0bbb9be99912c04821d883f6">oneG</a>, pPedometer-><a class="code" href="a04067.html#a2f1259e55605da0fb4eed707f775c170">config</a>.<a class="code" href="a04059.html#aea762e0e67fcafaf5b3cd61201769926">frequency</a>, &pPedometer-><a class="code" href="a04067.html#a2f1259e55605da0fb4eed707f775c170">config</a>.<a class="code" href="a04059.html#a31a77bbdd26e32b3982f054d600f7d9a">keynetik</a>);</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  pPedometer-><a class="code" href="a04067.html#aa49c2e033986e920aff4252b22d1a137">private</a>.<a class="code" href="a04083.html#ae71e38a7c4c0d6be723c1bc142d988f3">stepchg_stepcount</a> = 0;</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span> }</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span> <span class="comment">/*</span></div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span> <span class="comment">** ===================================================================</span></div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span> <span class="comment">** Method : pedometer_run</span></div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span> <span class="comment">** brief : The interface function excutes the pedometer algorithm.</span></div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span> <span class="comment">** params[in] : pedometer_t *pPedometer, handle to the pedometer.</span></div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span> <span class="comment">** params[in] : ped_accel_t data acceleration data.</span></div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span> <span class="comment">** ===================================================================</span></div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span> <span class="comment">*/</span></div><div class="line"><a name="l00125"></a><span class="lineno"><a class="line" href="a00956.html#a87224a70b303355a416beaca80ed1b2f"> 125</a></span> <a class="code" href="a00521.html#a5d7069350a7d7e65686c77a8038f462f">int32_t</a> <a class="code" href="a00926.html#a87224a70b303355a416beaca80ed1b2f">pedometer_run</a>(<a class="code" href="a04067.html">pedometer_t</a> *pPedometer, <a class="code" href="a04055.html">ped_accel_t</a> *pData)</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span> {</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  uint32_t events = 0;</div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <span class="comment">/* if suspend, don't execute the alogrithm and save the power.*/</span></div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <span class="keywordtype">bool</span> suspend = suspend_compute(pPedometer, pData);</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  <span class="keywordflow">if</span> (!suspend)</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  {</div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  events = KeynetikHandleIncomingEvent(pData-><a class="code" href="a04055.html#a661660001effc417fb684db96e973688">accel</a>[0], pData-><a class="code" href="a04055.html#a661660001effc417fb684db96e973688">accel</a>[1], pData-><a class="code" href="a04055.html#a661660001effc417fb684db96e973688">accel</a>[2]);</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  }</div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  status_update(pPedometer, events, suspend);</div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  <span class="keywordflow">return</span> events;</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span> }</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span> <span class="comment">/*</span></div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span> <span class="comment">** ===================================================================</span></div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span> <span class="comment">** Method : status_update</span></div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span> <span class="comment">** brief : update the status of the pedometer output</span></div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span> <span class="comment">** params[in] : pedometer_t *pPedometer, handle to the pedometer.</span></div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span> <span class="comment">** params[in] : uint32_t events kynetic event</span></div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span> <span class="comment">** params[in] : bool suspend suspend flag</span></div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span> <span class="comment">** ===================================================================</span></div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span> <span class="comment">*/</span></div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span> <span class="keyword">static</span> <span class="keywordtype">void</span> status_update(<a class="code" href="a04067.html">pedometer_t</a> *pPedometer, uint32_t events, <span class="keywordtype">bool</span> suspend)</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span> {</div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  <span class="keywordtype">bool</span> activity_stable =</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  debounce_count(pPedometer-><a class="code" href="a04067.html#a2f1259e55605da0fb4eed707f775c170">config</a>.<a class="code" href="a04059.html#abfc26f393d3220e339326c7b4cdbfcef">bits</a>.<a class="code" href="a04059.html#a80ad04273bcbca039bf53f5224b96f4e">activity_dbcntm</a>, !(events & KEYNETIK_ACTIVITYCHANGED),</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  &pPedometer-><a class="code" href="a04067.html#aa49c2e033986e920aff4252b22d1a137">private</a>.<a class="code" href="a04083.html#a5a3edadb40c8bc1e3ba7bdcce7ed47e8">activitycount</a>, pPedometer-><a class="code" href="a04067.html#a2f1259e55605da0fb4eed707f775c170">config</a>.<a class="code" href="a04059.html#a458f550d6843e8fb60674eae971c0cb9">activitycount_threshold</a>);</div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span> </div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  <a class="code" href="a00956.html#a0595338a17265357f0d301dba63e3fd3">activitylevel_t</a> activity = activity_stable ? keynetikActivityLevel : pPedometer-><a class="code" href="a04067.html#a57ce58a7b7cf3e03dc10aca88b0edcd5">status</a>.<a class="code" href="a04071.html#a0bb1fec62456252807796e63db9a6622">status</a>.<a class="code" href="a04071.html#aa9fd52939922d151d6d2b96afc0455ed">bits</a>.activity;</div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  uint16_t stepcount = uint32_to_uint16(keynetikStepCount);</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  uint8_t newstatus = (activity << <a class="code" href="a00926.html#a9eab5efe6197a175d923d43c6e9b57d5">PEDOMETER_STATUS_ACTIVITY_BITNUM</a>) & <a class="code" href="a00926.html#ad46eaac8679ad478fb74d51c3f78ed23">PEDOMETER_STATUS_ACTIVITY_MASK</a>;</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span> </div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  <span class="keywordflow">if</span> ((newstatus ^ pPedometer-><a class="code" href="a04067.html#a57ce58a7b7cf3e03dc10aca88b0edcd5">status</a>.<a class="code" href="a04071.html#a0bb1fec62456252807796e63db9a6622">status</a>.<a class="code" href="a04071.html#a96f44d20f1dbf1c8785a7bc99a46164c">byte</a>) & <a class="code" href="a00926.html#ad46eaac8679ad478fb74d51c3f78ed23">PEDOMETER_STATUS_ACTIVITY_MASK</a>)</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  newstatus |= <a class="code" href="a00926.html#adeeafda7d7bc523470e84dca8e12f6d6">PEDOMETER_STATUS_ACTCHG_MASK</a>;</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span> </div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  <span class="keywordflow">if</span> (pPedometer-><a class="code" href="a04067.html#a2f1259e55605da0fb4eed707f775c170">config</a>.<a class="code" href="a04059.html#ac86ef7d4985c951ba8930d11e2f3a485">stepcoalesce</a> &&</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  (stepcount - pPedometer-><a class="code" href="a04067.html#aa49c2e033986e920aff4252b22d1a137">private</a>.<a class="code" href="a04083.html#ae71e38a7c4c0d6be723c1bc142d988f3">stepchg_stepcount</a> >= pPedometer-><a class="code" href="a04067.html#a2f1259e55605da0fb4eed707f775c170">config</a>.<a class="code" href="a04059.html#ac86ef7d4985c951ba8930d11e2f3a485">stepcoalesce</a>))</div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  {</div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  pPedometer-><a class="code" href="a04067.html#aa49c2e033986e920aff4252b22d1a137">private</a>.<a class="code" href="a04083.html#ae71e38a7c4c0d6be723c1bc142d988f3">stepchg_stepcount</a> = stepcount;</div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  newstatus |= <a class="code" href="a00926.html#a463b24c49f5bb96ea8b05d7541861e1f">PEDOMETER_STATUS_STEPCHG_MASK</a>;</div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span>  }</div><div class="line"><a name="l00165"></a><span class="lineno"> 165</span> </div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  <span class="keywordflow">if</span> (suspend)</div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span>  newstatus |= <a class="code" href="a00926.html#ac257ef2728cd16f47f860c0e7266092c">PEDOMETER_STATUS_SUSPEND_MASK</a>;</div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span> </div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span>  <span class="keywordflow">if</span> ((newstatus ^ pPedometer-><a class="code" href="a04067.html#a57ce58a7b7cf3e03dc10aca88b0edcd5">status</a>.<a class="code" href="a04071.html#a0bb1fec62456252807796e63db9a6622">status</a>.<a class="code" href="a04071.html#a96f44d20f1dbf1c8785a7bc99a46164c">byte</a>) & <a class="code" href="a00926.html#ac257ef2728cd16f47f860c0e7266092c">PEDOMETER_STATUS_SUSPEND_MASK</a>)</div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span>  newstatus |= <a class="code" href="a00926.html#a9914acab9d20e47b8786047c36a813d2">PEDOMETER_STATUS_SUSPCHG_MASK</a>;</div><div class="line"><a name="l00171"></a><span class="lineno"> 171</span> </div><div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  <span class="keywordflow">if</span> (newstatus & <a class="code" href="a00926.html#a8a105cdee6d7b88c2c6fbf596230ccfb">PEDOMETER_STATUS_CHG_MASK</a>)</div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  newstatus |= <a class="code" href="a00926.html#a9c0193830ee00d081526140807baac64">PEDOMETER_STATUS_MRGFLG_MASK</a>;</div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  <span class="comment">/* Update the status such stepcount, distance, speed etc..*/</span></div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  pPedometer-><a class="code" href="a04067.html#a57ce58a7b7cf3e03dc10aca88b0edcd5">status</a>.<a class="code" href="a04071.html#ace0ff960f4cd3ce9aa8452dc57a97c2e">stepcount</a> = uint32_to_uint16(keynetikStepCount);</div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  pPedometer-><a class="code" href="a04067.html#a57ce58a7b7cf3e03dc10aca88b0edcd5">status</a>.<a class="code" href="a04071.html#a7ae9d3ad463ec7a0eb38ee23a15c51e7">distance</a> = uint32_to_uint16(keynetikDistance);</div><div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  pPedometer-><a class="code" href="a04067.html#a57ce58a7b7cf3e03dc10aca88b0edcd5">status</a>.<a class="code" href="a04071.html#a12633132d07532aac2bd05fa1d5c8a72">speed</a> = keynetikSpeed;</div><div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  pPedometer-><a class="code" href="a04067.html#a57ce58a7b7cf3e03dc10aca88b0edcd5">status</a>.<a class="code" href="a04071.html#a1317c431cecdc37eca645ff53566ff97">calories</a> = uint32_to_uint16(keynetikCalories);</div><div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  pPedometer-><a class="code" href="a04067.html#a57ce58a7b7cf3e03dc10aca88b0edcd5">status</a>.<a class="code" href="a04071.html#a0bb1fec62456252807796e63db9a6622">status</a>.<a class="code" href="a04071.html#a96f44d20f1dbf1c8785a7bc99a46164c">byte</a> = newstatus;</div><div class="line"><a name="l00180"></a><span class="lineno"> 180</span> }</div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span> <span class="comment">/*</span></div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span> <span class="comment">** ===================================================================</span></div><div class="line"><a name="l00183"></a><span class="lineno"> 183</span> <span class="comment">** Method : suspend_compute</span></div><div class="line"><a name="l00184"></a><span class="lineno"> 184</span> <span class="comment">** brief : compute the suspend status.</span></div><div class="line"><a name="l00185"></a><span class="lineno"> 185</span> <span class="comment">** params[in] : pedometer_t *pPedometer, handle to the pedometer.</span></div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span> <span class="comment">** params[in] : ped_accel_t data acceleration data.</span></div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span> <span class="comment">** ===================================================================</span></div><div class="line"><a name="l00188"></a><span class="lineno"> 188</span> <span class="comment">*/</span></div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span> <span class="keyword">static</span> <span class="keywordtype">bool</span> suspend_compute(<a class="code" href="a04067.html">pedometer_t</a> *pPedometer, <a class="code" href="a04055.html">ped_accel_t</a> *pData)</div><div class="line"><a name="l00190"></a><span class="lineno"> 190</span> {</div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span>  <span class="comment">/* compute the magnitude*/</span></div><div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  uint32_t mag2 = <a class="code" href="a00926.html#a6205f84a9ef9dc5da8bc39a7d812cd96">SQUARED</a>(pData-><a class="code" href="a04055.html#a661660001effc417fb684db96e973688">accel</a>[0]) + <a class="code" href="a00926.html#a6205f84a9ef9dc5da8bc39a7d812cd96">SQUARED</a>(pData-><a class="code" href="a04055.html#a661660001effc417fb684db96e973688">accel</a>[1]) + <a class="code" href="a00926.html#a6205f84a9ef9dc5da8bc39a7d812cd96">SQUARED</a>(pData-><a class="code" href="a04055.html#a661660001effc417fb684db96e973688">accel</a>[2]);</div><div class="line"><a name="l00193"></a><span class="lineno"> 193</span>  <span class="keywordtype">bool</span> stationary =</div><div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  (mag2 > <a class="code" href="a00926.html#a6205f84a9ef9dc5da8bc39a7d812cd96">SQUARED</a>(pPedometer-><a class="code" href="a04067.html#a2f1259e55605da0fb4eed707f775c170">config</a>.<a class="code" href="a04059.html#a867687de96d2347342441466c8e837bb">sleepminimum</a>)) && (mag2 < <a class="code" href="a00926.html#a6205f84a9ef9dc5da8bc39a7d812cd96">SQUARED</a>(pPedometer-><a class="code" href="a04067.html#a2f1259e55605da0fb4eed707f775c170">config</a>.<a class="code" href="a04059.html#afd0819d26b95dad6c81ed177e3b8841a">sleepmaximum</a>));</div><div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  <span class="keywordtype">bool</span> suspend = debounce_count(pPedometer-><a class="code" href="a04067.html#a2f1259e55605da0fb4eed707f775c170">config</a>.<a class="code" href="a04059.html#abfc26f393d3220e339326c7b4cdbfcef">bits</a>.<a class="code" href="a04059.html#a49c062ff578f76fa902e43245024202c">sleep_dbcntm</a>, stationary, &pPedometer-><a class="code" href="a04067.html#a57ce58a7b7cf3e03dc10aca88b0edcd5">status</a>.<a class="code" href="a04071.html#aa002fd6818c81cabd8ad9e41ba63951f">sleepcount</a>,</div><div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  pPedometer-><a class="code" href="a04067.html#a2f1259e55605da0fb4eed707f775c170">config</a>.<a class="code" href="a04059.html#a2c49d77dccbc74c7e51171069a0f2709">sleepcount_threshold</a>);</div><div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  <span class="keywordflow">return</span> (suspend);</div><div class="line"><a name="l00198"></a><span class="lineno"> 198</span> }</div><div class="line"><a name="l00199"></a><span class="lineno"> 199</span> <span class="comment">/*</span></div><div class="line"><a name="l00200"></a><span class="lineno"> 200</span> <span class="comment">** ===================================================================</span></div><div class="line"><a name="l00201"></a><span class="lineno"> 201</span> <span class="comment">** Method : uint32_to_uint16</span></div><div class="line"><a name="l00202"></a><span class="lineno"> 202</span> <span class="comment">** brief : conversion function from 32 to 16.</span></div><div class="line"><a name="l00203"></a><span class="lineno"> 203</span> <span class="comment">** params[in] : uint32_t x, imput</span></div><div class="line"><a name="l00204"></a><span class="lineno"> 204</span> <span class="comment">** params[in] : ped_accel_data data acceleration data.</span></div><div class="line"><a name="l00205"></a><span class="lineno"> 205</span> <span class="comment">** ===================================================================</span></div><div class="line"><a name="l00206"></a><span class="lineno"> 206</span> <span class="comment">*/</span></div><div class="line"><a name="l00207"></a><span class="lineno"> 207</span> uint16_t uint32_to_uint16(uint32_t val)</div><div class="line"><a name="l00208"></a><span class="lineno"> 208</span> {</div><div class="line"><a name="l00209"></a><span class="lineno"> 209</span>  <span class="keywordflow">if</span> (val > 0x0000FFFF)</div><div class="line"><a name="l00210"></a><span class="lineno"> 210</span>  <span class="keywordflow">return</span> (0xFFFF);</div><div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  <span class="keywordflow">return</span> ((uint16_t)val);</div><div class="line"><a name="l00212"></a><span class="lineno"> 212</span> }</div><div class="line"><a name="l00213"></a><span class="lineno"> 213</span> <span class="comment">/*</span></div><div class="line"><a name="l00214"></a><span class="lineno"> 214</span> <span class="comment">** ===================================================================</span></div><div class="line"><a name="l00215"></a><span class="lineno"> 215</span> <span class="comment">** Method : debounce_count</span></div><div class="line"><a name="l00216"></a><span class="lineno"> 216</span> <span class="comment">** brief : compute the debouct status.</span></div><div class="line"><a name="l00217"></a><span class="lineno"> 217</span> <span class="comment">** params[in] : bool dbcntm,</span></div><div class="line"><a name="l00218"></a><span class="lineno"> 218</span> <span class="comment">** params[in] : bool condition</span></div><div class="line"><a name="l00219"></a><span class="lineno"> 219</span> <span class="comment">** params[in] : debounce_count_t *count,</span></div><div class="line"><a name="l00220"></a><span class="lineno"> 220</span> <span class="comment">** params[in] : debounce_count_t threshold, debouce threshold</span></div><div class="line"><a name="l00221"></a><span class="lineno"> 221</span> <span class="comment">** ===================================================================</span></div><div class="line"><a name="l00222"></a><span class="lineno"> 222</span> <span class="comment">*/</span></div><div class="line"><a name="l00223"></a><span class="lineno"> 223</span> <span class="keyword">static</span> <span class="keywordtype">bool</span> debounce_count(<span class="keywordtype">bool</span> dbcntm, <span class="keywordtype">bool</span> condition, <a class="code" href="a00956.html#a00fabbe7008a793b4929533264562c79">debounce_count_t</a> *count, <a class="code" href="a00956.html#a00fabbe7008a793b4929533264562c79">debounce_count_t</a> threshold)</div><div class="line"><a name="l00224"></a><span class="lineno"> 224</span> {</div><div class="line"><a name="l00225"></a><span class="lineno"> 225</span>  <span class="keywordflow">if</span> (condition)</div><div class="line"><a name="l00226"></a><span class="lineno"> 226</span>  {</div><div class="line"><a name="l00227"></a><span class="lineno"> 227</span>  <span class="comment">/* increment count up to, but not above the threshold */</span></div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  *count = (*count + 1) < threshold ? *count + 1 : threshold;</div><div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  }</div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00231"></a><span class="lineno"> 231</span>  {</div><div class="line"><a name="l00232"></a><span class="lineno"> 232</span>  <span class="keywordflow">if</span> (dbcntm)</div><div class="line"><a name="l00233"></a><span class="lineno"> 233</span>  *count = 0;</div><div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00235"></a><span class="lineno"> 235</span>  <span class="comment">/* decrement count down to, but not below zero */</span></div><div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  *count = (*count - 1) > 0 ? *count - 1 : 0;</div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  }</div><div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  <span class="keywordflow">return</span> ((<span class="keywordtype">bool</span>)(*count >= threshold));</div><div class="line"><a name="l00239"></a><span class="lineno"> 239</span> }</div><div class="ttc" id="a04067_html_a57ce58a7b7cf3e03dc10aca88b0edcd5"><div class="ttname"><a href="a04067.html#a57ce58a7b7cf3e03dc10aca88b0edcd5">pedometer_t::status</a></div><div class="ttdeci">struct pedometer_t::pedometer_status_tag status</div></div> 52<div class="ttc" id="a00956_html_a50d24b234d9d75077968d54a23baac13"><div class="ttname"><a href="a00956.html#a50d24b234d9d75077968d54a23baac13">PEDO_ONEG_8G</a></div><div class="ttdeci">#define PEDO_ONEG_8G</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00028">pedometer.h:28</a></div></div> 53<div class="ttc" id="a00926_html_a5ea8580b8a07ce9ece550f8b6fd37ced"><div class="ttname"><a href="a00926.html#a5ea8580b8a07ce9ece550f8b6fd37ced">pedometer_configure</a></div><div class="ttdeci">void pedometer_configure(pedometer_t *pPedometer, const pedometer_config_t *pConfig)</div><div class="ttdoc">The interface function to configure the pedometer. </div><div class="ttdef"><b>Definition:</b> <a href="a00926_source.html#l00111">pedometer.c:111</a></div></div> 54<div class="ttc" id="a04059_html_a31a77bbdd26e32b3982f054d600f7d9a"><div class="ttname"><a href="a04059.html#a31a77bbdd26e32b3982f054d600f7d9a">pedometer_config_t::keynetik</a></div><div class="ttdeci">KeynetikConfig keynetik</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00061">pedometer.h:61</a></div></div> 55<div class="ttc" id="a00926_html_a9c0193830ee00d081526140807baac64"><div class="ttname"><a href="a00926.html#a9c0193830ee00d081526140807baac64">PEDOMETER_STATUS_MRGFLG_MASK</a></div><div class="ttdeci">#define PEDOMETER_STATUS_MRGFLG_MASK</div><div class="ttdef"><b>Definition:</b> <a href="a00926_source.html#l00035">pedometer.c:35</a></div></div> 56<div class="ttc" id="a00926_html_ac257ef2728cd16f47f860c0e7266092c"><div class="ttname"><a href="a00926.html#ac257ef2728cd16f47f860c0e7266092c">PEDOMETER_STATUS_SUSPEND_MASK</a></div><div class="ttdeci">#define PEDOMETER_STATUS_SUSPEND_MASK</div><div class="ttdef"><b>Definition:</b> <a href="a00926_source.html#l00031">pedometer.c:31</a></div></div> 57<div class="ttc" id="a00956_html_a0595338a17265357f0d301dba63e3fd3"><div class="ttname"><a href="a00956.html#a0595338a17265357f0d301dba63e3fd3">activitylevel_t</a></div><div class="ttdeci">KeynetikActivityLevel activitylevel_t</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00026">pedometer.h:26</a></div></div> 58<div class="ttc" id="a00926_html_ad46eaac8679ad478fb74d51c3f78ed23"><div class="ttname"><a href="a00926.html#ad46eaac8679ad478fb74d51c3f78ed23">PEDOMETER_STATUS_ACTIVITY_MASK</a></div><div class="ttdeci">#define PEDOMETER_STATUS_ACTIVITY_MASK</div><div class="ttdef"><b>Definition:</b> <a href="a00926_source.html#l00030">pedometer.c:30</a></div></div> 59<div class="ttc" id="a00956_html"><div class="ttname"><a href="a00956.html">pedometer.h</a></div><div class="ttdoc">The pedometer.h file contains the interface and structure definitions for pedometer application...</div></div> 60<div class="ttc" id="a04059_html_ac86ef7d4985c951ba8930d11e2f3a485"><div class="ttname"><a href="a04059.html#ac86ef7d4985c951ba8930d11e2f3a485">pedometer_config_t::stepcoalesce</a></div><div class="ttdeci">uint8_t stepcoalesce</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00063">pedometer.h:63</a></div></div> 61<div class="ttc" id="a04071_html_a7ae9d3ad463ec7a0eb38ee23a15c51e7"><div class="ttname"><a href="a04071.html#a7ae9d3ad463ec7a0eb38ee23a15c51e7">pedometer_t::pedometer_status_tag::distance</a></div><div class="ttdeci">uint16_t distance</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00092">pedometer.h:92</a></div></div> 62<div class="ttc" id="a00926_html_a8a105cdee6d7b88c2c6fbf596230ccfb"><div class="ttname"><a href="a00926.html#a8a105cdee6d7b88c2c6fbf596230ccfb">PEDOMETER_STATUS_CHG_MASK</a></div><div class="ttdeci">#define PEDOMETER_STATUS_CHG_MASK</div><div class="ttdef"><b>Definition:</b> <a href="a00926_source.html#l00037">pedometer.c:37</a></div></div> 63<div class="ttc" id="a04071_html_a96f44d20f1dbf1c8785a7bc99a46164c"><div class="ttname"><a href="a04071.html#a96f44d20f1dbf1c8785a7bc99a46164c">pedometer_t::pedometer_status_tag::byte</a></div><div class="ttdeci">uint8_t byte</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00088">pedometer.h:88</a></div></div> 64<div class="ttc" id="a04059_html_a80ad04273bcbca039bf53f5224b96f4e"><div class="ttname"><a href="a04059.html#a80ad04273bcbca039bf53f5224b96f4e">pedometer_config_t::activity_dbcntm</a></div><div class="ttdeci">bool activity_dbcntm</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00056">pedometer.h:56</a></div></div> 65<div class="ttc" id="a00956_html_ab257f08978fd8335aad1859c1c9905e3"><div class="ttname"><a href="a00956.html#ab257f08978fd8335aad1859c1c9905e3">PEDO_FILTER_STEPS_DEFAULT</a></div><div class="ttdeci">#define PEDO_FILTER_STEPS_DEFAULT</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00035">pedometer.h:35</a></div></div> 66<div class="ttc" id="a00926_html_a9914acab9d20e47b8786047c36a813d2"><div class="ttname"><a href="a00926.html#a9914acab9d20e47b8786047c36a813d2">PEDOMETER_STATUS_SUSPCHG_MASK</a></div><div class="ttdeci">#define PEDOMETER_STATUS_SUSPCHG_MASK</div><div class="ttdef"><b>Definition:</b> <a href="a00926_source.html#l00034">pedometer.c:34</a></div></div> 67<div class="ttc" id="a04059_html_a49c062ff578f76fa902e43245024202c"><div class="ttname"><a href="a04059.html#a49c062ff578f76fa902e43245024202c">pedometer_config_t::sleep_dbcntm</a></div><div class="ttdeci">bool sleep_dbcntm</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00054">pedometer.h:54</a></div></div> 68<div class="ttc" id="a04059_html"><div class="ttname"><a href="a04059.html">pedometer_config_t</a></div><div class="ttdoc">This defines the configuration structure of the pedometer. </div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00046">pedometer.h:46</a></div></div> 69<div class="ttc" id="a00926_html_a463b24c49f5bb96ea8b05d7541861e1f"><div class="ttname"><a href="a00926.html#a463b24c49f5bb96ea8b05d7541861e1f">PEDOMETER_STATUS_STEPCHG_MASK</a></div><div class="ttdeci">#define PEDOMETER_STATUS_STEPCHG_MASK</div><div class="ttdef"><b>Definition:</b> <a href="a00926_source.html#l00033">pedometer.c:33</a></div></div> 70<div class="ttc" id="a04059_html_a2c49d77dccbc74c7e51171069a0f2709"><div class="ttname"><a href="a04059.html#a2c49d77dccbc74c7e51171069a0f2709">pedometer_config_t::sleepcount_threshold</a></div><div class="ttdeci">debounce_count_t sleepcount_threshold</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00050">pedometer.h:50</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="a04071_html_aa9fd52939922d151d6d2b96afc0455ed"><div class="ttname"><a href="a04071.html#aa9fd52939922d151d6d2b96afc0455ed">pedometer_t::pedometer_status_tag::bits</a></div><div class="ttdeci">struct pedometer_t::pedometer_status_tag::@351::@352 bits</div></div> 73<div class="ttc" id="a00956_html_a3cc9f28cb35404b33588dde34f3ff99f"><div class="ttname"><a href="a00956.html#a3cc9f28cb35404b33588dde34f3ff99f">PEDO_FREQHZ_DEFAULT</a></div><div class="ttdeci">#define PEDO_FREQHZ_DEFAULT</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00031">pedometer.h:31</a></div></div> 74<div class="ttc" id="a04059_html_a458f550d6843e8fb60674eae971c0cb9"><div class="ttname"><a href="a04059.html#a458f550d6843e8fb60674eae971c0cb9">pedometer_config_t::activitycount_threshold</a></div><div class="ttdeci">debounce_count_t activitycount_threshold</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00062">pedometer.h:62</a></div></div> 75<div class="ttc" id="a04067_html"><div class="ttname"><a href="a04067.html">pedometer_t</a></div><div class="ttdoc">This defines the pedometer instance. </div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00073">pedometer.h:73</a></div></div> 76<div class="ttc" id="a04083_html_ae71e38a7c4c0d6be723c1bc142d988f3"><div class="ttname"><a href="a04083.html#ae71e38a7c4c0d6be723c1bc142d988f3">pedometer_t::pedometer_private_tag::stepchg_stepcount</a></div><div class="ttdeci">uint16_t stepchg_stepcount</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00101">pedometer.h:101</a></div></div> 77<div class="ttc" id="a04055_html"><div class="ttname"><a href="a04055.html">ped_accel_t</a></div><div class="ttdoc">This defines the acceleration input data for the pedometer. </div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00039">pedometer.h:39</a></div></div> 78<div class="ttc" id="a04071_html_a1317c431cecdc37eca645ff53566ff97"><div class="ttname"><a href="a04071.html#a1317c431cecdc37eca645ff53566ff97">pedometer_t::pedometer_status_tag::calories</a></div><div class="ttdeci">uint16_t calories</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00094">pedometer.h:94</a></div></div> 79<div class="ttc" id="a00956_html_acc76895a3812c086ea1cc0e665075103"><div class="ttname"><a href="a00956.html#acc76895a3812c086ea1cc0e665075103">PEDO_FILTER_TIME_DEFAULT</a></div><div class="ttdeci">#define PEDO_FILTER_TIME_DEFAULT</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00034">pedometer.h:34</a></div></div> 80<div class="ttc" id="a04071_html_ab22abc2906422da61885ac6c8e6a1a59"><div class="ttname"><a href="a04071.html#ab22abc2906422da61885ac6c8e6a1a59">pedometer_t::pedometer_status_tag::version</a></div><div class="ttdeci">uint8_t version</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00090">pedometer.h:90</a></div></div> 81<div class="ttc" id="a04059_html_aea762e0e67fcafaf5b3cd61201769926"><div class="ttname"><a href="a04059.html#aea762e0e67fcafaf5b3cd61201769926">pedometer_config_t::frequency</a></div><div class="ttdeci">uint16_t frequency</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00067">pedometer.h:67</a></div></div> 82<div class="ttc" id="a04059_html_a867687de96d2347342441466c8e837bb"><div class="ttname"><a href="a04059.html#a867687de96d2347342441466c8e837bb">pedometer_config_t::sleepminimum</a></div><div class="ttdeci">uint16_t sleepminimum</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00048">pedometer.h:48</a></div></div> 83<div class="ttc" id="a04083_html_a5a3edadb40c8bc1e3ba7bdcce7ed47e8"><div class="ttname"><a href="a04083.html#a5a3edadb40c8bc1e3ba7bdcce7ed47e8">pedometer_t::pedometer_private_tag::activitycount</a></div><div class="ttdeci">debounce_count_t activitycount</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00100">pedometer.h:100</a></div></div> 84<div class="ttc" id="a04071_html_a12633132d07532aac2bd05fa1d5c8a72"><div class="ttname"><a href="a04071.html#a12633132d07532aac2bd05fa1d5c8a72">pedometer_t::pedometer_status_tag::speed</a></div><div class="ttdeci">uint16_t speed</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00093">pedometer.h:93</a></div></div> 85<div class="ttc" id="a04067_html_aa49c2e033986e920aff4252b22d1a137"><div class="ttname"><a href="a04067.html#aa49c2e033986e920aff4252b22d1a137">pedometer_t::private</a></div><div class="ttdeci">struct pedometer_t::pedometer_private_tag private</div></div> 86<div class="ttc" id="a04067_html_a2f1259e55605da0fb4eed707f775c170"><div class="ttname"><a href="a04067.html#a2f1259e55605da0fb4eed707f775c170">pedometer_t::config</a></div><div class="ttdeci">pedometer_config_t config</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00097">pedometer.h:97</a></div></div> 87<div class="ttc" id="a00956_html_a00fabbe7008a793b4929533264562c79"><div class="ttname"><a href="a00956.html#a00fabbe7008a793b4929533264562c79">debounce_count_t</a></div><div class="ttdeci">uint16_t debounce_count_t</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00027">pedometer.h:27</a></div></div> 88<div class="ttc" id="a04059_html_afd0819d26b95dad6c81ed177e3b8841a"><div class="ttname"><a href="a04059.html#afd0819d26b95dad6c81ed177e3b8841a">pedometer_config_t::sleepmaximum</a></div><div class="ttdeci">uint16_t sleepmaximum</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00049">pedometer.h:49</a></div></div> 89<div class="ttc" id="a00956_html_a9b92edaeb7dec66a37b4c4689a8c1d42"><div class="ttname"><a href="a00956.html#a9b92edaeb7dec66a37b4c4689a8c1d42">PEDO_SPEED_PERIOD_DEFAULT</a></div><div class="ttdeci">#define PEDO_SPEED_PERIOD_DEFAULT</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00033">pedometer.h:33</a></div></div> 90<div class="ttc" id="a04071_html_aa002fd6818c81cabd8ad9e41ba63951f"><div class="ttname"><a href="a04071.html#aa002fd6818c81cabd8ad9e41ba63951f">pedometer_t::pedometer_status_tag::sleepcount</a></div><div class="ttdeci">debounce_count_t sleepcount</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00095">pedometer.h:95</a></div></div> 91<div class="ttc" id="a04071_html_a0bb1fec62456252807796e63db9a6622"><div class="ttname"><a href="a04071.html#a0bb1fec62456252807796e63db9a6622">pedometer_t::pedometer_status_tag::status</a></div><div class="ttdeci">union pedometer_t::pedometer_status_tag::@351 status</div></div> 92<div class="ttc" id="a04059_html_a0afa045b0bbb9be99912c04821d883f6"><div class="ttname"><a href="a04059.html#a0afa045b0bbb9be99912c04821d883f6">pedometer_config_t::oneG</a></div><div class="ttdeci">uint16_t oneG</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00064">pedometer.h:64</a></div></div> 93<div class="ttc" id="a00926_html_a6205f84a9ef9dc5da8bc39a7d812cd96"><div class="ttname"><a href="a00926.html#a6205f84a9ef9dc5da8bc39a7d812cd96">SQUARED</a></div><div class="ttdeci">#define SQUARED(x)</div><div class="ttdef"><b>Definition:</b> <a href="a00926_source.html#l00039">pedometer.c:39</a></div></div> 94<div class="ttc" id="a00926_html_adeeafda7d7bc523470e84dca8e12f6d6"><div class="ttname"><a href="a00926.html#adeeafda7d7bc523470e84dca8e12f6d6">PEDOMETER_STATUS_ACTCHG_MASK</a></div><div class="ttdeci">#define PEDOMETER_STATUS_ACTCHG_MASK</div><div class="ttdef"><b>Definition:</b> <a href="a00926_source.html#l00032">pedometer.c:32</a></div></div> 95<div class="ttc" id="a00926_html_a87224a70b303355a416beaca80ed1b2f"><div class="ttname"><a href="a00926.html#a87224a70b303355a416beaca80ed1b2f">pedometer_run</a></div><div class="ttdeci">int32_t pedometer_run(pedometer_t *pPedometer, ped_accel_t *pData)</div><div class="ttdoc">The interface function excutes the pedometer algorithm. </div><div class="ttdef"><b>Definition:</b> <a href="a00926_source.html#l00125">pedometer.c:125</a></div></div> 96<div class="ttc" id="a00956_html_a7aa4476f16cc506cd6353a5f367dbe43"><div class="ttname"><a href="a00956.html#a7aa4476f16cc506cd6353a5f367dbe43">PEDO_STEP_THRESHOLD_DEFAULT</a></div><div class="ttdeci">#define PEDO_STEP_THRESHOLD_DEFAULT</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00032">pedometer.h:32</a></div></div> 97<div class="ttc" id="a04055_html_a661660001effc417fb684db96e973688"><div class="ttname"><a href="a04055.html#a661660001effc417fb684db96e973688">ped_accel_t::accel</a></div><div class="ttdeci">int16_t accel[3]</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00041">pedometer.h:41</a></div></div> 98<div class="ttc" id="a04059_html_abfc26f393d3220e339326c7b4cdbfcef"><div class="ttname"><a href="a04059.html#abfc26f393d3220e339326c7b4cdbfcef">pedometer_config_t::bits</a></div><div class="ttdeci">struct pedometer_config_t::@350 bits</div></div> 99<div class="ttc" id="a00926_html_a9eab5efe6197a175d923d43c6e9b57d5"><div class="ttname"><a href="a00926.html#a9eab5efe6197a175d923d43c6e9b57d5">PEDOMETER_STATUS_ACTIVITY_BITNUM</a></div><div class="ttdeci">#define PEDOMETER_STATUS_ACTIVITY_BITNUM</div><div class="ttdef"><b>Definition:</b> <a href="a00926_source.html#l00023">pedometer.c:23</a></div></div> 100<div class="ttc" id="a00926_html_a594d690252fcfc6713fe8374f384fe69"><div class="ttname"><a href="a00926.html#a594d690252fcfc6713fe8374f384fe69">pedometer_init</a></div><div class="ttdeci">void pedometer_init(pedometer_t *pPedometer)</div><div class="ttdoc">The interface function initialize the pedometer. </div><div class="ttdef"><b>Definition:</b> <a href="a00926_source.html#l00097">pedometer.c:97</a></div></div> 101<div class="ttc" id="a04071_html_ace0ff960f4cd3ce9aa8452dc57a97c2e"><div class="ttname"><a href="a04071.html#ace0ff960f4cd3ce9aa8452dc57a97c2e">pedometer_t::pedometer_status_tag::stepcount</a></div><div class="ttdeci">uint16_t stepcount</div><div class="ttdef"><b>Definition:</b> <a href="a00956_source.html#l00091">pedometer.h:91</a></div></div> 102</div><!-- fragment --></div><!-- contents --> 103 104<hr class="footer"/><address class="footer"><small> 105© Copyright 2016-2022 NXP. All Rights Reserved. SPDX-License-Identifier: BSD-3-Clause 106</small></address> 107</body> 108</html> 109