104 lines
3.1 KiB
C++
104 lines
3.1 KiB
C++
#ifndef MISSION_STARTRACKER_DEFINITIONS_H_
|
|
#define MISSION_STARTRACKER_DEFINITIONS_H_
|
|
|
|
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
|
|
#include <fsfw/datapoollocal/LocalPoolVariable.h>
|
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
|
#include "objects/systemObjectList.h"
|
|
|
|
namespace StarTracker {
|
|
|
|
/** This is the address of the star tracker */
|
|
static const uint8_t ADDRESS = 33;
|
|
|
|
static const uint8_t STATUS_OK = 0;
|
|
|
|
enum PoolIds: lp_id_t {
|
|
TICKS_VERSION_SET,
|
|
TIME_VERSION_SET,
|
|
TICKS_TEMPERATURE_SET,
|
|
TIME_TEMPERATURE_SET,
|
|
MCU_TEMPERATURE,
|
|
CMOS_TEMPERATURE,
|
|
PROGRAM,
|
|
MAJOR,
|
|
MINOR
|
|
};
|
|
|
|
|
|
|
|
static const DeviceCommandId_t PING_REQUEST = 0;
|
|
static const DeviceCommandId_t REQ_VERSION = 2;
|
|
static const DeviceCommandId_t REBOOT = 7;
|
|
static const DeviceCommandId_t REQ_TEMPERATURE = 25;
|
|
|
|
static const uint32_t VERSION_SET_ID = REQ_VERSION;
|
|
static const uint32_t TEMPERATURE_SET_ID = REQ_TEMPERATURE;
|
|
|
|
/** Max size of unencoded frame */
|
|
static const size_t MAX_FRAME_SIZE = 1200;
|
|
|
|
static const uint8_t TEMPERATURE_SET_ENTRIES = 4;
|
|
static const uint8_t VERSION_SET_ENTRIES = 3;
|
|
|
|
/**
|
|
* @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)) {
|
|
}
|
|
|
|
// Ticks is time reference generated by interanl counter of the star tracker
|
|
lp_var_t<uint32_t> ticks = lp_var_t<uint32_t>(sid.objectId,
|
|
PoolIds::TICKS_TEMPERATURE_SET, this);
|
|
/** Unix time in microseconds */
|
|
lp_var_t<uint64_t> time = lp_var_t<uint64_t>(sid.objectId,
|
|
PoolIds::TIME_TEMPERATURE_SET, this);
|
|
lp_var_t<float> mcuTemperature = lp_var_t<float>(sid.objectId,
|
|
PoolIds::MCU_TEMPERATURE, this);
|
|
lp_var_t<float> cmosTemperature = lp_var_t<float>(sid.objectId,
|
|
PoolIds::CMOS_TEMPERATURE, this);
|
|
};
|
|
|
|
/**
|
|
* @brief Package to store version parameters
|
|
*/
|
|
class VersionSet:
|
|
public StaticLocalDataSet<VERSION_SET_ENTRIES> {
|
|
public:
|
|
|
|
VersionSet(HasLocalDataPoolIF* owner):
|
|
StaticLocalDataSet(owner, VERSION_SET_ID) {
|
|
}
|
|
|
|
VersionSet(object_id_t objectId):
|
|
StaticLocalDataSet(sid_t(objectId, VERSION_SET_ID)) {
|
|
}
|
|
|
|
// Ticks is time reference generated by interanl counter of the star tracker
|
|
lp_var_t<uint32_t> ticks = lp_var_t<uint32_t>(sid.objectId,
|
|
PoolIds::TICKS_VERSION_SET, this);
|
|
/** Unix time in microseconds */
|
|
lp_var_t<uint64_t> time = lp_var_t<uint64_t>(sid.objectId,
|
|
PoolIds::TIME_VERSION_SET, this);
|
|
lp_var_t<uint8_t> program = lp_var_t<uint8_t>(sid.objectId,
|
|
PoolIds::PROGRAM, this);
|
|
lp_var_t<uint8_t> major = lp_var_t<uint8_t>(sid.objectId,
|
|
PoolIds::MAJOR, this);
|
|
lp_var_t<uint8_t> minor = lp_var_t<uint8_t>(sid.objectId,
|
|
PoolIds::MINOR, this);
|
|
};
|
|
|
|
}
|
|
|
|
#endif /* MISSION_STARTRACKER_DEFINITIONS_H_ */
|
|
|