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

@ -206,7 +206,7 @@
/* ND and Routing */
#ifndef UIP_CONF_ROUTER
#define UIP_CONF_ROUTER 1
#define UIP_CONF_ROUTER 1
#endif
/* Prevent SDCC compile error when UIP_CONF_ROUTER == 0 */

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

@ -134,8 +134,8 @@ value(int type)
static int
status(int type)
{
return ready;
}
return ready;
}
/*---------------------------------------------------------------------------*/
/*
* On N740 we can control Ill and Acc individually:
@ -203,9 +203,9 @@ configure(int type, int value)
ready |= ADC_VAL_LIGHT_ON;
}
#endif /* LIGHT_SENSOR_ON */
n740_ser_par_set(ser_par_val);
n740_ser_par_set(ser_par_val);
#endif /* MODEL_N740 */
}
}
return ready;
}

View File

@ -59,25 +59,25 @@ 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();
}
}
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

@ -91,11 +91,11 @@
* CFD bytes programmed to 0x00.
*/
struct m25p16_rdid {
uint8_t man_id; /** Manufacturer ID */
uint8_t mem_type; /** Memory Type */
uint8_t mem_size; /** Memory Size */
uint8_t uid_len; /** Unique ID length */
uint8_t uid[16]; /** Unique ID */
uint8_t man_id; /** Manufacturer ID */
uint8_t mem_type; /** Memory Type */
uint8_t mem_size; /** Memory Size */
uint8_t uid_len; /** Unique ID length */
uint8_t uid[16]; /** Unique ID */
};
/*---------------------------------------------------------------------------*/
/**
@ -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

@ -44,13 +44,13 @@
const struct sensors_sensor *sensors[] = {
#if ADC_SENSOR_ON
&adc_sensor,
&adc_sensor,
#endif
#if BUTTON_SENSOR_ON
&button_1_sensor,
&button_2_sensor,
&button_1_sensor,
&button_2_sensor,
#endif
0
0
};
unsigned char sensors_flags[(sizeof(sensors) / sizeof(struct sensors_sensor *))];
@ -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) {