diff --git a/platform/wismote/dev/acc-sensor.c b/platform/wismote/dev/acc-sensor.c index 6817b7de6..15ea5fd82 100644 --- a/platform/wismote/dev/acc-sensor.c +++ b/platform/wismote/dev/acc-sensor.c @@ -26,14 +26,10 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: acc-sensor.c,v 1.6 2010/01/14 20:01:18 nifi Exp $ - * * ----------------------------------------------------------------- * * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne * Created : 2005-11-01 - * Updated : $Date: 2010/01/14 20:01:18 $ - * $Revision: 1.6 $ */ #include "dev/acc-sensor.h" @@ -101,15 +97,15 @@ value(int type) } /*---------------------------------------------------------------------------*/ static int -configure(int type, int c) +configure(int type, int value) { - switch(type) { - case SENSORS_ACTIVE: - if (c) { + if(type == SENSORS_ACTIVE) { + if(value) { activate(); } else { deactivate(); } + return 1; } return 0; } @@ -121,8 +117,9 @@ status(int type) case SENSORS_ACTIVE: case SENSORS_READY: return active; + default: + return 0; } - return 0; } /*---------------------------------------------------------------------------*/ SENSORS_SENSOR(acc_sensor, ACC_SENSOR, diff --git a/platform/wismote/dev/acc-sensor.h b/platform/wismote/dev/acc-sensor.h index b10ae214a..89df783a8 100644 --- a/platform/wismote/dev/acc-sensor.h +++ b/platform/wismote/dev/acc-sensor.h @@ -26,14 +26,10 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: acc-sensor.h,v 1.1 2009/01/15 21:06:02 adamdunkels Exp $ - * * ----------------------------------------------------------------- * * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne * Created : 2005-11-01 - * Updated : $Date: 2009/01/15 21:06:02 $ - * $Revision: 1.1 $ */ #ifndef __ACC_SENSOR_H__ diff --git a/platform/wismote/dev/button-sensor.c b/platform/wismote/dev/button-sensor.c index 0456356ba..51bf38c2f 100644 --- a/platform/wismote/dev/button-sensor.c +++ b/platform/wismote/dev/button-sensor.c @@ -51,12 +51,10 @@ interrupt(PORT2_VECTOR) { ENERGEST_ON(ENERGEST_TYPE_IRQ); - if(BUTTON_CHECK_IRQ()) { - if(timer_expired(&debouncetimer)) { - timer_set(&debouncetimer, CLOCK_SECOND / 4); - sensors_changed(&button_sensor); - LPM4_EXIT; - } + if(BUTTON_CHECK_IRQ() && timer_expired(&debouncetimer)) { + timer_set(&debouncetimer, CLOCK_SECOND / 4); + sensors_changed(&button_sensor); + LPM4_EXIT; } P2IFG = 0x00; ENERGEST_OFF(ENERGEST_TYPE_IRQ); @@ -69,11 +67,14 @@ value(int type) } /*---------------------------------------------------------------------------*/ static int -configure(int type, int c) +configure(int type, int value) { - switch (type) { - case SENSORS_ACTIVE: - if (c) { + if(type == SENSORS_ACTIVE) { + if(value == 0) { + /* Deactivate button sensor */ + BUTTON_DISABLE_IRQ(); + } else { + /* Activate button sensor */ if(!status(SENSORS_ACTIVE)) { timer_set(&debouncetimer, 0); BUTTON_IRQ_EDGE_SELECTD(); @@ -83,8 +84,6 @@ configure(int type, int c) BUTTON_ENABLE_IRQ(); } - } else { - BUTTON_DISABLE_IRQ(); } return 1; } @@ -94,12 +93,13 @@ configure(int type, int c) static int status(int type) { - switch (type) { + switch(type) { case SENSORS_ACTIVE: case SENSORS_READY: return BUTTON_IRQ_ENABLED(); + default: + return 0; } - return 0; } /*---------------------------------------------------------------------------*/ SENSORS_SENSOR(button_sensor, BUTTON_SENSOR, diff --git a/platform/wismote/dev/ext-sensor.c b/platform/wismote/dev/ext-sensor.c index 42a8e7ed1..a957e5232 100644 --- a/platform/wismote/dev/ext-sensor.c +++ b/platform/wismote/dev/ext-sensor.c @@ -26,15 +26,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ext-sensor.c,v 1.3 2010/02/13 11:20:48 joxe Exp $ - * * ----------------------------------------------------------------- * * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne, Marcus Lundén, * Jesper Karlsson * Created : 2005-11-01 - * Updated : $Date: 2010/02/13 11:20:48 $ - * $Revision: 1.3 $ */ #include "contiki.h" @@ -66,11 +62,12 @@ static int status(int type) { switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return active; + case SENSORS_ACTIVE: + case SENSORS_READY: + return active; + default: + return 0; } - return 0; } /*---------------------------------------------------------------------------*/ static int @@ -97,8 +94,10 @@ configure(int type, int c) sky_sensors_deactivate(0x0F); active = 0; } + return 1; + default: + return 0; } - return 0; } /*---------------------------------------------------------------------------*/ SENSORS_SENSOR(ext_sensor, "Ext", diff --git a/platform/wismote/dev/ext-sensor.h b/platform/wismote/dev/ext-sensor.h index 8fed8b59f..e9248144d 100644 --- a/platform/wismote/dev/ext-sensor.h +++ b/platform/wismote/dev/ext-sensor.h @@ -26,14 +26,10 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ext-sensor.h,v 1.2 2010/02/13 11:20:48 joxe Exp $ - * * ----------------------------------------------------------------- * * Author : Marcus Lundén * Created : 2005-11-01 - * Updated : $Date: 2010/02/13 11:20:48 $ - * $Revision: 1.2 $ */ #ifndef __EXT_SENSOR_H__