1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 21:05:35 +03:00

Move #ifdef'd code from platform.h into target.h for each target.

This commit is contained in:
Dominic Clifton 2014-06-02 18:36:31 +01:00
parent 7f027e7e24
commit c7cd7adee9
6 changed files with 100 additions and 109 deletions

View file

@ -14,47 +14,6 @@
#endif #endif
#ifdef NAZE32PRO
#define LED0_GPIO GPIOB
#define LED0_PIN Pin_12
#define BEEP_GPIO GPIOB
#define BEEP_PIN Pin_10
#define BUZZER
#define LED0
#define GYRO
#define ACC
#define MAG
#define SENSORS_SET (SENSOR_ACC)
#endif
#ifdef STM32F3DISCOVERY
#define LED0_GPIO GPIOE
#define LED0_PIN Pin_8|Pin_12 // Blue LEDs - PE8/PE12
#define LED0_INVERTED
#define LED1_GPIO GPIOE
#define LED1_PIN Pin_10|Pin_14 // Orange LEDs - PE10/PE14
#define LED1_INVERTED
#define BEEP_GPIO GPIOE
#define BEEP_PIN Pin_9|Pin_13 // Red LEDs - PE9/PE13
#define BUZZER_INVERTED
#define BARO_GPIO GPIOC
#define BARO_PIN Pin_13
#define GYRO
#define ACC
#define BUZZER
#define LED0
#define LED1
#define SENSORS_SET (SENSOR_ACC)
#endif // STM32F3DISCOVERY
#ifdef STM32F10X_MD #ifdef STM32F10X_MD
#include "stm32f10x_conf.h" #include "stm32f10x_conf.h"
@ -65,72 +24,7 @@
#define U_ID_1 (*(uint32_t*)0x1FFFF7EC) #define U_ID_1 (*(uint32_t*)0x1FFFF7EC)
#define U_ID_2 (*(uint32_t*)0x1FFFF7F0) #define U_ID_2 (*(uint32_t*)0x1FFFF7F0)
// Hardware definitions and GPIO
#ifdef FY90Q
// FY90Q
#define LED0_GPIO GPIOC
#define LED0_PIN Pin_12
#define LED1_GPIO GPIOA
#define LED1_PIN Pin_15
#define GYRO
#define ACC
#define LED0
#define LED1
#define SENSORS_SET (SENSOR_ACC)
#else
#ifdef OLIMEXINO
// OLIMEXINO
//#define OLIMEXINO_UNCUT_LED1_E_JUMPER
//#define OLIMEXINO_UNCUT_LED2_E_JUMPER
#ifdef OLIMEXINO_UNCUT_LED1_E_JUMPER
#define LED0_GPIO GPIOA
#define LED0_PIN Pin_5 // D13, PA5/SPI1_SCK/ADC5 - "LED1" on silkscreen, Green
#define LED0
#endif
#ifdef OLIMEXINO_UNCUT_LED2_E_JUMPER
// "LED2" is using one of the PWM pins (CH2/PWM2), so we must not use PWM2 unless the jumper is cut. @See pwmInit()
#define LED1_GPIO GPIOA
#define LED1_PIN Pin_1 // D3, PA1/USART2_RTS/ADC1/TIM2_CH3 - "LED2" on silkscreen, Yellow
#define LED1
#endif
#define GYRO
#define ACC
#define SENSORS_SET (SENSOR_ACC)
#else
// Afroflight32
#define LED0_GPIO GPIOB
#define LED0_PIN Pin_3 // PB3 (LED)
#define LED1_GPIO GPIOB
#define LED1_PIN Pin_4 // PB4 (LED)
#define BEEP_GPIO GPIOA
#define BEEP_PIN Pin_12 // PA12 (Buzzer)
#define BARO_GPIO GPIOC
#define BARO_PIN Pin_13
#define GYRO
#define ACC
#define MAG
#define BARO
#define LEDRING
#define SONAR
#define BUZZER
#define LED0
#define LED1
#define SENSORS_SET (SENSOR_ACC | SENSOR_BARO | SENSOR_MAG)
#endif
#endif
#endif // STM32F10X_MD #endif // STM32F10X_MD
#include "target.h"

