111 lines
3.5 KiB
C
111 lines
3.5 KiB
C
|
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_IMTQDEFINITIONS_H_
|
|||
|
#define MISSION_DEVICES_DEVICEDEFINITIONS_IMTQDEFINITIONS_H_
|
|||
|
|
|||
|
namespace IMTQ {
|
|||
|
|
|||
|
static const DeviceCommandId_t NONE = 0x0;
|
|||
|
static const DeviceCommandId_t GET_ENG_HK_DATA = 0x1;
|
|||
|
static const DeviceCommandId_t START_ACTUATION_DIPOLE = 0x2;
|
|||
|
|
|||
|
static const uint8_t GET_TEMP_REPLY_SIZE = 2;
|
|||
|
static const uint8_t CFGR_CMD_SIZE = 3;
|
|||
|
static const uint8_t POINTER_REG_SIZE = 1;
|
|||
|
|
|||
|
static const uint32_t ENG_HK_DATA_SET_ID = GET_ENG_HK_DATA;
|
|||
|
static const uint8_t SIZE_ENG_HK_COMMAND = 1;
|
|||
|
static const uint8_t SIZE_ENG_HK_DATA_REPLY = 24;
|
|||
|
|
|||
|
static const uint8_t MAX_REPLY_SIZE = SIZE_ENG_HK_DATA_REPLY;
|
|||
|
static const uint8_t MAX_COMMAND_SIZE = 9;
|
|||
|
|
|||
|
static const uint8_t POOL_ENTRIES = 8;
|
|||
|
|
|||
|
/**
|
|||
|
* Command code definitions. Each command or reply of an IMTQ request will begin with one of
|
|||
|
* the following command codes.
|
|||
|
*/
|
|||
|
namespace CC {
|
|||
|
static const uint8_t START_ACTUATION_DIPOLE = 0x6;
|
|||
|
static const uint8_t SOFTWARE_RESET = 0xAA;
|
|||
|
static const uint8_t GET_ENG_HK_DATA = 0x4A;
|
|||
|
};
|
|||
|
|
|||
|
enum IMTQPoolIds: lp_id_t {
|
|||
|
DIGITAL_VOLTAGE_MV,
|
|||
|
ANALOG_VOLTAGE_MV,
|
|||
|
DIGITAL_CURRENT_A,
|
|||
|
ANALOG_CURRENT_A,
|
|||
|
COIL_X_CURRENT_A,
|
|||
|
COIL_Y_CURRENT_A,
|
|||
|
COIL_Z_CURRENT_A,
|
|||
|
COIL_X_TEMPERATURE,
|
|||
|
COIL_Y_TEMPERATURE,
|
|||
|
COIL_Z_TEMPERATURE,
|
|||
|
MCU_TEMPERATURE
|
|||
|
};
|
|||
|
|
|||
|
class EngHkDataset:
|
|||
|
public StaticLocalDataSet<POOL_ENTRIES> {
|
|||
|
public:
|
|||
|
|
|||
|
EngHkDataset(HasLocalDataPoolIF* owner):
|
|||
|
StaticLocalDataSet(owner, ENG_HK_DATA_SET_ID) {
|
|||
|
}
|
|||
|
|
|||
|
EngHkDataset(object_id_t objectId):
|
|||
|
StaticLocalDataSet(sid_t(objectId, ENG_HK_DATA_SET_ID)) {
|
|||
|
}
|
|||
|
|
|||
|
lp_var_t<uint16_t> digitalVoltageMv = lp_var_t<uint16_t>(sid.objectId,
|
|||
|
DIGITAL_VOLTAGE_MV, this);
|
|||
|
lp_var_t<uint16_t> analogVoltageMv = lp_var_t<uint16_t>(sid.objectId,
|
|||
|
ANALOG_VOLTAGE_MV, this);
|
|||
|
lp_var_t<float> digitalCurrentA = lp_var_t<float>(sid.objectId,
|
|||
|
DIGITAL_CURRENT_A, this);
|
|||
|
lp_var_t<float> analogCurrentA = lp_var_t<float>(sid.objectId,
|
|||
|
ANALOG_CURRENT_A, this);
|
|||
|
lp_var_t<float> coilXcurrentA = lp_var_t<float>(sid.objectId,
|
|||
|
COIL_X_CURRENT_A, this);
|
|||
|
lp_var_t<float> coilYcurrentA = lp_var_t<float>(sid.objectId,
|
|||
|
COIL_Y_CURRENT_A, this);
|
|||
|
lp_var_t<float> coilZcurrentA = lp_var_t<float>(sid.objectId,
|
|||
|
COIL_Z_CURRENT_A, this);
|
|||
|
/** All temperatures in [<5B>C] */
|
|||
|
lp_var_t<uint16_t> coilXTemperature = lp_var_t<uint16_t>(sid.objectId,
|
|||
|
COIL_X_TEMPEARTURE, this);
|
|||
|
lp_var_t<uint16_t> coilYTemperature = lp_var_t<uint16_t>(sid.objectId,
|
|||
|
COIL_Y_TEMPERATURE, this);
|
|||
|
lp_var_t<uint16_t> coilZTemperature = lp_var_t<uint16_t>(sid.objectId,
|
|||
|
COIL_Z_TEMPERATURE, this);
|
|||
|
lp_var_t<uint16_t> mcuTemperature = lp_var_t<uint16_t>(sid.objectId,
|
|||
|
MCU_TEMPERATURE, this);
|
|||
|
};
|
|||
|
|
|||
|
/**
|
|||
|
* @brief This class can be used to ease the generation of an action message commanding the
|
|||
|
* IMTQHandler to configure the magnettorquer with the desired dipoles.
|
|||
|
*/
|
|||
|
class CommandDipolePacket : public SerialLinkedListAdapter<SerializeIF> {
|
|||
|
public:
|
|||
|
|
|||
|
CommandDipolePacket() {
|
|||
|
setLinks();
|
|||
|
}
|
|||
|
|
|||
|
private:
|
|||
|
CommandDipolePacket(uint16_t xDipole, uint16_t yDipole, uint16_t zDipole);
|
|||
|
void setLinks() {
|
|||
|
setStart(&cspPort);
|
|||
|
cspPort.setNext(&querySize);
|
|||
|
querySize.setNext(&magic);
|
|||
|
}
|
|||
|
SerializeElement<uint8_t> cspPort = GOMSPACE::P60_PORT_GNDWDT_RESET;
|
|||
|
SerializeElement<uint16_t> querySize = 1;
|
|||
|
/* Sending 0x78 to port 9 of a gomspace device resets the ground watchdog */
|
|||
|
SerializeElement<uint8_t> magic = 0x78;
|
|||
|
};
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_IMTQDEFINITIONS_H_ */
|