rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions | Variables
hellen_common.cpp File Reference

Functions

void hellenWbo ()
 
void setHellenCan ()
 
static void init5vpDiag ()
 
void setHellenAnalogDividers ()
 
void setHellenVbatt ()
 
void setHellen64Can ()
 
PUBLIC_API_WEAK bool isBoardWithPowerManagement ()
 
bool getHellenBoardEnabled ()
 
bool boardEnableSendWidebandInfo ()
 
bool fansDisabledByBoardStatus ()
 
PUBLIC_API_WEAK void onHellenEnChange (int value)
 
static void setHellenEnValue (int value)
 
void hellenEnableEn (const char *msg)
 
void hellenDisableEn (const char *msg)
 
void hellenDisableEnSilently ()
 
void setHellenEnPin (Gpio pin, bool enableBoardOnStartUp)
 
void setHellenMegaEnPin (bool enableBoardOnStartUp)
 
void setHellen64MegaEnPin ()
 
void hellenBoardStandBy ()
 
void hellenMegaSdWithAccelerometer ()
 
void hellenMegaAccelerometerPreInitCS2Pin ()
 
void configureHellenCanTerminator ()
 
void detectHellenBoardType ()
 
int boardGetAnalogDiagnostic ()
 

Variables

static OutputPin megaEn
 
static bool hellenEnPinInitialized = false
 
OutputPin accelerometerChipSelect
 

Function Documentation

◆ boardEnableSendWidebandInfo()

bool boardEnableSendWidebandInfo ( )

Definition at line 60 of file hellen_common.cpp.

60 {
61 // when board is powered down we should be more CANbus silent
62 return getHellenBoardEnabled();
63}
bool getHellenBoardEnabled()

Referenced by CanWrite::PeriodicTask().

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

◆ boardGetAnalogDiagnostic()

int boardGetAnalogDiagnostic ( )

Definition at line 169 of file hellen_common.cpp.

170{
171#ifdef DIAG_5VP_PIN
172 /* paranoid check */
173 if (!isBrainPinValid(DIAG_5VP_PIN)) {
174 /* Pin is not defined - return success */
175 return 0;
176 }
177
178 return efiReadPin(DIAG_5VP_PIN) ? 0 : -1;
179#else
180 return 0;
181#endif
182}
bool efiReadPin(brain_pin_e pin)
Definition io_pins.cpp:89
bool isBrainPinValid(brain_pin_e brainPin)
Here is the call graph for this function:

◆ configureHellenCanTerminator()

void configureHellenCanTerminator ( )

Definition at line 153 of file hellen_common.cpp.

153 {
154 static bool initialized = false;
155 static OutputPin terminatorControlPin;
156 if (!initialized) {
157 initialized = true;
158 terminatorControlPin.initPin("CAN-term", H_SPI3_CS); // todo: make this pin configurable
160 }
161}
Single output pin reference and state.
Definition efi_output.h:50
void initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e outputMode, bool forceInitWithFatalError=false)
Definition efi_gpio.cpp:697
void setValue(const char *msg, int logicValue, bool isForce=false)
Definition efi_gpio.cpp:590
static constexpr engine_configuration_s * engineConfiguration
static int initialized

Referenced by setBoardConfigOverrides().

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

◆ detectHellenBoardType()

void detectHellenBoardType ( )

Definition at line 163 of file hellen_common.cpp.

163 {
164#ifndef EFI_BOOTLOADER
166#endif /* EFI_BOOTLOADER */
167}
EngineState engineState
Definition engine.h:325
static Engine *const engine
Definition engine.h:389
int hackHellenBoardId(int detectedId)
int detectHellenBoardId()

Referenced by detectBoardType().

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

◆ fansDisabledByBoardStatus()

bool fansDisabledByBoardStatus ( )

Definition at line 67 of file hellen_common.cpp.

67 {
68 return !getHellenBoardEnabled();
69}

Referenced by FanController::getState().

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

◆ getHellenBoardEnabled()

bool getHellenBoardEnabled ( )

Definition at line 56 of file hellen_common.cpp.

56 {
58}
bool getLogicValue() const
Definition efi_gpio.cpp:653
PUBLIC_API_WEAK bool isBoardWithPowerManagement()
static OutputPin megaEn

Referenced by boardEnableSendWidebandInfo(), fansDisabledByBoardStatus(), setHwQcMode(), and THD_FUNCTION().

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

◆ hellenBoardStandBy()

void hellenBoardStandBy ( )

Definition at line 121 of file hellen_common.cpp.

121 {
122 // we need to turn 'megaEn' and pause for a bit to make sure that WBO is off and does not wake main firmware right away
124 // todo: 200ms is totally random what's the science for this sleep duration?
125 chThdSleepMilliseconds(200);
126}
void hellenDisableEn(const char *msg)

Referenced by onBoardStandBy().

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

◆ hellenDisableEn()

void hellenDisableEn ( const char msg)

Definition at line 85 of file hellen_common.cpp.

85 {
86#if EFI_FILE_LOGGING && EFI_PROD_CODE
87 // un-mount before turning power off SD card
89 // trying worst case just to test things
90 chThdSleepMilliseconds(1000);
91#endif
92 efiPrintf("Turning board off [%s]", msg);
94}
void hellenDisableEnSilently()
void sdCardRequestMode(SD_MODE mode)
Definition mmc_card.cpp:928
@ SD_MODE_UNMOUNT
Definition mmc_card.h:20

Referenced by configureRusefiLuaHooks(), and hellenBoardStandBy().

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

◆ hellenDisableEnSilently()

void hellenDisableEnSilently ( )

Definition at line 96 of file hellen_common.cpp.

96 {
97 // this function is called from criticalShutdown() that may be called from hardFault handler
98 // please no call to OS functions!
100}
static void setHellenEnValue(int value)

Referenced by hellenDisableEn(), and turnAllPinsOff().

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

◆ hellenEnableEn()

void hellenEnableEn ( const char msg)

Definition at line 80 of file hellen_common.cpp.

80 {
81 efiPrintf("Turning board ON [%s]", msg);
83}

Referenced by configureRusefiLuaHooks(), setHellenEnPin(), setHwQcMode(), and THD_FUNCTION().

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

◆ hellenMegaAccelerometerPreInitCS2Pin()

void hellenMegaAccelerometerPreInitCS2Pin ( )

Definition at line 144 of file hellen_common.cpp.

144 {
145#if EFI_ONBOARD_MEMS
147 accelerometerChipSelect.initPin("mm-CS2", Gpio::H_SPI1_CS2);
149 }
150#endif // EFI_ONBOARD_MEMS
151}
bool isInitialized() const
Definition efi_gpio.cpp:545
OutputPin accelerometerChipSelect

Referenced by hellenMegaSdWithAccelerometer(), and setBoardConfigOverrides().

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

◆ hellenMegaSdWithAccelerometer()

void hellenMegaSdWithAccelerometer ( )

Definition at line 138 of file hellen_common.cpp.

138 {
140 // weird order of operations? i guess it does not really matter
142}
void hellenMegaAccelerometerPreInitCS2Pin()
static void setHellenSdCardSpi1Hardware()

Referenced by setBoardConfigOverrides().

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

◆ hellenWbo()

void hellenWbo ( )

Definition at line 6 of file hellen_common.cpp.

Referenced by setBoardDefaultConfiguration().

Here is the caller graph for this function:

◆ init5vpDiag()

static void init5vpDiag ( )
static

Definition at line 16 of file hellen_common.cpp.

16 {
17#ifdef DIAG_5VP_PIN
18static bool is5vpInit = false;
19 if (!is5vpInit) {
20 efiSetPadMode("5VP_STATE", DIAG_5VP_PIN, PAL_MODE_INPUT);
21 is5vpInit = true;
22 }
23#endif // DIAG_5VP_PIN
24}
void efiSetPadMode(const char *msg, brain_pin_e brainPin, iomode_t mode)

Referenced by setHellenVbatt().

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

◆ isBoardWithPowerManagement()

PUBLIC_API_WEAK bool isBoardWithPowerManagement ( )

Definition at line 52 of file hellen_common.cpp.

52 {
53 return false;
54}

Referenced by getHellenBoardEnabled().

Here is the caller graph for this function:

◆ onHellenEnChange()

PUBLIC_API_WEAK void onHellenEnChange ( int  value)

Definition at line 71 of file hellen_common.cpp.

71 {
72}