View file

@ -0,0 +1,20 @@
#define LED0_GPIO GPIOE
#define LED0_PIN Pin_8|Pin_12 // Blue LEDs - PE8/PE12
#define LED0_INVERTED
#define LED1_GPIO GPIOE
#define LED1_PIN Pin_10|Pin_14 // Orange LEDs - PE10/PE14
#define LED1_INVERTED
#define BEEP_GPIO GPIOE
#define BEEP_PIN Pin_9|Pin_13 // Red LEDs - PE9/PE13
#define BUZZER_INVERTED
#define BARO_GPIO GPIOC
#define BARO_PIN Pin_13
#define GYRO
#define ACC
#define BUZZER
#define LED0
#define LED1
#define SENSORS_SET (SENSOR_ACC)

View file

@ -0,0 +1,22 @@
// Afroflight32
#define LED0_GPIO GPIOB
#define LED0_PIN Pin_3 // PB3 (LED)
#define LED1_GPIO GPIOB
#define LED1_PIN Pin_4 // PB4 (LED)
#define BEEP_GPIO GPIOA
#define BEEP_PIN Pin_12 // PA12 (Buzzer)
#define BARO_GPIO GPIOC
#define BARO_PIN Pin_13
#define GYRO
#define ACC
#define MAG
#define BARO
#define LEDRING
#define SONAR
#define BUZZER
#define LED0
#define LED1
#define SENSORS_SET (SENSOR_ACC | SENSOR_BARO | SENSOR_MAG)

View file

@ -0,0 +1,13 @@
#define LED0_GPIO GPIOB
#define LED0_PIN Pin_12
#define BEEP_GPIO GPIOB
#define BEEP_PIN Pin_10
#define BUZZER
#define LED0
#define GYRO
#define ACC
#define MAG
#define SENSORS_SET (SENSOR_ACC)

View file

@ -0,0 +1,22 @@
// OLIMEXINO
//#define OLIMEXINO_UNCUT_LED1_E_JUMPER
//#define OLIMEXINO_UNCUT_LED2_E_JUMPER
#ifdef OLIMEXINO_UNCUT_LED1_E_JUMPER
#define LED0_GPIO GPIOA
#define LED0_PIN Pin_5 // D13, PA5/SPI1_SCK/ADC5 - "LED1" on silkscreen, Green
#define LED0
#endif
#ifdef OLIMEXINO_UNCUT_LED2_E_JUMPER
// "LED2" is using one of the PWM pins (CH2/PWM2), so we must not use PWM2 unless the jumper is cut. @See pwmInit()
#define LED1_GPIO GPIOA
#define LED1_PIN Pin_1 // D3, PA1/USART2_RTS/ADC1/TIM2_CH3 - "LED2" on silkscreen, Yellow
#define LED1
#endif
#define GYRO
#define ACC
#define SENSORS_SET (SENSOR_ACC)

View file

@ -0,0 +1,20 @@
#define LED0_GPIO GPIOE
#define LED0_PIN Pin_8|Pin_12 // Blue LEDs - PE8/PE12
#define LED0_INVERTED
#define LED1_GPIO GPIOE
#define LED1_PIN Pin_10|Pin_14 // Orange LEDs - PE10/PE14
#define LED1_INVERTED
#define BEEP_GPIO GPIOE
#define BEEP_PIN Pin_9|Pin_13 // Red LEDs - PE9/PE13
#define BUZZER_INVERTED
#define BARO_GPIO GPIOC
#define BARO_PIN Pin_13
#define GYRO
#define ACC
#define BUZZER
#define LED0
#define LED1
#define SENSORS_SET (SENSOR_ACC)