mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 20:35:33 +03:00
added test BMA280 driver
git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@414 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
parent
c8f0fc78b3
commit
6763d8810b
5 changed files with 28 additions and 3 deletions
1
Makefile
1
Makefile
|
@ -68,6 +68,7 @@ COMMON_SRC = startup_stm32f10x_md_gcc.S \
|
||||||
NAZE_SRC = drv_spi.c \
|
NAZE_SRC = drv_spi.c \
|
||||||
drv_adc.c \
|
drv_adc.c \
|
||||||
drv_adxl345.c \
|
drv_adxl345.c \
|
||||||
|
drv_bma280.c \
|
||||||
drv_bmp085.c \
|
drv_bmp085.c \
|
||||||
drv_ms5611.c \
|
drv_ms5611.c \
|
||||||
drv_hcsr04.c \
|
drv_hcsr04.c \
|
||||||
|
|
|
@ -662,6 +662,11 @@
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>.\src\drv_softserial.c</FilePath>
|
<FilePath>.\src\drv_softserial.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>drv_bma280.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>.\src\drv_bma280.c</FilePath>
|
||||||
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
<Group>
|
<Group>
|
||||||
|
@ -1498,6 +1503,11 @@
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>.\src\drv_softserial.c</FilePath>
|
<FilePath>.\src\drv_softserial.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>drv_bma280.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>.\src\drv_bma280.c</FilePath>
|
||||||
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
<Group>
|
<Group>
|
||||||
|
@ -2518,6 +2528,11 @@
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>.\src\drv_softserial.c</FilePath>
|
<FilePath>.\src\drv_softserial.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>drv_bma280.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>.\src\drv_bma280.c</FilePath>
|
||||||
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
<Group>
|
<Group>
|
||||||
|
|
|
@ -53,7 +53,8 @@ typedef enum AccelSensors {
|
||||||
ACC_ADXL345 = 1,
|
ACC_ADXL345 = 1,
|
||||||
ACC_MPU6050 = 2,
|
ACC_MPU6050 = 2,
|
||||||
ACC_MMA8452 = 3,
|
ACC_MMA8452 = 3,
|
||||||
ACC_NONE = 4
|
ACC_BMA280 = 4,
|
||||||
|
ACC_NONE = 5
|
||||||
} AccelSensors;
|
} AccelSensors;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -243,6 +244,7 @@ typedef struct baro_t
|
||||||
// AfroFlight32
|
// AfroFlight32
|
||||||
#include "drv_adc.h"
|
#include "drv_adc.h"
|
||||||
#include "drv_adxl345.h"
|
#include "drv_adxl345.h"
|
||||||
|
#include "drv_bma280.h"
|
||||||
#include "drv_bmp085.h"
|
#include "drv_bmp085.h"
|
||||||
#include "drv_ms5611.h"
|
#include "drv_ms5611.h"
|
||||||
#include "drv_hmc5883l.h"
|
#include "drv_hmc5883l.h"
|
||||||
|
|
|
@ -54,7 +54,7 @@ static const char * const sensorNames[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char * const accNames[] = {
|
static const char * const accNames[] = {
|
||||||
"", "ADXL345", "MPU6050", "MMA845x", NULL
|
"", "ADXL345", "MPU6050", "MMA845x", "BMA280", "None", NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -125,7 +125,7 @@ const clivalue_t valueTable[] = {
|
||||||
{ "align_acc", VAR_UINT8, &mcfg.acc_align, 0, 8 },
|
{ "align_acc", VAR_UINT8, &mcfg.acc_align, 0, 8 },
|
||||||
{ "align_mag", VAR_UINT8, &mcfg.mag_align, 0, 8 },
|
{ "align_mag", VAR_UINT8, &mcfg.mag_align, 0, 8 },
|
||||||
{ "yaw_control_direction", VAR_INT8, &mcfg.yaw_control_direction, -1, 1 },
|
{ "yaw_control_direction", VAR_INT8, &mcfg.yaw_control_direction, -1, 1 },
|
||||||
{ "acc_hardware", VAR_UINT8, &mcfg.acc_hardware, 0, 4 },
|
{ "acc_hardware", VAR_UINT8, &mcfg.acc_hardware, 0, 5 },
|
||||||
{ "moron_threshold", VAR_UINT8, &mcfg.moron_threshold, 0, 128 },
|
{ "moron_threshold", VAR_UINT8, &mcfg.moron_threshold, 0, 128 },
|
||||||
{ "gyro_lpf", VAR_UINT16, &mcfg.gyro_lpf, 0, 256 },
|
{ "gyro_lpf", VAR_UINT16, &mcfg.gyro_lpf, 0, 256 },
|
||||||
{ "gyro_cmpf_factor", VAR_UINT16, &mcfg.gyro_cmpf_factor, 100, 1000 },
|
{ "gyro_cmpf_factor", VAR_UINT16, &mcfg.gyro_cmpf_factor, 100, 1000 },
|
||||||
|
|
|
@ -77,6 +77,13 @@ retry:
|
||||||
if (mcfg.acc_hardware == ACC_MMA8452)
|
if (mcfg.acc_hardware == ACC_MMA8452)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
; // fallthrough
|
||||||
|
case ACC_BMA280: // BMA280
|
||||||
|
if (bma280Detect(&acc)) {
|
||||||
|
accHardware = ACC_BMA280;
|
||||||
|
if (mcfg.acc_hardware == ACC_BMA280)
|
||||||
|
break;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue