feat(driver): autodetect IMU, add support for SC7U22 (#7191)
Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
raphaelcoeffic
Claude Opus 4.6
parent
5ea531d391
commit
0ce5c8f3f2
@@ -627,7 +627,7 @@ if(USB_CHARGER)
|
||||
endif()
|
||||
|
||||
if(IMU)
|
||||
target_sources(board PRIVATE targets/common/arm/stm32/lsm6ds_driver.cpp)
|
||||
target_sources(board PRIVATE drivers/lsm6ds.cpp)
|
||||
endif()
|
||||
|
||||
if(AUTOUPDATE)
|
||||
|
||||
@@ -125,6 +125,21 @@ void SDLEDpwrInit()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(IMU) && defined(IMU_I2C_BUS) && defined(IMU_I2C_BUS)
|
||||
#include "drivers/lsm6ds.h"
|
||||
#include "stm32_i2c_driver.h"
|
||||
|
||||
#define HAS_IMU
|
||||
|
||||
static void gyroInit()
|
||||
{
|
||||
const etx_imu_t candidates[] = {
|
||||
{ &imu_lsm6ds_driver, IMU_I2C_BUS, IMU_I2C_ADDRESS },
|
||||
};
|
||||
gyroStart(imuDetect(candidates, DIM(candidates)));
|
||||
}
|
||||
#endif
|
||||
|
||||
void boardInit()
|
||||
{
|
||||
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SYSCFG);
|
||||
@@ -277,6 +292,10 @@ void boardInit()
|
||||
#if defined(RADIO_GX12)
|
||||
gpio_init(HALL_SYNC, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
||||
#endif
|
||||
|
||||
#if defined(HAS_IMU)
|
||||
gyroInit();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user