Removed unnecessary gyro interrupt status function pointer
This commit is contained in:
parent
c448f0dae5
commit
1448b5040a
|
@ -51,7 +51,6 @@ typedef struct gyroDev_s {
|
||||||
sensorGyroInitFuncPtr initFn; // initialize function
|
sensorGyroInitFuncPtr initFn; // initialize function
|
||||||
sensorGyroReadFuncPtr readFn; // read 3 axis data function
|
sensorGyroReadFuncPtr readFn; // read 3 axis data function
|
||||||
sensorGyroReadDataFuncPtr temperatureFn; // read temperature if available
|
sensorGyroReadDataFuncPtr temperatureFn; // read temperature if available
|
||||||
sensorGyroInterruptStatusFuncPtr intStatusFn;
|
|
||||||
sensorGyroUpdateFuncPtr updateFn;
|
sensorGyroUpdateFuncPtr updateFn;
|
||||||
extiCallbackRec_t exti;
|
extiCallbackRec_t exti;
|
||||||
busDevice_t bus;
|
busDevice_t bus;
|
||||||
|
|
|
@ -83,16 +83,9 @@ static bool fakeGyroReadTemperature(gyroDev_t *gyro, int16_t *temperatureData)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool fakeGyroInitStatus(gyroDev_t *gyro)
|
|
||||||
{
|
|
||||||
UNUSED(gyro);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool fakeGyroDetect(gyroDev_t *gyro)
|
bool fakeGyroDetect(gyroDev_t *gyro)
|
||||||
{
|
{
|
||||||
gyro->initFn = fakeGyroInit;
|
gyro->initFn = fakeGyroInit;
|
||||||
gyro->intStatusFn = fakeGyroInitStatus;
|
|
||||||
gyro->readFn = fakeGyroRead;
|
gyro->readFn = fakeGyroRead;
|
||||||
gyro->temperatureFn = fakeGyroReadTemperature;
|
gyro->temperatureFn = fakeGyroReadTemperature;
|
||||||
#if defined(SIMULATOR_BUILD)
|
#if defined(SIMULATOR_BUILD)
|
||||||
|
|
|
@ -235,18 +235,6 @@ bool mpuGyroReadSPI(gyroDev_t *gyro)
|
||||||
return true;
|
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
|
#ifdef USE_SPI
|
||||||
static bool detectSPISensorsAndUpdateDetectionResult(gyroDev_t *gyro)
|
static bool detectSPISensorsAndUpdateDetectionResult(gyroDev_t *gyro)
|
||||||
{
|
{
|
||||||
|
|
|
@ -201,6 +201,4 @@ bool mpuAccRead(struct accDev_s *acc);
|
||||||
bool mpuGyroRead(struct gyroDev_s *gyro);
|
bool mpuGyroRead(struct gyroDev_s *gyro);
|
||||||
bool mpuGyroReadSPI(struct gyroDev_s *gyro);
|
bool mpuGyroReadSPI(struct gyroDev_s *gyro);
|
||||||
void mpuDetect(struct gyroDev_s *gyro);
|
void mpuDetect(struct gyroDev_s *gyro);
|
||||||
bool mpuCheckDataReady(struct gyroDev_s *gyro);
|
|
||||||
void mpuGyroSetIsrUpdate(struct gyroDev_s *gyro, sensorGyroUpdateFuncPtr updateFn);
|
void mpuGyroSetIsrUpdate(struct gyroDev_s *gyro, sensorGyroUpdateFuncPtr updateFn);
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,6 @@ bool mpu3050Detect(gyroDev_t *gyro)
|
||||||
gyro->initFn = mpu3050Init;
|
gyro->initFn = mpu3050Init;
|
||||||
gyro->readFn = mpuGyroRead;
|
gyro->readFn = mpuGyroRead;
|
||||||
gyro->temperatureFn = mpu3050ReadTemperature;
|
gyro->temperatureFn = mpu3050ReadTemperature;
|
||||||
gyro->intStatusFn = mpuCheckDataReady;
|
|
||||||
|
|
||||||
// 16.4 dps/lsb scalefactor
|
// 16.4 dps/lsb scalefactor
|
||||||
gyro->scale = 1.0f / 16.4f;
|
gyro->scale = 1.0f / 16.4f;
|
||||||
|
|
|
@ -105,7 +105,6 @@ bool mpu6050GyroDetect(gyroDev_t *gyro)
|
||||||
}
|
}
|
||||||
gyro->initFn = mpu6050GyroInit;
|
gyro->initFn = mpu6050GyroInit;
|
||||||
gyro->readFn = mpuGyroRead;
|
gyro->readFn = mpuGyroRead;
|
||||||
gyro->intStatusFn = mpuCheckDataReady;
|
|
||||||
|
|
||||||
// 16.4 dps/lsb scalefactor
|
// 16.4 dps/lsb scalefactor
|
||||||
gyro->scale = 1.0f / 16.4f;
|
gyro->scale = 1.0f / 16.4f;
|
||||||
|
|
|
@ -95,7 +95,6 @@ bool mpu6500GyroDetect(gyroDev_t *gyro)
|
||||||
|
|
||||||
gyro->initFn = mpu6500GyroInit;
|
gyro->initFn = mpu6500GyroInit;
|
||||||
gyro->readFn = mpuGyroRead;
|
gyro->readFn = mpuGyroRead;
|
||||||
gyro->intStatusFn = mpuCheckDataReady;
|
|
||||||
|
|
||||||
// 16.4 dps/lsb scalefactor
|
// 16.4 dps/lsb scalefactor
|
||||||
gyro->scale = 1.0f / 16.4f;
|
gyro->scale = 1.0f / 16.4f;
|
||||||
|
|
|
@ -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)
|
void bmi160SpiGyroInit(gyroDev_t *gyro)
|
||||||
{
|
{
|
||||||
BMI160_Init(gyro->bus.spi.csnPin);
|
BMI160_Init(gyro->bus.spi.csnPin);
|
||||||
|
@ -412,7 +400,6 @@ bool bmi160SpiGyroDetect(gyroDev_t *gyro)
|
||||||
|
|
||||||
gyro->initFn = bmi160SpiGyroInit;
|
gyro->initFn = bmi160SpiGyroInit;
|
||||||
gyro->readFn = bmi160GyroRead;
|
gyro->readFn = bmi160GyroRead;
|
||||||
gyro->intStatusFn = checkBMI160DataReady;
|
|
||||||
gyro->scale = 1.0f / 16.4f;
|
gyro->scale = 1.0f / 16.4f;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -141,7 +141,6 @@ bool icm20689SpiGyroDetect(gyroDev_t *gyro)
|
||||||
|
|
||||||
gyro->initFn = icm20689GyroInit;
|
gyro->initFn = icm20689GyroInit;
|
||||||
gyro->readFn = mpuGyroReadSPI;
|
gyro->readFn = mpuGyroReadSPI;
|
||||||
gyro->intStatusFn = mpuCheckDataReady;
|
|
||||||
|
|
||||||
// 16.4 dps/lsb scalefactor
|
// 16.4 dps/lsb scalefactor
|
||||||
gyro->scale = 1.0f / 16.4f;
|
gyro->scale = 1.0f / 16.4f;
|
||||||
|
|
|
@ -245,7 +245,6 @@ bool mpu6000SpiGyroDetect(gyroDev_t *gyro)
|
||||||
|
|
||||||
gyro->initFn = mpu6000SpiGyroInit;
|
gyro->initFn = mpu6000SpiGyroInit;
|
||||||
gyro->readFn = mpuGyroReadSPI;
|
gyro->readFn = mpuGyroReadSPI;
|
||||||
gyro->intStatusFn = mpuCheckDataReady;
|
|
||||||
// 16.4 dps/lsb scalefactor
|
// 16.4 dps/lsb scalefactor
|
||||||
gyro->scale = 1.0f / 16.4f;
|
gyro->scale = 1.0f / 16.4f;
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,6 @@ bool mpu6500SpiGyroDetect(gyroDev_t *gyro)
|
||||||
|
|
||||||
gyro->initFn = mpu6500SpiGyroInit;
|
gyro->initFn = mpu6500SpiGyroInit;
|
||||||
gyro->readFn = mpuGyroReadSPI;
|
gyro->readFn = mpuGyroReadSPI;
|
||||||
gyro->intStatusFn = mpuCheckDataReady;
|
|
||||||
|
|
||||||
// 16.4 dps/lsb scalefactor
|
// 16.4 dps/lsb scalefactor
|
||||||
gyro->scale = 1.0f / 16.4f;
|
gyro->scale = 1.0f / 16.4f;
|
||||||
|
|
|
@ -211,7 +211,6 @@ bool mpu9250SpiGyroDetect(gyroDev_t *gyro)
|
||||||
|
|
||||||
gyro->initFn = mpu9250SpiGyroInit;
|
gyro->initFn = mpu9250SpiGyroInit;
|
||||||
gyro->readFn = mpuGyroReadSPI;
|
gyro->readFn = mpuGyroReadSPI;
|
||||||
gyro->intStatusFn = mpuCheckDataReady;
|
|
||||||
|
|
||||||
// 16.4 dps/lsb scalefactor
|
// 16.4 dps/lsb scalefactor
|
||||||
gyro->scale = 1.0f / 16.4f;
|
gyro->scale = 1.0f / 16.4f;
|
||||||
|
|
|
@ -17,9 +17,14 @@
|
||||||
|
|
||||||
bool gyroSyncCheckUpdate(gyroDev_t *gyro)
|
bool gyroSyncCheckUpdate(gyroDev_t *gyro)
|
||||||
{
|
{
|
||||||
if (!gyro->intStatusFn)
|
bool ret;
|
||||||
return false;
|
if (gyro->dataReady) {
|
||||||
return gyro->intStatusFn(gyro);
|
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)
|
uint32_t gyroSetSampleRate(gyroDev_t *gyro, uint8_t lpf, uint8_t gyroSyncDenominator, bool gyro_use_32khz)
|
||||||
|
|
|
@ -43,4 +43,3 @@ typedef void (*sensorGyroInitFuncPtr)(struct gyroDev_s *gyro);
|
||||||
typedef bool (*sensorGyroReadFuncPtr)(struct gyroDev_s *gyro);
|
typedef bool (*sensorGyroReadFuncPtr)(struct gyroDev_s *gyro);
|
||||||
typedef bool (*sensorGyroUpdateFuncPtr)(struct gyroDev_s *gyro);
|
typedef bool (*sensorGyroUpdateFuncPtr)(struct gyroDev_s *gyro);
|
||||||
typedef bool (*sensorGyroReadDataFuncPtr)(struct gyroDev_s *gyro, int16_t *data);
|
typedef bool (*sensorGyroReadDataFuncPtr)(struct gyroDev_s *gyro, int16_t *data);
|
||||||
typedef bool (*sensorGyroInterruptStatusFuncPtr)(struct gyroDev_s *gyro);
|
|
||||||
|
|
Loading…
Reference in New Issue