Fix code style: Z1 main examples

This commit is contained in:
George Oikonomou 2015-11-24 12:00:23 +00:00 committed by Antonio Lignan
parent afa5ab1ae4
commit e1f6d39857
10 changed files with 108 additions and 165 deletions

View File

@ -47,36 +47,27 @@
#include "shell-file.h" #include "shell-file.h"
#include "shell-text.h" #include "shell-text.h"
#include "dev/adxl345.h" #include "dev/adxl345.h"
/*---------------------------------------------------------------------------*/
#define LED_INT_ONTIME CLOCK_SECOND/2 #define LED_INT_ONTIME (CLOCK_SECOND / 2)
#define ACCM_READ_INTERVAL CLOCK_SECOND #define ACCM_READ_INTERVAL CLOCK_SECOND
/*---------------------------------------------------------------------------*/
static process_event_t ledOff_event; static process_event_t led_off_event;
static struct etimer led_etimer;
static struct etimer et;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS(accel_process, "Test Accel process"); PROCESS(accel_process, "Test Accel process");
PROCESS(led_process, "LED handling process"); PROCESS(led_process, "LED handling process");
AUTOSTART_PROCESSES(&accel_process, &led_process); AUTOSTART_PROCESSES(&accel_process, &led_process);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* As several interrupts can be mapped to one interrupt pin, when interrupt /* As several interrupts can be mapped to one interrupt pin, when interrupt
strikes, the adxl345 interrupt source register is read. This function prints * strikes, the adxl345 interrupt source register is read. This function prints
out which interrupts occurred. Note that this will include all interrupts, * out which interrupts occurred. Note that this will include all interrupts,
even those mapped to 'the other' pin, and those that will always signal even if * even those mapped to 'the other' pin, and those that will always signal even
not enabled (such as watermark). */ * if not enabled (such as watermark).
*/
void void
print_int(uint16_t reg){ print_int(uint16_t reg)
#define ANNOYING_ALWAYS_THERE_ANYWAY_OUTPUT 0 {
#if ANNOYING_ALWAYS_THERE_ANYWAY_OUTPUT
if(reg & ADXL345_INT_OVERRUN) {
printf("Overrun ");
}
if(reg & ADXL345_INT_WATERMARK) {
printf("Watermark ");
}
if(reg & ADXL345_INT_DATAREADY) {
printf("DataReady ");
}
#endif
if(reg & ADXL345_INT_FREEFALL) { if(reg & ADXL345_INT_FREEFALL) {
printf("Freefall "); printf("Freefall ");
} }
@ -94,74 +85,49 @@ print_int(uint16_t reg){
} }
printf("\n"); printf("\n");
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* accelerometer free fall detection callback */ /* accelerometer free fall detection callback */
void void
accm_ff_cb(uint8_t reg){ accm_ff_cb(uint8_t reg)
{
L_ON(LEDS_B); L_ON(LEDS_B);
process_post(&led_process, ledOff_event, NULL); process_post(&led_process, led_off_event, NULL);
printf("~~[%u] Freefall detected! (0x%02X) -- ", ((uint16_t) clock_time())/128, reg); printf("~~[%u] Freefall detected! (0x%02X) -- ",
((uint16_t)clock_time()) / 128, reg);
print_int(reg); print_int(reg);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* accelerometer tap and double tap detection callback */ /* accelerometer tap and double tap detection callback */
void void
accm_tap_cb(uint8_t reg){ accm_tap_cb(uint8_t reg)
process_post(&led_process, ledOff_event, NULL); {
process_post(&led_process, led_off_event, NULL);
if(reg & ADXL345_INT_DOUBLETAP) { if(reg & ADXL345_INT_DOUBLETAP) {
L_ON(LEDS_G); L_ON(LEDS_G);
printf("~~[%u] DoubleTap detected! (0x%02X) -- ", ((uint16_t) clock_time())/128, reg); printf("~~[%u] DoubleTap detected! (0x%02X) -- ",
((uint16_t)clock_time()) / 128, reg);
} else { } else {
L_ON(LEDS_R); L_ON(LEDS_R);
printf("~~[%u] Tap detected! (0x%02X) -- ", ((uint16_t) clock_time())/128, reg); printf("~~[%u] Tap detected! (0x%02X) -- ",
((uint16_t)clock_time()) / 128, reg);
} }
print_int(reg); print_int(reg);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* When posted an ledOff event, the LEDs will switch off after LED_INT_ONTIME.
static process_event_t ledOff_event;
ledOff_event = process_alloc_event();
process_post(&led_process, ledOff_event, NULL);
*/
static struct etimer ledETimer;
PROCESS_THREAD(led_process, ev, data) { PROCESS_THREAD(led_process, ev, data) {
PROCESS_BEGIN(); PROCESS_BEGIN();
while(1) { while(1) {
PROCESS_WAIT_EVENT_UNTIL(ev == ledOff_event); PROCESS_WAIT_EVENT_UNTIL(ev == led_off_event);
etimer_set(&ledETimer, LED_INT_ONTIME); etimer_set(&led_etimer, LED_INT_ONTIME);
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&ledETimer)); PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&led_etimer));
L_OFF(LEDS_R + LEDS_G + LEDS_B); L_OFF(LEDS_R + LEDS_G + LEDS_B);
} }
PROCESS_END(); PROCESS_END();
} }
/*---------------------------------------------------------------------------*/
/* Returns a string with the argument byte written in binary.
Example usage:
printf("Port1: %s\n", char2bin(P1IN));
*/
/*
static uint8_t b[9];
static uint8_t
*char2bin(uint8_t x) {
uint8_t z;
b[8] = '\0';
for (z = 0; z < 8; z++) {
b[7-z] = (x & (1 << z)) ? '1' : '0';
}
return b;
}
*/
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* Main process, setups */ /* Main process, setups */
static struct etimer et;
PROCESS_THREAD(accel_process, ev, data) { PROCESS_THREAD(accel_process, ev, data) {
PROCESS_BEGIN(); PROCESS_BEGIN();
{ {
@ -169,11 +135,11 @@ PROCESS_THREAD(accel_process, ev, data) {
serial_shell_init(); serial_shell_init();
shell_ps_init(); shell_ps_init();
shell_file_init(); // for printing out files shell_file_init(); /* for printing out files */
shell_text_init(); // for binprint shell_text_init(); /* for binprint */
/* Register the event used for lighting up an LED when interrupt strikes. */ /* Register the event used for lighting up an LED when interrupt strikes. */
ledOff_event = process_alloc_event(); led_off_event = process_alloc_event();
/* Start and setup the accelerometer with default values, eg no interrupts enabled. */ /* Start and setup the accelerometer with default values, eg no interrupts enabled. */
accm_init(); accm_init();
@ -198,6 +164,5 @@ PROCESS_THREAD(accel_process, ev, data) {
} }
PROCESS_END(); PROCESS_END();
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/

View File

@ -29,20 +29,18 @@
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
*/ */
/*---------------------------------------------------------------------------*/
/** /**
* \file * \file
* Testing the internal MSP430 battery sensor on the Zolertia Z1 Platform. * Testing the internal MSP430 battery sensor on the Zolertia Z1 Platform.
* \author * \author
* Enric M. Calvo <ecalvo@zolertia.com> * Enric M. Calvo <ecalvo@zolertia.com>
*/ */
/*---------------------------------------------------------------------------*/
#include "contiki.h" #include "contiki.h"
#include "dev/battery-sensor.h" #include "dev/battery-sensor.h"
#include <stdio.h> /* For printf() */ #include <stdio.h>
/*---------------------------------------------------------------------------*/
float float
floor(float x) floor(float x)
{ {
@ -52,7 +50,6 @@ floor(float x)
return (float)((int)x - 1); return (float)((int)x - 1);
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS(test_battery_process, "Battery Sensor Test"); PROCESS(test_battery_process, "Battery Sensor Test");
AUTOSTART_PROCESSES(&test_battery_process); AUTOSTART_PROCESSES(&test_battery_process);
@ -75,5 +72,4 @@ PROCESS_THREAD(test_battery_process, ev, data)
PROCESS_END(); PROCESS_END();
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/

View File

@ -29,32 +29,32 @@
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
*/ */
/*---------------------------------------------------------------------------*/
/** /**
* \file * \file
* A quick program for testing the light ziglet driver in the Z1 platform * A quick program for testing the light ziglet driver in the Z1 platform
* \author * \author
* Antonio Lignan <alinan@zolertia.com> * Antonio Lignan <alinan@zolertia.com>
*/ */
/*---------------------------------------------------------------------------*/
#include <stdio.h> #include <stdio.h>
#include "contiki.h" #include "contiki.h"
#include "dev/i2cmaster.h" #include "dev/i2cmaster.h"
#include "dev/light-ziglet.h" #include "dev/light-ziglet.h"
/*---------------------------------------------------------------------------*/
#if 1 #if DEBUG
#define PRINTF(...) printf(__VA_ARGS__) #define PRINTF(...) printf(__VA_ARGS__)
#else #else
#define PRINTF(...) #define PRINTF(...)
#endif #endif
/*---------------------------------------------------------------------------*/
#define SENSOR_READ_INTERVAL (CLOCK_SECOND / 2) #define SENSOR_READ_INTERVAL (CLOCK_SECOND / 2)
/*---------------------------------------------------------------------------*/
PROCESS(test_process, "Test light ziglet process"); PROCESS(test_process, "Test light ziglet process");
AUTOSTART_PROCESSES(&test_process); AUTOSTART_PROCESSES(&test_process);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static struct etimer et; static struct etimer et;
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(test_process, ev, data) PROCESS_THREAD(test_process, ev, data)
{ {
PROCESS_BEGIN(); PROCESS_BEGIN();
@ -75,3 +75,4 @@ PROCESS_THREAD(test_process, ev, data)
} }
PROCESS_END(); PROCESS_END();
} }
/*---------------------------------------------------------------------------*/

View File

@ -29,7 +29,7 @@
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
*/ */
/*---------------------------------------------------------------------------*/
/** /**
* \file * \file
* An example of how to use the button and light sensor on * An example of how to use the button and light sensor on
@ -37,33 +37,31 @@
* \author * \author
* Joakim Eriksson <joakime@sics.se> * Joakim Eriksson <joakime@sics.se>
*/ */
/*---------------------------------------------------------------------------*/
#include <stdio.h> #include <stdio.h>
#include "contiki.h" #include "contiki.h"
#include "dev/button-sensor.h" #include "dev/button-sensor.h"
#include "dev/leds.h" #include "dev/leds.h"
#include "dev/z1-phidgets.h" #include "dev/z1-phidgets.h"
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS(test_button_process, "Test Button & Phidgets"); PROCESS(test_button_process, "Test Button & Phidgets");
AUTOSTART_PROCESSES(&test_button_process); AUTOSTART_PROCESSES(&test_button_process);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS_THREAD(test_button_process, ev, data) PROCESS_THREAD(test_button_process, ev, data)
{ {
//static struct etimer et; /* static struct etimer et; */
PROCESS_BEGIN(); PROCESS_BEGIN();
SENSORS_ACTIVATE(phidgets); SENSORS_ACTIVATE(phidgets);
SENSORS_ACTIVATE(button_sensor); SENSORS_ACTIVATE(button_sensor);
while(1) { while(1) {
//etimer_set(&et, CLOCK_SECOND/2);
printf("Please press the User Button\n"); printf("Please press the User Button\n");
PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event && PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event &&
data == &button_sensor); data == &button_sensor);
//PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
leds_toggle(LEDS_GREEN); leds_toggle(LEDS_GREEN);
//printf("Button clicked\n");
printf("Phidget 5V 1:%d\n", phidgets.value(PHIDGET5V_1)); printf("Phidget 5V 1:%d\n", phidgets.value(PHIDGET5V_1));
printf("Phidget 5V 2:%d\n", phidgets.value(PHIDGET5V_2)); printf("Phidget 5V 2:%d\n", phidgets.value(PHIDGET5V_2));
printf("Phidget 3V 1:%d\n", phidgets.value(PHIDGET3V_1)); printf("Phidget 3V 1:%d\n", phidgets.value(PHIDGET3V_1));
@ -74,7 +72,6 @@ PROCESS_THREAD(test_button_process, ev, data)
} else { } else {
leds_off(LEDS_RED); leds_off(LEDS_RED);
} }
} }
PROCESS_END(); PROCESS_END();
} }

