From 9f9012bbcf7629dbd1be8dda4de18aaa4216f3a1 Mon Sep 17 00:00:00 2001 From: cr0wg4n Date: Wed, 11 Nov 2020 22:38:46 -0400 Subject: [PATCH 1/2] fix: delay_ms does not exists in the bme280_dev struct --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0a0e398..147a05f 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ dev.intf_ptr = &dev_addr; dev.intf = BME280_SPI_INTF; dev.read = user_spi_read; dev.write = user_spi_write; -dev.delay_ms = user_delay_ms; +dev.delay_us = user_delay_ms; rslt = bme280_init(&dev); ``` @@ -54,7 +54,7 @@ dev.intf_ptr = &dev_addr; dev.intf = BME280_I2C_INTF; dev.read = user_i2c_read; dev.write = user_i2c_write; -dev.delay_ms = user_delay_ms; +dev.delay_us = user_delay_ms; rslt = bme280_init(&dev); ``` @@ -122,7 +122,7 @@ int8_t stream_sensor_data_forced_mode(struct bme280_dev *dev) while (1) { rslt = bme280_set_sensor_mode(BME280_FORCED_MODE, dev); /* Wait for the measurement to complete and print data @25Hz */ - dev->delay_ms(req_delay, dev->intf_ptr); + dev->delay_us(req_delay, dev->intf_ptr); rslt = bme280_get_sensor_data(BME280_ALL, &comp_data, dev); print_sensor_data(&comp_data); } @@ -164,7 +164,7 @@ int8_t stream_sensor_data_normal_mode(struct bme280_dev *dev) printf("Temperature, Pressure, Humidity\r\n"); while (1) { /* Delay while the sensor completes a measurement */ - dev->delay_ms(70, dev->intf_ptr); + dev->delay_us(70, dev->intf_ptr); rslt = bme280_get_sensor_data(BME280_ALL, &comp_data, dev); print_sensor_data(&comp_data); } From 2e01b10a4452dd665344aa6b370180246112daed Mon Sep 17 00:00:00 2001 From: cr0wg4n Date: Wed, 11 Nov 2020 22:45:23 -0400 Subject: [PATCH 2/2] fix: removing const in reg_data argument at bme280_write_fptr_t method, because introduce invalid conversion errors at the compilation time --- bme280_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bme280_defs.h b/bme280_defs.h index 686ba6a..b1f6d36 100644 --- a/bme280_defs.h +++ b/bme280_defs.h @@ -286,7 +286,7 @@ typedef BME280_INTF_RET_TYPE (*bme280_read_fptr_t)(uint8_t reg_addr, uint8_t *re * @retval Non zero value -> Fail. * */ -typedef BME280_INTF_RET_TYPE (*bme280_write_fptr_t)(uint8_t reg_addr, const uint8_t *reg_data, uint32_t len, +typedef BME280_INTF_RET_TYPE (*bme280_write_fptr_t)(uint8_t reg_addr, uint8_t *reg_data, uint32_t len, void *intf_ptr); /*!