Fixed CONFIG_FASTLOOP_PREFERRED_ACC related magic numbers
[betaflight.git] / src / main / target / MOTOLAB / target.h
blob09a94f4897044d70a5623173889659e22fa3d9b1
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 "MOTO" // MotoLab
21 #define USE_CLI
23 #define CONFIG_FASTLOOP_PREFERRED_ACC ACC_DEFAULT
25 #define LED0 PB5 // Blue LEDs - PB5
26 //#define LED1 PB9 // Green LEDs - PB9
28 #define BEEPER PA0
29 #define BEEPER_INVERTED
31 #define USABLE_TIMER_CHANNEL_COUNT 9
33 // MPU6050 interrupts
34 #define USE_EXTI
35 #define MPU_INT_EXTI PA15
36 #define EXTI15_10_CALLBACK_HANDLER_COUNT 1 // MPU data ready
37 #define USE_MPU_DATA_READY_SIGNAL
38 //#define ENSURE_MPU_DATA_READY_IS_LOW
40 #define GYRO
41 #define ACC
43 #define USE_GYRO_MPU6050
44 #define GYRO_MPU6050_ALIGN CW180_DEG
46 #define USE_ACC_MPU6050
48 #define ACC_MPU6050_ALIGN CW180_DEG
50 #define USE_GYRO_SPI_MPU6000
51 #define GYRO_MPU6000_ALIGN CW180_DEG
52 #define USE_ACC_SPI_MPU6000
53 #define ACC_MPU6000_ALIGN CW180_DEG
55 #define MPU6000_CS_GPIO GPIOB
56 #define MPU6000_CS_PIN PB12
57 #define MPU6000_SPI_INSTANCE SPI2
59 //#define BARO
60 //#define USE_BARO_MS5611
62 //#define MAG
63 //#define USE_MAG_HMC5883
65 #define USE_VCP
66 #define USE_USART1
67 #define USE_USART2
68 #define USE_USART3
69 #define SERIAL_PORT_COUNT 4
71 #define UART1_TX_PIN GPIO_Pin_6 // PB6
72 #define UART1_RX_PIN GPIO_Pin_7 // PB7
73 #define UART1_GPIO GPIOB
74 #define UART1_GPIO_AF GPIO_AF_7
75 #define UART1_TX_PINSOURCE GPIO_PinSource6
76 #define UART1_RX_PINSOURCE GPIO_PinSource7
78 #define UART2_TX_PIN GPIO_Pin_3 // PB3
79 #define UART2_RX_PIN GPIO_Pin_4 // PB4
80 #define UART2_GPIO GPIOB
81 #define UART2_GPIO_AF GPIO_AF_7
82 #define UART2_TX_PINSOURCE GPIO_PinSource3
83 #define UART2_RX_PINSOURCE GPIO_PinSource4
85 #define UART3_TX_PIN GPIO_Pin_10 // PB10 (AF7)
86 #define UART3_RX_PIN GPIO_Pin_11 // PB11 (AF7)
87 #define UART3_GPIO_AF GPIO_AF_7
88 #define UART3_GPIO GPIOB
89 #define UART3_TX_PINSOURCE GPIO_PinSource10
90 #define UART3_RX_PINSOURCE GPIO_PinSource11
92 #define USE_I2C
93 #define I2C_DEVICE (I2CDEV_2) // SDA (PA10/AF4), SCL (PA9/AF4)
95 #define I2C2_SCL_GPIO GPIOA
96 #define I2C2_SCL_GPIO_AF GPIO_AF_4
97 #define I2C2_SCL_PIN PA9
98 #define I2C2_SCL_PIN_SOURCE GPIO_PinSource9
99 #define I2C2_SCL_CLK_SOURCE RCC_AHBPeriph_GPIOA
100 #define I2C2_SDA_GPIO GPIOA
101 #define I2C2_SDA_GPIO_AF GPIO_AF_4
102 #define I2C2_SDA_PIN PA10
103 #define I2C2_SDA_PIN_SOURCE GPIO_PinSource10
104 #define I2C2_SDA_CLK_SOURCE RCC_AHBPeriph_GPIOA
106 #define USE_SPI
107 #define USE_SPI_DEVICE_2
109 #define M25P16_CS_PIN PB12
110 #define M25P16_SPI_INSTANCE SPI2
112 //#define SENSORS_SET (SENSOR_ACC | SENSOR_BARO | SENSOR_GPS | SENSOR_MAG)
113 #define SENSORS_SET (SENSOR_ACC)
115 #undef GPS
116 #define DISPLAY
117 #define USE_FLASHFS
118 #define USE_FLASH_M25P16
120 #define USE_ADC
121 #define BOARD_HAS_VOLTAGE_DIVIDER
123 #define ADC_INSTANCE ADC2
124 #define ADC_DMA_CHANNEL DMA2_Channel1
125 #define ADC_AHB_PERIPHERAL RCC_AHBPeriph_DMA2
127 #define VBAT_ADC_GPIO GPIOA
128 #define VBAT_ADC_GPIO_PIN GPIO_Pin_5
129 #define VBAT_ADC_CHANNEL ADC_Channel_2
131 //#define CURRENT_METER_ADC_GPIO GPIOA
132 //#define CURRENT_METER_ADC_GPIO_PIN GPIO_Pin_5
133 //#define CURRENT_METER_ADC_CHANNEL ADC_Channel_2
135 #define RSSI_ADC_GPIO GPIOB
136 #define RSSI_ADC_GPIO_PIN GPIO_Pin_2
137 #define RSSI_ADC_CHANNEL ADC_Channel_12
139 #define LED_STRIP
140 #if 1
141 #define LED_STRIP_TIMER TIM16
143 #define USE_LED_STRIP_ON_DMA1_CHANNEL3
144 #define WS2811_GPIO GPIOB
145 #define WS2811_GPIO_AHB_PERIPHERAL RCC_AHBPeriph_GPIOB
146 #define WS2811_GPIO_AF GPIO_AF_1
147 #define WS2811_PIN GPIO_Pin_8 // TIM16_CH1
148 #define WS2811_PIN_SOURCE GPIO_PinSource8
149 #define WS2811_TIMER TIM16
150 #define WS2811_TIMER_APB2_PERIPHERAL RCC_APB2Periph_TIM16
151 #define WS2811_DMA_CHANNEL DMA1_Channel3
152 #define WS2811_IRQ DMA1_Channel3_IRQn
153 #define WS2811_DMA_TC_FLAG DMA1_FLAG_TC3
154 #define WS2811_DMA_HANDLER_IDENTIFER DMA1_CH3_HANDLER
155 #endif
157 #if 0
158 // Alternate LED strip pin
159 // FIXME DMA IRQ Transfer Complete is never called because the TIM17_DMA_RMP needs to be set in SYSCFG_CFGR1
160 #define LED_STRIP_TIMER TIM17
162 #define USE_LED_STRIP_ON_DMA1_CHANNEL7
163 #define WS2811_GPIO GPIOA
164 #define WS2811_GPIO_AHB_PERIPHERAL RCC_AHBPeriph_GPIOA
165 #define WS2811_GPIO_AF GPIO_AF_1
166 #define WS2811_PIN GPIO_Pin_7 // TIM17_CH1
167 #define WS2811_PIN_SOURCE GPIO_PinSource7
168 #define WS2811_TIMER TIM17
169 #define WS2811_TIMER_APB2_PERIPHERAL RCC_APB2Periph_TIM17
170 #define WS2811_DMA_CHANNEL DMA1_Channel7
171 #define WS2811_IRQ DMA1_Channel7_IRQn
172 #endif
175 #define SPEKTRUM_BIND
176 // USART2, PB4
177 #define BIND_PIN PB4
179 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
181 // IO - stm32f303cc in 48pin package
182 #define TARGET_IO_PORTA 0xffff
183 #define TARGET_IO_PORTB 0xffff
184 #define TARGET_IO_PORTC (BIT(13)|BIT(14)|BIT(15))
185 // #define TARGET_IO_PORTF (BIT(0)|BIT(1))
186 // !!TODO - check the following line is correct
187 #define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(3)|BIT(4))
189 #define USED_TIMERS (TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(15) | TIM_N(17))
191 #define TIMER_APB2_PERIPHERALS (RCC_APB2Periph_TIM1 | RCC_APB2Periph_TIM15 | RCC_APB2Periph_TIM17)
192 #define TIMER_APB1_PERIPHERALS (RCC_APB1Periph_TIM2 | RCC_APB1Periph_TIM3)
193 #define TIMER_AHB_PERIPHERALS (RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB)