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:
timecop@gmail.com 2013-09-29 12:53:02 +00:00
parent c8f0fc78b3
commit 6763d8810b
5 changed files with 28 additions and 3 deletions

View File

@ -68,6 +68,7 @@ COMMON_SRC = startup_stm32f10x_md_gcc.S \
NAZE_SRC = drv_spi.c \
drv_adc.c \
drv_adxl345.c \
drv_bma280.c \
drv_bmp085.c \
drv_ms5611.c \
drv_hcsr04.c \

View File

@ -662,6 +662,11 @@
<FileType>1</FileType>
<FilePath>.\src\drv_softserial.c</FilePath>
</File>
<File>
<FileName>drv_bma280.c</FileName>
<FileType>1</FileType>
<FilePath>.\src\drv_bma280.c</FilePath>
</File>
</Files>
</Group>
<Group>
@ -1498,6 +1503,11 @@
<FileType>1</FileType>
<FilePath>.\src\drv_softserial.c</FilePath>
</File>
<File>
<FileName>drv_bma280.c</FileName>
<FileType>1</FileType>
<FilePath>.\src\drv_bma280.c</FilePath>
</File>
</Files>
</Group>
<Group>
@ -2518,6 +2528,11 @@
<FileType>1</FileType>
<FilePath>.\src\drv_softserial.c</FilePath>
</File>
<File>
<FileName>drv_bma280.c</FileName>
<FileType>1</FileType>
<FilePath>.\src\drv_bma280.c</FilePath>
</File>
</Files>
</Group>
<Group>

View File

@ -53,7 +53,8 @@ typedef enum AccelSensors {
ACC_ADXL345 = 1,
ACC_MPU6050 = 2,
ACC_MMA8452 = 3,
ACC_NONE = 4
ACC_BMA280 = 4,
ACC_NONE = 5
} AccelSensors;
typedef enum {
@ -243,6 +244,7 @@ typedef struct baro_t
// AfroFlight32
#include "drv_adc.h"
#include "drv_adxl345.h"
#include "drv_bma280.h"
#include "drv_bmp085.h"
#include "drv_ms5611.h"
#include "drv_hmc5883l.h"

View File

@ -54,7 +54,7 @@ static const char * const sensorNames[] = {
};
static const char * const accNames[] = {
"", "ADXL345", "MPU6050", "MMA845x", NULL
"", "ADXL345", "MPU6050", "MMA845x", "BMA280", "None", NULL
};
typedef struct {
@ -125,7 +125,7 @@ const clivalue_t valueTable[] = {
{ "align_acc", VAR_UINT8, &mcfg.acc_align, 0, 8 },
{ "align_mag", VAR_UINT8, &mcfg.mag_align, 0, 8 },
{ "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 },
{ "gyro_lpf", VAR_UINT16, &mcfg.gyro_lpf, 0, 256 },
{ "gyro_cmpf_factor", VAR_UINT16, &mcfg.gyro_cmpf_factor, 100, 1000 },

View File

@ -77,6 +77,13 @@ retry:
if (mcfg.acc_hardware == ACC_MMA8452)
break;
}
; // fallthrough
case ACC_BMA280: // BMA280
if (bma280Detect(&acc)) {
accHardware = ACC_BMA280;
if (mcfg.acc_hardware == ACC_BMA280)
break;
}
#endif
}