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

Functions

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

Variables

static OutputPin megaEn
 
static bool hellenEnPinInitialized = false
 
OutputPin accelerometerChipSelect
 

Function Documentation

◆ boardEnableSendWidebandInfo()

bool boardEnableSendWidebandInfo ( )

Definition at line 56 of file hellen_common.cpp.

56  {
57  // when board is powered down we should be more CANbus silent
58  return getHellenBoardEnabled();
59 }
bool getHellenBoardEnabled()
Here is the call graph for this function:

◆ configureHellenCanTerminator()

void configureHellenCanTerminator ( )

Definition at line 130 of file hellen_common.cpp.

130  {
131  static bool initialized = false;
132  static OutputPin terminatorControlPin;
133  if (!initialized) {
134  initialized = true;
135  terminatorControlPin.initPin("CAN-term", H_SPI3_CS); // todo: make this pin configurable
136  terminatorControlPin.setValue(engineConfiguration->boardUseCanTerminator);
137  }
138 }
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:689
void setValue(const char *msg, int logicValue, bool isForce=false)
Definition: efi_gpio.cpp:581
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 140 of file hellen_common.cpp.

140  {
141 #ifndef EFI_BOOTLOADER
143 #endif /* EFI_BOOTLOADER */
144 }
EngineState engineState
Definition: engine.h:312
Engine * engine
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 63 of file hellen_common.cpp.

63  {
64  return !getHellenBoardEnabled();
65 }
Here is the call graph for this function:

◆ getHellenBoardEnabled()

bool getHellenBoardEnabled ( )

Definition at line 52 of file hellen_common.cpp.

52  {
54 }
bool getLogicValue() const
Definition: efi_gpio.cpp:645
PUBLIC_API_WEAK bool isBoardWithPowerManagement()
static OutputPin megaEn

Referenced by boardEnableSendWidebandInfo(), fansDisabledByBoardStatus(), 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 98 of file hellen_common.cpp.

98  {
99  // 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
100  hellenDisableEn();
101  // todo: 200ms is totally random what's the science for this sleep duration?
102  chThdSleepMilliseconds(200);
103 }
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 73 of file hellen_common.cpp.

73  {
74  efiPrintf("Turning board off [%s]", msg);
75  megaEn.setValue(0, /*isForce*/ true);
77 }
static void ResetFilters()

Referenced by configureRusefiLuaHooks(), and hellenBoardStandBy().

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 67 of file hellen_common.cpp.

67  {
68  efiPrintf("Turning board ON [%s]", msg);
69  megaEn.setValue(1, /*isForce*/ true);
71 }

Referenced by configureRusefiLuaHooks(), setHellenEnPin(), 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 121 of file hellen_common.cpp.

121  {
122 #if EFI_ONBOARD_MEMS
124  accelerometerChipSelect.initPin("mm-CS2", Gpio::H_SPI1_CS2);
126  }
127 #endif // EFI_ONBOARD_MEMS
128 }
bool isInitialized() const
Definition: efi_gpio.cpp:536
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 115 of file hellen_common.cpp.

115  {
117  // weird order of operations? i guess it does not really matter
119 }
void hellenMegaAccelerometerPreInitCS2Pin()
static void setHellenSdCardSpi1()
Definition: hellen_meta.h:277

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 5 of file hellen_common.cpp.

Referenced by setBoardDefaultConfiguration().

Here is the caller graph for this function:

◆ init5vpDiag()

static void init5vpDiag ( )
static

Definition at line 15 of file hellen_common.cpp.

15  {
16 #ifdef DIAG_5VP_PIN
17 static bool is5vpInit = false;
18  if (!is5vpInit) {
19  efiSetPadMode("5VP_STATE", DIAG_5VP_PIN, PAL_MODE_INPUT);
20  is5vpInit = true;
21  }
22 #endif // DIAG_5VP_PIN
23 }
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 48 of file hellen_common.cpp.

48  {
49  return false;
50 }

Referenced by getHellenBoardEnabled().

Here is the caller graph for this function:

◆ setHellen64Can()

void setHellen64Can ( )

◆ setHellen64MegaEnPin()

void setHellen64MegaEnPin ( )

Definition at line 94 of file hellen_common.cpp.

94  {
95  setHellenEnPin(Gpio::MM64_GP1); // OUT_PWR_EN
96 }
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:

◆ setHellenCan()

void setHellenCan ( )

Definition at line 10 of file hellen_common.cpp.

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

Referenced by setBoardConfigOverrides(), and setBoardDefaultConfiguration().

Here is the caller graph for this function:

◆ setHellenEnPin()

void setHellenEnPin ( Gpio  pin,
bool  enableBoardOnStartUp 
)

Definition at line 79 of file hellen_common.cpp.

79  {
82  megaEn.initPin("EN", pin);
83  if (enableBoardOnStartUp) {
84  hellenEnableEn("start-up");
85  }
86  }
87 }
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:

◆ setHellenMegaEnPin()

void setHellenMegaEnPin ( bool  enableBoardOnStartUp)

Definition at line 89 of file hellen_common.cpp.

89  {
90  // H144_GP8 matches MM100_GP8 which is used as PWR_EN on early mm100
91  setHellenEnPin(H144_GP8, enableBoardOnStartUp); // OUT_PWR_EN
92 }

Referenced by setBoardConfigOverrides().

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

◆ setHellenVbatt()

void setHellenVbatt ( )

Definition at line 25 of file hellen_common.cpp.

25  {
26  // 4.7k high side/4.7k low side = 2.0 ratio divider
28 
29  // set vbatt_divider 5.835
30  // 33k / 6.8k
31  engineConfiguration->vbattDividerCoeff = (33 + 6.8) / 6.8; // 5.835
32 
33  engineConfiguration->vbattAdcChannel = H144_IN_VBATT;
34 
35  engineConfiguration->adcVcc = 3.29f;
36 
37  init5vpDiag(); // piggy back on popular 'setHellenVbatt' method
38 }
static void init5vpDiag()

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 61 of file hellen_common.cpp.

Referenced by setHellenEnPin().

◆ megaEn

OutputPin megaEn
static

Go to the source code of this file.