Skip to content

Commit 31558bd

Browse files
Update README.md
1 parent 42060d2 commit 31558bd

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

Diff for: README.md

+9-11
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ The class’ constructor takes one required parameter (a configured imp I²C
1717
| *i2cBus* | hardware.i2c | N/A | A pre-configured I²C bus |
1818
| *i2cAddress* | byte | 0x30 | The I²C address of the accelerometer |
1919

20-
&nbsp;<br>
21-
2220
```squirrel
2321
#require "LIS3DH.class.nut:1.3.0"
2422
@@ -63,7 +61,7 @@ Normal mode is enabled by default.
6361
accel.setLowPower(true);
6462
```
6563

66-
### enable([*state*])
64+
### enable(*[state]*)
6765

6866
The *enable()* method enables or disables all three axes on the accelerometer. The method takes an optional boolean parameter, *state*. By default *state* is set to `true` and the accelerometer is enabled. When *state* is `false`, the accelerometer will be disabled.
6967

@@ -135,7 +133,7 @@ This method configures an interrupt when the FIFO buffer reaches the set waterma
135133
| --------- | ---- | ------------- | ----------- |
136134
| *state* | Boolean | N/A | `true` to enable, `false` to disable |
137135
| *fifomode* | bitfield | *FIFO_STREAM_MODE* | See table below |
138-
| *watermark* | Integer | 28 | Number of buffer slots filled to generate<br> interrupt (buffer has 32 slots) |
136+
| *watermark* | Integer | 28 | Number of buffer slots filled to generate<br>interrupt (buffer has 32 slots) |
139137

140138
This example sets the FIFO buffer to Stream Mode and reads the data from
141139
the buffer whenever the watermark is reached:
@@ -148,15 +146,15 @@ function readBuffer() {
148146
149147
// Read buffer
150148
local stats = accel.getFifoStats();
151-
for (local i = 0; i < stats.unread; ++i) {
149+
for (local i = 0 ; i < stats.unread ; ++i) {
152150
local data = accel.getAccel();
153151
server.log(format("Accel (x,y,z): [%d, %d, %d]", data.x, data.y, data.z));
154152
}
155153
156154
// Check if we are now overrun
157155
local stats = accel.getFifoStats();
158156
if (stats.overrun) {
159-
server.error("Accelerometer buffer overrun")
157+
server.error("Accelerometer buffer overrun");
160158
161159
// Set FIFO mode to bypass to clear the buffer and then return to stream mode
162160
accel.configureFifoInterrupt(true, accel.FIFO_BYPASS_MODE);
@@ -177,8 +175,8 @@ wakePin.configure(DIGITAL_IN_PULLDOWN, readBuffer);
177175
accel.init();
178176
accel.setDataRate(100);
179177
180-
// Configure the FIFO buffer in Stream Mode and set interrupt generator to
181-
// generate an interrupt when there are 30 entries in the buffer
178+
// Configure the FIFO buffer in Stream Mode and set interrupt generator
179+
// to generate an interrupt when there are 30 entries in the buffer
182180
accel.configureFifoInterrupt(true, accel.FIFO_STREAM_MODE, 30);
183181
```
184182

@@ -189,7 +187,7 @@ accel.configureFifoInterrupt(true, accel.FIFO_STREAM_MODE, 30);
189187
| *FIFO_BYPASS_MODE* | Disables the FIFO buffer (only the first address is used for each channel) |
190188
| *FIFO_FIFO_MODE* | When full, the FIFO buffer stops collecting data from the input channels |
191189
| *FIFO_STREAM_MODE* | When full, the FIFO buffer discards the older data as the new arrive |
192-
| *FIFO_STREAM_TO_FIFO_MODE* | When full, the FIFO buffer discards the older data as the new arrive.<br> Once trigger event occurs, the FIFO buffer starts operating in FIFO mode. |
190+
| *FIFO_STREAM_TO_FIFO_MODE* | When full, the FIFO buffer discards the older data as the new arrive.<br>Once trigger event occurs, the FIFO buffer starts operating in FIFO mode |
193191

194192
### configureInertialInterrupt(*state[, threshold][, duration][, options]*)
195193

@@ -419,9 +417,9 @@ switch(hardware.wakereason()) {
419417

420418
### getFifoStats()
421419

422-
This method returns information about the state of the FIFO buffer in a squirrel table:
420+
This method returns information about the state of the FIFO buffer in a Squirrel table with the following keys:
423421

424-
| Value | Type | Description |
422+
| Key | Type | Description |
425423
| --- | --- | --- | --- |
426424
| *watermark* | Boolean | `true` if watermark has been set |
427425
| *overrun* | Boolean | `true` if data has been overwritten without being read |

0 commit comments

Comments
 (0)