mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
Checking ID on ST gyro works
This commit is contained in:
parent
0fbcf7723d
commit
cc47520baa
@ -244,7 +244,7 @@ static void SensorsTask(void *parameters)
|
||||
#endif
|
||||
|
||||
// Using L3DG20 gyro
|
||||
#elif defined(PIOS_INCLUDE_L3GD20)
|
||||
#elif 0 && defined(PIOS_INCLUDE_L3GD20)
|
||||
struct pios_l3gd20_data gyro;
|
||||
count = 0;
|
||||
while((read_good = PIOS_L3GD20_ReadFifo(&gyro)) != 0);
|
||||
@ -288,7 +288,7 @@ static void SensorsTask(void *parameters)
|
||||
gyrosData.y = gyros[1] * gyro_scaling;
|
||||
gyrosData.z = gyros[2] * gyro_scaling;
|
||||
gyrosData.temperature = 35.0f + ((float) gyro.temperature + 512.0f) / 340.0f;
|
||||
|
||||
gyrosData.temperature = PIOS_L3GD20_ReadID();
|
||||
if (bias_correct_gyro) {
|
||||
// Apply bias correction to the gyros
|
||||
GyrosBiasData gyrosBias;
|
||||
|
@ -247,15 +247,15 @@ float PIOS_L3GD20_GetScale()
|
||||
*/
|
||||
uint8_t PIOS_L3GD20_Test(void)
|
||||
{
|
||||
/* Verify that ID matches (MPU6050 ID is 0x69) */
|
||||
int32_t L3GD20_id = PIOS_L3GD20_ReadID();
|
||||
if(L3GD20_id < 0)
|
||||
int32_t l3gd20_id = PIOS_L3GD20_ReadID();
|
||||
if(l3gd20_id < 0)
|
||||
return -1;
|
||||
|
||||
if(L3GD20_id != 0x68);
|
||||
return -2;
|
||||
|
||||
return 0;
|
||||
|
||||
uint8_t id = l3gd20_id;
|
||||
if(id == 0xD4)
|
||||
return 0;
|
||||
|
||||
return -2;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,7 +62,7 @@
|
||||
#define PIOS_L3GD20_FIFO_CNT_MSB 0x72
|
||||
#define PIOS_L3GD20_FIFO_CNT_LSB 0x73
|
||||
#define PIOS_L3GD20_FIFO_REG 0x74
|
||||
#define PIOS_L3GD20_WHOAMI 0x75
|
||||
#define PIOS_L3GD20_WHOAMI 0x0F
|
||||
|
||||
/* FIFO enable for storing different values */
|
||||
#define PIOS_L3GD20_FIFO_TEMP_OUT 0x80
|
||||
|
@ -59,7 +59,7 @@
|
||||
#define PIOS_INCLUDE_HMC5883
|
||||
//#define PIOS_INCLUDE_MPU6000
|
||||
//#define PIOS_MPU6000_ACCEL
|
||||
//#define PIOS_INCLUDE_L3GD20
|
||||
#define PIOS_INCLUDE_L3GD20
|
||||
#define PIOS_INCLUDE_MS5611
|
||||
//#define PIOS_INCLUDE_HCSR04
|
||||
|
||||
|
@ -1671,17 +1671,18 @@ void PIOS_Board_Init(void) {
|
||||
|
||||
PIOS_DELAY_WaitmS(500);
|
||||
|
||||
/*
|
||||
|
||||
#if defined(PIOS_INCLUDE_MPU6000)
|
||||
PIOS_MPU6000_Attach(pios_spi_gyro_id);
|
||||
PIOS_MPU6000_Init(&pios_mpu6000_cfg);
|
||||
#elif defined(PIOS_INCLUDE_L3GD20)
|
||||
PIOS_L3GD20_Attach(pios_spi_gyro_id);
|
||||
PIOS_Assert(PIOS_L3GD20_Test() == 0);
|
||||
// PIOS_L3GD20_Init(&pios_l3gd20_cfg);
|
||||
#else
|
||||
PIOS_Assert(0);
|
||||
#endif
|
||||
*/
|
||||
|
||||
PIOS_BMA180_Attach(pios_spi_accel_id);
|
||||
PIOS_BMA180_Init(&pios_bma180_cfg);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user