Zoul: cleaned headers, doxygen tags and uncrustified

This commit is contained in:
Antonio Lignan 2016-09-01 16:08:01 +02:00
parent 3227360b92
commit e25a62997d
24 changed files with 122 additions and 91 deletions

View file

@ -481,7 +481,6 @@ PROCESS_THREAD(at_test_process, ev, data)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** /**
* @}
* @} * @}
* @} * @}
*/ */

View file

@ -29,7 +29,7 @@
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** /**
* \addtogroup remote-examples * \addtogroup zoul-examples
* @{ * @{
* *
* \defgroup zoul-AT-master-test * \defgroup zoul-AT-master-test
@ -63,5 +63,8 @@
#define NETSTACK_CONF_RDC nullrdc_driver #define NETSTACK_CONF_RDC nullrdc_driver
#endif /* PROJECT_CONF_H_ */ #endif /* PROJECT_CONF_H_ */
/*---------------------------------------------------------------------------*/
/** @} */ /**
* @}
* @}
*/

View file

@ -35,11 +35,12 @@
* @{ * @{
* *
* \file * \file
* Test file for the CC1200 demo * Test file for the CC1200 demo
* *
* \author * \author
* Antonio Lignan <alinan@zolertia.com> * Antonio Lignan <alinan@zolertia.com>
*/ */
/*---------------------------------------------------------------------------*/
#include "contiki.h" #include "contiki.h"
#include "cpu.h" #include "cpu.h"
#include "sys/etimer.h" #include "sys/etimer.h"

View file

@ -43,6 +43,7 @@
* \author * \author
* Antonio Lignan <alinan@zolertia.com> * Antonio Lignan <alinan@zolertia.com>
*/ */
/*---------------------------------------------------------------------------*/
#ifndef PROJECT_CONF_H_ #ifndef PROJECT_CONF_H_
#define PROJECT_CONF_H_ #define PROJECT_CONF_H_

View file

@ -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. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * 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 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE. * OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
/*---------------------------------------------------------------------------*/
/** /**
* \addtogroup remote-examples * \addtogroup zoul-examples
* @{ * @{
* *
* \file * \file
* Project specific configuration defines for the basic RE-Mote examples * Project specific configuration defines for the basic RE-Mote examples
*/ */
/*---------------------------------------------------------------------------*/
#ifndef PROJECT_CONF_H_ #ifndef PROJECT_CONF_H_
#define PROJECT_CONF_H_ #define PROJECT_CONF_H_

View file

@ -0,0 +1 @@
TARGET = zoul

View file

@ -80,18 +80,18 @@ static char *
print_pm(uint8_t state) print_pm(uint8_t state)
{ {
switch(state) { switch(state) {
case PM_SYSOFF_ON: case PM_SYSOFF_ON:
return "Battery on"; return "Battery on";
case PM_SYSOFF_OFF: case PM_SYSOFF_OFF:
return "Battery off"; return "Battery off";
case PM_TIMER_ENABLED: case PM_TIMER_ENABLED:
return "Nano Timer enabled"; return "Nano Timer enabled";
case PM_TIMER_DISABLED: case PM_TIMER_DISABLED:
return "Nano Timer disabled"; return "Nano Timer disabled";
case PM_AWAITING_RTC_EVENT: case PM_AWAITING_RTC_EVENT:
return "Awaiting RTC event"; return "Awaiting RTC event";
default: default:
return "UNKNOWN"; return "UNKNOWN";
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -107,24 +107,24 @@ get_status(uint8_t mask, uint8_t *val)
} }
if(!mask) { if(!mask) {
printf("STATUS %u\n", status); printf("STATUS %u\n", status);
*val = PM_IDLE; *val = PM_IDLE;
return PM_SUCCESS; return PM_SUCCESS;
} }
/* Read back ony the requested status bit */ /* Read back ony the requested status bit */
switch(mask) { switch(mask) {
case PM_SYSOFF_ON_MASK: case PM_SYSOFF_ON_MASK:
print_msg = (status & mask) ? PM_SYSOFF_ON : PM_SYSOFF_OFF; print_msg = (status & mask) ? PM_SYSOFF_ON : PM_SYSOFF_OFF;
break; break;
case PM_TIMER_ENABLED_MASK: case PM_TIMER_ENABLED_MASK:
print_msg = (status & mask) ? PM_TIMER_ENABLED : PM_TIMER_DISABLED; print_msg = (status & mask) ? PM_TIMER_ENABLED : PM_TIMER_DISABLED;
break; break;
case PM_AWAITING_RTC_EVENT_MASK: case PM_AWAITING_RTC_EVENT_MASK:
print_msg = (status & mask) ? PM_AWAITING_RTC_EVENT : PM_AWAITING_RTC_DIS; print_msg = (status & mask) ? PM_AWAITING_RTC_EVENT : PM_AWAITING_RTC_DIS;
break; break;
default: default:
return PM_ERROR; return PM_ERROR;
} }
printf("Status -> %s\n", print_pm(print_msg)); printf("Status -> %s\n", print_pm(print_msg));
@ -194,7 +194,7 @@ PROCESS_THREAD(test_remote_pm, ev, data)
broadcast_send(&bc); broadcast_send(&bc);
/* And wait a few seconds before going to sleep */ /* And wait a few seconds before going to sleep */
while(1){ while(1) {
etimer_set(&et, CLOCK_SECOND); etimer_set(&et, CLOCK_SECOND);
PROCESS_WAIT_EVENT(); PROCESS_WAIT_EVENT();

View file

@ -0,0 +1 @@
TARGET = zoul

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ * Copyright (c) 2015, Zolertia <http://www.zolertia.com>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * 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 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE. * 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 * \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_ #ifndef PROJECT_CONF_H_
#define PROJECT_CONF_H_ #define PROJECT_CONF_H_
#define NETSTACK_CONF_RDC nullrdc_driver #define NETSTACK_CONF_RDC nullrdc_driver
#endif /* PROJECT_CONF_H_ */ #endif /* PROJECT_CONF_H_ */
/*---------------------------------------------------------------------------*/
/** @} */ /**
* @}
* @}
*/

View file

@ -1,5 +1,6 @@
/* /*
* Copyright (c) 2015, Zolertia - http://www.zolertia.com * Copyright (c) 2015, Zolertia <http://www.zolertia.com>
* All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * 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 * 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 * Retrieves the current time and date from the system, then sets an alarm to
@ -42,10 +41,8 @@
* @{ * @{
* *
* \file * \file
* RE-Mote on-board RTCC test application * RE-Mote on-board RTCC test application
*
* \author * \author
*
* Antonio Lignan <alinan@zolertia.com> * Antonio Lignan <alinan@zolertia.com>
* Aitor Mejias <amejias@zolertia.com> * Aitor Mejias <amejias@zolertia.com>
* Toni Lozano <tlozano@zolertia.com> * Toni Lozano <tlozano@zolertia.com>
@ -178,4 +175,3 @@ PROCESS_THREAD(test_remote_rtcc_process, ev, data)
* @} * @}
* @} * @}
*/ */

View file

@ -28,20 +28,22 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE. * OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
/* /**
* \addtogroup zoul-examples * \addtogroup zoul-examples
* @{ * @{
*
* \defgroup zoul-aac-sensor-test Test AAC sensor * \defgroup zoul-aac-sensor-test Test AAC sensor
* *
* Demonstrates the operation of the current AAC analog sensor * Demonstrates the operation of the current AAC analog sensor
* @{ * @{
* *
* \file * \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 * \author
* Javier Sánchez <asanchez@zolertia.com> * Javier Sánchez <asanchez@zolertia.com>
*/ */
/*---------------------------------------------------------------------------*/
#include "contiki.h" #include "contiki.h"
#include "sys/etimer.h" #include "sys/etimer.h"
#include "sys/rtimer.h" #include "sys/rtimer.h"
@ -64,7 +66,7 @@ AUTOSTART_PROCESSES(&test_aac_sensor_process);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS_THREAD(test_aac_sensor_process, ev, data) PROCESS_THREAD(test_aac_sensor_process, ev, data)
{ {
PROCESS_BEGIN(); PROCESS_BEGIN();
counter = 0; counter = 0;
@ -86,12 +88,12 @@ PROCESS_THREAD(test_aac_sensor_process, ev, data)
printf("-----------------------------------------\n" printf("-----------------------------------------\n"
"Counter = 0x%08x\n", counter); "Counter = 0x%08x\n", counter);
printf("AC Amps = %d mA\n", adc_sensors.value(ANALOG_AAC_SENSOR)); printf("AC Amps = %d mA\n", adc_sensors.value(ANALOG_AAC_SENSOR));
etimer_set(&et, LOOP_INTERVAL); etimer_set(&et, LOOP_INTERVAL);
counter++; counter++;
} }
} }
PROCESS_END(); PROCESS_END();
} }
@ -100,3 +102,4 @@ PROCESS_THREAD(test_aac_sensor_process, ev, data)
* @} * @}
* @} * @}
*/ */

View file

@ -70,7 +70,7 @@ PROCESS_THREAD(remote_ac_dimmer_process, ev, data)
/* Set the lamp to 10% and wait a few seconds */ /* Set the lamp to 10% and wait a few seconds */
ac_dimmer.value(DIMMER_DEFAULT_MIN_DIMM_VALUE); ac_dimmer.value(DIMMER_DEFAULT_MIN_DIMM_VALUE);
etimer_set(&et, CLOCK_SECOND * 5); 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 /* 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 * 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)
* @} * @}
* @} * @}
*/ */

View file

@ -38,7 +38,7 @@
* @{ * @{
* *
* \file * \file
* Test file for the BMP085/BMP180 digital pressure and temperature sensor * Test file for the BMP085/BMP180 digital pressure and temp sensor
* *
* \author * \author
* Antonio Lignan <alinan@zolertia.com> * Antonio Lignan <alinan@zolertia.com>

View file

@ -85,7 +85,7 @@ PROCESS_THREAD(remote_grove_gyro_process, ev, data)
* the 3 gyroscope axis use GROVE_GYRO_SENSOR. Alternatively the value * 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_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 /* 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 * 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 /* This sensor has a different operation from others using Contiki's sensor
* API, to make data acquisition we write the readings directly to the * 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 * extern data structure, allowing to write more than 1 value at the same
* operation, and also allowing upon a data interrupt event to immediatly * 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 * access the data. The return value of the value() call is then the status
* result of the read operation * result of the read operation
*/ */
if(grove_gyro.value(GROVE_GYRO_XYZ) == GROVE_GYRO_SUCCESS) { if(grove_gyro.value(GROVE_GYRO_XYZ) == GROVE_GYRO_SUCCESS) {

View file

@ -29,24 +29,25 @@
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** /**
* \addtogroup remote-examples * \addtogroup zoul-examples
* @{ * @{
* \defgroup remote-iaq-test *
* * \defgroup zoul-iaq-test
*
* RE-Mote external IAQ test application * RE-Mote external IAQ test application
* Example of iAQ-Core implementation and simple operation reading the value * 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 * order to get the first true measurement as datasheet recomendation
* (standard result of 0x82 is obtained in first time). * (standard result of 0x82 is obtained in first time).
* Then, once initialized, periodically each 5 seconds reads * Then, once initialized, periodically each 5 seconds reads
* the values of the IAQ sensor and shows in the screen, toggling the LED * 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. * red if CO2 was not initialized and LED green if the reading was succeed.
* *
* @{ * @{
* \file * \file
* RE-Mote implementation of external IAQ-CORE-C test application * RE-Mote implementation of external IAQ-CORE-C test application
* \author * \author
* Aitor Mejias <amejias@zolertia.com> * Aitor Mejias <amejias@zolertia.com>
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#include "contiki.h" #include "contiki.h"
@ -87,17 +88,16 @@ PROCESS_THREAD(test_remote_iaq_process, ev, data)
count_delay += LOOP_PERIOD; count_delay += LOOP_PERIOD;
leds_toggle(LEDS_RED); leds_toggle(LEDS_RED);
printf("Test-IAQ: Initializing Time-elapsed: %u seconds of aprox. %lu sec.\n", 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) { } else if(status == IAQ_ACTIVE) {
leds_off(LEDS_RED); leds_off(LEDS_RED);
leds_toggle(LEDS_GREEN); leds_toggle(LEDS_GREEN);
/* Get data from sensor: VOC, CO2 and internal status */ /* Get data from sensor: VOC, CO2 and internal status */
printf("CO2 current value is: %d ppm\n", iaq.value(IAQ_VOC_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("TIAQ current value is: %d ppb\n", iaq.value(IAQ_CO2_VALUE));
printf("Status is: 0x%0X\n", iaq.value(IAQ_STATUS)); printf("Status is: 0x%0X\n", iaq.value(IAQ_STATUS));
} } else {
else {
printf("iAQ-Core Error: 0x%02X\n", status); printf("iAQ-Core Error: 0x%02X\n", status);
} }
} }

View file

@ -40,7 +40,7 @@
* @{ * @{
* *
* \file * \file
* Test application for the digital motion/presence sensor * Test application for the digital motion/presence sensor
* *
* \author * \author
* Antonio Lignan <alinan@zolertia.com> * Antonio Lignan <alinan@zolertia.com>
@ -100,3 +100,4 @@ PROCESS_THREAD(test_presence_sensor, ev, data)
* @} * @}
* @} * @}
*/ */

