Skip to content

Commit 3ddf12e

Browse files
committed
integrate fixes from pull-request boschsensortec#82
1 parent c47f06e commit 3ddf12e

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ The sensor driver package includes bme280.c, bme280.h and bme280_defs.h files.
2424
SPI 3-wire is currently not supported in the API.
2525
## Usage guide
2626
### 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
2929
need to fill in the various parameters as shown below.
3030

3131
#### Example for SPI 4-Wire
@@ -40,7 +40,7 @@ dev.intf_ptr = &dev_addr;
4040
dev.intf = BME280_SPI_INTF;
4141
dev.read = user_spi_read;
4242
dev.write = user_spi_write;
43-
dev.delay_ms = user_delay_ms;
43+
dev.delay_us = user_delay_us;
4444

4545
rslt = bme280_init(&dev);
4646
```
@@ -54,7 +54,7 @@ dev.intf_ptr = &dev_addr;
5454
dev.intf = BME280_I2C_INTF;
5555
dev.read = user_i2c_read;
5656
dev.write = user_i2c_write;
57-
dev.delay_ms = user_delay_ms;
57+
dev.delay_us = user_delay_us;
5858

5959
rslt = bme280_init(&dev);
6060
```
@@ -72,7 +72,7 @@ By default, 64 bit variant is used in the API. If the user wants 32 bit variant,
7272
macro BME280_64BIT_ENABLE in bme280_defs.h file.
7373

7474
### 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,
7676
> (in bme280_defs.h file or as compiler macros)
7777
> * BME280_FLOAT_ENABLE
7878
> * BME280_64BIT_ENABLE
@@ -112,7 +112,7 @@ int8_t stream_sensor_data_forced_mode(struct bme280_dev *dev)
112112
settings_sel = BME280_OSR_PRESS_SEL | BME280_OSR_TEMP_SEL | BME280_OSR_HUM_SEL | BME280_FILTER_SEL;
113113

114114
rslt = bme280_set_sensor_settings(settings_sel, dev);
115-
115+
116116
/*Calculate the minimum delay required between consecutive measurement based upon the sensor enabled
117117
* and the oversampling configuration. */
118118
req_delay = bme280_cal_meas_delay(&dev->settings);
@@ -122,7 +122,7 @@ int8_t stream_sensor_data_forced_mode(struct bme280_dev *dev)
122122
while (1) {
123123
rslt = bme280_set_sensor_mode(BME280_FORCED_MODE, dev);
124124
/* 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);
126126
rslt = bme280_get_sensor_data(BME280_ALL, &comp_data, dev);
127127
print_sensor_data(&comp_data);
128128
}
@@ -164,7 +164,7 @@ int8_t stream_sensor_data_normal_mode(struct bme280_dev *dev)
164164
printf("Temperature, Pressure, Humidity\r\n");
165165
while (1) {
166166
/* Delay while the sensor completes a measurement */
167-
dev->delay_ms(70, dev->intf_ptr);
167+
dev->delay_us(70, dev->intf_ptr);
168168
rslt = bme280_get_sensor_data(BME280_ALL, &comp_data, dev);
169169
print_sensor_data(&comp_data);
170170
}
@@ -185,11 +185,11 @@ void print_sensor_data(struct bme280_data *comp_data)
185185
### Templates for function pointers
186186
``` c
187187

188-
void user_delay_ms(uint32_t period, void *intf_ptr)
188+
void user_delay_us(uint32_t period, void *intf_ptr)
189189
{
190190
/*
191191
* Return control or wait,
192-
* for a period amount of milliseconds
192+
* for a period amount of microseconds
193193
*/
194194
}
195195

@@ -219,7 +219,7 @@ int8_t user_spi_read(uint8_t reg_addr, uint8_t *reg_data, uint32_t len, void *in
219219
return rslt;
220220
}
221221

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)
223223
{
224224
int8_t rslt = 0; /* Return 0 for Success, non-zero for failure */
225225

@@ -272,7 +272,7 @@ int8_t user_i2c_read(uint8_t reg_addr, uint8_t *reg_data, uint32_t len, void *in
272272
return rslt;
273273
}
274274

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)
276276
{
277277
int8_t rslt = 0; /* Return 0 for Success, non-zero for failure */
278278

bme280.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ int8_t bme280_compensate_data(uint8_t sensor_comp,
850850
}
851851

852852
/*!
853-
* @brief This API is used to calculate the maximum delay in milliseconds required for the
853+
* @brief This API is used to calculate the maximum delay in microseconds required for the
854854
* temperature/pressure/humidity(which ever at enabled) measurement to complete.
855855
*/
856856
uint32_t bme280_cal_meas_delay(const struct bme280_settings *settings)

bme280.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -377,13 +377,13 @@ int8_t bme280_compensate_data(uint8_t sensor_comp,
377377
* \code
378378
* uint32_t bme280_cal_meas_delay(const struct bme280_settings *settings);
379379
* \endcode
380-
* @brief This API is used to calculate the maximum delay in milliseconds required for the
380+
* @brief This API is used to calculate the maximum delay in microseconds required for the
381381
* temperature/pressure/humidity(which ever are enabled) measurement to complete.
382382
* The delay depends upon the number of sensors enabled and their oversampling configuration.
383383
*
384384
* @param[in] settings : contains the oversampling configurations.
385385
*
386-
* @return delay required in milliseconds.
386+
* @return delay required in microseconds.
387387
*
388388
*/
389389
uint32_t bme280_cal_meas_delay(const struct bme280_settings *settings);

bme280_defs.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@
218218
#define BME280_MEAS_OFFSET UINT16_C(1250)
219219
#define BME280_MEAS_DUR UINT16_C(2300)
220220
#define BME280_PRES_HUM_MEAS_OFFSET UINT16_C(575)
221-
#define BME280_MEAS_SCALING_FACTOR UINT16_C(1000)
221+
#define BME280_MEAS_SCALING_FACTOR UINT16_C(1)
222222

223223
/**\name Standby duration selection macros */
224224
#define BME280_STANDBY_TIME_0_5_MS (0x00)

0 commit comments

Comments
 (0)