mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 20:35:33 +03:00
Use Naze hardware revision when initialising adxl345 - this now allows
the driver to be used by any target with an hse_value of 12Mhz.
This commit is contained in:
parent
a4879cc2e3
commit
6162f609ea
2 changed files with 11 additions and 7 deletions
|
@ -65,10 +65,6 @@ bool adxl345Detect(drv_adxl345_config_t *init, acc_t *acc)
|
|||
bool ack = false;
|
||||
uint8_t sig = 0;
|
||||
|
||||
// Not supported with this frequency
|
||||
if (hse_value == 12000000)
|
||||
return false;
|
||||
|
||||
ack = i2cRead(ADXL345_ADDRESS, 0x00, 1, &sig);
|
||||
if (!ack || sig != 0xE5)
|
||||
return false;
|
||||
|
|
|
@ -56,6 +56,10 @@
|
|||
#include "sensors/compass.h"
|
||||
#include "sensors/sonar.h"
|
||||
|
||||
#ifdef NAZE
|
||||
#include "hardware_revision.h"
|
||||
#endif
|
||||
|
||||
extern float magneticDeclination;
|
||||
|
||||
extern gyro_t gyro;
|
||||
|
@ -191,12 +195,16 @@ retry:
|
|||
case ACC_ADXL345: // ADXL345
|
||||
acc_params.useFifo = false;
|
||||
acc_params.dataRate = 800; // unused currently
|
||||
#ifdef NAZE
|
||||
if (hardwareRevision < NAZE32_REV5 && adxl345Detect(&acc_params, &acc)) {
|
||||
accHardware = ACC_ADXL345;
|
||||
accAlign = CW270_DEG;
|
||||
}
|
||||
#else
|
||||
if (adxl345Detect(&acc_params, &acc)) {
|
||||
accHardware = ACC_ADXL345;
|
||||
#ifdef NAZE
|
||||
accAlign = CW270_DEG;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (accHardwareToUse == ACC_ADXL345)
|
||||
break;
|
||||
; // fallthrough
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue