Skip to content

Commit 3962c92

Browse files
authored
add new cgu7 based target (#24)
1 parent 8f2b9af commit 3962c92

File tree

7 files changed

+306
-6
lines changed

7 files changed

+306
-6
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
runs-on: ubuntu-22.04
4040
strategy:
4141
matrix:
42-
targets: [ EMSRPROTO1, EMSRPROTO2, EMSRPROTO3, NEUTRONRCF435AIO ]
42+
targets: [ EMSRPROTO1, EMSRPROTO2, EMSRPROTO3, NEUTRONRCF435AIO, NEUTRONRCF435MINI ]
4343
steps:
4444
- name: Code Checkout
4545
uses: actions/checkout@v2

src/main/drivers/bus_i2c_atbsp_init.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,12 @@ const i2cHardware_t i2cHardware[I2CDEV_COUNT] = {
7878
.sclPins = {
7979
I2CPINDEF(PB10, GPIO_MUX_4),
8080
I2CPINDEF(PD12, GPIO_MUX_4),
81+
I2CPINDEF(PH2, GPIO_MUX_4),
8182
},
8283
.sdaPins = {
8384
I2CPINDEF(PB3, GPIO_MUX_4),
8485
I2CPINDEF(PB11, GPIO_MUX_4),
86+
I2CPINDEF(PH3,GPIO_MUX_4),
8587
},
8688
.rcc = RCC_APB1(I2C2),
8789
.ev_irq = I2C2_EVT_IRQn,
@@ -97,7 +99,7 @@ const i2cHardware_t i2cHardware[I2CDEV_COUNT] = {
9799
},
98100
.sdaPins = {
99101
I2CPINDEF(PC1, GPIO_MUX_4),
100-
I2CPINDEF(PB14, GPIO_MUX_4),
102+
I2CPINDEF(PB14, GPIO_MUX_4),
101103
},
102104
.rcc = RCC_APB1(I2C3),
103105
.ev_irq = I2C3_EVT_IRQn,

src/main/drivers/serial_uart_at32f43x.c

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@
6767
#ifndef UART5_RX_DMA_CHANNEL
6868
#define UART5_RX_DMA_CHANNEL NULL
6969
#endif
70+
#ifndef UART7_TX_DMA_CHANNEL
71+
#define UART7_TX_DMA_CHANNEL NULL
72+
#endif
73+
#ifndef UART7_RX_DMA_CHANNEL
74+
#define UART7_RX_DMA_CHANNEL NULL
75+
#endif
7076
#ifndef UART8_TX_DMA_CHANNEL
7177
#define UART8_TX_DMA_CHANNEL NULL
7278
#endif
@@ -215,9 +221,9 @@ const uartHardware_t uartHardware[UARTDEV_COUNT] = {
215221
},
216222
.txPins = {
217223
{ DEFIO_TAG_E(PB6), GPIO_MUX_8 },
218-
{ DEFIO_TAG_E(PB9), GPIO_MUX_8 },
219-
{ DEFIO_TAG_E(PC12), GPIO_MUX_8 },
220-
{ DEFIO_TAG_E(PE10), GPIO_MUX_8 },
224+
{ DEFIO_TAG_E(PB9), GPIO_MUX_8 },
225+
{ DEFIO_TAG_E(PC12), GPIO_MUX_8 },
226+
{ DEFIO_TAG_E(PE10), GPIO_MUX_8 },
221227
},
222228
.rcc = RCC_APB1(UART5),
223229
.irqn = UART5_IRQn,
@@ -230,6 +236,38 @@ const uartHardware_t uartHardware[UARTDEV_COUNT] = {
230236
},
231237
#endif
232238

239+
#ifdef USE_UART7
240+
{
241+
.device = UARTDEV_7,
242+
.reg = UART7,
243+
#ifdef USE_DMA
244+
.rxDMAMuxId = DMAMUX_DMAREQ_ID_UART7_RX,
245+
.rxDMAResource = (dmaResource_t *)UART7_RX_DMA_CHANNEL,
246+
.txDMAMuxId = DMAMUX_DMAREQ_ID_UART7_TX,
247+
.txDMAResource = (dmaResource_t *)UART7_TX_DMA_CHANNEL,
248+
#endif
249+
.rxPins = {
250+
{ DEFIO_TAG_E(PB3), GPIO_MUX_8 },
251+
{ DEFIO_TAG_E(PC0), GPIO_MUX_8 },
252+
{ DEFIO_TAG_E(PE7), GPIO_MUX_8 },
253+
{ DEFIO_TAG_E(PF6), GPIO_MUX_8 },
254+
},
255+
.txPins = {
256+
{ DEFIO_TAG_E(PB4), GPIO_MUX_8 },
257+
{ DEFIO_TAG_E(PC1), GPIO_MUX_8 },
258+
{ DEFIO_TAG_E(PE8), GPIO_MUX_8 },
259+
{ DEFIO_TAG_E(PF7), GPIO_MUX_8 },
260+
},
261+
.rcc = RCC_APB1(UART7),
262+
.irqn = UART7_IRQn,
263+
.txPriority = NVIC_PRIO_SERIALUART7_TXDMA,
264+
.rxPriority = NVIC_PRIO_SERIALUART7,
265+
.txBuffer = uart7TxBuffer,
266+
.rxBuffer = uart7RxBuffer,
267+
.txBufferSize = sizeof(uart7TxBuffer),
268+
.rxBufferSize = sizeof(uart7RxBuffer),
269+
},
270+
#endif
233271

234272
#ifdef USE_UART8
235273
{

src/main/io/displayport_crsf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static int crsfWriteString(displayPort_t *displayPort, uint8_t col, uint8_t row,
8585
if (row >= crsfScreen.rows || col >= crsfScreen.cols) {
8686
return 0;
8787
}
88-
const size_t truncLen = MIN((int)strlen(s), crsfScreen.cols-col); // truncate at colCount
88+
const uint8_t truncLen = MIN((int)strlen(s), crsfScreen.cols-col); // truncate at colCount
8989
char *rowStart = &crsfScreen.buffer[row * crsfScreen.cols + col];
9090
crsfScreen.updated |= memcmp(rowStart, s, truncLen);
9191
if (crsfScreen.updated) {
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/* * This file is part of Cleanflight and Betaflight.
2+
*
3+
* Cleanflight and Betaflight are free software. You can redistribute
4+
* this software and/or modify this software under the terms of the
5+
* GNU General Public License as published by the Free Software
6+
* Foundation, either version 3 of the License, or (at your option)
7+
* any later version.
8+
*
9+
* Cleanflight and Betaflight are distributed in the hope that they
10+
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
11+
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
* See the GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this software.
16+
*
17+
* If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
20+
#include <stdint.h>
21+
22+
#include "platform.h"
23+
#include "drivers/io.h"
24+
25+
#include "drivers/dma.h"
26+
#include "drivers/timer.h"
27+
#include "drivers/timer_def.h"
28+
29+
const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = {
30+
DEF_TIM(TMR1, CH1, PA8, TIM_USE_ANY | TIM_USE_LED, 0, 7, 2), // PWM1 - OUT1 LEDSTRIP /MCO1
31+
32+
DEF_TIM(TMR4, CH1, PB6, TIM_USE_MOTOR, 0, 0, 0), // motor1 DMA1 CH1
33+
DEF_TIM(TMR1, CH3, PA10, TIM_USE_MOTOR, 0, 1, 0), // motor2 DMA1 CH2
34+
DEF_TIM(TMR2, CH4, PA3, TIM_USE_MOTOR, 0, 2, 1), // motor3 DMA1 CH3
35+
DEF_TIM(TMR3, CH4, PB1, TIM_USE_MOTOR, 0, 3, 1), // motor4 DMA1 CH4
36+
37+
38+
};
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
/*
2+
* This file is part of Cleanflight and Betaflight.
3+
*
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.
9+
*
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.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this software.
17+
*
18+
* If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
21+
#pragma once
22+
23+
#define TARGET_BOARD_IDENTIFIER "NEUTRONRCF435MINI"
24+
#define USBD_PRODUCT_STRING "NERC"
25+
/**********swd debuger reserved *****************
26+
*
27+
* pa13 swdio
28+
* pa14 swclk
29+
* PB4 JREST
30+
*
31+
* other pin
32+
*
33+
* BOOT0 button
34+
* PA8 MCO1/EXINT
35+
* PA12 OTG1 D+ DP
36+
* PA11 OTG1 D- DM
37+
* PH0 HEXT IN
38+
* PH1 HEXT OUT
39+
* PB2 BOOT1 -> GND
40+
*/
41+
42+
//No Buttons
43+
44+
//LEDS
45+
#define LED0_PIN PC13
46+
#define LED1_PIN PC14
47+
#define LED0_INVERTED //PC 13\PC14 驱动电流不够,改为反向驱动LED
48+
#define LED1_INVERTED
49+
50+
#define USE_BEEPER
51+
#define BEEPER_PIN PC15
52+
#define BEEPER_INVERTED //低电平触发
53+
54+
//ESC Protocol
55+
56+
#define ENABLE_DSHOT_DMAR DSHOT_DMAR_AUTO
57+
#define DSHOT_BITBANG_DEFAULT DSHOT_BITBANG_AUTO
58+
59+
// *************** SPI **********************
60+
#define USE_SPI
61+
#define USE_SPI_DEVICE_1
62+
63+
#define SPI1_SCK_PIN PA5
64+
#define SPI1_MISO_PIN PA6
65+
#define SPI1_MOSI_PIN PA7
66+
#define SPI1_NSS_PIN PA4
67+
68+
#define USE_SPI_DEVICE_2
69+
#define SPI2_SCK_PIN PB13
70+
#define SPI2_MISO_PIN PB14
71+
#define SPI2_MOSI_PIN PB15
72+
#define SPI2_NSS_PIN PB12
73+
74+
75+
// *************** Gyro & ACC **********************
76+
77+
#define USE_EXTI
78+
#define USE_GYRO_EXTI
79+
#define GYRO_1_EXTI_PIN PA15
80+
#define USE_MPU_DATA_READY_SIGNAL
81+
#define ENSURE_MPU_DATA_READY_IS_LOW
82+
83+
#define GYRO_1_CS_PIN SPI1_NSS_PIN
84+
#define GYRO_1_SPI_INSTANCE SPI1
85+
#define GYRO_1_ALIGN CW180_DEG
86+
87+
88+
#define USE_GYRO
89+
#define USE_GYRO_SPI_MPU6500 //debug only
90+
#define USE_ACC_SPI_MPU6500 //debug only
91+
#define USE_GYRO_SPI_ICM42688P
92+
#define USE_ACCGYRO_BMI270
93+
#define USE_ACCGYRO_LSM6DSO
94+
95+
#define USE_ACC
96+
#define USE_ACC_SPI_ICM42688P
97+
98+
99+
// *************** OSD *****************************
100+
//USE SPI3 ON AT-START BOARD ,USE SPI2 ON LQFP64
101+
#define USE_MAX7456
102+
#define MAX7456_SPI_INSTANCE SPI2
103+
#define MAX7456_SPI_CS_PIN SPI2_NSS_PIN
104+
105+
/********************BLACKBOX***********************/
106+
#define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
107+
#define USE_FLASHFS
108+
#define USE_FLASH_M25P16
109+
#define USE_FLASH_W25N01G // 1Gb NAND flash support
110+
#define USE_FLASH_W25M // Stacked die support
111+
#define USE_FLASH_W25M512 // 512Kb (256Kb x 2 stacked) NOR flash support
112+
#define USE_FLASH_W25M02G // 2Gb (1Gb x 2 stacked) NAND flash support
113+
#define FLASH_SPI_INSTANCE SPI2
114+
#define FLASH_CS_PIN PB5
115+
116+
117+
118+
// *************** Baro **************************
119+
#define USE_I2C
120+
#define USE_I2C_DEVICE_2
121+
#define I2C_DEVICE (I2CDEV_2)
122+
#define I2C2_SCL PH2 // SCL pad
123+
#define I2C2_SDA PH3 // SDA pad
124+
#define USE_I2C_PULLUP
125+
126+
#define USE_BARO
127+
#define USE_BARO_BMP280
128+
#define USE_BARO_DPS310
129+
#define BARO_I2C_INSTANCE (I2CDEV_2)
130+
131+
#define USE_MAG
132+
#define USE_MAG_HMC5883
133+
#define USE_MAG_QMC5883
134+
#define MAG_I2C_INSTANCE (I2CDEV_2)
135+
136+
137+
// *************** UART & Serial ******************
138+
#define USE_VCP
139+
140+
#define USE_UART1
141+
#define UART1_RX_PIN PB7 //PA10 CHANGE TO PB7
142+
#define UART1_TX_PIN PA9
143+
144+
#define USE_UART2
145+
#define UART2_RX_PIN PB0 //PA3 CHANGE TO PB0
146+
#define UART2_TX_PIN PA2
147+
148+
#define USE_UART3
149+
#define UART3_RX_PIN PB10
150+
#define UART3_TX_PIN PB11
151+
152+
#define USE_UART5
153+
#define UART5_RX_PIN PB8
154+
#define UART5_TX_PIN PB9
155+
156+
#define USE_UART7
157+
#define UART7_RX_PIN PB3
158+
#define UART7_TX_PIN PB4
159+
160+
161+
162+
#define USE_SOFTSERIAL1
163+
#define USE_SOFTSERIAL2
164+
165+
#define SERIAL_PORT_COUNT 8 // VCP UART1 UART2 UART3 UART5 UART7 SOFTSERIAL 1/2
166+
167+
#define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL
168+
#define SERIALRX_PROVIDER SERIALRX_SBUS
169+
#define SERIALRX_UART SERIAL_PORT_USART1
170+
171+
172+
173+
// *************** ADC *****************************
174+
#define USE_ADC
175+
#define ADC_INSTANCE ADC1 // Default added
176+
#define ADC1_DMA_OPT 11 //DMA 2 CH 5
177+
178+
#define VBAT_ADC_PIN PA0
179+
#define CURRENT_METER_ADC_PIN PA1
180+
//#define RSSI_ADC_PIN 0
181+
182+
#define USE_ESCSERIAL
183+
184+
#define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_TELEMETRY | FEATURE_SOFTSERIAL |FEATURE_LED_STRIP )
185+
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
186+
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
187+
188+
#define TARGET_IO_PORTA 0xffff
189+
#define TARGET_IO_PORTB 0xffff
190+
#define TARGET_IO_PORTC 0xffff
191+
#define TARGET_IO_PORTH BIT(1)|BIT(2)|BIT(3)
192+
193+
#define USABLE_TIMER_CHANNEL_COUNT 28
194+
#define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(5) | TIM_N(8) | TIM_N(20) )
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#AT32F43xxMT7_TARGETS += $(TARGET) #FOR 4032KB
2+
AT32F43xxGT7_TARGETS += $(TARGET) #FOR 1024KB
3+
4+
CUSTOM_DEFAULTS_EXTENDED = yes
5+
FEATURES += VCP ONBOARDFLASH
6+
7+
TARGET_SRC = \
8+
drivers/accgyro/accgyro_mpu6500.c \
9+
drivers/accgyro/accgyro_spi_mpu6000.c \
10+
drivers/accgyro/accgyro_spi_mpu6500.c\
11+
drivers/accgyro/accgyro_spi_icm426xx.c\
12+
drivers/barometer/barometer_bmp280.c \
13+
drivers/barometer/barometer_dps310.c\
14+
drivers/compass/compass_hmc5883l.c\
15+
drivers/compass/compass_qmc5883l.c\
16+
$(ROOT)/lib/main/BoschSensortec/BMI270-Sensor-API/bmi270.c \
17+
drivers/accgyro/accgyro_spi_bmi270.c\
18+
drivers/accgyro/accgyro_spi_lsm6dso_init.c \
19+
drivers/accgyro/accgyro_spi_lsm6dso.c \
20+
drivers/max7456.c \
21+
drivers/vtx_rtc6705.c \
22+
drivers/vtx_rtc6705_soft_spi.c \
23+
drivers/rx/expresslrs_driver_atbsp.c \
24+
drivers/rx/rx_sx127x.c \
25+
drivers/rx/rx_sx1280.c \
26+
rx/expresslrs_telemetry.c \
27+
rx/expresslrs_common.c \
28+
rx/expresslrs.c

0 commit comments

Comments
 (0)