View file

@ -31,13 +31,14 @@
/** /**
* \addtogroup zoul-examples * \addtogroup zoul-examples
* @{ * @{
*
* \defgroup zoul-pm10-sensor-test Test PM10 sensor * \defgroup zoul-pm10-sensor-test Test PM10 sensor
* *
* Demonstrates the operation of the Sharp PM10 analog sensor * Demonstrates the operation of the Sharp PM10 analog sensor
* @{ * @{
* *
* \file * \file
* GP2Y1010AU0F PM10 sensor example using the ADC sensors wrapper * GP2Y1010AU0F PM10 sensor example using the ADC sensors wrapper
* *
* \author * \author
* Toni Lozano <tlozano@zolertia.com> * Toni Lozano <tlozano@zolertia.com>
@ -93,3 +94,4 @@ PROCESS_THREAD(test_pm10_sensor_process, ev, data)
* @} * @}
* @} * @}
*/ */

View file

@ -87,3 +87,4 @@ PROCESS_THREAD(remote_relay_process, ev, data)
* @} * @}
* @} * @}
*/ */

View file

@ -38,7 +38,7 @@
* @{ * @{
* *
* \file * \file
* Phidget analog rotation sensor example using the ADC sensor wrapper * Phidget analog rotation sensor example using the ADC sensor wrapper
* *
* \author * \author
* Antonio Lignan <alinan@zolertia.com> * Antonio Lignan <alinan@zolertia.com>

View file

@ -105,3 +105,4 @@ PROCESS_THREAD(servo_test_process, ev, data)
* @} * @}
* @} * @}
*/ */

