Cleanup CC3D/NAZE/OLIMEXINO ADC initialisation and PWM mapping. Fixes
[betaflight.git] / src / main / target / NAZE / target.h
blobffd179baaad17a422ac6f0b5408633842e919d4d
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 LED0_GPIO GPIOB
24 #define LED0_PIN Pin_3 // PB3 (LED)
25 #define LED0_PERIPHERAL RCC_APB2Periph_GPIOB
26 #define LED1_GPIO GPIOB
27 #define LED1_PIN Pin_4 // PB4 (LED)
28 #define LED1_PERIPHERAL RCC_APB2Periph_GPIOB
31 #define BEEP_GPIO GPIOA
32 #define BEEP_PIN Pin_12 // PA12 (Beeper)
33 #define BEEP_PERIPHERAL RCC_APB2Periph_GPIOA
35 #define BARO_XCLR_GPIO GPIOC
36 #define BARO_XCLR_PIN Pin_13
37 #define BARO_EOC_GPIO GPIOC
38 #define BARO_EOC_PIN Pin_14
39 #define BARO_APB2_PERIPHERALS RCC_APB2Periph_GPIOC
41 #define INVERTER_PIN Pin_2 // PB2 (BOOT1) abused as inverter select GPIO
42 #define INVERTER_GPIO GPIOB
43 #define INVERTER_PERIPHERAL RCC_APB2Periph_GPIOB
44 #define INVERTER_USART USART2
46 // SPI2
47 // PB15 28 SPI2_MOSI
48 // PB14 27 SPI2_MISO
49 // PB13 26 SPI2_SCK
50 // PB12 25 SPI2_NSS
52 #define USE_SPI
53 #define USE_SPI_DEVICE_2
55 #define NAZE_SPI_INSTANCE SPI2
56 #define NAZE_SPI_CS_GPIO GPIOB
57 #define NAZE_SPI_CS_PIN GPIO_Pin_12
59 #define MPU6500_CS_GPIO NAZE_SPI_CS_GPIO
60 #define MPU6500_CS_PIN NAZE_SPI_CS_PIN
61 #define MPU6500_SPI_INSTANCE NAZE_SPI_INSTANCE
63 #define GYRO
64 #define USE_GYRO_MPU3050
65 #define USE_GYRO_MPU6050
67 #define GYRO_MPU3050_ALIGN CW0_DEG
68 #define GYRO_MPU6050_ALIGN CW0_DEG
69 #define GYRO_SPI_MPU6500_ALIGN CW0_DEG
71 #define ACC
72 #define USE_ACC_ADXL345
73 #define USE_ACC_BMA280
74 #define USE_ACC_MMA8452
75 #define USE_ACC_MPU6050
76 //#define ACC_SPI_MPU6500
78 #define ACC_ADXL345_ALIGN CW270_DEG
79 #define ACC_MPU6050_ALIGN CW0_DEG
80 #define ACC_MMA8452_ALIGN CW90_DEG
81 #define ACC_BMA280_ALIGN CW0_DEG
82 //#define ACC_SPI_MPU6500_ALIGN CW0_DEG
84 #define BARO
85 #define USE_BARO_MS5611
86 #define USE_BARO_BMP085
88 #define MAG
89 #define USE_MAG_HMC5883
91 #define MAG_HMC5883_ALIGN CW180_DEG
93 #define SONAR
94 #define BEEPER
95 #define LED0
96 #define LED1
97 #define INVERTER
98 #define DISPLAY
100 #define USE_USART1
101 #define USE_USART2
102 #define USE_SOFTSERIAL1
103 #define USE_SOFTSERIAL2
104 #define SERIAL_PORT_COUNT 4
106 #define SOFTSERIAL_1_TIMER TIM3
107 #define SOFTSERIAL_1_TIMER_RX_HARDWARE 4 // PWM 5
108 #define SOFTSERIAL_1_TIMER_TX_HARDWARE 5 // PWM 6
109 #define SOFTSERIAL_2_TIMER TIM3
110 #define SOFTSERIAL_2_TIMER_RX_HARDWARE 6 // PWM 7
111 #define SOFTSERIAL_2_TIMER_TX_HARDWARE 7 // PWM 8
113 #define USE_I2C
114 #define I2C_DEVICE (I2CDEV_2)
116 // #define SOFT_I2C // enable to test software i2c
117 // #define SOFT_I2C_PB1011 // If SOFT_I2C is enabled above, need to define pinout as well (I2C1 = PB67, I2C2 = PB1011)
118 // #define SOFT_I2C_PB67
120 #define USE_ADC
122 #define CURRENT_METER_ADC_GPIO GPIOB
123 #define CURRENT_METER_ADC_GPIO_PIN GPIO_Pin_1
124 #define CURRENT_METER_ADC_CHANNEL ADC_Channel_9
126 #define VBAT_ADC_GPIO GPIOA
127 #define VBAT_ADC_GPIO_PIN GPIO_Pin_4
128 #define VBAT_ADC_CHANNEL ADC_Channel_4
130 #define RSSI_ADC_GPIO GPIOA
131 #define RSSI_ADC_GPIO_PIN GPIO_Pin_1
132 #define RSSI_ADC_CHANNEL ADC_Channel_1
134 #define EXTERNAL1_ADC_GPIO GPIOA
135 #define EXTERNAL1_ADC_GPIO_PIN GPIO_Pin_5
136 #define EXTERNAL1_ADC_CHANNEL ADC_Channel_5
138 #define SENSORS_SET (SENSOR_ACC | SENSOR_BARO | SENSOR_MAG)
140 #define GPS
142 #define LED_STRIP
143 #define LED_STRIP_TIMER TIM3
145 #define BLACKBOX
146 #define TELEMETRY
147 #define SERIAL_RX
148 #define AUTOTUNE
150 #define SPEKTRUM_BIND
151 // USART2, PA3
152 #define BIND_PORT GPIOA
153 #define BIND_PIN Pin_3
155 // alternative defaults AlienWii32 (activate via OPTIONS="ALIENWII32" during make for NAZE target)
156 #ifdef ALIENWII32
157 #define BRUSHED_MOTORS
158 #define HARDWARE_BIND_PLUG
159 // Hardware bind plug at PB5 (Pin 41)
160 #define BINDPLUG_PORT GPIOB
161 #define BINDPLUG_PIN Pin_5
162 #endif