Code style fixes: cc2530dk

This commit is contained in:
George Oikonomou 2012-12-16 13:25:33 +00:00
parent 380ee3bae9
commit 351a4d39b9
8 changed files with 36 additions and 37 deletions

View File

@ -65,7 +65,7 @@ fade(int l) CC_NON_BANKED
volatile int i, a; volatile int i, a;
int k, j; int k, j;
for(k = 0; k < 400; ++k) { for(k = 0; k < 400; ++k) {
j = k > 200? 400 - k: k; j = k > 200 ? 400 - k : k;
leds_on(l); leds_on(l);
for(i = 0; i < j; ++i) { for(i = 0; i < j; ++i) {
@ -84,9 +84,9 @@ set_rime_addr(void) CC_NON_BANKED
char i; char i;
#if CC2530_CONF_MAC_FROM_PRIMARY #if CC2530_CONF_MAC_FROM_PRIMARY
__xdata unsigned char * macp = &X_IEEE_ADDR; __xdata unsigned char *macp = &X_IEEE_ADDR;
#else #else
__code unsigned char * macp = (__code unsigned char *) 0xFFE8; __code unsigned char *macp = (__code unsigned char *)0xFFE8;
#endif #endif
PUTSTRING("Rime is 0x"); PUTSTRING("Rime is 0x");

View File

@ -50,8 +50,7 @@ putdec(uint8_t c)
c %= div; c %= div;
if((disp != 0) || (hassent) || (div == 1)) { if((disp != 0) || (hassent) || (div == 1)) {
hassent = 1; hassent = 1;
putchar('0'+disp); putchar('0' + disp);
} }
} }
} }

View File

@ -40,26 +40,26 @@ static CC_AT_DATA struct timer debouncetimer;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* Button 1 - SmartRF and cc2531 USB Dongle */ /* Button 1 - SmartRF and cc2531 USB Dongle */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static static int
int value_b1(int type) value_b1(int type)
{ {
type; type;
return BUTTON_READ(1) || !timer_expired(&debouncetimer); return BUTTON_READ(1) || !timer_expired(&debouncetimer);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static static int
int status_b1(int type) status_b1(int type)
{ {
switch (type) { switch(type) {
case SENSORS_ACTIVE: case SENSORS_ACTIVE:
case SENSORS_READY: case SENSORS_READY:
return BUTTON_IRQ_ENABLED(1); return BUTTON_IRQ_ENABLED(1);
} }
return 0; return 0;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static static int
int configure_b1(int type, int value) configure_b1(int type, int value)
{ {
switch(type) { switch(type) {
case SENSORS_HW_INIT: case SENSORS_HW_INIT:
@ -88,26 +88,26 @@ int configure_b1(int type, int value)
/* Button 2 - cc2531 USb Dongle only */ /* Button 2 - cc2531 USb Dongle only */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if MODEL_CC2531 #if MODEL_CC2531
static static int
int value_b2(int type) value_b2(int type)
{ {
type; type;
return BUTTON_READ(2) || !timer_expired(&debouncetimer); return BUTTON_READ(2) || !timer_expired(&debouncetimer);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static static int
int status_b2(int type) status_b2(int type)
{ {
switch (type) { switch(type) {
case SENSORS_ACTIVE: case SENSORS_ACTIVE:
case SENSORS_READY: case SENSORS_READY:
return BUTTON_IRQ_ENABLED(2); return BUTTON_IRQ_ENABLED(2);
} }
return 0; return 0;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static static int
int configure_b2(int type, int value) configure_b2(int type, int value)
{ {
switch(type) { switch(type) {
case SENSORS_HW_INIT: case SENSORS_HW_INIT:

View File

@ -59,9 +59,9 @@ unsigned char
leds_arch_get(void) leds_arch_get(void)
{ {
#if MODEL_CC2531 #if MODEL_CC2531
return (unsigned char) (LED1_PIN | ((LED2_PIN ^ 0x01) << 1)); return (unsigned char)(LED1_PIN | ((LED2_PIN ^ 0x01) << 1));
#else #else
return (unsigned char) (LED1_PIN | (LED2_PIN << 1) | (LED3_PIN << 2)); return (unsigned char)(LED1_PIN | (LED2_PIN << 1) | (LED3_PIN << 2));
#endif #endif
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/

View File

@ -43,15 +43,15 @@
const struct sensors_sensor *sensors[] = { const struct sensors_sensor *sensors[] = {
#if ADC_SENSOR_ON #if ADC_SENSOR_ON
&adc_sensor, &adc_sensor,
#endif #endif
#if BUTTON_SENSOR_ON #if BUTTON_SENSOR_ON
&button_1_sensor, &button_1_sensor,
#if MODEL_CC2531 #if MODEL_CC2531
&button_2_sensor, &button_2_sensor,
#endif #endif
#endif #endif
0 0
}; };
unsigned char sensors_flags[(sizeof(sensors) / sizeof(struct sensors_sensor *))]; unsigned char sensors_flags[(sizeof(sensors) / sizeof(struct sensors_sensor *))];

View File

@ -104,20 +104,20 @@ static uint8_t buffered_data = 0;
#endif #endif
/* Callback to the input handler */ /* Callback to the input handler */
static int (*input_handler)(unsigned char c); static int (* input_handler)(unsigned char c);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
uint8_t * uint8_t *
usb_class_get_string_descriptor(uint16_t lang, uint8_t string) usb_class_get_string_descriptor(uint16_t lang, uint8_t string)
{ {
switch (string) { switch (string) {
case 0: case 0:
return (uint8_t *) &lang_id; return (uint8_t *)&lang_id;
case 1: case 1:
return (uint8_t *) &string_manufacturer; return (uint8_t *)&string_manufacturer;
case 2: case 2:
return (uint8_t *) &string_product; return (uint8_t *)&string_product;
case 3: case 3:
return (uint8_t *) &string_serial_nr; return (uint8_t *)&string_serial_nr;
default: default:
return NULL; return NULL;
} }
@ -271,7 +271,7 @@ PROCESS_THREAD(usb_serial_process, ev, data)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
usb_serial_set_input(int (*input)(unsigned char c)) usb_serial_set_input(int (* input)(unsigned char c))
{ {
input_handler = input; input_handler = input;
} }

View File

@ -46,7 +46,7 @@
void usb_serial_init(void); void usb_serial_init(void);
void usb_serial_writeb(uint8_t); 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 #if USB_SERIAL_CONF_BUFFERED
void usb_serial_flush(void); void usb_serial_flush(void);

View File

@ -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; uint32_t flip = 0;
PRINTF("Default Routes\n"); PRINTF("Default Routes\n");
for(i = buf[1]; i < UIP_DS6_DEFRT_NB; i++) { 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"); PRINTF("Unicast Addresses\n");
for(i = buf[1]; i < UIP_DS6_ADDR_NB; i++) { for(i = buf[1]; i < UIP_DS6_ADDR_NB; i++) {
if(uip_ds6_if.addr_list[i].isused) { 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); memset(&buf[2], 0, 4);
for(i = 0; i < UIP_DS6_ADDR_NB; i++) { for(i = 0; i < UIP_DS6_ADDR_NB; i++) {
if(uip_ds6_if.addr_list[i].isused) { if(uip_ds6_if.addr_list[i].isused) {