Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
48241ad08This file is pinned to the selected release. Download the original to open it in your design tool.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>IoT-MBBR (masterthesis): firmware/EFM32HG222F64_iot-mbbr/VL53L1X_API/VL53L1X_calibration.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">IoT-MBBR (masterthesis)
</div>
<div id="projectbrief">Masterthesis upgrading a Moving Bed BioReactor with extra sensors and cloud connectivity.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',false,false,'search.php','Search');
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('VL53L1X__calibration_8h.html','');});
</script>
<div id="doc-content">
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">VL53L1X_calibration.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<p><a href="VL53L1X__calibration_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a86320c9eff0091a4f0fb32e6c6715559"><td class="memItemLeft" align="right" valign="top"><a class="el" href="vl53l1__types_8h.html#aef44329758059c91c76d334e8fc09700">int8_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="VL53L1X__calibration_8h.html#a86320c9eff0091a4f0fb32e6c6715559">VL53L1X_CalibrateOffset</a> (<a class="el" href="vl53l1__types_8h.html#a273cf69d639a59973b6019625df33e30">uint16_t</a> dev, <a class="el" href="vl53l1__types_8h.html#a273cf69d639a59973b6019625df33e30">uint16_t</a> TargetDistInMm, <a class="el" href="vl53l1__types_8h.html#aa343fa3b3d06292b959ffdd4c4703b06">int16_t</a> *<a class="el" href="VL43L1X_8c.html#a59f874d10bf763992bd4b427fdb7f0cd">offset</a>)</td></tr>
<tr class="memdesc:a86320c9eff0091a4f0fb32e6c6715559"><td class="mdescLeft"> </td><td class="mdescRight">This function performs the offset calibration.<br />
The function returns the offset value found and programs the offset compensation into the device. <a href="#a86320c9eff0091a4f0fb32e6c6715559">More...</a><br /></td></tr>
<tr class="separator:a86320c9eff0091a4f0fb32e6c6715559"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a157137ae6596c371bb85c4e821e88552"><td class="memItemLeft" align="right" valign="top"><a class="el" href="vl53l1__types_8h.html#aef44329758059c91c76d334e8fc09700">int8_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="VL53L1X__calibration_8h.html#a157137ae6596c371bb85c4e821e88552">VL53L1X_CalibrateXtalk</a> (<a class="el" href="vl53l1__types_8h.html#a273cf69d639a59973b6019625df33e30">uint16_t</a> dev, <a class="el" href="vl53l1__types_8h.html#a273cf69d639a59973b6019625df33e30">uint16_t</a> TargetDistInMm, <a class="el" href="vl53l1__types_8h.html#a273cf69d639a59973b6019625df33e30">uint16_t</a> *<a class="el" href="VL43L1X_8c.html#adb0ff34475b9aa26cedb11940bc27e85">xtalk</a>)</td></tr>
<tr class="memdesc:a157137ae6596c371bb85c4e821e88552"><td class="mdescLeft"> </td><td class="mdescRight">This function performs the xtalk calibration.<br />
The function returns the xtalk value found and programs the xtalk compensation to the device. <a href="#a157137ae6596c371bb85c4e821e88552">More...</a><br /></td></tr>
<tr class="separator:a157137ae6596c371bb85c4e821e88552"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="a86320c9eff0091a4f0fb32e6c6715559"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a86320c9eff0091a4f0fb32e6c6715559">◆ </a></span>VL53L1X_CalibrateOffset()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="vl53l1__types_8h.html#aef44329758059c91c76d334e8fc09700">int8_t</a> VL53L1X_CalibrateOffset </td>
<td>(</td>
<td class="paramtype"><a class="el" href="vl53l1__types_8h.html#a273cf69d639a59973b6019625df33e30">uint16_t</a> </td>
<td class="paramname"><em>dev</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="vl53l1__types_8h.html#a273cf69d639a59973b6019625df33e30">uint16_t</a> </td>
<td class="paramname"><em>TargetDistInMm</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="vl53l1__types_8h.html#aa343fa3b3d06292b959ffdd4c4703b06">int16_t</a> * </td>
<td class="paramname"><em>offset</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function performs the offset calibration.<br />
The function returns the offset value found and programs the offset compensation into the device. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">TargetDistInMm</td><td>target distance in mm, ST recommended 100 mm Target reflectance = grey17% </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0:success, !=0: failed </dd>
<dd>
offset pointer contains the offset found in mm </dd></dl>
<p class="definition">Definition at line <a class="el" href="VL53L1X__calibration_8c_source.html#l00073">73</a> of file <a class="el" href="VL53L1X__calibration_8c_source.html">VL53L1X_calibration.c</a>.</p>
<div class="fragment"><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>  <a class="code" href="vl53l1__types_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> i, tmp;</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <a class="code" href="vl53l1__types_8h.html#aa343fa3b3d06292b959ffdd4c4703b06">int16_t</a> AverageDistance = 0;</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  <a class="code" href="vl53l1__types_8h.html#a273cf69d639a59973b6019625df33e30">uint16_t</a> distance;</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <a class="code" href="VL53L1X__api_8h.html#aa2cba6efa144107fcf97e81be52802fc">VL53L1X_ERROR</a> status = 0;</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>  status = <a class="code" href="vl53l1__platform_8c.html#a79dafd64b8435d306696839614382ef1">VL53L1_WrWord</a>(dev, <a class="code" href="VL53L1X__calibration_8c.html#a2ab0e4617017e0bd940200ba07be4d34">ALGO__PART_TO_PART_RANGE_OFFSET_MM</a>, 0x0);</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  status = <a class="code" href="vl53l1__platform_8c.html#a79dafd64b8435d306696839614382ef1">VL53L1_WrWord</a>(dev, <a class="code" href="VL53L1X__calibration_8c.html#a88617357dbed400268cfc2ee563f5396">MM_CONFIG__INNER_OFFSET_MM</a>, 0x0);</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  status = <a class="code" href="vl53l1__platform_8c.html#a79dafd64b8435d306696839614382ef1">VL53L1_WrWord</a>(dev, <a class="code" href="VL53L1X__calibration_8c.html#a3f7f279509c4971c0027dd4004007c2f">MM_CONFIG__OUTER_OFFSET_MM</a>, 0x0);</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  status = <a class="code" href="VL53L1X__api_8c.html#a59adb6ca7cf8cf1744dda9223e060d7a">VL53L1X_StartRanging</a>(dev); <span class="comment">/* Enable VL53L1X sensor */</span></div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  <span class="keywordflow">for</span> (i = 0; i < 50; i++) {</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  tmp = 0;</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  <span class="keywordflow">while</span> (tmp == 0){</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  status = <a class="code" href="VL53L1X__api_8c.html#a51f7cace95b9d5d8e1bd093ddb19a7dd">VL53L1X_CheckForDataReady</a>(dev, &tmp);</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>  status = <a class="code" href="VL53L1X__api_8c.html#a06745c308363ee18e041ea8fa3c24eb5">VL53L1X_GetDistance</a>(dev, &distance);</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  status = <a class="code" href="VL53L1X__api_8c.html#ab4bae81bb4a10d4bba7ff1849d10cf5c">VL53L1X_ClearInterrupt</a>(dev);</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  AverageDistance = AverageDistance + distance;</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  }</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  status = <a class="code" href="VL53L1X__api_8c.html#a39198465d18ebd1159a5378bf974ba85">VL53L1X_StopRanging</a>(dev);</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  AverageDistance = AverageDistance / 50;</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  *<a class="code" href="VL43L1X_8c.html#a59f874d10bf763992bd4b427fdb7f0cd">offset</a> = TargetDistInMm - AverageDistance;</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  status = <a class="code" href="vl53l1__platform_8c.html#a79dafd64b8435d306696839614382ef1">VL53L1_WrWord</a>(dev, <a class="code" href="VL53L1X__calibration_8c.html#a2ab0e4617017e0bd940200ba07be4d34">ALGO__PART_TO_PART_RANGE_OFFSET_MM</a>, *<a class="code" href="VL43L1X_8c.html#a59f874d10bf763992bd4b427fdb7f0cd">offset</a>*4);</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  <span class="keywordflow">return</span> status;</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span> }</div><div class="ttc" id="vl53l1__platform_8c_html_a79dafd64b8435d306696839614382ef1"><div class="ttname"><a href="vl53l1__platform_8c.html#a79dafd64b8435d306696839614382ef1">VL53L1_WrWord</a></div><div class="ttdeci">int8_t VL53L1_WrWord(uint16_t dev, uint16_t index, uint16_t data)</div><div class="ttdoc">Write a word (16 bits) to the I2C bus. </div><div class="ttdef"><b>Definition:</b> <a href="vl53l1__platform_8c_source.html#l00229">vl53l1_platform.c:229</a></div></div>
<div class="ttc" id="VL53L1X__api_8h_html_aa2cba6efa144107fcf97e81be52802fc"><div class="ttname"><a href="VL53L1X__api_8h.html#aa2cba6efa144107fcf97e81be52802fc">VL53L1X_ERROR</a></div><div class="ttdeci">int8_t VL53L1X_ERROR</div><div class="ttdef"><b>Definition:</b> <a href="VL53L1X__api_8h_source.html#l00078">VL53L1X_api.h:78</a></div></div>
<div class="ttc" id="VL53L1X__api_8c_html_a39198465d18ebd1159a5378bf974ba85"><div class="ttname"><a href="VL53L1X__api_8c.html#a39198465d18ebd1159a5378bf974ba85">VL53L1X_StopRanging</a></div><div class="ttdeci">VL53L1X_ERROR VL53L1X_StopRanging(uint16_t dev)</div><div class="ttdoc">This function stops the ranging. </div><div class="ttdef"><b>Definition:</b> <a href="VL53L1X__api_8c_source.html#l00283">VL53L1X_api.c:283</a></div></div>
<div class="ttc" id="VL53L1X__api_8c_html_a59adb6ca7cf8cf1744dda9223e060d7a"><div class="ttname"><a href="VL53L1X__api_8c.html#a59adb6ca7cf8cf1744dda9223e060d7a">VL53L1X_StartRanging</a></div><div class="ttdeci">VL53L1X_ERROR VL53L1X_StartRanging(uint16_t dev)</div><div class="ttdoc">This function starts the ranging distance operation The ranging operation is continuous. The clear interrupt has to be done after each get data to allow the interrupt to raise when the next data is ready 1=active high (default), 0=active low, use SetInterruptPolarity() to change the interrupt polarity if required. </div><div class="ttdef"><b>Definition:</b> <a href="VL53L1X__api_8c_source.html#l00275">VL53L1X_api.c:275</a></div></div>
<div class="ttc" id="VL43L1X_8c_html_a59f874d10bf763992bd4b427fdb7f0cd"><div class="ttname"><a href="VL43L1X_8c.html#a59f874d10bf763992bd4b427fdb7f0cd">offset</a></div><div class="ttdeci">int16_t offset</div><div class="ttdef"><b>Definition:</b> <a href="VL43L1X_8c_source.html#l00052">VL43L1X.c:52</a></div></div>
<div class="ttc" id="VL53L1X__calibration_8c_html_a3f7f279509c4971c0027dd4004007c2f"><div class="ttname"><a href="VL53L1X__calibration_8c.html#a3f7f279509c4971c0027dd4004007c2f">MM_CONFIG__OUTER_OFFSET_MM</a></div><div class="ttdeci">#define MM_CONFIG__OUTER_OFFSET_MM</div><div class="ttdef"><b>Definition:</b> <a href="VL53L1X__calibration_8c_source.html#l00071">VL53L1X_calibration.c:71</a></div></div>
<div class="ttc" id="vl53l1__types_8h_html_aa343fa3b3d06292b959ffdd4c4703b06"><div class="ttname"><a href="vl53l1__types_8h.html#aa343fa3b3d06292b959ffdd4c4703b06">int16_t</a></div><div class="ttdeci">short int16_t</div><div class="ttdoc">Typedef defining 16 bit short type. The developer should modify this to suit the platform being deplo...</div><div class="ttdef"><b>Definition:</b> <a href="vl53l1__types_8h_source.html#l00093">vl53l1_types.h:93</a></div></div>
<div class="ttc" id="VL53L1X__api_8c_html_a06745c308363ee18e041ea8fa3c24eb5"><div class="ttname"><a href="VL53L1X__api_8c.html#a06745c308363ee18e041ea8fa3c24eb5">VL53L1X_GetDistance</a></div><div class="ttdeci">VL53L1X_ERROR VL53L1X_GetDistance(uint16_t dev, uint16_t *distance)</div><div class="ttdoc">This function returns the distance measured by the sensor in mm. </div><div class="ttdef"><b>Definition:</b> <a href="VL53L1X__api_8c_source.html#l00546">VL53L1X_api.c:546</a></div></div>
<div class="ttc" id="VL53L1X__calibration_8c_html_a2ab0e4617017e0bd940200ba07be4d34"><div class="ttname"><a href="VL53L1X__calibration_8c.html#a2ab0e4617017e0bd940200ba07be4d34">ALGO__PART_TO_PART_RANGE_OFFSET_MM</a></div><div class="ttdeci">#define ALGO__PART_TO_PART_RANGE_OFFSET_MM</div><div class="ttdef"><b>Definition:</b> <a href="VL53L1X__calibration_8c_source.html#l00069">VL53L1X_calibration.c:69</a></div></div>
<div class="ttc" id="VL53L1X__calibration_8c_html_a88617357dbed400268cfc2ee563f5396"><div class="ttname"><a href="VL53L1X__calibration_8c.html#a88617357dbed400268cfc2ee563f5396">MM_CONFIG__INNER_OFFSET_MM</a></div><div class="ttdeci">#define MM_CONFIG__INNER_OFFSET_MM</div><div class="ttdef"><b>Definition:</b> <a href="VL53L1X__calibration_8c_source.html#l00070">VL53L1X_calibration.c:70</a></div></div>
<div class="ttc" id="VL53L1X__api_8c_html_a51f7cace95b9d5d8e1bd093ddb19a7dd"><div class="ttname"><a href="VL53L1X__api_8c.html#a51f7cace95b9d5d8e1bd093ddb19a7dd">VL53L1X_CheckForDataReady</a></div><div class="ttdeci">VL53L1X_ERROR VL53L1X_CheckForDataReady(uint16_t dev, uint8_t *isDataReady)</div><div class="ttdoc">This function checks if the new ranging data is available by polling the dedicated register...</div><div class="ttdef"><b>Definition:</b> <a href="VL53L1X__api_8c_source.html#l00291">VL53L1X_api.c:291</a></div></div>
<div class="ttc" id="VL53L1X__api_8c_html_ab4bae81bb4a10d4bba7ff1849d10cf5c"><div class="ttname"><a href="VL53L1X__api_8c.html#ab4bae81bb4a10d4bba7ff1849d10cf5c">VL53L1X_ClearInterrupt</a></div><div class="ttdeci">VL53L1X_ERROR VL53L1X_ClearInterrupt(uint16_t dev)</div><div class="ttdoc">This function clears the interrupt, to be called after a ranging data reading to arm the interrupt fo...</div><div class="ttdef"><b>Definition:</b> <a href="VL53L1X__api_8c_source.html#l00245">VL53L1X_api.c:245</a></div></div>
<div class="ttc" id="vl53l1__types_8h_html_a273cf69d639a59973b6019625df33e30"><div class="ttname"><a href="vl53l1__types_8h.html#a273cf69d639a59973b6019625df33e30">uint16_t</a></div><div class="ttdeci">unsigned short uint16_t</div><div class="ttdoc">Typedef defining 16 bit unsigned short type. The developer should modify this to suit the platform be...</div><div class="ttdef"><b>Definition:</b> <a href="vl53l1__types_8h_source.html#l00088">vl53l1_types.h:88</a></div></div>
<div class="ttc" id="vl53l1__types_8h_html_aba7bc1797add20fe3efdf37ced1182c5"><div class="ttname"><a href="vl53l1__types_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a></div><div class="ttdeci">unsigned char uint8_t</div><div class="ttdoc">Typedef defining 8 bit unsigned char type. The developer should modify this to suit the platform bein...</div><div class="ttdef"><b>Definition:</b> <a href="vl53l1__types_8h_source.html#l00098">vl53l1_types.h:98</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a id="a157137ae6596c371bb85c4e821e88552"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a157137ae6596c371bb85c4e821e88552">◆ </a></span>VL53L1X_CalibrateXtalk()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="vl53l1__types_8h.html#aef44329758059c91c76d334e8fc09700">int8_t</a> VL53L1X_CalibrateXtalk </td>
<td>(</td>
<td class="paramtype"><a class="el" href="vl53l1__types_8h.html#a273cf69d639a59973b6019625df33e30">uint16_t</a> </td>
<td class="paramname"><em>dev</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="vl53l1__types_8h.html#a273cf69d639a59973b6019625df33e30">uint16_t</a> </td>
<td class="paramname"><em>TargetDistInMm</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="vl53l1__types_8h.html#a273cf69d639a59973b6019625df33e30">uint16_t</a> * </td>
<td class="paramname"><em>xtalk</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>This function performs the xtalk calibration.<br />
The function returns the xtalk value found and programs the xtalk compensation to the device. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">TargetDistInMm</td><td>target distance in mm<br />
The target distance : the distance where the sensor start to "under range"<br />
due to the influence of the photons reflected back from the cover glass becoming strong<br />
It's also called inflection point<br />
Target reflectance = grey 17% </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0: success, !=0: failed </dd>
<dd>
xtalk pointer contains the xtalk value found in cps (number of photons in count per second) </dd></dl>
<p class="definition">Definition at line <a class="el" href="VL53L1X__calibration_8c_source.html#l00100">100</a> of file <a class="el" href="VL53L1X__calibration_8c_source.html">VL53L1X_calibration.c</a>.</p>
<div class="fragment"><div class="line"><a name="l00101"></a><span class="lineno"> 101</span> {</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  <a class="code" href="vl53l1__types_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> i, tmp;</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  <span class="keywordtype">float</span> AverageSignalRate = 0;</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  <span class="keywordtype">float</span> AverageDistance = 0;</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  <span class="keywordtype">float</span> AverageSpadNb = 0;</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <a class="code" href="vl53l1__types_8h.html#a273cf69d639a59973b6019625df33e30">uint16_t</a> distance = 0, spadNum;</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  <a class="code" href="vl53l1__types_8h.html#a273cf69d639a59973b6019625df33e30">uint16_t</a> sr;</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  <a class="code" href="VL53L1X__api_8h.html#aa2cba6efa144107fcf97e81be52802fc">VL53L1X_ERROR</a> status = 0;</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <a class="code" href="vl53l1__types_8h.html#a435d1572bf3f880d55459d9805097f62">uint32_t</a> calXtalk;</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span> </div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  status = <a class="code" href="vl53l1__platform_8c.html#a79dafd64b8435d306696839614382ef1">VL53L1_WrWord</a>(dev, 0x0016,0);</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  status = <a class="code" href="VL53L1X__api_8c.html#a59adb6ca7cf8cf1744dda9223e060d7a">VL53L1X_StartRanging</a>(dev);</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  <span class="keywordflow">for</span> (i = 0; i < 50; i++) {</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  tmp = 0;</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  <span class="keywordflow">while</span> (tmp == 0){</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  status = <a class="code" href="VL53L1X__api_8c.html#a51f7cace95b9d5d8e1bd093ddb19a7dd">VL53L1X_CheckForDataReady</a>(dev, &tmp);</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  }</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  status= <a class="code" href="VL53L1X__api_8c.html#ae0b24e3b0ba77c5de787018eb42e2336">VL53L1X_GetSignalRate</a>(dev, &sr);</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  status= <a class="code" href="VL53L1X__api_8c.html#a06745c308363ee18e041ea8fa3c24eb5">VL53L1X_GetDistance</a>(dev, &distance);</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  status = <a class="code" href="VL53L1X__api_8c.html#ab4bae81bb4a10d4bba7ff1849d10cf5c">VL53L1X_ClearInterrupt</a>(dev);</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  AverageDistance = AverageDistance + distance;</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  status = <a class="code" href="VL53L1X__api_8c.html#a3a31d70330fb9cfc607eb53e9ccf0aba">VL53L1X_GetSpadNb</a>(dev, &spadNum);</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  AverageSpadNb = AverageSpadNb + spadNum;</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  AverageSignalRate =</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  AverageSignalRate + sr;</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>  status = <a class="code" href="VL53L1X__api_8c.html#a39198465d18ebd1159a5378bf974ba85">VL53L1X_StopRanging</a>(dev);</div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  AverageDistance = AverageDistance / 50;</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  AverageSpadNb = AverageSpadNb / 50;</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  AverageSignalRate = AverageSignalRate / 50;</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  <span class="comment">/* Calculate Xtalk value */</span></div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  calXtalk = (<a class="code" href="vl53l1__types_8h.html#a273cf69d639a59973b6019625df33e30">uint16_t</a>)(512*(AverageSignalRate*(1-(AverageDistance/TargetDistInMm)))/AverageSpadNb);</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  *<a class="code" href="VL43L1X_8c.html#adb0ff34475b9aa26cedb11940bc27e85">xtalk</a> = (<a class="code" href="vl53l1__types_8h.html#a273cf69d639a59973b6019625df33e30">uint16_t</a>)(calXtalk*1000)>>9;</div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  status = <a class="code" href="vl53l1__platform_8c.html#a79dafd64b8435d306696839614382ef1">VL53L1_WrWord</a>(dev, 0x0016, calXtalk);</div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  <span class="keywordflow">return</span> status;</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span> }</div><div class="ttc" id="vl53l1__platform_8c_html_a79dafd64b8435d306696839614382ef1"><div class="ttname"><a href="vl53l1__platform_8c.html#a79dafd64b8435d306696839614382ef1">VL53L1_WrWord</a></div><div class="ttdeci">int8_t VL53L1_WrWord(uint16_t dev, uint16_t index, uint16_t data)</div><div class="ttdoc">Write a word (16 bits) to the I2C bus. </div><div class="ttdef"><b>Definition:</b> <a href="vl53l1__platform_8c_source.html#l00229">vl53l1_platform.c:229</a></div></div>
<div class="ttc" id="VL53L1X__api_8h_html_aa2cba6efa144107fcf97e81be52802fc"><div class="ttname"><a href="VL53L1X__api_8h.html#aa2cba6efa144107fcf97e81be52802fc">VL53L1X_ERROR</a></div><div class="ttdeci">int8_t VL53L1X_ERROR</div><div class="ttdef"><b>Definition:</b> <a href="VL53L1X__api_8h_source.html#l00078">VL53L1X_api.h:78</a></div></div>
<div class="ttc" id="VL53L1X__api_8c_html_a39198465d18ebd1159a5378bf974ba85"><div class="ttname"><a href="VL53L1X__api_8c.html#a39198465d18ebd1159a5378bf974ba85">VL53L1X_StopRanging</a></div><div class="ttdeci">VL53L1X_ERROR VL53L1X_StopRanging(uint16_t dev)</div><div class="ttdoc">This function stops the ranging. </div><div class="ttdef"><b>Definition:</b> <a href="VL53L1X__api_8c_source.html#l00283">VL53L1X_api.c:283</a></div></div>
<div class="ttc" id="VL53L1X__api_8c_html_a59adb6ca7cf8cf1744dda9223e060d7a"><div class="ttname"><a href="VL53L1X__api_8c.html#a59adb6ca7cf8cf1744dda9223e060d7a">VL53L1X_StartRanging</a></div><div class="ttdeci">VL53L1X_ERROR VL53L1X_StartRanging(uint16_t dev)</div><div class="ttdoc">This function starts the ranging distance operation The ranging operation is continuous. The clear interrupt has to be done after each get data to allow the interrupt to raise when the next data is ready 1=active high (default), 0=active low, use SetInterruptPolarity() to change the interrupt polarity if required. </div><div class="ttdef"><b>Definition:</b> <a href="VL53L1X__api_8c_source.html#l00275">VL53L1X_api.c:275</a></div></div>
<div class="ttc" id="VL43L1X_8c_html_adb0ff34475b9aa26cedb11940bc27e85"><div class="ttname"><a href="VL43L1X_8c.html#adb0ff34475b9aa26cedb11940bc27e85">xtalk</a></div><div class="ttdeci">uint16_t xtalk</div><div class="ttdef"><b>Definition:</b> <a href="VL43L1X_8c_source.html#l00053">VL43L1X.c:53</a></div></div>
<div class="ttc" id="VL53L1X__api_8c_html_ae0b24e3b0ba77c5de787018eb42e2336"><div class="ttname"><a href="VL53L1X__api_8c.html#ae0b24e3b0ba77c5de787018eb42e2336">VL53L1X_GetSignalRate</a></div><div class="ttdeci">VL53L1X_ERROR VL53L1X_GetSignalRate(uint16_t dev, uint16_t *signal)</div><div class="ttdoc">This function returns the returned signal in kcps. </div><div class="ttdef"><b>Definition:</b> <a href="VL53L1X__api_8c_source.html#l00581">VL53L1X_api.c:581</a></div></div>
<div class="ttc" id="VL53L1X__api_8c_html_a06745c308363ee18e041ea8fa3c24eb5"><div class="ttname"><a href="VL53L1X__api_8c.html#a06745c308363ee18e041ea8fa3c24eb5">VL53L1X_GetDistance</a></div><div class="ttdeci">VL53L1X_ERROR VL53L1X_GetDistance(uint16_t dev, uint16_t *distance)</div><div class="ttdoc">This function returns the distance measured by the sensor in mm. </div><div class="ttdef"><b>Definition:</b> <a href="VL53L1X__api_8c_source.html#l00546">VL53L1X_api.c:546</a></div></div>
<div class="ttc" id="VL53L1X__api_8c_html_a3a31d70330fb9cfc607eb53e9ccf0aba"><div class="ttname"><a href="VL53L1X__api_8c.html#a3a31d70330fb9cfc607eb53e9ccf0aba">VL53L1X_GetSpadNb</a></div><div class="ttdeci">VL53L1X_ERROR VL53L1X_GetSpadNb(uint16_t dev, uint16_t *spNb)</div><div class="ttdoc">This function returns the current number of enabled SPADs. </div><div class="ttdef"><b>Definition:</b> <a href="VL53L1X__api_8c_source.html#l00592">VL53L1X_api.c:592</a></div></div>
<div class="ttc" id="VL53L1X__api_8c_html_a51f7cace95b9d5d8e1bd093ddb19a7dd"><div class="ttname"><a href="VL53L1X__api_8c.html#a51f7cace95b9d5d8e1bd093ddb19a7dd">VL53L1X_CheckForDataReady</a></div><div class="ttdeci">VL53L1X_ERROR VL53L1X_CheckForDataReady(uint16_t dev, uint8_t *isDataReady)</div><div class="ttdoc">This function checks if the new ranging data is available by polling the dedicated register...</div><div class="ttdef"><b>Definition:</b> <a href="VL53L1X__api_8c_source.html#l00291">VL53L1X_api.c:291</a></div></div>
<div class="ttc" id="VL53L1X__api_8c_html_ab4bae81bb4a10d4bba7ff1849d10cf5c"><div class="ttname"><a href="VL53L1X__api_8c.html#ab4bae81bb4a10d4bba7ff1849d10cf5c">VL53L1X_ClearInterrupt</a></div><div class="ttdeci">VL53L1X_ERROR VL53L1X_ClearInterrupt(uint16_t dev)</div><div class="ttdoc">This function clears the interrupt, to be called after a ranging data reading to arm the interrupt fo...</div><div class="ttdef"><b>Definition:</b> <a href="VL53L1X__api_8c_source.html#l00245">VL53L1X_api.c:245</a></div></div>
<div class="ttc" id="vl53l1__types_8h_html_a273cf69d639a59973b6019625df33e30"><div class="ttname"><a href="vl53l1__types_8h.html#a273cf69d639a59973b6019625df33e30">uint16_t</a></div><div class="ttdeci">unsigned short uint16_t</div><div class="ttdoc">Typedef defining 16 bit unsigned short type. The developer should modify this to suit the platform be...</div><div class="ttdef"><b>Definition:</b> <a href="vl53l1__types_8h_source.html#l00088">vl53l1_types.h:88</a></div></div>
<div class="ttc" id="vl53l1__types_8h_html_aba7bc1797add20fe3efdf37ced1182c5"><div class="ttname"><a href="vl53l1__types_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a></div><div class="ttdeci">unsigned char uint8_t</div><div class="ttdoc">Typedef defining 8 bit unsigned char type. The developer should modify this to suit the platform bein...</div><div class="ttdef"><b>Definition:</b> <a href="vl53l1__types_8h_source.html#l00098">vl53l1_types.h:98</a></div></div>
<div class="ttc" id="vl53l1__types_8h_html_a435d1572bf3f880d55459d9805097f62"><div class="ttname"><a href="vl53l1__types_8h.html#a435d1572bf3f880d55459d9805097f62">uint32_t</a></div><div class="ttdeci">unsigned int uint32_t</div><div class="ttdoc">Typedef defining 32 bit unsigned int type. The developer should modify this to suit the platform bein...</div><div class="ttdef"><b>Definition:</b> <a href="vl53l1__types_8h_source.html#l00078">vl53l1_types.h:78</a></div></div>
</div><!-- fragment -->
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_d9edf6c004b4a7ff14fe9ae7a92214ee.html">firmware</a></li><li class="navelem"><a class="el" href="dir_9a5a365c58dea0dc152d55f461feaba5.html">EFM32HG222F64_iot-mbbr</a></li><li class="navelem"><a class="el" href="dir_0060e6410b4221bd784218667f19287e.html">VL53L1X_API</a></li><li class="navelem"><a class="el" href="VL53L1X__calibration_8h.html">VL53L1X_calibration.h</a></li>
<li class="footer">Generated on Thu Sep 3 2020 04:44:25 for IoT-MBBR (masterthesis) by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
</ul>
</div>
</body>
</html>