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:
|
2022-12-21 17:30:21 +01:00
|
|
|
static constexpr ReturnValue_t BUSY = returnvalue::makeCode(1, 0);
|
2022-12-21 14:11:31 +01:00
|
|
|
Stack5VHandler(PowerSwitchIF& switcher);
|
|
|
|
|
2023-01-10 11:13:34 +01:00
|
|
|
ReturnValue_t deviceToOn(StackCommander commander, bool updateStates);
|
|
|
|
ReturnValue_t deviceToOff(StackCommander commander, bool updateStates);
|
2022-12-21 14:11:31 +01:00
|
|
|
|
|
|
|
bool isSwitchOn();
|
2023-01-10 11:13:34 +01:00
|
|
|
void update();
|
2022-12-21 14:11:31 +01:00
|
|
|
|
|
|
|
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;
|
2023-01-10 15:04:49 +01:00
|
|
|
bool targetState = false;
|
2022-12-21 14:43:12 +01:00
|
|
|
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;
|
2023-01-10 11:13:34 +01:00
|
|
|
|
|
|
|
bool updateInternalStates();
|
2022-12-21 14:11:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* MISSION_SYSTEM_OBJECTS_STACK5VHANDLER_H_ */
|