View File

@ -29,19 +29,17 @@
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
*/ */
/*---------------------------------------------------------------------------*/
/** /**
* \file * \file
* Testing the Potentiometer in Zolertia Z1 Starter Platform. * Testing the Potentiometer in Zolertia Z1 Starter Platform.
* \author * \author
* Enric M. Calvo <ecalvo@zolertia.com> * Enric M. Calvo <ecalvo@zolertia.com>
*/ */
/*---------------------------------------------------------------------------*/
#include "contiki.h" #include "contiki.h"
#include "dev/potentiometer-sensor.h" #include "dev/potentiometer-sensor.h"
#include <stdio.h> #include <stdio.h>
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS(test_potent_process, "Testing Potentiometer in Z1SP"); PROCESS(test_potent_process, "Testing Potentiometer in Z1SP");
AUTOSTART_PROCESSES(&test_potent_process); AUTOSTART_PROCESSES(&test_potent_process);
@ -63,6 +61,4 @@ PROCESS_THREAD(test_potent_process, ev, data)
PROCESS_END(); PROCESS_END();
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/

View File

@ -29,7 +29,7 @@
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
*/ */
/*---------------------------------------------------------------------------*/
/** /**
* \file * \file
* A quick program for testing a generic relay device connected in the * A quick program for testing a generic relay device connected in the
@ -37,25 +37,19 @@
* \author * \author
* Antonio Lignan <alinan@zolertia.com> * Antonio Lignan <alinan@zolertia.com>
*/ */
/*---------------------------------------------------------------------------*/
#include <stdio.h> #include <stdio.h>
#include "contiki.h" #include "contiki.h"
#include "dev/relay-phidget.h" #include "dev/relay-phidget.h"
/*---------------------------------------------------------------------------*/
#if 1 #if DEBUG
#define PRINTF(...) printf(__VA_ARGS__) #define PRINTF(...) printf(__VA_ARGS__)
#else #else
#define PRINTF(...) #define PRINTF(...)
#endif #endif
/*---------------------------------------------------------------------------*/
#if 0
#define PRINTFDEBUG(...) printf(__VA_ARGS__)
#else
#define PRINTFDEBUG(...)
#endif
#define RELAY_INTERVAL (CLOCK_SECOND) #define RELAY_INTERVAL (CLOCK_SECOND)
/*---------------------------------------------------------------------------*/
PROCESS(test_process, "Relay test process"); PROCESS(test_process, "Relay test process");
AUTOSTART_PROCESSES(&test_process); AUTOSTART_PROCESSES(&test_process);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -78,3 +72,4 @@ PROCESS_THREAD(test_process, ev, data)
} }
PROCESS_END(); PROCESS_END();
} }
/*---------------------------------------------------------------------------*/

