]> Git Repo - pico-vscode.git/blob - web/docs/group__hardware__watchdog.html
Merge branch 'main' into main
[pico-vscode.git] / web / docs / group__hardware__watchdog.html
1 <!-- HTML header for doxygen 1.8.20-->
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5         <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
6         <meta http-equiv="X-UA-Compatible" content="IE=9"/>
7         <meta name="generator" content="Doxygen 1.9.4"/>
8         <meta name="viewport" content="width=device-width, initial-scale=1"/>
9         <title>Raspberry Pi Pico SDK: hardware_watchdog</title>
10         <!-- <link href="tabs.css" rel="stylesheet" type="text/css"/> -->
11         <script type="text/javascript" src="jquery.js"></script>
12         <script type="text/javascript" src="dynsections.js"></script>
13         <link href="navtree.css" rel="stylesheet" type="text/css"/>
14 <script type="text/javascript" src="resize.js"></script>
15 <script type="text/javascript" src="navtreedata.js"></script>
16 <script type="text/javascript" src="navtree.js"></script>
17         <link href="search/search.css" rel="stylesheet" type="text/css"/>
18 <script type="text/javascript" src="search/searchdata.js"></script>
19 <script type="text/javascript" src="search/search.js"></script>
20     <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
21         <link href="doxygen.css" rel="stylesheet" type="text/css" />
22         <link href="normalise.css" rel="stylesheet" type="text/css"/>
23 <link href="main.css" rel="stylesheet" type="text/css"/>
24 <link href="styles.css" rel="stylesheet" type="text/css"/>
25 </head>
26 <body>
27         <div class="navigation-mobile">
28                 <div class="logo--mobile">
29                         <a href="/"><img src="logo-mobile.svg" alt="Raspberry Pi"></a>
30                 </div>
31                 <div class="navigation-toggle">
32                         <span class="line-1"></span>
33                         <span class="line-2">
34                                 <p>Menu Toggle</p>
35                         </span>
36                         <span class="line-3"></span>
37                 </div>
38         </div>
39         <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
40                 <div class="logo">
41                         <a href="index.html"> <img src="logo.svg" alt="Raspberry Pi"></a>
42                         <span style="display: inline-block; margin-top: 10px;">
43                                 v2.0.0
44                         </span>
45                 </div>
46                 <div class="navigation-footer">
47                         <img src="logo-mobile.svg" alt="Raspberry Pi">
48                         <a href="https://www.raspberrypi.com/" target="_blank">By Raspberry Pi Ltd</a>
49                 </div>
50 <!--            <div class="search">
51                         <form>
52                                 <input type="search" name="search" id="search" placeholder="Search">
53                                 <input type="submit" value="Search">
54                         </form>
55                 </div> -->
56 <!-- Generated by Doxygen 1.9.4 -->
57 <script type="text/javascript">
58 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
59 var searchBox = new SearchBox("searchBox", "search",'Search','.html');
60 /* @license-end */
61 </script>
62 <script type="text/javascript" src="menudata.js"></script>
63 <script type="text/javascript" src="menu.js"></script>
64 <script type="text/javascript">
65 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
66 $(function() {
67   initMenu('',true,false,'search.php','Search');
68   $(document).ready(function() { init_search(); });
69 });
70 /* @license-end */
71 </script>
72 <div id="main-nav"></div>
73 </div><!-- top -->
74 <div id="side-nav" class="ui-resizable side-nav-resizable">
75   <div id="nav-tree">
76     <div id="nav-tree-contents">
77       <div id="nav-sync" class="sync"></div>
78     </div>
79   </div>
80   <div id="splitbar" style="-moz-user-select:none;" 
81        class="ui-resizable-handle">
82   </div>
83 </div>
84 <script type="text/javascript">
85 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
86 $(document).ready(function(){initNavTree('group__hardware__watchdog.html',''); initResizable(); });
87 /* @license-end */
88 </script>
89 <div id="doc-content">
90 <!-- window showing the filter options -->
91 <div id="MSearchSelectWindow"
92      onmouseover="return searchBox.OnSearchSelectShow()"
93      onmouseout="return searchBox.OnSearchSelectHide()"
94      onkeydown="return searchBox.OnSearchSelectKey(event)">
95 </div>
96
97 <!-- iframe showing the search results (closed by default) -->
98 <div id="MSearchResultsWindow">
99 <iframe src="javascript:void(0)" frameborder="0" 
100         name="MSearchResults" id="MSearchResults">
101 </iframe>
102 </div>
103
104 <div class="header">
105   <div class="summary">
106 <a href="#func-members">Functions</a>  </div>
107   <div class="headertitle"><div class="title">hardware_watchdog<div class="ingroups"><a class="el" href="group__hardware.html">Hardware APIs</a></div></div></div>
108 </div><!--header-->
109 <div class="contents">
110
111 <p>Hardware Watchdog Timer API.  
112 <a href="#details">More...</a></p>
113 <table class="memberdecls">
114 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
115 Functions</h2></td></tr>
116 <tr class="memitem:gaa73ccd43d6d755817e71bc3d7eb1fda6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__watchdog.html#gaa73ccd43d6d755817e71bc3d7eb1fda6">watchdog_reboot</a> (uint32_t pc, uint32_t sp, uint32_t delay_ms)</td></tr>
117 <tr class="memdesc:gaa73ccd43d6d755817e71bc3d7eb1fda6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Define actions to perform at watchdog timeout.  <a href="group__hardware__watchdog.html#gaa73ccd43d6d755817e71bc3d7eb1fda6">More...</a><br /></td></tr>
118 <tr class="separator:gaa73ccd43d6d755817e71bc3d7eb1fda6"><td class="memSeparator" colspan="2">&#160;</td></tr>
119 <tr class="memitem:gaab9cfb964649bc7928c72335d964e425"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__watchdog.html#gaab9cfb964649bc7928c72335d964e425">watchdog_start_tick</a> (uint cycles)</td></tr>
120 <tr class="memdesc:gaab9cfb964649bc7928c72335d964e425"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start the watchdog tick.  <a href="group__hardware__watchdog.html#gaab9cfb964649bc7928c72335d964e425">More...</a><br /></td></tr>
121 <tr class="separator:gaab9cfb964649bc7928c72335d964e425"><td class="memSeparator" colspan="2">&#160;</td></tr>
122 <tr class="memitem:ga329b748919954f8b48c58049115a5c54"><td class="memItemLeft" align="right" valign="top"><a id="ga329b748919954f8b48c58049115a5c54" name="ga329b748919954f8b48c58049115a5c54"></a>
123 void&#160;</td><td class="memItemRight" valign="bottom"><b>watchdog_update</b> (void)</td></tr>
124 <tr class="memdesc:ga329b748919954f8b48c58049115a5c54"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reload the watchdog counter with the amount of time set in watchdog_enable. <br /></td></tr>
125 <tr class="separator:ga329b748919954f8b48c58049115a5c54"><td class="memSeparator" colspan="2">&#160;</td></tr>
126 <tr class="memitem:ga87042933bd6c335c21131991c83c161d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__watchdog.html#ga87042933bd6c335c21131991c83c161d">watchdog_enable</a> (uint32_t delay_ms, bool pause_on_debug)</td></tr>
127 <tr class="memdesc:ga87042933bd6c335c21131991c83c161d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable the watchdog.  <a href="group__hardware__watchdog.html#ga87042933bd6c335c21131991c83c161d">More...</a><br /></td></tr>
128 <tr class="separator:ga87042933bd6c335c21131991c83c161d"><td class="memSeparator" colspan="2">&#160;</td></tr>
129 <tr class="memitem:gad627aed933db1187ad21853494dbe18d"><td class="memItemLeft" align="right" valign="top"><a id="gad627aed933db1187ad21853494dbe18d" name="gad627aed933db1187ad21853494dbe18d"></a>
130 void&#160;</td><td class="memItemRight" valign="bottom"><b>watchdog_disable</b> (void)</td></tr>
131 <tr class="memdesc:gad627aed933db1187ad21853494dbe18d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disable the watchdog. <br /></td></tr>
132 <tr class="separator:gad627aed933db1187ad21853494dbe18d"><td class="memSeparator" colspan="2">&#160;</td></tr>
133 <tr class="memitem:ga65f5d24169045b8c7dc709e572535d94"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__watchdog.html#ga65f5d24169045b8c7dc709e572535d94">watchdog_caused_reboot</a> (void)</td></tr>
134 <tr class="memdesc:ga65f5d24169045b8c7dc709e572535d94"><td class="mdescLeft">&#160;</td><td class="mdescRight">Did the watchdog cause the last reboot?  <a href="group__hardware__watchdog.html#ga65f5d24169045b8c7dc709e572535d94">More...</a><br /></td></tr>
135 <tr class="separator:ga65f5d24169045b8c7dc709e572535d94"><td class="memSeparator" colspan="2">&#160;</td></tr>
136 <tr class="memitem:ga455aa48ca6f11298e184d2ae0e81a085"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__watchdog.html#ga455aa48ca6f11298e184d2ae0e81a085">watchdog_enable_caused_reboot</a> (void)</td></tr>
137 <tr class="memdesc:ga455aa48ca6f11298e184d2ae0e81a085"><td class="mdescLeft">&#160;</td><td class="mdescRight">Did watchdog_enable cause the last reboot?  <a href="group__hardware__watchdog.html#ga455aa48ca6f11298e184d2ae0e81a085">More...</a><br /></td></tr>
138 <tr class="separator:ga455aa48ca6f11298e184d2ae0e81a085"><td class="memSeparator" colspan="2">&#160;</td></tr>
139 <tr class="memitem:ga536c4f5fbb5a967852b4fc8c4d2020bb"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__watchdog.html#ga536c4f5fbb5a967852b4fc8c4d2020bb">watchdog_get_time_remaining_ms</a> (void)</td></tr>
140 <tr class="memdesc:ga536c4f5fbb5a967852b4fc8c4d2020bb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the number of microseconds before the watchdog will reboot the chip.  <a href="group__hardware__watchdog.html#ga536c4f5fbb5a967852b4fc8c4d2020bb">More...</a><br /></td></tr>
141 <tr class="separator:ga536c4f5fbb5a967852b4fc8c4d2020bb"><td class="memSeparator" colspan="2">&#160;</td></tr>
142 </table>
143 <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
144 <p >Hardware Watchdog Timer API. </p>
145 <p >Supporting functions for the Pico hardware watchdog timer.</p>
146 <p >The RP-series microcontrollers have a built in HW watchdog Timer. This is a countdown timer that can restart parts of the chip if it reaches zero. For example, this can be used to restart the processor if the software running on it gets stuck in an infinite loop or similar. The programmer has to periodically write a value to the watchdog to stop it reaching zero.</p>
147 <h2><a class="anchor" id="watchdog_example"></a>
148 Example</h2>
149 <div class="fragment"><div class="line"> </div>
150 <div class="line"><span class="preprocessor">#include &lt;<a class="code" href="stdio_8h.html">stdio.h</a>&gt;</span></div>
151 <div class="line"><span class="preprocessor">#include &quot;<a class="code" href="stdlib_8h.html">pico/stdlib.h</a>&quot;</span></div>
152 <div class="line"><span class="preprocessor">#include &quot;<a class="code" href="rp2__common_2hardware__watchdog_2include_2hardware_2watchdog_8h.html">hardware/watchdog.h</a>&quot;</span></div>
153 <div class="line"> </div>
154 <div class="line"><span class="keywordtype">int</span> main() {</div>
155 <div class="line">    <a class="code hl_function" href="group__pico__stdio.html#ga0e604311fb226dae91ff4eb17a19d67a">stdio_init_all</a>();</div>
156 <div class="line"> </div>
157 <div class="line">    <span class="keywordflow">if</span> (<a class="code hl_function" href="group__hardware__watchdog.html#ga65f5d24169045b8c7dc709e572535d94">watchdog_caused_reboot</a>()) {</div>
158 <div class="line">        printf(<span class="stringliteral">&quot;Rebooted by Watchdog!\n&quot;</span>);</div>
159 <div class="line">        <span class="keywordflow">return</span> 0;</div>
160 <div class="line">    } <span class="keywordflow">else</span> {</div>
161 <div class="line">        printf(<span class="stringliteral">&quot;Clean boot\n&quot;</span>);</div>
162 <div class="line">    }</div>
163 <div class="line"> </div>
164 <div class="line">    <span class="comment">// Enable the watchdog, requiring the watchdog to be updated every 100ms or the chip will reboot</span></div>
165 <div class="line">    <span class="comment">// second arg is pause on debug which means the watchdog will pause when stepping through code</span></div>
166 <div class="line">    <a class="code hl_function" href="group__hardware__watchdog.html#ga87042933bd6c335c21131991c83c161d">watchdog_enable</a>(100, 1);</div>
167 <div class="line"> </div>
168 <div class="line">    <span class="keywordflow">for</span> (uint i = 0; i &lt; 5; i++) {</div>
169 <div class="line">        printf(<span class="stringliteral">&quot;Updating watchdog %d\n&quot;</span>, i);</div>
170 <div class="line">        <a class="code hl_function" href="group__hardware__watchdog.html#ga329b748919954f8b48c58049115a5c54">watchdog_update</a>();</div>
171 <div class="line">    }</div>
172 <div class="line"> </div>
173 <div class="line">    <span class="comment">// Wait in an infinite loop and don&#39;t update the watchdog so it reboots us</span></div>
174 <div class="line">    printf(<span class="stringliteral">&quot;Waiting to be rebooted by watchdog\n&quot;</span>);</div>
175 <div class="line">    <span class="keywordflow">while</span>(1);</div>
176 <div class="line">}</div>
177 <div class="ttc" id="agroup__hardware__watchdog_html_ga329b748919954f8b48c58049115a5c54"><div class="ttname"><a href="group__hardware__watchdog.html#ga329b748919954f8b48c58049115a5c54">watchdog_update</a></div><div class="ttdeci">void watchdog_update(void)</div><div class="ttdoc">Reload the watchdog counter with the amount of time set in watchdog_enable.</div><div class="ttdef"><b>Definition:</b> watchdog.c:26</div></div>
178 <div class="ttc" id="agroup__hardware__watchdog_html_ga65f5d24169045b8c7dc709e572535d94"><div class="ttname"><a href="group__hardware__watchdog.html#ga65f5d24169045b8c7dc709e572535d94">watchdog_caused_reboot</a></div><div class="ttdeci">bool watchdog_caused_reboot(void)</div><div class="ttdoc">Did the watchdog cause the last reboot?</div><div class="ttdef"><b>Definition:</b> watchdog.c:114</div></div>
179 <div class="ttc" id="agroup__hardware__watchdog_html_ga87042933bd6c335c21131991c83c161d"><div class="ttname"><a href="group__hardware__watchdog.html#ga87042933bd6c335c21131991c83c161d">watchdog_enable</a></div><div class="ttdeci">void watchdog_enable(uint32_t delay_ms, bool pause_on_debug)</div><div class="ttdoc">Enable the watchdog.</div><div class="ttdef"><b>Definition:</b> watchdog.c:79</div></div>
180 <div class="ttc" id="agroup__pico__stdio_html_ga0e604311fb226dae91ff4eb17a19d67a"><div class="ttname"><a href="group__pico__stdio.html#ga0e604311fb226dae91ff4eb17a19d67a">stdio_init_all</a></div><div class="ttdeci">bool stdio_init_all(void)</div><div class="ttdoc">Initialize all of the present standard stdio types that are linked into the binary.</div><div class="ttdef"><b>Definition:</b> stdio.c:200</div></div>
181 <div class="ttc" id="arp2__common_2hardware__watchdog_2include_2hardware_2watchdog_8h_html"><div class="ttname"><a href="rp2__common_2hardware__watchdog_2include_2hardware_2watchdog_8h.html">watchdog.h</a></div></div>
182 <div class="ttc" id="astdio_8h_html"><div class="ttname"><a href="stdio_8h.html">stdio.h</a></div></div>
183 <div class="ttc" id="astdlib_8h_html"><div class="ttname"><a href="stdlib_8h.html">stdlib.h</a></div></div>
184 </div><!-- fragment --> <h2 class="groupheader">Function Documentation</h2>
185 <a id="ga65f5d24169045b8c7dc709e572535d94" name="ga65f5d24169045b8c7dc709e572535d94"></a>
186 <h2 class="memtitle"><span class="permalink"><a href="#ga65f5d24169045b8c7dc709e572535d94">&#9670;&nbsp;</a></span>watchdog_caused_reboot()</h2>
187
188 <div class="memitem">
189 <div class="memproto">
190       <table class="memname">
191         <tr>
192           <td class="memname">bool watchdog_caused_reboot </td>
193           <td>(</td>
194           <td class="paramtype">void&#160;</td>
195           <td class="paramname"></td><td>)</td>
196           <td></td>
197         </tr>
198       </table>
199 </div><div class="memdoc">
200
201 <p>Did the watchdog cause the last reboot? </p>
202 <dl class="section return"><dt>Returns</dt><dd>true If the watchdog timer or a watchdog force caused the last reboot </dd>
203 <dd>
204 false If there has been no watchdog reboot since the last power on reset. A power on reset is typically caused by a power cycle or the run pin (reset button) being toggled. </dd></dl>
205
206 </div>
207 </div>
208 <a id="ga87042933bd6c335c21131991c83c161d" name="ga87042933bd6c335c21131991c83c161d"></a>
209 <h2 class="memtitle"><span class="permalink"><a href="#ga87042933bd6c335c21131991c83c161d">&#9670;&nbsp;</a></span>watchdog_enable()</h2>
210
211 <div class="memitem">
212 <div class="memproto">
213       <table class="memname">
214         <tr>
215           <td class="memname">void watchdog_enable </td>
216           <td>(</td>
217           <td class="paramtype">uint32_t&#160;</td>
218           <td class="paramname"><em>delay_ms</em>, </td>
219         </tr>
220         <tr>
221           <td class="paramkey"></td>
222           <td></td>
223           <td class="paramtype">bool&#160;</td>
224           <td class="paramname"><em>pause_on_debug</em>&#160;</td>
225         </tr>
226         <tr>
227           <td></td>
228           <td>)</td>
229           <td></td><td></td>
230         </tr>
231       </table>
232 </div><div class="memdoc">
233
234 <p>Enable the watchdog. </p>
235 <dl class="section note"><dt>Note</dt><dd>If <a class="el" href="group__hardware__watchdog.html#gaab9cfb964649bc7928c72335d964e425">watchdog_start_tick</a> value does not give a 1MHz clock to the watchdog system, then the <code>delay_ms</code> parameter will not be in milliseconds. See the datasheet for more details.</dd></dl>
236 <p>By default the SDK assumes a 12MHz XOSC and sets the <a class="el" href="group__hardware__watchdog.html#gaab9cfb964649bc7928c72335d964e425">watchdog_start_tick</a> appropriately.</p>
237 <p >This method sets a marker in the watchdog scratch register 4 that is checked by <a class="el" href="group__hardware__watchdog.html#ga455aa48ca6f11298e184d2ae0e81a085">watchdog_enable_caused_reboot</a>. If the device is subsequently reset via a call to watchdog_reboot (including for example by dragging a UF2 onto the RPI-RP2), then this value will be cleared, and so <a class="el" href="group__hardware__watchdog.html#ga455aa48ca6f11298e184d2ae0e81a085">watchdog_enable_caused_reboot</a> will return false.</p>
238 <dl class="params"><dt>Parameters</dt><dd>
239   <table class="params">
240     <tr><td class="paramname">delay_ms</td><td>Number of milliseconds before watchdog will reboot without watchdog_update being called. Maximum of 8388, which is approximately 8.3 seconds </td></tr>
241     <tr><td class="paramname">pause_on_debug</td><td>If the watchdog should be paused when the debugger is stepping through code </td></tr>
242   </table>
243   </dd>
244 </dl>
245
246 </div>
247 </div>
248 <a id="ga455aa48ca6f11298e184d2ae0e81a085" name="ga455aa48ca6f11298e184d2ae0e81a085"></a>
249 <h2 class="memtitle"><span class="permalink"><a href="#ga455aa48ca6f11298e184d2ae0e81a085">&#9670;&nbsp;</a></span>watchdog_enable_caused_reboot()</h2>
250
251 <div class="memitem">
252 <div class="memproto">
253       <table class="memname">
254         <tr>
255           <td class="memname">bool watchdog_enable_caused_reboot </td>
256           <td>(</td>
257           <td class="paramtype">void&#160;</td>
258           <td class="paramname"></td><td>)</td>
259           <td></td>
260         </tr>
261       </table>
262 </div><div class="memdoc">
263
264 <p>Did watchdog_enable cause the last reboot? </p>
265 <p >Perform additional checking along with <a class="el" href="group__hardware__watchdog.html#ga65f5d24169045b8c7dc709e572535d94">watchdog_caused_reboot</a> to determine if a watchdog timeout initiated by <a class="el" href="group__hardware__watchdog.html#ga87042933bd6c335c21131991c83c161d">watchdog_enable</a> caused the last reboot.</p>
266 <p >This method checks for a special value in watchdog scratch register 4 placed there by <a class="el" href="group__hardware__watchdog.html#ga87042933bd6c335c21131991c83c161d">watchdog_enable</a>. This would not be present if a watchdog reset is initiated by <a class="el" href="group__hardware__watchdog.html#gaa73ccd43d6d755817e71bc3d7eb1fda6">watchdog_reboot</a> or by the RP-series microcontroller bootrom (e.g. dragging a UF2 onto the RPI-RP2 drive).</p>
267 <dl class="section return"><dt>Returns</dt><dd>true If the watchdog timer or a watchdog force caused (see <a class="el" href="group__hardware__watchdog.html#ga65f5d24169045b8c7dc709e572535d94">watchdog_caused_reboot</a>) the last reboot and the watchdog reboot happened after <a class="el" href="group__hardware__watchdog.html#ga87042933bd6c335c21131991c83c161d">watchdog_enable</a> was called </dd>
268 <dd>
269 false If there has been no watchdog reboot since the last power on reset, or the watchdog reboot was not caused by a watchdog timeout after <a class="el" href="group__hardware__watchdog.html#ga87042933bd6c335c21131991c83c161d">watchdog_enable</a> was called. A power on reset is typically caused by a power cycle or the run pin (reset button) being toggled. </dd></dl>
270
271 </div>
272 </div>
273 <a id="ga536c4f5fbb5a967852b4fc8c4d2020bb" name="ga536c4f5fbb5a967852b4fc8c4d2020bb"></a>
274 <h2 class="memtitle"><span class="permalink"><a href="#ga536c4f5fbb5a967852b4fc8c4d2020bb">&#9670;&nbsp;</a></span>watchdog_get_time_remaining_ms()</h2>
275
276 <div class="memitem">
277 <div class="memproto">
278       <table class="memname">
279         <tr>
280           <td class="memname">uint32_t watchdog_get_time_remaining_ms </td>
281           <td>(</td>
282           <td class="paramtype">void&#160;</td>
283           <td class="paramname"></td><td>)</td>
284           <td></td>
285         </tr>
286       </table>
287 </div><div class="memdoc">
288
289 <p>Returns the number of microseconds before the watchdog will reboot the chip. </p>
290 <dl class="section return"><dt>Returns</dt><dd>The number of microseconds before the watchdog will reboot the chip. </dd></dl>
291
292 </div>
293 </div>
294 <a id="gaa73ccd43d6d755817e71bc3d7eb1fda6" name="gaa73ccd43d6d755817e71bc3d7eb1fda6"></a>
295 <h2 class="memtitle"><span class="permalink"><a href="#gaa73ccd43d6d755817e71bc3d7eb1fda6">&#9670;&nbsp;</a></span>watchdog_reboot()</h2>
296
297 <div class="memitem">
298 <div class="memproto">
299       <table class="memname">
300         <tr>
301           <td class="memname">void watchdog_reboot </td>
302           <td>(</td>
303           <td class="paramtype">uint32_t&#160;</td>
304           <td class="paramname"><em>pc</em>, </td>
305         </tr>
306         <tr>
307           <td class="paramkey"></td>
308           <td></td>
309           <td class="paramtype">uint32_t&#160;</td>
310           <td class="paramname"><em>sp</em>, </td>
311         </tr>
312         <tr>
313           <td class="paramkey"></td>
314           <td></td>
315           <td class="paramtype">uint32_t&#160;</td>
316           <td class="paramname"><em>delay_ms</em>&#160;</td>
317         </tr>
318         <tr>
319           <td></td>
320           <td>)</td>
321           <td></td><td></td>
322         </tr>
323       </table>
324 </div><div class="memdoc">
325
326 <p>Define actions to perform at watchdog timeout. </p>
327 <dl class="section note"><dt>Note</dt><dd>If <a class="el" href="group__hardware__watchdog.html#gaab9cfb964649bc7928c72335d964e425">watchdog_start_tick</a> value does not give a 1MHz clock to the watchdog system, then the <code>delay_ms</code> parameter will not be in milliseconds. See the datasheet for more details.</dd></dl>
328 <p>By default the SDK assumes a 12MHz XOSC and sets the <a class="el" href="group__hardware__watchdog.html#gaab9cfb964649bc7928c72335d964e425">watchdog_start_tick</a> appropriately.</p>
329 <dl class="params"><dt>Parameters</dt><dd>
330   <table class="params">
331     <tr><td class="paramname">pc</td><td>If Zero, a standard boot will be performed, if non-zero this is the program counter to jump to on reset. </td></tr>
332     <tr><td class="paramname">sp</td><td>If <code>pc</code> is non-zero, this will be the stack pointer used. </td></tr>
333     <tr><td class="paramname">delay_ms</td><td>Initial load value. Maximum value 8388, approximately 8.3s. </td></tr>
334   </table>
335   </dd>
336 </dl>
337
338 </div>
339 </div>
340 <a id="gaab9cfb964649bc7928c72335d964e425" name="gaab9cfb964649bc7928c72335d964e425"></a>
341 <h2 class="memtitle"><span class="permalink"><a href="#gaab9cfb964649bc7928c72335d964e425">&#9670;&nbsp;</a></span>watchdog_start_tick()</h2>
342
343 <div class="memitem">
344 <div class="memproto">
345       <table class="memname">
346         <tr>
347           <td class="memname">void watchdog_start_tick </td>
348           <td>(</td>
349           <td class="paramtype">uint&#160;</td>
350           <td class="paramname"><em>cycles</em></td><td>)</td>
351           <td></td>
352         </tr>
353       </table>
354 </div><div class="memdoc">
355
356 <p>Start the watchdog tick. </p>
357 <dl class="params"><dt>Parameters</dt><dd>
358   <table class="params">
359     <tr><td class="paramname">cycles</td><td>This needs to be a divider that when applied to the XOSC input, produces a 1MHz clock. So if the XOSC is 12MHz, this will need to be 12. </td></tr>
360   </table>
361   </dd>
362 </dl>
363
364 </div>
365 </div>
366 </div><!-- contents -->
367 </div><!-- doc-content -->
368
369         <script src="main.js"></script>
370 </body>
371 </html>
This page took 0.05055 seconds and 4 git commands to generate.