rusEFI
The most advanced open source ECU
Functions | Variables
board_configuration.cpp File Reference

Detailed Description

Configuration defaults for the 2chan board.

Author
andreika prome.nosp@m.theu.nosp@m.s.pcb.nosp@m.@gma.nosp@m.il.co.nosp@m.m
Andrey Belomutskiy, (c) 2012-2020

Definition in file board_configuration.cpp.

Functions

static void setInjectorPins ()
 
static void setIgnitionPins ()
 
static void setupDefaultSensorInputs ()
 
void boardInitHardware ()
 
void boardOnConfigurationChange (engine_configuration_s *)
 
static bool isMegaModuleRevision ()
 
void setBoardConfigOverrides ()
 
void setBoardDefaultConfiguration ()
 Board-specific configuration defaults. More...
 
void boardPrepareForStop ()
 
int getBoardMetaOutputsCount ()
 
GpiogetBoardMetaOutputs ()
 

Variables

static OutputPin alphaTachPullUp
 
static OutputPin alphaTempPullUp
 
static OutputPin alphaCrankPPullUp
 
static OutputPin alphaCrankNPullUp
 
static OutputPin alpha2stepPullDown
 
static OutputPin alphaCamPullDown
 
static Gpio OUTPUTS []
 

Function Documentation

◆ boardInitHardware()

void boardInitHardware ( )

Definition at line 58 of file board_configuration.cpp.

58  {
59 
60  alphaTachPullUp.initPin("a-tach", Gpio::H144_OUT_IO1);
61  alphaTempPullUp.initPin("a-temp", Gpio::H144_OUT_IO4);
62  alphaCrankPPullUp.initPin("a-crank-p", Gpio::H144_OUT_IO2);
63  alphaCrankNPullUp.initPin("a-crank-n", Gpio::H144_OUT_IO5);
64  alpha2stepPullDown.initPin("a-2step", Gpio::H144_OUT_IO7);
65  alphaCamPullDown.initPin("a-cam", Gpio::H144_OUT_IO8);
67 }
void initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e outputMode, bool forceInitWithFatalError=false)
Definition: efi_gpio.cpp:690
static OutputPin alphaCamPullDown
static OutputPin alphaTachPullUp
static OutputPin alphaCrankPPullUp
static OutputPin alphaTempPullUp
void boardOnConfigurationChange(engine_configuration_s *)
static OutputPin alpha2stepPullDown
static OutputPin alphaCrankNPullUp
Here is the call graph for this function:

◆ boardOnConfigurationChange()

void boardOnConfigurationChange ( engine_configuration_s previousConfiguration)

Definition at line 69 of file board_configuration.cpp.

Referenced by boardInitHardware().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ boardPrepareForStop()

void boardPrepareForStop ( )

Definition at line 153 of file board_configuration.cpp.

153  {
154  // Wake on the CAN RX pin
155  palEnableLineEvent(PAL_LINE(GPIOD, 0), PAL_EVENT_MODE_RISING_EDGE);
156 }

◆ getBoardMetaOutputs()

Gpio* getBoardMetaOutputs ( )

Definition at line 167 of file board_configuration.cpp.

167  {
168  return OUTPUTS;
169 }
static Gpio OUTPUTS[]

Referenced by setPin().

Here is the caller graph for this function:

◆ getBoardMetaOutputsCount()

int getBoardMetaOutputsCount ( )

Definition at line 163 of file board_configuration.cpp.

163  {
164  return efi::size(OUTPUTS);
165 }
composite packet size

Referenced by getBoardMetaLowSideOutputsCount(), sendOutBoardMeta(), and setPin().

Here is the caller graph for this function:

◆ isMegaModuleRevision()

static bool isMegaModuleRevision ( )
static

Definition at line 80 of file board_configuration.cpp.

80  {
82  return hellenBoardId != BOARD_ID_ALPHA2CH_B && hellenBoardId != BOARD_ID_ALPHA2CH_C && hellenBoardId != BOARD_ID_ALPHA2CH_D;
83 }
EngineState engineState
Definition: engine.h:315
Engine * engine
hellenBoardId("Detected Board ID", SensorCategory.SENSOR_INPUTS, FieldType.INT16, 1152, 1.0, 0.0, 3000.0, "id")

Referenced by setBoardConfigOverrides(), and setBoardDefaultConfiguration().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBoardConfigOverrides()

void setBoardConfigOverrides ( )

Definition at line 85 of file board_configuration.cpp.

85  {
88 
89  // rev.D uses SPI1 pins for CAN2, but rev.E and later uses mega-module meaning SPI1 for SD-card
90  if (isMegaModuleRevision()) {
93  } else {
94  setHellenEnPin(Gpio::H144_OUT_IO3);
95  }
96 
97  // todo: is it time for some helper method to work with sets?!
98  bool isBeforeRevG = hellenBoardId == BOARD_ID_ALPHA2CH_B ||
99  hellenBoardId == BOARD_ID_ALPHA2CH_C ||
100  hellenBoardId == BOARD_ID_ALPHA2CH_D ||
101  hellenBoardId == BOARD_ID_ALPHA2CH_E ||
102  hellenBoardId == BOARD_ID_ALPHA2CH_F;
103 
104  if (isBeforeRevG) {
105  engineConfiguration->vrThreshold[0].pin = Gpio::H144_OUT_PWM6;
106  } else {
107  engineConfiguration->vrThreshold[0].pin = Gpio::Unassigned; // rev G started to use MAX9924
108  }
109 
110  engineConfiguration->vrThreshold[1].pin = Gpio::Unassigned; // 2chan never had second VR
112 
113  setHellenCan();
114 }
@ Unassigned
static bool isMegaModuleRevision()
void hellenMegaSdWithAccelerometer()
void setHellenCan()
void setHellenVbatt()
void setHellenEnPin(Gpio pin, bool enableBoardOnStartUp)
void setHellenMegaEnPin(bool enableBoardOnStartUp)
void setDefaultHellenAtPullUps()
Definition: hellen_meta.h:314
Here is the call graph for this function:

