Skip to content

Commit d2ac268

Browse files
Merge pull request #11366 from sensei-hacker/feature-frskyf405-target
New target: FRSKYF405
2 parents a87537d + 8ba58cc commit d2ac268

3 files changed

Lines changed: 203 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(FRSKYF405 HSE_MHZ 24)

src/main/target/FRSKYF405/target.c

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 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+
20+
#include "platform.h"
21+
#include "drivers/io.h"
22+
#include "drivers/pwm_mapping.h"
23+
#include "drivers/timer.h"
24+
25+
timerHardware_t timerHardware[] = {
26+
DEF_TIM(TIM4, CH2, PB7, TIM_USE_OUTPUT_AUTO, 0, 0), // S1
27+
DEF_TIM(TIM4, CH1, PB6, TIM_USE_OUTPUT_AUTO, 0, 0), // S2
28+
DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // S3
29+
DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 0), // S4
30+
DEF_TIM(TIM8, CH3, PC8, TIM_USE_OUTPUT_AUTO, 0, 1), // S5
31+
DEF_TIM(TIM8, CH4, PC9, TIM_USE_OUTPUT_AUTO, 0, 0), // S6
32+
DEF_TIM(TIM12, CH1, PB14, TIM_USE_OUTPUT_AUTO, 0, 0), // S7 - no DShot (TIM12 has no DMA)
33+
DEF_TIM(TIM12, CH2, PB15, TIM_USE_OUTPUT_AUTO, 0, 0), // S8 - no DShot (TIM12 has no DMA)
34+
DEF_TIM(TIM1, CH1, PA8, TIM_USE_OUTPUT_AUTO, 0, 0), // S9
35+
36+
DEF_TIM(TIM2, CH1, PA15, TIM_USE_LED, 0, 0), // LED strip
37+
};
38+
39+
const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]);

