diff --git a/examples/zolertia/z1/test-light-ziglet.c b/examples/zolertia/z1/test-light-ziglet.c index e0df68dc0..ce292dff0 100644 --- a/examples/zolertia/z1/test-light-ziglet.c +++ b/examples/zolertia/z1/test-light-ziglet.c @@ -42,12 +42,6 @@ #include "dev/i2cmaster.h" #include "dev/light-ziglet.h" /*---------------------------------------------------------------------------*/ -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ #define SENSOR_READ_INTERVAL (CLOCK_SECOND / 2) /*---------------------------------------------------------------------------*/ PROCESS(test_process, "Test light ziglet process"); @@ -59,19 +53,14 @@ PROCESS_THREAD(test_process, ev, data) { PROCESS_BEGIN(); - uint16_t light; - /* Initialize driver and set a slower data rate */ - light_ziglet_init(); i2c_setrate(I2C_PRESC_100KHZ_LSB, I2C_PRESC_100KHZ_MSB); while(1) { etimer_set(&et, SENSOR_READ_INTERVAL); PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - light = light_ziglet_read(); - PRINTF("Light = %u\n", light); + printf("Light = %u\n", light_ziglet_read()); } PROCESS_END(); } diff --git a/examples/zolertia/z1/test-phidgets.c b/examples/zolertia/z1/test-phidgets.c index 1b767e86a..5dbdaf497 100644 --- a/examples/zolertia/z1/test-phidgets.c +++ b/examples/zolertia/z1/test-phidgets.c @@ -32,8 +32,7 @@ /*---------------------------------------------------------------------------*/ /** * \file - * An example of how to use the button and light sensor on - * the Z1 platform. + * An example of how to use the button and read the ADC ports * \author * Joakim Eriksson */ @@ -44,7 +43,7 @@ #include "dev/leds.h" #include "dev/z1-phidgets.h" /*---------------------------------------------------------------------------*/ -PROCESS(test_button_process, "Test Button & Phidgets"); +PROCESS(test_button_process, "Test Button & ADC"); AUTOSTART_PROCESSES(&test_button_process); /*---------------------------------------------------------------------------*/ PROCESS_THREAD(test_button_process, ev, data) diff --git a/examples/zolertia/z1/test-tmp102.c b/examples/zolertia/z1/test-tmp102.c index 69627262a..5d8be7a08 100644 --- a/examples/zolertia/z1/test-tmp102.c +++ b/examples/zolertia/z1/test-tmp102.c @@ -42,12 +42,6 @@ #include "dev/i2cmaster.h" #include "dev/tmp102.h" /*---------------------------------------------------------------------------*/ -#if DEBUG -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif -/*---------------------------------------------------------------------------*/ #define TMP102_READ_INTERVAL (CLOCK_SECOND / 2) /*---------------------------------------------------------------------------*/ PROCESS(temp_process, "Test Temperature process"); @@ -59,32 +53,15 @@ PROCESS_THREAD(temp_process, ev, data) { PROCESS_BEGIN(); - int16_t tempint; - uint16_t tempfrac; - int16_t raw; - uint16_t absraw; - int16_t sign; - char minus = ' '; + int16_t temp; tmp102_init(); while(1) { etimer_set(&et, TMP102_READ_INTERVAL); PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - sign = 1; - - PRINTFDEBUG("Reading Temp...\n"); - raw = tmp102_read_temp_raw(); - absraw = raw; - if(raw < 0) { /* Perform 2C's if sensor returned negative data */ - absraw = (raw ^ 0xFFFF) + 1; - sign = -1; - } - tempint = (absraw >> 8) * sign; - tempfrac = ((absraw >> 4) % 16) * 625; /* Info in 1/10000 of degree */ - minus = ((tempint == 0) & (sign == -1)) ? '-' : ' '; - PRINTF("Temp = %c%d.%04d\n", minus, tempint, tempfrac); + temp = tmp102_read_temp_x100(); + printf("Temp = %d\n", temp); } PROCESS_END(); }