Updated to match the new sensors API
This commit is contained in:
parent
c5508f9f88
commit
a7f8761978
4 changed files with 17 additions and 19 deletions
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: beeper.c,v 1.2 2006/06/21 12:40:14 nifi Exp $
|
* @(#)$Id: beeper.c,v 1.3 2010/01/15 10:37:04 nifi Exp $
|
||||||
*/
|
*/
|
||||||
#include "contiki-esb.h"
|
#include "contiki-esb.h"
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ PROCESS_THREAD(beeper_process, ev, data)
|
||||||
etimer_set(&etimer, CLOCK_SECOND / 2);
|
etimer_set(&etimer, CLOCK_SECOND / 2);
|
||||||
PT_INIT(&beeper_pt);
|
PT_INIT(&beeper_pt);
|
||||||
|
|
||||||
button_sensor.activate();
|
button_sensor.configure(SENSORS_ACTIVE, 1);
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: pinger.c,v 1.1 2006/06/18 07:48:48 adamdunkels Exp $
|
* @(#)$Id: pinger.c,v 1.2 2010/01/15 10:37:04 nifi Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki-esb.h"
|
#include "contiki-esb.h"
|
||||||
|
@ -124,8 +124,7 @@ PT_THREAD(config_thread(struct pt *pt, process_event_t ev, process_data_t data))
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
|
|
||||||
PT_WAIT_UNTIL(pt, ev == sensors_event &&
|
PT_WAIT_UNTIL(pt, ev == sensors_event && data == &button_sensor);
|
||||||
(struct sensors_sensor *)data == &button_sensor);
|
|
||||||
|
|
||||||
beep();
|
beep();
|
||||||
|
|
||||||
|
@ -134,8 +133,7 @@ PT_THREAD(config_thread(struct pt *pt, process_event_t ev, process_data_t data))
|
||||||
etimer_set(&pushtimer, CLOCK_SECOND);
|
etimer_set(&pushtimer, CLOCK_SECOND);
|
||||||
for(counter = 0; !etimer_expired(&pushtimer); ++counter) {
|
for(counter = 0; !etimer_expired(&pushtimer); ++counter) {
|
||||||
etimer_restart(&pushtimer);
|
etimer_restart(&pushtimer);
|
||||||
PT_YIELD_UNTIL(pt, (ev == sensors_event &&
|
PT_YIELD_UNTIL(pt, (ev == sensors_event && data == &button_sensor) ||
|
||||||
(struct sensors_sensor *)data == &button_sensor) ||
|
|
||||||
etimer_expired(&pushtimer));
|
etimer_expired(&pushtimer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +171,7 @@ PROCESS_THREAD(pinger, ev, data)
|
||||||
|
|
||||||
PT_INIT(&config_pt);
|
PT_INIT(&config_pt);
|
||||||
|
|
||||||
button_sensor.activate();
|
button_sensor.configure(SENSORS_ACTIVE, 1);
|
||||||
|
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: sensor-output.c,v 1.3 2007/10/26 12:37:48 joxe Exp $
|
* @(#)$Id: sensor-output.c,v 1.4 2010/01/15 10:37:04 nifi Exp $
|
||||||
*/
|
*/
|
||||||
#include "contiki-esb.h"
|
#include "contiki-esb.h"
|
||||||
|
|
||||||
|
@ -46,9 +46,9 @@ PROCESS_THREAD(sensor_output_process, ev, data)
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
/* Activate some sensors to get sensor events */
|
/* Activate some sensors to get sensor events */
|
||||||
button_sensor.activate();
|
button_sensor.configure(SENSORS_ACTIVE, 1);
|
||||||
pir_sensor.activate();
|
pir_sensor.configure(SENSORS_ACTIVE, 1);
|
||||||
vib_sensor.activate();
|
vib_sensor.configure(SENSORS_ACTIVE, 1);
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event);
|
PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event);
|
||||||
|
|
|
@ -29,35 +29,35 @@
|
||||||
* This file is part of the Configurable Sensor Network Application
|
* This file is part of the Configurable Sensor Network Application
|
||||||
* Architecture for sensor nodes running the Contiki operating system.
|
* Architecture for sensor nodes running the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: dummy-sensors.c,v 1.3 2010/01/15 08:50:39 adamdunkels Exp $
|
* $Id: dummy-sensors.c,v 1.4 2010/01/15 10:34:36 nifi Exp $
|
||||||
*
|
*
|
||||||
* -----------------------------------------------------------------
|
* -----------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne
|
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne
|
||||||
* Created : 2005-11-01
|
* Created : 2005-11-01
|
||||||
* Updated : $Date: 2010/01/15 08:50:39 $
|
* Updated : $Date: 2010/01/15 10:34:36 $
|
||||||
* $Revision: 1.3 $
|
* $Revision: 1.4 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dev/temperature-sensor.h"
|
#include "dev/temperature-sensor.h"
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static unsigned int
|
static int
|
||||||
value(int type)
|
value(int type)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int
|
static int
|
||||||
configure(int type, void *c)
|
configure(int type, int c)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void *
|
static int
|
||||||
status(int type)
|
status(int type)
|
||||||
{
|
{
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
SENSORS_SENSOR(temperature_sensor, TEMPERATURE_SENSOR,
|
SENSORS_SENSOR(temperature_sensor, TEMPERATURE_SENSOR,
|
||||||
|
|
Loading…
Reference in a new issue