src/main/target/FRSKYF405/target.h

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
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+
20+
#define TARGET_BOARD_IDENTIFIER "FR45"
21+
22+
#define USBD_PRODUCT_STRING "FrSkyF405"
23+
24+
// *************** LED & BEEPER **********************
25+
#define LED0 PA14 // shares SWCLK
26+
#define LED1 PA13 // shares SWDIO
27+
28+
#define BEEPER PC15
29+
#define BEEPER_INVERTED
30+
31+
// *************** Gyro & ACC **********************
32+
#define USE_SPI
33+
#define USE_SPI_DEVICE_1
34+
35+
#define SPI1_SCK_PIN PA5
36+
#define SPI1_MISO_PIN PA6
37+
#define SPI1_MOSI_PIN PA7
38+
39+
// IIM-42688P is compatible with ICM42605 driver
40+
#define USE_IMU_ICM42605
41+
#define ICM42605_CS_PIN PA4
42+
#define ICM42605_SPI_BUS BUS_SPI1
43+
#define IMU_ICM42605_ALIGN CW180_DEG_FLIP
44+
45+
46+
// *************** OSD *****************************
47+
#define USE_SPI_DEVICE_2
48+
#define SPI2_SCK_PIN PB13
49+
#define SPI2_MISO_PIN PC2
50+
#define SPI2_MOSI_PIN PC3
51+
52+
#define USE_MAX7456
53+
#define MAX7456_SPI_BUS BUS_SPI2
54+
#define MAX7456_CS_PIN PB12
55+
56+
// *************** SD Card *************************
57+
#define USE_SPI_DEVICE_3
58+
#define SPI3_SCK_PIN PB3
59+
#define SPI3_MISO_PIN PB4
60+
#define SPI3_MOSI_PIN PB5
61+
62+
#define USE_SDCARD
63+
#define USE_SDCARD_SPI
64+
#define SDCARD_SPI_BUS BUS_SPI3
65+
#define SDCARD_CS_PIN PC14
66+
67+
#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
68+
69+
// *************** UART *****************************
70+
#define USE_VCP
71+
72+
#define USE_UART1
73+
#define UART1_TX_PIN PA9
74+
#define UART1_RX_PIN PA10
75+
76+
#define USE_UART2
77+
#define UART2_TX_PIN PA2
78+
#define UART2_RX_PIN PA3
79+
80+
// UART2 has two pads: standard (for CRSF etc) and hardware-inverted SBUS
81+
#define SERIALRX_UART SERIAL_PORT_USART2
82+
#define SERIALRX_PROVIDER SERIALRX_SBUS
83+
#define DEFAULT_RX_TYPE RX_TYPE_SERIAL
84+
85+
#define USE_UART3
86+
#define UART3_TX_PIN PC10
87+
#define UART3_RX_PIN PC11
88+
89+
#define USE_UART4
90+
#define UART4_TX_PIN PA0
91+
#define UART4_RX_PIN PA1
92+
93+
94+
#define USE_UART5
95+
#define UART5_TX_PIN PC12
96+
#define UART5_RX_PIN PD2
97+
98+
#define USE_UART6
99+
#define UART6_TX_PIN PC6
100+
#define UART6_RX_PIN PC7
101+
102+
#define SERIAL_PORT_COUNT 7 // VCP + UART1-5, UART6
103+
104+
// *************** I2C ****************************
105+
#define USE_I2C
106+
107+
#define USE_I2C_DEVICE_1
108+
#define I2C1_SCL PB8
109+
#define I2C1_SDA PB9
110+
111+
#define USE_I2C_DEVICE_2
112+
#define I2C2_SCL PB10
113+
#define I2C2_SDA PB11
114+
115+
#define DEFAULT_I2C_BUS BUS_I2C1
116+
117+
#define USE_BARO
118+
#define BARO_I2C_BUS BUS_I2C1
119+
#define USE_BARO_SPL06
120+
121+
#define USE_MAG
122+
#define MAG_I2C_BUS DEFAULT_I2C_BUS
123+
#define USE_MAG_ALL
124+
125+
#define PITOT_I2C_BUS DEFAULT_I2C_BUS
126+
#define TEMPERATURE_I2C_BUS DEFAULT_I2C_BUS
127+
#define USE_RANGEFINDER
128+
#define RANGEFINDER_I2C_BUS DEFAULT_I2C_BUS
129+
130+
// *************** ADC *****************************
131+
#define USE_ADC
132+
#define ADC_INSTANCE ADC1
133+
#define ADC1_DMA_STREAM DMA2_Stream0
134+
135+
#define ADC_CHANNEL_1_PIN PC0
136+
#define ADC_CHANNEL_2_PIN PC1
137+
#define ADC_CHANNEL_3_PIN PC5
138+
139+
#define VBAT_ADC_CHANNEL ADC_CHN_1
140+
#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
141+
#define RSSI_ADC_CHANNEL ADC_CHN_3
142+
143+
#define CURRENT_METER_SCALE 250
144+
145+
#define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TELEMETRY | FEATURE_BLACKBOX)
146+
147+
// *************** LED STRIP ***********************
148+
#define USE_LED_STRIP
149+
#define WS2811_PIN PA15
150+
151+
// *************** PWM OUTPUTS *********************
152+
// S7/S8 on TIM12 do not support DShot
153+
#define MAX_PWM_OUTPUT_PORTS 9
154+
155+
// *************** Other ***************************
156+
#define USE_DSHOT
157+
#define USE_ESC_SENSOR
158+
#define USE_SERIAL_4WAY_BLHELI_INTERFACE
159+
160+
#define TARGET_IO_PORTA 0xffff
161+
#define TARGET_IO_PORTB 0xffff
162+
#define TARGET_IO_PORTC 0xffff
163+
#define TARGET_IO_PORTD (BIT(2)) // PD2 - UART5_RX

0 commit comments

Comments
 (0)