@@ -24,8 +24,8 @@ The sensor driver package includes bme280.c, bme280.h and bme280_defs.h files.
24
24
SPI 3-wire is currently not supported in the API.
25
25
## Usage guide
26
26
### Initializing the sensor
27
- To initialize the sensor, user need to create a device structure. User can do this by
28
- creating an instance of the structure bme280_dev. After creating the device strcuture, user
27
+ To initialize the sensor, user need to create a device structure. User can do this by
28
+ creating an instance of the structure bme280_dev. After creating the device strcuture, user
29
29
need to fill in the various parameters as shown below.
30
30
31
31
#### Example for SPI 4-Wire
@@ -40,7 +40,7 @@ dev.intf_ptr = &dev_addr;
40
40
dev.intf = BME280_SPI_INTF;
41
41
dev.read = user_spi_read;
42
42
dev.write = user_spi_write;
43
- dev.delay_ms = user_delay_ms ;
43
+ dev.delay_us = user_delay_us ;
44
44
45
45
rslt = bme280_init(&dev);
46
46
```
@@ -54,7 +54,7 @@ dev.intf_ptr = &dev_addr;
54
54
dev.intf = BME280_I2C_INTF;
55
55
dev.read = user_i2c_read;
56
56
dev.write = user_i2c_write;
57
- dev.delay_ms = user_delay_ms ;
57
+ dev.delay_us = user_delay_us ;
58
58
59
59
rslt = bme280_init(&dev);
60
60
```
@@ -72,7 +72,7 @@ By default, 64 bit variant is used in the API. If the user wants 32 bit variant,
72
72
macro BME280_64BIT_ENABLE in bme280_defs.h file.
73
73
74
74
### Sensor data units
75
- > The sensor data units depends on the following macros being enabled or not,
75
+ > The sensor data units depends on the following macros being enabled or not,
76
76
> (in bme280_defs.h file or as compiler macros)
77
77
> * BME280_FLOAT_ENABLE
78
78
> * BME280_64BIT_ENABLE
@@ -112,7 +112,7 @@ int8_t stream_sensor_data_forced_mode(struct bme280_dev *dev)
112
112
settings_sel = BME280_OSR_PRESS_SEL | BME280_OSR_TEMP_SEL | BME280_OSR_HUM_SEL | BME280_FILTER_SEL;
113
113
114
114
rslt = bme280_set_sensor_settings(settings_sel, dev);
115
-
115
+
116
116
/*Calculate the minimum delay required between consecutive measurement based upon the sensor enabled
117
117
* and the oversampling configuration. */
118
118
req_delay = bme280_cal_meas_delay(&dev->settings);
@@ -122,7 +122,7 @@ int8_t stream_sensor_data_forced_mode(struct bme280_dev *dev)
122
122
while (1) {
123
123
rslt = bme280_set_sensor_mode(BME280_FORCED_MODE, dev);
124
124
/* Wait for the measurement to complete and print data @25Hz */
125
- dev->delay_ms (req_delay, dev->intf_ptr);
125
+ dev->delay_us (req_delay, dev->intf_ptr);
126
126
rslt = bme280_get_sensor_data(BME280_ALL, &comp_data, dev);
127
127
print_sensor_data(&comp_data);
128
128
}
@@ -164,7 +164,7 @@ int8_t stream_sensor_data_normal_mode(struct bme280_dev *dev)
164
164
printf("Temperature, Pressure, Humidity\r\n");
165
165
while (1) {
166
166
/* Delay while the sensor completes a measurement */
167
- dev->delay_ms (70, dev->intf_ptr);
167
+ dev->delay_us (70, dev->intf_ptr);
168
168
rslt = bme280_get_sensor_data(BME280_ALL, &comp_data, dev);
169
169
print_sensor_data(&comp_data);
170
170
}
@@ -185,11 +185,11 @@ void print_sensor_data(struct bme280_data *comp_data)
185
185
### Templates for function pointers
186
186
``` c
187
187
188
- void user_delay_ms (uint32_t period, void * intf_ptr)
188
+ void user_delay_us (uint32_t period, void * intf_ptr)
189
189
{
190
190
/*
191
191
* Return control or wait,
192
- * for a period amount of milliseconds
192
+ * for a period amount of microseconds
193
193
* /
194
194
}
195
195
@@ -219,7 +219,7 @@ int8_t user_spi_read(uint8_t reg_addr, uint8_t *reg_data, uint32_t len, void *in
219
219
return rslt;
220
220
}
221
221
222
- int8_t user_spi_write(uint8_t reg_addr, uint8_t * reg_data, uint32_t len, void * intf_ptr)
222
+ int8_t user_spi_write(uint8_t reg_addr, const uint8_t * reg_data, uint32_t len, void * intf_ptr)
223
223
{
224
224
int8_t rslt = 0; /* Return 0 for Success, non-zero for failure * /
225
225
@@ -272,7 +272,7 @@ int8_t user_i2c_read(uint8_t reg_addr, uint8_t *reg_data, uint32_t len, void *in
272
272
return rslt;
273
273
}
274
274
275
- int8_t user_i2c_write(uint8_t reg_addr, uint8_t * reg_data, uint32_t len, void * intf_ptr)
275
+ int8_t user_i2c_write(uint8_t reg_addr, const uint8_t * reg_data, uint32_t len, void * intf_ptr)
276
276
{
277
277
int8_t rslt = 0; /* Return 0 for Success, non-zero for failure * /
278
278
0 commit comments