Skip to content

Commit b1d8533

Browse files
committed
docs(README): Add reference to constants
1 parent 77366e9 commit b1d8533

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,31 @@ readPressure(): Promise<number>
167167
Read temperature returns the celsius degrees.
168168
Read pressure returns the pressure in Pascals.
169169

170+
### Constants
171+
172+
In case that you want or need to work with lower level method, the module exposes several constants to work with:
173+
174+
- [`REGISTERS`](https://alejandroherr.github.io/async-bmp280/globals.html#registers)
175+
- [`MASKS`](https://alejandroherr.github.io/async-bmp280/globals.html#masks)
176+
- [`OFFSETS`](https://alejandroherr.github.io/async-bmp280/globals.html#offsets)
177+
- [`OVERSAMPLING`](https://alejandroherr.github.io/async-bmp280/globals.html#oversampling)
178+
- [`MODE`](https://alejandroherr.github.io/async-bmp280/globals.html#mode)
179+
- [`STANDBY_TIME`](https://alejandroherr.github.io/async-bmp280/globals.html#standby_time)
180+
- [`IIR_FILTER`](https://alejandroherr.github.io/async-bmp280/globals.html#iir_filter)
181+
182+
Example:
183+
184+
```javascript
185+
// ...
186+
await bmp280.writeByte(
187+
REGISTERS.CTRL_MEAS,
188+
(OVERSAMPLING.x1 << OFFSETS.OSRS_T) | (OVERSAMPLING.x1 << OFFSETS.OSRS_P) | MODE.NORMAL,
189+
);
190+
191+
const ctrlMeas = await bmp280.readByte(REGISTERS.CTRL_MEAS);
192+
const temperatureOversampling = (ctrlMeas & MASKS.OSRS_T) >>> OFFSETS.OSRS_T;
193+
```
194+
170195
### Full example of `NORMAL` (mode) usage
171196

172197
```javascript

0 commit comments

Comments
 (0)