Browse Source

added test BMA280 driver

git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@414 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
master
timecop@gmail.com 11 years ago
parent
commit
6763d8810b
  1. 1
      Makefile
  2. 15
      baseflight.uvproj
  3. 4
      src/board.h
  4. 4
      src/cli.c
  5. 7
      src/sensors.c

1
Makefile

@ -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 \

15
baseflight.uvproj

@ -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>

4
src/board.h

@ -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"

4
src/cli.c

@ -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 },

7
src/sensors.c

@ -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
}

Loading…
Cancel
Save