export board-specific macro for stm32 pins based on board yaml #3298

This commit is contained in:
rusefi 2023-09-02 21:14:06 -04:00
parent ea41455526
commit 51dda75914
16 changed files with 55 additions and 74 deletions

View File

@ -53,8 +53,8 @@ static void setupVbatt() {
static void setupDefaultSensorInputs() {
// trigger inputs, hall
engineConfiguration->triggerInputPins[0] = H144_IN_CRANK;
engineConfiguration->triggerInputPins[1] = H144_IN_CAM;
engineConfiguration->triggerInputPins[0] = Gpio::H144_IN_CRANK;
engineConfiguration->triggerInputPins[1] = Gpio::H144_IN_CAM;
engineConfiguration->camInputs[0] = Gpio::Unassigned;
engineConfiguration->tps1_1AdcChannel = H144_IN_TPS;

View File

@ -78,8 +78,8 @@ static void setupVbatt() {
static void setupDefaultSensorInputs() {
// trigger inputs, hall
engineConfiguration->triggerInputPins[0] = H144_IN_CRANK;
engineConfiguration->triggerInputPins[1] = H144_IN_CAM;
engineConfiguration->triggerInputPins[0] = Gpio::H144_IN_CRANK;
engineConfiguration->triggerInputPins[1] = Gpio::H144_IN_CAM;
engineConfiguration->camInputs[0] = Gpio::Unassigned;
setTPS1Inputs(H144_IN_TPS, H144_IN_AUX1);

View File

@ -12,8 +12,7 @@ pins:
color: red
- pin: A3
# H144_OUT_IO12
id: A8
meta: H144_OUT_IO12
class: outputs
function: Fuel Pump Relay Output (low)
type: ls
@ -76,32 +75,28 @@ pins:
color: orange
- pin: B2
# H144_IN_MAP2 AIN10 PC1
id: EFI_ADC_11
meta: H144_IN_MAP2
class: analog_inputs
function: MAP Sensor Input
ts_name: B2 - MAP
color: orange
- pin: B3
# H144_IN_IAT AIN14 PC3
id: EFI_ADC_13
meta: H144_IN_IAT
class: analog_inputs
function: IAT Sensor Input
ts_name: B3 - IAT
color: orange
- pin: B4
# H144_IN_O2S2 AIN12 PA1
id: EFI_ADC_1
meta: H144_IN_O2S2
class: analog_inputs
function: O2 Sensor Input
ts_name: B4 - O2
color: orange
- pin: B5
# H144_IN_TPS AIN17 PA4
id: EFI_ADC_4
meta: H144_IN_TPS
class: analog_inputs
function: TPS Sensor Input
ts_name: B5 - TPS
@ -113,8 +108,7 @@ pins:
color: orange
- pin: B7
# H144_IN_CLT AIN11 PC2
id: EFI_ADC_12
meta: H144_IN_CLT
class: analog_inputs
function: CLT Sensor Input
ts_name: B7 - CLT
@ -137,8 +131,7 @@ pins:
color: purple
- pin: C2
# H144_IN_D_3
id: [E14, E14]
id: [H144_IN_D_3, H144_IN_D_3]
class: [event_inputs, switch_inputs]
function: Crank Sensor -
type: hall
@ -146,8 +139,7 @@ pins:
color: white
- pin: C3
# H144_IN_D_1
id: [E12, E12]
id: [H144_IN_D_1, H144_IN_D_1]
class: [event_inputs, switch_inputs]
function: Crank Sensor +
type: hall
@ -155,8 +147,7 @@ pins:
color: gray
- pin: C2C3
# H144_IN_CRANK
id: B1
meta: H144_IN_CRANK
class: event_inputs
function: Crank Sensor (VR)
type: hall
@ -164,8 +155,7 @@ pins:
color: gray
- pin: C4
# H144_IN_VSS
id: [F11, F11]
id: [H144_IN_VSS, H144_IN_VSS]
class: [event_inputs, switch_inputs]
function: 2Step Digital Input
type: hall
@ -183,8 +173,7 @@ pins:
color: blue
- pin: C7
# H144_IN_CAM
id: [A6, A6, EFI_ADC_6]
id: [H144_IN_CAM, H144_IN_CAM, EFI_ADC_6]
class: [event_inputs, switch_inputs, analog_inputs]
function: Camshaft HALL Sensor or Generic Digital Input
type: hall
@ -232,16 +221,14 @@ pins:
color: orange
- pin: D5
# IN_PPS
id: EFI_ADC_3
meta: H144_IN_PPS
class: analog_inputs
function: PPS Sensor Input
ts_name: D5 - PPS
color: orange
- pin: D5g
# IN_TPS2
id: EFI_ADC_20
meta: H144_IN_TPS2
class: analog_inputs
function: PPS Sensor Input rev G
ts_name: D5 - PPS rev G
@ -284,8 +271,7 @@ pins:
color: purple
- pin: E3
# H144_IN_SENS2
id: [F4, F4]
id: [H144_IN_SENS2, H144_IN_SENS2]
class: [event_inputs, switch_inputs]
function: Digital Input 3
type: hall
@ -293,8 +279,7 @@ pins:
color: green
- pin: E4
# H144_IN_SENS3
id: [F5, F5]
id: [H144_IN_SENS3, H144_IN_SENS3]
class: [event_inputs, switch_inputs]
function: Digital Input 4
type: hall
@ -364,8 +349,7 @@ pins:
# also used as knock input (is hard-coded at the moment)
- pin: F3
# H144_IN_SENS4
id: F6
meta: H144_IN_SENS4
class: switch_inputs
function: Digital Input 5 / Knock Input
type: hall

View File

@ -86,7 +86,7 @@ static void setupVbatt() {
static void setupDefaultSensorInputs() {
// trigger inputs, hall
engineConfiguration->triggerInputPins[0] = H144_USB1ID;
engineConfiguration->triggerInputPins[1] = H144_IN_CAM;
engineConfiguration->triggerInputPins[1] = Gpio::H144_IN_CAM;
engineConfiguration->camInputs[0] = Gpio::Unassigned;
setTPS1Inputs(H144_IN_TPS, H144_IN_AUX1);

View File

@ -66,11 +66,11 @@ static void setupVbatt() {
static void setupDefaultSensorInputs() {
// trigger inputs, hall
engineConfiguration->triggerInputPins[0] = H144_IN_SENS4;
engineConfiguration->triggerInputPins[0] = Gpio::H144_IN_SENS4;
engineConfiguration->triggerInputPins[1] = Gpio::Unassigned;
engineConfiguration->camInputs[0] = Gpio::Unassigned;
engineConfiguration->vehicleSpeedSensorInputPin = H144_IN_VSS;
engineConfiguration->vehicleSpeedSensorInputPin = Gpio::H144_IN_VSS;
engineConfiguration->tps1_1AdcChannel = H144_IN_TPS;
engineConfiguration->tps1_2AdcChannel = H144_IN_O2S2;

View File

@ -56,9 +56,9 @@ static void setupVbatt() {
static void setupDefaultSensorInputs() {
// trigger inputs, hall
engineConfiguration->triggerInputPins[0] = H144_IN_SENS2;
engineConfiguration->triggerInputPins[0] = Gpio::H144_IN_SENS2;
engineConfiguration->triggerInputPins[1] = Gpio::Unassigned;
engineConfiguration->camInputs[0] = H144_IN_SENS4;
engineConfiguration->camInputs[0] = Gpio::H144_IN_SENS4;
setTPS1Inputs(H144_IN_TPS, H144_IN_AUX1);

View File

@ -40,7 +40,7 @@ static void setupVbatt() {
}
static void setupDefaultSensorInputs() {
engineConfiguration->vehicleSpeedSensorInputPin = H144_IN_VSS;
engineConfiguration->vehicleSpeedSensorInputPin = Gpio::H144_IN_VSS;
engineConfiguration->tps1_1AdcChannel = H144_IN_TPS;
@ -137,7 +137,7 @@ void setBoardDefaultConfiguration() {
engineConfiguration->hondaK = true;
engineConfiguration->verboseKLine = true;
engineConfiguration->brakePedalPin = H144_IN_CAM;
engineConfiguration->brakePedalPin = Gpio::H144_IN_CAM;
engineConfiguration->acRelayPin = Gpio::H144_LS_5;
engineConfiguration->tachOutputPin = Gpio::H144_OUT_IO10;
// A/C switch on k-line

View File

@ -48,9 +48,9 @@ static void setupVbatt() {
static void setupDefaultSensorInputs() {
// trigger inputs, hall
engineConfiguration->triggerInputPins[0] = H144_IN_CRANK;
engineConfiguration->triggerInputPins[0] = Gpio::H144_IN_CRANK;
engineConfiguration->triggerInputPins[1] = Gpio::Unassigned;
engineConfiguration->camInputs[0] = H144_IN_CAM;
engineConfiguration->camInputs[0] = Gpio::H144_IN_CAM;
engineConfiguration->tps1_1AdcChannel = H144_IN_TPS;

View File

@ -49,10 +49,10 @@ static void setupVbatt() {
static void setupDefaultSensorInputs() {
// trigger inputs
engineConfiguration->triggerInputPins[0] = H144_IN_CRANK;
engineConfiguration->triggerInputPins[0] = Gpio::H144_IN_CRANK;
engineConfiguration->triggerInputPins[1] = Gpio::Unassigned;
// Direct hall-only cam input
engineConfiguration->camInputs[0] = H144_IN_CAM;
engineConfiguration->camInputs[0] = Gpio::H144_IN_CAM;
// todo: remove from default since 4 cylinder does not use it
// todo: this requires unit test change
engineConfiguration->camInputs[1 * CAMS_PER_BANK] = H144_IN_D_AUX4;

View File

@ -46,7 +46,7 @@ static void setupDefaultSensorInputs() {
engineConfiguration->vvtMode[0] = VVT_SINGLE_TOOTH;
engineConfiguration->vvtMode[1] = VVT_SINGLE_TOOTH;
engineConfiguration->vehicleSpeedSensorInputPin = H144_IN_VSS;
engineConfiguration->vehicleSpeedSensorInputPin = Gpio::H144_IN_VSS;
setTPS1Inputs(H144_IN_TPS, H144_IN_AUX1);
@ -80,8 +80,8 @@ void setBoardConfigOverrides() {
int16_t hellenBoardId = engine->engineState.hellenBoardId;
if (hellenBoardId == -1) {
engineConfiguration->triggerInputPins[0] = H144_IN_CRANK;
engineConfiguration->camInputs[0] = H144_IN_CAM;
engineConfiguration->triggerInputPins[0] = Gpio::H144_IN_CRANK;
engineConfiguration->camInputs[0] = Gpio::H144_IN_CAM;
// control pins are inverted since overall ECU pinout seems to be inverted
engineConfiguration->etbIo[0].directionPin1 = Gpio::H144_OUT_PWM3;
@ -105,8 +105,8 @@ void setBoardConfigOverrides() {
}
engineConfiguration->stepperDcInvertedPins = false;
} else if (hellenBoardId == BOARD_ID_154hyundai_c || hellenBoardId == BOARD_ID_154hyundai_d) {
engineConfiguration->triggerInputPins[0] = H144_IN_SENS2;
engineConfiguration->camInputs[0] = H144_IN_SENS3;
engineConfiguration->triggerInputPins[0] = Gpio::H144_IN_SENS2;
engineConfiguration->camInputs[0] = Gpio::H144_IN_SENS3;
// todo You would not believe how you invert TLE9201 #4579

View File

@ -99,7 +99,7 @@ void setBoardDefaultConfiguration() {
engineConfiguration->tachOutputPin = Gpio::I0;
engineConfiguration->malfunctionIndicatorPin = Gpio::G9;
engineConfiguration->vehicleSpeedSensorInputPin = H144_IN_VSS;
engineConfiguration->vehicleSpeedSensorInputPin = Gpio::H144_IN_VSS;
// "required" hardware is done - set some reasonable defaults
setupDefaultSensorInputs();

View File

@ -101,7 +101,7 @@ void setBoardDefaultConfiguration() {
engineConfiguration->acSwitch = Gpio::B0;
engineConfiguration->acSwitchMode = PI_PULLUP;
engineConfiguration->vehicleSpeedSensorInputPin = H144_IN_VSS;
engineConfiguration->vehicleSpeedSensorInputPin = Gpio::H144_IN_VSS;
engineConfiguration->clutchDownPin = H144_IN_RES3;
engineConfiguration->clutchDownPinInverted = true;

View File

@ -46,10 +46,10 @@ static void setupVbatt() {
static void setupDefaultSensorInputs() {
// trigger inputs
engineConfiguration->triggerInputPins[0] = H144_IN_CRANK;
engineConfiguration->triggerInputPins[0] = Gpio::H144_IN_CRANK;
engineConfiguration->triggerInputPins[1] = Gpio::Unassigned;
// Direct hall-only cam input
engineConfiguration->camInputs[0] = H144_IN_CAM;
engineConfiguration->camInputs[0] = Gpio::H144_IN_CAM;
engineConfiguration->tps1_1AdcChannel = H144_IN_TPS;
engineConfiguration->tps1_2AdcChannel = H144_IN_AUX1;

View File

@ -48,8 +48,8 @@ static void setupVbatt() {
static void setupDefaultSensorInputs() {
// trigger inputs, hall
engineConfiguration->triggerInputPins[0] = H144_IN_CAM;
engineConfiguration->triggerInputPins[1] = H144_IN_CRANK;
engineConfiguration->triggerInputPins[0] = Gpio::H144_IN_CAM;
engineConfiguration->triggerInputPins[1] = Gpio::H144_IN_CRANK;
engineConfiguration->camInputs[0] = Gpio::Unassigned;
engineConfiguration->tps1_1AdcChannel = H144_IN_TPS;

View File

@ -40,8 +40,7 @@ pins:
color: yellow
- pin: A8
# H144_LS_1
id: G7
meta: H144_LS_1
function: Low Side Output 1 5A
class: outputs
ts_name: A8 - Low Side
@ -64,8 +63,7 @@ pins:
color: orange
- pin: B8
# H144_LS_2
id: G8
meta: H144_LS_2
function: Low Side Output 2 5A
class: outputs
type: inj
@ -73,8 +71,7 @@ pins:
color: blue
- pin: C1
# H144_OUT_PWM4
id: C8
meta: H64_OUT_PWM2
class: outputs
function: Low Side Output 3 5A
type: ls

View File

@ -47,9 +47,9 @@ void detectHellenBoardType();
#define H64_SPI1_CS1 Gpio::D2
#define H64_OUT_PWM1 Gpio::B7
#define H64_OUT_PWM2 Gpio::C8
#define H64_OUT_PWM2 C8
#define H64_OUT_PWM3 Gpio::C9
#define H64_OUT_PWM4 Gpio::A8
#define H64_OUT_PWM4 A8
#define H64_OUT_PWM5 Gpio::A9
#define H64_OUT_PWM6 Gpio::A15
@ -131,13 +131,13 @@ void detectHellenBoardType();
#define H144_OUT_IO13 G6
// A24
#define H144_IN_CRANK Gpio::B1
#define H144_IN_CRANK B1
#define H144_IN_CRANK_ANALOG EFI_ADC_9
// A19
#define H144_IN_CAM Gpio::A6
#define H144_IN_CAM A6
#define H144_IN_CAM_ANALOG EFI_ADC_6
// DIN5
#define H144_IN_VSS Gpio::F11
#define H144_IN_VSS F11
// IN_CLT AIN11 PC2
#define H144_IN_CLT EFI_ADC_12
@ -186,11 +186,11 @@ void detectHellenBoardType();
// A1 AIN1 no code to use ADC3 as analog
#define H144_IN_SENS1 Gpio::F3
// A2 AIN2 no code to use ADC3 as analog
#define H144_IN_SENS2 Gpio::F4
#define H144_IN_SENS2 F4
// A3 AIN3 no code to use ADC3 as analog
#define H144_IN_SENS3 Gpio::F5
#define H144_IN_SENS3 F5
// A4 AIN4 no code to use ADC3 as analog
#define H144_IN_SENS4 Gpio::F6
#define H144_IN_SENS4 F6
// IN_O2S AIN13 A13 PA0
#define H144_IN_O2S EFI_ADC_0
@ -198,11 +198,11 @@ void detectHellenBoardType();
#define H144_IN_O2S2 EFI_ADC_1
// IN_D1(old) or IN_DIG8(new/mega-module)
#define H144_IN_D_1 Gpio::E12
#define H144_IN_D_1 E12
// IN_D2(old) or IN_DIG9(new/mm)
#define H144_IN_D_2 Gpio::E13
// IN_D3(old) or IN_DIG10(new)
#define H144_IN_D_3 Gpio::E14
#define H144_IN_D_3 E14
// IN_D4(old) or IN_DIG11(new)
#define H144_IN_D_4 Gpio::E15