eive-obsw/mission/devices/devicedefinitions/RwDefinitions.h

87 lines
2.6 KiB
C++

#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_RWDEFINITIONS_H_
#define MISSION_DEVICES_DEVICEDEFINITIONS_RWDEFINITIONS_H_
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
#include <fsfw/datapoollocal/LocalPoolVariable.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include "objects/systemObjectList.h"
namespace RwDefinitions {
enum PoolIds: lp_id_t {
TEMPERATURE_C,
CURR_SPEED,
REFERENCE_SPEED,
STATE,
CLC_MODE
};
static constexpr DeviceCommandId_t GET_RW_STATUS = 4;
static constexpr DeviceCommandId_t SET_SPEED = 6;
static constexpr DeviceCommandId_t GET_TEMPERATURE = 8;
static constexpr uint32_t TEMPERATURE_SET_ID = GET_TEMPERATURE;
static constexpr uint32_t STATUS_SET_ID = GET_RW_STATUS;
static constexpr size_t SIZE_GET_RW_STATUS = 14;
static constexpr size_t SIZE_SET_SPEED_REPLY = 4;
static constexpr size_t SIZE_GET_TEMPERATURE_REPLY = 8;
/** Max size when requesting telemetry */
static constexpr size_t SIZE_GET_TELEMETRY_REPLY = 83;
/** Set speed command has maximum size */
static constexpr size_t MAX_CMD_SIZE = 9;
static constexpr size_t MAX_REPLY_SIZE = SIZE_GET_TELEMETRY_REPLY;
static constexpr uint8_t TEMPERATURE_SET_ENTRIES = 1;
static constexpr uint8_t STATUS_SET_ENTRIES = 4;
/**
* @brief This dataset can be used to store the temperature of a reaction wheel.
*/
class TemperatureSet:
public StaticLocalDataSet<TEMPERATURE_SET_ENTRIES> {
public:
TemperatureSet(HasLocalDataPoolIF* owner):
StaticLocalDataSet(owner, TEMPERATURE_SET_ID) {
}
TemperatureSet(object_id_t objectId):
StaticLocalDataSet(sid_t(objectId, TEMPERATURE_SET_ID)) {
}
lp_var_t<int32_t> temperatureCelcius = lp_var_t<int32_t>(sid.objectId,
PoolIds::TEMPERATURE_C, this);
};
/**
* @brief This dataset can be used to store the reaction wheel status.
*/
class StatusSet:
public StaticLocalDataSet<STATUS_SET_ENTRIES> {
public:
StatusSet(HasLocalDataPoolIF* owner):
StaticLocalDataSet(owner, STATUS_SET_ID) {
}
StatusSet(object_id_t objectId):
StaticLocalDataSet(sid_t(objectId, STATUS_SET_ID)) {
}
lp_var_t<int32_t> currSpeed = lp_var_t<int32_t>(sid.objectId,
PoolIds::CURR_SPEED, this);
lp_var_t<int32_t> referenceSpeed = lp_var_t<int32_t>(sid.objectId,
PoolIds::REFERENCE_SPEED, this);
lp_var_t<uint8_t> state = lp_var_t<uint8_t>(sid.objectId,
PoolIds::STATE, this);
lp_var_t<uint8_t> clcMode = lp_var_t<uint8_t>(sid.objectId,
PoolIds::CLC_MODE, this);
};
}
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_RWDEFINITIONS_H_ */