summaryrefslogtreecommitdiffstats
path: root/group__led.html
blob: f21e92c1a0e5d45a1ad6f24e7ee391c54868bc6b (plain)
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
<!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">
<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.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Sensor Watch: LED Control</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="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">Sensor Watch
   &#160;<span id="projectnumber">0.0.0</span>
   </div>
   <div id="projectbrief">A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'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:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- 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="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">LED Control</div>  </div>
</div><!--header-->
<div class="contents">

<p>This section covers functions related to the bi-color red/green LED mounted behind the LCD.  
<a href="#details">More...</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:ga86ce31dc95137ed41983fb7c6af5502a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__led.html#ga86ce31dc95137ed41983fb7c6af5502a">watch_enable_leds</a> (void)</td></tr>
<tr class="memdesc:ga86ce31dc95137ed41983fb7c6af5502a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enables the bi-color LED.  <a href="group__led.html#ga86ce31dc95137ed41983fb7c6af5502a">More...</a><br /></td></tr>
<tr class="separator:ga86ce31dc95137ed41983fb7c6af5502a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga883bf171196fb5a7a57ef727dca6e04a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__led.html#ga883bf171196fb5a7a57ef727dca6e04a">watch_disable_leds</a> (void)</td></tr>
<tr class="memdesc:ga883bf171196fb5a7a57ef727dca6e04a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disables the LEDs.  <a href="group__led.html#ga883bf171196fb5a7a57ef727dca6e04a">More...</a><br /></td></tr>
<tr class="separator:ga883bf171196fb5a7a57ef727dca6e04a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga042bcc9220ab05d1de8389cf0067511b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__led.html#ga042bcc9220ab05d1de8389cf0067511b">watch_set_led_color</a> (uint8_t red, uint8_t green)</td></tr>
<tr class="memdesc:ga042bcc9220ab05d1de8389cf0067511b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the LED to a custom color by modulating each output's duty cycle.  <a href="group__led.html#ga042bcc9220ab05d1de8389cf0067511b">More...</a><br /></td></tr>
<tr class="separator:ga042bcc9220ab05d1de8389cf0067511b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga36d89031d8e8813dfab5f6cff9c6ee40"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__led.html#ga36d89031d8e8813dfab5f6cff9c6ee40">watch_set_led_red</a> (void)</td></tr>
<tr class="memdesc:ga36d89031d8e8813dfab5f6cff9c6ee40"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the red LED to full brightness, and turns the green LED off.  <a href="group__led.html#ga36d89031d8e8813dfab5f6cff9c6ee40">More...</a><br /></td></tr>
<tr class="separator:ga36d89031d8e8813dfab5f6cff9c6ee40"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab01a29900ddc5315c0e752e63d748f41"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__led.html#gab01a29900ddc5315c0e752e63d748f41">watch_set_led_green</a> (void)</td></tr>
<tr class="memdesc:gab01a29900ddc5315c0e752e63d748f41"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the green LED to full brightness, and turns the red LED off.  <a href="group__led.html#gab01a29900ddc5315c0e752e63d748f41">More...</a><br /></td></tr>
<tr class="separator:gab01a29900ddc5315c0e752e63d748f41"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga51ba53c3281ad8724d98af27eacc3de0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__led.html#ga51ba53c3281ad8724d98af27eacc3de0">watch_set_led_yellow</a> (void)</td></tr>
<tr class="memdesc:ga51ba53c3281ad8724d98af27eacc3de0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets both red and green LEDs to full brightness.  <a href="group__led.html#ga51ba53c3281ad8724d98af27eacc3de0">More...</a><br /></td></tr>
<tr class="separator:ga51ba53c3281ad8724d98af27eacc3de0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8619f040ff7364285398412a4c420cae"><td class="memItemLeft" align="right" valign="top"><a id="ga8619f040ff7364285398412a4c420cae"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__led.html#ga8619f040ff7364285398412a4c420cae">watch_set_led_off</a> (void)</td></tr>
<tr class="memdesc:ga8619f040ff7364285398412a4c420cae"><td class="mdescLeft">&#160;</td><td class="mdescRight">Turns both the red and the green LEDs off. <br /></td></tr>
<tr class="separator:ga8619f040ff7364285398412a4c420cae"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga510b8e59dc64c9880c3eda27270722d8"><td class="memItemLeft" align="right" valign="top"><a id="ga510b8e59dc64c9880c3eda27270722d8"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>__attribute__</b> ((deprecated(&quot;Use <a class="el" href="group__led.html#ga86ce31dc95137ed41983fb7c6af5502a">watch_enable_leds</a> instead&quot;))) void watch_enable_led(bool unused)</td></tr>
<tr class="separator:ga510b8e59dc64c9880c3eda27270722d8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaca8285070363eed34dbb31c470d9d5bb"><td class="memItemLeft" align="right" valign="top"><a id="gaca8285070363eed34dbb31c470d9d5bb"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>__attribute__</b> ((deprecated(&quot;Use <a class="el" href="group__led.html#ga883bf171196fb5a7a57ef727dca6e04a">watch_disable_leds</a> instead&quot;))) void watch_disable_led(bool unused)</td></tr>
<tr class="separator:gaca8285070363eed34dbb31c470d9d5bb"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>This section covers functions related to the bi-color red/green LED mounted behind the LCD. </p>
<p>The SAM L22 is an exceedingly power efficient chip, whereas the LED's are relatively power- hungry. The green LED, at full power, consumes more power than the whole chip in active mode, and the red LED consumes about twelve times as much power! The LED's should thus be used only sparingly in order to preserve battery life. </p><dl class="section note"><dt>Note</dt><dd>Some watches use a red/blue LED instead of a red/green LED. You will be able to determine this easily when you double tap the reset button: if the pulsing bootloader LED is red, you have a red/green edition; if it is blue, you have a red/blue edition. For red/blue watches, build your project with the command <code>make LED=BLUE</code>, and the watch library will automatically swap the pins so that watch_set_led_red sets the red LED, and watch_set_led_green sets the blue one. </dd></dl>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga883bf171196fb5a7a57ef727dca6e04a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga883bf171196fb5a7a57ef727dca6e04a">&#9670;&nbsp;</a></span>watch_disable_leds()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void watch_disable_leds </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Disables the LEDs. </p>
<dl class="section note"><dt>Note</dt><dd>This method will also disable the buzzer, since the buzzer and LED both make use of the same peripheral to drive their PWM behavior. </dd></dl>

