Skip to content

Commit

Permalink
added logging to fifo streaming example
Browse files Browse the repository at this point in the history
  • Loading branch information
Betsy committed Oct 7, 2019
1 parent 83b3be3 commit 9e0a674
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions examples/simpleFIFOStream.example.device.nut
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function readBuffer() {
local stats = accel.getFifoStats();
for (local i = 0 ; i < stats.unread ; i++) {
local data = accel.getAccel();
server.log(format("Accel (x,y,z): [%d, %d, %d]", data.x, data.y, data.z));
server.log(format("Accel (x,y,z): [%f, %f, %f]", data.x, data.y, data.z));
}

// Check if we are now over-run
Expand All @@ -62,6 +62,9 @@ accel.reset();
// Configure accelerometer
accel.setDataRate(100);

server.log("Log accel streaming data using FIFO interrupt...");
server.log("------------------------------------------------");

// Configure the FIFO buffer in Stream Mode
accel.configureFifo(true, LIS3DH_FIFO_STREAM_MODE);
// Configure interrupt to trigger when there are 30 entries in the buffer
Expand All @@ -71,4 +74,7 @@ accel.configureFifoInterrupts(true, false, 30);
imp.wakeup(5, function() {
accel.configureFifo(false);
accel.configureFifoInterrupts(false);
})

server.log("Stop logging accel streaming data.");
server.log("------------------------------------------------");
})

0 comments on commit 9e0a674

Please sign in to comment.