eive-obsw/mission/system/objects/Stack5VHandler.h

32 lines
910 B
C
Raw Normal View History

2022-12-21 14:11:31 +01:00
#ifndef MISSION_SYSTEM_OBJECTS_STACK5VHANDLER_H_
#define MISSION_SYSTEM_OBJECTS_STACK5VHANDLER_H_
#include <fsfw/power/PowerSwitchIF.h>
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
2022-12-21 14:34:07 +01:00
enum class StackCommander { RAD_SENSOR = 0, PL_PCDU = 1 };
2022-12-21 14:43:12 +01:00
enum class HandlerState { SWITCH_PENDING, IDLE };
2022-12-21 14:34:07 +01:00
2022-12-21 14:11:31 +01:00
class Stack5VHandler {
public:
static constexpr ReturnValue_t BUSY = returnvalue::makeCode(1, 0);
2022-12-21 14:11:31 +01:00
Stack5VHandler(PowerSwitchIF& switcher);
2022-12-21 14:34:07 +01:00
ReturnValue_t deviceToOn(StackCommander commander);
ReturnValue_t deviceToOff(StackCommander commander);
2022-12-21 14:11:31 +01:00
bool isSwitchOn();
private:
2022-12-21 14:34:07 +01:00
MutexIF* stackLock;
2022-12-21 14:11:31 +01:00
PowerSwitchIF& switcher;
2022-12-21 14:43:12 +01:00
bool switchIsOn = false;
HandlerState handlerState = HandlerState::IDLE;
2022-12-21 14:11:31 +01:00
bool radSensorIsOn = false;
bool plPcduIsOn = false;
pcdu::Switches stackSwitch = pcdu::Switches::P60_DOCK_5V_STACK;
};
#endif /* MISSION_SYSTEM_OBJECTS_STACK5VHANDLER_H_ */