Developer World
Spresense Arduino Library v3.2.0-77d75a4
Watchdog.h
Go to the documentation of this file.
1/*
2 * Watchdog.h - Spresense Arduino Watchdog library
3 * Copyright 2018 Sony Semiconductor Solutions Corporation
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef Watchdog_h
21#define Watchdog_h
22
38/*
39 This header file maybe inclued in plain C file.
40 To avoid compiling error all C++ stuff should be ignored
41 */
42
43#include <sdk/config.h>
44#include <nuttx/config.h>
45#include <nuttx/timers/watchdog.h>
46#include <Arduino.h>
47
48
49/*
50 For debug kernel
51 */
52#if BRD_DEBUG
53#define watchdog_printf(...) printf(__VA_ARGS__)
54#else
55#define watchdog_printf(x...)
56#endif
57
66public:
73
79 void begin(void);
80
86 void end(void);
87
96 void start(uint32_t timeout);
97
104 void stop(void);
105
112 void kick(void);
113
121 uint32_t timeleft(void);
122
123private:
124 int wd_fd;
125};
126
127extern WatchdogClass Watchdog;
128
131#endif // Watchdog_h
Watchdog controller.
Definition: Watchdog.h:65
void stop(void)
Stop to check timer for avoid bite watchdog.
uint32_t timeleft(void)
Get a remain time for bite watchdog.
void kick(void)
Kick to watchdog for notify keep alive.
void begin(void)
Initialize the Watchdog library.
void end(void)
Disable the Watchdog.
WatchdogClass(void)
Create WatchdogClass object.
void start(uint32_t timeout)
Start to check timer for bite watchdog.