Use the BMP in 'forced' mode and reduce startup delay
In forced mode, the BMP will turn itself off after a reading
This commit is contained in:
parent
3bbf3cc435
commit
cee6c190c5
2 changed files with 7 additions and 8 deletions
|
@ -136,7 +136,7 @@ static int enabled = SENSOR_STATUS_DISABLED;
|
|||
static uint8_t sensor_value[SENSOR_DATA_BUF_SIZE];
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Wait SENSOR_STARTUP_DELAY clock ticks for the sensor to be ready - ~80ms */
|
||||
#define SENSOR_STARTUP_DELAY 11
|
||||
#define SENSOR_STARTUP_DELAY 3
|
||||
|
||||
static struct ctimer startup_timer;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -187,7 +187,7 @@ enable_sensor(bool enable)
|
|||
|
||||
if(enable) {
|
||||
/* Enable forced mode */
|
||||
val = PM_NORMAL | OSRSP(1) | OSRST(1);
|
||||
val = PM_FORCED | OSRSP(1) | OSRST(1);
|
||||
} else {
|
||||
val = PM_OFF;
|
||||
}
|
||||
|
@ -345,6 +345,7 @@ configure(int type, int enable)
|
|||
case SENSORS_HW_INIT:
|
||||
enabled = SENSOR_STATUS_INITIALISED;
|
||||
init();
|
||||
enable_sensor(0);
|
||||
break;
|
||||
case SENSORS_ACTIVE:
|
||||
/* Must be initialised first */
|
||||
|
|
|
@ -42,12 +42,10 @@
|
|||
*
|
||||
* Once the sensor is stable, the driver will generate a sensors_changed event.
|
||||
*
|
||||
* Once a reading has been taken, the caller has two options:
|
||||
* - Turn the sensor off by calling SENSORS_DEACTIVATE, but in order to take
|
||||
* subsequent readings SENSORS_ACTIVATE must be called again
|
||||
* - Leave the sensor on. In this scenario, the caller can simply keep calling
|
||||
* value() for subsequent readings, but having the sensor on will consume
|
||||
* energy
|
||||
* We take readings in "Forced" mode. In this mode, the BMP will take a single
|
||||
* measurement and it will then automatically go to sleep.
|
||||
*
|
||||
* SENSORS_ACTIVATE must be called again to trigger a new reading cycle
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
|
|
Loading…
Reference in a new issue