[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paparazzi-commits] [5902] removed timer before ami601 read
From: |
Eric |
Subject: |
[paparazzi-commits] [5902] removed timer before ami601 read |
Date: |
Sun, 19 Sep 2010 03:14:27 +0000 |
Revision: 5902
http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=5902
Author: lamestllama
Date: 2010-09-19 03:14:27 +0000 (Sun, 19 Sep 2010)
Log Message:
-----------
removed timer before ami601 read
Modified Paths:
--------------
paparazzi3/trunk/sw/airborne/booz/peripherals/booz_ami601.h
Modified: paparazzi3/trunk/sw/airborne/booz/peripherals/booz_ami601.h
===================================================================
--- paparazzi3/trunk/sw/airborne/booz/peripherals/booz_ami601.h 2010-09-19
03:14:17 UTC (rev 5901)
+++ paparazzi3/trunk/sw/airborne/booz/peripherals/booz_ami601.h 2010-09-19
03:14:27 UTC (rev 5902)
@@ -26,51 +26,46 @@
extern volatile uint32_t ami601_nb_err;
#define AMI601_SLAVE_ADDR 0x60
+#define AMI601_IT TIR_MR1I
+#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 ) { \
- /* trigger delay for measurement */ \
- T0MR1 = T0TC + SYS_TICS_OF_USEC(12288); \
- /* clear match 1 interrupt */ \
- T0IR = TIR_MR1I; \
- /* enable match 1 interrupt */ \
- T0MCR |= TMCR_MR1_I; \
- ami601_status = AMI601_WAITING_MEASURE; \
- }
\
- 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;
\
+ }
\
+}
#endif
-#define AMI601_IT TIR_MR1I
-#define AMI601_ISR() AMI601ReadMeasure()
-#define AMI601ReadMeasure() { \
- ami601_status = AMI601_READING_MEASURE; \
- ami601_i2c_trans.type = I2CTransRx;
\
- ami601_i2c_trans.len_r = 15; \
- i2c_submit(&i2c1, &ami601_i2c_trans); \
- }
+
#endif /* AMI601_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paparazzi-commits] [5902] removed timer before ami601 read,
Eric <=