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

104 lines
3.1 KiB
C
Raw Normal View History

2021-07-07 12:12:01 +02:00
#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;
2021-11-26 13:16:05 +01:00
static const uint8_t STATUS_OK = 0;
2021-07-07 12:12:01 +02:00
enum PoolIds: lp_id_t {
2021-11-26 15:24:52 +01:00
TICKS_VERSION_SET,
TIME_VERSION_SET,
TICKS_TEMPERATURE_SET,
TIME_TEMPERATURE_SET,
2021-07-07 12:12:01 +02:00
MCU_TEMPERATURE,
2021-11-26 15:24:52 +01:00
CMOS_TEMPERATURE,
PROGRAM,
MAJOR,
MINOR
2021-07-07 12:12:01 +02:00
};
2021-11-26 09:14:41 +01:00
static const DeviceCommandId_t PING_REQUEST = 0;
2021-11-26 15:24:52 +01:00
static const DeviceCommandId_t REQ_VERSION = 2;
2021-11-26 13:16:05 +01:00
static const DeviceCommandId_t REBOOT = 7;
2021-07-07 12:12:01 +02:00
static const DeviceCommandId_t REQ_TEMPERATURE = 25;
2021-11-26 15:24:52 +01:00
static const uint32_t VERSION_SET_ID = REQ_VERSION;
2021-07-07 12:12:01 +02:00
static const uint32_t TEMPERATURE_SET_ID = REQ_TEMPERATURE;
/** Max size of unencoded frame */
static const size_t MAX_FRAME_SIZE = 1200;
2021-11-26 15:24:52 +01:00
static const uint8_t TEMPERATURE_SET_ENTRIES = 4;
static const uint8_t VERSION_SET_ENTRIES = 3;
2021-07-07 12:12:01 +02:00
/**
* @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)) {
}
2021-11-26 13:16:05 +01:00
// Ticks is time reference generated by interanl counter of the star tracker
2021-07-07 12:12:01 +02:00
lp_var_t<uint32_t> ticks = lp_var_t<uint32_t>(sid.objectId,
2021-11-26 15:24:52 +01:00
PoolIds::TICKS_TEMPERATURE_SET, this);
2021-07-07 12:12:01 +02:00
/** Unix time in microseconds */
lp_var_t<uint64_t> time = lp_var_t<uint64_t>(sid.objectId,
2021-11-26 15:24:52 +01:00
PoolIds::TIME_TEMPERATURE_SET, this);
2021-07-07 12:12:01 +02:00
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);
};
2021-11-26 15:24:52 +01:00
/**
* @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);
};
2021-07-07 12:12:01 +02:00
}
#endif /* MISSION_STARTRACKER_DEFINITIONS_H_ */