View File

@ -29,7 +29,7 @@
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
*/ */
/*---------------------------------------------------------------------------*/
/** /**
* \file * \file
* Testing the SHT11 sensor on the Zolertia Z1 Platform. * Testing the SHT11 sensor on the Zolertia Z1 Platform.
@ -37,15 +37,15 @@
* Nicolas Tsiftes <nvt@sics.se> * Nicolas Tsiftes <nvt@sics.se>
* Enric M. Calvo <ecalvo@zolertia.com> * Enric M. Calvo <ecalvo@zolertia.com>
*/ */
/*---------------------------------------------------------------------------*/
#include "contiki.h" #include "contiki.h"
#include "dev/sht11/sht11.h" #include "dev/sht11/sht11.h"
#include <stdio.h> #include <stdio.h>
/*---------------------------------------------------------------------------*/
PROCESS(test_sht11_process, "SHT11 test"); PROCESS(test_sht11_process, "SHT11 test");
AUTOSTART_PROCESSES(&test_sht11_process); AUTOSTART_PROCESSES(&test_sht11_process);
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(test_sht11_process, ev, data) PROCESS_THREAD(test_sht11_process, ev, data)
{ {
static struct etimer et; static struct etimer et;
@ -65,3 +65,4 @@ PROCESS_THREAD(test_sht11_process, ev, data)
PROCESS_END(); PROCESS_END();
} }
/*---------------------------------------------------------------------------*/

