Merge pull request #11198 from SteveCEvans/sce_rc2
[betaflight.git] / src / main / target / CJMCU / target.h
blob2a114d59e21a932a4ac265f54ae998134416d9fc
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #pragma once
23 #define TARGET_BOARD_IDENTIFIER "CJM1" // CJMCU
24 #define USE_HARDWARE_REVISION_DETECTION
25 #define USE_TARGET_CONFIG
26 #define TARGET_BUS_INIT
28 #define LED0_PIN PC14
29 #define LED1_PIN PC13
30 #define LED2_PIN PC15
32 #undef USE_BEEPER
34 #define USE_GYRO
35 #define USE_GYRO_MPU6050
37 #define USE_ACC
38 #define USE_ACC_MPU6050
40 //#define USE_MAG
41 //#define USE_MAG_HMC5883
43 #define BRUSHED_MOTORS
45 #define USE_UART1
46 #define USE_UART2
48 #define SERIAL_PORT_COUNT 2
50 #define USE_I2C
51 #define USE_I2C_DEVICE_1
52 #define I2C_DEVICE (I2CDEV_1)
54 // #define SOFT_I2C // enable to test software i2c
55 // #define SOFT_I2C_PB1011 // If SOFT_I2C is enabled above, need to define pinout as well (I2C1 = PB67, I2C2 = PB1011)
56 // #define SOFT_I2C_PB67
59 #define USE_RX_NRF24
60 #ifdef USE_RX_NRF24
62 #define USE_SPI
63 #define USE_SPI_DEVICE_1
65 #define USE_RX_SPI
66 #define RX_SPI_INSTANCE SPI1
68 // Nordic Semiconductor uses 'CSN', STM uses 'NSS'
69 #define RX_CE_PIN PA4
70 #define RX_NSS_PIN PA11
71 #define RX_SPI_EXTI_PIN PA8
72 // CJMCU has NSS on PA11, rather than the standard PA4
73 #define SPI1_NSS_PIN RX_NSS_PIN
75 #define SPI1_SCK_PIN PA5
76 #define SPI1_MISO_PIN PA6
77 #define SPI1_MOSI_PIN PA7
79 #define USE_RX_NRF24
80 #define USE_RX_CX10
81 #define USE_RX_H8_3D
82 //#define USE_RX_INAV // Temporary disabled to make some room in flash
83 //#define USE_RX_SYMA
84 #define USE_RX_V202
85 //#define RX_SPI_DEFAULT_PROTOCOL RX_SPI_NRF24_SYMA_X5
86 //#define RX_SPI_DEFAULT_PROTOCOL RX_SPI_NRF24_SYMA_X5C
87 //#define RX_SPI_DEFAULT_PROTOCOL RX_SPI_NRF24_INAV
88 #define RX_SPI_DEFAULT_PROTOCOL RX_SPI_NRF24_H8_3D
89 //#define RX_SPI_DEFAULT_PROTOCOL RX_SPI_NRF24_CX10A
90 //#define RX_SPI_DEFAULT_PROTOCOL RX_SPI_NRF24_V202_1M
92 #define DEFAULT_RX_FEATURE FEATURE_RX_SPI
93 //#define USE_TELEMETRY
94 //#define USE_TELEMETRY_LTM
95 //#define USE_TELEMETRY_NRF24_LTM
96 #ifdef USE_PWM
97 #undef USE_PWM
98 #endif
100 #ifdef USE_PPM
101 #undef USE_PPM
102 #endif
104 #ifdef USE_SERIAL_RX
105 #undef USE_SERIAL_RX
106 #endif
107 #else
109 #define DEFAULT_RX_FEATURE FEATURE_RX_PPM
110 #define USE_RX_MSP
112 #endif //USE_RX_NRF24
114 #define BRUSHED_MOTORS
115 #define DEFAULT_FEATURES FEATURE_MOTOR_STOP
116 #undef USE_SERIAL_PASSTHROUGH
117 #undef USE_CLI
119 // Since the CJMCU PCB has holes for 4 motors in each corner we can save same flash space by disabling support for other mixers.
120 #define USE_QUAD_MIXER_ONLY
121 #undef USE_SERVOS
123 // Number of available PWM outputs
124 //#define MAX_PWM_OUTPUT_PORTS 4
126 // IO - assuming all IOs on 48pin package TODO
127 #define TARGET_IO_PORTA 0xffff
128 #define TARGET_IO_PORTB 0xffff
129 #define TARGET_IO_PORTC (BIT(13)|BIT(14)|BIT(15))
131 #define USABLE_TIMER_CHANNEL_COUNT 14
132 #define USED_TIMERS (TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4))