This repository has been archived on 2024-01-25. You can view files and clone it, but cannot push or open issues or pull requests.
Solar-Panel/html/measure_8c.html
2023-03-15 12:55:57 +01:00

326 lines
16 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Solar panel: measure.c 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>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></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 id="projectrow">
<td id="projectalign">
<div id="projectname">Solar panel
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</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">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('measure_8c.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle"><div class="title">measure.c File Reference</div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;xc.h&gt;</code><br />
<code>#include &quot;<a class="el" href="measure_8h_source.html">measure.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="mcc_8h_source.html">mcc_generated_files/mcc.h</a>&quot;</code><br />
</div>
<p><a href="measure_8c_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 id="define-members" name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a3ad11a109af35fa8de5e0b1b3e60142b"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="measure_8c.html#a3ad11a109af35fa8de5e0b1b3e60142b">VOLTAGE_CHANNEL</a>&#160;&#160;&#160;0x5</td></tr>
<tr class="separator:a3ad11a109af35fa8de5e0b1b3e60142b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a501e37e951966e98511c9c1eb0c7d397"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="measure_8c.html#a501e37e951966e98511c9c1eb0c7d397">CURRENT_CHANNEL</a>&#160;&#160;&#160;0x6</td></tr>
<tr class="separator:a501e37e951966e98511c9c1eb0c7d397"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a00978ca9e8220475258dcbbbb7d29129"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="measure_8c.html#a00978ca9e8220475258dcbbbb7d29129">ADC_RESOLUTION</a>&#160;&#160;&#160;(1024 - 1)</td></tr>
<tr class="separator:a00978ca9e8220475258dcbbbb7d29129"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0d196150332c5bf12bb9684b0f1cc975"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="measure_8c.html#a0d196150332c5bf12bb9684b0f1cc975">ADC_REFH</a>&#160;&#160;&#160;3300</td></tr>
<tr class="separator:a0d196150332c5bf12bb9684b0f1cc975"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8c8f27b35dfa40ccf31c1ee31479a31c"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="measure_8c.html#a8c8f27b35dfa40ccf31c1ee31479a31c">GAIN</a>&#160;&#160;&#160;66</td></tr>
<tr class="separator:a8c8f27b35dfa40ccf31c1ee31479a31c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a061cddbb720e9fd818a11a141e890f47"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="measure_8c.html#a061cddbb720e9fd818a11a141e890f47">RESISTOR</a>&#160;&#160;&#160;3</td></tr>
<tr class="separator:a061cddbb720e9fd818a11a141e890f47"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0772f4f0c5e19d53263d12a0c0b296ae"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="measure_8c.html#a0772f4f0c5e19d53263d12a0c0b296ae">AVERAGE_SAMPLES</a>&#160;&#160;&#160;8</td></tr>
<tr class="separator:a0772f4f0c5e19d53263d12a0c0b296ae"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a2b815e6730e8723a6d1d06d9ef8f31c0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="measure_8c.html#a2b815e6730e8723a6d1d06d9ef8f31c0">adc_init</a> (void)</td></tr>
<tr class="separator:a2b815e6730e8723a6d1d06d9ef8f31c0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a104c0f284978c4cc8d34d36677a97e72"><td class="memItemLeft" align="right" valign="top">uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="measure_8c.html#a104c0f284978c4cc8d34d36677a97e72">measure_voltage</a> ()</td></tr>
<tr class="separator:a104c0f284978c4cc8d34d36677a97e72"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad77a3b79bc20b11c0d5462cc0b7134b3"><td class="memItemLeft" align="right" valign="top">uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="measure_8c.html#ad77a3b79bc20b11c0d5462cc0b7134b3">measure_current</a> (uint16_t offset)</td></tr>
<tr class="separator:ad77a3b79bc20b11c0d5462cc0b7134b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a0d196150332c5bf12bb9684b0f1cc975" name="a0d196150332c5bf12bb9684b0f1cc975"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0d196150332c5bf12bb9684b0f1cc975">&#9670;&#160;</a></span>ADC_REFH</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define ADC_REFH&#160;&#160;&#160;3300</td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="measure_8c_source.html#l00009">9</a> of file <a class="el" href="measure_8c_source.html">measure.c</a>.</p>
</div>
</div>
<a id="a00978ca9e8220475258dcbbbb7d29129" name="a00978ca9e8220475258dcbbbb7d29129"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a00978ca9e8220475258dcbbbb7d29129">&#9670;&#160;</a></span>ADC_RESOLUTION</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define ADC_RESOLUTION&#160;&#160;&#160;(1024 - 1)</td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="measure_8c_source.html#l00008">8</a> of file <a class="el" href="measure_8c_source.html">measure.c</a>.</p>
</div>
</div>
<a id="a0772f4f0c5e19d53263d12a0c0b296ae" name="a0772f4f0c5e19d53263d12a0c0b296ae"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0772f4f0c5e19d53263d12a0c0b296ae">&#9670;&#160;</a></span>AVERAGE_SAMPLES</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define AVERAGE_SAMPLES&#160;&#160;&#160;8</td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="measure_8c_source.html#l00014">14</a> of file <a class="el" href="measure_8c_source.html">measure.c</a>.</p>
</div>
</div>
<a id="a501e37e951966e98511c9c1eb0c7d397" name="a501e37e951966e98511c9c1eb0c7d397"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a501e37e951966e98511c9c1eb0c7d397">&#9670;&#160;</a></span>CURRENT_CHANNEL</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define CURRENT_CHANNEL&#160;&#160;&#160;0x6</td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="measure_8c_source.html#l00007">7</a> of file <a class="el" href="measure_8c_source.html">measure.c</a>.</p>
</div>
</div>
<a id="a8c8f27b35dfa40ccf31c1ee31479a31c" name="a8c8f27b35dfa40ccf31c1ee31479a31c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8c8f27b35dfa40ccf31c1ee31479a31c">&#9670;&#160;</a></span>GAIN</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define GAIN&#160;&#160;&#160;66</td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="measure_8c_source.html#l00010">10</a> of file <a class="el" href="measure_8c_source.html">measure.c</a>.</p>
</div>
</div>
<a id="a061cddbb720e9fd818a11a141e890f47" name="a061cddbb720e9fd818a11a141e890f47"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a061cddbb720e9fd818a11a141e890f47">&#9670;&#160;</a></span>RESISTOR</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define RESISTOR&#160;&#160;&#160;3</td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="measure_8c_source.html#l00011">11</a> of file <a class="el" href="measure_8c_source.html">measure.c</a>.</p>
</div>
</div>
<a id="a3ad11a109af35fa8de5e0b1b3e60142b" name="a3ad11a109af35fa8de5e0b1b3e60142b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3ad11a109af35fa8de5e0b1b3e60142b">&#9670;&#160;</a></span>VOLTAGE_CHANNEL</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define VOLTAGE_CHANNEL&#160;&#160;&#160;0x5</td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="measure_8c_source.html#l00006">6</a> of file <a class="el" href="measure_8c_source.html">measure.c</a>.</p>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a2b815e6730e8723a6d1d06d9ef8f31c0" name="a2b815e6730e8723a6d1d06d9ef8f31c0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2b815e6730e8723a6d1d06d9ef8f31c0">&#9670;&#160;</a></span>adc_init()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void adc_init </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Initialize ADC and pins for measuring current and voltage </p>
<p class="definition">Definition at line <a class="el" href="measure_8c_source.html#l00016">16</a> of file <a class="el" href="measure_8c_source.html">measure.c</a>.</p>
</div>
</div>
<a id="ad77a3b79bc20b11c0d5462cc0b7134b3" name="ad77a3b79bc20b11c0d5462cc0b7134b3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad77a3b79bc20b11c0d5462cc0b7134b3">&#9670;&#160;</a></span>measure_current()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint16_t measure_current </td>
<td>(</td>
<td class="paramtype">uint16_t&#160;</td>
<td class="paramname"><em>offset</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Measure the current on the solar panel. This function is expected to do some filtering</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">offset</td><td>: the offset as measured by measure_current_offset </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the current in microamperes </dd></dl>
<p class="definition">Definition at line <a class="el" href="measure_8c_source.html#l00049">49</a> of file <a class="el" href="measure_8c_source.html">measure.c</a>.</p>
</div>
</div>
<a id="a104c0f284978c4cc8d34d36677a97e72" name="a104c0f284978c4cc8d34d36677a97e72"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a104c0f284978c4cc8d34d36677a97e72">&#9670;&#160;</a></span>measure_voltage()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint16_t measure_voltage </td>
<td>(</td>
<td class="paramtype">void&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Measure the voltage on the channel for the current. This function is expected to do some filtering.</p>
<dl class="section return"><dt>Returns</dt><dd>The offset </dd></dl>
<p class="definition">Definition at line <a class="el" href="measure_8c_source.html#l00037">37</a> of file <a class="el" href="measure_8c_source.html">measure.c</a>.</p>
</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="measure_8c.html">measure.c</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>
</body>
</html>