1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 19:40:31 +03:00

Remove GYRO defines from common_post_defaults (#12406)

This commit is contained in:
J Blackman 2023-02-27 20:59:47 +11:00 committed by GitHub
parent eacbf0d548
commit fbca7f06f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 45 deletions

View file

@ -34,6 +34,22 @@
#include "drivers/sensor.h" #include "drivers/sensor.h"
#include "sensors/gyro.h" #include "sensors/gyro.h"
#ifndef GYRO_1_SPI_INSTANCE
#define GYRO_1_SPI_INSTANCE NULL
#endif
#ifndef GYRO_1_CS_PIN
#define GYRO_1_CS_PIN NONE
#endif
#ifndef GYRO_1_EXTI_PIN
#define GYRO_1_EXTI_PIN NONE
#endif
#ifndef GYRO_2_SPI_INSTANCE
#define GYRO_2_SPI_INSTANCE NULL
#endif
#ifndef GYRO_2_CS_PIN #ifndef GYRO_2_CS_PIN
#define GYRO_2_CS_PIN NONE #define GYRO_2_CS_PIN NONE
#endif #endif
@ -42,6 +58,23 @@
#define GYRO_2_EXTI_PIN NONE #define GYRO_2_EXTI_PIN NONE
#endif #endif
#ifdef MPU_ADDRESS
#define GYRO_I2C_ADDRESS MPU_ADDRESS
#else
// 0 == AUTO
#define GYRO_I2C_ADDRESS 0
#endif
// gyro alignments
#ifndef GYRO_1_ALIGN
#define GYRO_1_ALIGN CW0_DEG
#endif
#ifndef GYRO_2_ALIGN
#define GYRO_2_ALIGN CW0_DEG
#endif
ioTag_t selectMPUIntExtiConfigByHardwareRevision(void); // XXX Should be gone ioTag_t selectMPUIntExtiConfigByHardwareRevision(void); // XXX Should be gone
#if defined(USE_SPI_GYRO) || defined(USE_I2C_GYRO) #if defined(USE_SPI_GYRO) || defined(USE_I2C_GYRO)

View file

@ -27,6 +27,14 @@
#include "common/sensor_alignment.h" #include "common/sensor_alignment.h"
#include "drivers/io_types.h" #include "drivers/io_types.h"
#ifdef USE_MULTI_GYRO
#define MAX_GYRODEV_COUNT 2
#define MAX_ACCDEV_COUNT 2
#else
#define MAX_GYRODEV_COUNT 1
#define MAX_ACCDEV_COUNT 1
#endif
typedef struct gyroDeviceConfig_s { typedef struct gyroDeviceConfig_s {
int8_t index; int8_t index;
uint8_t busType; uint8_t busType;

View file

@ -121,51 +121,6 @@
#endif #endif
// gyro hardware
#if !defined(GYRO_1_SPI_INSTANCE) && !defined(SIMULATOR_BUILD)
#define GYRO_1_SPI_INSTANCE NULL
#endif
#if !defined(GYRO_1_CS_PIN)
#define GYRO_1_CS_PIN NONE
#endif
#if !defined(GYRO_1_EXTI_PIN)
#define GYRO_1_EXTI_PIN NONE
#endif
// F4 and F7 single gyro boards
#if defined(USE_MULTI_GYRO) && !defined(GYRO_2_SPI_INSTANCE)
#define GYRO_2_SPI_INSTANCE NULL
#define GYRO_2_CS_PIN NONE
#define GYRO_2_EXTI_PIN NONE
#endif
#if defined(MPU_ADDRESS)
#define GYRO_I2C_ADDRESS MPU_ADDRESS
#else
#define GYRO_I2C_ADDRESS 0 // AUTO
#endif
#ifdef USE_MULTI_GYRO
#define MAX_GYRODEV_COUNT 2
#define MAX_ACCDEV_COUNT 2
#else
#define MAX_GYRODEV_COUNT 1
#define MAX_ACCDEV_COUNT 1
#endif
// gyro alignments
#if !defined(GYRO_1_ALIGN)
#define GYRO_1_ALIGN CW0_DEG
#endif
#if !defined(GYRO_2_ALIGN)
#define GYRO_2_ALIGN CW0_DEG
#endif
// Previously there was logic here to default GYRO_1_CUSTOM_ALIGN and GYRO_2_CUSTOM_ALIGN // Previously there was logic here to default GYRO_1_CUSTOM_ALIGN and GYRO_2_CUSTOM_ALIGN
// to CUSTOM_ALIGN_CW0_DEG if they weren't defined in the target. The defaulting logic // to CUSTOM_ALIGN_CW0_DEG if they weren't defined in the target. The defaulting logic
// has been moved to pg/gyrodev.c to set the custom alignment based on the sensor alignment // has been moved to pg/gyrodev.c to set the custom alignment based on the sensor alignment