Referenced by setHellenEnValue().

Here is the caller graph for this function:

◆ setHellen64Can()

void setHellen64Can ( )

◆ setHellen64MegaEnPin()

void setHellen64MegaEnPin ( )

Definition at line 117 of file hellen_common.cpp.

117 {
118 setHellenEnPin(Gpio::MM64_GP1); // OUT_PWR_EN
119}
void setHellenEnPin(Gpio pin, bool enableBoardOnStartUp)

Referenced by setBoardConfigOverrides().

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

◆ setHellenAnalogDividers()

void setHellenAnalogDividers ( )

Definition at line 26 of file hellen_common.cpp.

26 {
27 // 4.7k high side/4.7k low side = 2.0 ratio divider
29
30 // set vbatt_divider 5.835
31 // 33k / 6.8k
32 engineConfiguration->vbattDividerCoeff = (33 + 6.8) / 6.8; // 5.835
34}

Referenced by setBoardConfigOverrides(), and setHellenVbatt().

Here is the caller graph for this function:

◆ setHellenCan()

void setHellenCan ( )

Definition at line 11 of file hellen_common.cpp.

11 {
12 engineConfiguration->canTxPin = H176_CAN_TX;
13 engineConfiguration->canRxPin = H176_CAN_RX;
14}

Referenced by setBoardConfigOverrides(), and setBoardDefaultConfiguration().

Here is the caller graph for this function:

◆ setHellenEnPin()

void setHellenEnPin ( Gpio  pin,
bool  enableBoardOnStartUp 
)

Definition at line 102 of file hellen_common.cpp.

102 {
105 megaEn.initPin("EN", pin);
106 if (enableBoardOnStartUp) {
107 hellenEnableEn("start-up");
108 }
109 }
110}
void hellenEnableEn(const char *msg)
static bool hellenEnPinInitialized
brain_pin_e pin
Definition stm32_adc.cpp:15

Referenced by boardInitHardware(), setBoardConfigOverrides(), setHellen64MegaEnPin(), and setHellenMegaEnPin().

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

◆ setHellenEnValue()

static void setHellenEnValue ( int  value)
static

Definition at line 74 of file hellen_common.cpp.

74 {
75 megaEn.setValue(value, /*isForce*/ true);
76 onHellenEnChange(value);
78}
static void ResetFilters()
PUBLIC_API_WEAK void onHellenEnChange(int value)

Referenced by hellenDisableEnSilently(), and hellenEnableEn().

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

◆ setHellenMegaEnPin()

void setHellenMegaEnPin ( bool  enableBoardOnStartUp)

Definition at line 112 of file hellen_common.cpp.

112 {
113 // H144_GP8 matches MM100_GP8 which is used as PWR_EN on early mm100
114 setHellenEnPin(H144_GP8, enableBoardOnStartUp); // OUT_PWR_EN
115}

Referenced by boardInitHardware(), and setBoardConfigOverrides().

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

◆ setHellenVbatt()

void setHellenVbatt ( )

Definition at line 36 of file hellen_common.cpp.

36 {
38
39 engineConfiguration->vbattAdcChannel = H144_IN_VBATT;
40
41 init5vpDiag(); // piggy back on popular 'setHellenVbatt' method
42}
static void init5vpDiag()
void setHellenAnalogDividers()

Referenced by setBoardConfigOverrides().

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

Variable Documentation

◆ accelerometerChipSelect

OutputPin accelerometerChipSelect
extern

We need to make sure that accelerometer device which physically exists does not conflict with SD card in case of shared SPI. We reply on specific order of execution here: 1) accelerometer pre-initialization into safe CS pin state 2) SD card initialization 3) accelerometer main initialization if accelerometer feature is desired

Definition at line 59 of file accelerometer.cpp.

Referenced by hellenMegaAccelerometerPreInitCS2Pin(), and initAccelerometer().

◆ hellenEnPinInitialized

bool hellenEnPinInitialized = false
static

Definition at line 65 of file hellen_common.cpp.

Referenced by setHellenEnPin().

◆ megaEn

OutputPin megaEn
static

Definition at line 49 of file hellen_common.cpp.

Referenced by getHellenBoardEnabled(), setHellenEnPin(), and setHellenEnValue().

Go to the source code of this file.