[DRAFT] 2chan rev E SD card config #5067 (#5070)

* 2chan rev E SD card config #5067

* setHellenSdCardSpi1()

* setHellenSdCardSpi1()
This commit is contained in:
Andreika 2023-02-13 21:10:38 +02:00 committed by GitHub
parent 4f546fae86
commit 86d827ae48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -101,7 +101,10 @@ void setBoardConfigOverrides() {
setHellen144LedPins();
setupVbatt();
setHellenSdCardSpi2();
// rev.D uses SPI1 pins for CAN2, but rev.E and later uses SPI1 for SD-card
if (engine->engineState.hellenBoardId != BOARD_ID_2chan_d) {
setHellenSdCardSpi1();
}
engineConfiguration->clt.config.bias_resistor = 4700;
engineConfiguration->iat.config.bias_resistor = 4700;

View File

@ -8,6 +8,7 @@
#pragma once
#define BOARD_ID_154hyundai_c 10
#define BOARD_ID_2chan_d 107
void hellenWbo();
@ -212,6 +213,15 @@ void detectHellenBoardType();
#define H_SPI3_SCK Gpio::C10
#define H_SPI3_CS Gpio::A15
static void setHellenSdCardSpi1() {
engineConfiguration->sdCardSpiDevice = SPI_DEVICE_1;
engineConfiguration->spi1mosiPin = H_SPI1_MOSI;
engineConfiguration->spi1misoPin = H_SPI1_MISO;
engineConfiguration->spi1sckPin = H_SPI1_SCK;
engineConfiguration->sdCardCsPin = H_SPI1_CS1;
engineConfiguration->is_enabled_spi_1 = true;
}
static void setHellenSdCardSpi2() {
engineConfiguration->sdCardSpiDevice = SPI_DEVICE_2;
engineConfiguration->spi2mosiPin = H_SPI2_MOSI;