Updated to match the new sensors API

This commit is contained in:
nifi 2010-01-15 11:02:18 +00:00
parent 758710cadd
commit c557f23bf4
2 changed files with 18 additions and 8 deletions

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)$Id: contiki-sky-main.c,v 1.9 2009/11/20 10:45:07 nifi Exp $ * @(#)$Id: contiki-sky-main.c,v 1.10 2010/01/15 11:02:18 nifi Exp $
*/ */
#include <signal.h> #include <signal.h>
@ -37,7 +37,10 @@
#include "contiki.h" #include "contiki.h"
#include "dev/battery-sensor.h"
#include "dev/button-sensor.h" #include "dev/button-sensor.h"
#include "dev/light-sensor.h"
#include "dev/sht11-sensor.h"
#include "dev/ds2411.h" #include "dev/ds2411.h"
#include "dev/sht11.h" #include "dev/sht11.h"
#include "dev/leds.h" #include "dev/leds.h"
@ -59,7 +62,7 @@
/*#include "codeprop/codeprop.h"*/ /*#include "codeprop/codeprop.h"*/
SENSORS(&button_sensor); SENSORS(&button_sensor, &light_sensor, &battery_sensor, &sht11_sensor);
extern int lpm_en; extern int lpm_en;
@ -138,10 +141,9 @@ main(int argc, char **argv)
#endif /* WITH_UIP */ #endif /* WITH_UIP */
printf("Starting %s " printf("Starting %s "
"($Id: contiki-sky-main.c,v 1.9 2009/11/20 10:45:07 nifi Exp $)\n", __FILE__); "($Id: contiki-sky-main.c,v 1.10 2010/01/15 11:02:18 nifi Exp $)\n", __FILE__);
ds2411_init(); ds2411_init();
sensors_light_init();
sht11_init();
xmem_init(); xmem_init();
leds_toggle(LEDS_RED | LEDS_GREEN | LEDS_BLUE); leds_toggle(LEDS_RED | LEDS_GREEN | LEDS_BLUE);
@ -172,6 +174,14 @@ main(int argc, char **argv)
process_init(); process_init();
process_start(&etimer_process, NULL); process_start(&etimer_process, NULL);
process_start(&sensors_process, NULL); process_start(&sensors_process, NULL);
/*
* Initialize light and humidity/temp sensors.
*/
SENSORS_ACTIVATE(light_sensor);
SENSORS_ACTIVATE(sht11_sensor);
ctimer_init(); ctimer_init();
set_rime_addr(); set_rime_addr();
@ -193,7 +203,7 @@ main(int argc, char **argv)
process_start(&slip_process, NULL); process_start(&slip_process, NULL);
#endif /* WITH_UIP */ #endif /* WITH_UIP */
button_sensor.activate(); SENSORS_ACTIVATE(button_sensor);
print_processes(autostart_processes); print_processes(autostart_processes);
autostart_start(autostart_processes); autostart_start(autostart_processes);

View File

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: energest-demo.c,v 1.8 2009/03/12 21:58:21 adamdunkels Exp $ * $Id: energest-demo.c,v 1.9 2010/01/15 11:02:18 nifi Exp $
*/ */
/** /**
@ -340,7 +340,7 @@ PROCESS_THREAD(user_process, ev, data)
printf("Node id %d\n", node_id); printf("Node id %d\n", node_id);
button_sensor.activate(); SENSORS_ACTIVATE(button_sensor);
state = RADIO_OFF; state = RADIO_OFF;
while(1) { while(1) {