View file

@ -28,20 +28,23 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE. * OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
/* /*---------------------------------------------------------------------------*/
/**
* \addtogroup zoul-examples * \addtogroup zoul-examples
* @{ * @{
*
* \defgroup zoul-vac-sensor-test Test VAC sensor * \defgroup zoul-vac-sensor-test Test VAC sensor
* *
* Demonstrates the operation of the voltage VAC analog sensor * Demonstrates the operation of the voltage VAC analog sensor
* @{ * @{
* *
* \file * \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 * \author
* Javier Sánchez <asanchez@zolertia.com> * Javier Sánchez <asanchez@zolertia.com>
*/ */
/*---------------------------------------------------------------------------*/
#include "contiki.h" #include "contiki.h"
#include "sys/etimer.h" #include "sys/etimer.h"
#include "sys/rtimer.h" #include "sys/rtimer.h"
@ -65,7 +68,7 @@ AUTOSTART_PROCESSES(&test_vac_sensor_process);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS_THREAD(test_vac_sensor_process, ev, data) PROCESS_THREAD(test_vac_sensor_process, ev, data)
{ {
PROCESS_BEGIN(); PROCESS_BEGIN();
counter = 0; counter = 0;
@ -90,10 +93,10 @@ PROCESS_THREAD(test_vac_sensor_process, ev, data)
/*AC voltage value, with applied corresponding sensor algorithm*/ /*AC voltage value, with applied corresponding sensor algorithm*/
printf("AC voltage = %d V\n", adc_sensors.value(ANALOG_VAC_SENSOR)); printf("AC voltage = %d V\n", adc_sensors.value(ANALOG_VAC_SENSOR));
etimer_set(&et, LOOP_INTERVAL); etimer_set(&et, LOOP_INTERVAL);
counter++; counter++;
} }
} }
PROCESS_END(); PROCESS_END();
} }
@ -102,3 +105,4 @@ PROCESS_THREAD(test_vac_sensor_process, ev, data)
* @} * @}
* @} * @}
*/ */

View file