View File

@ -29,21 +29,23 @@
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
*/ */
/*---------------------------------------------------------------------------*/
/** /**
* \file * \file
* A quick program for testing the SHT25 temperature and humidity sensor * A quick program for testing the SHT25 temperature and humidity sensor
* \author * \author
* Antonio Lignan <alinan@zolertia.com> * Antonio Lignan <alinan@zolertia.com>
*/ */
/*---------------------------------------------------------------------------*/
#include <stdio.h> #include <stdio.h>
#include "contiki.h" #include "contiki.h"
#include "dev/sht25.h" #include "dev/sht25.h"
/*---------------------------------------------------------------------------*/
PROCESS(test_sht25_process, "SHT25 test"); PROCESS(test_sht25_process, "SHT25 test");
AUTOSTART_PROCESSES(&test_sht25_process); AUTOSTART_PROCESSES(&test_sht25_process);
/*---------------------------------------------------------------------------*/
static struct etimer et; static struct etimer et;
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(test_sht25_process, ev, data) PROCESS_THREAD(test_sht25_process, ev, data)
{ {
int16_t temperature, humidity; int16_t temperature, humidity;
@ -61,3 +63,4 @@ PROCESS_THREAD(test_sht25_process, ev, data)
} }
PROCESS_END(); PROCESS_END();
} }
/*---------------------------------------------------------------------------*/

View File

