random Frankenso clean-up
This commit is contained in:
parent
93cb248194
commit
bf6aac9f3b
|
@ -2,6 +2,8 @@
|
|||
* @file board_extra.c
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
#include "hip9011_logic.h"
|
||||
#include "chconf_common.h"
|
||||
|
||||
/**
|
||||
|
@ -10,3 +12,116 @@
|
|||
*/
|
||||
void setPinConfigurationOverrides() {
|
||||
}
|
||||
|
||||
static void setDefaultFrankensoStepperIdleParameters() {
|
||||
engineConfiguration->idle.stepperDirectionPin = Gpio::E10;
|
||||
engineConfiguration->idle.stepperStepPin = Gpio::E12;
|
||||
engineConfiguration->stepperEnablePin = Gpio::E14;
|
||||
engineConfiguration->idleStepperReactionTime = 10;
|
||||
engineConfiguration->idleStepperTotalSteps = 150;
|
||||
}
|
||||
|
||||
static void setCanFrankensoDefaults() {
|
||||
engineConfiguration->canTxPin = Gpio::B6;
|
||||
engineConfiguration->canRxPin = Gpio::B12;
|
||||
}
|
||||
|
||||
static void setHip9011FrankensoPinout() {
|
||||
/**
|
||||
* SPI on PB13/14/15
|
||||
*/
|
||||
// engineConfiguration->hip9011CsPin = Gpio::D0; // rev 0.1
|
||||
|
||||
engineConfiguration->isHip9011Enabled = true;
|
||||
engineConfiguration->hip9011PrescalerAndSDO = HIP_8MHZ_PRESCALER; // 8MHz chip
|
||||
engineConfiguration->is_enabled_spi_2 = true;
|
||||
// todo: convert this to rusEfi, hardware-independent enum
|
||||
#if EFI_PROD_CODE
|
||||
#ifdef EFI_HIP_CS_PIN
|
||||
engineConfiguration->hip9011CsPin = EFI_HIP_CS_PIN;
|
||||
#else
|
||||
engineConfiguration->hip9011CsPin = Gpio::B0; // rev 0.4
|
||||
#endif
|
||||
engineConfiguration->hip9011CsPinMode = OM_OPENDRAIN;
|
||||
|
||||
engineConfiguration->hip9011IntHoldPin = Gpio::B11;
|
||||
engineConfiguration->hip9011IntHoldPinMode = OM_OPENDRAIN;
|
||||
|
||||
engineConfiguration->spi2SckMode = PO_OPENDRAIN; // 4
|
||||
engineConfiguration->spi2MosiMode = PO_OPENDRAIN; // 4
|
||||
engineConfiguration->spi2MisoMode = PO_PULLUP; // 32
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
engineConfiguration->hip9011Gain = 1;
|
||||
|
||||
if (!engineConfiguration->useTpicAdvancedMode) {
|
||||
engineConfiguration->hipOutputChannel = EFI_ADC_10; // PC0
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Hardware board-specific default configuration (GPIO pins, ADC channels, SPI configs etc.)
|
||||
*/
|
||||
void setBoardDefaultConfiguration() {
|
||||
setDefaultFrankensoStepperIdleParameters();
|
||||
setCanFrankensoDefaults();
|
||||
|
||||
#if EFI_HIP_9011
|
||||
setHip9011FrankensoPinout();
|
||||
#endif /* EFI_HIP_9011 */
|
||||
|
||||
// set optional subsystem configs
|
||||
#if EFI_MEMS
|
||||
// this would override some values from above
|
||||
configureAccelerometerPins();
|
||||
#endif /* EFI_MEMS */
|
||||
|
||||
|
||||
|
||||
engineConfiguration->map.sensor.hwChannel = EFI_ADC_4;
|
||||
engineConfiguration->clt.adcChannel = EFI_ADC_6;
|
||||
engineConfiguration->iat.adcChannel = EFI_ADC_7;
|
||||
engineConfiguration->afr.hwChannel = EFI_ADC_14;
|
||||
|
||||
engineConfiguration->accelerometerSpiDevice = SPI_DEVICE_1;
|
||||
engineConfiguration->hip9011SpiDevice = SPI_DEVICE_2;
|
||||
engineConfiguration->cj125SpiDevice = SPI_DEVICE_2;
|
||||
|
||||
// engineConfiguration->gps_rx_pin = Gpio::B7;
|
||||
// engineConfiguration->gps_tx_pin = Gpio::B6;
|
||||
|
||||
engineConfiguration->triggerSimulatorPins[0] = Gpio::D1;
|
||||
engineConfiguration->triggerSimulatorPins[1] = Gpio::D2;
|
||||
|
||||
engineConfiguration->triggerInputPins[0] = Gpio::C6;
|
||||
engineConfiguration->triggerInputPins[1] = Gpio::A5;
|
||||
|
||||
// set this to SPI_DEVICE_3 to enable stimulation
|
||||
//engineConfiguration->digitalPotentiometerSpiDevice = SPI_DEVICE_3;
|
||||
engineConfiguration->digitalPotentiometerChipSelect[0] = Gpio::D7;
|
||||
engineConfiguration->digitalPotentiometerChipSelect[1] = Gpio::Unassigned;
|
||||
engineConfiguration->digitalPotentiometerChipSelect[2] = Gpio::D5;
|
||||
engineConfiguration->digitalPotentiometerChipSelect[3] = Gpio::Unassigned;
|
||||
|
||||
engineConfiguration->spi1mosiPin = Gpio::B5;
|
||||
engineConfiguration->spi1misoPin = Gpio::B4;
|
||||
engineConfiguration->spi1sckPin = Gpio::B3; // please note that this pin is also SWO/SWD - Single Wire debug Output
|
||||
|
||||
engineConfiguration->spi2mosiPin = Gpio::B15;
|
||||
engineConfiguration->spi2misoPin = Gpio::B14;
|
||||
engineConfiguration->spi2sckPin = Gpio::B13;
|
||||
|
||||
engineConfiguration->spi3mosiPin = Gpio::B5;
|
||||
engineConfiguration->spi3misoPin = Gpio::B4;
|
||||
engineConfiguration->spi3sckPin = Gpio::B3;
|
||||
|
||||
|
||||
|
||||
#if EFI_FILE_LOGGING
|
||||
setDefaultSdCardParameters();
|
||||
#endif /* EFI_FILE_LOGGING */
|
||||
|
||||
engineConfiguration->is_enabled_spi_1 = false;
|
||||
engineConfiguration->is_enabled_spi_2 = false;
|
||||
engineConfiguration->is_enabled_spi_3 = true;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "advance_map.h"
|
||||
#include "flash_main.h"
|
||||
|
||||
#include "hip9011_logic.h"
|
||||
#include "bench_test.h"
|
||||
|
||||
#if EFI_MEMS
|
||||
|
@ -320,19 +319,6 @@ static void setDefaultIdleSpeedTarget() {
|
|||
copyArray(config->cltIdleRpm, { 1350, 1350, 1300, 1200, 1150, 1100, 1050, 1000, 1000, 950, 950, 930, 900, 900, 1000, 1100 });
|
||||
}
|
||||
|
||||
static void setDefaultFrankensoStepperIdleParameters() {
|
||||
engineConfiguration->idle.stepperDirectionPin = Gpio::E10;
|
||||
engineConfiguration->idle.stepperStepPin = Gpio::E12;
|
||||
engineConfiguration->stepperEnablePin = Gpio::E14;
|
||||
engineConfiguration->idleStepperReactionTime = 10;
|
||||
engineConfiguration->idleStepperTotalSteps = 150;
|
||||
}
|
||||
|
||||
static void setCanFrankensoDefaults() {
|
||||
engineConfiguration->canTxPin = Gpio::B6;
|
||||
engineConfiguration->canRxPin = Gpio::B12;
|
||||
}
|
||||
|
||||
/**
|
||||
* see also setDefaultIdleSpeedTarget()
|
||||
*/
|
||||
|
@ -378,39 +364,6 @@ static void setDefaultEngineNoiseTable() {
|
|||
setArrayValues(engineConfiguration->knockBaseNoise, -20);
|
||||
}
|
||||
|
||||
static void setHip9011FrankensoPinout() {
|
||||
/**
|
||||
* SPI on PB13/14/15
|
||||
*/
|
||||
// engineConfiguration->hip9011CsPin = Gpio::D0; // rev 0.1
|
||||
|
||||
engineConfiguration->isHip9011Enabled = true;
|
||||
engineConfiguration->hip9011PrescalerAndSDO = HIP_8MHZ_PRESCALER; // 8MHz chip
|
||||
engineConfiguration->is_enabled_spi_2 = true;
|
||||
// todo: convert this to rusEfi, hardware-independent enum
|
||||
#if EFI_PROD_CODE
|
||||
#ifdef EFI_HIP_CS_PIN
|
||||
engineConfiguration->hip9011CsPin = EFI_HIP_CS_PIN;
|
||||
#else
|
||||
engineConfiguration->hip9011CsPin = Gpio::B0; // rev 0.4
|
||||
#endif
|
||||
engineConfiguration->hip9011CsPinMode = OM_OPENDRAIN;
|
||||
|
||||
engineConfiguration->hip9011IntHoldPin = Gpio::B11;
|
||||
engineConfiguration->hip9011IntHoldPinMode = OM_OPENDRAIN;
|
||||
|
||||
engineConfiguration->spi2SckMode = PO_OPENDRAIN; // 4
|
||||
engineConfiguration->spi2MosiMode = PO_OPENDRAIN; // 4
|
||||
engineConfiguration->spi2MisoMode = PO_PULLUP; // 32
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
engineConfiguration->hip9011Gain = 1;
|
||||
|
||||
if (!engineConfiguration->useTpicAdvancedMode) {
|
||||
engineConfiguration->hipOutputChannel = EFI_ADC_10; // PC0
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Global default engine configuration
|
||||
* This method sets the global engine configuration defaults. These default values are then
|
||||
|
@ -679,67 +632,9 @@ static void setDefaultEngineConfiguration() {
|
|||
strncpy(config->luaScript, "function onTick()\nend", efi::size(config->luaScript));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Hardware board-specific default configuration (GPIO pins, ADC channels, SPI configs etc.)
|
||||
*/
|
||||
|
||||
void setDefaultFrankensoConfiguration() {
|
||||
setDefaultFrankensoStepperIdleParameters();
|
||||
setCanFrankensoDefaults();
|
||||
|
||||
engineConfiguration->map.sensor.hwChannel = EFI_ADC_4;
|
||||
engineConfiguration->clt.adcChannel = EFI_ADC_6;
|
||||
engineConfiguration->iat.adcChannel = EFI_ADC_7;
|
||||
engineConfiguration->afr.hwChannel = EFI_ADC_14;
|
||||
|
||||
engineConfiguration->accelerometerSpiDevice = SPI_DEVICE_1;
|
||||
engineConfiguration->hip9011SpiDevice = SPI_DEVICE_2;
|
||||
engineConfiguration->cj125SpiDevice = SPI_DEVICE_2;
|
||||
|
||||
// engineConfiguration->gps_rx_pin = Gpio::B7;
|
||||
// engineConfiguration->gps_tx_pin = Gpio::B6;
|
||||
|
||||
engineConfiguration->triggerSimulatorPins[0] = Gpio::D1;
|
||||
engineConfiguration->triggerSimulatorPins[1] = Gpio::D2;
|
||||
|
||||
engineConfiguration->triggerInputPins[0] = Gpio::C6;
|
||||
engineConfiguration->triggerInputPins[1] = Gpio::A5;
|
||||
|
||||
// set this to SPI_DEVICE_3 to enable stimulation
|
||||
//engineConfiguration->digitalPotentiometerSpiDevice = SPI_DEVICE_3;
|
||||
engineConfiguration->digitalPotentiometerChipSelect[0] = Gpio::D7;
|
||||
engineConfiguration->digitalPotentiometerChipSelect[1] = Gpio::Unassigned;
|
||||
engineConfiguration->digitalPotentiometerChipSelect[2] = Gpio::D5;
|
||||
engineConfiguration->digitalPotentiometerChipSelect[3] = Gpio::Unassigned;
|
||||
|
||||
engineConfiguration->spi1mosiPin = Gpio::B5;
|
||||
engineConfiguration->spi1misoPin = Gpio::B4;
|
||||
engineConfiguration->spi1sckPin = Gpio::B3; // please note that this pin is also SWO/SWD - Single Wire debug Output
|
||||
|
||||
engineConfiguration->spi2mosiPin = Gpio::B15;
|
||||
engineConfiguration->spi2misoPin = Gpio::B14;
|
||||
engineConfiguration->spi2sckPin = Gpio::B13;
|
||||
|
||||
engineConfiguration->spi3mosiPin = Gpio::B5;
|
||||
engineConfiguration->spi3misoPin = Gpio::B4;
|
||||
engineConfiguration->spi3sckPin = Gpio::B3;
|
||||
|
||||
// set optional subsystem configs
|
||||
#if EFI_MEMS
|
||||
// this would override some values from above
|
||||
configureAccelerometerPins();
|
||||
#endif /* EFI_MEMS */
|
||||
|
||||
#if EFI_HIP_9011
|
||||
setHip9011FrankensoPinout();
|
||||
#endif /* EFI_HIP_9011 */
|
||||
|
||||
#if EFI_FILE_LOGGING
|
||||
setDefaultSdCardParameters();
|
||||
#endif /* EFI_FILE_LOGGING */
|
||||
|
||||
engineConfiguration->is_enabled_spi_1 = false;
|
||||
engineConfiguration->is_enabled_spi_2 = false;
|
||||
engineConfiguration->is_enabled_spi_3 = true;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_RESET_SWITCH_PORT
|
||||
|
|
Loading…
Reference in New Issue