mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 13:25:30 +03:00
Merge pull request #3607 from AlienWiiBF/FortiniF4
Support for FORTINIF4 OSD revision
This commit is contained in:
commit
3cd73f1a29
5 changed files with 105 additions and 1 deletions
|
@ -21,10 +21,20 @@
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
|
|
||||||
#ifdef TARGET_CONFIG
|
#ifdef TARGET_CONFIG
|
||||||
|
#include "fc/config.h"
|
||||||
|
|
||||||
|
#include "config/feature.h"
|
||||||
|
|
||||||
#include "telemetry/telemetry.h"
|
#include "telemetry/telemetry.h"
|
||||||
|
|
||||||
|
#include "hardware_revision.h"
|
||||||
|
|
||||||
void targetConfiguration(void)
|
void targetConfiguration(void)
|
||||||
{
|
{
|
||||||
|
if (hardwareRevision == FORTINIF4_REV_2) {
|
||||||
|
featureSet(FEATURE_OSD);
|
||||||
|
}
|
||||||
|
|
||||||
telemetryConfigMutable()->halfDuplex = false;
|
telemetryConfigMutable()->halfDuplex = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
53
src/main/target/FF_FORTINIF4/hardware_revision.c
Normal file
53
src/main/target/FF_FORTINIF4/hardware_revision.c
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Cleanflight.
|
||||||
|
*
|
||||||
|
* Cleanflight is free software: you can redistribute it and/or modify
|
||||||
|
* it 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 is distributed in the hope that it 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 Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
|
#include "build/build_config.h"
|
||||||
|
|
||||||
|
#include "drivers/io.h"
|
||||||
|
#include "drivers/time.h"
|
||||||
|
|
||||||
|
#include "hardware_revision.h"
|
||||||
|
|
||||||
|
uint8_t hardwareRevision = FORTINIF4_UNKNOWN;
|
||||||
|
|
||||||
|
static IO_t HWDetectPin = IO_NONE;
|
||||||
|
|
||||||
|
void detectHardwareRevision(void)
|
||||||
|
{
|
||||||
|
HWDetectPin = IOGetByTag(IO_TAG(HW_PIN));
|
||||||
|
IOInit(HWDetectPin, OWNER_SYSTEM, 0);
|
||||||
|
IOConfigGPIO(HWDetectPin, IOCFG_IPU);
|
||||||
|
|
||||||
|
delayMicroseconds(10); // allow configuration to settle
|
||||||
|
|
||||||
|
// Check hardware revision
|
||||||
|
if (IORead(HWDetectPin)) {
|
||||||
|
hardwareRevision = FORTINIF4_REV_1;
|
||||||
|
} else {
|
||||||
|
hardwareRevision = FORTINIF4_REV_2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateHardwareRevision(void)
|
||||||
|
{
|
||||||
|
}
|
28
src/main/target/FF_FORTINIF4/hardware_revision.h
Normal file
28
src/main/target/FF_FORTINIF4/hardware_revision.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Cleanflight.
|
||||||
|
*
|
||||||
|
* Cleanflight is free software: you can redistribute it and/or modify
|
||||||
|
* it 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 is distributed in the hope that it 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 Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
typedef enum ftf4HardwareRevision_t {
|
||||||
|
FORTINIF4_UNKNOWN = 0,
|
||||||
|
FORTINIF4_REV_1, // SPI Flash
|
||||||
|
FORTINIF4_REV_2 // OSD
|
||||||
|
} ftf4HardwareRevision_e;
|
||||||
|
|
||||||
|
extern uint8_t hardwareRevision;
|
||||||
|
|
||||||
|
void updateHardwareRevision(void);
|
||||||
|
void detectHardwareRevision(void);
|
|
@ -19,6 +19,8 @@
|
||||||
#define TARGET_BOARD_IDENTIFIER "FORT"
|
#define TARGET_BOARD_IDENTIFIER "FORT"
|
||||||
#define USBD_PRODUCT_STRING "FortiniF4"
|
#define USBD_PRODUCT_STRING "FortiniF4"
|
||||||
#define TARGET_CONFIG
|
#define TARGET_CONFIG
|
||||||
|
#define USE_HARDWARE_REVISION_DETECTION
|
||||||
|
#define HW_PIN PC14
|
||||||
/*--------------LED----------------*/
|
/*--------------LED----------------*/
|
||||||
#define LED0_PIN PB5
|
#define LED0_PIN PB5
|
||||||
#define LED1_PIN PB6
|
#define LED1_PIN PB6
|
||||||
|
@ -80,6 +82,15 @@
|
||||||
#define USE_FLASH_M25P16
|
#define USE_FLASH_M25P16
|
||||||
/*---------------------------------*/
|
/*---------------------------------*/
|
||||||
|
|
||||||
|
/*-------------OSD-----------------*/
|
||||||
|
#define OSD
|
||||||
|
#define USE_MAX7456
|
||||||
|
#define MAX7456_SPI_INSTANCE SPI3
|
||||||
|
#define MAX7456_SPI_CS_PIN PB3
|
||||||
|
#define MAX7456_SPI_CLK (SPI_CLOCK_STANDARD*2)
|
||||||
|
#define MAX7456_RESTORE_CLK (SPI_CLOCK_FAST)
|
||||||
|
/*---------------------------------*/
|
||||||
|
|
||||||
/*-----------USB-UARTs-------------*/
|
/*-----------USB-UARTs-------------*/
|
||||||
#define USE_VCP
|
#define USE_VCP
|
||||||
//#define VBUS_SENSING_PIN PA8
|
//#define VBUS_SENSING_PIN PA8
|
||||||
|
|
|
@ -5,4 +5,6 @@ TARGET_SRC = \
|
||||||
drivers/accgyro/accgyro_spi_mpu6000.c \
|
drivers/accgyro/accgyro_spi_mpu6000.c \
|
||||||
drivers/accgyro/accgyro_mpu6500.c \
|
drivers/accgyro/accgyro_mpu6500.c \
|
||||||
drivers/accgyro/accgyro_spi_mpu6500.c \
|
drivers/accgyro/accgyro_spi_mpu6500.c \
|
||||||
drivers/accgyro/accgyro_spi_icm20689.c
|
drivers/accgyro/accgyro_spi_icm20689.c \
|
||||||
|
drivers/max7456.c
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue