diff --git a/examples/zolertia/zoul/Makefile b/examples/zolertia/zoul/Makefile index c5e99f92c..c06984c73 100644 --- a/examples/zolertia/zoul/Makefile +++ b/examples/zolertia/zoul/Makefile @@ -1,11 +1,11 @@ DEFINES+=PROJECT_CONF_H=\"project-conf.h\" -CONTIKI_PROJECT = zoul-demo test-tsl2563 test-sht25 test-power-mgmt +CONTIKI_PROJECT = zoul-demo test-tsl2563 test-sht25 test-servo.c CONTIKI_PROJECT += test-bmp085-bmp180 test-motion test-rotation-sensor CONTIKI_PROJECT += test-grove-light-sensor test-grove-loudness-sensor CONTIKI_PROJECT += test-weather-meter test-grove-gyro test-lcd test-iaq CONTIKI_PROJECT += test-pm10-sensor test-vac-sensor test-aac-sensor -CONTIKI_PROJECT += test-zonik test-dht22.c test-ac-dimmer.c test-servo.c +CONTIKI_PROJECT += test-zonik test-dht22.c test-ac-dimmer.c CONTIKI_TARGET_SOURCEFILES += tsl2563.c sht25.c bmpx8x.c motion-sensor.c CONTIKI_TARGET_SOURCEFILES += adc-sensors.c weather-meter.c grove-gyro.c diff --git a/examples/zolertia/zoul/README.md b/examples/zolertia/zoul/README.md new file mode 100644 index 000000000..dbcff3e2a --- /dev/null +++ b/examples/zolertia/zoul/README.md @@ -0,0 +1,59 @@ +Zolertia Zoul test examples +============================================ + +The following tests are valid for the following platforms: + +* RE-Mote revision A +* RE-Mote revision B +* Firefly + +Specific RE-mote revision A examples are available at the `rev-a` folder. + +Compile and install an example +------------------- + +To flash either hardware platform use the same `TARGET=zoul` and the following: + +* RE-Mote revision A : `BOARD=remote-reva` +* RE-Mote revision B : `BOARD=remote-revb` +* Zolertia Firefly : `BOARD=firefly` + +An example on how to compile is shown next: + +`make TARGET=zoul BOARD=remote-revb` + +Or alternatively if you just type `make`, it will default to use the `BOARD=remote-revb`. + +For backward compatibility with the previous `remote` target corresponding to the +RE-Mote revision A, using `BOARD=remote` will default to `BOARD=remote-reva`. + +To upload an example to your Zolertia device, just add the `.upload` target as: + +`make TARGET=zoul BOARD=remote-revb zoul-demo.upload` + +Optionally you can select a specific USB port to flash a given device, in Linux +and assuming there is a device at the `/dev/ttyUSB0`: + +`make TARGET=zoul BOARD=remote-revb zoul-demo.upload PORT=/dev/ttyUSB0` + +If you ommit the `PORT` argument, the system will flash all Zolertia devices connected over USB. + +Visualize the console output +------------------- + +Just type `make login` to open a connection to the console via USB. +As above to specify a given port use the `PORT=/dev/ttyUSB0` argument. + +Alternatively you can save the above `PORT`, `TARGET` or `BOARD` as follows: + +`export BOARD=/dev/ttyUSB0` + +This will save you to type these when running a command on the terminal + +Documentation and guides +------------------- + +More information about the platforms, guides and specific documentation can be found at [Zolertia Wiki][wiki] + +[wiki]: https://github.com/Zolertia/Resources/wiki "Zolertia Wiki" + diff --git a/examples/zolertia/zoul/at-test/at-master-test.c b/examples/zolertia/zoul/at-test/at-master-test.c index 520c28bdb..1b7d14d53 100644 --- a/examples/zolertia/zoul/at-test/at-master-test.c +++ b/examples/zolertia/zoul/at-test/at-master-test.c @@ -481,7 +481,6 @@ PROCESS_THREAD(at_test_process, ev, data) } /*---------------------------------------------------------------------------*/ /** - * @} * @} * @} */ diff --git a/examples/zolertia/zoul/at-test/project-conf.h b/examples/zolertia/zoul/at-test/project-conf.h index 4a29f1d59..ef1581773 100644 --- a/examples/zolertia/zoul/at-test/project-conf.h +++ b/examples/zolertia/zoul/at-test/project-conf.h @@ -29,7 +29,7 @@ */ /*---------------------------------------------------------------------------*/ /** - * \addtogroup remote-examples + * \addtogroup zoul-examples * @{ * * \defgroup zoul-AT-master-test @@ -63,5 +63,8 @@ #define NETSTACK_CONF_RDC nullrdc_driver #endif /* PROJECT_CONF_H_ */ - -/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * @} + * @} + */ diff --git a/examples/zolertia/zoul/cc1200-demo/cc1200-demo.c b/examples/zolertia/zoul/cc1200-demo/cc1200-demo.c index 1fe69f58c..4eb4d27b1 100644 --- a/examples/zolertia/zoul/cc1200-demo/cc1200-demo.c +++ b/examples/zolertia/zoul/cc1200-demo/cc1200-demo.c @@ -35,11 +35,12 @@ * @{ * * \file - * Test file for the CC1200 demo + * Test file for the CC1200 demo * * \author * Antonio Lignan */ +/*---------------------------------------------------------------------------*/ #include "contiki.h" #include "cpu.h" #include "sys/etimer.h" diff --git a/examples/zolertia/zoul/cc1200-demo/project-conf.h b/examples/zolertia/zoul/cc1200-demo/project-conf.h index 9367973ff..add005170 100644 --- a/examples/zolertia/zoul/cc1200-demo/project-conf.h +++ b/examples/zolertia/zoul/cc1200-demo/project-conf.h @@ -43,6 +43,7 @@ * \author * Antonio Lignan */ +/*---------------------------------------------------------------------------*/ #ifndef PROJECT_CONF_H_ #define PROJECT_CONF_H_ diff --git a/examples/zolertia/zoul/project-conf.h b/examples/zolertia/zoul/project-conf.h index 230724b2d..34f3116f6 100644 --- a/examples/zolertia/zoul/project-conf.h +++ b/examples/zolertia/zoul/project-conf.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ + * Copyright (c) 2016, Zolertia - http://www.zolertia.com * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,13 +28,15 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ +/*---------------------------------------------------------------------------*/ /** - * \addtogroup remote-examples + * \addtogroup zoul-examples * @{ * * \file * Project specific configuration defines for the basic RE-Mote examples */ +/*---------------------------------------------------------------------------*/ #ifndef PROJECT_CONF_H_ #define PROJECT_CONF_H_ diff --git a/examples/zolertia/zoul/rev-a/Makefile b/examples/zolertia/zoul/rev-a/Makefile new file mode 100644 index 000000000..bf3c06f74 --- /dev/null +++ b/examples/zolertia/zoul/rev-a/Makefile @@ -0,0 +1,9 @@ +DEFINES+=PROJECT_CONF_H=\"project-conf.h\" + +CONTIKI_PROJECT = test-power-mgmt + +all: $(CONTIKI_PROJECT) + +CONTIKI = ../../../.. +CONTIKI_WITH_RIME = 1 +include $(CONTIKI)/Makefile.include diff --git a/examples/zolertia/zoul/rev-a/Makefile.target b/examples/zolertia/zoul/rev-a/Makefile.target new file mode 100644 index 000000000..75430a6e4 --- /dev/null +++ b/examples/zolertia/zoul/rev-a/Makefile.target @@ -0,0 +1 @@ +TARGET = zoul diff --git a/examples/zolertia/zoul/rev-a/project-conf.h b/examples/zolertia/zoul/rev-a/project-conf.h new file mode 100644 index 000000000..c5a153b5c --- /dev/null +++ b/examples/zolertia/zoul/rev-a/project-conf.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016, Zolertia + * 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. + */ +/** + * \addtogroup remote-examples + * @{ + * + * \file + * Project specific configuration defines for the basic RE-Mote examples + */ +#ifndef PROJECT_CONF_H_ +#define PROJECT_CONF_H_ + +#define BROADCAST_CHANNEL 129 +#define NETSTACK_CONF_RDC nullrdc_driver + +#endif /* PROJECT_CONF_H_ */ + +/** @} */ diff --git a/examples/zolertia/zoul/test-power-mgmt.c b/examples/zolertia/zoul/rev-a/test-power-mgmt.c similarity index 88% rename from examples/zolertia/zoul/test-power-mgmt.c rename to examples/zolertia/zoul/rev-a/test-power-mgmt.c index 1b0690bdb..a29668b22 100644 --- a/examples/zolertia/zoul/test-power-mgmt.c +++ b/examples/zolertia/zoul/rev-a/test-power-mgmt.c @@ -32,8 +32,8 @@ * \addtogroup remote-power-management-test * @{ * - * Test the RE-Mote's power management features, shutdown mode and battery - * management + * Test the RE-Mote's (revision A) power management features, shutdown mode and + * battery management * * @{ * @@ -80,18 +80,18 @@ static char * print_pm(uint8_t state) { switch(state) { - case PM_SYSOFF_ON: - return "Battery on"; - case PM_SYSOFF_OFF: - return "Battery off"; - case PM_TIMER_ENABLED: - return "Nano Timer enabled"; - case PM_TIMER_DISABLED: - return "Nano Timer disabled"; - case PM_AWAITING_RTC_EVENT: - return "Awaiting RTC event"; - default: - return "UNKNOWN"; + case PM_SYSOFF_ON: + return "Battery on"; + case PM_SYSOFF_OFF: + return "Battery off"; + case PM_TIMER_ENABLED: + return "Nano Timer enabled"; + case PM_TIMER_DISABLED: + return "Nano Timer disabled"; + case PM_AWAITING_RTC_EVENT: + return "Awaiting RTC event"; + default: + return "UNKNOWN"; } } /*---------------------------------------------------------------------------*/ @@ -107,24 +107,24 @@ get_status(uint8_t mask, uint8_t *val) } if(!mask) { - printf("STATUS %u\n", status); + printf("STATUS %u\n", status); *val = PM_IDLE; return PM_SUCCESS; } /* Read back ony the requested status bit */ switch(mask) { - case PM_SYSOFF_ON_MASK: - print_msg = (status & mask) ? PM_SYSOFF_ON : PM_SYSOFF_OFF; - break; - case PM_TIMER_ENABLED_MASK: - print_msg = (status & mask) ? PM_TIMER_ENABLED : PM_TIMER_DISABLED; - break; - case PM_AWAITING_RTC_EVENT_MASK: - print_msg = (status & mask) ? PM_AWAITING_RTC_EVENT : PM_AWAITING_RTC_DIS; - break; - default: - return PM_ERROR; + case PM_SYSOFF_ON_MASK: + print_msg = (status & mask) ? PM_SYSOFF_ON : PM_SYSOFF_OFF; + break; + case PM_TIMER_ENABLED_MASK: + print_msg = (status & mask) ? PM_TIMER_ENABLED : PM_TIMER_DISABLED; + break; + case PM_AWAITING_RTC_EVENT_MASK: + print_msg = (status & mask) ? PM_AWAITING_RTC_EVENT : PM_AWAITING_RTC_DIS; + break; + default: + return PM_ERROR; } printf("Status -> %s\n", print_pm(print_msg)); @@ -194,7 +194,7 @@ PROCESS_THREAD(test_remote_pm, ev, data) broadcast_send(&bc); /* And wait a few seconds before going to sleep */ - while(1){ + while(1) { etimer_set(&et, CLOCK_SECOND); PROCESS_WAIT_EVENT(); diff --git a/examples/zolertia/zoul/rtcc/Makefile.target b/examples/zolertia/zoul/rtcc/Makefile.target new file mode 100644 index 000000000..75430a6e4 --- /dev/null +++ b/examples/zolertia/zoul/rtcc/Makefile.target @@ -0,0 +1 @@ +TARGET = zoul diff --git a/examples/zolertia/zoul/rtcc/project-conf.h b/examples/zolertia/zoul/rtcc/project-conf.h index 9ff57c953..66bf67bc0 100644 --- a/examples/zolertia/zoul/rtcc/project-conf.h +++ b/examples/zolertia/zoul/rtcc/project-conf.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ + * Copyright (c) 2015, Zolertia * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,18 +28,28 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ +/*---------------------------------------------------------------------------*/ /** - * \addtogroup remote-examples + * \addtogroup zoul-examples + * @{ + * + * \defgroup remote-rtcc-test RE-Mote on-board RTCC test application + * + * Test the Real-Time-Clock-Calendar built in the RE-Motes revision A and B * @{ * * \file - * Project specific configuration defines for the basic RE-Mote examples + * Project specific configuration defines for the RTCC RE-Mote example */ +/*---------------------------------------------------------------------------*/ #ifndef PROJECT_CONF_H_ #define PROJECT_CONF_H_ #define NETSTACK_CONF_RDC nullrdc_driver #endif /* PROJECT_CONF_H_ */ - -/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * @} + * @} + */ diff --git a/examples/zolertia/zoul/rtcc/test-rtcc.c b/examples/zolertia/zoul/rtcc/test-rtcc.c index cb14d5fa5..9b8895c09 100644 --- a/examples/zolertia/zoul/rtcc/test-rtcc.c +++ b/examples/zolertia/zoul/rtcc/test-rtcc.c @@ -1,5 +1,6 @@ /* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com + * Copyright (c) 2015, Zolertia + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,10 +30,8 @@ */ /*---------------------------------------------------------------------------*/ /** - * \addtogroup remote-examples + * \addtogroup remote-rtcc-test * @{ - - * \defgroup remote-rtcc-test RE-Mote on-board RTCC test application * * Example project to show the on-board RTCC configuration and operation * Retrieves the current time and date from the system, then sets an alarm to @@ -42,10 +41,8 @@ * @{ * * \file - * RE-Mote on-board RTCC test application - * + * RE-Mote on-board RTCC test application * \author - * * Antonio Lignan * Aitor Mejias * Toni Lozano @@ -178,4 +175,3 @@ PROCESS_THREAD(test_remote_rtcc_process, ev, data) * @} * @} */ - diff --git a/examples/zolertia/zoul/test-aac-sensor.c b/examples/zolertia/zoul/test-aac-sensor.c index bbda23955..d6d8bda01 100644 --- a/examples/zolertia/zoul/test-aac-sensor.c +++ b/examples/zolertia/zoul/test-aac-sensor.c @@ -28,20 +28,22 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/** * \addtogroup zoul-examples * @{ + * * \defgroup zoul-aac-sensor-test Test AAC sensor * * Demonstrates the operation of the current AAC analog sensor * @{ * * \file - * Example demonstrating the Zoul module on the RE-Mote & AAC sensor 0-5V 50Amps AC + * Example demonstrating the RE-Mote & AAC sensor 0-5V 50Amps AC * * \author * Javier Sánchez */ +/*---------------------------------------------------------------------------*/ #include "contiki.h" #include "sys/etimer.h" #include "sys/rtimer.h" @@ -64,7 +66,7 @@ AUTOSTART_PROCESSES(&test_aac_sensor_process); /*---------------------------------------------------------------------------*/ PROCESS_THREAD(test_aac_sensor_process, ev, data) { - + PROCESS_BEGIN(); counter = 0; @@ -86,12 +88,12 @@ PROCESS_THREAD(test_aac_sensor_process, ev, data) printf("-----------------------------------------\n" "Counter = 0x%08x\n", counter); - + printf("AC Amps = %d mA\n", adc_sensors.value(ANALOG_AAC_SENSOR)); - + etimer_set(&et, LOOP_INTERVAL); counter++; - } + } } PROCESS_END(); } @@ -100,3 +102,4 @@ PROCESS_THREAD(test_aac_sensor_process, ev, data) * @} * @} */ + diff --git a/examples/zolertia/zoul/test-ac-dimmer.c b/examples/zolertia/zoul/test-ac-dimmer.c index 521b023e3..6fd28faa7 100644 --- a/examples/zolertia/zoul/test-ac-dimmer.c +++ b/examples/zolertia/zoul/test-ac-dimmer.c @@ -70,7 +70,7 @@ PROCESS_THREAD(remote_ac_dimmer_process, ev, data) /* Set the lamp to 10% and wait a few seconds */ ac_dimmer.value(DIMMER_DEFAULT_MIN_DIMM_VALUE); etimer_set(&et, CLOCK_SECOND * 5); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); + PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); /* Upon testing for duty cycles lower than 10% there was noise (probably from * the triac), causing the driver to skip a beat, and from time to time made @@ -100,3 +100,4 @@ PROCESS_THREAD(remote_ac_dimmer_process, ev, data) * @} * @} */ + diff --git a/examples/zolertia/zoul/test-bmp085-bmp180.c b/examples/zolertia/zoul/test-bmp085-bmp180.c index 73cf0168f..81d54b31e 100644 --- a/examples/zolertia/zoul/test-bmp085-bmp180.c +++ b/examples/zolertia/zoul/test-bmp085-bmp180.c @@ -38,7 +38,7 @@ * @{ * * \file - * Test file for the BMP085/BMP180 digital pressure and temperature sensor + * Test file for the BMP085/BMP180 digital pressure and temp sensor * * \author * Antonio Lignan diff --git a/examples/zolertia/zoul/test-grove-gyro.c b/examples/zolertia/zoul/test-grove-gyro.c index 24baa360f..978aa69f8 100644 --- a/examples/zolertia/zoul/test-grove-gyro.c +++ b/examples/zolertia/zoul/test-grove-gyro.c @@ -85,7 +85,7 @@ PROCESS_THREAD(remote_grove_gyro_process, ev, data) * the 3 gyroscope axis use GROVE_GYRO_SENSOR. Alternatively the value * GROVE_GYRO_ALL could also be used to power everything at once */ - grove_gyro.configure(GROVE_GYRO_POWER_ON, GROVE_GYRO_SENSOR); + grove_gyro.configure(GROVE_GYRO_POWER_ON, GROVE_GYRO_SENSOR); /* Read back the configured sensor I2C address to check if the sensor is * working OK, this is the only case in which the value() returns a value @@ -128,9 +128,9 @@ PROCESS_THREAD(remote_grove_gyro_process, ev, data) /* This sensor has a different operation from others using Contiki's sensor * API, to make data acquisition we write the readings directly to the - * extern data structure, allowing to write more than 1 value at the same - * operation, and also allowing upon a data interrupt event to immediatly - * access the data. The return value of the value() call is then the status + * extern data structure, allowing to write more than 1 value at the same + * operation, and also allowing upon a data interrupt event to immediatly + * access the data. The return value of the value() call is then the status * result of the read operation */ if(grove_gyro.value(GROVE_GYRO_XYZ) == GROVE_GYRO_SUCCESS) { diff --git a/examples/zolertia/zoul/test-iaq.c b/examples/zolertia/zoul/test-iaq.c index 147ecd8a7..9940448ce 100644 --- a/examples/zolertia/zoul/test-iaq.c +++ b/examples/zolertia/zoul/test-iaq.c @@ -29,24 +29,25 @@ */ /*---------------------------------------------------------------------------*/ /** - * \addtogroup remote-examples + * \addtogroup zoul-examples * @{ - * \defgroup remote-iaq-test - * + * + * \defgroup zoul-iaq-test + * * RE-Mote external IAQ test application * Example of iAQ-Core implementation and simple operation reading the value - * of CO2, TVOC sensor and Status. The test checks for a each 5 minutes in + * of CO2, TVOC sensor and Status. The test checks for a each 5 minutes in * order to get the first true measurement as datasheet recomendation - * (standard result of 0x82 is obtained in first time). - * Then, once initialized, periodically each 5 seconds reads - * the values of the IAQ sensor and shows in the screen, toggling the LED + * (standard result of 0x82 is obtained in first time). + * Then, once initialized, periodically each 5 seconds reads + * the values of the IAQ sensor and shows in the screen, toggling the LED * red if CO2 was not initialized and LED green if the reading was succeed. * * @{ * \file - * RE-Mote implementation of external IAQ-CORE-C test application + * RE-Mote implementation of external IAQ-CORE-C test application * \author - * Aitor Mejias + * Aitor Mejias */ /*---------------------------------------------------------------------------*/ #include "contiki.h" @@ -87,17 +88,16 @@ PROCESS_THREAD(test_remote_iaq_process, ev, data) count_delay += LOOP_PERIOD; leds_toggle(LEDS_RED); printf("Test-IAQ: Initializing Time-elapsed: %u seconds of aprox. %lu sec.\n", - count_delay, IAQ_INIT_WAIT); + count_delay, IAQ_INIT_WAIT); } else if(status == IAQ_ACTIVE) { leds_off(LEDS_RED); leds_toggle(LEDS_GREEN); /* Get data from sensor: VOC, CO2 and internal status */ - printf("CO2 current value is: %d ppm\n", iaq.value(IAQ_VOC_VALUE)); - printf("TIAQ current value is: %d ppb\n", iaq.value(IAQ_CO2_VALUE)); + printf("CO2 current value is: %d ppm\n", iaq.value(IAQ_VOC_VALUE)); + printf("TIAQ current value is: %d ppb\n", iaq.value(IAQ_CO2_VALUE)); printf("Status is: 0x%0X\n", iaq.value(IAQ_STATUS)); - } - else { + } else { printf("iAQ-Core Error: 0x%02X\n", status); } } diff --git a/examples/zolertia/zoul/test-motion.c b/examples/zolertia/zoul/test-motion.c index b5c9c3f59..1a4edfcc5 100644 --- a/examples/zolertia/zoul/test-motion.c +++ b/examples/zolertia/zoul/test-motion.c @@ -40,7 +40,7 @@ * @{ * * \file - * Test application for the digital motion/presence sensor + * Test application for the digital motion/presence sensor * * \author * Antonio Lignan @@ -100,3 +100,4 @@ PROCESS_THREAD(test_presence_sensor, ev, data) * @} * @} */ + diff --git a/examples/zolertia/zoul/test-pm10-sensor.c b/examples/zolertia/zoul/test-pm10-sensor.c index d307f9050..2f6dfae42 100644 --- a/examples/zolertia/zoul/test-pm10-sensor.c +++ b/examples/zolertia/zoul/test-pm10-sensor.c @@ -31,13 +31,14 @@ /** * \addtogroup zoul-examples * @{ + * * \defgroup zoul-pm10-sensor-test Test PM10 sensor * * Demonstrates the operation of the Sharp PM10 analog sensor * @{ * * \file - * GP2Y1010AU0F PM10 sensor example using the ADC sensors wrapper + * GP2Y1010AU0F PM10 sensor example using the ADC sensors wrapper * * \author * Toni Lozano @@ -93,3 +94,4 @@ PROCESS_THREAD(test_pm10_sensor_process, ev, data) * @} * @} */ + diff --git a/examples/zolertia/zoul/test-relay.c b/examples/zolertia/zoul/test-relay.c index cd743919d..51f55e537 100644 --- a/examples/zolertia/zoul/test-relay.c +++ b/examples/zolertia/zoul/test-relay.c @@ -87,3 +87,4 @@ PROCESS_THREAD(remote_relay_process, ev, data) * @} * @} */ + diff --git a/examples/zolertia/zoul/test-rotation-sensor.c b/examples/zolertia/zoul/test-rotation-sensor.c index 76fb029ec..6e03d44ea 100644 --- a/examples/zolertia/zoul/test-rotation-sensor.c +++ b/examples/zolertia/zoul/test-rotation-sensor.c @@ -38,7 +38,7 @@ * @{ * * \file - * Phidget analog rotation sensor example using the ADC sensor wrapper + * Phidget analog rotation sensor example using the ADC sensor wrapper * * \author * Antonio Lignan diff --git a/examples/zolertia/zoul/test-servo.c b/examples/zolertia/zoul/test-servo.c index 9b65ae617..ab201c06d 100644 --- a/examples/zolertia/zoul/test-servo.c +++ b/examples/zolertia/zoul/test-servo.c @@ -105,3 +105,4 @@ PROCESS_THREAD(servo_test_process, ev, data) * @} * @} */ + diff --git a/examples/zolertia/zoul/test-vac-sensor.c b/examples/zolertia/zoul/test-vac-sensor.c index 37db59edf..5be57e44b 100644 --- a/examples/zolertia/zoul/test-vac-sensor.c +++ b/examples/zolertia/zoul/test-vac-sensor.c @@ -28,20 +28,23 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/*---------------------------------------------------------------------------*/ +/** * \addtogroup zoul-examples * @{ + * * \defgroup zoul-vac-sensor-test Test VAC sensor * * Demonstrates the operation of the voltage VAC analog sensor * @{ * * \file - * Example demonstrating the Zoul module on the RE-Mote & VAC sensor 0-5V 250V AC + * Example demonstrating the RE-Mote & VAC sensor 0-5V 250V AC * * \author * Javier Sánchez */ +/*---------------------------------------------------------------------------*/ #include "contiki.h" #include "sys/etimer.h" #include "sys/rtimer.h" @@ -65,7 +68,7 @@ AUTOSTART_PROCESSES(&test_vac_sensor_process); /*---------------------------------------------------------------------------*/ PROCESS_THREAD(test_vac_sensor_process, ev, data) { - + PROCESS_BEGIN(); counter = 0; @@ -90,10 +93,10 @@ PROCESS_THREAD(test_vac_sensor_process, ev, data) /*AC voltage value, with applied corresponding sensor algorithm*/ printf("AC voltage = %d V\n", adc_sensors.value(ANALOG_VAC_SENSOR)); - + etimer_set(&et, LOOP_INTERVAL); counter++; - } + } } PROCESS_END(); } @@ -102,3 +105,4 @@ PROCESS_THREAD(test_vac_sensor_process, ev, data) * @} * @} */ + diff --git a/examples/zolertia/zoul/test-weather-meter.c b/examples/zolertia/zoul/test-weather-meter.c index 2e2bcba2f..637ba8571 100644 --- a/examples/zolertia/zoul/test-weather-meter.c +++ b/examples/zolertia/zoul/test-weather-meter.c @@ -40,7 +40,7 @@ * @{ * * \file - * Test application for the Sparkfun's weather meter + * Test application for the Sparkfun's weather meter * * \author * Antonio Lignan @@ -153,7 +153,7 @@ PROCESS_THREAD(test_weather_meter_sensors, ev, data) } /*---------------------------------------------------------------------------*/ /** - * @} * @} * @} */ + diff --git a/examples/zolertia/zoul/test-zonik.c b/examples/zolertia/zoul/test-zonik.c index 622b73291..a046a950c 100644 --- a/examples/zolertia/zoul/test-zonik.c +++ b/examples/zolertia/zoul/test-zonik.c @@ -29,22 +29,23 @@ */ /*---------------------------------------------------------------------------*/ /** - * \addtogroup remote-examples + * \addtogroup zoul-examples * @{ + * * \defgroup remote-zonik-test Zolertia Zonik sonometer test application * * Example of Zonik board implementation and simple operation: Infinite loop * enablinkg the sensor and rading few times, acquiring the dBA of sensor * The first value acquired is invalid, because it's in hw init state awaiting - * a valid internal reading.Once the driver is initialized, posterior readings + * a valid internal reading.Once the driver is initialized, posterior readings * are valid.Finally in the loop disables the board with standard call and * shows the error, and loop again enabling it. * * @{ * \file - * RE-Mote test application of Zolertia Zonik sound sensor + * RE-Mote test application of Zolertia Zonik sound sensor * \author - * Aitor Mejias + * Aitor Mejias */ /*---------------------------------------------------------------------------*/ #include "contiki.h" @@ -70,17 +71,17 @@ PROCESS_THREAD(test_remote_zonik_process, ev, data) PROCESS_BEGIN(); printf("Initial status of sensor is: 0x%04X\n", - zonik.status(SENSORS_ACTIVE)); + zonik.status(SENSORS_ACTIVE)); while(1) { /* Configure Zonik and activate the internal process readings */ SENSORS_ACTIVATE(zonik); printf("Initialized. Sensor status: 0x%04X\n", - zonik.status(SENSORS_ACTIVE)); + zonik.status(SENSORS_ACTIVE)); /* Read sensor value dBA multiple times */ - for(i=0; i [zolertia-site]: http://www.zolertia.io/products "Zolertia" +[zolertia-wiki]: https://github.com/Zolertia/Resources/wiki "Zolertia Wiki" [cc1200]: http://www.ti.com/product/cc1200 "CC1200" [smart-rf-studio]: http://www.ti.com/tool/smartrftm-studio "SmartRF Studio" [smart-rf-flashprog]: http://www.ti.com/tool/flash-programmer "SmartRF Flash Programmer" diff --git a/platform/zoul/contiki-conf.h b/platform/zoul/contiki-conf.h index d7fdcb39f..bfe57994c 100644 --- a/platform/zoul/contiki-conf.h +++ b/platform/zoul/contiki-conf.h @@ -458,7 +458,7 @@ typedef uint32_t rtimer_clock_t; /* Don't let contiki-default-conf.h decide if we are an IPv6 build */ #ifndef NETSTACK_CONF_WITH_IPV6 -#define NETSTACK_CONF_WITH_IPV6 0 +#define NETSTACK_CONF_WITH_IPV6 0 #endif #if NETSTACK_CONF_WITH_IPV6 @@ -497,7 +497,7 @@ typedef uint32_t rtimer_clock_t; #define UIP_CONF_ND6_RETRANS_TIMER 10000 #ifndef NBR_TABLE_CONF_MAX_NEIGHBORS -#define NBR_TABLE_CONF_MAX_NEIGHBORS 16 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 16 #endif #ifndef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 16 diff --git a/platform/zoul/remote/antenna-sw.c b/platform/zoul/dev/antenna-sw.c similarity index 100% rename from platform/zoul/remote/antenna-sw.c rename to platform/zoul/dev/antenna-sw.c diff --git a/platform/zoul/remote/antenna-sw.h b/platform/zoul/dev/antenna-sw.h similarity index 100% rename from platform/zoul/remote/antenna-sw.h rename to platform/zoul/dev/antenna-sw.h diff --git a/platform/zoul/remote/rtcc-config.h b/platform/zoul/dev/rtcc-config.h similarity index 100% rename from platform/zoul/remote/rtcc-config.h rename to platform/zoul/dev/rtcc-config.h diff --git a/platform/zoul/remote/rtcc.c b/platform/zoul/dev/rtcc.c similarity index 100% rename from platform/zoul/remote/rtcc.c rename to platform/zoul/dev/rtcc.c diff --git a/platform/zoul/remote/rtcc.h b/platform/zoul/dev/rtcc.h similarity index 100% rename from platform/zoul/remote/rtcc.h rename to platform/zoul/dev/rtcc.h diff --git a/platform/zoul/firefly/Makefile.firefly b/platform/zoul/firefly/Makefile.firefly index afecf9fa5..50cb71997 100644 --- a/platform/zoul/firefly/Makefile.firefly +++ b/platform/zoul/firefly/Makefile.firefly @@ -1,2 +1,2 @@ MOTELIST_ZOLERTIA = firefly -BOARD_SOURCEFILES += board.c +BOARD_SOURCEFILES += board.c leds-arch.c diff --git a/platform/zoul/images/remote-back.png b/platform/zoul/images/remote-reva-back.png similarity index 100% rename from platform/zoul/images/remote-back.png rename to platform/zoul/images/remote-reva-back.png diff --git a/platform/zoul/images/remote-front.png b/platform/zoul/images/remote-reva-front.png similarity index 100% rename from platform/zoul/images/remote-front.png rename to platform/zoul/images/remote-reva-front.png diff --git a/platform/zoul/images/remote-pinout-back.png b/platform/zoul/images/remote-reva-pinout-back.png similarity index 100% rename from platform/zoul/images/remote-pinout-back.png rename to platform/zoul/images/remote-reva-pinout-back.png diff --git a/platform/zoul/images/remote-pinout-front.png b/platform/zoul/images/remote-reva-pinout-front.png similarity index 100% rename from platform/zoul/images/remote-pinout-front.png rename to platform/zoul/images/remote-reva-pinout-front.png diff --git a/platform/zoul/remote-reva/Makefile.remote-reva b/platform/zoul/remote-reva/Makefile.remote-reva new file mode 100644 index 000000000..475208875 --- /dev/null +++ b/platform/zoul/remote-reva/Makefile.remote-reva @@ -0,0 +1,2 @@ +MOTELIST_ZOLERTIA = remote +BOARD_SOURCEFILES += board.c antenna-sw.c rtcc.c power-mgmt.c leds-arch.c diff --git a/platform/zoul/remote/README.md b/platform/zoul/remote-reva/README.md similarity index 90% rename from platform/zoul/remote/README.md rename to platform/zoul/remote-reva/README.md index c1f57a1fd..c61e8a2f1 100644 --- a/platform/zoul/remote/README.md +++ b/platform/zoul/remote-reva/README.md @@ -1,4 +1,4 @@ -Zolertia RE-Mote platform +Zolertia RE-Mote platform (revision A) ============================================ ![Zolertia RE-Mote development platform][remote-front] @@ -12,15 +12,15 @@ The RE-Mote platform was designed jointly with universities and industrial partn The RE-Mote features a Zoul as its core module and it is bundled with the following features: * ARM Cortex-M3 with 512KB flash and 32KB RAM (16KB retention), 32MHz. -* ISM 2.4-GHz IEEE 802.15.4 & Zigbee compliant. +* ISM 2.4-GHz IEEE 802.15.4 & Zigbee/Thread compliant. * ISM 868-, 915-, 920-, 950-MHz ISM/SRD Band. * On-board RF switch to programatically select RF itnerfaces. Above RF interfaces can be used alternatively over a single RP-SMA connector for external antenna, or simultaneously by using an UFl pigtail or soldering an internal ceramic chip antenna (available on request). * AES-128/256, SHA2 Hardware Encryption Engine. * ECC-128/256, RSA Hardware Acceleration Engine for Secure Key Exchange. -* Power consumption down to 300nA using our shutdown mode. +* Power consumption down to 170nA using our shutdown mode. * Programming over BSL without requiring to press any button to enter bootloader mode. * Built-in battery charger (500mA), Energy Harvesting and Solar Panels to be connected to standards LiPo batteries. -* Power input with wide range 3.7-26VDC. +* Power input with wide range 3.7-16VDC. * On-board micro USB connector for USB 2.0 applications. * RGB LED to allow more than 7 colour combinations. * On-board nano-watt Real Time Clock Calendar (RTCC). @@ -28,10 +28,11 @@ The RE-Mote features a Zoul as its core module and it is bundled with the follow * On-board Micro-SD for external storage. * On-board external Watchdog Timer (WDT) for resilient operation. * Small form-factor of 73x40 mm. +* Available with enclosure for indoor use The most prominent feature of the RE-Mote is its ultra low-power implementation, allowing a flexible and time/date-aware control of the platform operation modes by introducing a real-time clock (RTCC), nanowatt external timer, ultra-low power PIC governing the battery manager, etc. -The RE-Mote features an optional custom-made enclosure to fit most scenarios, allowing to easily connect sensors, actuators and rechargeable LiPo batteries. Its on-board RP-SMA antenna eliminates the need to mechanize an external antenna, allowing to alternatively use either a sub-1GHz or 2.4GHz antenna, or a multiband one. +The RE-Mote features an optional custom-made enclosure to fit most scenarios, allowing to easily connect sensors, actuators and rechargeable LiPo batteries. Its on-board RP-SMA antenna eliminates the need to mechanize an external antenna, allowing to alternatively use either a sub-1GHz or 2.4GHz antenna, or a multiband one. For dual band applications it is possible to use both sub-GHz and 2.4GHz interfaces simultaneously. The external WDT with battery monitor allows a robust and resilience operation for most critical applications. diff --git a/platform/zoul/remote/board.c b/platform/zoul/remote-reva/board.c similarity index 95% rename from platform/zoul/remote/board.c rename to platform/zoul/remote-reva/board.c index ad98f2fd0..ddf85ed86 100644 --- a/platform/zoul/remote/board.c +++ b/platform/zoul/remote-reva/board.c @@ -29,11 +29,11 @@ */ /*---------------------------------------------------------------------------*/ /** - * \addtogroup remote + * \addtogroup remote-reva * @{ * * \file - * Board-initialisation for the Zolertia's RE-Mote platform + * Board-initialisation for the Zolertia's RE-Mote revision A platform * */ /*---------------------------------------------------------------------------*/ diff --git a/platform/zoul/remote/board.h b/platform/zoul/remote-reva/board.h similarity index 98% rename from platform/zoul/remote/board.h rename to platform/zoul/remote-reva/board.h index 2887f452a..338d6c8e1 100644 --- a/platform/zoul/remote/board.h +++ b/platform/zoul/remote-reva/board.h @@ -33,7 +33,7 @@ * \addtogroup zoul-platforms * @{ * - * \defgroup remote RE-Mote platform + * \defgroup remote-reva RE-Mote platform revision A * * The RE-Mote was designed jointly with universities and industry partners in * RERUM European project, to ease the development of private and secure @@ -42,7 +42,7 @@ * Shutdown mode to reduce its power consumption down to 300nA. * * This file provides connectivity information on LEDs, Buttons, UART and - * other RE-Mote peripherals + * other RE-Mote revision A peripherals * * This file can be used as the basis to configure other platforms using the * cc2538 SoC. @@ -50,7 +50,7 @@ * * \file * Header file with definitions related to the I/O connections on the Zolertia's - * RE-Mote platform, cc2538-based + * RE-Mote platform (revision A), cc2538-based * * \note Do not include this file directly. It gets included by contiki-conf * after all relevant directives have been set. @@ -485,7 +485,7 @@ * \name Device string used on startup * @{ */ -#define BOARD_STRING "Zolertia RE-Mote platform" +#define BOARD_STRING "Zolertia RE-Mote revision A platform" /** @} */ #endif /* BOARD_H_ */ diff --git a/platform/zoul/remote/power-mgmt.c b/platform/zoul/remote-reva/power-mgmt.c similarity index 100% rename from platform/zoul/remote/power-mgmt.c rename to platform/zoul/remote-reva/power-mgmt.c diff --git a/platform/zoul/remote/power-mgmt.h b/platform/zoul/remote-reva/power-mgmt.h similarity index 100% rename from platform/zoul/remote/power-mgmt.h rename to platform/zoul/remote-reva/power-mgmt.h diff --git a/platform/zoul/remote-revb/Makefile.remote-revb b/platform/zoul/remote-revb/Makefile.remote-revb new file mode 100644 index 000000000..34f526c65 --- /dev/null +++ b/platform/zoul/remote-revb/Makefile.remote-revb @@ -0,0 +1,2 @@ +MOTELIST_ZOLERTIA = remote +BOARD_SOURCEFILES += board.c antenna-sw.c rtcc.c leds-res-arch.c diff --git a/platform/zoul/remote-revb/README.md b/platform/zoul/remote-revb/README.md new file mode 100644 index 000000000..8b6095e24 --- /dev/null +++ b/platform/zoul/remote-revb/README.md @@ -0,0 +1,43 @@ +Zolertia RE-Mote platform (revision B) +============================================ + +The RE-Mote is a hardware development platform to build real IoT (Internet of Things) applications and products, aimed to high skilled developers as well as Makers (Do-It-Yourself enthusiasts) and early beginners, providing an industry-ready and resilient hardware solution for most Smart Cities, Home Comfort, eHealth and Industrial applications. The RE-Mote conciliates an ultra-low power consumption with a high performance design, meeting specifications of processing resources, security and resilient operation. + +The RE-Mote platform was designed jointly with universities and industrial partners from different countries in the context of RERUM European Project. + +The RE-Mote features a Zoul as its core module and it is bundled with the following features: + +* ARM Cortex-M3 with 512KB flash and 32KB RAM (16KB retention), 32MHz. +* ISM 2.4-GHz IEEE 802.15.4 & Zigbee/Thread compliant. +* ISM 868-, 915-, 920-, 950-MHz ISM/SRD Band. +* On-board RF switch to programatically select RF itnerfaces. Above RF interfaces can be used alternatively over a single RP-SMA connector for external antenna, or simultaneously by using an UFl pigtail or soldering an internal ceramic chip antenna (available on request). +* AES-128/256, SHA2 Hardware Encryption Engine. +* ECC-128/256, RSA Hardware Acceleration Engine for Secure Key Exchange. +* Power consumption down to 150nA using our shutdown mode. +* Programming over BSL without requiring to press any button to enter bootloader mode. +* Built-in battery charger (500mA), Energy Harvesting and Solar Panels to be connected to standards LiPo batteries. +* Power input with wide range 3.7-16VDC. +* On-board micro USB connector for USB 2.0 applications. +* RGB LED to allow more than 7 colour combinations. +* On-board nano-watt Real Time Clock Calendar (RTCC). +* User and Reset buttons. +* On-board Micro-SD for external storage. +* On-board external Watchdog Timer (WDT) for resilient operation. +* Small form-factor of 73x40 mm. +* Available with enclosure for indoor use + +The changes from Revision A to this new Revision B are summarized in the [Wiki](https://github.com/Zolertia/Resources/wiki/RE-Mote:-Enhancements-from-Rev.A-to-Rev.B) + +The most prominent feature of the RE-Mote is its ultra low-power implementation, allowing a flexible and time/date-aware control of the platform operation modes by using its real-time clock (RTCC) and an ultra-low power PIC governing the battery manager. + +The RE-Mote features an optional custom-made enclosure to fit most scenarios, allowing to easily connect sensors, actuators and rechargeable LiPo batteries. Its on-board RP-SMA antenna eliminates the need to mechanize an external antenna, allowing to alternatively use either a sub-1GHz or 2.4GHz antenna, or a multiband one. For dual band applications it is possible to use both sub-GHz and 2.4GHz interfaces simultaneously. + +The external WDT with battery monitor allows a robust and resilience operation for most critical applications. + +Zoul pin-out +============= + +![RE-Mote pin-out (front)][remote-pinout-front] +![RE-Mote pin-out (back)][remote-pinout-back] + + diff --git a/platform/zoul/remote-revb/board.c b/platform/zoul/remote-revb/board.c new file mode 100644 index 000000000..f3e39617c --- /dev/null +++ b/platform/zoul/remote-revb/board.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.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. + */ +/*---------------------------------------------------------------------------*/ +/** + * \addtogroup remote-revb + * @{ + * + * \file + * Board-initialisation for the Zolertia's RE-Mote revision B platform + * + */ +/*---------------------------------------------------------------------------*/ +#include "contiki-conf.h" +#include "antenna-sw.h" +#include +#include +/*---------------------------------------------------------------------------*/ +static void +configure_unused_pins(void) +{ + /* FIXME */ +} +/*---------------------------------------------------------------------------*/ +void +board_init() +{ + antenna_sw_config(); + configure_unused_pins(); +} +/*---------------------------------------------------------------------------*/ +/** + * @} + */ + diff --git a/platform/zoul/remote-revb/board.h b/platform/zoul/remote-revb/board.h new file mode 100644 index 000000000..783209e26 --- /dev/null +++ b/platform/zoul/remote-revb/board.h @@ -0,0 +1,522 @@ +/* + * Copyright (c) 2016, Zolertia + * 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. + */ +/** + * \addtogroup zoul-platforms + * @{ + * + * \defgroup remote-revb RE-Mote platform revision B + * + * The RE-Mote was designed jointly with universities and industry partners in + * RERUM European project, to ease the development of private and secure + * applications for IoT and Smart City applications. The RE-Mote packs several + * on-board resources, like a RTC, external WDT, Micro-SD, RF switch and a + * Shutdown mode to reduce its power consumption down to 150nA. + * + * This file provides connectivity information on LEDs, Buttons, UART and + * other RE-Mote revision A peripherals + * + * This file can be used as the basis to configure other platforms using the + * cc2538 SoC. + * @{ + * + * \file + * Header file with definitions related to the I/O connections on the Zolertia's + * RE-Mote platform (revision B), cc2538-based + * + * \note Do not include this file directly. It gets included by contiki-conf + * after all relevant directives have been set. + */ +#ifndef BOARD_H_ +#define BOARD_H_ + +#include "dev/gpio.h" +#include "dev/nvic.h" +/*---------------------------------------------------------------------------*/ +/** \name Connector headers + * + * The RE-Mote features two 2.54 mm header rows over which exposes the following + * pins (facing up, Zolertia/RERUM logo above, buttons and micro USB at bottom): + * ----------------------+---+---+--------------------------------------------- + * PIN_NAME |JP6|JP5| PIN_NAME + * ----------------------+---+---+--------------------------------------------- + * LED1.R/PD4 |-01|17-| PB2/SPIO0.SCLK/CC1200.SCLK + * LED2.G/JTAG.TDO/PB7 |-02|16-| PB1/SPIO0.MOSI/CC1200.MOSI + * LED3.B/JTAG.TDI/PB6 |-03|15-| PB3/SPIO0.MISO/CC1200.MISO + * UART0.RX/PA0 |-04|14-| PA7/AIN7/USD.CS|ADC5 + * UART0.TX/PA1 |-05|13-| DGND + * PD0 |-06|12-| D+3.3 + * I2C.SDA/PC2 |-07|11-| PA5/AIN5/ADC1 + * I2C.SCL/PC3 |-08|10-| PA4/AIN4/ADC2 + * DGND |-09|09-| DGND + * D+3.3 |-10|08-| D+5.0 + * CC1200.GPIO0/PB4 |-11|07-| PA2/AIN2/ADC3 + * CC1200.GPIO2/PB0 |-12|06-| PA6/AIN6/USD.SEL|ADC4 + * UART1.RX/PC1 |-13|05-| PC6/SPI1.MISO + * UART1.TX/PC0 |-14|04-| PC5/SPI1.MOSI + * DGND |-15|03-| PC4/SPI1.SCLK + * D+3.3 |-16|02-| PS+EXT/VIN + * CC1200.CS/PB5 |-17|01-| DGND + * ----------------------+---+---+--------------------------------------------- + * + * Two auxiliary connectors allow to connect an external LiPo battery and + * access to the RESET/user buttons: + * + * - JP4 (placed below JP6 connector): |1-| DGND, |2-| VBAT + * - JP9 (placed above JP5 connector): |1-| BUTTON.RESET, |2-| BUTTON.USER|ADC6 + */ +/*---------------------------------------------------------------------------*/ +/** \name RE-Mote LED configuration + * + * LEDs on the RE-Mote are exposed in the JP6 port as follows: + * - LED1 (Red) -> PD4 + * - LED2 (Green) -> PB7 (shared with JTAG.TDO) + * - LED3 (Blue) -> PB6 (shared with JTAG.TDI) + * + * The LEDs are connected to a MOSFET to minimize current draw. The LEDs can + * be disabled by removing resistors R12, R13 and R14. + * @{ + */ +/*---------------------------------------------------------------------------*/ +#undef LEDS_GREEN +#undef LEDS_YELLOW +#undef LEDS_BLUE +#undef LEDS_RED +#undef LEDS_CONF_ALL + +#define LEDS_RED 1 /**< LED1 (Red) -> PD4 */ +#define LEDS_RED_PIN_MASK (1 << 4) +#define LEDS_RED_PORT_BASE GPIO_D_BASE + +#define LEDS_GREEN 2 /**< LED2 (Green) -> PB7 */ +#define LEDS_GREEN_PIN_MASK (1 << 7) +#define LEDS_GREEN_PORT_BASE GPIO_B_BASE + +#define LEDS_BLUE 4 /**< LED3 (Blue) -> PB6 */ +#define LEDS_BLUE_PIN_MASK (1 << 6) +#define LEDS_BLUE_PORT_BASE GPIO_B_BASE + +#define LEDS_CONF_ALL (LEDS_GREEN | LEDS_BLUE | LEDS_RED) /* 7 */ +#define LEDS_LIGHT_BLUE (LEDS_GREEN | LEDS_BLUE) /* 6 */ +#define LEDS_YELLOW (LEDS_GREEN | LEDS_RED) /* 3 */ +#define LEDS_PURPLE (LEDS_BLUE | LEDS_RED) /* 5 */ +#define LEDS_WHITE LEDS_ALL /* 7 */ + +/* Notify various examples that we have LEDs */ +#define PLATFORM_HAS_LEDS 1 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** \name USB configuration + * + * The USB pullup is enabled by an external resistor, not mapped to a GPIO + */ +#ifdef USB_PULLUP_PORT +#undef USB_PULLUP_PORT +#endif +#ifdef USB_PULLUP_PIN +#undef USB_PULLUP_PIN +#endif +/** @} */ +/*---------------------------------------------------------------------------*/ +/** \name UART configuration + * + * On the RE-Mote, the UARTs are connected to the following ports/pins: + * + * - UART0: + * - RX: PA0, connected to CP2104 serial-to-usb converter TX pin + * - TX: PA1, connected to CP2104 serial-to-usb converter RX pin + * - UART1: + * - RX: PC1 + * - TX: PC0 + * - CTS: disabled as default, PD0 may be assigned if not using I2C interrupts + * - RTS: disabled as default + * + * We configure the port to use UART0 and UART1, CTS/RTS only for UART1, + * both without a HW pull-up resistor + * UART0 and UART1 pins are exposed over the JP6 connector + * @{ + */ +#define UART0_RX_PORT GPIO_A_NUM +#define UART0_RX_PIN 0 +#define UART0_TX_PORT GPIO_A_NUM +#define UART0_TX_PIN 1 + +#define UART1_RX_PORT GPIO_C_NUM +#define UART1_RX_PIN 1 +#define UART1_TX_PORT GPIO_C_NUM +#define UART1_TX_PIN 0 +#define UART1_CTS_PORT (-1) +#define UART1_CTS_PIN (-1) +#define UART1_RTS_PORT (-1) +#define UART1_RTS_PIN (-1) +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name ADC configuration + * + * These values configure which CC2538 pins and ADC channels to use for the ADC + * inputs. By default the RE-Mote allows two out-of-the-box ADC ports with a + * phidget-like 3-pin connector (GND/VDD/ADC) + * + * The RE-Mote allows both 3.3V and 5V analogue sensors as follow: + * + * - ADC1 (PA5): up to 3.3V. + * - ADC2 (PA4): up to 3.3V + * - ADC3 (PA2): up to 5V, by means of a 2/3 voltage divider. + * + * Also there are other ADC channels shared by default with Micro SD card and + * user button implementations: + * + * - ADC4 (PA6): up to 3.3V. + * - ADC5 (PA7): up to 3.3V. + * - ADC6 (PA3): up to 3.3V. + * + * ADC inputs can only be on port A. + * All ADCx are exposed in JP5 connector, but only ADC1 and ADC3 have GND and + * VDD (3/5V) pins next to it, so these can be exposed into a 3-pin phidget-like + * connector, for ADC2 either solder a wire to connect, or use a 4-pin connector + * to expose both ADC1 and ADC2 in a single connector, but this will leave no + * space for a ADC3 connector. + * + * The internal ADC reference is 1190mV, use either a voltage divider as input, + * or a different voltage reference, like AVDD5, or externally using PA7/AIN7 + * and PA6/AIN6 configurable as differential reference, by removing the R26 and + * R33 0Ohm resistors to disconnect off the Micro-SD, and those will be + * accessible from JP5 connector. + * + * To enable the ADC[2,4-6], remove any 0Ohm resistors if required (see above), + * and define in your application `ADC_SENSORS_CONF_ADCx_PIN` and set its + * value with the corresponding pin number (i.e ADC2 to 4 as mapped to PA4). + * To disable any ADC[1-6] just define as above, but set to (-1) instead. + + * Warning: if using ADC6 (PA3), you will need to disable the bootloader by + * making FLASH_CCA_CONF_BOOTLDR_BACKDOOR equal to zero + * + * @{ + */ +#define ADC_SENSORS_PORT GPIO_A_NUM /**< ADC GPIO control port */ + +#ifndef ADC_SENSORS_CONF_ADC1_PIN +#define ADC_SENSORS_ADC1_PIN 5 /**< ADC1 to PA5, 3V3 */ +#else +#if ((ADC_SENSORS_CONF_ADC1_PIN != -1) && (ADC_SENSORS_CONF_ADC1_PIN != 5)) +#error "ADC1 channel should be mapped to PA5 or disabled with -1" +#else +#define ADC_SENSORS_ADC1_PIN ADC_SENSORS_CONF_ADC1_PIN +#endif +#endif + +#ifndef ADC_SENSORS_CONF_ADC3_PIN +#define ADC_SENSORS_ADC3_PIN 2 /**< ADC3 to PA2, 5V */ +#else +#if ((ADC_SENSORS_CONF_ADC3_PIN != -1) && (ADC_SENSORS_CONF_ADC3_PIN != 2)) +#error "ADC3 channel should be mapped to PA2 or disabled with -1" +#else +#define ADC_SENSORS_ADC3_PIN ADC_SENSORS_CONF_ADC3_PIN +#endif +#endif + +#ifndef ADC_SENSORS_CONF_ADC2_PIN +#define ADC_SENSORS_ADC2_PIN (-1) /**< ADC2 no declared */ +#else +#define ADC_SENSORS_ADC2_PIN 4 /**< Hard-coded to PA4 */ +#endif + +#ifndef ADC_SENSORS_CONF_ADC4_PIN +#define ADC_SENSORS_ADC4_PIN (-1) /**< ADC4 not declared */ +#else +#define ADC_SENSORS_ADC4_PIN 6 /**< Hard-coded to PA6 */ +#endif + +#ifndef ADC_SENSORS_CONF_ADC5_PIN +#define ADC_SENSORS_ADC5_PIN (-1) /**< ADC5 not declared */ +#else +#define ADC_SENSORS_ADC5_PIN 7 /**< Hard-coded to PA7 */ +#endif + +#ifndef ADC_SENSORS_CONF_ADC6_PIN +#define ADC_SENSORS_ADC6_PIN (-1) /**< ADC6 not declared */ +#else +#define ADC_SENSORS_ADC6_PIN 3 /**< Hard-coded to PA3 */ +#endif + +#ifndef ADC_SENSORS_CONF_MAX +#define ADC_SENSORS_MAX 2 /**< Maximum sensors */ +#else +#define ADC_SENSORS_MAX ADC_SENSORS_CONF_MAX +#endif +/** @} */ +/*---------------------------------------------------------------------------*/ +/** \name RE-Mote Button configuration + * + * Buttons on the RE-Mote are connected as follows: + * - BUTTON_USER -> PA3, S1 user button, shared with bootloader + * - BUTTON_RESET -> RESET_N line, S2 reset the CC2538 + * - BUTTON_PWR -> Depending on the enabled resistor, it can be used to reset + * the onboard Low-power PIC, provoking a master reset on all + * the RE-Mote's onboards components. Note the BUTTON_RESET + * only resets the CC2538. This is disabled by default, as + * the R45 0Ohm resistor is not soldered on that position + * The other R45 position enables a test-button to drive the + * SYSOFF pin of the power management block, disconnecting the + * battery when used, leaving only powered the RTCC and + * Low-Power PIC. Useful if developing applications using the + * shutdown mode if required to snap out of it. + * @{ + */ +#define BUTTON_USER_PORT GPIO_A_NUM +#define BUTTON_USER_PIN 3 +#define BUTTON_USER_VECTOR NVIC_INT_GPIO_PORT_A + +/* Notify various examples that we have an user button. + * If ADC6 channel is used, then disable the user button + */ +#ifdef PLATFORM_CONF_WITH_BUTTON +#if (PLATFORM_CONF_WITH_BUTTON && (ADC_SENSORS_ADC6_PIN == 3)) +#error "The ADC6 (PA3) and user button cannot be enabled at the same time" +#else +#define PLATFORM_HAS_BUTTON (PLATFORM_CONF_WITH_BUTTON && \ + !(ADC_SENSORS_ADC6_PIN == 3)) +#endif /* (PLATFORM_CONF_WITH_BUTTON && (ADC_SENSORS_ADC6_PIN == 3)) */ +#else +#define PLATFORM_HAS_BUTTON !(ADC_SENSORS_ADC6_PIN == 3) +#endif /* PLATFORM_CONF_WITH_BUTTON */ +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name SPI (SSI0) configuration + * + * These values configure which CC2538 pins to use for the SPI (SSI0) lines, + * reserved exclusively for the CC1200 RF transceiver. These pins are not + * exposed to any connector, and should be avoid to use it. + * TX -> MOSI, RX -> MISO + * @{ + */ +#define SPI0_CLK_PORT GPIO_B_NUM +#define SPI0_CLK_PIN 2 +#define SPI0_TX_PORT GPIO_B_NUM +#define SPI0_TX_PIN 1 +#define SPI0_RX_PORT GPIO_B_NUM +#define SPI0_RX_PIN 3 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name SPI (SSI1) configuration + * + * These values configure which CC2538 pins to use for the SPI (SSI1) lines, + * shared with the microSD and exposed over JP5 connector. + * TX -> MOSI, RX -> MISO + * @{ + */ +#define SPI1_CLK_PORT GPIO_C_NUM +#define SPI1_CLK_PIN 4 +#define SPI1_TX_PORT GPIO_C_NUM +#define SPI1_TX_PIN 5 +#define SPI1_RX_PORT GPIO_C_NUM +#define SPI1_RX_PIN 6 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name I2C configuration + * + * These values configure which CC2538 pins to use for the I2C lines, exposed + * over JP6 connector. + * The I2C bus is shared with the on-board RTC and the Low-Power PIC + * The I2C is exposed over the JP6 header, using a 5-pin connector with 2.54 mm + * spacing, providing also D+3.3V, GND and PD0 pin that can be used as an + * interrupt pin if required + * @{ + */ +#define I2C_SCL_PORT GPIO_C_NUM +#define I2C_SCL_PIN 3 +#define I2C_SDA_PORT GPIO_C_NUM +#define I2C_SDA_PIN 2 +#define I2C_INT_PORT GPIO_D_NUM +#define I2C_INT_PIN 0 +#define I2C_INT_VECTOR NVIC_INT_GPIO_PORT_D +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name Antenna switch configuration + * + * These values configure the required pin to drive the RF antenna switch, to + * either enable the sub-1Ghz RF interface (power-up the CC1200) or the 2.4GHz + * RF interface of the CC2538, both alternatively routed to a RP-SMA connector + * to allow using an external antenna for both cases. + * + * Note it is also possible to enable both RF interfaces at the same time, by + * switching On the sub-1GHz RF interface, and placing an 0Ohm resistor (R19), + * to select between using a ceramic chip antenna (not mounted), or to connect + * and external antenna over a pigtail to the U.Fl connector (not mounted). + * + * RF switch state: + * - LOW: 2.4GHz RF interface on RP-SMA connector, CC1200 powered-off. + * - HIGH: Sub-1GHz RF interface on RP-SMA connector. + * @{ + */ +#define ANTENNA_RF_SW_PORT GPIO_D_NUM +#define ANTENNA_RF_SW_PIN 2 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name Dual RF interface support + * + * Enables support for dual band operation (both CC1200 and 2.4GHz enabled). + * The driver checks the selected Radio stack, and forces the antenna switch to + * either position. Enabling the definition below forces to skip this check. + * @{ + */ +#define REMOTE_DUAL_RF_ENABLED 0 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name CC1200 configuration + * + * These values configure the required pins to drive the CC1200 + * None of the following pins are exposed to any connector, kept for internal + * use only + * @{ + */ +#define CC1200_SPI_INSTANCE 0 +#define CC1200_SPI_SCLK_PORT SPI0_CLK_PORT +#define CC1200_SPI_SCLK_PIN SPI0_CLK_PIN +#define CC1200_SPI_MOSI_PORT SPI0_TX_PORT +#define CC1200_SPI_MOSI_PIN SPI0_TX_PIN +#define CC1200_SPI_MISO_PORT SPI0_RX_PORT +#define CC1200_SPI_MISO_PIN SPI0_RX_PIN +#define CC1200_SPI_CSN_PORT GPIO_B_NUM +#define CC1200_SPI_CSN_PIN 5 +#define CC1200_GDO0_PORT GPIO_B_NUM +#define CC1200_GDO0_PIN 4 +#define CC1200_GDO2_PORT GPIO_B_NUM +#define CC1200_GDO2_PIN 0 +#define CC1200_RESET_PORT GPIO_C_NUM +#define CC1200_RESET_PIN 7 +#define CC1200_GPIOx_VECTOR NVIC_INT_GPIO_PORT_B +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name microSD configuration + * + * These values configure the required pins to drive the built-in microSD + * external module, to be used with SSI1. USD_CSN and USD_SEL are shared with + * ADC4/ADC5, but it is disabled by default as there are 0Ohm resistors + * connecting the PA6/PA7 pins to the microSD (see ADC block above for comments) + * The USD_SEL pin can be used both as output and input, to detect if there is + * a microSD in the slot, or when connected to disable the microSD to save power + * @{ + */ +#define USD_CLK_PORT SPI1_CLK_PORT +#define USD_CLK_PIN SPI1_CLK_PIN +#define USD_MOSI_PORT SPI1_TX_PORT +#define USD_MOSI_PIN SPI1_TX_PIN +#define USD_MISO_PORT SPI1_RX_PORT +#define USD_MISO_PIN SPI1_RX_PIN +#define USD_CSN_PORT GPIO_A_NUM +#define USD_CSN_PIN 7 +#define USD_SEL_PORT GPIO_A_NUM +#define USD_SEL_PIN 6 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name Power management and shutdown mode + * + * The shutdown mode is an ultra-low power operation mode that effectively + * powers-down the entire RE-Mote (CC2538, CC1200, attached sensors, etc) and + * only keeps running a the on-board RTC and an ultra-low power consumption MCU + * The Shutdown mode allows: + * + * - Put the board in an ultra-low power sleep (shutdown) drawing <150nA avg. + * - Awake the system by scheduling the RTCC to awake the Low-Power PIC after + * it disconnects the battery and goes to sleep mode. + * - Awake the system by using the Low-Power PIC's timer + * + * As commented above, S3 can be used to restart the entire board (power + * management block included), or to kick the board out of shutdown mode by + * reconnecting the battery. + * @{ + */ +#define PM_ENABLE_PORT GPIO_D_NUM +#define PM_ENABLE_PIN 1 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name On-board RTCC + * + * The on-board RTCC (real time clock-calendar) is powered over USB/battery, + * and it will remain powered in shutdown mode with the Low-Power PIC. The + * RTC_INT1 is connected to the CC2538, so it is possible to receive interrupts + * from a pre-configured alarm, even waking up the CC2538 from PM3. + * A second interruption pin (RTC_INT2) is connected to the Low-Power PIC, after + * configuring the RTCC the Low-Power PIC can drive the board to shutdown mode, + * and enter into low-power mode (sleep), being the RTCC interrupt the waking up + * source to resume operation. + * + * @{ + */ +#define RTC_SDA_PORT I2C_SDA_PORT +#define RTC_SDA_PIN I2C_SDA_PIN +#define RTC_SCL_PORT I2C_SCL_PORT +#define RTC_SCL_PIN I2C_SCL_PIN +#define RTC_INT1_PORT GPIO_D_NUM +#define RTC_INT1_PIN 3 +#define RTC_INT1_VECTOR NVIC_INT_GPIO_PORT_D +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name On-board external WDT + * The RE-Mote features an on-board external WDT and battery monitor, which + * adds more robustness and prevents the mote to run wild if any unexpected + * problem shows-up. + * The external WDT requires a short pulse (<1ms) to be sent before a 2-second + * period. The battery monitor keeps the device in Reset if the voltage input + * is lower than 2.5V. + * The external WDT can be disabled by removing the R34 0Ohm resistor. + * As default the Texas Instrument's TPS3823 WDT is not mounted. + * Alternatively the testpoint or unused WDT's pad can be used to re-use as GPIO + * @{ + */ +#define EXT_WDT_PORT GPIO_D_NUM +#define EXT_WDT_PIN 5 +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name Device string used on startup + * @{ + */ +#define BOARD_STRING "Zolertia RE-Mote revision B platform" +/** @} */ + +#endif /* BOARD_H_ */ + +/** + * @} + * @} + */ diff --git a/platform/zoul/remote-revb/leds-res-arch.c b/platform/zoul/remote-revb/leds-res-arch.c new file mode 100644 index 000000000..59484c2ff --- /dev/null +++ b/platform/zoul/remote-revb/leds-res-arch.c @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2015, Zolertia - http://www.zolertia.com + * Copyright (c) 2015, University of Bristol - http://www.bristol.ac.uk + * 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. + */ +/** + * \addtogroup zoul + * @{ + * + * \defgroup remote-revb-leds RE-Mote revision B arch LED + * + * LED driver implementation for the RE-Mote revision B + * @{ + * + * \file + * LED driver implementation for the RE-Mote revision B + */ +#include "contiki.h" +#include "reg.h" +#include "dev/leds.h" +#include "dev/gpio.h" +#include "dev/ioc.h" +/*---------------------------------------------------------------------------*/ +#define LEDS_PORTB_PIN_MASK (LEDS_GREEN_PIN_MASK | LEDS_BLUE_PIN_MASK) +/*---------------------------------------------------------------------------*/ +void +leds_arch_init(void) +{ + /* Initialize LED2 (Green) and LED3 (Blue) */ + GPIO_SOFTWARE_CONTROL(GPIO_B_BASE, LEDS_PORTB_PIN_MASK); + GPIO_SET_OUTPUT(GPIO_B_BASE, LEDS_PORTB_PIN_MASK); + GPIO_CLR_PIN(GPIO_B_BASE, LEDS_PORTB_PIN_MASK); + + /* Initialize LED1 (Red) */ + GPIO_SOFTWARE_CONTROL(LEDS_RED_PORT_BASE, LEDS_RED_PIN_MASK); + GPIO_SET_OUTPUT(LEDS_RED_PORT_BASE, LEDS_RED_PIN_MASK); + GPIO_CLR_PIN(LEDS_RED_PORT_BASE, LEDS_RED_PIN_MASK); +} +/*---------------------------------------------------------------------------*/ +unsigned char +leds_arch_get(void) +{ + uint8_t mask_leds; + + mask_leds = GPIO_READ_PIN(LEDS_GREEN_PORT_BASE, LEDS_GREEN_PIN_MASK) == 0 ? 0: LEDS_GREEN; + mask_leds |= GPIO_READ_PIN(LEDS_BLUE_PORT_BASE, LEDS_BLUE_PIN_MASK) == 0 ? 0 : LEDS_BLUE; + mask_leds |= GPIO_READ_PIN(LEDS_RED_PORT_BASE, LEDS_RED_PIN_MASK) == 0 ? 0 : LEDS_RED; + + return mask_leds; +} +/*---------------------------------------------------------------------------*/ +void +leds_arch_set(unsigned char leds) +{ + if(leds & LEDS_GREEN) { + GPIO_SET_PIN(LEDS_GREEN_PORT_BASE, LEDS_GREEN_PIN_MASK); + } else { + GPIO_CLR_PIN(LEDS_GREEN_PORT_BASE, LEDS_GREEN_PIN_MASK); + } + + if(leds & LEDS_BLUE) { + GPIO_SET_PIN(LEDS_BLUE_PORT_BASE, LEDS_BLUE_PIN_MASK); + } else { + GPIO_CLR_PIN(LEDS_BLUE_PORT_BASE, LEDS_BLUE_PIN_MASK); + } + + if(leds & LEDS_RED) { + GPIO_SET_PIN(LEDS_RED_PORT_BASE, LEDS_RED_PIN_MASK); + } else { + GPIO_CLR_PIN(LEDS_RED_PORT_BASE, LEDS_RED_PIN_MASK); + } +} +/*---------------------------------------------------------------------------*/ +/** + * @} + * @} + */ diff --git a/platform/zoul/remote/Makefile.remote b/platform/zoul/remote/Makefile.remote deleted file mode 100644 index 11f5ebe3a..000000000 --- a/platform/zoul/remote/Makefile.remote +++ /dev/null @@ -1,2 +0,0 @@ -MOTELIST_ZOLERTIA = remote -BOARD_SOURCEFILES += board.c antenna-sw.c rtcc.c power-mgmt.c