1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 22:35:23 +03:00

Configurable acc/gyro

This commit is contained in:
jflyper 2018-05-10 22:25:37 +09:00
parent 5ef68ef6a3
commit fc6c24c38e
133 changed files with 1095 additions and 1116 deletions

View file

@ -70,6 +70,7 @@
#include "pg/beeper_dev.h"
#include "pg/dashboard.h"
#include "pg/flash.h"
#include "pg/gyrodev.h"
#include "pg/max7456.h"
#include "pg/pg.h"
#include "pg/pg_ids.h"
@ -158,7 +159,7 @@ static const char * const lookupTableAlignment[] = {
"CW270FLIP"
};
#ifdef USE_DUAL_GYRO
#ifdef USE_MULTI_GYRO
static const char * const lookupTableGyro[] = {
"FIRST", "SECOND", "BOTH"
};
@ -289,7 +290,10 @@ static const char * const lookupTableFailsafeSwitchMode[] = {
};
static const char * const lookupTableBusType[] = {
"NONE", "I2C", "SPI", "SLAVE"
"NONE", "I2C", "SPI", "SLAVE",
#if defined(USE_SPI_GYRO) && defined(USE_I2C_GYRO)
"GYROAUTO"
#endif
};
#ifdef USE_MAX7456
@ -458,7 +462,7 @@ const lookupTableEntry_t lookupTables[] = {
#ifdef USE_LED_STRIP
LOOKUP_TABLE_ENTRY(lookupLedStripFormatRGB),
#endif
#ifdef USE_DUAL_GYRO
#ifdef USE_MULTI_GYRO
LOOKUP_TABLE_ENTRY(lookupTableGyro),
#endif
LOOKUP_TABLE_ENTRY(lookupTableThrottleLimitType),
@ -485,6 +489,7 @@ const lookupTableEntry_t lookupTables[] = {
#ifdef USE_VTX_COMMON
LOOKUP_TABLE_ENTRY(lookupTableVtxLowPowerDisarm),
#endif
LOOKUP_TABLE_ENTRY(lookupTableGyroHardware),
};
#undef LOOKUP_TABLE_ENTRY
@ -526,7 +531,8 @@ const clivalue_t valueTable[] = {
#if defined(GYRO_USES_SPI) && defined(USE_32K_CAPABLE_GYRO)
{ "gyro_use_32khz", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_GYRO_CONFIG, offsetof(gyroConfig_t, gyro_use_32khz) },
#endif
#ifdef USE_DUAL_GYRO
#endif
#ifdef USE_MULTI_GYRO
{ "gyro_to_use", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_GYRO }, PG_GYRO_CONFIG, offsetof(gyroConfig_t, gyro_to_use) },
#endif
#if defined(USE_GYRO_DATA_ANALYSE)
@ -1153,6 +1159,20 @@ const clivalue_t valueTable[] = {
{ "rcdevice_init_dev_attempts", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 10 }, PG_RCDEVICE_CONFIG, offsetof(rcdeviceConfig_t, initDeviceAttempts) },
{ "rcdevice_init_dev_attempt_interval", VAR_UINT32 | MASTER_VALUE, .config.minmax = { 500, 5000 }, PG_RCDEVICE_CONFIG, offsetof(rcdeviceConfig_t, initDeviceAttemptInterval) }
#endif
#define PG_ARRAY_OFFSET(type, index, member) (index * sizeof(type) + offsetof(type, member))
// PG_GYRO_DEVICE_CONFIG
{ "gyro_1_bustype", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_BUS_TYPE }, PG_GYRO_DEVICE_CONFIG, PG_ARRAY_OFFSET(gyroDeviceConfig_t, 0, bustype) },
{ "gyro_1_spibus", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, SPIDEV_COUNT }, PG_GYRO_DEVICE_CONFIG, PG_ARRAY_OFFSET(gyroDeviceConfig_t, 0, spiBus) },
{ "gyro_1_i2cBus", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, I2CDEV_COUNT }, PG_GYRO_DEVICE_CONFIG, PG_ARRAY_OFFSET(gyroDeviceConfig_t, 0, i2cBus) },
{ "gyro_1_i2c_address", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, I2C_ADDR7_MAX }, PG_GYRO_DEVICE_CONFIG, PG_ARRAY_OFFSET(gyroDeviceConfig_t, 0, i2cAddress) },
#ifdef USE_MULTI_GYRO
{ "gyro_2_bustype", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_BUS_TYPE }, PG_GYRO_DEVICE_CONFIG, PG_ARRAY_OFFSET(gyroDeviceConfig_t, 1, bustype) },
{ "gyro_2_spibus", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, SPIDEV_COUNT }, PG_GYRO_DEVICE_CONFIG, PG_ARRAY_OFFSET(gyroDeviceConfig_t, 1, spiBus) },
{ "gyro_2_i2cBus", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, I2CDEV_COUNT }, PG_GYRO_DEVICE_CONFIG, PG_ARRAY_OFFSET(gyroDeviceConfig_t, 1, i2cBus) },
{ "gyro_2_i2c_address", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, I2C_ADDR7_MAX }, PG_GYRO_DEVICE_CONFIG, PG_ARRAY_OFFSET(gyroDeviceConfig_t, 1, i2cAddress) },
#endif
};
const uint16_t valueTableEntryCount = ARRAYLEN(valueTable);