diff --git a/firmware/config/boards/hellen/alphax-4chan/board.mk b/firmware/config/boards/hellen/alphax-4chan/board.mk index bc30f99fa7..a7da5f8235 100644 --- a/firmware/config/boards/hellen/alphax-4chan/board.mk +++ b/firmware/config/boards/hellen/alphax-4chan/board.mk @@ -36,3 +36,4 @@ $(error Unsupported PROJECT_CPU [$(PROJECT_CPU)]) endif DDEFS += -DHW_HELLEN_4CHAN=1 +ONBOARD_MEMS_TYPE=LIS2DH12 diff --git a/firmware/config/boards/hellen/alphax-8chan/board.mk b/firmware/config/boards/hellen/alphax-8chan/board.mk index a23f31cf4c..9787f041b2 100644 --- a/firmware/config/boards/hellen/alphax-8chan/board.mk +++ b/firmware/config/boards/hellen/alphax-8chan/board.mk @@ -30,3 +30,5 @@ DDEFS += -DSTATIC_BOARD_ID=STATIC_BOARD_ID_ALPHAX_8CHAN SHORT_BOARD_NAME=alphax-8chan DDEFS += -DHW_HELLEN_8CHAN=1 + +ONBOARD_MEMS_TYPE=LIS2DH12 diff --git a/firmware/config/boards/hellen/hellen-common.mk b/firmware/config/boards/hellen/hellen-common.mk index d7d2545c2e..b7f3ca2428 100644 --- a/firmware/config/boards/hellen/hellen-common.mk +++ b/firmware/config/boards/hellen/hellen-common.mk @@ -16,3 +16,13 @@ DDEFS += -DHW_HELLEN=1 ifeq ($(RAM_UNUSED_SIZE),) DDEFS += -DRAM_UNUSED_SIZE=100 endif + +ifeq ($(ONBOARD_MEMS_TYPE),LIS2DH12) + # Same spi is used for SD and Accelerometer + DDEFS += -DMMC_USE_MUTUAL_EXCLUSION=TRUE + + # This board has some Accelerometer onboard + DDEFS += -DEFI_ONBOARD_MEMS=TRUE + EFI_ONBOARD_MEMS_LIS2DH12 = yes + DDEFS += -DLSM303AGR_USE_SPI=TRUE -DLSM303AGR_USE_I2C=FALSE -DLSM303AGR_SHARED_SPI=TRUE +endif diff --git a/firmware/config/boards/hellen/hellen-honda-k/board_configuration.cpp b/firmware/config/boards/hellen/hellen-honda-k/board_configuration.cpp index c95f0b2152..9d403c19d5 100644 --- a/firmware/config/boards/hellen/hellen-honda-k/board_configuration.cpp +++ b/firmware/config/boards/hellen/hellen-honda-k/board_configuration.cpp @@ -146,9 +146,7 @@ void setBoardDefaultConfiguration() { setTPS1Calibration(100, 650); hellenWbo(); - /* accel SPI is shared with SD card SPI */ - engineConfiguration->accelerometerSpiDevice = SPI_DEVICE_1; - engineConfiguration->accelerometerCsPin = Gpio::H_SPI1_CS2; + setAccelerometerSpi(); } static Gpio OUTPUTS[] = { diff --git a/firmware/config/boards/hellen_meta.h b/firmware/config/boards/hellen_meta.h index 89f62bdde8..8c4b770548 100644 --- a/firmware/config/boards/hellen_meta.h +++ b/firmware/config/boards/hellen_meta.h @@ -249,6 +249,12 @@ static void setHellenSdCardSpi3NoCS() { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" +static void setAccelerometerSpi() { + /* accelerometer SPI is shared with SD card SPI on mm144 */ + engineConfiguration->accelerometerSpiDevice = SPI_DEVICE_1; + engineConfiguration->accelerometerCsPin = Gpio::H_SPI1_CS2; +} + static void setHellenSdCardSpi1() { setHellenSdCardSpi1NoCS(); engineConfiguration->sdCardCsPin = Gpio::H_SPI1_CS1;