[peripherals] ami601: silence warning

This commit is contained in:
Felix Ruess
2013-12-19 21:30:54 +01:00
parent 2842220b17
commit 7c466ff14c
+34 -32
View File
@@ -30,40 +30,42 @@ extern volatile uint32_t ami601_nb_err;
#define AMI601_ISR() {}
#ifdef SITL
#define AMI601Event(_handler) { \
if (ami601_status == AMI601_DATA_AVAILABLE) \
_handler(); \
#define AMI601Event(_handler) { \
if (ami601_status == AMI601_DATA_AVAILABLE) \
_handler(); \
}
#else
#define AMI601Event(_handler) { \
switch (ami601_status) { \
case AMI601_SENDING_REQ : \
if ( ami601_i2c_trans.status == I2CTransSuccess ) { \
ami601_status = AMI601_WAITING_MEASURE; \
} \
break; \
case AMI601_WAITING_MEASURE : \
ami601_status = AMI601_READING_MEASURE; \
ami601_i2c_trans.type = I2CTransRx; \
ami601_i2c_trans.len_r = 15; \
i2c_submit(&i2c1, &ami601_i2c_trans); \
break; \
case AMI601_READING_MEASURE : \
if ( ami601_i2c_trans.status == I2CTransSuccess ) { \
ami601_foo1 = ami601_i2c_trans.buf[0]; /* AA ? */ \
ami601_foo2 = ami601_i2c_trans.buf[1]; /* 55 ? */ \
ami601_foo3 = ami601_i2c_trans.buf[2]; /* ERR ? */ \
uint8_t i; \
for (i=0; i< AMI601_NB_CHAN; i++) { \
ami601_values[i] = ami601_i2c_trans.buf[3 + 2 * i]; \
ami601_values[i] += ami601_i2c_trans.buf[3 + 2 * i + 1] * 256;\
} \
ami601_status = AMI601_DATA_AVAILABLE; \
_handler(); \
} \
break; \
} \
}
#define AMI601Event(_handler) { \
switch (ami601_status) { \
case AMI601_SENDING_REQ : \
if ( ami601_i2c_trans.status == I2CTransSuccess ) { \
ami601_status = AMI601_WAITING_MEASURE; \
} \
break; \
case AMI601_WAITING_MEASURE : \
ami601_status = AMI601_READING_MEASURE; \
ami601_i2c_trans.type = I2CTransRx; \
ami601_i2c_trans.len_r = 15; \
i2c_submit(&i2c1, &ami601_i2c_trans); \
break; \
case AMI601_READING_MEASURE : \
if ( ami601_i2c_trans.status == I2CTransSuccess ) { \
ami601_foo1 = ami601_i2c_trans.buf[0]; /* AA ? */ \
ami601_foo2 = ami601_i2c_trans.buf[1]; /* 55 ? */ \
ami601_foo3 = ami601_i2c_trans.buf[2]; /* ERR ? */ \
uint8_t i; \
for (i=0; i< AMI601_NB_CHAN; i++) { \
ami601_values[i] = ami601_i2c_trans.buf[3 + 2 * i]; \
ami601_values[i] += ami601_i2c_trans.buf[3 + 2 * i + 1] * 256; \
} \
ami601_status = AMI601_DATA_AVAILABLE; \
_handler(); \
} \
break; \
default: \
break; \
} \
}
#endif