summaryrefslogtreecommitdiffstats
path: root/group__buttons.html
blob: 6e38d949ec2b87d868c00fb01c078e8d2c754a85 (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
<!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=11"/>
<meta name="generator" content="Doxygen 1.9.3"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Sensor Watch: Buttons &amp; External Interrupts</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 id="projectrow">
  <td id="projectalign">
   <div id="projectname">Sensor Watch<span id="projectnumber">&#160;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.3 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'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 -->
<!-- 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="#typedef-members">Typedefs</a> &#124;
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle"><div class="title">Buttons &amp; External Interrupts</div></div>
</div><!--header-->
<div class="contents">

<p>This section covers functions related to the three buttons: Light, Mode and Alarm, as well as external interrupts from devices on the nine-pin connector.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="typedef-members" name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:gadee2b304ce34a8aec5aedabd75934c1b"><td class="memItemLeft" align="right" valign="top"><a id="gadee2b304ce34a8aec5aedabd75934c1b" name="gadee2b304ce34a8aec5aedabd75934c1b"></a>
typedef enum <a class="el" href="group__buttons.html#ga0454ca577b6fcc7a7cb03039cb5150d8">watch_interrupt_trigger</a>&#160;</td><td class="memItemRight" valign="bottom"><b>watch_interrupt_trigger</b></td></tr>
<tr class="memdesc:gadee2b304ce34a8aec5aedabd75934c1b"><td class="mdescLeft">&#160;</td><td class="mdescRight">An enum defining the types of interrupt trigger you wish to scan for. <br /></td></tr>
<tr class="separator:gadee2b304ce34a8aec5aedabd75934c1b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="enum-members" name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:ga0454ca577b6fcc7a7cb03039cb5150d8"><td class="memItemLeft" align="right" valign="top"><a id="ga0454ca577b6fcc7a7cb03039cb5150d8" name="ga0454ca577b6fcc7a7cb03039cb5150d8"></a>enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__buttons.html#ga0454ca577b6fcc7a7cb03039cb5150d8">watch_interrupt_trigger</a> { <b>INTERRUPT_TRIGGER_NONE</b> = 0
, <b>INTERRUPT_TRIGGER_RISING</b>
, <b>INTERRUPT_TRIGGER_FALLING</b>
, <b>INTERRUPT_TRIGGER_BOTH</b>
 }</td></tr>