@ -29,7 +29,7 @@
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
*/ */
/*---------------------------------------------------------------------------*/
/** /**
* \file * \file
* A simple program for testing the TLC59116 I2C led driver. * A simple program for testing the TLC59116 I2C led driver.
@ -37,23 +37,21 @@
* \author * \author
* Jelmer Tiete, VUB <jelmer@tiete.be> * Jelmer Tiete, VUB <jelmer@tiete.be>
*/ */
/*---------------------------------------------------------------------------*/
#include <stdio.h> #include <stdio.h>
#include "contiki.h" #include "contiki.h"
#include "dev/tlc59116.h" #include "dev/tlc59116.h"
/*---------------------------------------------------------------------------*/
#define BLINK_INTERVAL CLOCK_SECOND/25 #define BLINK_INTERVAL (CLOCK_SECOND / 25)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS(tlc59116_process, "Test tlc59116 process"); PROCESS(tlc59116_process, "Test tlc59116 process");
AUTOSTART_PROCESSES(&tlc59116_process); AUTOSTART_PROCESSES(&tlc59116_process);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* Main process, setups */ /* Main process, setups */
static struct etimer et; static struct etimer et;
static uint8_t count = 0; static uint8_t count = 0;
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(tlc59116_process, ev, data) PROCESS_THREAD(tlc59116_process, ev, data)
{ {
PROCESS_BEGIN(); PROCESS_BEGIN();
@ -80,5 +78,4 @@ PROCESS_THREAD(tlc59116_process, ev, data)
} }
PROCESS_END(); PROCESS_END();
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/

View File

@ -29,41 +29,32 @@
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
*/ */
/*---------------------------------------------------------------------------*/
/** /**
* \file * \file
* A quick program for testing the tmp102 driver in the Z1 platform * A quick program for testing the tmp102 driver in the Z1 platform
* \author * \author
* Enric M. Calvo <ecalvo@zolertia.com> * Enric M. Calvo <ecalvo@zolertia.com>
*/ */
/*---------------------------------------------------------------------------*/
#include <stdio.h> #include <stdio.h>
#include "contiki.h" #include "contiki.h"
#include "dev/i2cmaster.h" #include "dev/i2cmaster.h"
#include "dev/tmp102.h" #include "dev/tmp102.h"
/*---------------------------------------------------------------------------*/
#if DEBUG
#if 1
#define PRINTF(...) printf(__VA_ARGS__) #define PRINTF(...) printf(__VA_ARGS__)
#else #else
#define PRINTF(...) #define PRINTF(...)
#endif #endif
/*---------------------------------------------------------------------------*/
#if 0
#define PRINTFDEBUG(...) printf(__VA_ARGS__)
#else
#define PRINTFDEBUG(...)
#endif
#define TMP102_READ_INTERVAL (CLOCK_SECOND / 2) #define TMP102_READ_INTERVAL (CLOCK_SECOND / 2)
/*---------------------------------------------------------------------------*/
PROCESS(temp_process, "Test Temperature process"); PROCESS(temp_process, "Test Temperature process");
AUTOSTART_PROCESSES(&temp_process); AUTOSTART_PROCESSES(&temp_process);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static struct etimer et; static struct etimer et;
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(temp_process, ev, data) PROCESS_THREAD(temp_process, ev, data)
{ {
PROCESS_BEGIN(); PROCESS_BEGIN();
@ -86,14 +77,15 @@ PROCESS_THREAD(temp_process, ev, data)
PRINTFDEBUG("Reading Temp...\n"); PRINTFDEBUG("Reading Temp...\n");
raw = tmp102_read_temp_raw(); raw = tmp102_read_temp_raw();
absraw = raw; absraw = raw;
if(raw < 0) { // Perform 2C's if sensor returned negative data if(raw < 0) { /* Perform 2C's if sensor returned negative data */
absraw = (raw ^ 0xFFFF) + 1; absraw = (raw ^ 0xFFFF) + 1;
sign = -1; sign = -1;
} }
tempint = (absraw >> 8) * sign; tempint = (absraw >> 8) * sign;
tempfrac = ((absraw >> 4) % 16) * 625; // Info in 1/10000 of degree tempfrac = ((absraw >> 4) % 16) * 625; /* Info in 1/10000 of degree */
minus = ((tempint == 0) & (sign == -1)) ? '-' : ' '; minus = ((tempint == 0) & (sign == -1)) ? '-' : ' ';
PRINTF("Temp = %c%d.%04d\n", minus, tempint, tempfrac); PRINTF("Temp = %c%d.%04d\n", minus, tempint, tempfrac);
} }
PROCESS_END(); PROCESS_END();
} }
/*---------------------------------------------------------------------------*/