chore: reorg TX15 files (#6560)
This commit is contained in:
@@ -73,7 +73,7 @@ int audioInit()
|
||||
|
||||
memset(_dma_buffer, 0, sizeof(_dma_buffer));
|
||||
|
||||
if (tas2505_probe(&_tas2505, 0, 0x30 >> 1) < 0) {
|
||||
if (tas2505_probe(&_tas2505, AUDIO_I2C, 0x30 >> 1) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
-13
@@ -28,7 +28,6 @@
|
||||
#include "board.h"
|
||||
|
||||
#include "globals.h"
|
||||
#include "lcd_driver.h"
|
||||
|
||||
static const stm32_pulse_timer_t _bl_timer = {
|
||||
.GPIO = (gpio_t)BACKLIGHT_GPIO,
|
||||
@@ -63,16 +62,6 @@ uint8_t lastDutyCycle = 0;
|
||||
void backlightEnable(uint8_t dutyCycle)
|
||||
{
|
||||
stm32_pulse_set_cmp_val(&_bl_timer, dutyCycle);
|
||||
|
||||
if(!dutyCycle) {
|
||||
//experimental to turn off LCD when no backlight
|
||||
if(lcdOffFunction) lcdOffFunction();
|
||||
}
|
||||
else if(!lastDutyCycle) {
|
||||
if(lcdOnFunction) lcdOnFunction();
|
||||
else lcdInit();
|
||||
}
|
||||
|
||||
lastDutyCycle = dutyCycle;
|
||||
}
|
||||
|
||||
@@ -81,8 +70,6 @@ void lcdOff() {
|
||||
}
|
||||
|
||||
void lcdOn(){
|
||||
// if(lcdOnFunction) lcdOnFunction();
|
||||
// else lcdInit();
|
||||
backlightEnable(BACKLIGHT_LEVEL_MAX);
|
||||
}
|
||||
|
||||
@@ -153,11 +153,14 @@ void boardInit()
|
||||
flashRegisterDriver(QSPI_BASE, QSPI_FLASH_SIZE, &extflash_driver);
|
||||
|
||||
// init_trainer();
|
||||
|
||||
#if defined(FLYSKY_GIMBAL)
|
||||
auto inittime = flysky_gimbal_init();
|
||||
if (inittime)
|
||||
TRACE("Serial gimbal detected in %d ms", inittime);
|
||||
else
|
||||
TRACE("No serial gimbal detected");
|
||||
#endif
|
||||
|
||||
usbInit();
|
||||
|
||||
@@ -200,10 +200,6 @@ bool isBacklightEnabled();
|
||||
: g_eeGeneral.blOffBright); \
|
||||
}
|
||||
|
||||
#define USB_NAME "TX15"
|
||||
#define USB_MANUFACTURER 'R', 'M', ' ', ' ', ' ', ' ', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'T', 'X', '1', '5', ' ', ' ', ' ', ' ' /* 8 Bytes */
|
||||
|
||||
#if defined(__cplusplus) && !defined(SIMU)
|
||||
}
|
||||
#endif
|
||||
@@ -60,19 +60,18 @@ static void _init_io_expander(bsp_io_expander* io, uint32_t mask)
|
||||
io->state = 0;
|
||||
}
|
||||
|
||||
static volatile uint8_t pca95xx_errors = 0;
|
||||
|
||||
static uint32_t _read_io_expander(bsp_io_expander* io)
|
||||
{
|
||||
uint16_t value = 0;
|
||||
if (pca95xx_read(&io->exp, io->mask, &value) == 0) {
|
||||
io->state = value;
|
||||
} else {
|
||||
if (pca95xx_errors++ > 5) {
|
||||
gpio_clear(IO_RESET_GPIO);
|
||||
pca95xx_errors = 0;
|
||||
delay_us(1); // Only 6ns are needed according to PCA datasheet, but lets be safe
|
||||
gpio_set(IO_RESET_GPIO);
|
||||
gpio_clear(IO_RESET_GPIO);
|
||||
delay_us(1); // Only 4ns are needed according to PCA datasheet
|
||||
gpio_set(IO_RESET_GPIO);
|
||||
// Re read
|
||||
if (pca95xx_read(&io->exp, io->mask, &value) == 0) {
|
||||
io->state = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,14 +128,14 @@ int bsp_io_init()
|
||||
gpio_set(IO_RESET_GPIO);
|
||||
|
||||
// configure expander 1
|
||||
_init_io_expander(&_io_fs_switches, 0xFF3F);
|
||||
_init_io_expander(&_io_fs_switches, EXP_1_MASK);
|
||||
if (pca95xx_init(&_io_fs_switches.exp, I2C_Bus_1, 0x74) < 0) {
|
||||
TRACE("EXP1 INIT ERROR");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// configure expander 2
|
||||
_init_io_expander(&_io_switches, 0xFFF8);
|
||||
_init_io_expander(&_io_switches, EXP_2_MASK);
|
||||
if (pca95xx_init(&_io_switches.exp, I2C_Bus_1, 0x75) < 0) {
|
||||
TRACE("EXP2 INIT ERROR");
|
||||
return -1;
|
||||
@@ -211,9 +210,13 @@ static SwitchHwPos _get_fs_switch_pos(uint8_t idx)
|
||||
}
|
||||
}
|
||||
|
||||
bool boardIsCustomSwitch(uint8_t idx);
|
||||
|
||||
SwitchHwPos boardSwitchGetPosition(uint8_t idx)
|
||||
{
|
||||
if (idx < 6)
|
||||
if (boardIsCustomSwitch(idx)) {
|
||||
return _get_fs_switch_pos(idx);
|
||||
} else {
|
||||
return _get_switch_pos(idx);
|
||||
return _get_fs_switch_pos(idx);
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "delays_driver.h"
|
||||
#include "debug.h"
|
||||
#include "lcd.h"
|
||||
#include "lcd_driver.h"
|
||||
#include "lcd_driver_480.h"
|
||||
#include "board.h"
|
||||
|
||||
#include "hal/gpio.h"
|
||||
@@ -38,10 +38,6 @@
|
||||
typedef void (*lcdSpiInitFucPtr)(void);
|
||||
typedef unsigned int LcdReadIDFucPtr( void );
|
||||
|
||||
extern lcdSpiInitFucPtr lcdInitFunction;
|
||||
extern lcdSpiInitFucPtr lcdOffFunction;
|
||||
extern lcdSpiInitFucPtr lcdOnFunction;
|
||||
|
||||
#define SET_IO_INPUT( PORT, PIN ) LL_GPIO_SetPinMode( PORT, PIN, LL_GPIO_MODE_INPUT )
|
||||
#define SET_IO_OUTPUT( PORT, PIN ) LL_GPIO_SetPinMode( PORT, PIN, LL_GPIO_MODE_OUTPUT )
|
||||
|
||||
@@ -63,7 +63,6 @@ set(HARDWARE_TOUCH YES)
|
||||
set(RADIO_DEPENDENCIES ${RADIO_DEPENDENCIES} ${BITMAPS_TARGET})
|
||||
set(FIRMWARE_DEPENDENCIES datacopy)
|
||||
set(SOFTWARE_KEYBOARD ON)
|
||||
set(FLYSKY_GIMBAL ON)
|
||||
set(FUNCTION_SWITCHES ON)
|
||||
set(USB_CHARGER YES)
|
||||
set(AUX_SERIAL YES)
|
||||
@@ -112,17 +111,22 @@ set(AFHDS3 ON)
|
||||
set(ENABLE_SERIAL_PASSTHROUGH ON CACHE BOOL "Enable serial passthrough")
|
||||
set(CLI ON CACHE BOOL "Enable CLI")
|
||||
|
||||
set(BOARD rm-h750)
|
||||
|
||||
include_directories(boards/${BOARD})
|
||||
|
||||
set(TARGET_SRC_DIR targets/${TARGET_DIR})
|
||||
set(BOARD_SRC_DIR boards/${BOARD})
|
||||
|
||||
set(BOARD_COMMON_SRC
|
||||
${TARGET_SRC_DIR}/board.cpp
|
||||
${TARGET_SRC_DIR}/bsp_io.cpp
|
||||
${BOARD_SRC_DIR}/board.cpp
|
||||
${BOARD_SRC_DIR}/bsp_io.cpp
|
||||
${BOARD_SRC_DIR}/lcd_driver_480.cpp
|
||||
${BOARD_SRC_DIR}/backlight_driver.cpp
|
||||
${BOARD_SRC_DIR}/haptic_driver.cpp
|
||||
${BOARD_SRC_DIR}/extflash_driver.cpp
|
||||
${BOARD_SRC_DIR}/usb_charger_driver.cpp
|
||||
${TARGET_SRC_DIR}/key_driver.cpp
|
||||
${TARGET_SRC_DIR}/lcd_driver.cpp
|
||||
${TARGET_SRC_DIR}/backlight_driver.cpp
|
||||
${TARGET_SRC_DIR}/haptic_driver.cpp
|
||||
${TARGET_SRC_DIR}/extflash_driver.cpp
|
||||
${TARGET_SRC_DIR}/usb_charger_driver.cpp
|
||||
targets/common/arm/stm32/abnormal_reboot.cpp
|
||||
targets/common/arm/stm32/delays_driver.cpp
|
||||
targets/common/arm/stm32/dma2d.cpp
|
||||
@@ -137,8 +141,7 @@ set(BOARD_COMMON_SRC
|
||||
# Bootloader board library
|
||||
add_library(board_bl OBJECT EXCLUDE_FROM_ALL
|
||||
${BOARD_COMMON_SRC}
|
||||
${TARGET_SRC_DIR}/sdram_driver.cpp
|
||||
${TARGET_SRC_DIR}/usb_charger_driver.cpp
|
||||
${BOARD_SRC_DIR}/sdram_driver.cpp
|
||||
${RADIO_SRC_DIR}/gui/colorlcd/boot_menu.cpp
|
||||
targets/common/arm/stm32/stm32_qspi.cpp
|
||||
targets/common/arm/stm32/stm32_pulse_driver.cpp
|
||||
@@ -146,14 +149,14 @@ add_library(board_bl OBJECT EXCLUDE_FROM_ALL
|
||||
add_dependencies(board_bl minimal_board_lib)
|
||||
set(BOOTLOADER_SRC ${BOOTLOADER_SRC} $<TARGET_OBJECTS:board_bl>)
|
||||
|
||||
set(CMSIS_SRC ${TARGET_SRC_DIR}/system_clock.c)
|
||||
set(CMSIS_SRC ${BOARD_SRC_DIR}/system_clock.c)
|
||||
|
||||
# Firmware board library
|
||||
add_library(board OBJECT EXCLUDE_FROM_ALL
|
||||
${BOARD_COMMON_SRC}
|
||||
${TARGET_SRC_DIR}/led_driver.cpp
|
||||
${TARGET_SRC_DIR}/tp_gt911.cpp
|
||||
${TARGET_SRC_DIR}/audio_driver.cpp
|
||||
${BOARD_SRC_DIR}/led_driver.cpp
|
||||
${BOARD_SRC_DIR}/tp_gt911.cpp
|
||||
${BOARD_SRC_DIR}/audio_driver.cpp
|
||||
drivers/icm42607C.cpp
|
||||
drivers/imu_filter.cpp
|
||||
drivers/tas2505.cpp
|
||||
|
||||
@@ -24,19 +24,6 @@
|
||||
#include "drivers/pca95xx.h"
|
||||
#include "hal/switch_driver.h"
|
||||
|
||||
// Port expander 1 (0x74)
|
||||
#define SWITCH_A_L PCA95XX_P14
|
||||
#define SWITCH_A_H PCA95XX_P15
|
||||
#define SWITCH_B_L PCA95XX_P12
|
||||
#define SWITCH_B_H PCA95XX_P13
|
||||
#define SWITCH_C_L PCA95XX_P10
|
||||
#define SWITCH_C_H PCA95XX_P11
|
||||
#define SWITCH_D_L PCA95XX_P6
|
||||
#define SWITCH_D_H PCA95XX_P7
|
||||
#define SWITCH_E_L PCA95XX_P16
|
||||
#define SWITCH_E_H PCA95XX_P17
|
||||
#define SWITCH_F_H PCA95XX_P4
|
||||
#define SWITCH_F_L PCA95XX_P5
|
||||
|
||||
// Port expander 2 (0x75)
|
||||
#define BSP_TR1U PCA95XX_PIN_13
|
||||
@@ -51,13 +38,6 @@
|
||||
#define BSP_TR4L PCA95XX_PIN_9
|
||||
#define BSP_TR4R PCA95XX_PIN_8
|
||||
|
||||
#define FSSWITCH_1 PCA95XX_P0
|
||||
#define FSSWITCH_2 PCA95XX_P1
|
||||
#define FSSWITCH_3 PCA95XX_P2
|
||||
#define FSSWITCH_4 PCA95XX_P3
|
||||
#define FSSWITCH_5 PCA95XX_P4
|
||||
#define FSSWITCH_6 PCA95XX_P5
|
||||
|
||||
extern uint8_t isSwitch3Pos(uint8_t idx);
|
||||
|
||||
int bsp_io_init();
|
||||
@@ -67,3 +47,7 @@ uint32_t bsp_get_fs_switches();
|
||||
|
||||
uint16_t bsp_input_get();
|
||||
struct stm32_switch_t;
|
||||
|
||||
//TODO compute from json
|
||||
constexpr uint32_t EXP_1_MASK = 0xFF3F;
|
||||
constexpr uint32_t EXP_2_MASK = 0xFFF8;
|
||||
|
||||
@@ -354,6 +354,7 @@ TIM17: ROTARY_ENCODER_TIMER
|
||||
|
||||
|
||||
// AUDIO
|
||||
#define AUDIO_I2C I2C_Bus_1
|
||||
#define AUDIO_SPI SPI2
|
||||
#define AUDIO_RESET_PIN GPIO_PIN(GPIOH, 10)
|
||||
#define AUDIO_HP_DETECT_PIN GPIO_PIN(GPIOA, 5)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#ifndef _USB_DESCRIPTOR_H_
|
||||
#define _USB_DESCRIPTOR_H_
|
||||
|
||||
#define USB_NAME "TX15"
|
||||
#define USB_NAME "RadioMaster TX15"
|
||||
#define USB_MANUFACTURER 'R', 'M', ' ', ' ', ' ', ' ', ' ', ' ' /* 8 bytes */
|
||||
#define USB_PRODUCT 'T', 'X', '1', '5', ' ', ' ', ' ', ' ' /* 8 Bytes */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user