Drop Betaflight PIDc support for OPBL
[betaflight.git] / src / main / target / CC3D / target.c
bloba870de9e24efcc6ec69d52620b044b884057c6f0
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 #include <stdint.h>
20 #include <platform.h>
21 #include "drivers/io.h"
22 #include "drivers/pwm_mapping.h"
24 const uint16_t multiPPM[] = {
25 PWM6 | (MAP_TO_PPM_INPUT << 8), // PPM input
26 PWM7 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #1
27 PWM8 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #2
28 PWM9 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #3
29 PWM10 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #4
30 PWM11 | (MAP_TO_MOTOR_OUTPUT << 8),
31 PWM12 | (MAP_TO_MOTOR_OUTPUT << 8),
32 PWM2 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed
33 PWM3 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed
34 PWM4 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed
35 PWM5 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed
36 0xFFFF
39 const uint16_t multiPWM[] = {
40 PWM1 | (MAP_TO_PWM_INPUT << 8), // input #1
41 PWM2 | (MAP_TO_PWM_INPUT << 8),
42 PWM3 | (MAP_TO_PWM_INPUT << 8),
43 PWM4 | (MAP_TO_PWM_INPUT << 8),
44 PWM5 | (MAP_TO_PWM_INPUT << 8),
45 PWM6 | (MAP_TO_PWM_INPUT << 8), // input #6
46 PWM7 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #1 or servo #1 (swap to servo if needed)
47 PWM8 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #2 or servo #2 (swap to servo if needed)
48 PWM9 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #1 or #3
49 PWM10 | (MAP_TO_MOTOR_OUTPUT << 8),
50 PWM11 | (MAP_TO_MOTOR_OUTPUT << 8),
51 PWM12 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #4 or #6
52 0xFFFF
55 const uint16_t airPPM[] = {
56 PWM6 | (MAP_TO_PPM_INPUT << 8), // PPM input
57 PWM7 | (MAP_TO_MOTOR_OUTPUT << 8),
58 PWM8 | (MAP_TO_MOTOR_OUTPUT << 8),
59 PWM9 | (MAP_TO_SERVO_OUTPUT << 8),
60 PWM10 | (MAP_TO_SERVO_OUTPUT << 8),
61 PWM11 | (MAP_TO_SERVO_OUTPUT << 8),
62 PWM12 | (MAP_TO_SERVO_OUTPUT << 8),
63 PWM2 | (MAP_TO_SERVO_OUTPUT << 8),
64 PWM3 | (MAP_TO_SERVO_OUTPUT << 8),
65 PWM4 | (MAP_TO_SERVO_OUTPUT << 8),
66 PWM5 | (MAP_TO_SERVO_OUTPUT << 8),
67 0xFFFF
70 const uint16_t airPWM[] = {
71 PWM1 | (MAP_TO_PWM_INPUT << 8), // input #1
72 PWM2 | (MAP_TO_PWM_INPUT << 8),
73 PWM3 | (MAP_TO_PWM_INPUT << 8),
74 PWM4 | (MAP_TO_PWM_INPUT << 8),
75 PWM5 | (MAP_TO_PWM_INPUT << 8),
76 PWM6 | (MAP_TO_PWM_INPUT << 8), // input #6
77 PWM7 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #1
78 PWM8 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #2
79 PWM9 | (MAP_TO_SERVO_OUTPUT << 8), // servo #1
80 PWM10 | (MAP_TO_SERVO_OUTPUT << 8), // servo #2
81 PWM11 | (MAP_TO_SERVO_OUTPUT << 8), // servo #3
82 PWM12 | (MAP_TO_SERVO_OUTPUT << 8), // servo #4
83 0xFFFF
86 const uint16_t multiPPM_BP6[] = {
87 PWM6 | (MAP_TO_PPM_INPUT << 8), // PPM input
88 PWM7 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #1
89 PWM8 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #2
90 PWM9 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #3
91 PWM10 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #4
92 PWM11 | (MAP_TO_MOTOR_OUTPUT << 8),
93 PWM2 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed
94 PWM3 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed
95 PWM4 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed
96 PWM5 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed
97 0xFFFF
100 const uint16_t multiPWM_BP6[] = {
101 PWM1 | (MAP_TO_PWM_INPUT << 8), // input #1
102 PWM2 | (MAP_TO_PWM_INPUT << 8),
103 PWM3 | (MAP_TO_PWM_INPUT << 8),
104 PWM4 | (MAP_TO_PWM_INPUT << 8),
105 PWM5 | (MAP_TO_PWM_INPUT << 8),
106 PWM6 | (MAP_TO_PWM_INPUT << 8), // input #6
107 PWM7 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #1 or servo #1 (swap to servo if needed)
108 PWM8 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #2 or servo #2 (swap to servo if needed)
109 PWM9 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #1 or #3
110 PWM10 | (MAP_TO_MOTOR_OUTPUT << 8),
111 PWM11 | (MAP_TO_MOTOR_OUTPUT << 8),
112 0xFFFF
115 const uint16_t airPPM_BP6[] = {
116 PWM6 | (MAP_TO_PPM_INPUT << 8), // PPM input
117 PWM7 | (MAP_TO_MOTOR_OUTPUT << 8),
118 PWM8 | (MAP_TO_MOTOR_OUTPUT << 8),
119 PWM9 | (MAP_TO_SERVO_OUTPUT << 8),
120 PWM10 | (MAP_TO_SERVO_OUTPUT << 8),
121 PWM11 | (MAP_TO_SERVO_OUTPUT << 8),
122 PWM2 | (MAP_TO_SERVO_OUTPUT << 8),
123 PWM3 | (MAP_TO_SERVO_OUTPUT << 8),
124 PWM4 | (MAP_TO_SERVO_OUTPUT << 8),
125 PWM5 | (MAP_TO_SERVO_OUTPUT << 8),
126 0xFFFF
129 const uint16_t airPWM_BP6[] = {
130 PWM1 | (MAP_TO_PWM_INPUT << 8), // input #1
131 PWM2 | (MAP_TO_PWM_INPUT << 8),
132 PWM3 | (MAP_TO_PWM_INPUT << 8),
133 PWM4 | (MAP_TO_PWM_INPUT << 8),
134 PWM5 | (MAP_TO_PWM_INPUT << 8),
135 PWM6 | (MAP_TO_PWM_INPUT << 8), // input #6
136 PWM7 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #1
137 PWM8 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #2
138 PWM9 | (MAP_TO_SERVO_OUTPUT << 8), // servo #1
139 PWM10 | (MAP_TO_SERVO_OUTPUT << 8), // servo #2
140 PWM11 | (MAP_TO_SERVO_OUTPUT << 8), // servo #3
141 0xFFFF
145 const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = {
146 { TIM4, IO_TAG(PB6), TIM_Channel_1, TIM4_IRQn, 0, IOCFG_IPD }, // S1_IN
147 { TIM3, IO_TAG(PB5), TIM_Channel_2, TIM3_IRQn, 0, IOCFG_IPD }, // S2_IN - SoftSerial TX - GPIO_PartialRemap_TIM3 / Sonar trigger
148 { TIM3, IO_TAG(PB0), TIM_Channel_3, TIM3_IRQn, 0, IOCFG_IPD }, // S3_IN - SoftSerial RX / Sonar echo / RSSI ADC
149 { TIM3, IO_TAG(PB1), TIM_Channel_4, TIM3_IRQn, 0, IOCFG_IPD }, // S4_IN - Current
150 { TIM2, IO_TAG(PA0), TIM_Channel_1, TIM2_IRQn, 0, IOCFG_IPD }, // S5_IN - Vbattery
151 { TIM2, IO_TAG(PA1), TIM_Channel_2, TIM2_IRQn, 0, IOCFG_IPD }, // S6_IN - PPM IN
152 { TIM4, IO_TAG(PB9), TIM_Channel_4, TIM4_IRQn, 1, IOCFG_AF_PP }, // S1_OUT
153 { TIM4, IO_TAG(PB8), TIM_Channel_3, TIM4_IRQn, 1, IOCFG_AF_PP }, // S2_OUT
154 { TIM4, IO_TAG(PB7), TIM_Channel_2, TIM4_IRQn, 1, IOCFG_AF_PP }, // S3_OUT
155 { TIM1, IO_TAG(PA8), TIM_Channel_1, TIM1_CC_IRQn, 1, IOCFG_AF_PP }, // S4_OUT
156 { TIM3, IO_TAG(PB4), TIM_Channel_1, TIM3_IRQn, 1, IOCFG_AF_PP }, // S5_OUT - GPIO_PartialRemap_TIM3 - LED Strip
157 { TIM2, IO_TAG(PA2), TIM_Channel_3, TIM2_IRQn, 1, IOCFG_AF_PP } // S6_OUT