From 624692901694693b0604d0a7fbc296d13f700761 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Mon, 18 Nov 2013 23:45:35 +0100 Subject: [PATCH] Removed old unused jcreate platform examples --- examples/jcreate/Makefile | 24 --- examples/jcreate/Makefile.target | 1 - examples/jcreate/announce-blink.c | 176 -------------------- examples/jcreate/example-ext-sensor.c | 87 ---------- examples/jcreate/jcreate-shell.c | 227 -------------------------- 5 files changed, 515 deletions(-) delete mode 100644 examples/jcreate/Makefile delete mode 100644 examples/jcreate/Makefile.target delete mode 100644 examples/jcreate/announce-blink.c delete mode 100644 examples/jcreate/example-ext-sensor.c delete mode 100644 examples/jcreate/jcreate-shell.c diff --git a/examples/jcreate/Makefile b/examples/jcreate/Makefile deleted file mode 100644 index fb94e4311..000000000 --- a/examples/jcreate/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -CONTIKI_PROJECT = jcreate-shell -all: $(CONTIKI_PROJECT) - -APPS = serial-shell -CONTIKI = ../.. - -jcreate-blink: - (echo; sleep 4; echo "~K"; sleep 4; \ - echo "repeat 0 0 { acc | leds 1 } &"; sleep 4) | make login - -%.shell-upload: %.ce - (echo; sleep 4; echo "~K"; sleep 4; \ - echo "dec64 | write $*.ce | null"; sleep 4; \ - ../../tools/base64-encode < $<; sleep 4; \ - echo "~K"; sleep 4; \ - echo "read $*.ce | size"; sleep 4) | make login - -%.netsend: %.shell-upload - (echo; sleep 4; echo "~K"; sleep 4; \ - echo "netcmd { recvnetfile | write $*.ce | size | send } "; sleep 4; \ - echo "netfile $*.ce"; sleep 4;\ - echo "collect | binprint"; sleep 40) | make login - -include $(CONTIKI)/Makefile.include diff --git a/examples/jcreate/Makefile.target b/examples/jcreate/Makefile.target deleted file mode 100644 index e60fcf4dc..000000000 --- a/examples/jcreate/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = jcreate diff --git a/examples/jcreate/announce-blink.c b/examples/jcreate/announce-blink.c deleted file mode 100644 index d8457b79d..000000000 --- a/examples/jcreate/announce-blink.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Example program that displays the number of neighbors on the JCreate LEDs - * \author - * Adam Dunkels - */ - -#include "contiki.h" -#include "contiki-net.h" -#include "shell.h" - -#include "dev/acc-sensor.h" -#include "net/mac/xmac.h" -#include "dev/leds.h" - -#include - -#define MAX_NEIGHBORS_SEEN 8 -#define NEIGHBOR_TIMEOUT 4 * CLOCK_SECOND - -static struct announcement announcement; - -struct neighbor_entry { - struct neighbor_entry *next; - rimeaddr_t addr; - struct ctimer ctimer; -}; - -LIST(neighbor_table); -MEMB(neighbor_mem, struct neighbor_entry, MAX_NEIGHBORS_SEEN); - -/*---------------------------------------------------------------------------*/ -PROCESS(announce_blink_process, "Annouce blink"); -AUTOSTART_PROCESSES(&announce_blink_process); -/*---------------------------------------------------------------------------*/ -/* - * This function takes the length of the neighbor table list and - * displays it on the on-board LEDs. - */ -static void -show_leds(void) -{ - int val, i; - int num; - - num = list_length(neighbor_table); - - val = 1; - for(i = 0; i < num; ++i) { - val |= (val << 1); - } - val >>= 1; - - leds_on(val & 0xff); - leds_off(~(val & 0xff)); -} -/*---------------------------------------------------------------------------*/ -static void -remove_neighbor(void *dummy) -{ - struct neighbor_entry *e = dummy; - - list_remove(neighbor_table, e); - memb_free(&neighbor_mem, e); - - show_leds(); - - printf("%d.%d: removed %d.%d\n", - rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - e->addr.u8[0], e->addr.u8[1]); -} -/*---------------------------------------------------------------------------*/ -static void -received_announcement(struct announcement *a, const rimeaddr_t *from, - uint16_t id, uint16_t value) -{ - struct neighbor_entry *e; - - printf("%d.%d: announcement from neighbor %d.%d, id %d, value %d\n", - rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - from->u8[0], from->u8[1], - id, value); - - - for(e = list_head(neighbor_table); e != NULL; e = e->next) { - if(rimeaddr_cmp(from, &e->addr)) { - ctimer_set(&e->ctimer, NEIGHBOR_TIMEOUT, remove_neighbor, e); - show_leds(); - return; - } - } - - - e = memb_alloc(&neighbor_mem); - if(e != NULL) { - rimeaddr_copy(&e->addr, from); - list_add(neighbor_table, e); - ctimer_set(&e->ctimer, NEIGHBOR_TIMEOUT, remove_neighbor, e); - } else { - } - show_leds(); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(announce_blink_process, ev, data) -{ - PROCESS_BEGIN(); - - announcement_register(&announcement, 80, received_announcement); - - list_init(neighbor_table); - memb_init(&neighbor_mem); - - { - int i; - for(i = 0; i < 10; ++i) { - rimeaddr_t r; - r.u8[0] = r.u8[1] = i; - received_announcement(NULL, &r, 0, 0); - received_announcement(NULL, &r, 0, 0); - } - } - - 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); - - while(1) { - static struct etimer e; - static uint16_t last_value; - - etimer_set(&e, CLOCK_SECOND / 8); - PROCESS_WAIT_EVENT(); - if(acc_sensor.value(1) / 256 != last_value) { - last_value = acc_sensor.value(1) / 256; - announcement_listen(1); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/jcreate/example-ext-sensor.c b/examples/jcreate/example-ext-sensor.c deleted file mode 100644 index 4d12cd528..000000000 --- a/examples/jcreate/example-ext-sensor.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2010, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * A very simple Contiki application showing how to use ext-sensor - * In this case a i-Snail current sensor for 10A is used to measure - * current. - * \author - * Joakim Eriksson - */ - -#include "contiki.h" -#include "dev/leds.h" -#include "dev/ext-sensor.h" -#include -/*---------------------------------------------------------------------------*/ -PROCESS(ext_sensor_process, "ext-sensor process"); -AUTOSTART_PROCESSES(&ext_sensor_process); -/*---------------------------------------------------------------------------*/ - -PROCESS_THREAD(ext_sensor_process, ev, data) -{ - static struct etimer et; - static long maValue; - static long maSum; - static int time; - PROCESS_BEGIN(); - - SENSORS_ACTIVATE(ext_sensor); - - leds_invert(LEDS_ALL); - - etimer_set(&et, CLOCK_SECOND); - while(1) { - - leds_invert(LEDS_ALL); - - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - etimer_reset(&et); - - leds_invert(LEDS_ALL); - - /* the max value of the i-Snail sensor is 10 Ampere (=> ~5V) */ - /* and we are using the 2.5 V reference voltage which */ - /* means that 5 Ampere will make the sensor max-out. */ - /* => 5 Ampere will be 4095 in the sensor ADC register */ - maValue = (ext_sensor.value(ADC0) * 5000L) / 4095; - maSum += maValue; - time++; - printf("Measured ext1 %d %ld mA %ld W %ld Wh %d (s)\n", - ext_sensor.value(ADC0), maValue, (maValue * 230L) / 1000, - (maSum * 230L) / (1000L * 60 * 60), time); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/examples/jcreate/jcreate-shell.c b/examples/jcreate/jcreate-shell.c deleted file mode 100644 index f7489c8fa..000000000 --- a/examples/jcreate/jcreate-shell.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/** - * \file - * Jcreate-specific Contiki shell - * \author - * Adam Dunkels - */ - -#include "contiki.h" -#include "shell.h" -#include "serial-shell.h" - -#include "dev/leds.h" -#include "dev/acc-sensor.h" - -#include -#include - -#include -#include - -/*---------------------------------------------------------------------------*/ -PROCESS(shell_poke_process, "poke"); -SHELL_COMMAND(poke_command, - "poke", - "poke
: write byte to address
", - &shell_poke_process); -PROCESS(shell_peek_process, "peek"); -SHELL_COMMAND(peek_command, - "peek", - "peek
: read a byte from address
", - &shell_peek_process); -PROCESS(shell_acc_process, "acc"); -SHELL_COMMAND(acc_command, - "acc", - "acc: print out accelerometer data", - &shell_acc_process); -PROCESS(shell_leds_process, "leds"); -SHELL_COMMAND(leds_command, - "leds", - "leds: set LEDs", - &shell_leds_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(shell_poke_process, ev, data) -{ - uint8_t *address; - uint8_t byte; - const char *args, *next; - - PROCESS_BEGIN(); - - args = data; - - if(args == NULL) { - shell_output_str(&poke_command, "usage 0", ""); - PROCESS_EXIT(); - } - - address = (uint8_t *)(int)shell_strtolong(args, &next); - if(next == args) { - shell_output_str(&poke_command, "usage 1", ""); - PROCESS_EXIT(); - } - - args = next; - byte = shell_strtolong(args, &next); - if(next == args) { - shell_output_str(&poke_command, "usage 2", ""); - PROCESS_EXIT(); - } - - printf("address %p byte 0x%02x\n", address, byte); - - *address = byte; - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(shell_peek_process, ev, data) -{ - uint8_t *address; - const char *args, *next; - char buf[32]; - - PROCESS_BEGIN(); - - args = data; - - if(args == NULL) { - shell_output_str(&peek_command, "usage 0", ""); - PROCESS_EXIT(); - } - - address = (uint8_t *)(int)shell_strtolong(args, &next); - if(next == args) { - shell_output_str(&peek_command, "usage 1", ""); - PROCESS_EXIT(); - } - - snprintf(buf, sizeof(buf), "0x%02x", *address); - - shell_output_str(&peek_command, buf, ""); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -struct acc_msg { - uint16_t len; - uint16_t acc[4]; -}; -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(shell_acc_process, ev, data) -{ - struct acc_msg msg; - int i; - - PROCESS_BEGIN(); - - msg.len = 1; - for(i = 0; i < 4; ++i) { - msg.acc[i] = acc_sensor.value(i); - } - - shell_output(&acc_command, &msg, sizeof(msg), "", 0); - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(shell_leds_process, ev, data) -{ - struct acc_msg *msg; - struct shell_input *input; - int val, i; - static int num; - const char *args, *next; - - PROCESS_BEGIN(); - - args = data; - if(args == NULL) { - shell_output_str(&acc_command, "usage 0", ""); - PROCESS_EXIT(); - } - - num = shell_strtolong(args, &next); - if(next == args) { - shell_output_str(&acc_command, "usage 1", ""); - PROCESS_EXIT(); - } - - PROCESS_WAIT_EVENT_UNTIL(ev == shell_event_input); - input = data; - msg = (struct acc_msg *)input->data1; - val = 0; - for(i = 0; i < msg->acc[num] >> 9; ++i) { - val = (val << 1) | 1; - } - leds_on(val & 0xff); - leds_off(~(val & 0xff)); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -PROCESS(sky_shell_process, "Sky Contiki shell"); -AUTOSTART_PROCESSES(&sky_shell_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(sky_shell_process, ev, data) -{ - PROCESS_BEGIN(); - - serial_shell_init(); - shell_blink_init(); - shell_file_init(); - shell_coffee_init(); - shell_ps_init(); - shell_reboot_init(); - shell_rime_init(); - /* shell_rime_debug_init();*/ - shell_rime_netcmd_init(); -/* shell_rime_ping_init(); */ - shell_rime_neighbors_init(); - shell_rime_sendcmd_init(); - /* shell_rime_sniff_init();*/ - shell_rime_unicast_init(); - /*shell_sky_init();*/ - shell_text_init(); - shell_time_init(); - - SENSORS_ACTIVATE(acc_sensor); - shell_register_command(&acc_command); - shell_register_command(&poke_command); - shell_register_command(&peek_command); - shell_register_command(&leds_command); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/