Skip to content

Commit

Permalink
Merge pull request #9281 from iNavFlight/mmosca-f435
Browse files Browse the repository at this point in the history
BETAFPVF435 unofficial target
  • Loading branch information
mmosca authored Sep 8, 2023
2 parents eceabdb + 2141596 commit b78319c
Show file tree
Hide file tree
Showing 5 changed files with 288 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/io/ledstrip.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ typedef struct ledStripConfig_s {
PG_DECLARE(ledStripConfig_t, ledStripConfig);

#define DEFINE_LED(ledConfigPtr, x, y, col, dir, func, ol, params) { \
ledConfigPtr->led_position = CALCULATE_LED_XY(x, y); \
ledConfigPtr->led_color = (col); \
ledConfigPtr->led_direction = (dir); \
ledConfigPtr->led_function = (func); \
ledConfigPtr->led_overlay = (ol); \
ledConfigPtr->led_params = (params); }
(ledConfigPtr)->led_position = CALCULATE_LED_XY(x, y); \
(ledConfigPtr)->led_color = (col); \
(ledConfigPtr)->led_direction = (dir); \
(ledConfigPtr)->led_function = (func); \
(ledConfigPtr)->led_overlay = (ol); \
(ledConfigPtr)->led_params = (params); }

static inline uint8_t ledGetXY(const ledConfig_t *lcfg) { return (lcfg->led_position); }
static inline uint8_t ledGetX(const ledConfig_t *lcfg) { return ((lcfg->led_position >> (LED_X_BIT_OFFSET)) & LED_XY_MASK); }
Expand Down
1 change: 1 addition & 0 deletions src/main/target/BETAFPVF435/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target_at32f43x_xGT7(BETAFPVF435 SKIP_RELEASES)
36 changes: 36 additions & 0 deletions src/main/target/BETAFPVF435/config.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* This file is part of INAV.
*
* INAV 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.
*
* INAV 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 INAV. If not, see <http://www.gnu.org/licenses/>.
*
* This target has been autgenerated by bf2inav.py
*/

#include <stdint.h>

#include "platform.h"

#include "fc/fc_msp_box.h"
#include "fc/config.h"

#include "io/ledstrip.h"

void targetConfiguration(void)
{
ledStripConfig_t *config = ledStripConfigMutable();
ledConfig_t *lc = config->ledConfigs;
DEFINE_LED(lc, 0, 0, COLOR_RED, 0, LED_FUNCTION_COLOR, LED_FLAG_OVERLAY(LED_OVERLAY_STROBE), 0);
DEFINE_LED(lc+1, 0, 1, COLOR_GREEN, 0, LED_FUNCTION_COLOR, LED_FLAG_OVERLAY(LED_OVERLAY_STROBE), 0);
}

44 changes: 44 additions & 0 deletions src/main/target/BETAFPVF435/target.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* This file is part of INAV.
*
* INAV 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.
*
* INAV 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/bus.h"
#include "drivers/io.h"
#include "drivers/pwm_mapping.h"
#include "drivers/timer.h"
#include "drivers/pinio.h"
#include "drivers/sensor.h"

timerHardware_t timerHardware[] = {
DEF_TIM(TMR3, CH3, PB0, TIM_USE_MC_MOTOR | TIM_USE_FW_MOTOR, 0, 1), // TMR3_CH3 motor 1
DEF_TIM(TMR3, CH4, PB1, TIM_USE_MC_MOTOR | TIM_USE_FW_MOTOR, 0, 2), // TMR3_CH4 motor 2
DEF_TIM(TMR2, CH4, PA3, TIM_USE_MC_MOTOR | TIM_USE_FW_MOTOR, 0, 7), // TMR2_CH4 motor 3
DEF_TIM(TMR2, CH3, PA2, TIM_USE_MC_MOTOR | TIM_USE_FW_MOTOR, 0, 6), // TMR2_CH3 motor 4

DEF_TIM(TMR8, CH3, PC8, TIM_USE_MC_MOTOR | TIM_USE_MC_SERVO |TIM_USE_FW_MOTOR | TIM_USE_FW_SERVO | TIM_USE_ANY, 0, 4), // TMR8_CH3 motor 5
DEF_TIM(TMR1, CH1, PA8, TIM_USE_MC_MOTOR | TIM_USE_MC_SERVO |TIM_USE_FW_MOTOR | TIM_USE_FW_SERVO | TIM_USE_ANY, 0, 5), // TMR1_CH3 motor 6

DEF_TIM(TMR4, CH1, PB6, TIM_USE_LED, 0, 0), // TMR4_CH1 LED_STRIP
};

const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]);
201 changes: 201 additions & 0 deletions src/main/target/BETAFPVF435/target.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
/*
* This file is part of INAV.
*
* INAV 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.
*
* INAV 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/>.
*/
//https://www.arterychip.com/download/DS/DS_AT32F435_437_V2.02-EN.pdf
#pragma once

#define TARGET_BOARD_IDENTIFIER "BHER"
#define USBD_PRODUCT_STRING "BETAFPVF435"

#define LED0 PB5

#define USE_BEEPER
#define BEEPER PB4
#define BEEPER_INVERTED

//#define ENABLE_DSHOT_DMAR DSHOT_DMAR_AUTO
//#define DSHOT_BITBANG_DEFAULT DSHOT_BITBANG_AUTO
//#define ENABLE_DSHOT

// *************** Gyro & ACC **********************
#define USE_SPI
#define USE_SPI_DEVICE_1

#define SPI1_SCK_PIN PA5
#define SPI1_MISO_PIN PA6
#define SPI1_MOSI_PIN PA7

#define SPI1_NSS_PIN PA4
//#define GYRO_1_SPI_INSTANCE SPI1

