Merge pull request #667 from Rehan-MALAK/minor-refactor-hdc-1000-sensor
minor refactoring of hdc-1000-sensor following commit f4a8cba37
This commit is contained in:
commit
350d1fcc51
@ -205,7 +205,7 @@ notify_ready(void *not_used)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \brief Returns a reading from the sensor
|
||||
* \param type HDC_1000_SENSOR_TYPE_TEMP or HDC_1000_SENSOR_TYPE_HUMIDITY
|
||||
* \param type HDC_1000_SENSOR_TYPE_TEMP or HDC_1000_SENSOR_TYPE_HUMID
|
||||
* \return Temperature (centi degrees C) or Humidity (centi %RH)
|
||||
*/
|
||||
static int
|
||||
@ -221,7 +221,7 @@ value(int type)
|
||||
}
|
||||
|
||||
if((type != HDC_1000_SENSOR_TYPE_TEMP) &&
|
||||
type != HDC_1000_SENSOR_TYPE_HUMIDITY) {
|
||||
type != HDC_1000_SENSOR_TYPE_HUMID) {
|
||||
PRINTF("Invalid type\n");
|
||||
return CC26XX_SENSOR_READING_ERROR;
|
||||
} else {
|
||||
@ -231,7 +231,7 @@ value(int type)
|
||||
|
||||
if(type == HDC_1000_SENSOR_TYPE_TEMP) {
|
||||
rv = (int)(temp * 100);
|
||||
} else if(type == HDC_1000_SENSOR_TYPE_HUMIDITY) {
|
||||
} else if(type == HDC_1000_SENSOR_TYPE_HUMID) {
|
||||
rv = (int)(hum * 100);
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@
|
||||
* and latch them. It will then generate a sensors_changed event.
|
||||
*
|
||||
* The user can then retrieve readings by calling .value() and by passing
|
||||
* either HDC_1000_SENSOR_TYPE_TEMP or HDC_1000_SENSOR_TYPE_HUMIDITY as the
|
||||
* either HDC_1000_SENSOR_TYPE_TEMP or HDC_1000_SENSOR_TYPE_HUMID as the
|
||||
* argument. Multiple calls to value() will not trigger new readings, they will
|
||||
* simply return the most recent latched values.
|
||||
*
|
||||
@ -65,7 +65,7 @@
|
||||
#include "lib/sensors.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define HDC_1000_SENSOR_TYPE_TEMP 1
|
||||
#define HDC_1000_SENSOR_TYPE_HUMIDITY 2
|
||||
#define HDC_1000_SENSOR_TYPE_HUMID 2
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name HDC1000 driver states
|
||||
|
@ -77,7 +77,7 @@ read_temp_value(const ipso_sensor_t *s, int32_t *value)
|
||||
static lwm2m_status_t
|
||||
read_hum_value(const ipso_sensor_t *s, int32_t *value)
|
||||
{
|
||||
*value = 10 * hdc_1000_sensor.value(HDC_1000_SENSOR_TYPE_HUMIDITY);
|
||||
*value = 10 * hdc_1000_sensor.value(HDC_1000_SENSOR_TYPE_HUMID);
|
||||
return LWM2M_STATUS_OK;
|
||||
}
|
||||
/* Lux reading */
|
||||
|
@ -203,7 +203,7 @@ get_hdc_reading()
|
||||
printf("HDC: Temp Read Error\n");
|
||||
}
|
||||
|
||||
value = hdc_1000_sensor.value(HDC_1000_SENSOR_TYPE_HUMIDITY);
|
||||
value = hdc_1000_sensor.value(HDC_1000_SENSOR_TYPE_HUMID);
|
||||
if(value != CC26XX_SENSOR_READING_ERROR) {
|
||||
printf("HDC: Humidity=%d.%02d %%RH\n", value / 100, value % 100);
|
||||
} else {
|
||||
|
@ -636,7 +636,7 @@ get_hdc_reading()
|
||||
}
|
||||
|
||||
if(hdc_hum_reading.publish) {
|
||||
value = hdc_1000_sensor.value(HDC_1000_SENSOR_TYPE_HUMIDITY);
|
||||
value = hdc_1000_sensor.value(HDC_1000_SENSOR_TYPE_HUMID);
|
||||
if(value != CC26XX_SENSOR_READING_ERROR) {
|
||||
hdc_hum_reading.raw = value;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user