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

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

◆ configureHellenCanTerminator()

void configureHellenCanTerminator ( )

Definition at line 127 of file hellen_common.cpp.

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

137  {
138 #ifndef EFI_BOOTLOADER
140 #endif /* EFI_BOOTLOADER */
141 }
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 62 of file hellen_common.cpp.

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

◆ getHellenBoardEnabled()

bool getHellenBoardEnabled ( )

Definition at line 51 of file hellen_common.cpp.

51  {
53 }
bool getLogicValue() const
Definition: efi_gpio.cpp:646
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 95 of file hellen_common.cpp.

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

71  {
72  efiPrintf("Turning board off [%s]", msg);
73  megaEn.setValue(0, /*isForce*/ true);
74 }

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

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

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

118  {
119 #if EFI_ONBOARD_MEMS
121  accelerometerChipSelect.initPin("mm-CS2", Gpio::H_SPI1_CS2);
123  }
124 #endif // EFI_ONBOARD_MEMS
125 }
bool isInitialized() const
Definition: efi_gpio.cpp:536
OutputPin accelerometerChipSelect

Referenced by hellenMegaSdWithAccelerometer().

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

◆ hellenMegaSdWithAccelerometer()

void hellenMegaSdWithAccelerometer ( )

Definition at line 112 of file hellen_common.cpp.

112  {
114  // weird order of operations? i guess it does not really matter
116 }
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 4 of file hellen_common.cpp.

Referenced by setBoardDefaultConfiguration().

Here is the caller graph for this function:

◆ init5vpDiag()

static void init5vpDiag ( )
static

Definition at line 14 of file hellen_common.cpp.

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

47  {
48  return false;
49 }

Referenced by getHellenBoardEnabled().

Here is the caller graph for this function:

◆ setHellen64Can()

void setHellen64Can ( )

◆ setHellen64MegaEnPin()

void setHellen64MegaEnPin ( )

Definition at line 91 of file hellen_common.cpp.

91  {
92  setHellenEnPin(Gpio::MM64_GP1); // OUT_PWR_EN
93 }
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 9 of file hellen_common.cpp.

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

Referenced by setBoardConfigOverrides(), and setBoardDefaultConfiguration().

Here is the caller graph for this function:

◆ setHellenEnPin()

void setHellenEnPin ( Gpio  pin,
bool  enableBoardOnStartUp 
)

Definition at line 76 of file hellen_common.cpp.

76  {
79  megaEn.initPin("EN", pin);
80  if (enableBoardOnStartUp) {
81  hellenEnableEn("start-up");
82  }
83  }
84 }
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 86 of file hellen_common.cpp.

86  {
87  // H144_GP8 matches MM100_GP8 which is used as PWR_EN on early mm100
88  setHellenEnPin(H144_GP8, enableBoardOnStartUp); // OUT_PWR_EN
89 }

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

24  {
25  // 4.7k high side/4.7k low side = 2.0 ratio divider
27 
28  // set vbatt_divider 5.835
29  // 33k / 6.8k
30  engineConfiguration->vbattDividerCoeff = (33 + 6.8) / 6.8; // 5.835
31 
32  engineConfiguration->vbattAdcChannel = H144_IN_VBATT;
33 
34  engineConfiguration->adcVcc = 3.29f;
35 
36  init5vpDiag(); // piggy back on popular 'setHellenVbatt' method
37 }
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 60 of file hellen_common.cpp.

Referenced by setHellenEnPin().

◆ megaEn

OutputPin megaEn
static

Go to the source code of this file.