Skip to content

Commit 37c417e

Browse files
shanggltcddddDusKing1
committed
add three targets based on at32 chips
NEUTRONRCF435AIO - based on AT32F435RGT7 NEUTRONRCF435MINI - based on AT32F435CGU7 NEUTRONRCF435WING - based on AT32F435CGU7 Co-Authored-By: EMSR <10240646+shanggl@users.noreply.github.com> Co-Authored-By: carl <101383042+tcdddd@users.noreply.github.com> Co-Authored-By: Hugo Chiang <hugo@gyroflow.xyz>
1 parent b8d263b commit 37c417e

File tree

9 files changed

+740
-0
lines changed

9 files changed

+740
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target_at32f43x_xGT7(NEUTRONRCF435MINI)
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* This file is part of Cleanflight.
3+
*
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.
8+
*
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.
13+
*
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/>.
16+
*/
17+
18+
#include <stdint.h>
19+
20+
#include "platform.h"
21+
22+
#include "drivers/bus.h"
23+
#include "drivers/io.h"
24+
#include "drivers/pwm_mapping.h"
25+
#include "drivers/timer.h"
26+
27+
timerHardware_t timerHardware[] = {
28+
29+
DEF_TIM(TMR1, CH1, PA8, TIM_USE_ANY |TIM_USE_LED, 0,7), // PWM1 - LED MCO1 DMA1 CH2
30+
31+
DEF_TIM(TMR4, CH1, PB6, TIM_USE_MC_MOTOR|TIM_USE_FW_MOTOR, 0,0), // motor1 DMA2 CH7
32+
DEF_TIM(TMR1, CH3, PA10, TIM_USE_MC_MOTOR|TIM_USE_FW_MOTOR, 0,2), // motor2 DMA2 CH6
33+
DEF_TIM(TMR2, CH4, PA3, TIM_USE_MC_MOTOR|TIM_USE_FW_SERVO, 0,1), // motor3 DMA2 CH5
34+
DEF_TIM(TMR3, CH4, PB1, TIM_USE_MC_MOTOR|TIM_USE_FW_SERVO, 0,3), // motor4 DMA2 CH4
35+
36+
};
37+
38+
const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]);
39+
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
/*
2+
* This file is part of Cleanflight.
3+
*
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.
8+
*
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.
13+
*
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/>.
16+
*/
17+
18+
#pragma once
19+
20+
#define TARGET_BOARD_IDENTIFIER "NERC"
21+
22+
#define USBD_PRODUCT_STRING "NeuronRC F435 MINI"
23+
24+
/**********swd debuger reserved *****************
25+
*
26+
* pa13 swdio
27+
* pa14 swclk
28+
* PA15 JTDI
29+
* PB4 JREST
30+
* pb3 swo /DTO
31+
32+
* other pin
33+
*
34+
* PB2 ->BOOT0 button
35+
* PA8 MCO1
36+
* PA11 OTG1 D+ DP
37+
* PA10 OTG1 D- DN
38+
* PH0 HEXT IN
39+
* PH1 HEXT OUT
40+
*/
41+
42+
#define LED0 PC13
43+
#define LED1 PC14
44+
#define LED0_INVERTED
45+
#define LED1_INVERTED
46+
47+
#define BEEPER PC15
48+
#define BEEPER_INVERTED
49+
50+
// *************** Gyro & ACC **********************
51+
#define USE_SPI
52+
#define USE_SPI_DEVICE_1
53+
54+
#define SPI1_SCK_PIN PA5
55+
#define SPI1_MISO_PIN PA6
56+
#define SPI1_MOSI_PIN PA7
57+
#define SPI1_NSS_PIN PA4
58+
59+
// #define USE_EXTI
60+
// #define GYRO_INT_EXTI PA15
61+
// #define USE_MPU_DATA_READY_SIGNAL
62+
63+
// MPU6500
64+
#define USE_IMU_MPU6500
65+
#define IMU_MPU6500_ALIGN CW0_DEG
66+
#define MPU6500_SPI_BUS BUS_SPI1
67+
#define MPU6500_CS_PIN SPI1_NSS_PIN
68+
69+
// ICM42605/ICM42688P
70+
#define USE_IMU_ICM42605
71+
#define IMU_ICM42605_ALIGN CW0_DEG
72+
#define ICM42605_SPI_BUS BUS_SPI1
73+
#define ICM42605_CS_PIN SPI1_NSS_PIN
74+
// #define ICM42605_EXTI_PIN GYRO_INT_EXTI
75+
76+
// BMI270
77+
#define USE_IMU_BMI270
78+
#define IMU_BMI270_ALIGN CW0_DEG
79+
#define BMI270_SPI_BUS BUS_SPI1
80+
#define BMI270_CS_PIN SPI1_NSS_PIN
81+
82+
// LSM6DXX
83+
#define USE_IMU_LSM6DXX
84+
#define IMU_LSM6DXX_ALIGN CW0_DEG
85+
#define LSM6DXX_CS_PIN SPI1_NSS_PIN
86+
#define LSM6DXX_SPI_BUS BUS_SPI1
87+
88+
89+
// *************** I2C/Baro/Mag/EXT*********************
90+
#define USE_I2C
91+
#define USE_I2C_DEVICE_2
92+
#define I2C2_SCL PH2 // SCL pad
93+
#define I2C2_SDA PH3 // SDA pad
94+
#define USE_I2C_PULLUP
95+
96+
#define USE_BARO
97+
#define BARO_I2C_BUS BUS_I2C2
98+
#define USE_BARO_BMP280
99+
#define USE_BARO_DPS310
100+
101+
#define USE_MAG
102+
#define MAG_I2C_BUS BUS_I2C2
103+
#define USE_MAG_HMC5883
104+
#define USE_MAG_QMC5883
105+
#define DEFAULT_I2C_BUS BUS_I2C2
106+
107+
// temperature sensors
108+
//#define TEMPERATURE_I2C_BUS BUS_I2C1
109+
// air speed sensors
110+
//#define PITOT_I2C_BUS BUS_I2C1
111+
// ranger sensors
112+
//#define USE_RANGEFINDER
113+
//#define RANGEFINDER_I2C_BUS BUS_I2C1
114+
115+
// *************** OSD *****************************
116+
#define USE_SPI_DEVICE_2
117+
#define SPI2_SCK_PIN PB13
118+
#define SPI2_MISO_PIN PB14
119+
#define SPI2_MOSI_PIN PB15
120+
#define SPI2_NSS_PIN PB12
121+
122+
#define USE_MAX7456
123+
#define MAX7456_SPI_BUS BUS_SPI2
124+
#define MAX7456_CS_PIN SPI2_NSS_PIN
125+
126+
127+
// *************** SD/BLACKBOX **************************
128+
129+
#define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
130+
#define USE_FLASHFS
131+
#define USE_FLASH_M25P16
132+
#define M25P16_SPI_BUS BUS_SPI2
133+
#define M25P16_CS_PIN PB5
134+
135+
#define USE_FLASH_W25N01G
136+
#define W25N01G_SPI_BUS BUS_SPI2
137+
#define W25N01G_CS_PIN PB5
138+
139+
// *************** UART *****************************
140+
#define USE_VCP
141+
//#define USB_DETECT_PIN PC14
142+
#define USE_USB_DETECT
143+
144+
#define USE_UART1
145+
#define UART1_RX_PIN PB7
146+
#define UART1_TX_PIN PA9
147+
148+
#define USE_UART2
149+
#define UART2_RX_PIN PB0
150+
#define UART2_TX_PIN PA2
151+
152+
#define USE_UART3
153+
#define UART3_RX_PIN PB11
154+
#define UART3_TX_PIN PB10
155+
156+
#define USE_UART5
157+
#define UART5_RX_PIN PB8
158+
#define UART5_TX_PIN PB9
159+
160+
#define USE_UART7
161+
#define UART7_RX_PIN PB3
162+
#define UART7_TX_PIN PB4
163+
164+
#define SERIAL_PORT_COUNT 6
165+
166+
#define DEFAULT_RX_TYPE RX_TYPE_SERIAL
167+
#define SERIALRX_PROVIDER SERIALRX_CRSF
168+
#define SERIALRX_UART SERIAL_PORT_USART7
169+
170+
// *************** ADC *****************************
171+
#define USE_ADC
172+
#define ADC_INSTANCE ADC1
173+
174+
#define ADC1_DMA_STREAM DMA2_CHANNEL5
175+
#define ADC_CHANNEL_1_PIN PA0
176+
#define ADC_CHANNEL_2_PIN PA1
177+
//#define ADC_CHANNEL_3_PIN PB0
178+
#define VBAT_ADC_CHANNEL ADC_CHN_1
179+
#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
180+
//#define RSSI_ADC_CHANNEL ADC_CHN_3
181+
182+
#define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_CURRENT_METER | FEATURE_TELEMETRY| FEATURE_VBAT | FEATURE_OSD )
183+
184+
// #define USE_LED_STRIP
185+
// #define WS2811_PIN PB10 //TIM2_CH3
186+
187+
// #define USE_SPEKTRUM_BIND
188+
// #define BIND_PIN PA3 //UART2_RX_PIN
189+
190+
#define USE_SERIAL_4WAY_BLHELI_INTERFACE
191+
192+
#define TARGET_IO_PORTA 0xffff
193+
#define TARGET_IO_PORTB 0xffff
194+
#define TARGET_IO_PORTC 0xffff
195+
#define TARGET_IO_PORTD 0xffff
196+
#define TARGET_IO_PORTE BIT(2)
197+
#define TARGET_IO_PORTH BIT(1)|BIT(2)|BIT(3)
198+
199+
#define MAX_PWM_OUTPUT_PORTS 8
200+
#define USE_DSHOT
201+
#define USE_ESC_SENSOR
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target_at32f43x_xGT7(NEUTRONRCF435SE)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* This file is part of Cleanflight.
3+
*
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.
8+
*
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.
13+
*
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/>.
16+
*/
17+
18+
#include <stdint.h>
19+
20+
#include "platform.h"
21+
22+
#include "drivers/bus.h"
23+
#include "drivers/io.h"
24+
#include "drivers/pwm_mapping.h"
25+
#include "drivers/timer.h"
26+
27+
timerHardware_t timerHardware[] = {
28+
29+
DEF_TIM(TMR5, CH1, PA0, TIM_USE_ANY, 0, 13), // TIM_USE_CAMERA_CONTROL
30+
DEF_TIM(TMR5, CH2, PA1, TIM_USE_ANY |TIM_USE_LED, 0,7), // PWM1 - LED MCO1 DMA1 CH2
31+
DEF_TIM(TMR2, CH4, PA3, TIM_USE_ANY |TIM_USE_PPM, 0,6), // PWM2 - PPM DMA1 CH6
32+
33+
DEF_TIM(TMR8, CH4, PC9, TIM_USE_MC_MOTOR|TIM_USE_FW_MOTOR, 0,0), // motor1 DMA2 CH7
34+
DEF_TIM(TMR8, CH3, PC8, TIM_USE_MC_MOTOR|TIM_USE_FW_MOTOR, 0,2), // motor2 DMA2 CH6
35+
DEF_TIM(TMR3, CH2, PC7, TIM_USE_MC_MOTOR|TIM_USE_FW_SERVO, 0,1), // motor3 DMA2 CH5
36+
DEF_TIM(TMR3, CH1, PC6, TIM_USE_MC_MOTOR|TIM_USE_FW_SERVO, 0,3), // motor4 DMA2 CH4
37+
38+
DEF_TIM(TMR4, CH1, PB6, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO | TIM_USE_MC_SERVO, 0,11), // PWM1 - OUT5 DMA1 CH7
39+
DEF_TIM(TMR4, CH2, PB7, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO | TIM_USE_MC_SERVO, 0,10), // PWM2 - OUT6 DMA2 CH1
40+
DEF_TIM(TMR3, CH4, PB1, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO | TIM_USE_MC_SERVO, 0,9), // PWM3 - OUT7 DMA2 CH2
41+
DEF_TIM(TMR3, CH3, PB0, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO | TIM_USE_MC_SERVO, 0,8), // PWM4 - OUT8 DMA2 CH3
42+
43+
};
44+
45+
const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]);
46+

0 commit comments

Comments
 (0)