mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
driver/bme280: add dependencies on temperature for pressure and humidity
This commit is contained in:
parent
568e551c9b
commit
973d9fd54b
@ -355,10 +355,11 @@ int16_t bmx280_read_temperature(bmx280_t *dev)
|
||||
return (dev->t_fine * 5 + 128) >> 8;
|
||||
}
|
||||
|
||||
uint32_t bmx280_read_pressure(const bmx280_t *dev)
|
||||
uint32_t bmx280_read_pressure(bmx280_t *dev)
|
||||
{
|
||||
assert(dev);
|
||||
|
||||
bmx280_read_temperature(dev);
|
||||
const bmx280_calibration_t *cal = &dev->calibration; /* helper variable */
|
||||
|
||||
/* Read the uncompensated pressure */
|
||||
@ -397,10 +398,11 @@ uint32_t bmx280_read_pressure(const bmx280_t *dev)
|
||||
}
|
||||
|
||||
#if defined(MODULE_BME280_SPI) || defined(MODULE_BME280_I2C)
|
||||
uint16_t bme280_read_humidity(const bmx280_t *dev)
|
||||
uint16_t bme280_read_humidity(bmx280_t *dev)
|
||||
{
|
||||
assert(dev);
|
||||
|
||||
bmx280_read_temperature(dev);
|
||||
const bmx280_calibration_t *cal = &dev->calibration; /* helper variable */
|
||||
|
||||
/* Read the uncompensated pressure */
|
||||
|
@ -35,7 +35,7 @@ static int read_temperature(const void *dev, phydat_t *res)
|
||||
|
||||
static int read_pressure(const void *dev, phydat_t *res)
|
||||
{
|
||||
res->val[0] = bmx280_read_pressure((const bmx280_t *)dev) / 100;
|
||||
res->val[0] = bmx280_read_pressure((bmx280_t *)dev) / 100;
|
||||
res->unit = UNIT_PA;
|
||||
res->scale = 2;
|
||||
|
||||
@ -45,7 +45,7 @@ static int read_pressure(const void *dev, phydat_t *res)
|
||||
#if defined(MODULE_BME280_SPI) || defined(MODULE_BME280_I2C)
|
||||
static int read_relative_humidity(const void *dev, phydat_t *res)
|
||||
{
|
||||
res->val[0] = bme280_read_humidity((const bmx280_t *)dev);
|
||||
res->val[0] = bme280_read_humidity((bmx280_t *)dev);
|
||||
res->unit = UNIT_PERCENT;
|
||||
res->scale = -2;
|
||||
|
||||
|
@ -283,7 +283,7 @@ int16_t bmx280_read_temperature(bmx280_t* dev);
|
||||
*
|
||||
* @return air pressure in PA
|
||||
*/
|
||||
uint32_t bmx280_read_pressure(const bmx280_t *dev);
|
||||
uint32_t bmx280_read_pressure(bmx280_t *dev);
|
||||
|
||||
#if defined(MODULE_BME280_SPI) || defined(MODULE_BME280_I2C) || defined(DOXYGEN)
|
||||
/**
|
||||
@ -302,7 +302,7 @@ uint32_t bmx280_read_pressure(const bmx280_t *dev);
|
||||
*
|
||||
* @return humidity in centi %RH (i.e. the percentage times 100)
|
||||
*/
|
||||
uint16_t bme280_read_humidity(const bmx280_t *dev);
|
||||
uint16_t bme280_read_humidity(bmx280_t *dev);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
Reference in New Issue
Block a user