minor corrections to adhere contiki code style guidelines

This commit is contained in:
Giovanni `evilaliv3` Pellerano 2012-12-21 12:36:29 +01:00
parent aa07993d36
commit ee556dcf14
7 changed files with 47 additions and 47 deletions

View file

@ -120,9 +120,9 @@ clock_delay_usec(uint16_t dt)
stop = now + dt * ((pic32_clock_get_system_clock() / 1000000) / 2);
for (;;) {
for(;;) {
asm volatile("mfc0 %0, $9" : "=r"(now));
if ((int32_t) (now - stop) >= 0) {
if((int32_t)(now - stop) >= 0) {
break;
}
}

View file

@ -150,9 +150,9 @@
int8_t \
pic32_uart##XX##_write(uint8_t data) \
{ \
while (U##XX##STAbits.UTXBF); \
while(U##XX##STAbits.UTXBF); \
U##XX##TXREG = data; \
while (!U##XX##STAbits.TRMT); \
while(!U##XX##STAbits.TRMT); \
\
return UART_NO_ERROR; \
}

View file

@ -81,15 +81,15 @@
ISR(_UART_##XX##_VECTOR) \
{ \
volatile uint8_t byte; \
if (IFS##Y##bits.U##XX##RXIF) { \
if ((U##XX##STAbits.PERR == 0) && (U##XX##STAbits.FERR == 0)) { \
if(IFS##Y##bits.U##XX##RXIF) { \
if((U##XX##STAbits.PERR == 0) && (U##XX##STAbits.FERR == 0)) { \
CALLBACK(U##XX##RXREG); \
} else { \
byte = U##XX##RXREG; /* NULL READ */ \
} \
IFS##Y##CLR = _IFS##Y##_U##XX##RXIF_MASK; \
} \
if (U##XX##STAbits.OERR) { \
if(U##XX##STAbits.OERR) { \
U##XX##STACLR = _U##XX##STA_OERR_MASK; \
} \
}

View file

@ -127,7 +127,7 @@ PROCESS_THREAD(battery_process, ev, data)
// start converting
AD1CON1SET = 0b0000000000000010;
while (!(AD1CON1 & 0b0000000000000001)) {
while(!(AD1CON1 & 0b0000000000000001)) {
; // wait conversion finish
}

View file

@ -96,7 +96,7 @@ configure(int type, int value)
{
switch (type) {
case SENSORS_ACTIVE:
if (value) {
if(value) {
if(!status(SENSORS_ACTIVE)) {
timer_set(&debouncetimer, 0);

View file

@ -106,8 +106,8 @@ set_long_add_mem(uint16_t addr, uint8_t val)
const uint8_t tmp = MRF24J40_INTERRUPT_ENABLE_STAT();
uint8_t msg[3];
msg[0] = (((uint8_t) (addr >> 3)) & 0x7F) | 0x80;
msg[1] = (((uint8_t) (addr << 5)) & 0xE0) | 0x10;
msg[0] = (((uint8_t)(addr >> 3)) & 0x7F) | 0x80;
msg[1] = (((uint8_t)(addr << 5)) & 0xE0) | 0x10;
msg[2] = val;
if(tmp) {
@ -154,8 +154,8 @@ get_long_add_mem(uint16_t addr)
uint8_t ret_val;
uint8_t msg[2];
msg[0] = (((uint8_t) (addr >> 3)) & 0x7F) | 0x80;
msg[1] = ((uint8_t) (addr << 5)) & 0xE0;
msg[0] = (((uint8_t)(addr >> 3)) & 0x7F) | 0x80;
msg[1] = ((uint8_t)(addr << 5)) & 0xE0;
if(tmp) {
MRF24J40_INTERRUPT_ENABLE_CLR();
@ -215,8 +215,8 @@ mrf24j40_set_channel(uint16_t ch)
void
mrf24j40_set_panid(uint16_t id)
{
set_short_add_mem(MRF24J40_PANIDL, (uint8_t) id);
set_short_add_mem(MRF24J40_PANIDH, (uint8_t) (id >> 8));
set_short_add_mem(MRF24J40_PANIDL, (uint8_t)id);
set_short_add_mem(MRF24J40_PANIDH, (uint8_t)(id >> 8));
}
/*---------------------------------------------------------------------------*/
/**
@ -227,8 +227,8 @@ mrf24j40_set_panid(uint16_t id)
void
mrf24j40_set_short_mac_addr(uint16_t addr)
{
set_short_add_mem(MRF24J40_SADRL, (uint8_t) addr);
set_short_add_mem(MRF24J40_SADRH, (uint8_t) (addr >> 8));
set_short_add_mem(MRF24J40_SADRL, (uint8_t)addr);
set_short_add_mem(MRF24J40_SADRH, (uint8_t)(addr >> 8));
}
/*---------------------------------------------------------------------------*/
/**
@ -239,14 +239,14 @@ mrf24j40_set_short_mac_addr(uint16_t addr)
void
mrf24j40_set_extended_mac_addr(uint64_t addr)
{
set_short_add_mem(MRF24J40_EADR7, (uint8_t) addr);
set_short_add_mem(MRF24J40_EADR6, (uint8_t) (addr >> 8));
set_short_add_mem(MRF24J40_EADR5, (uint8_t) (addr >> 16));
set_short_add_mem(MRF24J40_EADR4, (uint8_t) (addr >> 24));
set_short_add_mem(MRF24J40_EADR3, (uint8_t) (addr >> 32));
set_short_add_mem(MRF24J40_EADR2, (uint8_t) (addr >> 40));
set_short_add_mem(MRF24J40_EADR1, (uint8_t) (addr >> 48));
set_short_add_mem(MRF24J40_EADR0, (uint8_t) (addr >> 56));
set_short_add_mem(MRF24J40_EADR7, (uint8_t)addr);
set_short_add_mem(MRF24J40_EADR6, (uint8_t)(addr >> 8));
set_short_add_mem(MRF24J40_EADR5, (uint8_t)(addr >> 16));
set_short_add_mem(MRF24J40_EADR4, (uint8_t)(addr >> 24));
set_short_add_mem(MRF24J40_EADR3, (uint8_t)(addr >> 32));
set_short_add_mem(MRF24J40_EADR2, (uint8_t)(addr >> 40));
set_short_add_mem(MRF24J40_EADR1, (uint8_t)(addr >> 48));
set_short_add_mem(MRF24J40_EADR0, (uint8_t)(addr >> 56));
}
/*---------------------------------------------------------------------------*/
/**
@ -257,8 +257,8 @@ mrf24j40_set_extended_mac_addr(uint64_t addr)
void
mrf24j40_get_short_mac_addr(uint16_t *addr)
{
*(((uint8_t *) & addr)) = get_short_add_mem(MRF24J40_SADRH);
*(((uint8_t *) & addr) + 1) = get_short_add_mem(MRF24J40_SADRL);
*(((uint8_t *)& addr)) = get_short_add_mem(MRF24J40_SADRH);
*(((uint8_t *)& addr) + 1) = get_short_add_mem(MRF24J40_SADRL);
}
/*---------------------------------------------------------------------------*/
/**
@ -269,14 +269,14 @@ mrf24j40_get_short_mac_addr(uint16_t *addr)
void
mrf24j40_get_extended_mac_addr(uint64_t *addr)
{
*(((uint8_t *) & addr)) = get_short_add_mem(MRF24J40_EADR7);
*(((uint8_t *) & addr) + 1) = get_short_add_mem(MRF24J40_EADR6);
*(((uint8_t *) & addr) + 2) = get_short_add_mem(MRF24J40_EADR5);
*(((uint8_t *) & addr) + 3) = get_short_add_mem(MRF24J40_EADR4);
*(((uint8_t *) & addr) + 4) = get_short_add_mem(MRF24J40_EADR3);
*(((uint8_t *) & addr) + 5) = get_short_add_mem(MRF24J40_EADR2);
*(((uint8_t *) & addr) + 6) = get_short_add_mem(MRF24J40_EADR1);
*(((uint8_t *) & addr) + 7) = get_short_add_mem(MRF24J40_EADR0);
*(((uint8_t *)& addr)) = get_short_add_mem(MRF24J40_EADR7);
*(((uint8_t *)& addr) + 1) = get_short_add_mem(MRF24J40_EADR6);
*(((uint8_t *)& addr) + 2) = get_short_add_mem(MRF24J40_EADR5);
*(((uint8_t *)& addr) + 3) = get_short_add_mem(MRF24J40_EADR4);
*(((uint8_t *)& addr) + 4) = get_short_add_mem(MRF24J40_EADR3);
*(((uint8_t *)& addr) + 5) = get_short_add_mem(MRF24J40_EADR2);
*(((uint8_t *)& addr) + 6) = get_short_add_mem(MRF24J40_EADR1);
*(((uint8_t *)& addr) + 7) = get_short_add_mem(MRF24J40_EADR0);
}
/*---------------------------------------------------------------------------*/
/**

View file

@ -82,10 +82,10 @@ init_net(uint8_t node_id)
memset(&shortaddr, 0, sizeof(shortaddr));
memset(&longaddr, 0, sizeof(longaddr));
*((uint8_t *) & shortaddr) = node_id >> 8;
*((uint8_t *) & shortaddr + 1) = node_id;
*((uint8_t *) & longaddr) = node_id >> 8;
*((uint8_t *) & longaddr + 1) = node_id;
*((uint8_t *)&shortaddr) = node_id >> 8;
*((uint8_t *)&shortaddr + 1) = node_id;
*((uint8_t *)&longaddr) = node_id >> 8;
*((uint8_t *)&longaddr + 1) = node_id;
for(i = 2; i < sizeof(longaddr); ++i) {
((uint8_t *)&longaddr)[i] = random_rand();
}
@ -94,14 +94,14 @@ init_net(uint8_t node_id)
*((uint8_t *) & shortaddr), *((uint8_t *) & shortaddr + 1));
PRINTF("EXTENDED MAC ADDRESS %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
*((uint8_t *) & longaddr),
*((uint8_t *) & longaddr + 1),
*((uint8_t *) & longaddr + 2),
*((uint8_t *) & longaddr + 3),
*((uint8_t *) & longaddr + 4),
*((uint8_t *) & longaddr + 5),
*((uint8_t *) & longaddr + 6),
*((uint8_t *) & longaddr + 7));
*((uint8_t *)&longaddr),
*((uint8_t *)&longaddr + 1),
*((uint8_t *)&longaddr + 2),
*((uint8_t *)&longaddr + 3),
*((uint8_t *)&longaddr + 4),
*((uint8_t *)&longaddr + 5),
*((uint8_t *)&longaddr + 6),
*((uint8_t *)&longaddr + 7));
memset(&addr, 0, sizeof(rimeaddr_t));