From cc55197d52bac5892624e87d4210e8c6a60e54c6 Mon Sep 17 00:00:00 2001 From: nifi Date: Mon, 3 May 2010 22:02:59 +0000 Subject: [PATCH] Updated to use the platform 'jcreate' --- examples/jcreate/Makefile.target | 2 +- examples/jcreate/announce-blink.c | 31 ++++++--------------------- examples/jcreate/example-ext-sensor.c | 6 +----- examples/jcreate/jcreate-shell.c | 10 +++------ 4 files changed, 11 insertions(+), 38 deletions(-) diff --git a/examples/jcreate/Makefile.target b/examples/jcreate/Makefile.target index d56a50bcc..e60fcf4dc 100644 --- a/examples/jcreate/Makefile.target +++ b/examples/jcreate/Makefile.target @@ -1 +1 @@ -TARGET = sky +TARGET = jcreate diff --git a/examples/jcreate/announce-blink.c b/examples/jcreate/announce-blink.c index ed4fb00e5..daa772fe5 100644 --- a/examples/jcreate/announce-blink.c +++ b/examples/jcreate/announce-blink.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: announce-blink.c,v 1.2 2010/01/31 16:47:44 nifi Exp $ + * $Id: announce-blink.c,v 1.3 2010/05/03 22:02:59 nifi Exp $ */ /** @@ -42,11 +42,9 @@ #include "contiki-net.h" #include "shell.h" -#if CONTIKI_TARGET_SKY #include "dev/acc-sensor.h" -#include "dev/cc2420.h" #include "net/mac/xmac.h" -#endif /* CONTIKI_TARGET_SKY */ +#include "dev/leds.h" #include @@ -70,9 +68,7 @@ AUTOSTART_PROCESSES(&announce_blink_process); /*---------------------------------------------------------------------------*/ /* * This function takes the length of the neighbor table list and - * displays it on the on-board LEDs. There is currently no support for - * using 8 LEDs in the standard Contiki LED library, so we directly - * write to the LEDS_PxOUT variable. + * displays it on the on-board LEDs. */ static void show_leds(void) @@ -88,9 +84,8 @@ show_leds(void) } val >>= 1; -#if CONTIKI_TARGET_SKY - LEDS_PxOUT = ~val; -#endif /* CONTIKI_TARGET_SKY */ + leds_on(val & 0xff); + leds_off(~(val & 0xff)); } /*---------------------------------------------------------------------------*/ static void @@ -143,20 +138,11 @@ PROCESS_THREAD(announce_blink_process, ev, data) { PROCESS_BEGIN(); - /* XXX the Sentilla JCreate has 8 LEDs, and we need to set the ports - correctly. */ -#if CONTIKI_TARGET_SKY - LEDS_PxDIR = 0xff; - LEDS_PxOUT = 0xff; -#endif /* CONTIKI_TARGET_SKY */ - - announcement_register(&announcement, 80, 0, - received_announcement); + announcement_register(&announcement, 80, received_announcement); list_init(neighbor_table); memb_init(&neighbor_mem); -#if CONTIKI_TARGET_NATIVE { int i; for(i = 0; i < 10; ++i) { @@ -166,16 +152,13 @@ PROCESS_THREAD(announce_blink_process, ev, data) received_announcement(NULL, &r, 0, 0); } } -#endif /* CONTIKI_TARGET_NATIVE */ -#if CONTIKI_TARGET_SKY SENSORS_ACTIVATE(acc_sensor); /* Lower the transmission power for the announcements so that only close-range neighbors are noticed. (Makes for a nicer visual effect.) */ xmac_set_announcement_radio_txpower(1); -#endif /* CONTIKI_TARGET_SKY */ while(1) { static struct etimer e; @@ -183,12 +166,10 @@ PROCESS_THREAD(announce_blink_process, ev, data) etimer_set(&e, CLOCK_SECOND / 8); PROCESS_WAIT_EVENT(); -#if CONTIKI_TARGET_SKY if(acc_sensor.value(1) / 256 != last_value) { last_value = acc_sensor.value(1) / 256; announcement_listen(1); } -#endif /* CONTIKI_TARGET_SKY */ } PROCESS_END(); diff --git a/examples/jcreate/example-ext-sensor.c b/examples/jcreate/example-ext-sensor.c index eb9542b2b..a5657f7a8 100644 --- a/examples/jcreate/example-ext-sensor.c +++ b/examples/jcreate/example-ext-sensor.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: example-ext-sensor.c,v 1.1 2010/02/13 12:21:31 joxe Exp $ + * $Id: example-ext-sensor.c,v 1.2 2010/05/03 22:02:59 nifi Exp $ */ /** @@ -57,10 +57,6 @@ PROCESS_THREAD(ext_sensor_process, ev, data) static int time; PROCESS_BEGIN(); - /* The Sentilla JCreate has 8 LEDs, and we need to set the ports - correctly. */ - LEDS_PxDIR = 0xff; - LEDS_PxOUT = 0xff; SENSORS_ACTIVATE(ext_sensor); leds_invert(LEDS_ALL); diff --git a/examples/jcreate/jcreate-shell.c b/examples/jcreate/jcreate-shell.c index 80a8baf9f..00772390f 100644 --- a/examples/jcreate/jcreate-shell.c +++ b/examples/jcreate/jcreate-shell.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: jcreate-shell.c,v 1.5 2010/03/22 10:21:57 nifi Exp $ + * $Id: jcreate-shell.c,v 1.6 2010/05/03 22:02:59 nifi Exp $ */ /** @@ -186,7 +186,8 @@ PROCESS_THREAD(shell_leds_process, ev, data) for(i = 0; i < msg->acc[num] >> 9; ++i) { val = (val << 1) | 1; } - LEDS_PxOUT = ~val; + leds_on(val & 0xff); + leds_off(~(val & 0xff)); PROCESS_END(); } @@ -198,11 +199,6 @@ PROCESS_THREAD(sky_shell_process, ev, data) { PROCESS_BEGIN(); - /* XXX the Sentilla JCreate has 8 LEDs, and we need to set the ports - correctly. */ - LEDS_PxDIR = 0xff; - LEDS_PxOUT = 0xff; - serial_shell_init(); shell_blink_init(); shell_file_init();