eive-obsw/mission/system/objects/Stack5VHandler.h
Robin Mueller 557162fe8c
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
some more bugfixes
2023-01-10 15:04:49 +01:00

36 lines
1.0 KiB
C++

#ifndef MISSION_SYSTEM_OBJECTS_STACK5VHANDLER_H_
#define MISSION_SYSTEM_OBJECTS_STACK5VHANDLER_H_
#include <fsfw/power/PowerSwitchIF.h>
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
enum class StackCommander { RAD_SENSOR = 0, PL_PCDU = 1 };
enum class HandlerState { SWITCH_PENDING, IDLE };
class Stack5VHandler {
public:
static constexpr ReturnValue_t BUSY = returnvalue::makeCode(1, 0);
Stack5VHandler(PowerSwitchIF& switcher);
ReturnValue_t deviceToOn(StackCommander commander, bool updateStates);
ReturnValue_t deviceToOff(StackCommander commander, bool updateStates);
bool isSwitchOn();
void update();
private:
MutexIF* stackLock;
PowerSwitchIF& switcher;
bool switchIsOn = false;
bool targetState = false;
HandlerState handlerState = HandlerState::IDLE;
bool radSensorIsOn = false;
bool plPcduIsOn = false;
pcdu::Switches stackSwitch = pcdu::Switches::P60_DOCK_5V_STACK;
bool updateInternalStates();
};
#endif /* MISSION_SYSTEM_OBJECTS_STACK5VHANDLER_H_ */