From 08f06d8039f330f03dd25b8a531f1aa35a684594 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Tue, 23 Feb 2010 18:43:43 +0000 Subject: [PATCH] Updated to new sensors API --- platform/netsim/dev/button-sensor.c | 8 ++++---- platform/netsim/dev/pir-sensor.c | 8 ++++---- platform/netsim/dev/radio-sensor.c | 18 ++++++------------ platform/netsim/dev/vib-sensor.c | 15 +++++++-------- 4 files changed, 21 insertions(+), 28 deletions(-) diff --git a/platform/netsim/dev/button-sensor.c b/platform/netsim/dev/button-sensor.c index da7c73349..82dba1de9 100644 --- a/platform/netsim/dev/button-sensor.c +++ b/platform/netsim/dev/button-sensor.c @@ -10,22 +10,22 @@ button_press(void) sensors_changed(&button_sensor); } /*---------------------------------------------------------------------------*/ -static unsigned int +static int value(int type) { return 0; } /*---------------------------------------------------------------------------*/ static int -configure(int type, void *c) +configure(int type, int value) { return 0; } /*---------------------------------------------------------------------------*/ -static void * +static int status(int type) { - return NULL; + return 0; } /*---------------------------------------------------------------------------*/ SENSORS_SENSOR(button_sensor, BUTTON_SENSOR, diff --git a/platform/netsim/dev/pir-sensor.c b/platform/netsim/dev/pir-sensor.c index 14d9ccb5f..f13b7cc41 100644 --- a/platform/netsim/dev/pir-sensor.c +++ b/platform/netsim/dev/pir-sensor.c @@ -13,22 +13,22 @@ pir_sensor_changed(int strength) sensors_changed(&pir_sensor); } /*---------------------------------------------------------------------------*/ -static unsigned int +static int value(int type) { return pir_value; } /*---------------------------------------------------------------------------*/ static int -configure(int type, void *c) +configure(int type, int c) { return 0; } /*---------------------------------------------------------------------------*/ -static void * +static int status(int type) { - return NULL; + return 0; } /*---------------------------------------------------------------------------*/ SENSORS_SENSOR(pir_sensor, PIR_SENSOR, diff --git a/platform/netsim/dev/radio-sensor.c b/platform/netsim/dev/radio-sensor.c index 0c69cc5ab..a77f966a9 100644 --- a/platform/netsim/dev/radio-sensor.c +++ b/platform/netsim/dev/radio-sensor.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: radio-sensor.c,v 1.2 2010/01/14 15:38:56 adamdunkels Exp $ + * @(#)$Id: radio-sensor.c,v 1.3 2010/02/23 18:43:43 adamdunkels Exp $ */ #include "lib/sensors.h" @@ -36,31 +36,25 @@ const struct sensors_sensor radio_sensor; -unsigned int radio_sensor_signal; +unsigned int radio_sensor_signal = 0; /*---------------------------------------------------------------------------*/ -static void -init(void) -{ - radio_sensor_signal = 0; -} -/*---------------------------------------------------------------------------*/ -static unsigned int +static int value(int type) { return radio_sensor_signal; } /*---------------------------------------------------------------------------*/ static int -configure(int type, void *c) +configure(int type, int c) { return 0; } /*---------------------------------------------------------------------------*/ -static void * +static int status(int type) { - return NULL; + return 0; } /*---------------------------------------------------------------------------*/ SENSORS_SENSOR(radio_sensor, RADIO_SENSOR, diff --git a/platform/netsim/dev/vib-sensor.c b/platform/netsim/dev/vib-sensor.c index 0c297179a..a70d9cb31 100644 --- a/platform/netsim/dev/vib-sensor.c +++ b/platform/netsim/dev/vib-sensor.c @@ -29,20 +29,19 @@ * This file is part of the Configurable Sensor Network Application * Architecture for sensor nodes running the Contiki operating system. * - * $Id: vib-sensor.c,v 1.2 2010/01/14 15:38:56 adamdunkels Exp $ + * $Id: vib-sensor.c,v 1.3 2010/02/23 18:43:43 adamdunkels Exp $ * * ----------------------------------------------------------------- * * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne * Created : 2005-11-01 - * Updated : $Date: 2010/01/14 15:38:56 $ - * $Revision: 1.2 $ + * Updated : $Date: 2010/02/23 18:43:43 $ + * $Revision: 1.3 $ */ #include "dev/vib-sensor.h" const struct sensors_sensor vib_sensor; -static unsigned int vib; /*---------------------------------------------------------------------------*/ void @@ -51,22 +50,22 @@ vib_sensor_changed(void) sensors_changed(&vib_sensor); } /*---------------------------------------------------------------------------*/ -static unsigned int +static int value(int type) { return 0; } /*---------------------------------------------------------------------------*/ static int -configure(int type, void *c) +configure(int type, int c) { return 0; } /*---------------------------------------------------------------------------*/ -static void * +static int status(int type) { - return NULL; + return 0; } /*---------------------------------------------------------------------------*/ SENSORS_SENSOR(vib_sensor, VIB_SENSOR,