From b4bb51e811018ea434ea0a9f8a97096e7d44fcc7 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 16 Dec 2012 11:01:23 +0000 Subject: [PATCH] Code style fixes: sensinode --- platform/sensinode/apps/batmon/batmon.c | 4 +-- platform/sensinode/contiki-conf.h | 2 +- platform/sensinode/contiki-sensinode-main.c | 8 +++--- platform/sensinode/debug.c | 2 +- platform/sensinode/dev/adc-sensor.c | 8 +++--- platform/sensinode/dev/button-sensor.c | 32 ++++++++++----------- platform/sensinode/dev/m25p16.c | 10 ++++--- platform/sensinode/dev/m25p16.h | 12 ++++---- platform/sensinode/dev/n740.h | 2 +- platform/sensinode/dev/sensinode-sensors.c | 12 ++++---- platform/sensinode/disco.c | 11 +++---- platform/sensinode/viztool.c | 6 ++-- 12 files changed, 56 insertions(+), 53 deletions(-) diff --git a/platform/sensinode/apps/batmon/batmon.c b/platform/sensinode/apps/batmon/batmon.c index a4e59ab28..184404199 100644 --- a/platform/sensinode/apps/batmon/batmon.c +++ b/platform/sensinode/apps/batmon/batmon.c @@ -91,7 +91,7 @@ struct flash_address { static struct flash_address f; static struct record r; -static struct sensors_sensor * s; +static struct sensors_sensor *s; static struct etimer et; #define FLASH_START_ADDR 0x1E0000 #define FLASH_END_ADDR 0x1FFFFF @@ -201,7 +201,7 @@ PROCESS_THREAD(batmon_process, ev, data) PRINTF("BatMon\n", sizeof(r)); s = sensors_find(ADC_SENSOR); - if (!s) { + if(!s) { PRINTF("BatMon: ADC not found\n"); PROCESS_EXIT(); } diff --git a/platform/sensinode/contiki-conf.h b/platform/sensinode/contiki-conf.h index 610c3cf54..440d65948 100644 --- a/platform/sensinode/contiki-conf.h +++ b/platform/sensinode/contiki-conf.h @@ -206,7 +206,7 @@ /* ND and Routing */ #ifndef UIP_CONF_ROUTER -#define UIP_CONF_ROUTER 1 +#define UIP_CONF_ROUTER 1 #endif /* Prevent SDCC compile error when UIP_CONF_ROUTER == 0 */ diff --git a/platform/sensinode/contiki-sensinode-main.c b/platform/sensinode/contiki-sensinode-main.c index 27cc1a1ae..a13e440d2 100644 --- a/platform/sensinode/contiki-sensinode-main.c +++ b/platform/sensinode/contiki-sensinode-main.c @@ -77,7 +77,7 @@ fade(int l) CC_NON_BANKED volatile int i, a; int k, j; for(k = 0; k < 400; ++k) { - j = k > 200? 400 - k: k; + j = k > 200 ? 400 - k : k; leds_on(l); for(i = 0; i < j; ++i) { @@ -96,7 +96,7 @@ set_rime_addr(void) CC_NON_BANKED uint8_t *addr_long = NULL; uint16_t addr_short = 0; char i; - __code unsigned char * macp; + __code unsigned char *macp; PUTSTRING("Rime is 0x"); PUTHEX(sizeof(rimeaddr_t)); @@ -119,7 +119,7 @@ set_rime_addr(void) CC_NON_BANKED FMAP = 3; /* Set our pointer to the correct address and fetch 8 bytes of MAC */ - macp = (__code unsigned char *) 0xFFF8; + macp = (__code unsigned char *)0xFFF8; for(i = (RIMEADDR_SIZE - 1); i >= 0; --i) { rimeaddr_node_addr.u8[i] = *macp; @@ -343,7 +343,7 @@ main(void) nop __endasm; - if (SLEEP & SLEEP_MODE0) { + if(SLEEP & SLEEP_MODE0) { #endif /* LPM_MODE==LPM_MODE_PM2 */ ENERGEST_OFF(ENERGEST_TYPE_CPU); diff --git a/platform/sensinode/debug.c b/platform/sensinode/debug.c index 390c2ff06..f2fcb9498 100644 --- a/platform/sensinode/debug.c +++ b/platform/sensinode/debug.c @@ -54,7 +54,7 @@ putdec(uint8_t c) c %= div; if((disp != 0) || (hassent) || (div == 1)) { hassent = 1; - putchar('0'+disp); + putchar('0' + disp); } } } diff --git a/platform/sensinode/dev/adc-sensor.c b/platform/sensinode/dev/adc-sensor.c index 8de2deb04..c039adafa 100644 --- a/platform/sensinode/dev/adc-sensor.c +++ b/platform/sensinode/dev/adc-sensor.c @@ -134,8 +134,8 @@ value(int type) static int status(int type) { - return ready; - } + return ready; +} /*---------------------------------------------------------------------------*/ /* * On N740 we can control Ill and Acc individually: @@ -203,9 +203,9 @@ configure(int type, int value) ready |= ADC_VAL_LIGHT_ON; } #endif /* LIGHT_SENSOR_ON */ - n740_ser_par_set(ser_par_val); + n740_ser_par_set(ser_par_val); #endif /* MODEL_N740 */ - } + } return ready; } diff --git a/platform/sensinode/dev/button-sensor.c b/platform/sensinode/dev/button-sensor.c index a2bda01c2..7b9c82ab4 100644 --- a/platform/sensinode/dev/button-sensor.c +++ b/platform/sensinode/dev/button-sensor.c @@ -59,25 +59,25 @@ HWCONF_PORT_0_IRQ(BUTTON_2, 7) #endif /* MODEL_N711 */ /*---------------------------------------------------------------------------*/ -static -int value_b1(int type) +static int +value_b1(int type) { return BUTTON_1_READ() || !timer_expired(&debouncetimer[0]); } /*---------------------------------------------------------------------------*/ -static -int status_b1(int type) +static int +status_b1(int type) { - switch (type) { + switch(type) { case SENSORS_ACTIVE: case SENSORS_READY: return BUTTON_1_IRQ_ENABLED(); - } + } return 0; } /*---------------------------------------------------------------------------*/ -static -int configure_b1(int type, int value) +static int +configure_b1(int type, int value) { switch(type) { case SENSORS_HW_INIT: @@ -92,7 +92,7 @@ int configure_b1(int type, int value) timer_set(&debouncetimer[0], 0); BUTTON_1_IRQ_FLAG_OFF(); BUTTON_1_ENABLE_IRQ(); -} + } } else { BUTTON_1_DISABLE_IRQ(); } @@ -101,16 +101,16 @@ int configure_b1(int type, int value) return 0; } /*---------------------------------------------------------------------------*/ -static -int value_b2(int type) +static int +value_b2(int type) { return BUTTON_2_READ() || !timer_expired(&debouncetimer[1]); } /*---------------------------------------------------------------------------*/ -static -int status_b2(int type) +static int +status_b2(int type) { - switch (type) { + switch(type) { case SENSORS_ACTIVE: case SENSORS_READY: return BUTTON_2_IRQ_ENABLED(); @@ -118,8 +118,8 @@ int status_b2(int type) return 0; } /*---------------------------------------------------------------------------*/ -static -int configure_b2(int type, int value) +static int +configure_b2(int type, int value) { switch(type) { case SENSORS_HW_INIT: diff --git a/platform/sensinode/dev/m25p16.c b/platform/sensinode/dev/m25p16.c index d842a3421..f1cbdebfd 100644 --- a/platform/sensinode/dev/m25p16.c +++ b/platform/sensinode/dev/m25p16.c @@ -146,7 +146,7 @@ m25p16_wrdi() } /*---------------------------------------------------------------------------*/ void -m25p16_rdid(struct m25p16_rdid * rdid) +m25p16_rdid(struct m25p16_rdid *rdid) { uint8_t i; @@ -237,7 +237,7 @@ m25p16_pp(uint8_t * addr, uint8_t * buff, uint8_t buff_len) } /* Write the bytes */ - for(i=0; iconfigure(SENSORS_ACTIVE, 1); sensor = sensors_next(sensor); } @@ -73,7 +73,7 @@ sensinode_sensors_deactivate() { struct sensors_sensor *sensor; sensor = sensors_first(); - while (sensor) { + while(sensor) { sensor->configure(SENSORS_ACTIVE, 0); sensor = sensors_next(sensor); } diff --git a/platform/sensinode/disco.c b/platform/sensinode/disco.c index 39e023980..ccfbf3f09 100644 --- a/platform/sensinode/disco.c +++ b/platform/sensinode/disco.c @@ -76,7 +76,7 @@ void batmon_log(uint8_t trigger); #endif /*---------------------------------------------------------------------------*/ static struct uip_udp_conn *server_conn; -static struct disco_request_pdu * req; +static struct disco_request_pdu *req; static struct disco_response_pdu resp; static struct disco_seed seed; static uint8_t state; @@ -92,7 +92,7 @@ extern void *uip_appdata; __xdata __at(BOOTTY_CMD_LOCATION) static uint8_t bd; /*---------------------------------------------------------------------------*/ -static void timer_handler(void * p); +static void timer_handler(void *p); /*---------------------------------------------------------------------------*/ static void abort() CC_NON_BANKED @@ -116,9 +116,9 @@ restart_timer(uint16_t t) CC_NON_BANKED } /*---------------------------------------------------------------------------*/ static void -timer_handler(void * p) +timer_handler(void *p) { - uint8_t * s = p; + uint8_t *s = p; uint8_t wip; PRINTF("Disco: @ %lu, s: %u\n", clock_seconds(), *s); @@ -213,7 +213,8 @@ cmd_init() CC_NON_BANKED static uint8_t cmd_write() CC_NON_BANKED { - PRINTF("Disco: Write 0x%02x%02x%02x\n", req->addr[0], req->addr[1], req->addr[2]); + PRINTF("Disco: Write 0x%02x%02x%02x\n", req->addr[0], req->addr[1], + req->addr[2]); if(uip_datalen() != DISCO_LEN_WRITE) { resp.status = DISCO_ERR_BAD_LEN; return DISCO_RESP_LEN_ERR; diff --git a/platform/sensinode/viztool.c b/platform/sensinode/viztool.c index 642cb2f5c..229b2ae3d 100644 --- a/platform/sensinode/viztool.c +++ b/platform/sensinode/viztool.c @@ -168,7 +168,7 @@ process_request() CC_NON_BANKED } } } - } else if (buf[0] == REQUEST_TYPE_DRT) { + } else if(buf[0] == REQUEST_TYPE_DRT) { uint32_t flip = 0; PRINTF("Default Routes\n"); for(i = buf[1]; i < UIP_DS6_DEFRT_NB; i++) { @@ -195,7 +195,7 @@ process_request() CC_NON_BANKED } } } - } else if (buf[0] == REQUEST_TYPE_ADDR) { + } else if(buf[0] == REQUEST_TYPE_ADDR) { PRINTF("Unicast Addresses\n"); for(i = buf[1]; i < UIP_DS6_ADDR_NB; i++) { if(uip_ds6_if.addr_list[i].isused) { @@ -217,7 +217,7 @@ process_request() CC_NON_BANKED } } } - } else if (buf[0] == REQUEST_TYPE_TOTALS) { + } else if(buf[0] == REQUEST_TYPE_TOTALS) { memset(&buf[2], 0, 4); for(i = 0; i < UIP_DS6_ADDR_NB; i++) { if(uip_ds6_if.addr_list[i].isused) {