@ -40,7 +40,7 @@
* @{ * @{
* *
* \file * \file
* Test application for the Sparkfun's weather meter * Test application for the Sparkfun's weather meter
* *
* \author * \author
* Antonio Lignan <alinan@zolertia.com> * Antonio Lignan <alinan@zolertia.com>
@ -153,7 +153,7 @@ PROCESS_THREAD(test_weather_meter_sensors, ev, data)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** /**
* @}
* @} * @}
* @} * @}
*/ */

View file

@ -29,22 +29,23 @@
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** /**
* \addtogroup remote-examples * \addtogroup zoul-examples
* @{ * @{
*
* \defgroup remote-zonik-test Zolertia Zonik sonometer test application * \defgroup remote-zonik-test Zolertia Zonik sonometer test application
* *
* Example of Zonik board implementation and simple operation: Infinite loop * Example of Zonik board implementation and simple operation: Infinite loop
* enablinkg the sensor and rading few times, acquiring the dBA of sensor * 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 * 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 * are valid.Finally in the loop disables the board with standard call and
* shows the error, and loop again enabling it. * shows the error, and loop again enabling it.
* *
* @{ * @{
* \file * \file
* RE-Mote test application of Zolertia Zonik sound sensor * RE-Mote test application of Zolertia Zonik sound sensor
* \author * \author
* Aitor Mejias <amejias@zolertia.com> * Aitor Mejias <amejias@zolertia.com>
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#include "contiki.h" #include "contiki.h"
@ -70,17 +71,17 @@ PROCESS_THREAD(test_remote_zonik_process, ev, data)
PROCESS_BEGIN(); PROCESS_BEGIN();
printf("Initial status of sensor is: 0x%04X\n", printf("Initial status of sensor is: 0x%04X\n",
zonik.status(SENSORS_ACTIVE)); zonik.status(SENSORS_ACTIVE));
while(1) { while(1) {
/* Configure Zonik and activate the internal process readings */ /* Configure Zonik and activate the internal process readings */
SENSORS_ACTIVATE(zonik); SENSORS_ACTIVATE(zonik);
printf("Initialized. Sensor status: 0x%04X\n", printf("Initialized. Sensor status: 0x%04X\n",
zonik.status(SENSORS_ACTIVE)); zonik.status(SENSORS_ACTIVE));
/* Read sensor value dBA multiple times */ /* Read sensor value dBA multiple times */
for(i=0; i<MAX_VALID_READINGS; i++) { for(i = 0; i < MAX_VALID_READINGS; i++) {
/* Wait a bit */ /* Wait a bit */
etimer_set(&et, CLOCK_SECOND); etimer_set(&et, CLOCK_SECOND);
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
@ -92,13 +93,13 @@ PROCESS_THREAD(test_remote_zonik_process, ev, data)
} }
printf("Sensor status is: 0x%04X\n", printf("Sensor status is: 0x%04X\n",
zonik.status(SENSORS_ACTIVE)); zonik.status(SENSORS_ACTIVE));
/* Disable Zonik sensor */ /* Disable Zonik sensor */
SENSORS_DEACTIVATE(zonik); SENSORS_DEACTIVATE(zonik);
printf("Process Stopped: 0x%04X\n", zonik.status(SENSORS_ACTIVE)); printf("Process Stopped: 0x%04X\n", zonik.status(SENSORS_ACTIVE));
for(i=0; i<MAX_INVALID_READINGS; i++) { for(i = 0; i < MAX_INVALID_READINGS; i++) {
/* Wait a bit */ /* Wait a bit */
etimer_set(&et, CLOCK_SECOND); etimer_set(&et, CLOCK_SECOND);
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
@ -108,7 +109,7 @@ PROCESS_THREAD(test_remote_zonik_process, ev, data)
leds_toggle(LEDS_GREEN); leds_toggle(LEDS_GREEN);
printf("Value (dBA): %d\n", zonik_val); printf("Value (dBA): %d\n", zonik_val);
} }
etimer_set(&et, CLOCK_SECOND); etimer_set(&et, CLOCK_SECOND);
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
} }

View file

@ -29,6 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE. * OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
/*---------------------------------------------------------------------------*/
/** /**
* \addtogroup zoul * \addtogroup zoul
* @{ * @{
@ -62,6 +63,7 @@
* \file * \file
* Example demonstrating the Zoul module on the RE-Mote & Firefly platforms * Example demonstrating the Zoul module on the RE-Mote & Firefly platforms
*/ */
/*---------------------------------------------------------------------------*/
#include "contiki.h" #include "contiki.h"
#include "cpu.h" #include "cpu.h"
#include "sys/etimer.h" #include "sys/etimer.h"
@ -194,3 +196,4 @@ PROCESS_THREAD(zoul_demo_process, ev, data)
* @} * @}
* @} * @}
*/ */