From 351a4d39b90c4d78ea8fba66698c6db26a239354 Mon Sep 17 00:00:00 2001
From: George Oikonomou <g.oikonomou@bristol.ac.uk>
Date: Sun, 16 Dec 2012 13:25:33 +0000
Subject: [PATCH] Code style fixes: cc2530dk

---
 platform/cc2530dk/contiki-main.c        |  6 ++---
 platform/cc2530dk/debug.c               |  3 +--
 platform/cc2530dk/dev/button-sensor.c   | 32 ++++++++++++-------------
 platform/cc2530dk/dev/leds-arch.c       |  4 ++--
 platform/cc2530dk/dev/smartrf-sensors.c |  8 +++----
 platform/cc2530dk/dev/usb-serial.c      | 12 +++++-----
 platform/cc2530dk/dev/usb-serial.h      |  2 +-
 platform/cc2530dk/viztool.c             |  6 ++---
 8 files changed, 36 insertions(+), 37 deletions(-)

diff --git a/platform/cc2530dk/contiki-main.c b/platform/cc2530dk/contiki-main.c
index b5ac1555e3..1935470bc2 100644
--- a/platform/cc2530dk/contiki-main.c
+++ b/platform/cc2530dk/contiki-main.c
@@ -65,7 +65,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) {
@@ -84,9 +84,9 @@ set_rime_addr(void) CC_NON_BANKED
   char i;
 
 #if CC2530_CONF_MAC_FROM_PRIMARY
-  __xdata unsigned char * macp = &X_IEEE_ADDR;
+  __xdata unsigned char *macp = &X_IEEE_ADDR;
 #else
-  __code unsigned char * macp = (__code unsigned char *) 0xFFE8;
+  __code unsigned char *macp = (__code unsigned char *)0xFFE8;
 #endif
 
   PUTSTRING("Rime is 0x");
diff --git a/platform/cc2530dk/debug.c b/platform/cc2530dk/debug.c
index 1773eff528..36131227a5 100644
--- a/platform/cc2530dk/debug.c
+++ b/platform/cc2530dk/debug.c
@@ -50,8 +50,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/cc2530dk/dev/button-sensor.c b/platform/cc2530dk/dev/button-sensor.c
index c1a6f593ca..4f5f1347d8 100644
--- a/platform/cc2530dk/dev/button-sensor.c
+++ b/platform/cc2530dk/dev/button-sensor.c
@@ -40,26 +40,26 @@ static CC_AT_DATA struct timer debouncetimer;
 /*---------------------------------------------------------------------------*/
 /* Button 1 - SmartRF and cc2531 USB Dongle */
 /*---------------------------------------------------------------------------*/
-static
-int value_b1(int type)
+static int
+value_b1(int type)
 {
   type;
   return BUTTON_READ(1) || !timer_expired(&debouncetimer);
 }
 /*---------------------------------------------------------------------------*/
-static
-int status_b1(int type)
+static int
+status_b1(int type)
 {
-  switch (type) {
+  switch(type) {
   case SENSORS_ACTIVE:
   case SENSORS_READY:
     return BUTTON_IRQ_ENABLED(1);
-    }
+  }
   return 0;
 }
 /*---------------------------------------------------------------------------*/
-static
-int configure_b1(int type, int value)
+static int
+configure_b1(int type, int value)
 {
   switch(type) {
   case SENSORS_HW_INIT:
@@ -88,26 +88,26 @@ int configure_b1(int type, int value)
 /* Button 2 - cc2531 USb Dongle only */
 /*---------------------------------------------------------------------------*/
 #if MODEL_CC2531
-static
-int value_b2(int type)
+static int
+value_b2(int type)
 {
   type;
   return BUTTON_READ(2) || !timer_expired(&debouncetimer);
 }
 /*---------------------------------------------------------------------------*/
-static
-int status_b2(int type)
+static int
+status_b2(int type)
 {
-  switch (type) {
+  switch(type) {
   case SENSORS_ACTIVE:
   case SENSORS_READY:
     return BUTTON_IRQ_ENABLED(2);
-    }
+  }
   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/cc2530dk/dev/leds-arch.c b/platform/cc2530dk/dev/leds-arch.c
index e899893dd9..566fb000cf 100644
--- a/platform/cc2530dk/dev/leds-arch.c
+++ b/platform/cc2530dk/dev/leds-arch.c
@@ -59,9 +59,9 @@ unsigned char
 leds_arch_get(void)
 {
 #if MODEL_CC2531
-  return (unsigned char) (LED1_PIN | ((LED2_PIN ^ 0x01) << 1));
+  return (unsigned char)(LED1_PIN | ((LED2_PIN ^ 0x01) << 1));
 #else
-  return (unsigned char) (LED1_PIN | (LED2_PIN << 1) | (LED3_PIN << 2));
+  return (unsigned char)(LED1_PIN | (LED2_PIN << 1) | (LED3_PIN << 2));
 #endif
 }
 /*---------------------------------------------------------------------------*/
diff --git a/platform/cc2530dk/dev/smartrf-sensors.c b/platform/cc2530dk/dev/smartrf-sensors.c
index 87d4935cc8..4bac66dab6 100644
--- a/platform/cc2530dk/dev/smartrf-sensors.c
+++ b/platform/cc2530dk/dev/smartrf-sensors.c
@@ -43,15 +43,15 @@
 
 const struct sensors_sensor *sensors[] = {
 #if ADC_SENSOR_ON
-    &adc_sensor,
+  &adc_sensor,
 #endif
 #if BUTTON_SENSOR_ON
-    &button_1_sensor,
+  &button_1_sensor,
 #if MODEL_CC2531
-    &button_2_sensor,
+  &button_2_sensor,
 #endif
 #endif
-    0
+  0
 };
 
 unsigned char sensors_flags[(sizeof(sensors) / sizeof(struct sensors_sensor *))];
diff --git a/platform/cc2530dk/dev/usb-serial.c b/platform/cc2530dk/dev/usb-serial.c
index 403813cb6c..4f766abb7e 100644
--- a/platform/cc2530dk/dev/usb-serial.c
+++ b/platform/cc2530dk/dev/usb-serial.c
@@ -104,20 +104,20 @@ static uint8_t buffered_data = 0;
 #endif
 
 /* Callback to the input handler */
-static int (*input_handler)(unsigned char c);
+static int (* input_handler)(unsigned char c);
 /*---------------------------------------------------------------------------*/
 uint8_t *
 usb_class_get_string_descriptor(uint16_t lang, uint8_t string)
 {
   switch (string) {
   case 0:
-    return (uint8_t *) &lang_id;
+    return (uint8_t *)&lang_id;
   case 1:
-    return (uint8_t *) &string_manufacturer;
+    return (uint8_t *)&string_manufacturer;
   case 2:
-    return (uint8_t *) &string_product;
+    return (uint8_t *)&string_product;
   case 3:
-    return (uint8_t *) &string_serial_nr;
+    return (uint8_t *)&string_serial_nr;
   default:
     return NULL;
   }
@@ -271,7 +271,7 @@ PROCESS_THREAD(usb_serial_process, ev, data)
 }
 /*---------------------------------------------------------------------------*/
 void
-usb_serial_set_input(int (*input)(unsigned char c))
+usb_serial_set_input(int (* input)(unsigned char c))
 {
   input_handler = input;
 }
diff --git a/platform/cc2530dk/dev/usb-serial.h b/platform/cc2530dk/dev/usb-serial.h
index 3af06b37e6..bc7784e497 100644
--- a/platform/cc2530dk/dev/usb-serial.h
+++ b/platform/cc2530dk/dev/usb-serial.h
@@ -46,7 +46,7 @@
 
 void usb_serial_init(void);
 void usb_serial_writeb(uint8_t);
-void usb_serial_set_input(int (*input)(unsigned char c));
+void usb_serial_set_input(int (* input)(unsigned char c));
 
 #if USB_SERIAL_CONF_BUFFERED
 void usb_serial_flush(void);
diff --git a/platform/cc2530dk/viztool.c b/platform/cc2530dk/viztool.c
index 642cb2f5ca..229b2ae3d1 100644
--- a/platform/cc2530dk/viztool.c
+++ b/platform/cc2530dk/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) {
-- 
GitLab