1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 05:15:25 +03:00
This commit is contained in:
Alex Wolf 2018-08-13 18:27:44 -04:00
commit 031ea3ea94
29 changed files with 205 additions and 863 deletions

View file

@ -52,7 +52,7 @@ This board use the STM32F722RET6 microcontroller and have the following features
### 8 Outputs
| Value | Identifier | function | pin | Notes |
| ----- | ------------ | ----------| ------| ------------------------------------------------------------------------------------- |
| 1 | TIM_CH2 | PPM | PB7 | PPM
| 1 | TIM4_CH2 | PPM | PB7 | PPM
| 2 | TIM8_CH1 | OUPUT1 | PC6 | DMA
| 3 | TIM8_CH2 | OUPUT2 | PC7 | DMA
| 4 | TIM8_CH3 | OUPUT3 | PC8 | DMA
@ -65,7 +65,7 @@ This board use the STM32F722RET6 microcontroller and have the following features
| 11 | TIM3_CH4 | PWM | PB1 | FPV Camera Control(FCAM)
### Gyro & ACC ,suppose ICM20602 and MPU6000
### Gyro & ACC ,support ICM20602 and MPU6000
| Value | Identifier | function | pin | Notes |
| ----- | ------------ | ---------| -------| ------------------------------------------------------------------------------------- |
| 1 | SPI1 | SCK | PA5 | MPU6000 & ICM20602
@ -100,6 +100,10 @@ This board use the STM32F722RET6 microcontroller and have the following features
| 3 | SWDIO | PAD |
| 4 | 3V3 | PAD |
![DALRCF722DUAL top](images/DALRCF722DUAL-Top.png)
![DALRCF722DUAL bottom](images/DALRCF722DUAL-Botton.jpg)
###Designers
* ZhengNyway(nyway@vip.qq.com)

101
docs/boards/Board - FLYWOOF405.md Executable file
View file

@ -0,0 +1,101 @@
# Board - FLYWOOF405
This board use the STM32F405RGT6 microcontroller and have the following features:
* 1024K bytes of flash memory,192K bytes RAM,168 MHz CPU/210 DMIPS
* The 16M byte SPI flash for data logging
* USB VCP and boot select button on board(for DFU)
* Stable voltage regulation,9V/1.5A DCDC BEC for VTX/camera etc.And could select 5v/9v with pad
* Serial LED interface(LED_STRIP)
* VBAT/CURR/RSSI sensors input
* Suppose IRC Tramp/smart audio/FPV Camera Control/FPORT/telemetry
* Supports SBus, Spektrum1024/2048, PPM. No external inverters required (built-in).
* Supports I2C device extend(baro/compass/OLED etc)
* Supports GPS
### All uarts have pad on board
| Value | Identifier | RX | TX | Notes |
| ----- | ------------ | -----| -----| ------------------------------------------------------------------------------------------- |
| 1 | USART1 | PA10 | PB6 | USE smartport/FPORT/TEL etc |
| 2 | USART3 | PB11 | PB10| FOR SBUS IN(inverter build in) |
| 3 | USART4 | PA1 | PA0 | PAD USE FOR TRAMP/smart audio |
| 4 | USART5 | PD2 | / | PAD ESC sensor |
| 5 | USART6 | PC7 | PC6 | PAD USE FOR GPS/BLE etc |
### I2C with GPS port together.Use for BARO or compass etc
| Value | Identifier | function | pin | Notes |
| ----- | ------------ | ---------| -------| ------------------------------------------------------------------------------------- |
| 1 | I2C1 | SDA | PB9 | with GPS outlet
| 2 | I2C1 | SCL | PB6 | with GPS outlet
### Buzzer/LED output
| Value | Identifier | function | pin | Notes |
| ----- | ------------ | ---------| -------| ------------------------------------------------------------------------------------- |
| 1 | LED0 | LED | PC14 |
| 2 | BEEPER | BEE | PC13 |
### VBAT input with 1/10 divider ratio,Current signal input,Analog/digit RSSI input
| Value | Identifier | function | pin | Notes |
| ----- | ------------ | ----------| ------| ------------------------------------------------------------------------------------- |
| 1 | ADC1 | VBAT | PC3 | DMA2_Stream0
| 2 | ADC1 | CURR | PC2 | DMA2_Stream0
| 3 | ADC1 | RSSI | PC1 | DMA2_Stream0
### 8 Outputs, 1 PPM input
| Value | Identifier | function | pin | Notes |
| ----- | ------------ | ----------| ------| ------------------------------------------------------------------------------------- |
| 1 | TIM10_CH1 | PPM | PB7 | PPM
| 2 | TIM3_CH3 | OUPUT1 | PB0 | DMA1_Stream7
| 3 | TIM3_CH4 | OUPUT2 | PB1 | DMA1_Stream2
| 4 | TIM2_CH4 | OUPUT3 | PA3 | DMA1_Stream6
| 5 | TIM2_CH3 | OUPUT4 | PA2 | DMA1_Stream1
| 6 | TIM3_CH2 | OUPUT5 | PB5 | DMA1_Stream5
| 7 | TIM4_CH2 | OUPUT6 | PB7 | DMA1_Stream3
| 8 | TIM8_CH4 | OUPUT7 | PC9 | DMA2_Stream7
| 9 | TIM3_CH1 | OUPUT8 | PB4 | DMA1_Stream4
| 10 | TIM8_CH3 | LED | PC8 | DMA2_Stream2 LED_STRIP
| 11 | TIM1_CH2 | PWM | PA9 | FPV Camera Control(FCAM)
### Gyro & ACC ICM20689
| Value | Identifier | function | pin | Notes |
| ----- | ------------ | ---------| -------| ------------------------------------------------------------------------------------- |
| 1 | SPI1 | SCK | PA5 |
| 2 | SPI1 | MISO | PA6 |
| 3 | SPI1 | MOSI | PA7 |
| 4 | SPI1 | CS | PC4 |
### OSD MAX7456
| Value | Identifier | function | pin | Notes |
| ----- | ------------ | ---------| -------| ------------------------------------------------------------------------------------- |
| 1 | SPI3 | SCK | PC10 |
| 2 | SPI3 | MISO | PC11 |
| 3 | SPI3 | MOSI | PC12 |
| 4 | SPI3 | CS | PB14 |
### 16Mbyte flash
| Value | Identifier | function | pin | Notes |
| ----- | ------------ | ---------| -------| ------------------------------------------------------------------------------------- |
| 1 | SPI3 | SCK | PC10 |
| 2 | SPI3 | MISO | PC11 |
| 3 | SPI3 | MOSI | PC12 |
| 4 | SPI3 | CS | PB3 |
### SWD
| Pin | Function | Notes |
| --- | -------------- | -------------------------------------------- |
| 1 | SWCLK | PAD |
| 2 | Ground | PAD |
| 3 | SWDIO | PAD |
| 4 | 3V3 | PAD |
* FLYWOO TECH

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 KiB

