Improve OPT sensor driver and usage

* Query the sensor about its state, rather than using variables in the driver
* Correctly put the sensor to deep sleep
* Fix doxygen comments
* Don't turn off the sensor in examples since it is no longer needed
This commit is contained in:
George Oikonomou 2015-05-01 16:03:48 +01:00
parent 3ab1b836c4
commit 00a6c31158
4 changed files with 105 additions and 51 deletions

View file

@ -574,8 +574,6 @@ get_light_reading()
value = opt_3001_sensor.value(0);
SENSORS_DEACTIVATE(opt_3001_sensor);
if(value != CC26XX_SENSOR_READING_ERROR) {
opt_reading.raw = value;
@ -587,6 +585,7 @@ get_light_reading()
value % 100);
}
/* The OPT will turn itself off, so we don't need to call its DEACTIVATE */
ctimer_set(&opt_timer, next, init_light_reading, NULL);
}
/*---------------------------------------------------------------------------*/