Skip to content

Commit 58124ed

Browse files
committed
Rename WDT class instantiation to "wdt"
1 parent 4b23840 commit 58124ed

File tree

5 files changed

+23
-24
lines changed

5 files changed

+23
-24
lines changed

libraries/WDT/examples/Example1_WDT_Basic/Example1_WDT_Basic.ino

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void setup() {
3535
Serial.println("Artemis Watchdog Timer Example");
3636

3737
// Start the watchdog
38-
WDT.start();
38+
wdt.start();
3939
}
4040

4141
void loop()
@@ -63,12 +63,12 @@ void loop()
6363
extern "C" void am_watchdog_isr(void)
6464
{
6565
// Clear the watchdog interrupt
66-
WDT.clear();
66+
wdt.clear();
6767

6868
// Catch the first four watchdog interrupts, but let the fifth through untouched
6969
if ( watchdogInterrupt < 4 )
7070
{
71-
WDT.restart(); // "Pet" the dog
71+
wdt.restart(); // "Pet" the dog
7272
}
7373
else {
7474
digitalWrite(LED_BUILTIN, HIGH); // Visual indication of system reset trigger

libraries/WDT/examples/Example2_WDT_Config/Example2_WDT_Config.ino

+7-7
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ void setup()
5757
// Set watchdog interrupt to 1 seconds (128 ticks / 128 Hz = 1 second)
5858
// Set watchdog reset ~2 seconds (255 ticks / 128 Hz = 1.99 seconds)
5959
// Note: Ticks are limited to 255 (8-bit)
60-
WDT.configure(WDT_128HZ, 128, 255); // Equivalent to: wdt.configure(1, 128, 255);
61-
WDT.start(); // Start the watchdog
60+
wdt.configure(WDT_128HZ, 128, 255); // Equivalent to: wdt.configure(1, 128, 255);
61+
wdt.start(); // Start the watchdog
6262
}
6363

6464
void loop()
@@ -74,9 +74,9 @@ void loop()
7474
Serial.print(" Period: "); Serial.print(currentMillis); Serial.println(" ms");
7575

7676
// The watchdog configurations can also be set individually
77-
WDT.setClock(WDT_16HZ); // Set watchdog timer clock to 16 Hz
78-
WDT.setInterrupt(64); // Set watchdog interrupt to 4 second (64 ticks / 16 Hz = 4 seconds)
79-
WDT.setReset(96); // Set watchdog reset to 8 seconds (96 ticks / 16 Hz = 8 seconds)
77+
wdt.setClock(WDT_16HZ); // Set watchdog timer clock to 16 Hz
78+
wdt.setInterrupt(64); // Set watchdog interrupt to 4 second (64 ticks / 16 Hz = 4 seconds)
79+
wdt.setReset(96); // Set watchdog reset to 8 seconds (96 ticks / 16 Hz = 8 seconds)
8080

8181
if (watchdogInterrupt == 9)
8282
{
@@ -91,12 +91,12 @@ void loop()
9191
extern "C" void am_watchdog_isr(void)
9292
{
9393
// Clear the watchdog interrupt
94-
WDT.clear();
94+
wdt.clear();
9595

9696
// Catch the first eight watchdog interrupts, but let the ninth through untouched
9797
if ( watchdogInterrupt < 8 )
9898
{
99-
WDT.restart(); // "Pet" the dog
99+
wdt.restart(); // "Pet" the dog
100100
}
101101
else
102102
{

libraries/WDT/examples/Example3_WDT_LowPower/Example3_WDT_LowPower.ino

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ void setup()
4040

4141
// Configure the watchdog timer
4242
// See Example2_WDT_Config for more information on how to configure the watchdog
43-
WDT.configure(WDT_16HZ, 160, 240); // 16 Hz clock, 10-second interrupt period, 15-second reset period
43+
wdt.configure(WDT_16HZ, 160, 240); // 16 Hz clock, 10-second interrupt period, 15-second reset period
4444

4545
// Start the watchdog
46-
WDT.start();
46+
wdt.start();
4747
}
4848

4949
void loop()
@@ -73,10 +73,10 @@ void loop()
7373
// Print the RTC's current date and time
7474
void printDateTime()
7575
{
76-
rtc.getTime();
76+
RTC.getTime();
7777
Serial.printf("20%02d-%02d-%02d %02d:%02d:%02d.%02d\n",
78-
rtc.year, rtc.month, rtc.dayOfMonth,
79-
rtc.hour, rtc.minute, rtc.seconds, rtc.hundredths);
78+
RTC.year, RTC.month, RTC.dayOfMonth,
79+
RTC.hour, RTC.minute, RTC.seconds, RTC.hundredths);
8080
}
8181

8282
// Power down gracefully
@@ -154,7 +154,7 @@ extern "C" void am_watchdog_isr(void)
154154
// Perform system reset after 10 watchdog interrupts (should not occur)
155155
if ( watchdogInterrupt < 10 )
156156
{
157-
WDT.restart(); // "Pet" the dog
157+
wdt.restart(); // "Pet" the dog
158158
}
159159
else {
160160
digitalWrite(LED_BUILTIN, HIGH); // Visual indication of system reset trigger

libraries/WDT/src/WDT.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
#include "WDT.h"
77

8-
Apollo3WDT WDT;
8+
Apollo3WDT wdt;
99

1010
// Constructor
11-
Apollo3WDT::Apollo3WDT() {
11+
Apollo3WDT::Apollo3WDT()
1212
{
1313
// The watchdog only runs off of the LFRC
1414
am_hal_clkgen_control(AM_HAL_CLKGEN_CONTROL_LFRC_START, 0);
@@ -97,5 +97,4 @@ void Apollo3WDT::clear()
9797
uint32_t Apollo3WDT::getCounter()
9898
{
9999
return am_hal_wdt_counter_get();
100-
}
101-
100+
}

libraries/WDT/src/WDT.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
#include <Arduino.h>
1010

11-
#ifdef WDT
12-
#undef WDT
11+
#ifdef wdt
12+
#undef wdt
1313
#endif
1414

1515
// Simplified WDT Clock Divider Selections
@@ -51,6 +51,6 @@ class Apollo3WDT {
5151
void setReset(uint8_t reset); // Set number of ticks before the watchdog will issue a system reset
5252
};
5353

54-
extern Apollo3WDT WDT;
54+
extern Apollo3WDT wdt;
5555

56-
#endif // _APOLLO3_LIBRARIES_RTC_H_
56+
#endif // _APOLLO3_LIBRARIES_RTC_H_

0 commit comments

Comments
 (0)