Code style fixes: cc2530dk

ico
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;
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");

View File

@ -50,8 +50,7 @@ putdec(uint8_t c)
c %= div;
if((disp != 0) || (hassent) || (div == 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 */
/*---------------------------------------------------------------------------*/
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:

View File

@ -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
}
/*---------------------------------------------------------------------------*/

View File

@ -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 *))];

View File

@ -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;
}

View File

@ -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);

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;
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) {