diff --git a/firmware/config/boards/proteus/board.mk b/firmware/config/boards/proteus/board.mk index 4510b15426..0569ca59f1 100644 --- a/firmware/config/boards/proteus/board.mk +++ b/firmware/config/boards/proteus/board.mk @@ -22,7 +22,7 @@ else endif # Override DEFAULT_ENGINE_TYPE -DDEFS += $(MCU_DEFS) -DEFI_USE_OSC=TRUE -DLED_CRITICAL_ERROR_BRAIN_PIN=GPIOE_3 -DFIRMWARE_ID=\"proteus\" -DDEFAULT_ENGINE_TYPE=PROTEUS -DSTM32_ADC_USE_ADC3=TRUE -DEFI_INCLUDE_ENGINE_PRESETS=FALSE -DEFI_ICU_INPUTS=FALSE -DHAL_TRIGGER_USE_PAL=TRUE -DEFI_VEHICLE_SPEED=FALSE -DEFI_LOGIC_ANALYZER=FALSE -DEFI_SOFTWARE_KNOCK=TRUE +DDEFS += $(MCU_DEFS) -DEFI_USE_OSC=TRUE -DLED_CRITICAL_ERROR_BRAIN_PIN=GPIOE_3 -DFIRMWARE_ID=\"proteus\" -DDEFAULT_ENGINE_TYPE=PROTEUS -DSTM32_ADC_USE_ADC3=TRUE -DEFI_INCLUDE_ENGINE_PRESETS=FALSE -DEFI_ICU_INPUTS=FALSE -DHAL_TRIGGER_USE_PAL=TRUE -DEFI_VEHICLE_SPEED=FALSE -DEFI_LOGIC_ANALYZER=FALSE -DEFI_SOFTWARE_KNOCK=TRUE -DEFI_CONSOLE_TX_BRAIN_PIN=GPIO_UNASSIGNED -DEFI_CONSOLE_RX_BRAIN_PIN=GPIO_UNASSIGNED # Proteus <=v0.2 needs ADC hack - vbatt is on ADC3 ifeq ($(PROTEUS_LEGACY),TRUE) diff --git a/firmware/config/boards/proteus/board_configuration.cpp b/firmware/config/boards/proteus/board_configuration.cpp index 6511eca9c0..b0074f2769 100644 --- a/firmware/config/boards/proteus/board_configuration.cpp +++ b/firmware/config/boards/proteus/board_configuration.cpp @@ -139,6 +139,18 @@ static void setupDefaultSensorInputs() { engineConfiguration->map.sensor.hwChannel = EFI_ADC_10; } +static void setupSdCard() { + engineConfiguration->isSdCardEnabled = true; + + engineConfiguration->sdCardSpiDevice = SPI_DEVICE_3; + engineConfiguration->sdCardCsPin = GPIOD_2; + + engineConfiguration->is_enabled_spi_3 = true; + engineConfiguration->spi3sckPin = GPIOC_10; + engineConfiguration->spi3misoPin = GPIOC_11; + engineConfiguration->spi3mosiPin = GPIOC_12; +} + void setPinConfigurationOverrides(void) { } @@ -164,6 +176,7 @@ void setBoardConfigurationOverrides(void) { setLedPins(); setupVbatt(); setupEtb(); + setupSdCard(); // "required" hardware is done - set some reasonable defaults setupDefaultSensorInputs(); diff --git a/firmware/hw_layer/io_pins.cpp b/firmware/hw_layer/io_pins.cpp index ec5d746fad..4a185caa5d 100644 --- a/firmware/hw_layer/io_pins.cpp +++ b/firmware/hw_layer/io_pins.cpp @@ -48,6 +48,11 @@ bool efiReadPin(brain_pin_e pin) { */ void efiSetPadMode(const char *msg, brain_pin_e brainPin, iomode_t mode) { + if (brainPin == GPIO_UNASSIGNED) { + // No pin configured, nothing to do here. + return; + } + bool wasUsed = brain_pin_markUsed(brainPin, msg); if (!wasUsed) {