mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-18 22:05:17 +03:00
Moved gyro and acc detection code into init functions
This commit is contained in:
parent
d9a2f7f5d9
commit
17494840a5
5 changed files with 26 additions and 36 deletions
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "platform.h"
|
||||
|
@ -226,8 +227,12 @@ retry:
|
|||
return true;
|
||||
}
|
||||
|
||||
void accInit(uint32_t gyroSamplingInverval)
|
||||
bool accInit(const accelerometerConfig_t *accelerometerConfig, uint32_t gyroSamplingInverval)
|
||||
{
|
||||
memset(&acc, 0, sizeof(acc));
|
||||
if (!accDetect(&acc.dev, accelerometerConfig->acc_hardware)) {
|
||||
return false;
|
||||
}
|
||||
acc.dev.acc_1G = 256; // set default
|
||||
acc.dev.init(&acc.dev); // driver initialisation
|
||||
// set the acc sampling interval according to the gyro sampling interval
|
||||
|
@ -251,6 +256,7 @@ void accInit(uint32_t gyroSamplingInverval)
|
|||
biquadFilterInitLPF(&accFilter[axis], accLpfCutHz, acc.accSamplingInterval);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void accSetCalibrationCycles(uint16_t calibrationCyclesRequired)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue