From 26c4a81331b63ab350444ca095160fce4b1381e9 Mon Sep 17 00:00:00 2001 From: Antonio Lignan Date: Tue, 16 Aug 2016 15:33:21 +0200 Subject: [PATCH] Z1: cleaned up non-required libraries from builds and moved SENSORS declaration to its own file --- examples/zolertia/z1/Makefile | 7 ++++-- platform/z1/Makefile.common | 15 +++++------ platform/z1/Makefile.z1 | 2 +- platform/z1/contiki-z1-main.c | 9 +------ platform/z1/dev/z1-sensors.c | 47 +++++++++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 20 deletions(-) create mode 100644 platform/z1/dev/z1-sensors.c diff --git a/examples/zolertia/z1/Makefile b/examples/zolertia/z1/Makefile index 78b18d9dc..d0ba2abc8 100644 --- a/examples/zolertia/z1/Makefile +++ b/examples/zolertia/z1/Makefile @@ -7,8 +7,11 @@ ZOLERTIA_Z1SP=0 CONTIKI_PROJECT = test-phidgets blink test-adxl345 test-tmp102 test-light-ziglet CONTIKI_PROJECT += test-battery test-relay-phidget test-tlc59116 test-sht25 -CONTIKI_SOURCEFILES += sht11.c reed-sensor.c -APPS=serial-shell + +CONTIKI_SOURCEFILES += reed-sensor.c sht25.c tlc59116.c light-ziglet.c \ + relay-phidget.c + +MODULES += dev/sht11 ifeq ($(ZOLERTIA_Z1SP),1) CONTIKI_PROJECT += test-potent diff --git a/platform/z1/Makefile.common b/platform/z1/Makefile.common index 642071bdc..6d6bc2e9e 100644 --- a/platform/z1/Makefile.common +++ b/platform/z1/Makefile.common @@ -12,14 +12,12 @@ endif CLEAN += symbols.c symbols.h -ARCH=msp430.c leds.c watchdog.c xmem.c \ - spi.c cc2420.c cc2420-arch.c cc2420-arch-sfd.c\ - node-id.c sensors.c button-sensor.c cfs-coffee.c \ - radio-sensor.c uart0.c uart0-putchar.c uip-ipchksum.c \ - slip.c slip_uart0.c \ - z1-phidgets.c sht11.c sht11-sensor.c light-sensor.c \ - battery-sensor.c sky-sensors.c tmp102.c temperature-sensor.c light-ziglet.c \ - relay-phidget.c tlc59116.c sht25.c +ARCH = msp430.c leds.c watchdog.c xmem.c i2cmaster.c \ + spi.c cc2420.c cc2420-arch.c cc2420-arch-sfd.c\ + node-id.c sensors.c button-sensor.c cfs-coffee.c \ + radio-sensor.c uart0.c uart0-putchar.c uip-ipchksum.c \ + slip.c slip_uart0.c z1-sensors.c adxl345.c temperature-sensor.c \ + z1-phidgets.c light-sensor.c battery-sensor.c sky-sensors.c tmp102.c CONTIKI_TARGET_DIRS = . dev apps net ifndef CONTIKI_TARGET_MAIN @@ -31,7 +29,6 @@ CFLAGS += -DMACID=$(nodemac) endif CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS) -CONTIKI_TARGET_SOURCEFILES += i2cmaster.c adxl345.c MCU=msp430f2617 diff --git a/platform/z1/Makefile.z1 b/platform/z1/Makefile.z1 index 015171af7..6ca3ab0e8 100644 --- a/platform/z1/Makefile.z1 +++ b/platform/z1/Makefile.z1 @@ -12,4 +12,4 @@ endif MODULES += core/net \ core/net/mac core/net/mac/contikimac \ core/net/llsec \ - dev/cc2420 dev/sht11 + dev/cc2420 diff --git a/platform/z1/contiki-z1-main.c b/platform/z1/contiki-z1-main.c index 92a7b5bd7..b95a9c231 100644 --- a/platform/z1/contiki-z1-main.c +++ b/platform/z1/contiki-z1-main.c @@ -43,7 +43,6 @@ #include "lib/random.h" #include "net/netstack.h" #include "net/mac/frame802154.h" -#include "dev/button-sensor.h" #include "dev/adxl345.h" #include "sys/clock.h" @@ -58,12 +57,6 @@ #include "cfs/cfs-coffee.h" #include "sys/autostart.h" -#include "dev/battery-sensor.h" -#include "dev/button-sensor.h" -#include "dev/sht11/sht11-sensor.h" - -SENSORS(&button_sensor); - extern unsigned char node_mac[8]; #if DCOSYNCH_CONF_ENABLED @@ -279,7 +272,7 @@ main(int argc, char **argv) set_rime_addr(); cc2420_init(); - accm_init(); + SENSORS_ACTIVATE(adxl345); { uint8_t longaddr[8]; diff --git a/platform/z1/dev/z1-sensors.c b/platform/z1/dev/z1-sensors.c new file mode 100644 index 000000000..db5b418b9 --- /dev/null +++ b/platform/z1/dev/z1-sensors.c @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2016, Zolertia - http://www.zolertia.com + * 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 copyright holder 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 COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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. + */ +/*---------------------------------------------------------------------------*/ +/** + * \file + * Zolertia Z1 on-board sensors + * \author + * Antonio Lignan, Zolertia + */ +/*---------------------------------------------------------------------------*/ +#include "contiki.h" +#include "lib/sensors.h" +#include "dev/button-sensor.h" +#include "dev/tmp102.h" +#include "dev/adxl345.h" +/*---------------------------------------------------------------------------*/ +/** \brief Exports global symbols for the sensor API */ +SENSORS(&button_sensor, &adxl345, &tmp102); +/*---------------------------------------------------------------------------*/