Final move of target specific code into target directory.
[betaflight.git] / src / main / target / PORT103R / target.h
blobc0dfc4aa33f79e1208ad55f4396b2d2f9c986a71
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 "103R"
22 #define LED0 PB3 // PB3 (LED)
23 #define LED1 PB4 // PB4 (LED)
24 #define LED2 PD2 // PD2 (LED) - Labelled LED4
26 #define BEEPER PA12 // PA12 (Beeper)
28 #define BARO_XCLR_GPIO GPIOC
29 #define BARO_XCLR_PIN PC13
30 #define BARO_EOC_GPIO GPIOC
31 #define BARO_EOC_PIN PC14
32 #define BARO_APB2_PERIPHERALS RCC_APB2Periph_GPIOC
34 #define INVERTER PB2 // PB2 (BOOT1) abused as inverter select GPIO
35 #define INVERTER_USART USART2
37 #define USE_SPI
38 #define USE_SPI_DEVICE_2
40 #define PORT103R_SPI_INSTANCE SPI2
41 #define PORT103R_SPI_CS_GPIO GPIOB
42 #define PORT103R_SPI_CS_PIN PB12
44 // We either have this 16mbit flash chip on SPI or the MPU6500 acc/gyro depending on board revision:
45 #define M25P16_CS_GPIO PORT103R_SPI_CS_GPIO
46 #define M25P16_CS_PIN PORT103R_SPI_CS_PIN
47 #define M25P16_SPI_INSTANCE PORT103R_SPI_INSTANCE
49 #define MPU6000_CS_GPIO PORT103R_SPI_CS_GPIO
50 #define MPU6000_CS_PIN PORT103R_SPI_CS_PIN
51 #define MPU6000_SPI_INSTANCE PORT103R_SPI_INSTANCE
53 #define MPU6500_CS_GPIO PORT103R_SPI_CS_GPIO
54 #define MPU6500_CS_PIN PORT103R_SPI_CS_PIN
55 #define MPU6500_SPI_INSTANCE PORT103R_SPI_INSTANCE
56 #define MPU6500_CS_GPIO_CLK_PERIPHERAL RCC_APB2Periph_GPIOB
58 #define GYRO
59 #define USE_FAKE_GYRO
60 //#define USE_GYRO_L3G4200D
61 //#define USE_GYRO_L3GD20
62 //#define USE_GYRO_MPU3050
63 #define USE_GYRO_MPU6050
64 #define USE_GYRO_SPI_MPU6000
65 #define USE_GYRO_SPI_MPU6500
67 #define ACC
68 #define USE_FAKE_ACC
69 //#define USE_ACC_ADXL345
70 //#define USE_ACC_BMA280
71 //#define USE_ACC_MMA8452
72 #define USE_ACC_MPU6050
73 #define USE_ACC_SPI_MPU6000
74 #define USE_ACC_SPI_MPU6500
76 #define BARO
77 #define USE_BARO_MS5611
78 #define USE_BARO_BMP085
79 #define USE_BARO_BMP280
81 #define MAG
82 #define USE_MAG_HMC5883
83 #define USE_MAG_AK8975
85 #define USE_FLASHFS
86 #define USE_FLASHTOOLS
87 #define USE_FLASH_M25P16
89 #define SONAR
90 #define DISPLAY
92 #define USE_USART1
93 #define USE_USART2
94 #define USE_SOFTSERIAL1
95 #define USE_SOFTSERIAL2
96 #define SERIAL_PORT_COUNT 4
98 #define SOFTSERIAL_1_TIMER TIM3
99 #define SOFTSERIAL_1_TIMER_RX_HARDWARE 4 // PWM 5
100 #define SOFTSERIAL_1_TIMER_TX_HARDWARE 5 // PWM 6
101 #define SOFTSERIAL_2_TIMER TIM3
102 #define SOFTSERIAL_2_TIMER_RX_HARDWARE 6 // PWM 7
103 #define SOFTSERIAL_2_TIMER_TX_HARDWARE 7 // PWM 8
105 #define USE_I2C
106 #define I2C_DEVICE (I2CDEV_2)
108 // #define SOFT_I2C // enable to test software i2c
109 // #define SOFT_I2C_PB1011 // If SOFT_I2C is enabled above, need to define pinout as well (I2C1 = PB67, I2C2 = PB1011)
110 // #define SOFT_I2C_PB67
112 #define USE_ADC
114 #define CURRENT_METER_ADC_GPIO GPIOB
115 #define CURRENT_METER_ADC_GPIO_PIN GPIO_Pin_1
116 #define CURRENT_METER_ADC_CHANNEL ADC_Channel_9
118 #define VBAT_ADC_GPIO GPIOA
119 #define VBAT_ADC_GPIO_PIN GPIO_Pin_4
120 #define VBAT_ADC_CHANNEL ADC_Channel_4
122 #define RSSI_ADC_GPIO GPIOA
123 #define RSSI_ADC_GPIO_PIN GPIO_Pin_1
124 #define RSSI_ADC_CHANNEL ADC_Channel_1
126 #define EXTERNAL1_ADC_GPIO GPIOA
127 #define EXTERNAL1_ADC_GPIO_PIN GPIO_Pin_5
128 #define EXTERNAL1_ADC_CHANNEL ADC_Channel_5
130 //#define LED_STRIP
131 //#define LED_STRIP_TIMER TIM3
133 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
135 // IO - stm32f103RCT6 in 64pin package
136 #define TARGET_IO_PORTA 0xffff
137 #define TARGET_IO_PORTB 0xffff
138 #define TARGET_IO_PORTC 0xffff
139 #define TARGET_IO_PORTD (BIT(0)|BIT(1)|BIT(2))
142 #define USED_TIMERS (TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4))
144 #define TIMER_APB1_PERIPHERALS (RCC_APB1Periph_TIM2 | RCC_APB1Periph_TIM3 | RCC_APB1Periph_TIM4)
145 #define TIMER_APB2_PERIPHERALS (RCC_APB2Periph_TIM1 | RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB)