Skip to content

Commit 5b7d2b3

Browse files
author
betzrhodes
authored
Merge pull request #16 from electricimp/develop
added teardown and sensor int resets to test files
2 parents 0786115 + 1fde8af commit 5b7d2b3

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

Diff for: tests/LIS3HD.automated.device.test.nut

+10
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ class MyTestCase extends ImpTestCase {
3333
_i2c = hardware.i2c89;
3434
_i2c.configure(CLOCK_SPEED_400_KHZ);
3535
_intPin = hardware.pin1;
36+
37+
// Software reset for pressure sensor
38+
_i2c.write(0xB8, format("%c%c", 0x11, (0x14 & 0xff)));
39+
// Disable TempHumid Interrupt
40+
_i2c.write(0xBE, format("%c%c", 0x22, (0x00 & 0xff)));
3641
}
3742

3843
function getLIS() {
@@ -152,4 +157,9 @@ class MyTestCase extends ImpTestCase {
152157
}.bindenv(this));
153158
}.bindenv(this))
154159
}
160+
161+
function tearDown() {
162+
local accel = LIS3DH(_i2c, 0x32);
163+
accel.reset();
164+
}
155165
}

Diff for: tests/LIS3HD.manual.device.test.nut

+11
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ class MyTestCase extends ImpTestCase {
3434
_i2c = hardware.i2c89;
3535
_i2c.configure(CLOCK_SPEED_400_KHZ);
3636
_intPin = hardware.pin1;
37+
38+
// Software reset for pressure sensor
39+
_i2c.write(0xB8, format("%c%c", 0x11, (0x14 & 0xff)));
40+
// Disable TempHumid Interrupt
41+
_i2c.write(0xBE, format("%c%c", 0x22, (0x00 & 0xff)));
3742
}
3843

3944
function getLIS() {
@@ -405,4 +410,10 @@ class MyTestCase extends ImpTestCase {
405410
}.bindenv(this));
406411
}
407412

413+
function tearDown() {
414+
local accel = LIS3DH(_i2c, 0x32);
415+
accel.reset();
416+
}
417+
418+
408419
}

0 commit comments

Comments
 (0)