Code style fixes: sensinode

This commit is contained in:
George Oikonomou 2012-12-16 11:01:23 +00:00
parent e38b419e84
commit b4bb51e811
12 changed files with 56 additions and 53 deletions

View file

@ -91,7 +91,7 @@ struct flash_address {
static struct flash_address f;
static struct record r;
static struct sensors_sensor * s;
static struct sensors_sensor *s;
static struct etimer et;
#define FLASH_START_ADDR 0x1E0000
#define FLASH_END_ADDR 0x1FFFFF
@ -201,7 +201,7 @@ PROCESS_THREAD(batmon_process, ev, data)
PRINTF("BatMon\n", sizeof(r));
s = sensors_find(ADC_SENSOR);
if (!s) {
if(!s) {
PRINTF("BatMon: ADC not found\n");
PROCESS_EXIT();
}

View file

@ -77,7 +77,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) {
@ -96,7 +96,7 @@ set_rime_addr(void) CC_NON_BANKED
uint8_t *addr_long = NULL;
uint16_t addr_short = 0;
char i;
__code unsigned char * macp;
__code unsigned char *macp;
PUTSTRING("Rime is 0x");
PUTHEX(sizeof(rimeaddr_t));
@ -119,7 +119,7 @@ set_rime_addr(void) CC_NON_BANKED
FMAP = 3;
/* Set our pointer to the correct address and fetch 8 bytes of MAC */
macp = (__code unsigned char *) 0xFFF8;
macp = (__code unsigned char *)0xFFF8;
for(i = (RIMEADDR_SIZE - 1); i >= 0; --i) {
rimeaddr_node_addr.u8[i] = *macp;
@ -343,7 +343,7 @@ main(void)
nop
__endasm;
if (SLEEP & SLEEP_MODE0) {
if(SLEEP & SLEEP_MODE0) {
#endif /* LPM_MODE==LPM_MODE_PM2 */
ENERGEST_OFF(ENERGEST_TYPE_CPU);

View file

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

View file

@ -135,7 +135,7 @@ static int
status(int type)
{
return ready;
}
}
/*---------------------------------------------------------------------------*/
/*
* On N740 we can control Ill and Acc individually:

View file

@ -59,16 +59,16 @@ HWCONF_PORT_0_IRQ(BUTTON_2, 7)
#endif /* MODEL_N711 */
/*---------------------------------------------------------------------------*/
static
int value_b1(int type)
static int
value_b1(int type)
{
return BUTTON_1_READ() || !timer_expired(&debouncetimer[0]);
}
/*---------------------------------------------------------------------------*/
static
int status_b1(int type)
static int
status_b1(int type)
{
switch (type) {
switch(type) {
case SENSORS_ACTIVE:
case SENSORS_READY:
return BUTTON_1_IRQ_ENABLED();
@ -76,8 +76,8 @@ int status_b1(int type)
return 0;
}
/*---------------------------------------------------------------------------*/
static
int configure_b1(int type, int value)
static int
configure_b1(int type, int value)
{
switch(type) {
case SENSORS_HW_INIT:
@ -92,7 +92,7 @@ int configure_b1(int type, int value)
timer_set(&debouncetimer[0], 0);
BUTTON_1_IRQ_FLAG_OFF();
BUTTON_1_ENABLE_IRQ();
}
}
} else {
BUTTON_1_DISABLE_IRQ();
}
@ -101,16 +101,16 @@ int configure_b1(int type, int value)
return 0;
}
/*---------------------------------------------------------------------------*/
static
int value_b2(int type)
static int
value_b2(int type)
{
return BUTTON_2_READ() || !timer_expired(&debouncetimer[1]);
}
/*---------------------------------------------------------------------------*/
static
int status_b2(int type)
static int
status_b2(int type)
{
switch (type) {
switch(type) {
case SENSORS_ACTIVE:
case SENSORS_READY:
return BUTTON_2_IRQ_ENABLED();
@ -118,8 +118,8 @@ int status_b2(int type)
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

@ -146,7 +146,7 @@ m25p16_wrdi()
}
/*---------------------------------------------------------------------------*/
void
m25p16_rdid(struct m25p16_rdid * rdid)
m25p16_rdid(struct m25p16_rdid *rdid)
{
uint8_t i;
@ -237,7 +237,7 @@ m25p16_pp(uint8_t * addr, uint8_t * buff, uint8_t buff_len)
}
/* Write the bytes */
for(i=0; i<buff_len; i++) {
for(i = 0; i < buff_len; i++) {
bit_bang_write(~buff[i]);
}
ENERGEST_OFF(ENERGEST_TYPE_FLASH_WRITE);
@ -281,7 +281,8 @@ m25p16_dp()
* Release Deep Power Down. We do NOT read the Electronic Signature
*/
void
m25p16_res() {
m25p16_res()
{
select();
bit_bang_write(M25P16_I_RES);
deselect();
@ -296,7 +297,8 @@ m25p16_res() {
* \return The old style Electronic Signature. This must be 0x14
*/
uint8_t
m25p16_res_res() {
m25p16_res_res()
{
uint8_t rv;
select();

View file

@ -144,7 +144,7 @@ void m25p16_wrdi();
* \param rdid Pointer to a struct which will hold the information returned
* by the RDID instruction
*/
void m25p16_rdid(struct m25p16_rdid * rdid);
void m25p16_rdid(struct m25p16_rdid *rdid);
/**
* \brief Read Status Register (RDSR) instruction

View file

@ -64,7 +64,7 @@
/* Serial/Parallel Shift Register (74HC595D) Functions */
void n740_ser_par_init(void);
void n740_ser_par_set(uint8_t data) ;
void n740_ser_par_set(uint8_t data);
uint8_t n740_ser_par_get(void);
/* Analog Switch (U5 - 74HC4053D) Functions */

View file

@ -61,7 +61,7 @@ sensinode_sensors_activate()
{
struct sensors_sensor *sensor;
sensor = sensors_first();
while (sensor) {
while(sensor) {
sensor->configure(SENSORS_ACTIVE, 1);
sensor = sensors_next(sensor);
}
@ -73,7 +73,7 @@ sensinode_sensors_deactivate()
{
struct sensors_sensor *sensor;
sensor = sensors_first();
while (sensor) {
while(sensor) {
sensor->configure(SENSORS_ACTIVE, 0);
sensor = sensors_next(sensor);
}

View file

@ -76,7 +76,7 @@ void batmon_log(uint8_t trigger);
#endif
/*---------------------------------------------------------------------------*/
static struct uip_udp_conn *server_conn;
static struct disco_request_pdu * req;
static struct disco_request_pdu *req;
static struct disco_response_pdu resp;
static struct disco_seed seed;
static uint8_t state;
@ -92,7 +92,7 @@ extern void *uip_appdata;
__xdata __at(BOOTTY_CMD_LOCATION) static uint8_t bd;
/*---------------------------------------------------------------------------*/
static void timer_handler(void * p);
static void timer_handler(void *p);
/*---------------------------------------------------------------------------*/
static void
abort() CC_NON_BANKED
@ -116,9 +116,9 @@ restart_timer(uint16_t t) CC_NON_BANKED
}
/*---------------------------------------------------------------------------*/
static void
timer_handler(void * p)
timer_handler(void *p)
{
uint8_t * s = p;
uint8_t *s = p;
uint8_t wip;
PRINTF("Disco: @ %lu, s: %u\n", clock_seconds(), *s);
@ -213,7 +213,8 @@ cmd_init() CC_NON_BANKED
static uint8_t
cmd_write() CC_NON_BANKED
{
PRINTF("Disco: Write 0x%02x%02x%02x\n", req->addr[0], req->addr[1], req->addr[2]);
PRINTF("Disco: Write 0x%02x%02x%02x\n", req->addr[0], req->addr[1],
req->addr[2]);
if(uip_datalen() != DISCO_LEN_WRITE) {
resp.status = DISCO_ERR_BAD_LEN;
return DISCO_RESP_LEN_ERR;

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