Removed unnecessary gyro interrupt status function pointer

This commit is contained in:
Martin Budden 2017-07-11 07:05:48 +01:00
parent c448f0dae5
commit 1448b5040a
14 changed files with 8 additions and 46 deletions

View File

@ -51,7 +51,6 @@ typedef struct gyroDev_s {
sensorGyroInitFuncPtr initFn; // initialize function
sensorGyroReadFuncPtr readFn; // read 3 axis data function
sensorGyroReadDataFuncPtr temperatureFn; // read temperature if available
sensorGyroInterruptStatusFuncPtr intStatusFn;
sensorGyroUpdateFuncPtr updateFn;
extiCallbackRec_t exti;
busDevice_t bus;

View File

@ -83,16 +83,9 @@ static bool fakeGyroReadTemperature(gyroDev_t *gyro, int16_t *temperatureData)
return true;
}
static bool fakeGyroInitStatus(gyroDev_t *gyro)
{
UNUSED(gyro);
return true;
}
bool fakeGyroDetect(gyroDev_t *gyro)
{
gyro->initFn = fakeGyroInit;
gyro->intStatusFn = fakeGyroInitStatus;
gyro->readFn = fakeGyroRead;
gyro->temperatureFn = fakeGyroReadTemperature;
#if defined(SIMULATOR_BUILD)

View File

@ -235,18 +235,6 @@ bool mpuGyroReadSPI(gyroDev_t *gyro)
return true;
}
bool mpuCheckDataReady(gyroDev_t* gyro)
{
bool ret;
if (gyro->dataReady) {
ret = true;
gyro->dataReady= false;
} else {
ret = false;
}
return ret;
}
#ifdef USE_SPI
static bool detectSPISensorsAndUpdateDetectionResult(gyroDev_t *gyro)
{

View File

@ -201,6 +201,4 @@ bool mpuAccRead(struct accDev_s *acc);
bool mpuGyroRead(struct gyroDev_s *gyro);
bool mpuGyroReadSPI(struct gyroDev_s *gyro);
void mpuDetect(struct gyroDev_s *gyro);
bool mpuCheckDataReady(struct gyroDev_s *gyro);
void mpuGyroSetIsrUpdate(struct gyroDev_s *gyro, sensorGyroUpdateFuncPtr updateFn);

View File

@ -84,7 +84,6 @@ bool mpu3050Detect(gyroDev_t *gyro)
gyro->initFn = mpu3050Init;
gyro->readFn = mpuGyroRead;
gyro->temperatureFn = mpu3050ReadTemperature;
gyro->intStatusFn = mpuCheckDataReady;
// 16.4 dps/lsb scalefactor
gyro->scale = 1.0f / 16.4f;

View File

@ -105,7 +105,6 @@ bool mpu6050GyroDetect(gyroDev_t *gyro)
}
gyro->initFn = mpu6050GyroInit;
gyro->readFn = mpuGyroRead;
gyro->intStatusFn = mpuCheckDataReady;
// 16.4 dps/lsb scalefactor
gyro->scale = 1.0f / 16.4f;

View File

@ -95,7 +95,6 @@ bool mpu6500GyroDetect(gyroDev_t *gyro)
gyro->initFn = mpu6500GyroInit;
gyro->readFn = mpuGyroRead;
gyro->intStatusFn = mpuCheckDataReady;
// 16.4 dps/lsb scalefactor
gyro->scale = 1.0f / 16.4f;

View File

@ -365,18 +365,6 @@ bool bmi160GyroRead(gyroDev_t *gyro)
}
bool checkBMI160DataReady(gyroDev_t* gyro)
{
bool ret;
if (gyro->dataReady) {
ret = true;
gyro->dataReady= false;
} else {
ret = false;
}
return ret;
}
void bmi160SpiGyroInit(gyroDev_t *gyro)
{
BMI160_Init(gyro->bus.spi.csnPin);
@ -412,7 +400,6 @@ bool bmi160SpiGyroDetect(gyroDev_t *gyro)
gyro->initFn = bmi160SpiGyroInit;
gyro->readFn = bmi160GyroRead;
gyro->intStatusFn = checkBMI160DataReady;
gyro->scale = 1.0f / 16.4f;
return true;

View File

@ -141,7 +141,6 @@ bool icm20689SpiGyroDetect(gyroDev_t *gyro)
gyro->initFn = icm20689GyroInit;
gyro->readFn = mpuGyroReadSPI;
gyro->intStatusFn = mpuCheckDataReady;
// 16.4 dps/lsb scalefactor
gyro->scale = 1.0f / 16.4f;

View File

@ -245,7 +245,6 @@ bool mpu6000SpiGyroDetect(gyroDev_t *gyro)
gyro->initFn = mpu6000SpiGyroInit;
gyro->readFn = mpuGyroReadSPI;
gyro->intStatusFn = mpuCheckDataReady;
// 16.4 dps/lsb scalefactor
gyro->scale = 1.0f / 16.4f;

View File

@ -137,7 +137,6 @@ bool mpu6500SpiGyroDetect(gyroDev_t *gyro)
gyro->initFn = mpu6500SpiGyroInit;
gyro->readFn = mpuGyroReadSPI;
gyro->intStatusFn = mpuCheckDataReady;
// 16.4 dps/lsb scalefactor
gyro->scale = 1.0f / 16.4f;

View File

@ -211,7 +211,6 @@ bool mpu9250SpiGyroDetect(gyroDev_t *gyro)
gyro->initFn = mpu9250SpiGyroInit;
gyro->readFn = mpuGyroReadSPI;
gyro->intStatusFn = mpuCheckDataReady;
// 16.4 dps/lsb scalefactor
gyro->scale = 1.0f / 16.4f;

View File

@ -17,9 +17,14 @@
bool gyroSyncCheckUpdate(gyroDev_t *gyro)
{
if (!gyro->intStatusFn)
return false;
return gyro->intStatusFn(gyro);
bool ret;
if (gyro->dataReady) {
ret = true;
gyro->dataReady= false;
} else {
ret = false;
}
return ret;
}
uint32_t gyroSetSampleRate(gyroDev_t *gyro, uint8_t lpf, uint8_t gyroSyncDenominator, bool gyro_use_32khz)

View File

@ -43,4 +43,3 @@ typedef void (*sensorGyroInitFuncPtr)(struct gyroDev_s *gyro);
typedef bool (*sensorGyroReadFuncPtr)(struct gyroDev_s *gyro);
typedef bool (*sensorGyroUpdateFuncPtr)(struct gyroDev_s *gyro);
typedef bool (*sensorGyroReadDataFuncPtr)(struct gyroDev_s *gyro, int16_t *data);
typedef bool (*sensorGyroInterruptStatusFuncPtr)(struct gyroDev_s *gyro);