-
Notifications
You must be signed in to change notification settings - Fork 0
/
_logic_8cpp_source.html
149 lines (147 loc) · 57.5 KB
/
_logic_8cpp_source.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!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>Plant Watering Sensor: src/Logic.cpp Source File</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="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 style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Plant Watering Sensor
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_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('_logic_8cpp_source.html','');});
</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">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Logic.cpp</div> </div>
</div><!--header-->
<div class="contents">
<a href="_logic_8cpp.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">// Plant Watering Sensor Project</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">// ---------------------------------------------------------------------------</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">// (c)2017 by Lucky Resistor. See LICENSE for details.</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">// https://luckyresistor.me</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">//</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment">// This program is free software; you can redistribute it and/or modify</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment">// it under the terms of the GNU General Public License as published by</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment">// the Free Software Foundation; either version 2 of the License, or</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">// (at your option) any later version.</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">//</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">// This program is distributed in the hope that it will be useful,</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">// GNU General Public License for more details.</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment">//</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment">// You should have received a copy of the GNU General Public License along</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment">// with this program; if not, write to the Free Software Foundation, Inc.,</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment">// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.</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="preprocessor">#include "<a class="code" href="_logic_8h.html">Logic.h</a>"</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> </div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> </div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#include "<a class="code" href="_configuration_8h.html">Configuration.h</a>"</span></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#include "<a class="code" href="_display_8h.html">Display.h</a>"</span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#include "<a class="code" href="_hardware_8h.html">Hardware.h</a>"</span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="preprocessor">#include "<a class="code" href="_logger_8h.html">Logger.h</a>"</span></div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#include "<a class="code" href="_settings_8h.html">Settings.h</a>"</span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="preprocessor">#include "<a class="code" href="_tool_8h.html">Tool.h</a>"</span></div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> </div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="preprocessor">#include <avr/cpufunc.h></span></div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="preprocessor">#include <avr/interrupt.h></span></div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="preprocessor">#include <avr/pgmspace.h></span></div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="preprocessor">#include <avr/sleep.h></span></div><div class="line"><a name="l00035"></a><span class="lineno"> 35</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"> 37</span> <span class="comment">// This global volatile values exist in global namespace to simplify debugging</span></div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> </div><div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="_logic_8cpp.html#a6d4cb5c6b4efebaf0255c1cc0aa00615"> 41</a></span> <span class="keyword">volatile</span> uint16_t <a class="code" href="_logic_8cpp.html#a6d4cb5c6b4efebaf0255c1cc0aa00615">currentVoltage</a> = 0;</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span> </div><div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="_logic_8cpp.html#a53a4dab4ade4ba46aa0ff4aea05777f4"> 45</a></span> <span class="keyword">volatile</span> uint8_t <a class="code" href="_logic_8cpp.html#a53a4dab4ade4ba46aa0ff4aea05777f4">currentOscillatorFrequency</a> = 0;</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span> </div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span> </div><div class="line"><a name="l00048"></a><span class="lineno"><a class="line" href="namespace_logic.html"> 48</a></span> <span class="keyword">namespace </span><a class="code" href="namespace_logic.html">Logic</a> {</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span> </div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span> </div><div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="namespace_logic.html#a75a7f23fd444fbc4362bdcdb7c592db9"> 53</a></span> <span class="keyword">const</span> <span class="keywordtype">char</span> cFirmwareSignature[] <a class="code" href="namespace_logic.html#a75a7f23fd444fbc4362bdcdb7c592db9">PROGMEM</a> = <span class="stringliteral">"FW"</span> <a class="code" href="_configuration_8h.html#a064e561242ccd1db0dd9b4a1792f95de">LR_FIRMWARE_VERSION</a> <span class="stringliteral">":LuckyResistor"</span>;</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> </div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span> </div><div class="line"><a name="l00058"></a><span class="lineno"><a class="line" href="namespace_logic.html#a60d5eb696e1c7b126bf69abb665bcda0"> 58</a></span> <span class="keyword">enum</span> <a class="code" href="namespace_logic.html#a60d5eb696e1c7b126bf69abb665bcda0">UserAction</a> : uint8_t {</div><div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="namespace_logic.html#a60d5eb696e1c7b126bf69abb665bcda0a095597b4573534346fb66eebf09622c6"> 59</a></span>  <a class="code" href="namespace_logic.html#a60d5eb696e1c7b126bf69abb665bcda0a095597b4573534346fb66eebf09622c6">UA_None</a>, </div><div class="line"><a name="l00060"></a><span class="lineno"><a class="line" href="namespace_logic.html#a60d5eb696e1c7b126bf69abb665bcda0a1f9f63555d244e63a7dd521bfa979f37"> 60</a></span>  <a class="code" href="namespace_logic.html#a60d5eb696e1c7b126bf69abb665bcda0a1f9f63555d244e63a7dd521bfa979f37">UA_NewSetPoint</a>, </div><div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="namespace_logic.html#a60d5eb696e1c7b126bf69abb665bcda0a5ff271f7393530eb2384274ce26634ff"> 61</a></span>  <a class="code" href="namespace_logic.html#a60d5eb696e1c7b126bf69abb665bcda0a5ff271f7393530eb2384274ce26634ff">UA_DisableFlash</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> </div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> </div><div class="line"><a name="l00069"></a><span class="lineno"><a class="line" href="namespace_logic.html#ad892031f473e8f9f3f27f70bba576d87"> 69</a></span> <a class="code" href="namespace_logic.html#a60d5eb696e1c7b126bf69abb665bcda0">UserAction</a> <a class="code" href="namespace_logic.html#ad892031f473e8f9f3f27f70bba576d87">getUserAction</a>()</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span> {</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  <span class="comment">// Pulse green for ~3 seconds while the button is pressed.</span></div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  <span class="keywordflow">for</span> (uint8_t i = 0; i < <a class="code" href="namespace_configuration.html#a6a78b990c56b9029f095711e22572e4c">Configuration::cLogicPulsesForUserAction</a>; ++i) {</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  <a class="code" href="namespace_display.html#a16173933e3fed9fd3de4c25c82ee9074">Display::pulse</a>(<a class="code" href="namespace_display.html#ae90342f85dd0312c91e6c79041f8a577a04e133a795e123a442574bff653f88b6">Display::Green</a>);</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <span class="keywordflow">if</span> (!<a class="code" href="namespace_hardware.html#ac3cdea93de8ebd6a0216dbfc35ce2ee6">Hardware::isButtonPressed</a>()) {</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="comment">// Abort if the button is released in this state.</span></div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="keywordflow">return</span> <a class="code" href="namespace_logic.html#a60d5eb696e1c7b126bf69abb665bcda0a095597b4573534346fb66eebf09622c6">UA_None</a>;</div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  }</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  }</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="comment">// After green, pulse for ~3 seconds in red.</span></div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  <span class="keywordflow">for</span> (uint8_t i = 0; i < <a class="code" href="namespace_configuration.html#a6a78b990c56b9029f095711e22572e4c">Configuration::cLogicPulsesForUserAction</a>; ++i) {</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  <a class="code" href="namespace_display.html#a16173933e3fed9fd3de4c25c82ee9074">Display::pulse</a>(<a class="code" href="namespace_display.html#ae90342f85dd0312c91e6c79041f8a577a136f1deeb1377e23c957f3cba7448854">Display::Red</a>);</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="keywordflow">if</span> (!<a class="code" href="namespace_hardware.html#ac3cdea93de8ebd6a0216dbfc35ce2ee6">Hardware::isButtonPressed</a>()) {</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <span class="comment">// A new set point shall be selected.</span></div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  <a class="code" href="namespace_display.html#a9bafff031c379fdca400266542ff9090">Display::flash</a>(<a class="code" href="namespace_display.html#ae90342f85dd0312c91e6c79041f8a577a04e133a795e123a442574bff653f88b6">Display::Green</a>, 3);</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <span class="keywordflow">return</span> <a class="code" href="namespace_logic.html#a60d5eb696e1c7b126bf69abb665bcda0a1f9f63555d244e63a7dd521bfa979f37">UA_NewSetPoint</a>;</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  }</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  }</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="comment">// The flash should be disabled until a new set-point is written.</span></div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  <a class="code" href="namespace_display.html#a9bafff031c379fdca400266542ff9090">Display::flash</a>(<a class="code" href="namespace_display.html#ae90342f85dd0312c91e6c79041f8a577a136f1deeb1377e23c957f3cba7448854">Display::Red</a>, 3);</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  <span class="keywordflow">return</span> <a class="code" href="namespace_logic.html#a60d5eb696e1c7b126bf69abb665bcda0a5ff271f7393530eb2384274ce26634ff">UA_DisableFlash</a>;</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span> }</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span> </div><div class="line"><a name="l00097"></a><span class="lineno"><a class="line" href="namespace_logic.html#a0661d1556f3ce4188ed7b261bfb1779e"> 97</a></span> <span class="keywordtype">void</span> <a class="code" href="namespace_logic.html#a0661d1556f3ce4188ed7b261bfb1779e">configurationMode</a>()</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>  <span class="comment">// Check the requested user action.</span></div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  <span class="keyword">const</span> <a class="code" href="namespace_logic.html#a60d5eb696e1c7b126bf69abb665bcda0">UserAction</a> userAction = <a class="code" href="namespace_logic.html#ad892031f473e8f9f3f27f70bba576d87">getUserAction</a>();</div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  <span class="keywordflow">if</span> (userAction == <a class="code" href="namespace_logic.html#a60d5eb696e1c7b126bf69abb665bcda0a1f9f63555d244e63a7dd521bfa979f37">UA_NewSetPoint</a>) {</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  <span class="comment">// Write the current oscillator frequency as new set-point to the settings.</span></div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  <a class="code" href="namespace_settings.html#a96147af823e9489d87f95e636b1324e1">Settings::setSetPointFrequency</a>(<a class="code" href="_logic_8cpp.html#a53a4dab4ade4ba46aa0ff4aea05777f4">currentOscillatorFrequency</a>+<a class="code" href="namespace_configuration.html#a42ebb5740c91dcdb2a4e94b1d0e1b7a0">Configuration::cSetPointCompensation</a>);</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  <a class="code" href="namespace_settings.html#a99ce176e86cfab03e4f783670ccd1b84">Settings::write</a>();</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (userAction == <a class="code" href="namespace_logic.html#a60d5eb696e1c7b126bf69abb665bcda0a5ff271f7393530eb2384274ce26634ff">UA_DisableFlash</a>) {</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <a class="code" href="namespace_settings.html#a96147af823e9489d87f95e636b1324e1">Settings::setSetPointFrequency</a>(<a class="code" href="namespace_configuration.html#a2dad644fa10548ed4a2ad556c57ac73a">Configuration::cDisabledSetPointFrequency</a>);</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  <a class="code" href="namespace_settings.html#a99ce176e86cfab03e4f783670ccd1b84">Settings::write</a>();</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  }</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <span class="comment">// Just ignore the action otherwise.</span></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> </div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span> </div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span> [[noreturn]]</div><div class="line"><a name="l00118"></a><span class="lineno"><a class="line" href="namespace_logic.html#a186b85b61134b0357b9050054f09d349"> 118</a></span> <span class="keywordtype">void</span> <a class="code" href="namespace_logic.html#a186b85b61134b0357b9050054f09d349">testMode</a>()</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span> {</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  <span class="keywordflow">while</span> (1) { </div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  <span class="keywordflow">for</span> (uint8_t i = 0; i < 4; i++) {</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  <a class="code" href="namespace_display.html#ae407713ef5a2c380a2643cdc0c2b35cd">Display::dimSignal</a>(<a class="code" href="namespace_display.html#ae90342f85dd0312c91e6c79041f8a577a136f1deeb1377e23c957f3cba7448854">Display::Red</a>);</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <a class="code" href="namespace_display.html#ae407713ef5a2c380a2643cdc0c2b35cd">Display::dimSignal</a>(<a class="code" href="namespace_display.html#ae90342f85dd0312c91e6c79041f8a577a04e133a795e123a442574bff653f88b6">Display::Green</a>);</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  }</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  <span class="keywordflow">for</span> (uint8_t i = 0; i < 100; ++i) {</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <a class="code" href="_logic_8cpp.html#a53a4dab4ade4ba46aa0ff4aea05777f4">currentOscillatorFrequency</a> = <a class="code" href="namespace_hardware.html#af22843e53b124a161486dedb9799a40e">Hardware::getOscillatorFrequency</a>();</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="keywordflow">if</span> (<a class="code" href="_logic_8cpp.html#a53a4dab4ade4ba46aa0ff4aea05777f4">currentOscillatorFrequency</a> > <a class="code" href="namespace_configuration.html#a00ab8d52f3716e5d5b9f8bbbe2ad32ad">Configuration::cTestHighOscillator</a>) {</div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <a class="code" href="namespace_display.html#ae407713ef5a2c380a2643cdc0c2b35cd">Display::dimSignal</a>(<a class="code" href="namespace_display.html#ae90342f85dd0312c91e6c79041f8a577a04e133a795e123a442574bff653f88b6">Display::Green</a>);</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="_logic_8cpp.html#a53a4dab4ade4ba46aa0ff4aea05777f4">currentOscillatorFrequency</a> < <a class="code" href="namespace_configuration.html#a8fcdf399b8f117e31509298e835f248a">Configuration::cTestLowOscillator</a>) {</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  <a class="code" href="namespace_display.html#ae407713ef5a2c380a2643cdc0c2b35cd">Display::dimSignal</a>(<a class="code" href="namespace_display.html#ae90342f85dd0312c91e6c79041f8a577a136f1deeb1377e23c957f3cba7448854">Display::Red</a>);</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  <a class="code" href="namespace_tool.html#a403edfe54b1b8a2cddae03feac5715aa">Tool::delayMs</a>(100);</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>  }</div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  }</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> </div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span> </div><div class="line"><a name="l00139"></a><span class="lineno"><a class="line" href="namespace_logic.html#a414bdba753d4d17cb9d999eacfbf2142"> 139</a></span> <span class="keywordtype">void</span> <a class="code" href="namespace_logic.html#a414bdba753d4d17cb9d999eacfbf2142">main</a>()</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span> {</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  <span class="comment">// Setup everything.</span></div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  <a class="code" href="namespace_hardware.html#a1911f7db5cd655f8537610e261cad1a8">Hardware::setup</a>();</div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  </div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  <span class="comment">// Test loop (disabled in production)</span></div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  <span class="keywordflow">do</span> { </div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  <span class="comment">// Time elapsed since at this point, after power level on MCU reached 2V:</span></div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  <span class="comment">// BOD off SUT = 0b10: ~60ms</span></div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  <span class="comment">// BOD on (1.8V) SUT = 0b00: ~4ms</span></div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  </div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  <span class="comment">// Oscillator is working after 1ms, no delay required.</span></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>  <span class="comment">// Step 1: Check the battery level</span></div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  <a class="code" href="_logic_8cpp.html#a6d4cb5c6b4efebaf0255c1cc0aa00615">currentVoltage</a> = <a class="code" href="namespace_hardware.html#a03469c3c4aa1b9abfe64e1a148c0801c">Hardware::getVoltageValue</a>();</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  <span class="keywordflow">if</span> (<a class="code" href="_logic_8cpp.html#a6d4cb5c6b4efebaf0255c1cc0aa00615">currentVoltage</a> < <a class="code" href="namespace_configuration.html#aef23da168dec47bc03bc136d899c2bf4">Configuration::cMinimumVoltageValue</a>) {</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  <span class="comment">// Signal low battery using two short flashes.</span></div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  <a class="code" href="namespace_display.html#a9bafff031c379fdca400266542ff9090">Display::flash</a>(<a class="code" href="namespace_display.html#ae90342f85dd0312c91e6c79041f8a577a136f1deeb1377e23c957f3cba7448854">Display::Red</a>, 2);</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  <span class="comment">// Wait until the button is released</span></div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  <span class="keywordflow">while</span> (<a class="code" href="namespace_hardware.html#ac3cdea93de8ebd6a0216dbfc35ce2ee6">Hardware::isButtonPressed</a>()) {}</div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  <span class="keywordflow">goto</span> lDone;</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="namespace_configuration.html#a43dbb9b69ec9a6a0209e8a098a21cd65">Configuration::cTestModeEnabled</a> && <a class="code" href="_logic_8cpp.html#a6d4cb5c6b4efebaf0255c1cc0aa00615">currentVoltage</a> > <a class="code" href="namespace_configuration.html#ac441b1a2997f4ce8efe37e770f7bf6f0">Configuration::cTestVoltageValue</a>) {</div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  <a class="code" href="namespace_logic.html#a186b85b61134b0357b9050054f09d349">testMode</a>();</div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  }</div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  <span class="keywordflow">if</span> (<a class="code" href="namespace_configuration.html#a7bf5b2db20f207c607f540c10a7163d0">Configuration::cPowerSave</a>) {</div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span>  <a class="code" href="namespace_hardware.html#a8d4a4cffef848027149e4326604fdafa">Hardware::shutdownVoltageMeasurement</a>();</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>  </div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span>  <span class="comment">// Step 2: Measure the current frequency of the oscillator.</span></div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  <a class="code" href="_logic_8cpp.html#a53a4dab4ade4ba46aa0ff4aea05777f4">currentOscillatorFrequency</a> = <a class="code" href="namespace_hardware.html#af22843e53b124a161486dedb9799a40e">Hardware::getOscillatorFrequency</a>();</div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span>  <span class="keywordflow">if</span> (<a class="code" href="namespace_configuration.html#a7bf5b2db20f207c607f540c10a7163d0">Configuration::cPowerSave</a>) {</div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span>  <a class="code" href="namespace_hardware.html#ae7b93d93d3a7c1fdde56d43d16162b61">Hardware::shutdownOscillatorCounter</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>  </div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  <span class="comment">// Step 3: Read the reference frequency from the EEPROM.</span></div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  <a class="code" href="namespace_settings.html#ac0f3ec889ab03b807e937580704a3ee9">Settings::read</a>();</div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  <span class="keyword">const</span> uint8_t setpointOscillatorFrequency = <a class="code" href="namespace_settings.html#ac6abd5b438e4b4e3f072c8d261794f64">Settings::getSetPointFrequency</a>();</div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span> </div><div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  <span class="comment">// Step 4: Check if the button is pressed.</span></div><div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  <span class="keywordflow">if</span> (<a class="code" href="namespace_configuration.html#a42fafe59219c7dfa0a012b5655498bcd">Configuration::cConfigurationModeEnabled</a> && <a class="code" href="namespace_hardware.html#ac3cdea93de8ebd6a0216dbfc35ce2ee6">Hardware::isButtonPressed</a>()) {</div><div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  <span class="comment">// Go to the configuration mode.</span></div><div class="line"><a name="l00180"></a><span class="lineno"> 180</span>  <a class="code" href="namespace_logic.html#a0661d1556f3ce4188ed7b261bfb1779e">configurationMode</a>();</div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span>  } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span>  <span class="comment">// Just check the status and give a signal if we are below set-point.</span></div><div class="line"><a name="l00183"></a><span class="lineno"> 183</span>  <span class="keywordflow">if</span> (<a class="code" href="_logic_8cpp.html#a53a4dab4ade4ba46aa0ff4aea05777f4">currentOscillatorFrequency</a> >= setpointOscillatorFrequency) {</div><div class="line"><a name="l00184"></a><span class="lineno"> 184</span>  <span class="comment">// Send a single flash signal.</span></div><div class="line"><a name="l00185"></a><span class="lineno"> 185</span>  <a class="code" href="namespace_display.html#a9bafff031c379fdca400266542ff9090">Display::flash</a>(<a class="code" href="namespace_display.html#ae90342f85dd0312c91e6c79041f8a577a04e133a795e123a442574bff653f88b6">Display::Green</a>, 1);</div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span>  }</div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span>  }</div><div class="line"><a name="l00188"></a><span class="lineno"> 188</span>  </div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span>  <span class="comment">// Wait 5s if the test loop is enabled.</span></div><div class="line"><a name="l00190"></a><span class="lineno"> 190</span>  <span class="keywordflow">if</span> (<a class="code" href="namespace_configuration.html#a7a7b056781375b07952b9fd0417c980e">Configuration::cTestLoopEnabled</a>) {</div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span>  <a class="code" href="namespace_tool.html#a403edfe54b1b8a2cddae03feac5715aa">Tool::delayMs</a>(2000);</div><div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  }</div><div class="line"><a name="l00193"></a><span class="lineno"> 193</span> </div><div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  <span class="keywordflow">if</span> (<a class="code" href="namespace_configuration.html#a40e76b37292c7825190b5dcbdcbc49a3">Configuration::cFirmwareSignatureEnabled</a>) {</div><div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  <span class="comment">// On "use" the firmware identifier to keep it in memory.</span></div><div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  pgm_read_byte(cFirmwareSignature);</div><div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  }</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="keywordflow">while</span> (<a class="code" href="namespace_configuration.html#a7a7b056781375b07952b9fd0417c980e">Configuration::cTestLoopEnabled</a>); </div><div class="line"><a name="l00200"></a><span class="lineno"> 200</span> </div><div class="line"><a name="l00201"></a><span class="lineno"> 201</span> lDone:</div><div class="line"><a name="l00202"></a><span class="lineno"> 202</span>  <span class="comment">// Log the current values if the logger is activated.</span></div><div class="line"><a name="l00203"></a><span class="lineno"> 203</span>  <span class="keywordflow">if</span> (<a class="code" href="namespace_configuration.html#a0fa539ea0cbc3afa0d0e5f00d6e12f37">Configuration::cLoggingEnabled</a>) {</div><div class="line"><a name="l00204"></a><span class="lineno"> 204</span>  <a class="code" href="namespace_logger.html#aac652d5cbadeee9faa2a208d7dd654d4">Logger::log</a>(<a class="code" href="_logic_8cpp.html#a53a4dab4ade4ba46aa0ff4aea05777f4">currentOscillatorFrequency</a>, <a class="code" href="_logic_8cpp.html#a6d4cb5c6b4efebaf0255c1cc0aa00615">currentVoltage</a>, <a class="code" href="namespace_hardware.html#ac3cdea93de8ebd6a0216dbfc35ce2ee6">Hardware::isButtonPressed</a>());</div><div class="line"><a name="l00205"></a><span class="lineno"> 205</span>  }</div><div class="line"><a name="l00206"></a><span class="lineno"> 206</span> </div><div class="line"><a name="l00207"></a><span class="lineno"> 207</span>  <span class="comment">// Send the done signal and repeat until the system timer turns off the power.</span></div><div class="line"><a name="l00208"></a><span class="lineno"> 208</span>  <span class="keywordflow">while</span> (1) {</div><div class="line"><a name="l00209"></a><span class="lineno"> 209</span>  <a class="code" href="namespace_hardware.html#a525ddf756e4b9f63b866907b2f9088fa">Hardware::sendDoneSignal</a>();</div><div class="line"><a name="l00210"></a><span class="lineno"> 210</span>  }</div><div class="line"><a name="l00211"></a><span class="lineno"> 211</span> }</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>  </div><div class="line"><a name="l00214"></a><span class="lineno"> 214</span> }</div><div class="ttc" id="_settings_8h_html"><div class="ttname"><a href="_settings_8h.html">Settings.h</a></div></div>
<div class="ttc" id="namespace_settings_html_ac6abd5b438e4b4e3f072c8d261794f64"><div class="ttname"><a href="namespace_settings.html#ac6abd5b438e4b4e3f072c8d261794f64">Settings::getSetPointFrequency</a></div><div class="ttdeci">uint8_t getSetPointFrequency()</div><div class="ttdoc">Read the set-point value. </div><div class="ttdef"><b>Definition:</b> <a href="_settings_8cpp_source.html#l00112">Settings.cpp:112</a></div></div>
<div class="ttc" id="namespace_logic_html"><div class="ttname"><a href="namespace_logic.html">Logic</a></div><div class="ttdoc">This module contains the logic of the firmware. </div><div class="ttdef"><b>Definition:</b> <a href="_logic_8cpp_source.html#l00048">Logic.cpp:48</a></div></div>
<div class="ttc" id="namespace_configuration_html_a7a7b056781375b07952b9fd0417c980e"><div class="ttname"><a href="namespace_configuration.html#a7a7b056781375b07952b9fd0417c980e">Configuration::cTestLoopEnabled</a></div><div class="ttdeci">const bool cTestLoopEnabled</div><div class="ttdoc">This flag enables the test loop, which never stops but runs the logic in a loop. </div><div class="ttdef"><b>Definition:</b> <a href="_configuration_8h_source.html#l00102">Configuration.h:102</a></div></div>
<div class="ttc" id="namespace_settings_html_ac0f3ec889ab03b807e937580704a3ee9"><div class="ttname"><a href="namespace_settings.html#ac0f3ec889ab03b807e937580704a3ee9">Settings::read</a></div><div class="ttdeci">void read()</div><div class="ttdoc">Read all settings into SRAM. </div><div class="ttdef"><b>Definition:</b> <a href="_settings_8cpp_source.html#l00085">Settings.cpp:85</a></div></div>
<div class="ttc" id="namespace_hardware_html_af22843e53b124a161486dedb9799a40e"><div class="ttname"><a href="namespace_hardware.html#af22843e53b124a161486dedb9799a40e">Hardware::getOscillatorFrequency</a></div><div class="ttdeci">uint8_t getOscillatorFrequency()</div><div class="ttdoc">Try to determine the frequency. </div><div class="ttdef"><b>Definition:</b> <a href="_hardware_8cpp_source.html#l00136">Hardware.cpp:136</a></div></div>
<div class="ttc" id="_logic_8cpp_html_a6d4cb5c6b4efebaf0255c1cc0aa00615"><div class="ttname"><a href="_logic_8cpp.html#a6d4cb5c6b4efebaf0255c1cc0aa00615">currentVoltage</a></div><div class="ttdeci">volatile uint16_t currentVoltage</div><div class="ttdoc">The current voltage value. </div><div class="ttdef"><b>Definition:</b> <a href="_logic_8cpp_source.html#l00041">Logic.cpp:41</a></div></div>
<div class="ttc" id="namespace_configuration_html_a43dbb9b69ec9a6a0209e8a098a21cd65"><div class="ttname"><a href="namespace_configuration.html#a43dbb9b69ec9a6a0209e8a098a21cd65">Configuration::cTestModeEnabled</a></div><div class="ttdeci">const bool cTestModeEnabled</div><div class="ttdoc">This flag enables the test mode which is activated with a 4V VCC voltage. </div><div class="ttdef"><b>Definition:</b> <a href="_configuration_8h_source.html#l00106">Configuration.h:106</a></div></div>
<div class="ttc" id="namespace_display_html_a9bafff031c379fdca400266542ff9090"><div class="ttname"><a href="namespace_display.html#a9bafff031c379fdca400266542ff9090">Display::flash</a></div><div class="ttdeci">void flash(Color color, uint8_t flashCount)</div><div class="ttdoc">Display a number of flashes. </div><div class="ttdef"><b>Definition:</b> <a href="_display_8cpp_source.html#l00031">Display.cpp:31</a></div></div>
<div class="ttc" id="namespace_display_html_a16173933e3fed9fd3de4c25c82ee9074"><div class="ttname"><a href="namespace_display.html#a16173933e3fed9fd3de4c25c82ee9074">Display::pulse</a></div><div class="ttdeci">void pulse(Color color)</div><div class="ttdoc">Smooth Pulse one time. </div><div class="ttdef"><b>Definition:</b> <a href="_display_8cpp_source.html#l00058">Display.cpp:58</a></div></div>
<div class="ttc" id="namespace_logic_html_a75a7f23fd444fbc4362bdcdb7c592db9"><div class="ttname"><a href="namespace_logic.html#a75a7f23fd444fbc4362bdcdb7c592db9">Logic::PROGMEM</a></div><div class="ttdeci">const char cFirmwareSignature [] PROGMEM</div><div class="ttdoc">A message for the release version written into the image. </div><div class="ttdef"><b>Definition:</b> <a href="_logic_8cpp_source.html#l00053">Logic.cpp:53</a></div></div>
<div class="ttc" id="namespace_configuration_html_a42fafe59219c7dfa0a012b5655498bcd"><div class="ttname"><a href="namespace_configuration.html#a42fafe59219c7dfa0a012b5655498bcd">Configuration::cConfigurationModeEnabled</a></div><div class="ttdeci">const bool cConfigurationModeEnabled</div><div class="ttdoc">This flag enables the configuration mode. </div><div class="ttdef"><b>Definition:</b> <a href="_configuration_8h_source.html#l00110">Configuration.h:110</a></div></div>
<div class="ttc" id="namespace_configuration_html_a0fa539ea0cbc3afa0d0e5f00d6e12f37"><div class="ttname"><a href="namespace_configuration.html#a0fa539ea0cbc3afa0d0e5f00d6e12f37">Configuration::cLoggingEnabled</a></div><div class="ttdeci">const bool cLoggingEnabled</div><div class="ttdoc">This flag enables logging of the last 10 values into SRAM. </div><div class="ttdef"><b>Definition:</b> <a href="_configuration_8h_source.html#l00114">Configuration.h:114</a></div></div>
<div class="ttc" id="namespace_logic_html_a60d5eb696e1c7b126bf69abb665bcda0"><div class="ttname"><a href="namespace_logic.html#a60d5eb696e1c7b126bf69abb665bcda0">Logic::UserAction</a></div><div class="ttdeci">UserAction</div><div class="ttdoc">The action the user would like to do. </div><div class="ttdef"><b>Definition:</b> <a href="_logic_8cpp_source.html#l00058">Logic.cpp:58</a></div></div>
<div class="ttc" id="namespace_hardware_html_a1911f7db5cd655f8537610e261cad1a8"><div class="ttname"><a href="namespace_hardware.html#a1911f7db5cd655f8537610e261cad1a8">Hardware::setup</a></div><div class="ttdeci">void setup()</div><div class="ttdoc">Setup the MCU hardware to the initial values. </div><div class="ttdef"><b>Definition:</b> <a href="_hardware_8cpp_source.html#l00035">Hardware.cpp:35</a></div></div>
<div class="ttc" id="namespace_hardware_html_a525ddf756e4b9f63b866907b2f9088fa"><div class="ttname"><a href="namespace_hardware.html#a525ddf756e4b9f63b866907b2f9088fa">Hardware::sendDoneSignal</a></div><div class="ttdeci">void sendDoneSignal()</div><div class="ttdoc">Send the done signal. </div><div class="ttdef"><b>Definition:</b> <a href="_hardware_8cpp_source.html#l00089">Hardware.cpp:89</a></div></div>
<div class="ttc" id="namespace_logic_html_ad892031f473e8f9f3f27f70bba576d87"><div class="ttname"><a href="namespace_logic.html#ad892031f473e8f9f3f27f70bba576d87">Logic::getUserAction</a></div><div class="ttdeci">UserAction getUserAction()</div><div class="ttdoc">Wait for the button release to get the selected user action. </div><div class="ttdef"><b>Definition:</b> <a href="_logic_8cpp_source.html#l00069">Logic.cpp:69</a></div></div>
<div class="ttc" id="namespace_configuration_html_aef23da168dec47bc03bc136d899c2bf4"><div class="ttname"><a href="namespace_configuration.html#aef23da168dec47bc03bc136d899c2bf4">Configuration::cMinimumVoltageValue</a></div><div class="ttdeci">const uint16_t cMinimumVoltageValue</div><div class="ttdoc">The minimum voltage value. </div><div class="ttdef"><b>Definition:</b> <a href="_configuration_8h_source.html#l00035">Configuration.h:35</a></div></div>
<div class="ttc" id="namespace_hardware_html_ac3cdea93de8ebd6a0216dbfc35ce2ee6"><div class="ttname"><a href="namespace_hardware.html#ac3cdea93de8ebd6a0216dbfc35ce2ee6">Hardware::isButtonPressed</a></div><div class="ttdeci">bool isButtonPressed()</div><div class="ttdoc">Get the status of the button. </div><div class="ttdef"><b>Definition:</b> <a href="_hardware_8cpp_source.html#l00099">Hardware.cpp:99</a></div></div>
<div class="ttc" id="_tool_8h_html"><div class="ttname"><a href="_tool_8h.html">Tool.h</a></div></div>
<div class="ttc" id="namespace_display_html_ae407713ef5a2c380a2643cdc0c2b35cd"><div class="ttname"><a href="namespace_display.html#ae407713ef5a2c380a2643cdc0c2b35cd">Display::dimSignal</a></div><div class="ttdeci">void dimSignal(Color color)</div><div class="ttdoc">Very short dim signal. </div><div class="ttdef"><b>Definition:</b> <a href="_display_8cpp_source.html#l00073">Display.cpp:73</a></div></div>
<div class="ttc" id="namespace_hardware_html_a8d4a4cffef848027149e4326604fdafa"><div class="ttname"><a href="namespace_hardware.html#a8d4a4cffef848027149e4326604fdafa">Hardware::shutdownVoltageMeasurement</a></div><div class="ttdeci">void shutdownVoltageMeasurement()</div><div class="ttdoc">Shutdown voltage measurement to save power. </div><div class="ttdef"><b>Definition:</b> <a href="_hardware_8cpp_source.html#l00128">Hardware.cpp:128</a></div></div>
<div class="ttc" id="namespace_logic_html_a60d5eb696e1c7b126bf69abb665bcda0a1f9f63555d244e63a7dd521bfa979f37"><div class="ttname"><a href="namespace_logic.html#a60d5eb696e1c7b126bf69abb665bcda0a1f9f63555d244e63a7dd521bfa979f37">Logic::UA_NewSetPoint</a></div><div class="ttdoc">Write a new set-point with the current value. </div><div class="ttdef"><b>Definition:</b> <a href="_logic_8cpp_source.html#l00060">Logic.cpp:60</a></div></div>
<div class="ttc" id="_logger_8h_html"><div class="ttname"><a href="_logger_8h.html">Logger.h</a></div></div>
<div class="ttc" id="namespace_display_html_ae90342f85dd0312c91e6c79041f8a577a136f1deeb1377e23c957f3cba7448854"><div class="ttname"><a href="namespace_display.html#ae90342f85dd0312c91e6c79041f8a577a136f1deeb1377e23c957f3cba7448854">Display::Red</a></div><div class="ttdoc">Display a red color. </div><div class="ttdef"><b>Definition:</b> <a href="_display_8h_source.html#l00035">Display.h:35</a></div></div>
<div class="ttc" id="namespace_configuration_html_a6a78b990c56b9029f095711e22572e4c"><div class="ttname"><a href="namespace_configuration.html#a6a78b990c56b9029f095711e22572e4c">Configuration::cLogicPulsesForUserAction</a></div><div class="ttdeci">const uint8_t cLogicPulsesForUserAction</div><div class="ttdoc">The number of pulses for the selection of the user action. </div><div class="ttdef"><b>Definition:</b> <a href="_configuration_8h_source.html#l00077">Configuration.h:77</a></div></div>
<div class="ttc" id="namespace_configuration_html_a42ebb5740c91dcdb2a4e94b1d0e1b7a0"><div class="ttname"><a href="namespace_configuration.html#a42ebb5740c91dcdb2a4e94b1d0e1b7a0">Configuration::cSetPointCompensation</a></div><div class="ttdeci">const uint8_t cSetPointCompensation</div><div class="ttdoc">Set-point compensation for human touch of the button. </div><div class="ttdef"><b>Definition:</b> <a href="_configuration_8h_source.html#l00089">Configuration.h:89</a></div></div>
<div class="ttc" id="_display_8h_html"><div class="ttname"><a href="_display_8h.html">Display.h</a></div></div>
<div class="ttc" id="namespace_configuration_html_a7bf5b2db20f207c607f540c10a7163d0"><div class="ttname"><a href="namespace_configuration.html#a7bf5b2db20f207c607f540c10a7163d0">Configuration::cPowerSave</a></div><div class="ttdeci">const bool cPowerSave</div><div class="ttdoc">This flag controls if the times, etc. </div><div class="ttdef"><b>Definition:</b> <a href="_configuration_8h_source.html#l00098">Configuration.h:98</a></div></div>
<div class="ttc" id="_hardware_8h_html"><div class="ttname"><a href="_hardware_8h.html">Hardware.h</a></div></div>
<div class="ttc" id="namespace_configuration_html_ac441b1a2997f4ce8efe37e770f7bf6f0"><div class="ttname"><a href="namespace_configuration.html#ac441b1a2997f4ce8efe37e770f7bf6f0">Configuration::cTestVoltageValue</a></div><div class="ttdeci">const uint16_t cTestVoltageValue</div><div class="ttdoc">The test voltage value. </div><div class="ttdef"><b>Definition:</b> <a href="_configuration_8h_source.html#l00041">Configuration.h:41</a></div></div>
<div class="ttc" id="namespace_display_html_ae90342f85dd0312c91e6c79041f8a577a04e133a795e123a442574bff653f88b6"><div class="ttname"><a href="namespace_display.html#ae90342f85dd0312c91e6c79041f8a577a04e133a795e123a442574bff653f88b6">Display::Green</a></div><div class="ttdoc">Display a green color. </div><div class="ttdef"><b>Definition:</b> <a href="_display_8h_source.html#l00036">Display.h:36</a></div></div>
<div class="ttc" id="namespace_hardware_html_a03469c3c4aa1b9abfe64e1a148c0801c"><div class="ttname"><a href="namespace_hardware.html#a03469c3c4aa1b9abfe64e1a148c0801c">Hardware::getVoltageValue</a></div><div class="ttdeci">uint16_t getVoltageValue()</div><div class="ttdoc">Read the current voltage value. </div><div class="ttdef"><b>Definition:</b> <a href="_hardware_8cpp_source.html#l00105">Hardware.cpp:105</a></div></div>
<div class="ttc" id="namespace_logic_html_a0661d1556f3ce4188ed7b261bfb1779e"><div class="ttname"><a href="namespace_logic.html#a0661d1556f3ce4188ed7b261bfb1779e">Logic::configurationMode</a></div><div class="ttdeci">void configurationMode()</div><div class="ttdoc">The configuration mode. </div><div class="ttdef"><b>Definition:</b> <a href="_logic_8cpp_source.html#l00097">Logic.cpp:97</a></div></div>
<div class="ttc" id="namespace_logic_html_a186b85b61134b0357b9050054f09d349"><div class="ttname"><a href="namespace_logic.html#a186b85b61134b0357b9050054f09d349">Logic::testMode</a></div><div class="ttdeci">void testMode()</div><div class="ttdoc">The test mode. </div><div class="ttdef"><b>Definition:</b> <a href="_logic_8cpp_source.html#l00118">Logic.cpp:118</a></div></div>
<div class="ttc" id="namespace_hardware_html_ae7b93d93d3a7c1fdde56d43d16162b61"><div class="ttname"><a href="namespace_hardware.html#ae7b93d93d3a7c1fdde56d43d16162b61">Hardware::shutdownOscillatorCounter</a></div><div class="ttdeci">void shutdownOscillatorCounter()</div><div class="ttdoc">Shutdown the counter to save power. </div><div class="ttdef"><b>Definition:</b> <a href="_hardware_8cpp_source.html#l00156">Hardware.cpp:156</a></div></div>
<div class="ttc" id="namespace_logic_html_a414bdba753d4d17cb9d999eacfbf2142"><div class="ttname"><a href="namespace_logic.html#a414bdba753d4d17cb9d999eacfbf2142">Logic::main</a></div><div class="ttdeci">void main()</div><div class="ttdoc">The main loop of the firmware. </div><div class="ttdef"><b>Definition:</b> <a href="_logic_8cpp_source.html#l00139">Logic.cpp:139</a></div></div>
<div class="ttc" id="namespace_configuration_html_a8fcdf399b8f117e31509298e835f248a"><div class="ttname"><a href="namespace_configuration.html#a8fcdf399b8f117e31509298e835f248a">Configuration::cTestLowOscillator</a></div><div class="ttdeci">const uint16_t cTestLowOscillator</div><div class="ttdoc">Test value for glass of water. </div><div class="ttdef"><b>Definition:</b> <a href="_configuration_8h_source.html#l00049">Configuration.h:49</a></div></div>
<div class="ttc" id="namespace_logic_html_a60d5eb696e1c7b126bf69abb665bcda0a5ff271f7393530eb2384274ce26634ff"><div class="ttname"><a href="namespace_logic.html#a60d5eb696e1c7b126bf69abb665bcda0a5ff271f7393530eb2384274ce26634ff">Logic::UA_DisableFlash</a></div><div class="ttdoc">Disable the annoying flashing until a new set-point is written. </div><div class="ttdef"><b>Definition:</b> <a href="_logic_8cpp_source.html#l00061">Logic.cpp:61</a></div></div>
<div class="ttc" id="_logic_8h_html"><div class="ttname"><a href="_logic_8h.html">Logic.h</a></div></div>
<div class="ttc" id="_logic_8cpp_html_a53a4dab4ade4ba46aa0ff4aea05777f4"><div class="ttname"><a href="_logic_8cpp.html#a53a4dab4ade4ba46aa0ff4aea05777f4">currentOscillatorFrequency</a></div><div class="ttdeci">volatile uint8_t currentOscillatorFrequency</div><div class="ttdoc">The current oscillator frequency. </div><div class="ttdef"><b>Definition:</b> <a href="_logic_8cpp_source.html#l00045">Logic.cpp:45</a></div></div>
<div class="ttc" id="_configuration_8h_html_a064e561242ccd1db0dd9b4a1792f95de"><div class="ttname"><a href="_configuration_8h.html#a064e561242ccd1db0dd9b4a1792f95de">LR_FIRMWARE_VERSION</a></div><div class="ttdeci">#define LR_FIRMWARE_VERSION</div><div class="ttdoc">The firmware version. </div><div class="ttdef"><b>Definition:</b> <a href="_configuration_8h_source.html#l00126">Configuration.h:126</a></div></div>
<div class="ttc" id="namespace_configuration_html_a00ab8d52f3716e5d5b9f8bbbe2ad32ad"><div class="ttname"><a href="namespace_configuration.html#a00ab8d52f3716e5d5b9f8bbbe2ad32ad">Configuration::cTestHighOscillator</a></div><div class="ttdeci">const uint16_t cTestHighOscillator</div><div class="ttdoc">Test value for air. </div><div class="ttdef"><b>Definition:</b> <a href="_configuration_8h_source.html#l00045">Configuration.h:45</a></div></div>
<div class="ttc" id="namespace_configuration_html_a40e76b37292c7825190b5dcbdcbc49a3"><div class="ttname"><a href="namespace_configuration.html#a40e76b37292c7825190b5dcbdcbc49a3">Configuration::cFirmwareSignatureEnabled</a></div><div class="ttdeci">const bool cFirmwareSignatureEnabled</div><div class="ttdoc">This flag enables the firmware signature text. </div><div class="ttdef"><b>Definition:</b> <a href="_configuration_8h_source.html#l00119">Configuration.h:119</a></div></div>
<div class="ttc" id="namespace_logger_html_aac652d5cbadeee9faa2a208d7dd654d4"><div class="ttname"><a href="namespace_logger.html#aac652d5cbadeee9faa2a208d7dd654d4">Logger::log</a></div><div class="ttdeci">void log(uint8_t oscillatorFrequency, uint16_t voltageValue, bool isButtonPressed)</div><div class="ttdoc">Log one entry into EEPROM. </div></div>
<div class="ttc" id="namespace_configuration_html_a2dad644fa10548ed4a2ad556c57ac73a"><div class="ttname"><a href="namespace_configuration.html#a2dad644fa10548ed4a2ad556c57ac73a">Configuration::cDisabledSetPointFrequency</a></div><div class="ttdeci">const uint8_t cDisabledSetPointFrequency</div><div class="ttdoc">The set-point value if the user disabled it. </div><div class="ttdef"><b>Definition:</b> <a href="_configuration_8h_source.html#l00085">Configuration.h:85</a></div></div>
<div class="ttc" id="namespace_settings_html_a99ce176e86cfab03e4f783670ccd1b84"><div class="ttname"><a href="namespace_settings.html#a99ce176e86cfab03e4f783670ccd1b84">Settings::write</a></div><div class="ttdeci">void write()</div><div class="ttdoc">Write all settings back to EEPROM. </div><div class="ttdef"><b>Definition:</b> <a href="_settings_8cpp_source.html#l00103">Settings.cpp:103</a></div></div>
<div class="ttc" id="namespace_settings_html_a96147af823e9489d87f95e636b1324e1"><div class="ttname"><a href="namespace_settings.html#a96147af823e9489d87f95e636b1324e1">Settings::setSetPointFrequency</a></div><div class="ttdeci">void setSetPointFrequency(uint8_t frequency)</div><div class="ttdoc">Write a new set-point value. </div><div class="ttdef"><b>Definition:</b> <a href="_settings_8cpp_source.html#l00118">Settings.cpp:118</a></div></div>
<div class="ttc" id="_configuration_8h_html"><div class="ttname"><a href="_configuration_8h.html">Configuration.h</a></div></div>
<div class="ttc" id="namespace_logic_html_a60d5eb696e1c7b126bf69abb665bcda0a095597b4573534346fb66eebf09622c6"><div class="ttname"><a href="namespace_logic.html#a60d5eb696e1c7b126bf69abb665bcda0a095597b4573534346fb66eebf09622c6">Logic::UA_None</a></div><div class="ttdoc">No action, the user accidentally pressed the button. </div><div class="ttdef"><b>Definition:</b> <a href="_logic_8cpp_source.html#l00059">Logic.cpp:59</a></div></div>
<div class="ttc" id="namespace_tool_html_a403edfe54b1b8a2cddae03feac5715aa"><div class="ttname"><a href="namespace_tool.html#a403edfe54b1b8a2cddae03feac5715aa">Tool::delayMs</a></div><div class="ttdeci">void delayMs(uint16_t delay)</div><div class="ttdoc">Wait approximate the given number of milliseconds. </div><div class="ttdef"><b>Definition:</b> <a href="_tool_8cpp_source.html#l00031">Tool.cpp:31</a></div></div>
</div><!-- fragment --></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_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="_logic_8cpp.html">Logic.cpp</a></li>
<li class="footer">Generated 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>