eive-obsw/bsp_q7s/core/CoreDefinitions.h
Ulrich Mohr ad88bfa5b4
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
core controller bigWIP
2022-07-28 17:16:24 +02:00

109 lines
3.9 KiB
C++

#ifndef BSP_Q7S_CORE_COREDEFINITIONS_H_
#define BSP_Q7S_CORE_COREDEFINITIONS_H_
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
#include <fsfw/action/MinMaxParameter.h>
#include <fsfw/action/TemplateAction.h>
#include <fsfw/introspection/Enum.h>
class CoreController;
namespace core {
FSFW_ENUM(ActionId, ActionId_t, ((LIST_DIRECTORY_INTO_FILE, 0, "List Directory into file"))
((SWITCH_REBOOT_FILE_HANDLING, 5, "Switch Reboot File Handling"))
((RESET_REBOOT_COUNTERS, 6, "Reset Boot Counters"))
((SWITCH_IMG_LOCK, 7, "Switch Image Lock"))
((SET_MAX_REBOOT_CNT, 8, "Set maximum reboot Count"))
((XSC_REBOOT_OBC, 32, "Reboot using the xsc_boot_copy command"))
((MOUNT_OTHER_COPY, 33, "Mount Other Copy"))
((REBOOT_OBC, 34, "Reboot using the reboot command")))
FSFW_ENUM(Boolenum, uint8_t, ((NO, 0, "NO"))((YES, 1, "Yes")))
class ListDirectoryIntoFileAction : public TemplateAction<CoreController, ListDirectoryIntoFileAction, ActionId> {
public:
ListDirectoryIntoFileAction(CoreController *owner)
: TemplateAction(owner, ActionId::LIST_DIRECTORY_INTO_FILE){};
};
class SwitchRebootFileHandlingAction : public TemplateAction<CoreController, SwitchRebootFileHandlingAction, ActionId> {
public:
SwitchRebootFileHandlingAction(CoreController *owner)
: TemplateAction(owner, ActionId::SWITCH_REBOOT_FILE_HANDLING){};
Parameter<Boolenum> enableRebootFile = Parameter<Boolenum>::createParameter(this, "Enable Reboot File");
};
class ResetRebootCountersAction : public TemplateAction<CoreController, ResetRebootCountersAction, ActionId> {
public:
ResetRebootCountersAction(CoreController *owner)
: TemplateAction(owner, ActionId::RESET_REBOOT_COUNTERS){};
};
class SwitchImageLockAction : public TemplateAction<CoreController, SwitchImageLockAction, ActionId> {
public:
SwitchImageLockAction(CoreController *owner)
: TemplateAction(owner, ActionId::SWITCH_IMG_LOCK){};
};
class SetMaxRebootCntAction : public TemplateAction<CoreController, SetMaxRebootCntAction, ActionId> {
public:
SetMaxRebootCntAction(CoreController *owner)
: TemplateAction(owner, ActionId::SET_MAX_REBOOT_CNT){};
};
class XscRebootObcAction : public TemplateAction<CoreController, XscRebootObcAction, ActionId> {
public:
XscRebootObcAction(CoreController *owner)
: TemplateAction(owner, ActionId::XSC_REBOOT_OBC){};
};
class MountOtherCopyAction : public TemplateAction<CoreController, MountOtherCopyAction, ActionId> {
public:
MountOtherCopyAction(CoreController *owner)
: TemplateAction(owner, ActionId::MOUNT_OTHER_COPY){};
};
class RebootObcAction : public TemplateAction<CoreController, RebootObcAction, ActionId> {
public:
RebootObcAction(CoreController *owner)
: TemplateAction(owner, ActionId::REBOOT_OBC){};
};
static const uint8_t HK_SET_ENTRIES = 3;
static const uint32_t HK_SET_ID = 5;
enum PoolIds { TEMPERATURE, PS_VOLTAGE, PL_VOLTAGE };
/**
* @brief Set storing OBC internal housekeeping data
*/
class HkSet : public StaticLocalDataSet<HK_SET_ENTRIES> {
public:
HkSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, HK_SET_ID) {}
HkSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, HK_SET_ID)) {}
// On-chip temperature
lp_var_t<float> temperature = lp_var_t<float>(sid.objectId, PoolIds::TEMPERATURE, this);
// Processing system VCC
lp_var_t<float> psVoltage = lp_var_t<float>(sid.objectId, PoolIds::PS_VOLTAGE, this);
// Programmable logic VCC
lp_var_t<float> plVoltage = lp_var_t<float>(sid.objectId, PoolIds::PL_VOLTAGE, this);
void printSet() {
sif::info << "HkSet::printSet: On-chip temperature: " << this->temperature << " °C"
<< std::endl;
sif::info << "HkSet::printSet: PS voltage: " << this->psVoltage << " mV" << std::endl;
sif::info << "HkSet::printSet: PL voltage: " << this->plVoltage << " mV" << std::endl;
}
};
} // namespace core
#endif /* BSP_Q7S_CORE_COREDEFINITIONS_H_ */