1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

Using some config switches to get this board up and running

This commit is contained in:
James Cotton 2012-03-14 02:45:42 -05:00
parent 6b88a278b3
commit a77a859e5c
3 changed files with 19 additions and 14 deletions

View File

@ -172,7 +172,9 @@ static void SensorsTask(void *parameters)
#if defined(PIOS_INCLUDE_BMA180)
accel_test = PIOS_BMA180_Test();
#endif
#if defined(PIOS_INCLUDE_HMC5883)
mag_test = PIOS_HMC5883_Test();
#endif
if(accel_test < 0 || gyro_test < 0 || mag_test < 0) {
AlarmsSet(SYSTEMALARMS_ALARM_SENSORS, SYSTEMALARMS_ALARM_CRITICAL);
@ -345,9 +347,10 @@ static void SensorsTask(void *parameters)
// Because most crafts wont get enough information from gravity to zero yaw gyro, we try
// and make it average zero (weakly)
MagnetometerData mag;
bool mag_updated = false;
bool mag_updated = false;
MagnetometerData mag;
#if defined(PIOS_INCLUDE_HMC5883)
if (PIOS_HMC5883_NewDataAvailable() || PIOS_DELAY_DiffuS(mag_update_time) > 150000) {
mag_updated = true;
int16_t values[3];
@ -358,6 +361,7 @@ static void SensorsTask(void *parameters)
MagnetometerSet(&mag);
mag_update_time = PIOS_DELAY_GetRaw();
}
#endif
// For debugging purposes here we can output all of the sensors. Do it as a single transaction
// so the message isn't split if anything else is writing to it

View File

@ -57,12 +57,12 @@
#define PIOS_INCLUDE_WDG
/* Select the sensors to include */
#define PIOS_INCLUDE_BMA180
#define PIOS_INCLUDE_HMC5883
//#define PIOS_INCLUDE_MPU6000
//#define PIOS_MPU6000_ACCEL
#define PIOS_INCLUDE_L3GD20
#define PIOS_INCLUDE_MS5611
//#define PIOS_INCLUDE_BMA180
//#define PIOS_INCLUDE_HMC5883
#define PIOS_INCLUDE_MPU6000
#define PIOS_MPU6000_ACCEL
//#define PIOS_INCLUDE_L3GD20
//#define PIOS_INCLUDE_MS5611
//#define PIOS_INCLUDE_HCSR04
#define PIOS_FLASH_ON_ACCEL /* true for second revo */
#define FLASH_FREERTOS

View File

@ -789,14 +789,10 @@ void PIOS_Board_Init(void) {
PIOS_DELAY_WaitmS(500);
#if defined(PIOS_INCLUDE_BMA180)
PIOS_BMA180_Init(pios_spi_accel_id, 0, &pios_bma180_cfg);
PIOS_Assert(PIOS_BMA180_Test() == 0);
#endif
#if defined(PIOS_INCLUDE_MPU6000)
PIOS_MPU6000_Attach(pios_spi_gyro_id);
PIOS_MPU6000_Init(&pios_mpu6000_cfg);
// PIOS_Assert(PIOS_MPU6000_Test() == 0);
// PIOS_Assert(PIOS_MPU6000_Test() == 0);
#elif defined(PIOS_INCLUDE_L3GD20)
PIOS_L3GD20_Init(pios_spi_gyro_id, 0, &pios_l3gd20_cfg);
PIOS_Assert(PIOS_L3GD20_Test() == 0);
@ -804,6 +800,11 @@ void PIOS_Board_Init(void) {
PIOS_Assert(0);
#endif
#if defined(PIOS_INCLUDE_BMA180)
PIOS_BMA180_Init(pios_spi_accel_id, 0, &pios_bma180_cfg);
PIOS_Assert(PIOS_BMA180_Test() == 0);
#endif
#if defined(PIOS_INCLUDE_HMC5883)
PIOS_HMC5883_Init(&pios_hmc5883_cfg);