diff --git a/firmware/config/engines/custom_engine.cpp b/firmware/config/engines/custom_engine.cpp index 2b2d2e2190..047c9401fe 100644 --- a/firmware/config/engines/custom_engine.cpp +++ b/firmware/config/engines/custom_engine.cpp @@ -347,8 +347,10 @@ void setTle8888TestConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { // IN1 PF15 // IN2 PF14 // SF PF11 +#if EFI_FSIO setFsio(12, GPIOF_12, "0" PASS_ENGINE_PARAMETER_SUFFIX); setFsio(14, GPIOF_13, "1" PASS_ENGINE_PARAMETER_SUFFIX); +#endif CONFIG(etb1_use_two_wires) = true; CONFIGB(etb1.directionPin1) = GPIOF_15; CONFIGB(etb1.directionPin2) = GPIOF_14; @@ -360,8 +362,10 @@ void setTle8888TestConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { // IN1 PE2 // IN2 PE4 // SF PE3 +#if EFI_FSIO setFsio(13, GPIOE_5, "0" PASS_ENGINE_PARAMETER_SUFFIX); setFsio(15, GPIOE_6, "1" PASS_ENGINE_PARAMETER_SUFFIX); +#endif CONFIG(etb2_use_two_wires) = true; CONFIG(etb2.directionPin1) = GPIOE_2; CONFIG(etb2.directionPin2) = GPIOE_4; diff --git a/firmware/console/binary/tunerstudio_io.cpp b/firmware/console/binary/tunerstudio_io.cpp index 393789963d..3f63469446 100644 --- a/firmware/console/binary/tunerstudio_io.cpp +++ b/firmware/console/binary/tunerstudio_io.cpp @@ -65,18 +65,19 @@ static void tsRxIRQIdleHandler(UARTDriver *uartp) { /* Note: This structure is modified from the default ChibiOS layout! */ static UARTConfig tsDmaUartConfig = { - NULL, NULL, NULL, NULL, NULL, - 0, 0, 0/*USART_CR2_STOP1_BITS*/ | USART_CR2_LINEN, 0, - /*timeout_cb*/tsRxIRQIdleHandler, /*rxhalf_cb*/tsRxIRQHalfHandler + .txend1_cb = NULL, .txend2_cb = NULL, .rxend_cb = NULL, .rxchar_cb = NULL, .rxerr_cb = NULL, + .speed = 0, .cr1 = 0, .cr2 = 0/*USART_CR2_STOP1_BITS*/ | USART_CR2_LINEN, .cr3 = 0, + .timeout_cb = tsRxIRQIdleHandler, .rxhalf_cb = tsRxIRQHalfHandler }; #elif TS_UART_MODE /* Note: This structure is modified from the default ChibiOS layout! */ static UARTConfig tsUartConfig = { - NULL, NULL, NULL, NULL, NULL, - 0, 0, 0/*USART_CR2_STOP1_BITS*/ | USART_CR2_LINEN, 0 + .txend1_cb = NULL, .txend2_cb = NULL, .rxend_cb = NULL, .rxchar_cb = NULL, .rxerr_cb = NULL, + .speed = 0, .cr1 = 0, .cr2 = 0/*USART_CR2_STOP1_BITS*/ | USART_CR2_LINEN, .cr3 = 0, + .timeout_cb = NULL, .rxhalf_cb = NULL }; #else -static SerialConfig tsSerialConfig = { 0, 0, USART_CR2_STOP1_BITS | USART_CR2_LINEN, 0 }; +static SerialConfig tsSerialConfig = { .speed = 0, .cr1 = 0, .cr2 = USART_CR2_STOP1_BITS | USART_CR2_LINEN, .cr3 = 0 }; #endif /* TS_UART_DMA_MODE */ #endif /* EFI_PROD_CODE */ diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 63b963edea..205dd7b89c 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -151,12 +151,18 @@ volatile int globalConfigurationVersion = 0; * * todo: place this field next to 'engineConfiguration'? */ +#ifdef EFI_ACTIVE_CONFIGURATION_IN_FLASH +engine_configuration_s EFI_ACTIVE_CONFIGURATION_IN_FLASH activeConfiguration; +#else engine_configuration_s activeConfiguration; +#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */ extern engine_configuration_s *engineConfiguration; void rememberCurrentConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { +#ifndef EFI_ACTIVE_CONFIGURATION_IN_FLASH memcpy(&activeConfiguration, engineConfiguration, sizeof(engine_configuration_s)); +#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */ } diff --git a/firmware/hw_layer/smart_gpio.cpp b/firmware/hw_layer/smart_gpio.cpp index c93c52ea2c..70dbc4de4b 100644 --- a/firmware/hw_layer/smart_gpio.cpp +++ b/firmware/hw_layer/smart_gpio.cpp @@ -20,14 +20,45 @@ EXTERN_CONFIG; +// todo: migrate to TS or board config +#ifndef TLE6240_SS_PORT +#define TLE6240_SS_PORT GPIOF +#endif /* TLE6240_SS_PORT */ +#ifndef TLE6240_SS_PAD +#define TLE6240_SS_PAD 0U +#endif /* TLE6240_SS_PAD */ +#ifndef TLE6240_RESET_PORT +#define TLE6240_RESET_PORT GPIOG +#endif /* TLE6240_RESET_PORT */ +#ifndef TLE6240_RESET_PAD +#define TLE6240_RESET_PAD 3U +#endif /* TLE6240_RESET_PAD */ +#ifndef TLE6240_DIRECT_IO +#define TLE6240_DIRECT_IO \ + /* IN1 - D_TACH_OUT */ \ + [0] = {.port = GPIOG, .pad = 2}, \ + /* IN2..4 grounded */ \ + [1] = {.port = NULL, .pad = 0}, \ + [2] = {.port = NULL, .pad = 0}, \ + [3] = {.port = NULL, .pad = 0}, \ + /* IN9 - D_INJ_5 */ \ + [4] = {.port = GPIOD, .pad = 15}, \ + /* IN10 - D_WASTGATE */ \ + [5] = {.port = GPIOD, .pad = 14}, \ + /* IN11 - D_IDLE_OPEN */ \ + [6] = {.port = GPIOC, .pad = 6}, \ + /* IN12 - D_IDLE_CLOSE */ \ + [7] = {.port = GPIOC, .pad = 7}, +#endif /* TLE6240_DIRECT_IO */ + #if (BOARD_TLE6240_COUNT > 0) struct tle6240_config tle6240 = { .spi_bus = NULL /* TODO software lookup &SPID4 */, .spi_config = { .circular = false, .end_cb = NULL, - .ssport = GPIOF, - .sspad = 0U, + .ssport = TLE6240_SS_PORT, + .sspad = TLE6240_SS_PAD, .cr1 = SPI_CR1_16BIT_MODE | SPI_CR1_SSM | @@ -41,22 +72,9 @@ struct tle6240_config tle6240 = { .cr2 = SPI_CR2_16BIT_MODE }, .direct_io = { - /* IN1 - D_TACH_OUT */ - [0] = {.port = GPIOG, .pad = 2}, - /* IN2..4 grounded */ - [1] = {.port = NULL}, - [2] = {.port = NULL}, - [3] = {.port = NULL}, - /* IN9 - D_INJ_5 */ - [4] = {.port = GPIOD, .pad = 15}, - /* IN10 - D_WASTGATE */ - [5] = {.port = GPIOD, .pad = 14}, - /* IN11 - D_IDLE_OPEN */ - [6] = {.port = GPIOC, .pad = 6}, - /* IN12 - D_IDLE_CLOSE */ - [7] = {.port = GPIOC, .pad = 7}, + TLE6240_DIRECT_IO }, - .reset = {.port = GPIOG, .pad = 3} + .reset = {.port = TLE6240_RESET_PORT, .pad = TLE6240_RESET_PAD} }; #endif /* (BOARD_TLE6240_COUNT > 0) */ diff --git a/firmware/hw_layer/trigger_input.cpp b/firmware/hw_layer/trigger_input.cpp index 55b8e85e18..b62b537b23 100644 --- a/firmware/hw_layer/trigger_input.cpp +++ b/firmware/hw_layer/trigger_input.cpp @@ -14,7 +14,7 @@ #include "global.h" -#if EFI_SHAFT_POSITION_INPUT && (HAL_USE_PAL == TRUE || HAL_USE_ICU == TRUE) +#if EFI_SHAFT_POSITION_INPUT && (HAL_USE_PAL == TRUE || HAL_USE_ICU == TRUE) && (HAL_USE_COMP == FALSE) #include "trigger_input.h" #include "digital_input_hw.h" @@ -314,4 +314,4 @@ void applyNewTriggerInputPins(void) { startTriggerInputPins(); } -#endif /* (EFI_SHAFT_POSITION_INPUT && (HAL_USE_PAL == TRUE || HAL_USE_ICU == TRUE)) */ +#endif /* (EFI_SHAFT_POSITION_INPUT && (HAL_USE_PAL == TRUE || HAL_USE_ICU == TRUE) && (HAL_USE_COMP == FALSE)) */