55 lines
1.5 KiB
C++
55 lines
1.5 KiB
C++
#ifndef MISSION_DEVICES_DEVICEPACKETS_THERMALSENSORPACKET_H_
|
|
#define MISSION_DEVICES_DEVICEPACKETS_THERMALSENSORPACKET_H_
|
|
|
|
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
|
|
#include <fsfw/datapoollocal/LocalPoolVariable.h>
|
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
|
#include "objects/systemObjectList.h"
|
|
|
|
namespace Max31865Definitions {
|
|
|
|
enum PoolIds: lp_id_t {
|
|
TEMPERATURE_C,
|
|
FAULT_BYTE
|
|
};
|
|
|
|
static constexpr DeviceCommandId_t CONFIG_CMD = 0x80;
|
|
static constexpr DeviceCommandId_t REQUEST_CONFIG = 0x00;
|
|
static constexpr DeviceCommandId_t REQUEST_RTD = 0x01;
|
|
static constexpr DeviceCommandId_t REQUEST_FAULT_BYTE = 0x07;
|
|
|
|
static constexpr uint32_t MAX31865_SET_ID = REQUEST_RTD;
|
|
|
|
static constexpr size_t MAX_REPLY_SIZE = 5;
|
|
|
|
class Max31865Set:
|
|
public StaticLocalDataSet<sizeof(float) + sizeof(uint8_t)> {
|
|
public:
|
|
/**
|
|
* Constructor used by owner and data creators like device handlers.
|
|
* @param owner
|
|
* @param setId
|
|
*/
|
|
Max31865Set(HasLocalDataPoolIF* owner):
|
|
StaticLocalDataSet(owner, MAX31865_SET_ID) {
|
|
}
|
|
|
|
/**
|
|
* Constructor used by data users like controllers.
|
|
* @param sid
|
|
*/
|
|
Max31865Set(object_id_t objectId):
|
|
StaticLocalDataSet(sid_t(objectId, MAX31865_SET_ID)) {
|
|
}
|
|
|
|
lp_var_t<float> temperatureCelcius = lp_var_t<float>(sid.objectId,
|
|
PoolIds::TEMPERATURE_C, this);
|
|
lp_var_t<uint8_t> errorByte = lp_var_t<uint8_t>(sid.objectId,
|
|
PoolIds::FAULT_BYTE, this);
|
|
};
|
|
|
|
}
|
|
|
|
#endif /* MISSION_DEVICES_DEVICEPACKETS_THERMALSENSORPACKET_H_ */
|
|
|