Added a function to the pressure sensor API to be able to know if a measurement is currently being made
This commit is contained in:
parent
f4ffc96d5a
commit
efae9a917e
@ -113,6 +113,16 @@ bool BMP280_trigger_measurement(void)
|
||||
return i2c_write_reg(BMP280_I2C_ADDR, BMP280_CTRL_MEAS, data);
|
||||
}
|
||||
|
||||
bool BMP280_is_measuring(void)
|
||||
{
|
||||
uint8_t data;
|
||||
|
||||
if(!i2c_read_reg(BMP280_I2C_ADDR, BMP280_STATUS, &data)) return false;
|
||||
|
||||
/* If bit 3 of the status register is 1, then a measurement is ongoing */
|
||||
return (data >> 3) & 0x01;
|
||||
}
|
||||
|
||||
float BMP280_get_temperature(void)
|
||||
{
|
||||
int32_t var1, var2;
|
||||
|
@ -110,6 +110,15 @@ bool BMP280_configure(BMP280_Mode_e mode, BMP280_Oversampling_e temperature_over
|
||||
*/
|
||||
bool BMP280_trigger_measurement(void);
|
||||
|
||||
/**
|
||||
* @brief Checks if the sensor is currently performing a measurement or not.
|
||||
* This can be useful to check if the measurement is ready after calling @ref BMP280_trigger_measurement.
|
||||
*
|
||||
* @return true if the sensor is currently performing a measurement.
|
||||
* @return false if the sensor is not, this means that the data is ready to be read.
|
||||
*/
|
||||
bool BMP280_is_measuring(void);
|
||||
|
||||
/**
|
||||
* @brief Returns the previously sampled temperature in °C.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user