<tr class="memdesc:ga0454ca577b6fcc7a7cb03039cb5150d8"><td class="mdescLeft">&#160;</td><td class="mdescRight">An enum defining the types of interrupt trigger you wish to scan for. <br /></td></tr>
<tr class="separator:ga0454ca577b6fcc7a7cb03039cb5150d8"><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:ga9bcddd56ef2065183697b471a5fff6d2"><td class="memItemLeft" align="right" valign="top"><a id="ga9bcddd56ef2065183697b471a5fff6d2" name="ga9bcddd56ef2065183697b471a5fff6d2"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>watch_enable_external_interrupts</b> (void)</td></tr>
<tr class="memdesc:ga9bcddd56ef2065183697b471a5fff6d2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enables the external interrupt controller. <br /></td></tr>
<tr class="separator:ga9bcddd56ef2065183697b471a5fff6d2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga14c8fd8d92e4535012fb939ca8f12084"><td class="memItemLeft" align="right" valign="top"><a id="ga14c8fd8d92e4535012fb939ca8f12084" name="ga14c8fd8d92e4535012fb939ca8f12084"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>watch_disable_external_interrupts</b> (void)</td></tr>
<tr class="memdesc:ga14c8fd8d92e4535012fb939ca8f12084"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disables the external interrupt controller. <br /></td></tr>
<tr class="separator:ga14c8fd8d92e4535012fb939ca8f12084"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae40d2f73d0412680d83c26b8a0e1d31c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__buttons.html#gae40d2f73d0412680d83c26b8a0e1d31c">watch_register_interrupt_callback</a> (const uint8_t pin, ext_irq_cb_t callback, <a class="el" href="group__buttons.html#ga0454ca577b6fcc7a7cb03039cb5150d8">watch_interrupt_trigger</a> trigger)</td></tr>
<tr class="memdesc:gae40d2f73d0412680d83c26b8a0e1d31c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Configures an external interrupt callback on one of the external interrupt pins.  <a href="group__buttons.html#gae40d2f73d0412680d83c26b8a0e1d31c">More...</a><br /></td></tr>
<tr class="separator:gae40d2f73d0412680d83c26b8a0e1d31c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gabb98ef2a5bedc045ad2151302719bfea"><td class="memItemLeft" align="right" valign="top"><a id="gabb98ef2a5bedc045ad2151302719bfea" name="gabb98ef2a5bedc045ad2151302719bfea"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>__attribute__</b> ((deprecated(&quot;Use <a class="el" href="group__buttons.html#gae40d2f73d0412680d83c26b8a0e1d31c">watch_register_interrupt_callback</a> or <a class="el" href="group__deepsleep.html#gacad726423f5f38697c87474ab25244ca">watch_register_extwake_callback</a> instead&quot;))) void watch_register_button_callback(const uint8_t pin</td></tr>
<tr class="separator:gabb98ef2a5bedc045ad2151302719bfea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3d4f747fa7699e83a72ec8d6b8d8f8fc"><td class="memItemLeft" align="right" valign="top"><a id="ga3d4f747fa7699e83a72ec8d6b8d8f8fc" name="ga3d4f747fa7699e83a72ec8d6b8d8f8fc"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>__attribute__</b> ((deprecated(&quot;Use <a class="el" href="group__buttons.html#ga9bcddd56ef2065183697b471a5fff6d2">watch_enable_external_interrupts</a> instead&quot;))) void watch_enable_buttons(void)</td></tr>
<tr class="separator:ga3d4f747fa7699e83a72ec8d6b8d8f8fc"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="var-members" name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:ga9d5607684bd75c0f8b06d31fee6bb08c"><td class="memItemLeft" align="right" valign="top"><a id="ga9d5607684bd75c0f8b06d31fee6bb08c" name="ga9d5607684bd75c0f8b06d31fee6bb08c"></a>
ext_irq_cb_t&#160;</td><td class="memItemRight" valign="bottom"><b>callback</b></td></tr>
<tr class="separator:ga9d5607684bd75c0f8b06d31fee6bb08c"><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 three buttons: Light, Mode and Alarm, as well as external interrupts from devices on the nine-pin connector. </p>
<p >The buttons are the core input UI of the watch, and the way the user will interact with your application. They are active high, pulled down by the microcontroller, and triggered when one of the "pushers" brings a tab from the metal frame into contact with the edge of the board. Note that the buttons can only wake the watch from STANDBY mode, at least as of the current SAM L22 silicon revision. The external interrupt controller runs in STANDBY mode, but it does not run in BACKUP mode; to wake from BACKUP, buttons will not cut it. </p>
<h2 class="groupheader">Function Documentation</h2>
<a id="gae40d2f73d0412680d83c26b8a0e1d31c" name="gae40d2f73d0412680d83c26b8a0e1d31c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gae40d2f73d0412680d83c26b8a0e1d31c">&#9670;&nbsp;</a></span>watch_register_interrupt_callback()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void watch_register_interrupt_callback </td>
          <td>(</td>
          <td class="paramtype">const uint8_t&#160;</td>
          <td class="paramname"><em>pin</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">ext_irq_cb_t&#160;</td>
          <td class="paramname"><em>callback</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__buttons.html#ga0454ca577b6fcc7a7cb03039cb5150d8">watch_interrupt_trigger</a>&#160;</td>
          <td class="paramname"><em>trigger</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Configures an external interrupt callback on one of the external interrupt pins. </p>
<p >You can set one interrupt callback per pin, and you can monitor for a rising condition, a falling condition, or both. If you just want to detect a button press, register your interrupt with INTERRUPT_TRIGGER_RISING; if you want to detect an active-low interrupt signal from a device on the nine-pin connector, use INTERRUPT_TRIGGER_FALLING. If you want to detect both rising and falling conditions (i.e. button down and button up), use INTERRUPT_TRIGGER_BOTH and use watch_get_pin_level to check the pin level in your callback to determine which condition caused the interrupt. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">pin</td><td>One of BTN_LIGHT, BTN_MODE, BTN_ALARM, A0, A1, A3 or A4. If the pin parameter matches one of the three button pins, this function will also enable an internal pull-down resistor. If the pin parameter is A0-A4, you are responsible for setting any required pull configuration using watch_enable_pull_up or watch_enable_pull_down. </td></tr>
    <tr><td class="paramname">callback</td><td>The function you wish to have called when the button is pressed. </td></tr>
    <tr><td class="paramname">trigger</td><td>The condition on which you wish to trigger: rising, falling or both. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>Pins A2 and A4 can also generate interrupts via the watch_register_extwake_callback function, which will allow them to trigger even when the watch is in deep sleep mode. </dd></dl>
<dl class="section warning"><dt>Warning</dt><dd>As of now, A2 is not usable via the watch_register_interrupt_callback function. To enable an external interrupt on pin A2, use the watch_register_extwake_callback function. This issue will be addressed in a future revision of the watch library. </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.3
</small></address>
</body>
</html>