View file

@ -59,14 +59,7 @@ COMMON_SRC = \
sensors/battery.c \
sensors/current.c \
sensors/voltage.c \
target/config_helper.c
OSD_SLAVE_SRC = \
io/displayport_max7456.c \
osd_slave/osd_slave_init.c \
io/osd_slave.c
FC_SRC = \
target/config_helper.c \
fc/fc_init.c \
fc/controlrate_profile.c \
drivers/camera_control.c \
@ -176,12 +169,7 @@ COMMON_DEVICE_SRC = \
$(CMSIS_SRC) \
$(DEVICE_STDPERIPH_SRC)
ifeq ($(OSD_SLAVE),yes)
TARGET_FLAGS := -DUSE_OSD_SLAVE $(TARGET_FLAGS)
COMMON_SRC := $(COMMON_SRC) $(OSD_SLAVE_SRC) $(COMMON_DEVICE_SRC)
else
COMMON_SRC := $(COMMON_SRC) $(FC_SRC) $(COMMON_DEVICE_SRC)
endif
COMMON_SRC := $(COMMON_SRC) $(COMMON_DEVICE_SRC)
ifeq ($(SIMULATOR_BUILD),yes)
TARGET_FLAGS := -DSIMULATOR_BUILD $(TARGET_FLAGS)

View file

