Reformatted the README and fixed bug in documentation for reading out sensor data
This commit is contained in:
parent
313a58a9c5
commit
b619094dfe
34
README.md
34
README.md
@ -1,10 +1,13 @@
|
||||
# BME680 sensor API
|
||||
|
||||
## Introduction
|
||||
|
||||
This package contains the Bosch Sensortec's BME680 gas sensor API
|
||||
|
||||
The sensor driver package includes bme680.h, bme680.c and bme680_defs.h files
|
||||
|
||||
## Version
|
||||
|
||||
File | Version | Date
|
||||
--------------|---------|-------------
|
||||
bme680.c | 3.5.8 | 22 Feb 2018
|
||||
@ -12,28 +15,35 @@ bme680.h | 3.5.8 | 22 Feb 2018
|
||||
bme680_defs.h | 3.5.8 | 22 Feb 2018
|
||||
|
||||
## Integration details
|
||||
|
||||
* Integrate bme680.h, bme680_defs.h and bme680.c file in to your project.
|
||||
* Include the bme680.h file in your code like below.
|
||||
|
||||
``` c
|
||||
#include "bme680.h"
|
||||
```
|
||||
|
||||
## File information
|
||||
|
||||
* bme680_defs.h : This header file has the constants, macros and datatype declarations.
|
||||
* bme680.h : This header file contains the declarations of the sensor driver APIs.
|
||||
* bme680.c : This source file contains the definitions of the sensor driver APIs.
|
||||
|
||||
## Supported sensor interfaces
|
||||
|
||||
* SPI 4-wire
|
||||
* I2C
|
||||
|
||||
## Usage guide
|
||||
|
||||
### Initializing the sensor
|
||||
|
||||
To initialize the sensor, you will first need to create a device structure. You
|
||||
can do this by creating an instance of the structure bme680_dev. Then go on to
|
||||
fill in the various parameters as shown below
|
||||
|
||||
#### Example for SPI 4-Wire
|
||||
|
||||
``` c
|
||||
struct bme680_dev gas_sensor;
|
||||
|
||||
@ -53,6 +63,7 @@ fill in the various parameters as shown below
|
||||
```
|
||||
|
||||
#### Example for I2C
|
||||
|
||||
``` c
|
||||
struct bme680_dev gas_sensor;
|
||||
|
||||
@ -82,7 +93,9 @@ If the user needs the floating point version, the user has to un-comment BME680_
|
||||
in bme680_defs.h file or to add it in the compiler flags.
|
||||
|
||||
### Configuring the sensor
|
||||
|
||||
#### Example for configuring the sensor in forced mode
|
||||
|
||||
``` c
|
||||
uint8_t set_required_settings;
|
||||
|
||||
@ -112,20 +125,25 @@ in bme680_defs.h file or to add it in the compiler flags.
|
||||
/* Set the power mode */
|
||||
rslt = bme680_set_sensor_mode(&gas_sensor);
|
||||
|
||||
|
||||
```
|
||||
|
||||
### Reading sensor data
|
||||
|
||||
#### Example for reading all sensor data
|
||||
|
||||
``` c
|
||||
/* Get the total measurement duration so as to sleep or wait till the
|
||||
* measurement is complete */
|
||||
uint16_t meas_period;
|
||||
bme680_get_profile_dur(&meas_period, &gas_sensor);
|
||||
user_delay_ms(meas_period); /* Delay till the measurement is ready */
|
||||
```
|
||||
|
||||
### Reading sensor data
|
||||
#### Example for reading all sensor data
|
||||
``` c
|
||||
struct bme680_field_data data;
|
||||
|
||||
while(1)
|
||||
{
|
||||
user_delay_ms(meas_period); /* Delay till the measurement is ready */
|
||||
|
||||
rslt = bme680_get_sensor_data(&data, &gas_sensor);
|
||||
|
||||
printf("T: %.2f degC, P: %.2f hPa, H %.2f %%rH ", data.temperature / 100.0f,
|
||||
@ -135,10 +153,16 @@ in bme680_defs.h file or to add it in the compiler flags.
|
||||
printf(", G: %d ohms", data.gas_resistance);
|
||||
|
||||
printf("\r\n");
|
||||
|
||||
/* Trigger the next measurement if you would like to read data out continuously */
|
||||
if (gas_sensor.power_mode == BME680_FORCED_MODE) {
|
||||
rslt = bme680_set_sensor_mode(&gas_sensor);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Templates for function pointers
|
||||
|
||||
``` c
|
||||
|
||||
void user_delay_ms(uint32_t period)
|
||||
|
Loading…
Reference in New Issue
Block a user