mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-23 04:45:37 +08:00
indentation
This commit is contained in:
@@ -81,7 +81,7 @@ void imu_periodic(void) {
|
||||
SPI_Cmd(SPI2, ENABLE);
|
||||
max1168_read();
|
||||
#if IMU_B2_MAG_TYPE == IMU_B2_MAG_HMC5843
|
||||
hmc5843_periodic();
|
||||
hmc5843_periodic();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -36,24 +36,24 @@ extern void baro_board_send_config_abs(void);
|
||||
extern void baro_board_send_config_diff(void);
|
||||
|
||||
#define BaroEvent(_b_abs_handler, _b_diff_handler) { \
|
||||
if (baro_board.status == LBS_READING_ABS && \
|
||||
baro_trans.status != I2CTransPending) { \
|
||||
baro_board.status = LBS_READ_ABS; \
|
||||
if (baro_trans.status == I2CTransSuccess) { \
|
||||
int16_t tmp = baro_trans.buf[0]<<8 | baro_trans.buf[1]; \
|
||||
baro.absolute = tmp; \
|
||||
_b_abs_handler(); \
|
||||
} \
|
||||
} \
|
||||
if (baro_board.status == LBS_READING_ABS && \
|
||||
baro_trans.status != I2CTransPending) { \
|
||||
baro_board.status = LBS_READ_ABS; \
|
||||
if (baro_trans.status == I2CTransSuccess) { \
|
||||
int16_t tmp = baro_trans.buf[0]<<8 | baro_trans.buf[1]; \
|
||||
baro.absolute = tmp; \
|
||||
_b_abs_handler(); \
|
||||
} \
|
||||
} \
|
||||
else if (baro_board.status == LBS_READING_DIFF && \
|
||||
baro_trans.status != I2CTransPending) { \
|
||||
baro_board.status = LBS_READ_DIFF; \
|
||||
if (baro_trans.status == I2CTransSuccess) { \
|
||||
int16_t tmp = baro_trans.buf[0]<<8 | baro_trans.buf[1]; \
|
||||
baro.differential = tmp; \
|
||||
_b_diff_handler(); \
|
||||
} \
|
||||
} \
|
||||
baro_trans.status != I2CTransPending) { \
|
||||
baro_board.status = LBS_READ_DIFF; \
|
||||
if (baro_trans.status == I2CTransSuccess) { \
|
||||
int16_t tmp = baro_trans.buf[0]<<8 | baro_trans.buf[1]; \
|
||||
baro.differential = tmp; \
|
||||
_b_diff_handler(); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ void hmc5843_init(void)
|
||||
hmc5843.i2c_trans.slave_addr = HMC5843_ADDR;
|
||||
|
||||
#ifndef HMC5843_NO_IRQ
|
||||
hmc5843_arch_init();
|
||||
hmc5843_arch_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -31,21 +31,21 @@ static void send_config(void)
|
||||
hmc5843.i2c_trans.buf[1] = 0x00 | (0x06 << 2);
|
||||
hmc5843.i2c_trans.len_w = 2;
|
||||
i2c_submit(&HMC5843_I2C_DEVICE,&hmc5843.i2c_trans);
|
||||
while(hmc5843.i2c_trans.status == I2CTransPending);
|
||||
while(hmc5843.i2c_trans.status == I2CTransPending);
|
||||
|
||||
hmc5843.i2c_trans.type = I2CTransTx;
|
||||
hmc5843.i2c_trans.buf[0] = HMC5843_REG_CFGB; // set to gain to 1 Gauss
|
||||
hmc5843.i2c_trans.buf[1] = 0x01<<5;
|
||||
hmc5843.i2c_trans.len_w = 2;
|
||||
i2c_submit(&HMC5843_I2C_DEVICE,&hmc5843.i2c_trans);
|
||||
while(hmc5843.i2c_trans.status == I2CTransPending);
|
||||
while(hmc5843.i2c_trans.status == I2CTransPending);
|
||||
|
||||
hmc5843.i2c_trans.type = I2CTransTx;
|
||||
hmc5843.i2c_trans.buf[0] = HMC5843_REG_MODE; // set to continuous mode
|
||||
hmc5843.i2c_trans.buf[1] = 0x00;
|
||||
hmc5843.i2c_trans.len_w = 2;
|
||||
i2c_submit(&HMC5843_I2C_DEVICE,&hmc5843.i2c_trans);
|
||||
while(hmc5843.i2c_trans.status == I2CTransPending);
|
||||
while(hmc5843.i2c_trans.status == I2CTransPending);
|
||||
|
||||
}
|
||||
|
||||
@@ -123,8 +123,8 @@ void hmc5843_periodic(void)
|
||||
}
|
||||
|
||||
#ifdef HMC5843_NO_IRQ
|
||||
// < 50Hz
|
||||
fake_mag_eoc = 1;
|
||||
// < 50Hz
|
||||
fake_mag_eoc = 1;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -73,11 +73,11 @@ extern void hmc5843_idle_task(void);
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define MagEvent(_m_handler) { \
|
||||
hmc5843_idle_task(); \
|
||||
if (hmc5843.data_available) { \
|
||||
_m_handler(); \
|
||||
} \
|
||||
#define MagEvent(_m_handler) { \
|
||||
hmc5843_idle_task(); \
|
||||
if (hmc5843.data_available) { \
|
||||
_m_handler(); \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif /* HMC5843_H */
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
#include "peripherals/hmc5843.h"
|
||||
#define foo_handler() {}
|
||||
#define ImuMagEvent(_mag_handler) { \
|
||||
MagEvent(foo_handler); \
|
||||
MagEvent(foo_handler); \
|
||||
if (hmc5843.data_available) { \
|
||||
imu.mag_unscaled.x = hmc5843.data.value[IMU_MAG_X_CHAN]; \
|
||||
imu.mag_unscaled.y = hmc5843.data.value[IMU_MAG_Y_CHAN]; \
|
||||
|
||||
Reference in New Issue
Block a user