Merge pull request #11198 from SteveCEvans/sce_rc2
[betaflight.git] / src / main / target / NAZE / target.h
blobd81fc8d79528c6ded57508ca2be58c9d627435c4
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #pragma once
23 #define USE_TELEMETRY_IBUS
25 #define USE_TARGET_CONFIG
26 #define TARGET_VALIDATECONFIG
27 #define USE_HARDWARE_REVISION_DETECTION
28 #define TARGET_BUS_INIT
30 #define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
32 #define LED0_PIN PB3
33 #define LED1_PIN PB4
35 #define USE_BEEPER
36 #define BEEPER_PIN PA12
38 #if defined(AFROMINI)
39 #define BEEPER_INVERTED
40 #define TARGET_BOARD_IDENTIFIER "AFMN"
41 #elif defined(BEEBRAIN)
42 #define BRUSHED_MOTORS
43 #undef USE_SERVOS
44 #define TARGET_BOARD_IDENTIFIER "BEBR"
45 #define USE_TARGET_CONFIG
46 #define DEFAULT_FEATURES FEATURE_MOTOR_STOP
47 #else
48 #define TARGET_BOARD_IDENTIFIER "AFNA"
49 // Beeper configuration is handled in 'config.c', since it is dependent on hardware revision
50 #endif
52 //#define BARO_XCLR_PIN PC13
53 //#define BARO_EOC_PIN PC14
55 #define INVERTER_PIN_UART2 PB2 // PB2 (BOOT1) abused as inverter select GPIO
57 #define USE_RX_MSP
59 #define USE_EXTI
60 #define MAG_INT_EXTI PC14
61 #define USE_GYRO_EXTI
62 #define GYRO_1_EXTI_PIN PC13
63 #define MMA8451_INT_PIN PA5
65 #define USE_MPU_DATA_READY_SIGNAL
66 #define USE_MAG_DATA_READY_SIGNAL
68 #define USE_SPI
69 #define USE_SPI_DEVICE_2
71 #define NAZE_SPI_INSTANCE SPI2
72 #define NAZE_SPI_CS_PIN PB12
74 // We either have this 16mbit flash chip on SPI or the MPU6500 acc/gyro depending on board revision:
75 #define FLASH_CS_PIN NAZE_SPI_CS_PIN
76 #define FLASH_SPI_INSTANCE NAZE_SPI_INSTANCE
78 #define GYRO_1_CS_PIN NAZE_SPI_CS_PIN
79 #define GYRO_1_SPI_INSTANCE NAZE_SPI_INSTANCE
81 #define USE_FLASHFS
82 #define USE_FLASH_M25P16
84 #define USE_GYRO
85 #define USE_GYRO_MPU3050
86 #define USE_GYRO_MPU6050
87 #define USE_GYRO_MPU6500
88 #define USE_GYRO_SPI_MPU6500
90 #define GYRO_1_ALIGN CW0_DEG
92 #define USE_ACC
93 //#define USE_ACC_ADXL345
94 //#define USE_ACC_BMA280
95 //#define USE_ACC_MMA8452
96 #define USE_ACC_MPU6050
97 #define USE_ACC_MPU6500
98 #define USE_ACC_SPI_MPU6500
100 //#define ACC_ADXL345_ALIGN CW270_DEG
101 //#define ACC_MMA8452_ALIGN CW90_DEG
102 //#define ACC_BMA280_ALIGN CW0_DEG
105 // Barometer dropped to make flash space
106 //#define USE_BARO
107 //#define USE_BARO_MS5611 // needed for Flip32 board
108 //#define USE_BARO_BMP280
110 // Compass dropped to make flash space
111 //#define USE_MAG
112 //#define USE_MAG_HMC5883
113 //#define MAG_HMC5883_ALIGN CW180_DEG
115 // Rangefinder dropped to make flash space
116 //#define USE_RANGEFINDER
117 //#define USE_RANGEFINDER_HCSR04
118 //#define RANGEFINDER_HCSR04_TRIGGER_PIN PB0
119 //#define RANGEFINDER_HCSR04_ECHO_PIN PB1
120 //#define RANGEFINDER_HCSR04_TRIGGER_PIN_PWM PB8
121 //#define RANGEFINDER_HCSR04_ECHO_PIN_PWM PB9
123 #define USE_UART1
124 #define USE_UART2
125 /* only 2 uarts available on the NAZE, add ifdef here if present on other boards */
126 //#define USE_UART3
127 #define USE_SOFTSERIAL1
128 #define USE_SOFTSERIAL2
129 #define SERIAL_PORT_COUNT 4
131 #define SOFTSERIAL1_RX_PIN PA6 // PWM 5
132 #define SOFTSERIAL1_TX_PIN PA7 // PWM 6
134 #define SOFTSERIAL2_RX_PIN PB0 // PWM 7
135 #define SOFTSERIAL2_TX_PIN PB1 // PWM 8
137 #define UART3_RX_PIN PB11
138 #define UART3_TX_PIN PB10
140 #define USE_I2C
141 #define USE_I2C_DEVICE_2
142 #define I2C_DEVICE (I2CDEV_2)
144 // #define SOFT_I2C // enable to test software i2c
145 // #define SOFT_I2C_PB1011 // If SOFT_I2C is enabled above, need to define pinout as well (I2C1 = PB67, I2C2 = PB1011)
146 // #define SOFT_I2C_PB67
148 #define USE_ADC
149 #define CURRENT_METER_ADC_PIN PB1
150 #define VBAT_ADC_PIN PA4
151 #define RSSI_ADC_PIN PA1
152 #define EXTERNAL1_ADC_PIN PA5
154 #define DEFAULT_RX_FEATURE FEATURE_RX_PPM
156 // IO - assuming all IOs on 48pin package
157 #define TARGET_IO_PORTA 0xffff
158 #define TARGET_IO_PORTB 0xffff
159 #define TARGET_IO_PORTC ( BIT(13) | BIT(14) | BIT(15) )
161 #define USABLE_TIMER_CHANNEL_COUNT 14
162 #define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) )