@ -2,7 +2,6 @@ OFFICIAL_TARGETS = ALIENFLIGHTF3 ALIENFLIGHTF4 ANYFCF7 BETAFLIGHTF3 BLUEJAYF4 F
ALT_TARGETS = $(sort $(filter-out target, $(basename $(notdir $(wildcard $(ROOT)/src/main/target/*/*.mk)))))
NOBUILD_TARGETS = $(sort $(filter-out target, $(basename $(notdir $(wildcard $(ROOT)/src/main/target/*/*.nomk)))))
OPBL_TARGETS = $(filter %_OPBL, $(ALT_TARGETS))
OSD_SLAVE_TARGETS = SPRACINGF3OSD
VALID_TARGETS = $(dir $(wildcard $(ROOT)/src/main/target/*/target.mk))
VALID_TARGETS := $(subst /,, $(subst ./src/main/target/,, $(VALID_TARGETS)))
@ -60,14 +59,6 @@ ifeq ($(filter $(TARGET),$(OPBL_TARGETS)), $(TARGET))
OPBL = yes
endif
ifeq ($(filter $(TARGET),$(OSD_SLAVE_TARGETS)), $(TARGET))
# build an OSD SLAVE
OSD_SLAVE = yes
else
# build an FC
FC = yes
endif
# silently ignore if the file is not present. Allows for target specific.
-include $(ROOT)/src/main/target/$(BASE_TARGET)/target.mk

View file

@ -98,6 +98,11 @@ enum {
ALIGN_MAG = 2
};
enum {
ARMING_DELAYED_DISARMED = 0,
ARMING_DELAYED_NORMAL = 1,
ARMING_DELAYED_CRASHFLIP = 2
};
#define GYRO_WATCHDOG_DELAY 80 // delay for gyro sync
@ -130,7 +135,7 @@ static uint32_t disarmAt; // Time of automatic disarm when "Don't spin the m
bool isRXDataNew;
static int lastArmingDisabledReason = 0;
static timeUs_t lastDisarmTimeUs;
static bool tryingToArm;
static int tryingToArm = ARMING_DELAYED_DISARMED;
#ifdef USE_RUNAWAY_TAKEOFF
static timeUs_t runawayTakeoffDeactivateUs = 0;
@ -335,11 +340,17 @@ void tryArm(void)
}
#ifdef USE_DSHOT
if (micros() - getLastDshotBeaconCommandTimeUs() < DSHOT_BEACON_GUARD_DELAY_US) {
tryingToArm = true;
if (tryingToArm == ARMING_DELAYED_DISARMED) {
if (isModeActivationConditionPresent(BOXFLIPOVERAFTERCRASH) && IS_RC_MODE_ACTIVE(BOXFLIPOVERAFTERCRASH)) {
tryingToArm = ARMING_DELAYED_CRASHFLIP;
} else {
tryingToArm = ARMING_DELAYED_NORMAL;
}
}
return;
}
if (isMotorProtocolDshot() && isModeActivationConditionPresent(BOXFLIPOVERAFTERCRASH)) {
if (!IS_RC_MODE_ACTIVE(BOXFLIPOVERAFTERCRASH)) {
if (!(IS_RC_MODE_ACTIVE(BOXFLIPOVERAFTERCRASH) || (tryingToArm == ARMING_DELAYED_CRASHFLIP))) {
flipOverAfterCrashMode = false;
if (!feature(FEATURE_3D)) {
pwmWriteDshotCommand(ALL_MOTORS, getMotorCount(), DSHOT_CMD_SPIN_DIRECTION_NORMAL, false);
@ -1025,10 +1036,10 @@ timeUs_t getLastDisarmTimeUs(void)
bool isTryingToArm()
{
return tryingToArm;
return (tryingToArm != ARMING_DELAYED_DISARMED);
}
void resetTryingToArm()
{
tryingToArm = false;
tryingToArm = ARMING_DELAYED_DISARMED;
}

View file

@ -123,7 +123,6 @@
#include "io/asyncfatfs/asyncfatfs.h"
#include "io/transponder_ir.h"
#include "io/osd.h"
#include "io/osd_slave.h"
#include "io/pidaudio.h"
#include "io/piniobox.h"
#include "io/displayport_msp.h"

View file

@ -65,7 +65,6 @@
#include "io/gps.h"
#include "io/ledstrip.h"
#include "io/osd.h"
#include "io/osd_slave.h"
#include "io/piniobox.h"
#include "io/serial.h"
#include "io/transponder_ir.h"

View file

@ -3722,8 +3722,10 @@ const cliResourceValue_t resourceTable[] = {
#ifdef USE_SERVOS
DEFA( OWNER_SERVO, PG_SERVO_CONFIG, servoConfig_t, dev.ioTags[0], MAX_SUPPORTED_SERVOS ),
#endif
#if defined(USE_PWM) || defined(USE_PPM)
#if defined(USE_PPM)
DEFS( OWNER_PPMINPUT, PG_PPM_CONFIG, ppmConfig_t, ioTag ),
#endif
#if defined(USE_PWM)
DEFA( OWNER_PWMINPUT, PG_PWM_CONFIG, pwmConfig_t, ioTags[0], PWM_INPUT_PORT_COUNT ),
#endif
#ifdef USE_RANGEFINDER_HCSR04

View file

@ -87,7 +87,6 @@
#include "io/ledstrip.h"
#include "io/motors.h"
#include "io/osd.h"
#include "io/osd_slave.h"
#include "io/serial.h"
#include "io/serial_4way.h"
#include "io/servos.h"

View file

@ -34,7 +34,6 @@
#include "io/displayport_max7456.h"
#include "io/osd.h"
#include "io/osd_slave.h"
#include "pg/max7456.h"
#include "pg/pg.h"

View file

@ -1,176 +0,0 @@
/*
* This file is part of Cleanflight and Betaflight.
*
* Cleanflight and Betaflight are free software. You can redistribute
* this software and/or modify this software under the terms of the
* GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* Cleanflight and Betaflight are distributed in the hope that they
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
/*
Created by Dominic Clifton
*/
#include <stdbool.h>
#include <stdint.h>
#include "platform.h"
#ifdef USE_OSD_SLAVE
#include "build/debug.h"
#include "build/version.h"
#include "common/printf.h"
#include "common/utils.h"
#include "drivers/display.h"
#include "drivers/max7456_symbols.h"
#include "drivers/time.h"
#include "io/osd_slave.h"
//#define OSD_SLAVE_DEBUG
// when locked the system ignores requests to enter cli or bootloader mode via serial connection.
bool osdSlaveIsLocked = false;
static displayPort_t *osdDisplayPort;
static void osdDrawLogo(int x, int y)
{
char fontOffset = 160;
for (int row = 0; row < 4; row++) {
for (int column = 0; column < 24; column++) {
if (fontOffset != 255) // FIXME magic number
displayWriteChar(osdDisplayPort, x + column, y + row, fontOffset++);
}
}
}
bool displayDrawScreenQueued = false;
bool receivingScreen = false;
bool stalled = false;
void osdSlaveDrawScreen(void)
{
displayDrawScreenQueued = true;
}
static uint32_t timeoutAt = 0;
void osdSlaveClearScreen(void)
{
displayClearScreen(osdDisplayPort);
receivingScreen = true;
}
void osdSlaveWriteChar(const uint8_t x, const uint8_t y, const uint8_t c)
{
displayWriteChar(osdDisplayPort, x, y, c);
}
void osdSlaveWrite(const uint8_t x, const uint8_t y, const char *s)
{
displayWrite(osdDisplayPort, x, y, s);
}
void osdSlaveHeartbeat(void)
{
timeoutAt = micros() + (1000 * 1000);
if (stalled) {
stalled = false;
displayResync(osdDisplayPort);
}
}
void osdSlaveInit(displayPort_t *osdDisplayPortToUse)
{
if (!osdDisplayPortToUse)
return;
osdDisplayPort = osdDisplayPortToUse;
delay(100); // need max7456 to be ready before using the displayPort API further.
displayClearScreen(osdDisplayPort);
displayResync(osdDisplayPort);
delay(100); // wait a little for video to stabilise
osdDrawLogo(3, 1);
char string_buffer[30];
tfp_sprintf(string_buffer, "V%s", FC_VERSION_STRING);
displayWrite(osdDisplayPort, 20, 6, string_buffer);
displayWrite(osdDisplayPort, 13, 6, "OSD");
displayResync(osdDisplayPort);
}
bool osdSlaveInitialized(void)
{
return osdDisplayPort;
}
bool osdSlaveCheck(timeUs_t currentTimeUs, timeDelta_t currentDeltaTimeUs)
{
UNUSED(currentTimeUs);
UNUSED(currentDeltaTimeUs);
if (!stalled && (cmp32(currentTimeUs, timeoutAt) > 0)) {
stalled = true;
displayWrite(osdDisplayPort, 8, 12, "WAITING FOR FC");
displayResync(osdDisplayPort);
}
if (!receivingScreen && !displayIsSynced(osdDisplayPort)) {
// queue a screen draw to ensure any remaining characters not written to the screen yet
// remember that displayDrawScreen() may return WITHOUT having fully updated the screen.
displayDrawScreenQueued = true;
}
return receivingScreen || displayDrawScreenQueued;
}
/*
* Called periodically by the scheduler
*/
void osdSlaveUpdate(timeUs_t currentTimeUs)
{
UNUSED(currentTimeUs);
#ifdef MAX7456_DMA_CHANNEL_TX
// don't touch buffers if DMA transaction is in progress
if (displayIsTransferInProgress(osdDisplayPort)) {
return;
}
#endif // MAX7456_DMA_CHANNEL_TX
#ifdef OSD_SLAVE_DEBUG
char buff[32];
for (int i = 0; i < 4; i ++) {
tfp_sprintf(buff, "%5d", debug[i]);
displayWrite(osdDisplayPort, i * 8, 0, buff);
}
#endif
if (displayDrawScreenQueued) {
displayDrawScreen(osdDisplayPort);
displayDrawScreenQueued = false;
receivingScreen = false;
}
}
#endif // OSD_SLAVE

View file

@ -1,46 +0,0 @@
/*
* This file is part of Cleanflight and Betaflight.
*
* Cleanflight and Betaflight are free software. You can redistribute
* this software and/or modify this software under the terms of the
* GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* Cleanflight and Betaflight are distributed in the hope that they
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifdef USE_OSD_SLAVE
#include "common/time.h"
struct displayPort_s;
extern bool osdSlaveIsLocked;
// init
void osdSlaveInit(struct displayPort_s *osdDisplayPort);
bool osdSlaveInitialized(void);
// task api
bool osdSlaveCheck(timeUs_t currentTimeUs, timeDelta_t currentDeltaTimeUs);
void osdSlaveUpdate(timeUs_t currentTimeUs);
// msp api
void osdSlaveHeartbeat(void);
void osdSlaveClearScreen(void);
void osdSlaveWriteChar(const uint8_t x, const uint8_t y, const uint8_t c);
void osdSlaveWrite(const uint8_t x, const uint8_t y, const char *s);
void osdSlaveDrawScreen(void);
#endif

View file

@ -1,308 +0,0 @@
/*
* This file is part of Cleanflight and Betaflight.
*
* Cleanflight and Betaflight are free software. You can redistribute
* this software and/or modify this software under the terms of the
* GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* Cleanflight and Betaflight are distributed in the hope that they
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "platform.h"
#include "blackbox/blackbox.h"
#include "common/axis.h"
#include "common/color.h"
#include "common/maths.h"
#include "common/printf.h"
#include "config/config_eeprom.h"
#include "config/feature.h"
#include "drivers/adc.h"
#include "drivers/bus.h"
#include "drivers/bus_i2c.h"
#include "drivers/bus_spi.h"
#include "drivers/dma.h"
#include "drivers/exti.h"
#include "drivers/inverter.h"
#include "drivers/io.h"
#include "drivers/light_led.h"
#include "drivers/nvic.h"
#include "drivers/sensor.h"
#include "drivers/serial.h"
#include "drivers/serial_softserial.h"
#include "drivers/serial_uart.h"
#include "drivers/sound_beeper.h"
#include "drivers/system.h"
#include "drivers/time.h"
#include "drivers/timer.h"
#include "drivers/transponder_ir.h"
#include "drivers/usb_io.h"
#include "fc/config.h"
#include "fc/rc_controls.h"
#include "fc/fc_tasks.h"
#include "fc/runtime_config.h"
#include "interface/cli.h"
#include "interface/msp.h"
#include "msp/msp_serial.h"
#include "io/beeper.h"
#include "io/displayport_max7456.h"
#include "io/flashfs.h"
#include "io/ledstrip.h"
#include "io/osd_slave.h"
#include "io/serial.h"
#include "io/transponder_ir.h"
#include "osd_slave/osd_slave_init.h"
#include "pg/adc.h"
#include "pg/bus_i2c.h"
#include "pg/bus_spi.h"
#include "pg/pg.h"
#include "pg/pg_ids.h"
#include "pg/vcd.h"
#include "scheduler/scheduler.h"
#include "sensors/acceleration.h"
#include "sensors/barometer.h"
#include "sensors/battery.h"
#ifdef USE_HARDWARE_REVISION_DETECTION
#include "hardware_revision.h"
#endif
#include "build/build_config.h"
#include "build/debug.h"
#ifdef TARGET_PREINIT
void targetPreInit(void);
#endif
uint8_t systemState = SYSTEM_STATE_INITIALISING;
void processLoopback(void)
{
}
#ifdef BUS_SWITCH_PIN
void busSwitchInit(void)
{
static IO_t busSwitchResetPin = IO_NONE;
busSwitchResetPin = IOGetByTag(IO_TAG(BUS_SWITCH_PIN));
IOInit(busSwitchResetPin, OWNER_SYSTEM, 0);
IOConfigGPIO(busSwitchResetPin, IOCFG_OUT_PP);
// ENABLE
IOLo(busSwitchResetPin);
}
#endif
void init(void)
{
#ifdef USE_HAL_DRIVER
HAL_Init();
#endif
printfSupportInit();
systemInit();
// initialize IO (needed for all IO operations)
IOInitGlobal();
#ifdef USE_HARDWARE_REVISION_DETECTION
detectHardwareRevision();
#endif
initEEPROM();
ensureEEPROMStructureIsValid();
readEEPROM();
systemState |= SYSTEM_STATE_CONFIG_LOADED;
debugMode = systemConfig()->debug_mode;
// Latch active features to be used for feature() in the remainder of init().
latchActiveFeatures();
#ifdef TARGET_PREINIT
targetPreInit();
#endif
ledInit(statusLedConfig());
LED2_ON;
#ifdef USE_EXTI
EXTIInit();
#endif
delay(100);
timerInit(); // timer must be initialized before any channel is allocated
#ifdef BUS_SWITCH_PIN
busSwitchInit();
#endif
#if defined(USE_UART) && !defined(SIMULATOR_BUILD)
uartPinConfigure(serialPinConfig());
#endif
serialInit(false, SERIAL_PORT_NONE);
#ifdef USE_BEEPER
beeperInit(beeperDevConfig());
#endif
/* temp until PGs are implemented. */
#ifdef USE_INVERTER
initInverters();
#endif
#ifdef TARGET_BUS_INIT
targetBusInit();
#else
#ifdef USE_SPI
spiPinConfigure(spiPinConfig(0));
// Initialize CS lines and keep them high
spiPreInit();
#ifdef USE_SPI_DEVICE_1
spiInit(SPIDEV_1);
#endif
#ifdef USE_SPI_DEVICE_2
spiInit(SPIDEV_2);
#endif
#ifdef USE_SPI_DEVICE_3
spiInit(SPIDEV_3);
#endif
#ifdef USE_SPI_DEVICE_4
spiInit(SPIDEV_4);
#endif
#endif /* USE_SPI */
#ifdef USE_I2C
i2cHardwareConfigure(i2cConfig(0));
// Note: Unlike UARTs which are configured when client is present,
// I2C buses are initialized unconditionally if they are configured.
#ifdef USE_I2C_DEVICE_1
i2cInit(I2CDEV_1);
#endif
#ifdef USE_I2C_DEVICE_2
i2cInit(I2CDEV_2);
#endif
#ifdef USE_I2C_DEVICE_3
i2cInit(I2CDEV_3);
#endif
#ifdef USE_I2C_DEVICE_4
i2cInit(I2CDEV_4);
#endif
#endif /* USE_I2C */
#endif /* TARGET_BUS_INIT */
#ifdef USE_HARDWARE_REVISION_DETECTION
updateHardwareRevision();
#endif
#ifdef USE_ADC
adcConfigMutable()->vbat.enabled = (batteryConfig()->voltageMeterSource == VOLTAGE_METER_ADC);
adcConfigMutable()->current.enabled = (batteryConfig()->currentMeterSource == CURRENT_METER_ADC);
adcConfigMutable()->rssi.enabled = feature(FEATURE_RSSI_ADC);
adcInit(adcConfig());
#endif
LED1_ON;
LED0_OFF;
LED2_OFF;
for (int i = 0; i < 10; i++) {
LED1_TOGGLE;
LED0_TOGGLE;
#if defined(USE_BEEPER)
delay(25);
if (!(beeperConfig()->beeper_off_flags & BEEPER_GET_FLAG(BEEPER_SYSTEM_INIT))) BEEP_ON;
delay(25);
BEEP_OFF;
#else
delay(50);
#endif
}
LED0_OFF;
LED1_OFF;
mspInit();
mspSerialInit();
#ifdef USE_CLI
cliInit(serialConfig());
#endif
displayPort_t *osdDisplayPort = NULL;
#if defined(USE_MAX7456)
// If there is a max7456 chip for the OSD then use it
osdDisplayPort = max7456DisplayPortInit(vcdProfile());
// osdInit will register with CMS by itself.
osdSlaveInit(osdDisplayPort);
#endif
#ifdef USE_LED_STRIP
ledStripInit();
if (feature(FEATURE_LED_STRIP)) {
ledStripEnable();
}
#endif
#ifdef USE_USB_DETECT
usbCableDetectInit();
#endif
#ifdef USE_TRANSPONDER
if (feature(FEATURE_TRANSPONDER)) {
transponderInit();
transponderStartRepeating();
systemState |= SYSTEM_STATE_TRANSPONDER_ENABLED;
}
#endif
timerStart();
batteryInit();
// Latch active features AGAIN since some may be modified by init().
latchActiveFeatures();
fcTasksInit();
systemState |= SYSTEM_STATE_READY;
}

View file

@ -1,32 +0,0 @@
/*
* This file is part of Cleanflight and Betaflight.
*
* Cleanflight and Betaflight are free software. You can redistribute
* this software and/or modify this software under the terms of the
* GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* Cleanflight and Betaflight are distributed in the hope that they
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
typedef enum {
SYSTEM_STATE_INITIALISING = 0,
SYSTEM_STATE_CONFIG_LOADED = (1 << 0),
SYSTEM_STATE_TRANSPONDER_ENABLED = (1 << 3),
SYSTEM_STATE_READY = (1 << 7)
} systemState_e;
extern uint8_t systemState;
void init(void);

View file

@ -106,12 +106,7 @@
#error "Invalid chipset specified. Update platform.h"
#endif
#ifdef USE_OSD_SLAVE
#include "target/common_osd_slave.h"
#include "target.h"
#else
#include "target/common_fc_pre.h"
#include "target.h"
#include "target/common_fc_post.h"
#endif
#include "target/common_defaults_post.h"

View file

@ -136,6 +136,7 @@
#define RSSI_ADC_PIN PA0
#define CURRENT_METER_SCALE_DEFAULT 166
#define VBAT_SCALE_DEFAULT 160
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC

View file

@ -39,6 +39,7 @@ const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = {
#endif
DEF_TIM(TIM4, CH4, PB9, TIM_USE_PPM, 0, 0 ), // PPM IN
#if defined(FF_FORTINIF4_REV03)
DEF_TIM(TIM4, CH2, PB7, TIM_USE_ANY, 0, 0 ), // FC CAM - DMA1_ST3
DEF_TIM(TIM4, CH1, PB6, TIM_USE_LED, 0, 0 ), // LED - DMA1_ST0
#else
DEF_TIM(TIM4, CH2, PB7, TIM_USE_LED, 0, 0 ), // LED - DMA1_ST3

View file

@ -226,6 +226,10 @@
/*---------------------------------*/
/*--------------TIMERS-------------*/
#if defined(FF_FORTINIF4_REV03)
#define USABLE_TIMER_CHANNEL_COUNT 7
#else
#define USABLE_TIMER_CHANNEL_COUNT 6
#endif
#define USED_TIMERS ( TIM_N(2) | TIM_N(3) | TIM_N(4) )
/*---------------------------------*/

View file

@ -0,0 +1 @@
#FLYWOOF405.mk file

View file

@ -27,13 +27,28 @@
#include "drivers/timer_def.h"
const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = {
#if defined(FLYWOOF405)
DEF_TIM(TIM10, CH1, PB8, TIM_USE_PPM, 0, 0), // PPM IN
DEF_TIM(TIM3, CH3, PB0, TIM_USE_MOTOR, 0, 0), // S1_OUT - DMA1_ST7
DEF_TIM(TIM3, CH4, PB1, TIM_USE_MOTOR, 0, 0), // S2_OUT - DMA1_ST2
DEF_TIM(TIM2, CH4, PA3, TIM_USE_MOTOR, 0, 1), // S3_OUT - DMA1_ST6
DEF_TIM(TIM2, CH3, PA2, TIM_USE_MOTOR, 0, 0), // S4_OUT - DMA1_ST1
DEF_TIM(TIM3, CH2, PB5, TIM_USE_MOTOR, 0, 0), // S5_OUT - DMA1_ST5
DEF_TIM(TIM4, CH2, PB7, TIM_USE_MOTOR, 0, 0), // S6_OUT - DMA1_ST3
DEF_TIM(TIM8, CH4, PC9, TIM_USE_MOTOR, 0, 0), // S7_OUT - DMA2_ST7
DEF_TIM(TIM3, CH1, PB4, TIM_USE_MOTOR, 0, 0), // S8_OUT - DMA1_ST4
DEF_TIM(TIM8, CH3, PC8, TIM_USE_LED, 0, 0), // LED_STRIP - DMA2_ST2
#else
DEF_TIM(TIM8, CH2, PC7, TIM_USE_PPM, 0, 0), // PPM IN
DEF_TIM(TIM3, CH3, PB0, TIM_USE_MOTOR, 0, 0), // S1_OUT - DMA1_ST7
DEF_TIM(TIM3, CH4, PB1, TIM_USE_MOTOR, 0, 0), // S2_OUT - DMA1_ST2
DEF_TIM(TIM2, CH4, PA3, TIM_USE_MOTOR, 0, 1), // S3_OUT - DMA1_ST6
DEF_TIM(TIM2, CH3, PA2, TIM_USE_MOTOR, 0, 0), // S4_OUT - DMA1_ST1
#endif
#if defined(KAKUTEF4V2)
DEF_TIM(TIM8, CH3, PC8, TIM_USE_LED, 0, 0), // LED_STRIP - DMA2_ST2
#elif defined(FLYWOOF405)
DEF_TIM(TIM1, CH2, PA9, TIM_USE_PWM, 0, 0), // FC CAM
#else
DEF_TIM(TIM5, CH1, PA0, TIM_USE_MOTOR, 0, 0), // S5_OUT - DMA1_ST2
DEF_TIM(TIM8, CH3, PC8, TIM_USE_MOTOR, 0, 1), // S6_OUT - DMA2_ST4

View file

@ -22,6 +22,9 @@
#if defined(KAKUTEF4V2)
#define TARGET_BOARD_IDENTIFIER "KTV2"
#define USBD_PRODUCT_STRING "KakuteF4-V2"
#elif defined(FLYWOOF405)
#define TARGET_BOARD_IDENTIFIER "FWF4"
#define USBD_PRODUCT_STRING "FLYWOOF405"
#else
#define TARGET_BOARD_IDENTIFIER "KTV1"
#define USBD_PRODUCT_STRING "KakuteF4-V1"
@ -29,12 +32,25 @@
#define USE_TARGET_CONFIG
#if defined(FLYWOOF405)
#define LED0_PIN PC14
#else
#define LED0_PIN PB5
#define LED1_PIN PB4
#define LED2_PIN PB6
#endif
#define USE_BEEPER
#if defined(FLYWOOF405)
//define camera control
#define CAMERA_CONTROL_PIN PA9
#define BEEPER_PIN PC13
#else
#define BEEPER_PIN PC9
#endif
#define BEEPER_INVERTED
#define INVERTER_PIN_UART3 PB15
@ -56,11 +72,27 @@
#define USE_GYRO_SPI_ICM20689
#define GYRO_ICM20689_ALIGN CW270_DEG
#ifdef KAKUTEF4V2 // There is invertor on RXD3(PB11), so PB10/PB11 can't be used as I2C2.
#if defined(FLYWOOF405)
//------MPU6000
#define MPU6000_CS_PIN PC4
#define MPU6000_SPI_INSTANCE SPI1
#define USE_GYRO_SPI_MPU6000
#define GYRO_MPU6000_ALIGN CW270_DEG
#define USE_ACC_SPI_MPU6000
#define ACC_MPU6000_ALIGN CW270_DEG
#endif
#if defined(KAKUTEF4V2) || defined(FLYWOOF405) // There is invertor on RXD3(PB11), so PB10/PB11 can't be used as I2C2.
#define USE_I2C //No other I2C pins are fanned out, So V1 don't support I2C peripherals.
#define USE_I2C_DEVICE_1
#define I2C_DEVICE (I2CDEV_1)
#if defined(FLYWOOF405)
#define I2C1_SCL PB6
#else
#define I2C1_SCL PB8 // SCL pad
#endif
#define I2C1_SDA PB9 // SDA pad
#define BARO_I2C_INSTANCE I2C_DEVICE
#define MAG_I2C_INSTANCE I2C_DEVICE
@ -80,7 +112,6 @@
#define MAX7456_SPI_CS_PIN PB14
#define MAX7456_SPI_CLK (SPI_CLOCK_STANDARD)
#define MAX7456_RESTORE_CLK (SPI_CLOCK_FAST)
#define FLASH_CS_PIN PB3
#define FLASH_SPI_INSTANCE SPI3
@ -93,7 +124,13 @@
#define USE_UART1
#define UART1_RX_PIN PA10
#if defined (FLYWOOF405)
#define UART1_TX_PIN PB6 //SCL/UART1_TX/TIM4_CH1
#else
#define UART1_TX_PIN PA9
#endif
#define UART1_AHB1_PERIPHERALS RCC_AHB1Periph_DMA2
#define USE_UART3
@ -104,7 +141,7 @@
#define UART6_RX_PIN PC7
#define UART6_TX_PIN PC6
#ifdef KAKUTEF4V2 // Uart4 and Uart5 are fanned out on v2
#if defined (KAKUTEF4V2) || defined(FLYWOOF405) // Uart4 and Uart5 are fanned out on v2
#define USE_UART4 // Uart4 can be used for GPS or RunCam Split
#define UART4_RX_PIN PA1
#define UART4_TX_PIN PA0
@ -122,10 +159,14 @@
#endif
#define USE_ESCSERIAL
#if defined(FLYWOOF405)
#define ESCSERIAL_TIMER_TX_PIN PB8
#else
#define ESCSERIAL_TIMER_TX_PIN PC7 // (HARDARE=0,PPM)
#endif
#define USE_SPI
#define USE_SPI_DEVICE_1 //ICM20689
#define SPI1_NSS_PIN PC4
#define SPI1_SCK_PIN PA5
@ -157,9 +198,12 @@
#define TARGET_IO_PORTC 0xffff
#define TARGET_IO_PORTD (BIT(2))
#ifdef KAKUTEF4V2
#if defined (KAKUTEF4V2)
#define USABLE_TIMER_CHANNEL_COUNT 6
#define USED_TIMERS ( TIM_N(2) | TIM_N(3) | TIM_N(8))
#elif defined(FLYWOOF405)
#define USABLE_TIMER_CHANNEL_COUNT 11
#define USED_TIMERS ( TIM_N(2) | TIM_N(3) | TIM_N(4)| TIM_N(8))
#else
#define USABLE_TIMER_CHANNEL_COUNT 8
#define USED_TIMERS ( TIM_N(2) | TIM_N(3) | TIM_N(5) | TIM_N(8))

View file

@ -9,3 +9,7 @@ TARGET_SRC = \
drivers/compass/compass_hmc5883l.c \
drivers/compass/compass_qmc5883l.c \
drivers/max7456.c
ifeq ($(TARGET), FLYWOOF405)
TARGET_SRC += drivers/accgyro/accgyro_spi_mpu6000.c
endif

View file

@ -1,39 +0,0 @@
/*
* This file is part of Cleanflight and Betaflight.
*
* Cleanflight and Betaflight are free software. You can redistribute
* this software and/or modify this software under the terms of the
* GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* Cleanflight and Betaflight are distributed in the hope that they
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdbool.h>
#include <stdint.h>
#include "platform.h"
#include "drivers/serial.h"
#include "io/serial.h"
#include "config/feature.h"
#include "fc/config.h"
#ifdef USE_TARGET_CONFIG
void targetConfiguration(void)
{
serialConfigMutable()->portConfigs[1].functionMask = FUNCTION_MSP; // To connect to FC.
}
#endif

View file

@ -1,38 +0,0 @@
/*
* This file is part of Cleanflight and Betaflight.
*
* Cleanflight and Betaflight are free software. You can redistribute
* this software and/or modify this software under the terms of the
* GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* Cleanflight and Betaflight are distributed in the hope that they
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include "platform.h"
#include "drivers/io.h"
#include "drivers/timer.h"
#include "drivers/timer_def.h"
#include "drivers/dma.h"
const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = {
DEF_TIM(TIM3, CH3, PB0, TIM_USE_MOTOR, 0), // DMA1_Channel2
DEF_TIM(TIM3, CH4, PB1, TIM_USE_MOTOR, 0), // DMA1_Channel4
DEF_TIM(TIM16, CH1, PB4, TIM_USE_MOTOR, 0), // DMA1_Channel3 or DMA1_Channel6 with Remap (need remap to free SPI1_TX for Flash)
DEF_TIM(TIM17, CH1, PB5, TIM_USE_MOTOR, 0), // DMA1_Channel1 or DMA1_Channel7 with Remap (need remap, ADC1 is on DMA1_Channel1)
DEF_TIM(TIM1, CH1, PA8, TIM_USE_TRANSPONDER, 0),
};

View file

@ -1,103 +0,0 @@
/*
* This file is part of Cleanflight and Betaflight.
*
* Cleanflight and Betaflight are free software. You can redistribute
* this software and/or modify this software under the terms of the
* GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* Cleanflight and Betaflight are distributed in the hope that they
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#define TARGET_BOARD_IDENTIFIER "SOF3"
#define USE_TARGET_CONFIG
#define LED0_PIN PA15
#define USE_EXTI
#define USE_GYRO
#define USE_FAKE_GYRO
#define USE_ACC
#define USE_FAKE_ACC
#define REMAP_TIM16_DMA
#define REMAP_TIM17_DMA
#define USE_VCP
#define USE_UART1
#define USE_UART3
#define SERIAL_PORT_COUNT 3
#define UART1_TX_PIN PA9
#define UART1_RX_PIN PA10
#define BUS_SWITCH_PIN PB3 // connects and disconnects UART1 from external devices
#define UART3_TX_PIN PB10
#define UART3_RX_PIN PB11
#define USE_I2C
#define USE_I2C_DEVICE_1
#define I2C_DEVICE (I2CDEV_1)
#define USE_SPI
#define USE_SPI_DEVICE_1 // Flash Chip
#define USE_SPI_DEVICE_2 // MAX7456
#define SPI1_NSS_PIN PA4
#define SPI1_SCK_PIN PA5
#define SPI1_MISO_PIN PA6
#define SPI1_MOSI_PIN PA7
#define SPI2_NSS_PIN PB12
#define SPI2_SCK_PIN PB13
#define SPI2_MISO_PIN PB14
#define SPI2_MOSI_PIN PB15
#define USE_MAX7456
#define MAX7456_SPI_INSTANCE SPI2
#define MAX7456_SPI_CS_PIN SPI2_NSS_PIN
#define MAX7456_NRST_PIN PB2
#define MAX7456_DMA_CHANNEL_TX DMA1_Channel5
#define MAX7456_DMA_CHANNEL_RX DMA1_Channel4
#define MAX7456_DMA_IRQ_HANDLER_ID DMA1_CH4_HANDLER
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define USE_ADC
#define ADC_INSTANCE ADC1
#define VBAT_ADC_PIN PA2
#define CURRENT_METER_ADC_PIN PA3
#define VOLTAGE_12V_ADC_PIN PA0
#define VOLTAGE_5V_ADC_PIN PA1
#define USE_TRANSPONDER
#define DEFAULT_FEATURES (FEATURE_TRANSPONDER)
// IO - assuming 303 in 64pin package, TODO
#define TARGET_IO_PORTA 0xffff
#define TARGET_IO_PORTB 0xffff
#define TARGET_IO_PORTC 0xffff
#define TARGET_IO_PORTD (BIT(2))
#define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(4))
#define USABLE_TIMER_CHANNEL_COUNT 12 // 2xPPM, 6xPWM, UART3 RX/TX, LED Strip, IR.
#define USED_TIMERS (TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(8) | TIM_N(15) | TIM_N(16))

View file

@ -1,6 +0,0 @@
F3_TARGETS += $(TARGET)
FEATURES = VCP SDCARD
TARGET_SRC = \
drivers/accgyro/accgyro_fake.c \
drivers/max7456.c

View file

@ -1,68 +0,0 @@
/*
* This file is part of Cleanflight and Betaflight.
*
* Cleanflight and Betaflight are free software. You can redistribute
* this software and/or modify this software under the terms of the
* GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* Cleanflight and Betaflight are distributed in the hope that they
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#define USE_PARAMETER_GROUPS
// type conversion warnings.
// -Wconversion can be turned on to enable the process of eliminating these warnings
//#pragma GCC diagnostic warning "-Wconversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
// -Wpadded can be turned on to check padding of structs
//#pragma GCC diagnostic warning "-Wpadded"
//#define SCHEDULER_DEBUG // define this to use scheduler debug[] values. Undefined by default for performance reasons
#define DEBUG_MODE DEBUG_NONE // change this to change initial debug mode
#define I2C1_OVERCLOCK true
#define I2C2_OVERCLOCK true
#define MAX_PROFILE_COUNT 0
#ifdef STM32F1
#define MINIMAL_CLI
#endif
#ifdef STM32F3
#define MINIMAL_CLI
#endif
#ifdef STM32F4
#define I2C3_OVERCLOCK true
#endif
#ifdef STM32F7
#define I2C3_OVERCLOCK true
#define I2C4_OVERCLOCK true
#endif
#if defined(STM32F4) || defined(STM32F7)
#define SCHEDULER_DELAY_LIMIT 10
#else
#define SCHEDULER_DELAY_LIMIT 100
#endif
#define FAST_CODE
#define FAST_CODE_NOINLINE
#define FAST_RAM_ZERO_INIT
#define FAST_RAM
//CLI needs FC dependencies removed before we can compile it, disabling for now
//#define USE_CLI