refactor(boot): move BT and rotary encoder init to board specifics (#7265)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Raphael Coeffic
2026-04-29 20:30:25 +10:00
committed by GitHub
co-authored by Claude Opus 4.6
parent ac4c4d7b6b
commit 559866c059
12 changed files with 70 additions and 49 deletions
+4 -6
View File
@@ -581,12 +581,6 @@ if(ROTARY_ENCODER)
)
endif()
if(BLUETOOTH)
list(APPEND BOARD_COMMON_SRC
targets/common/arm/stm32/bluetooth_driver.cpp
)
endif()
# Bootloader board library
add_library(board_bl OBJECT EXCLUDE_FROM_ALL
${BOARD_COMMON_SRC}
@@ -612,6 +606,10 @@ add_library(board OBJECT EXCLUDE_FROM_ALL
)
set(FIRMWARE_SRC ${FIRMWARE_SRC} $<TARGET_OBJECTS:board>)
if(BLUETOOTH)
target_sources(board PRIVATE targets/common/arm/stm32/bluetooth_driver.cpp)
endif()
if(BIND_KEY)
add_definitions(-DBIND_KEY)
target_sources(board PRIVATE ${TARGET_SRC_DIR}/bind_button_driver.cpp)
+23
View File
@@ -27,6 +27,7 @@
#include "hal/switch_driver.h"
#include "hal/module_port.h"
#include "hal/abnormal_reboot.h"
#include "hal/rotary_encoder.h"
#include "hal/usb_driver.h"
#include "hal/gpio.h"
#include "hal/rgbleds.h"
@@ -48,6 +49,28 @@
#include "flysky_gimbal_driver.h"
#endif
#if defined(BOOT)
#if defined(BLUETOOTH)
void boardBLEarlyInit()
{
// Disable the BT module so it will be detected on firmware start
#if defined(BT_EN_GPIO)
gpio_init(BT_EN_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW);
gpio_write(BT_EN_GPIO, 1);
#endif
}
#endif
#if defined(ROTARY_ENCODER_NAVIGATION)
void boardBLInit()
{
rotaryEncoderInit();
}
#endif
#endif // BOOT
#if !defined(BOOT)
#include "edgetx.h"
#if defined(PXX1)