◆ setBoardDefaultConfiguration()

void setBoardDefaultConfiguration ( )

Board-specific configuration defaults.

Hardware board-specific default configuration (GPIO pins, ADC channels, SPI configs etc.)

See also setDefaultEngineConfiguration

!!!!!!!!!!!!!!!!!!

Definition at line 122 of file board_configuration.cpp.

122  {
123  setInjectorPins();
124  setIgnitionPins();
125 
126  if (isMegaModuleRevision()) {
127  setHellenMMbaro();
128  engineConfiguration->map.sensor.hwChannel = H144_IN_MAP3; // On-board MAP
129  engineConfiguration->map.sensor.type = MT_MPXH6400;
130  } else {
131  engineConfiguration->map.sensor.hwChannel = H144_IN_MAP2; // B2 external signal
132  engineConfiguration->baroSensor.type = MT_MPXH6400;
133  engineConfiguration->baroSensor.hwChannel = H144_IN_MAP3; // On-board MAP
134  }
135 
137 
138  engineConfiguration->fuelPumpPin = Gpio::H144_OUT_PWM2;
139  engineConfiguration->fanPin = Gpio::H144_OUT_PWM4;
140  engineConfiguration->tachOutputPin = Gpio::H144_OUT_PWM3;
141 
142  // "required" hardware is done - set some reasonable defaults
144 
145  setInline4();
146 
147  engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS; // IM_WASTED_SPARK
148 
149  engineConfiguration->launchActivationMode = CLUTCH_INPUT_LAUNCH;
150 // ? engineConfiguration->malfunctionIndicatorPin = Gpio::G4; //1E - Check Engine Light
151 }
void setInline4()
static void setupDefaultSensorInputs()
static void setIgnitionPins()
static void setInjectorPins()
void setHellenMMbaro()
Definition: hellen_meta.h:319
Here is the call graph for this function:

◆ setIgnitionPins()

static void setIgnitionPins ( )
static

Definition at line 34 of file board_configuration.cpp.

Referenced by setBoardDefaultConfiguration().

Here is the caller graph for this function:

◆ setInjectorPins()

static void setInjectorPins ( )
static

◆ setupDefaultSensorInputs()

static void setupDefaultSensorInputs ( )
static

Definition at line 41 of file board_configuration.cpp.

41  {
42  // trigger inputs, hall
43  engineConfiguration->triggerInputPins[0] = Gpio::H144_IN_CRANK;
44  engineConfiguration->triggerInputPins[1] = Gpio::H144_IN_CAM;
46 
48 
49 
50 
51  engineConfiguration->afr.hwChannel = EFI_ADC_1;
52 
53  engineConfiguration->clt.adcChannel = H144_IN_CLT;
54 
55  engineConfiguration->iat.adcChannel = H144_IN_IAT;
56 }
brain_input_pin_e triggerInputPins[TRIGGER_INPUT_PIN_COUNT]

Referenced by setBoardDefaultConfiguration().

Here is the caller graph for this function:

Variable Documentation

◆ alpha2stepPullDown

OutputPin alpha2stepPullDown
static

Definition at line 19 of file board_configuration.cpp.

Referenced by boardInitHardware(), and boardOnConfigurationChange().

◆ alphaCamPullDown

OutputPin alphaCamPullDown
static

Definition at line 20 of file board_configuration.cpp.

Referenced by boardInitHardware(), and boardOnConfigurationChange().

◆ alphaCrankNPullUp

OutputPin alphaCrankNPullUp
static

Definition at line 18 of file board_configuration.cpp.

Referenced by boardInitHardware(), and boardOnConfigurationChange().

◆ alphaCrankPPullUp

OutputPin alphaCrankPPullUp
static

Definition at line 17 of file board_configuration.cpp.

Referenced by boardInitHardware(), and boardOnConfigurationChange().

◆ alphaTachPullUp

OutputPin alphaTachPullUp
static

Definition at line 15 of file board_configuration.cpp.

Referenced by boardInitHardware(), and boardOnConfigurationChange().

◆ alphaTempPullUp

OutputPin alphaTempPullUp
static

Definition at line 16 of file board_configuration.cpp.

Referenced by boardInitHardware(), and boardOnConfigurationChange().

◆ OUTPUTS

Gpio OUTPUTS[]
static
Initial value:
= {
Gpio::H144_LS_1,
Gpio::H144_LS_2,
}

Definition at line 158 of file board_configuration.cpp.

Referenced by getBoardMetaOutputs(), and getBoardMetaOutputsCount().

Go to the source code of this file.