Skip to content

Commit 7ad4a74

Browse files
author
James Foster
committed
Add avr/wdt.h and simple test that ensures the header can be found and the functions can be called.
1 parent 84d7ad4 commit 7ad4a74

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2424
### Added
2525
- Better indications of the build phases in the test runner `arduino_ci.rb`
2626
- Better indications of which example sketch is being compiled as part of testing
27+
- Allow use of watchdog timer in application code (though it doesn't do anything)
2728

2829
### Changed
2930
- Topmost installtion instructions now suggest `gem install arduino_ci` instead of using a `Gemfile`. Reasons for using a `Gemfile` are listed and discussed separately further down the README.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <Arduino.h>
2+
#include <ArduinoUnitTests.h>
3+
#include <avr/wdt.h>
4+
5+
unittest(wdt) {
6+
wdt_disable();
7+
wdt_enable(WDTO_8S);
8+
wdt_reset();
9+
assertTrue(true);
10+
}
11+
12+
unittest_main()

cpp/arduino/avr/wdt.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Stub for testing that doesn't do anything (but at least compiles!)
2+
3+
#define wdt_disable() (void)0
4+
#define wdt_enable(timeout) (void)0
5+
#define wdt_reset() (void)0
6+
7+
#define WDTO_15MS 0
8+
#define WDTO_30MS 1
9+
#define WDTO_60MS 2
10+
#define WDTO_120MS 3
11+
#define WDTO_250MS 4
12+
#define WDTO_500MS 5
13+
#define WDTO_1S 6
14+
#define WDTO_2S 7
15+
#define WDTO_4S 8
16+
#define WDTO_8S 9

0 commit comments

Comments
 (0)