Graft of 'cli_diff_command' into 'master'.
[betaflight.git] / src / main / target / NAZE / target.h
blob212ea2c83f04b82dec26bcd7c5bfbc97f5228c28
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
20 #define TARGET_BOARD_IDENTIFIER "AFNA" // AFroNAze - NAZE might be considered misleading on Naze clones like the flip32.
21 #define USE_HARDWARE_REVISION_DETECTION
23 #define BOARD_HAS_VOLTAGE_DIVIDER
25 #define LED0 PB3
26 #define LED1 PB4
28 #define BEEPER PA12
29 #ifdef AFROMINI
30 #define BEEPER_INVERTED
31 #endif
33 #define BARO_XCLR_PIN PC13
34 #define BARO_EOC_PIN PC14
36 #define INVERTER PB2 // PB2 (BOOT1) abused as inverter select GPIO
37 #define INVERTER_USART USART2
39 #define USE_EXTI
40 #define MAG_INT_EXTI PC14
41 #define EXTI_CALLBACK_HANDLER_COUNT 3 // MPU data ready, MAG data ready, BMP085 EOC
42 //#define DEBUG_MPU_DATA_READY_INTERRUPT
43 #define USE_MPU_DATA_READY_SIGNAL
44 //#define DEBUG_MAG_DATA_READY_INTERRUPT
45 #define USE_MAG_DATA_READY_SIGNAL
47 // SPI2
48 // PB15 28 SPI2_MOSI
49 // PB14 27 SPI2_MISO
50 // PB13 26 SPI2_SCK
51 // PB12 25 SPI2_NSS
53 #define USE_SPI
54 #define USE_SPI_DEVICE_2
56 #define NAZE_SPI_INSTANCE SPI2
57 #define NAZE_SPI_CS_GPIO GPIOB
58 #define NAZE_SPI_CS_PIN PB12
59 #define NAZE_CS_GPIO_CLK_PERIPHERAL RCC_APB2Periph_GPIOB
61 // We either have this 16mbit flash chip on SPI or the MPU6500 acc/gyro depending on board revision:
62 #define M25P16_CS_GPIO NAZE_SPI_CS_GPIO
63 #define M25P16_CS_PIN NAZE_SPI_CS_PIN
64 #define M25P16_SPI_INSTANCE NAZE_SPI_INSTANCE
66 #define MPU6500_CS_GPIO_CLK_PERIPHERAL NAZE_CS_GPIO_CLK_PERIPHERAL
67 #define MPU6500_CS_GPIO NAZE_SPI_CS_GPIO
68 #define MPU6500_CS_PIN NAZE_SPI_CS_PIN
69 #define MPU6500_SPI_INSTANCE NAZE_SPI_INSTANCE
71 #define USE_FLASHFS
72 #define USE_FLASH_M25P16
74 #define GYRO
75 #define USE_GYRO_MPU3050
76 #define USE_GYRO_MPU6050
77 #define USE_GYRO_MPU6500
78 #define USE_GYRO_SPI_MPU6500
80 #define GYRO_MPU3050_ALIGN CW0_DEG
81 #define GYRO_MPU6050_ALIGN CW0_DEG
82 #define GYRO_MPU6500_ALIGN CW0_DEG
84 #define ACC
85 #define USE_ACC_ADXL345
86 #define USE_ACC_BMA280
87 #define USE_ACC_MMA8452
88 #define USE_ACC_MPU6050
89 #define USE_ACC_MPU6500
90 #define USE_ACC_SPI_MPU6500
92 #define ACC_ADXL345_ALIGN CW270_DEG
93 #define ACC_MPU6050_ALIGN CW0_DEG
94 #define ACC_MMA8452_ALIGN CW90_DEG
95 #define ACC_BMA280_ALIGN CW0_DEG
96 #define ACC_MPU6500_ALIGN CW0_DEG
98 #define BARO
99 #define USE_BARO_MS5611
100 #define USE_BARO_BMP085
101 #define USE_BARO_BMP280
103 #define MAG
104 #define USE_MAG_HMC5883
105 #define MAG_HMC5883_ALIGN CW180_DEG
107 #define SONAR
108 #define SONAR_TRIGGER_PIN PB0
109 #define SONAR_ECHO_PIN PB1
110 #define SONAR_TRIGGER_PIN_PWM PB8
111 #define SONAR_ECHO_PIN_PWM PB9
113 //#define DISPLAY
115 #define USE_UART1
116 #define USE_UART2
117 #define USE_UART3
118 #define USE_SOFTSERIAL1
119 #define USE_SOFTSERIAL2
120 #define SERIAL_PORT_COUNT 5
122 #define SOFTSERIAL_1_TIMER TIM3
123 #define SOFTSERIAL_1_TIMER_RX_HARDWARE 4 // PWM 5
124 #define SOFTSERIAL_1_TIMER_TX_HARDWARE 5 // PWM 6
125 #define SOFTSERIAL_2_TIMER TIM3
126 #define SOFTSERIAL_2_TIMER_RX_HARDWARE 6 // PWM 7
127 #define SOFTSERIAL_2_TIMER_TX_HARDWARE 7 // PWM 8
129 // USART3 only on NAZE32_SP - Flex Port
130 #define UART3_RX_PIN PB11
131 #define UART3_TX_PIN PB10
133 #define USE_I2C
134 #define I2C_DEVICE (I2CDEV_2)
136 // #define SOFT_I2C // enable to test software i2c
137 // #define SOFT_I2C_PB1011 // If SOFT_I2C is enabled above, need to define pinout as well (I2C1 = PB67, I2C2 = PB1011)
138 // #define SOFT_I2C_PB67
140 #define USE_ADC
141 #define CURRENT_METER_ADC_PIN PB1
142 #define VBAT_ADC_PIN PA4
143 #define RSSI_ADC_PIN PA1
144 #define EXTERNAL1_ADC_PIN PA5
147 #define LED_STRIP
148 #define WS2811_TIMER TIM3
149 #define WS2811_PIN PA6
150 #define WS2811_DMA_TC_FLAG DMA1_FLAG_TC6
151 #define WS2811_DMA_HANDLER_IDENTIFER DMA1_CH6_HANDLER
153 #undef GPS
155 #define SPEKTRUM_BIND
156 // USART2, PA3
157 #define BIND_PIN PA3
159 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
161 // IO - assuming all IOs on 48pin package
162 #define TARGET_IO_PORTA 0xffff
163 #define TARGET_IO_PORTB 0xffff
164 #define TARGET_IO_PORTC ( BIT(13) | BIT(14) | BIT(15) )
166 #define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) )