</div>
</div>
<a id="ga86ce31dc95137ed41983fb7c6af5502a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga86ce31dc95137ed41983fb7c6af5502a">&#9670;&nbsp;</a></span>watch_enable_leds()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void watch_enable_leds </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Enables the bi-color LED. </p>
<dl class="section note"><dt>Note</dt><dd>The TCC peripheral that drives the LEDs does not run in STANDBY mode — but the outputs do! This means that if you set either red, green or both LEDs to full power, they will shine even when your app is asleep. If, however, you set a custom color using watch_set_led_color, the color will not display correctly in STANDBY mode. You will need to keep your app running while the LED is on. </dd></dl>

</div>
</div>
<a id="ga042bcc9220ab05d1de8389cf0067511b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga042bcc9220ab05d1de8389cf0067511b">&#9670;&nbsp;</a></span>watch_set_led_color()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void watch_set_led_color </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>red</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>green</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sets the LED to a custom color by modulating each output's duty cycle. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">red</td><td>The red value from 0-255. </td></tr>
    <tr><td class="paramname">green</td><td>The green value from 0-255. If your watch has a red/blue LED, this will be the blue value. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>If you are displaying a custom color, you will need to prevent your app from going to sleep while the LED is on; otherwise, the color will not display correctly. You can do this by returning false in your app_loop method. </dd></dl>

</div>
</div>
<a id="gab01a29900ddc5315c0e752e63d748f41"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab01a29900ddc5315c0e752e63d748f41">&#9670;&nbsp;</a></span>watch_set_led_green()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void watch_set_led_green </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sets the green LED to full brightness, and turns the red LED off. </p>
<p>Of the two LED's in the RG bi-color LED, the green LED is the more power-efficient one (~0.44 mA). </p><dl class="section note"><dt>Note</dt><dd>If your watch has a red/blue LED, this method will set the LED to blue. </dd></dl>

</div>
</div>
<a id="ga36d89031d8e8813dfab5f6cff9c6ee40"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga36d89031d8e8813dfab5f6cff9c6ee40">&#9670;&nbsp;</a></span>watch_set_led_red()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void watch_set_led_red </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sets the red LED to full brightness, and turns the green LED off. </p>
<p>Of the two LED's in the RG bi-color LED, the red LED is the less power-efficient one (~4.5 mA). </p>

</div>
</div>
<a id="ga51ba53c3281ad8724d98af27eacc3de0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga51ba53c3281ad8724d98af27eacc3de0">&#9670;&nbsp;</a></span>watch_set_led_yellow()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void watch_set_led_yellow </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sets both red and green LEDs to full brightness. </p>
<p>The total current draw between the two LED's in this mode will be ~5 mA, which is more than the watch draws in any other mode. Take care not to drain the battery. </p><dl class="section note"><dt>Note</dt><dd>If your watch has a red/blue LED, this method will set the LED to pink. </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>