Skip to content

Commit 0b319b2

Browse files
Merge pull request iNavFlight#11280 from sunyanmeng963/INAV9.0-add-blueberryF405wing
Add target BLUEBERRYF405
2 parents aa07f4c + 88d278c commit 0b319b2

4 files changed

Lines changed: 250 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target_stm32f405xg(BLUEBERRYF405)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* This file is part of INAV.
3+
*
4+
* INAV 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+
* INAV 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 INAV. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
#include <stdint.h>
19+
#include "platform.h"
20+
#include "fc/fc_msp_box.h"
21+
#include "fc/config.h"
22+
#include "drivers/pwm_mapping.h"
23+
#include "flight/mixer_profile.h"
24+
#include "io/piniobox.h"
25+
26+
void targetConfiguration(void)
27+
{
28+
pinioBoxConfigMutable()->permanentId[0] = BOX_PERMANENT_ID_USER1;
29+
pinioBoxConfigMutable()->permanentId[1] = BOX_PERMANENT_ID_USER2;
30+
31+
// S1 and S2 are not as readily accessible, set default mixer to skip them
32+
timerOverridesMutable(timer2id(TIM8))->outputMode = OUTPUT_MODE_SERVOS;
33+
timerOverridesMutable(timer2id(TIM2))->outputMode = OUTPUT_MODE_SERVOS;
34+
timerOverridesMutable(timer2id(TIM1))->outputMode = OUTPUT_MODE_MOTORS;
35+
36+
*primaryMotorMixerMutable(0) = (motorMixer_t){ 1.0f, 0.0f, 0.0f, 0.0f };
37+
38+
*customServoMixersMutable(0) = (servoMixer_t){ .targetChannel = 1, .inputSource = 29, .rate = 100, .speed = 0 };
39+
*customServoMixersMutable(1) = (servoMixer_t){ .targetChannel = 2, .inputSource = 29, .rate = 100, .speed = 0 };
40+
*customServoMixersMutable(2) = (servoMixer_t){ .targetChannel = 3, .inputSource = 1, .rate = 100, .speed = 0 };
41+
*customServoMixersMutable(3) = (servoMixer_t){ .targetChannel = 4, .inputSource = 0, .rate = 100, .speed = 0 };
42+
*customServoMixersMutable(4) = (servoMixer_t){ .targetChannel = 5, .inputSource = 0, .rate = 100, .speed = 0 };
43+
*customServoMixersMutable(5) = (servoMixer_t){ .targetChannel = 6, .inputSource = 2, .rate = 100, .speed = 0 };
44+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* This file is part of INAV.
3+
*
4+
* INAV 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+
* INAV 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 INAV. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
#include <stdbool.h>
19+
#include <platform.h>
20+
#include "drivers/bus.h"
21+
#include "drivers/io.h"
22+
#include "drivers/pwm_mapping.h"
23+
#include "drivers/timer.h"
24+
#include "drivers/sensor.h"
25+
#include "drivers/timer_def_stm32f4xx.h"
26+
27+
timerHardware_t timerHardware[] = {
28+
DEF_TIM(TIM8, CH4, PC9, TIM_USE_OUTPUT_AUTO, 0, 0), // S1 D(2,7,7) UP217
29+
DEF_TIM(TIM8, CH3, PC8, TIM_USE_OUTPUT_AUTO, 0, 0), // S2 D(2,2,0) UP217
30+
DEF_TIM(TIM1, CH3N, PB15, TIM_USE_OUTPUT_AUTO, 0, 0), // S3 D(2,6,0) UP256
31+
DEF_TIM(TIM1, CH1, PA8, TIM_USE_OUTPUT_AUTO, 0, 1), // S4 D(2,1,6) UP256
32+
33+
DEF_TIM(TIM2, CH4, PB11, TIM_USE_OUTPUT_AUTO, 0, 0), // S5 D(1,7,3) UP173
34+
DEF_TIM(TIM2, CH3, PB10, TIM_USE_OUTPUT_AUTO, 0, 0), // S6 D(1,1,3) UP173
35+
DEF_TIM(TIM2, CH2, PB3, TIM_USE_OUTPUT_AUTO, 0, 0), // S7 D(1,6,3) UP173
36+
DEF_TIM(TIM2, CH1, PA15, TIM_USE_OUTPUT_AUTO, 0, 0), // S8 D(1,5,3) UP173
37+
38+
DEF_TIM(TIM12, CH1, PB14, TIM_USE_OUTPUT_AUTO, 0, 0), // S9 DMA NONE
39+
DEF_TIM(TIM13, CH1, PA6, TIM_USE_OUTPUT_AUTO, 0, 0), // S10 DMA NONE
40+
DEF_TIM(TIM4, CH1, PB6, TIM_USE_OUTPUT_AUTO, 0, 0), // S11 D(1,0,2)
41+
42+
DEF_TIM(TIM3, CH4, PB1, TIM_USE_LED, 0, 0), // 2812LED D(1,2,5)
43+
44+
DEF_TIM(TIM5, CH3, PA2, TIM_USE_ANY, 0, 0), // softserial1_TX (PA2 shared with UART2_TX)
45+
};
46+
47+
const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]);
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
/*
2+
* This file is part of INAV.
3+
*
4+
* INAV 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+
* INAV 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 INAV. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
#pragma once
19+
#define USE_TARGET_CONFIG
20+
21+
#define TARGET_BOARD_IDENTIFIER "BLF4"
22+
#define USBD_PRODUCT_STRING "BLUEBERRYF405"
23+
24+
#define LED0 PA14 //Blue
25+
#define LED1 PA13 //Green
26+
27+
#define BEEPER PB9
28+
#define BEEPER_INVERTED
29+
30+
// *************** SPI1 IMU & OSD *******************
31+
#define USE_SPI
32+
#define USE_SPI_DEVICE_1
33+
34+
#define SPI1_SCK_PIN PA5
35+
#define SPI1_MISO_PIN PB4
36+
#define SPI1_MOSI_PIN PA7
37+
38+
#define USE_IMU_ICM42605
39+
#define IMU_ICM42605_ALIGN CW270_DEG_FLIP
40+
#define ICM42605_SPI_BUS BUS_SPI1
41+
#define ICM42605_CS_PIN PC14
42+
43+
#define USE_IMU_BMI270
44+
#define IMU_BMI270_ALIGN CW270_DEG_FLIP
45+
#define BMI270_SPI_BUS BUS_SPI1
46+
#define BMI270_CS_PIN PC14
47+
48+
#define USE_MAX7456
49+
#define MAX7456_SPI_BUS BUS_SPI1
50+
#define MAX7456_CS_PIN PB12
51+
52+
// *************** SPI2 Flash/SD Card ****************
53+
#define USE_SPI_DEVICE_2
54+
#define SPI2_SCK_PIN PB13
55+
#define SPI2_MISO_PIN PC2
56+
#define SPI2_MOSI_PIN PC3
57+
58+
#define USE_SDCARD
59+
#define USE_SDCARD_SPI
60+
#define SDCARD_SPI_BUS BUS_SPI2
61+
#define SDCARD_CS_PIN PC1
62+
#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
63+
64+
// *************** I2C /Baro/Mag *********************
65+
#define USE_I2C
66+
#define USE_I2C_DEVICE_1
67+
#define I2C1_SCL PB8
68+
#define I2C1_SDA PB7
69+
70+
#define USE_BARO
71+
#define BARO_I2C_BUS BUS_I2C1
72+
#define USE_BARO_BMP280
73+
#define USE_BARO_MS5611
74+
#define USE_BARO_DPS310
75+
#define USE_BARO_SPL06
76+
77+
#define USE_MAG
78+
#define MAG_I2C_BUS BUS_I2C1
79+
#define USE_MAG_ALL
80+
81+
#define USE_RANGEFINDER
82+
#define RANGEFINDER_I2C_BUS BUS_I2C1
83+
#define PITOT_I2C_BUS BUS_I2C1
84+
#define TEMPERATURE_I2C_BUS BUS_I2C1
85+
86+
// *************** UART *****************************
87+
#define USE_VCP
88+
89+
#define USE_UART1
90+
#define UART1_TX_PIN PA9
91+
#define UART1_RX_PIN PA10
92+
93+
#define USE_UART2
94+
#define UART2_TX_PIN PA2
95+
#define UART2_RX_PIN PA3
96+
97+
#define USE_UART3
98+
#define UART3_TX_PIN PC10
99+
#define UART3_RX_PIN PC11
100+
101+
#define USE_UART4
102+
#define UART4_TX_PIN PA0
103+
#define UART4_RX_PIN PA1
104+
105+
#define USE_UART5
106+
#define UART5_TX_PIN PC12
107+
#define UART5_RX_PIN PD2
108+
109+
#define USE_UART6
110+
#define UART6_TX_PIN PC6
111+
#define UART6_RX_PIN PC7
112+
113+
#define SERIAL_PORT_COUNT 7
114+
115+
#define DEFAULT_RX_TYPE RX_TYPE_SERIAL
116+
#define SERIALRX_PROVIDER SERIALRX_CRSF
117+
#define SERIALRX_UART SERIAL_PORT_USART2
118+
119+
// *************** ADC ***************************
120+
#define USE_ADC
121+
#define ADC_INSTANCE ADC1
122+
#define ADC1_DMA_STREAM DMA2_Stream4
123+
#define ADC_CHANNEL_1_PIN PC4
124+
#define ADC_CHANNEL_2_PIN PC5
125+
#define ADC_CHANNEL_3_PIN PB0
126+
#define ADC_CHANNEL_4_PIN PC0
127+
#define VBAT_ADC_CHANNEL ADC_CHN_1
128+
#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
129+
#define RSSI_ADC_CHANNEL ADC_CHN_3
130+
#define AIRSPEED_ADC_CHANNEL ADC_CHN_4
131+
132+
// *************** PINIO ***************************
133+
#define USE_PINIO
134+
#define USE_PINIOBOX
135+
#define PINIO1_PIN PA4
136+
#define PINIO2_PIN PB5
137+
138+
// *************** LEDSTRIP ************************
139+
#define USE_LED_STRIP
140+
#define WS2811_PIN PB1
141+
142+
// *************** others ************************
143+
#define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_TELEMETRY | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TX_PROF_SEL | FEATURE_BLACKBOX )
144+
#define VBAT_SCALE_DEFAULT 2100
145+
#define CURRENT_METER_SCALE 150
146+
147+
#define TARGET_IO_PORTA 0xffff
148+
#define TARGET_IO_PORTB 0xffff
149+
#define TARGET_IO_PORTC 0xffff
150+
#define TARGET_IO_PORTD (BIT(2))
151+
152+
#define MAX_PWM_OUTPUT_PORTS 11
153+
154+
#define USE_SERIAL_4WAY_BLHELI_INTERFACE
155+
#define USE_DSHOT
156+
#define USE_DSHOT_DMAR
157+
#define USE_ESC_SENSOR
158+

0 commit comments

Comments
 (0)