Code style fixes: cc2530dk examples

ico
George Oikonomou 2012-12-16 15:27:01 +00:00
parent 351a4d39b9
commit 594ba9a0ed
10 changed files with 38 additions and 35 deletions

View File

@ -33,7 +33,7 @@ PROCESS_THREAD(hello_world_process, ev, data)
if(ev == PROCESS_EVENT_TIMER) {
printf("Sensor says #%u\n", count);
count ++;
count++;
etimer_reset(&et_hello);
}

View File

@ -75,7 +75,7 @@ print_local_addresses(void) CC_NON_BANKED
PUTSTRING(" ");
PRINT6ADDR(&uip_ds6_if.addr_list[i].ipaddr);
PUTCHAR('\n');
if (state == ADDR_TENTATIVE) {
if(state == ADDR_TENTATIVE) {
uip_ds6_if.addr_list[i].state = ADDR_PREFERRED;
}
}

View File

@ -57,7 +57,7 @@ static void
slip_input_callback(void)
{
PRINTF("SIN: %u\n", uip_len);
if((char) uip_buf[0] == '!') {
if((char)uip_buf[0] == '!') {
PRINTF("Got configuration message of type %c\n", uip_buf[1]);
uip_len = 0;
if((char)uip_buf[1] == 'P') {

View File

@ -91,7 +91,7 @@ PROCESS_THREAD(buttons_test_process, ev, data)
PROCESS_BEGIN();
while (1) {
while(1) {
PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event);
@ -113,7 +113,7 @@ PROCESS_THREAD(sensors_test_process, ev, data)
/* Sensor Values */
static int rv;
static struct sensors_sensor * sensor;
static struct sensors_sensor *sensor;
static float sane = 0;
static int dec;
static float frac;
@ -127,7 +127,7 @@ PROCESS_THREAD(sensors_test_process, ev, data)
/* Set an etimer. We take sensor readings when it expires and reset it. */
etimer_set(&et, CLOCK_SECOND * 2);
while (1) {
while(1) {
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
@ -136,7 +136,7 @@ PROCESS_THREAD(sensors_test_process, ev, data)
* Return value -1 means sensor not available or turned off in conf
*/
sensor = sensors_find(ADC_SENSOR);
if (sensor) {
if(sensor) {
PRINTF("------------------\n");
leds_on(LEDS_RED);
/*
@ -189,5 +189,5 @@ PROCESS_THREAD(sensors_test_process, ev, data)
etimer_reset(&et);
}
PROCESS_END();
}
}
/*---------------------------------------------------------------------------*/

View File

@ -47,4 +47,3 @@ netstack_init(void)
NETSTACK_RADIO.init();
}
/*---------------------------------------------------------------------------*/

View File

@ -88,13 +88,13 @@ init(void)
}
/*---------------------------------------------------------------------------*/
const struct rdc_driver stub_rdc_driver = {
"stub-rdc",
init,
send,
send_list,
input,
on,
off,
cca,
"stub-rdc",
init,
send,
send_list,
input,
on,
off,
cca,
};
/*---------------------------------------------------------------------------*/

View File

@ -48,7 +48,8 @@ AUTOSTART_PROCESSES(&clock_test_process);
/*---------------------------------------------------------------------------*/
#if TEST_RTIMER
void
rt_callback(struct rtimer *t, void *ptr) {
rt_callback(struct rtimer *t, void *ptr)
{
rt_now = RTIMER_NOW();
ct = clock_time();
printf("Task called at %u (clock = %u)\n", rt_now, ct);
@ -82,13 +83,13 @@ PROCESS_THREAD(clock_test_process, ev, data)
printf("Rtimer Test, 1 sec (%u rtimer ticks):\n", RTIMER_SECOND);
i = 0;
while(i < 5) {
etimer_set(&et, 2*CLOCK_SECOND);
etimer_set(&et, 2 * CLOCK_SECOND);
printf("=======================\n");
ct = clock_time();
rt_now = RTIMER_NOW();
rt_for = rt_now + RTIMER_SECOND;
printf("Now=%u (clock = %u) - For=%u\n", rt_now, ct, rt_for);
if (rtimer_set(&rt, rt_for, 1,
if(rtimer_set(&rt, rt_for, 1,
(void (*)(struct rtimer *, void *))rt_callback, NULL) != RTIMER_OK) {
printf("Error setting\n");
}

View File

@ -81,7 +81,7 @@ static void
timeout_handler(void)
{
static int seq_id;
struct uip_udp_conn * this_conn;
struct uip_udp_conn *this_conn;
leds_on(LEDS_RED);
memset(buf, 0, MAX_PAYLOAD_LEN);
@ -117,7 +117,7 @@ PROCESS_THREAD(udp_client_process, ev, data)
PROCESS_BEGIN();
PRINTF("UDP client process started\n");
uip_ip6addr(&ipaddr,0xfe80,0,0,0,0x0215,0x2000,0x0002,0x2145);
uip_ip6addr(&ipaddr, 0xfe80, 0, 0, 0, 0x0215, 0x2000, 0x0002, 0x2145);
/* new connection with remote host */
l_conn = udp_new(&ipaddr, UIP_HTONS(3000), NULL);
if(!l_conn) {
@ -128,9 +128,9 @@ PROCESS_THREAD(udp_client_process, ev, data)
PRINTF("Link-Local connection with ");
PRINT6ADDR(&l_conn->ripaddr);
PRINTF(" local/remote port %u/%u\n",
UIP_HTONS(l_conn->lport), UIP_HTONS(l_conn->rport));
UIP_HTONS(l_conn->lport), UIP_HTONS(l_conn->rport));
uip_ip6addr(&ipaddr,0xaaaa,0,0,0,0x0215,0x2000,0x0002,0x2145);
uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0x0215, 0x2000, 0x0002, 0x2145);
g_conn = udp_new(&ipaddr, UIP_HTONS(3000), NULL);
if(!g_conn) {
PRINTF("udp_new g_conn error.\n");
@ -140,7 +140,7 @@ PROCESS_THREAD(udp_client_process, ev, data)
PRINTF("Global connection with ");
PRINT6ADDR(&g_conn->ripaddr);
PRINTF(" local/remote port %u/%u\n",
UIP_HTONS(g_conn->lport), UIP_HTONS(g_conn->rport));
UIP_HTONS(g_conn->lport), UIP_HTONS(g_conn->rport));
etimer_set(&et, SEND_INTERVAL);

View File

@ -72,7 +72,8 @@ ping6handler()
count, PING6_DATALEN);
uip_len = UIP_ICMPH_LEN + UIP_ICMP6_ECHO_REQUEST_LEN + UIP_IPH_LEN + PING6_DATALEN;
uip_len = UIP_ICMPH_LEN + UIP_ICMP6_ECHO_REQUEST_LEN + UIP_IPH_LEN
+ PING6_DATALEN;
UIP_IP_BUF->len[0] = (uint8_t)((uip_len - 40) >> 8);
UIP_IP_BUF->len[1] = (uint8_t)((uip_len - 40) & 0x00FF);
@ -104,9 +105,9 @@ PROCESS_THREAD(ping6_process, ev, data)
PRINTF("ping6 running.\n");
PRINTF("Button 1: 5 pings 16 byte payload.\n");
uip_ip6addr(&dest_addr,0xaaaa,0,0,0,0x0215,0x2000,0x0002,0x2145);
uip_ip6addr(&dest_addr, 0xaaaa, 0, 0, 0, 0x0215, 0x2000, 0x0002, 0x2145);
count = 0;
icmp6_new(NULL);
while(1) {
@ -124,7 +125,7 @@ PROCESS_THREAD(ping6_process, ev, data)
PRINTF("Echo Reply\n");
}
}
PROCESS_END();
}
/*---------------------------------------------------------------------------*/

View File

@ -92,9 +92,10 @@ static void
print_stats()
{
PRINTF("tl=%lu, ts=%lu, bs=%lu, bc=%lu\n",
rimestats.toolong, rimestats.tooshort, rimestats.badsynch, rimestats.badcrc);
PRINTF("llrx=%lu, lltx=%lu, rx=%lu, tx=%lu\n",
rimestats.llrx, rimestats.lltx, rimestats.rx, rimestats.tx);
rimestats.toolong, rimestats.tooshort, rimestats.badsynch,
rimestats.badcrc);
PRINTF("llrx=%lu, lltx=%lu, rx=%lu, tx=%lu\n", rimestats.llrx,
rimestats.lltx, rimestats.rx, rimestats.tx);
}
#endif
/*---------------------------------------------------------------------------*/
@ -112,7 +113,7 @@ print_local_addresses(void)
PRINTF(" ");
PRINT6ADDR(&uip_ds6_if.addr_list[i].ipaddr);
PRINTF("\n");
if (state == ADDR_TENTATIVE) {
if(state == ADDR_TENTATIVE) {
uip_ds6_if.addr_list[i].state = ADDR_PREFERRED;
}
}
@ -131,7 +132,8 @@ create_dag()
print_local_addresses();
dag = rpl_set_root(RPL_DEFAULT_INSTANCE, &uip_ds6_get_global(ADDR_PREFERRED)->ipaddr);
dag = rpl_set_root(RPL_DEFAULT_INSTANCE,
&uip_ds6_get_global(ADDR_PREFERRED)->ipaddr);
if(dag != NULL) {
uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
rpl_set_prefix(dag, &ipaddr, 64);
@ -167,7 +169,7 @@ PROCESS_THREAD(udp_server_process, ev, data)
tcpip_handler();
#if (BUTTON_SENSOR_ON && (DEBUG==DEBUG_PRINT))
} else if(ev == sensors_event && data == &button_sensor) {
print_stats();
print_stats();
#endif /* BUTTON_SENSOR_ON */
}
}