Added the battery indicator to the sensors API
This commit is contained in:
parent
2f19892f74
commit
e455ef3533
2 changed files with 12 additions and 8 deletions
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* @(#)$Id: sht11-sensor.c,v 1.1 2010/01/14 20:16:33 adamdunkels Exp $
|
||||
* @(#)$Id: sht11-sensor.c,v 1.2 2010/01/15 08:51:21 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -59,7 +59,10 @@ value(int type)
|
|||
/* Total Solar Radiation. */
|
||||
case SHT11_SENSOR_HUMIDITY:
|
||||
return sht11_humidity();
|
||||
}
|
||||
|
||||
case SHT11_SENSOR_BATTERY_INDICATOR:
|
||||
return sht11_sreg() & 0x40? 1: 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -76,7 +79,7 @@ status(int type)
|
|||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int
|
||||
configure(int type, void *c)
|
||||
configure(int type, int c)
|
||||
{
|
||||
switch(type) {
|
||||
case SENSORS_ACTIVE:
|
||||
|
|
|
@ -27,14 +27,14 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* $Id: sht11-sensor.h,v 1.1 2010/01/14 20:16:33 adamdunkels Exp $
|
||||
* $Id: sht11-sensor.h,v 1.2 2010/01/15 08:51:21 adamdunkels Exp $
|
||||
*
|
||||
* -----------------------------------------------------------------
|
||||
*
|
||||
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne
|
||||
* Created : 2010-01-08
|
||||
* Updated : $Date: 2010/01/14 20:16:33 $
|
||||
* $Revision: 1.1 $
|
||||
* Updated : $Date: 2010/01/15 08:51:21 $
|
||||
* $Revision: 1.2 $
|
||||
*/
|
||||
|
||||
#ifndef __SHT11_SENSOR_H__
|
||||
|
@ -44,8 +44,9 @@
|
|||
|
||||
extern const struct sensors_sensor sht11_sensor;
|
||||
|
||||
#define SHT11_SENSOR_TEMP 0
|
||||
#define SHT11_SENSOR_HUMIDITY 1
|
||||
#define SHT11_SENSOR_TEMP 0
|
||||
#define SHT11_SENSOR_HUMIDITY 1
|
||||
#define SHT11_SENSOR_BATTERY_INDICATOR 2
|
||||
|
||||
|
||||
#endif /* __SHT11-SENSOR_H__ */
|
||||
|
|
Loading…
Reference in a new issue