//#define USE_EXTI
//#define USE_GYRO_EXTI
//#define GYRO_1_EXTI_PIN PC4
//#define USE_MPU_DATA_READY_SIGNAL
//#define ENSURE_MPU_DATA_READY_IS_LOW

// MPU6000
#define USE_IMU_MPU6000
#define IMU_MPU6000_ALIGN CW270_DEG
#define MPU6000_SPI_BUS BUS_SPI1
#define MPU6000_CS_PIN SPI1_NSS_PIN

// ICM42605/ICM42688P
#define USE_IMU_ICM42605
#define IMU_ICM42605_ALIGN CW270_DEG
#define ICM42605_SPI_BUS BUS_SPI1
#define ICM42605_CS_PIN SPI1_NSS_PIN

//#define USE_ACC
#define USE_IMU_BMI270
#define IMU_BMI270_ALIGN CW270_DEG
#define BMI270_SPI_BUS BUS_SPI1
#define BMI270_CS_PIN SPI1_NSS_PIN

// *************** Baro **************************
#define USE_BARO
#define USE_BARO_BMP280
#define SPI3_NSS_PIN PB3
#define BMP280_SPI_BUS BUS_SPI3
#define BMP280_CS_PIN SPI3_NSS_PIN
#define USE_BARO_DPS310
#define DPS310_SPI_BUS BUS_SPI3
#define DPS310_CS_PIN SPI3_NSS_PIN

// *************** BLACKBOX **************************
#define USE_SPI_DEVICE_2
#define SPI2_SCK_PIN PB13
#define SPI2_MISO_PIN PB14
#define SPI2_MOSI_PIN PB15

#define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
#define USE_FLASHFS
#define FLASH_CS_PIN PB12

#define USE_FLASH_M25P16
#define M25P16_SPI_BUS BUS_SPI2
#define M25P16_CS_PIN FLASH_CS_PIN
#define USE_FLASH_W25N01G // 1Gb NAND flash support
#define W25N01G_SPI_BUS BUS_SPI2
#define W25N01G_CS_PIN FLASH_CS_PIN
#define USE_FLASH_W25M // Stacked die support
#define W25M_SPI_BUS BUS_SPI2
#define W25M_CS_PIN FLASH_CS_PIN
#define USE_FLASH_W25M512 // 512Kb (256Kb x 2 stacked) NOR flash support
#define W25M512_SPI_BUS BUS_SPI2
#define W25M512_CS_PIN FLASH_CS_PIN
#define USE_FLASH_W25M02G // 2Gb (1Gb x 2 stacked) NAND flash support
#define W25M02G_SPI_BUS BUS_SPI2
#define W25M02G_CS_PIN FLASH_CS_PIN

// *************** OSD *****************************
#define USE_SPI_DEVICE_3
#define SPI3_SCK_PIN PC10
#define SPI3_MISO_PIN PC11
#define SPI3_MOSI_PIN PC12

#if 0
#define USE_MAX7456
#define MAX7456_SPI_BUS BUS_SPI3
#define MAX7456_CS_PIN PA15
#endif

#if 0
// I2C
#define USE_I2C
#define USE_I2C_DEVICE_2
#define I2C2_SCL PB10 // SCL pad
#define I2C2_SDA PB11 // SDA pad
#define USE_I2C_PULLUP
#endif

#define USE_BARO
#define BARO_I2C_BUS BUS_I2C2
#define USE_BARO_BMP280
#define USE_BARO_DPS310

// *************** UART *****************************
#define USE_VCP
#define USE_USB_DETECT
//#define USB_DETECT_PIN PC5


#define USE_UART1
#define UART1_RX_PIN PA10
#define UART1_TX_PIN PA9

#define USE_UART3
#define UART3_RX_PIN PB11
#define UART3_TX_PIN PB10
#define USE_UART_INVERTER
#define INVERTER_PIN_UART3_RX PC9
#define INVERTER_PIN_USART3_RX PC9

#define USE_UART4
#define UART4_RX_PIN PA1
#define UART4_TX_PIN PA0

#define USE_UART5
#define UART5_RX_PIN PD2
#define UART5_TX_PIN PD2

#define USE_UART6
#define UART6_RX_PIN PC7
#define UART6_TX_PIN PC6

#define SERIAL_PORT_COUNT 6

#define DEFAULT_RX_TYPE RX_TYPE_SERIAL
#define SERIALRX_PROVIDER SERIALRX_CRSF
#define SERIALRX_UART SERIAL_PORT_USART3

// *************** ADC *****************************
#define USE_ADC
#define ADC_INSTANCE ADC1
#define ADC1_DMA_STREAM DMA2_CHANNEL5
#define ADC_CHANNEL1_PIN PC2
#define ADC_CHANNEL2_PIN PC1
#define ADC_CHANNEL3_PIN PC0
#define VBAT_ADC_CHANNEL ADC_CHN_1
#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
#define RSSI_ADC_CHANNEL ADC_CHN_3

#define USE_LED_STRIP
#define WS2811_PIN PB6

#define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_TELEMETRY | FEATURE_OSD | FEATURE_LED_STRIP )
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC

#define VBAT_SCALE_DEFAULT 110
#define CURRENT_METER_SCALE_DEFAULT 800

#define TARGET_IO_PORTA 0xffff
#define TARGET_IO_PORTB 0xffff
#define TARGET_IO_PORTC 0xffff
#define TARGET_IO_PORTD 0xffff
#define TARGET_IO_PORTE BIT(2)


#define MAX_PWM_OUTPUT_PORTS 8

#define USE_SERIAL_4WAY_BLHELI_INTERFACE
//#define USE_DSHOT
//#define USE_ESC_SENSOR
#define USE_ESCSERIAL

0 comments on commit b78319c

Please sign in to comment.