only: more hellen power management

This commit is contained in:
rusefillc 2024-03-23 15:39:13 -04:00
parent a6c112144f
commit 644cba8d55
3 changed files with 13 additions and 4 deletions

View File

@ -45,8 +45,6 @@ void onBoardStandBy() {
hellenBoardStandBy(); hellenBoardStandBy();
} }
void setBoardConfigOverrides() { void setBoardConfigOverrides() {
setHellenMegaEnPin(); setHellenMegaEnPin();
setHellenVbatt(); setHellenVbatt();

View File

@ -43,12 +43,20 @@ void setHellen64Can() {
static OutputPin megaEn; static OutputPin megaEn;
void hellenEnableEn() {
megaEn.setValue(1);
}
void hellenDisableEn() {
megaEn.setValue(0);
}
void setHellenEnPin(Gpio pin) { void setHellenEnPin(Gpio pin) {
static bool initialized = false; static bool initialized = false;
if (!initialized) { if (!initialized) {
initialized = true; initialized = true;
megaEn.initPin("EN", pin); megaEn.initPin("EN", pin);
megaEn.setValue(1); hellenEnableEn();
} }
} }
@ -63,7 +71,7 @@ void setHellen64MegaEnPin() {
void hellenBoardStandBy() { void hellenBoardStandBy() {
// 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 // 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
megaEn.setValue(0); hellenDisableEn();
// todo: 200ms is totally random what's the science for this sleep duration? // todo: 200ms is totally random what's the science for this sleep duration?
chThdSleepMilliseconds(200); chThdSleepMilliseconds(200);
} }

View File

@ -16,6 +16,9 @@ void hellenWbo();
void setHellenMegaEnPin(); void setHellenMegaEnPin();
void setHellenEnPin(Gpio pin); void setHellenEnPin(Gpio pin);
void setHellen64MegaEnPin(); void setHellen64MegaEnPin();
void hellenEnableEn();
void hellenDisableEn();
void hellenBoardStandBy(); void hellenBoardStandBy();
void hellenMegaAccelerometerPreInitCS2Pin(); void hellenMegaAccelerometerPreInitCS2Pin();
void configureHellenCanTerminator(); void configureHellenCanTerminator();