void PowerSwitch::handle() { for(uint8_t index = 0; index < 4; index++) { if(getPowerSwitchStatus(index) == ON) { if(switchHandleClock[index].milliSecondsPassed() >= 500) { if(getSwitchPinStatus(index) == TRUE) { switchSet(index, FALSE); } else { switchSet(index, TRUE); } switchHandleClock[index].setStartTics(); } } } }
//-----------public---------------------------- void PowerSwitch::init() { POWER_SWITCH_1_TURN_DR(1); POWER_SWITCH_2_TURN_DR(1); //POWER_SWITCH_3_TURN_DR(1); //POWER_SWITCH_4_TURN_DR(1); POWER_SWITCH_SENSE_DR(0); for(uint8_t index = 0; index < 4; index++) { switchStatus[index] = OFF; switchSet(index, FALSE); } }
void PowerSwitch::turn_off(uint8_t switchIndex) { if((int8_t)switchIndex >= 0 && switchIndex < 4) { if(getPowerSwitchStatus(switchIndex) == ON) { switchStatus[switchIndex] = OFF; switchSet(switchIndex, FALSE); usart.printLn(&switchIndex, sizeof(switchIndex), NUMBER); usart.print(&_msg_pswitch_off, sizeof(_msg_pswitch_off), STRING); } } }
Foam::dictionary& Foam::debug::tolerances() { return switchSet("Tolerances", tolerancesPtr_); }
Foam::dictionary& Foam::debug::optimisationSwitches() { return switchSet("OptimisationSwitches", optimisationSwitchesPtr_); }
Foam::dictionary& Foam::debug::infoSwitches() { return switchSet("InfoSwitches", infoSwitchesPtr_); }
Foam::dictionary& Foam::debug::debugSwitches() { return switchSet("DebugSwitches", debugSwitchesPtr_); }