2021-06-21 09:50:26 +02:00
|
|
|
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_MAX13865DEFINITIONS_H_
|
|
|
|
#define MISSION_DEVICES_DEVICEDEFINITIONS_MAX13865DEFINITIONS_H_
|
2021-03-05 12:57:42 +01:00
|
|
|
|
|
|
|
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
|
|
|
|
#include <fsfw/datapoollocal/LocalPoolVariable.h>
|
|
|
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
2021-05-17 20:03:56 +02:00
|
|
|
#include "objects/systemObjectList.h"
|
2021-03-05 12:57:42 +01:00
|
|
|
|
2021-03-13 14:42:30 +01:00
|
|
|
namespace Max31865Definitions {
|
2021-03-05 12:57:42 +01:00
|
|
|
|
|
|
|
enum PoolIds: lp_id_t {
|
2021-07-26 13:55:58 +02:00
|
|
|
RTD_VALUE,
|
2021-03-05 12:57:42 +01:00
|
|
|
TEMPERATURE_C,
|
|
|
|
FAULT_BYTE
|
|
|
|
};
|
|
|
|
|
|
|
|
static constexpr DeviceCommandId_t CONFIG_CMD = 0x80;
|
2021-06-02 10:25:35 +02:00
|
|
|
static constexpr DeviceCommandId_t WRITE_HIGH_THRESHOLD = 0x83;
|
|
|
|
static constexpr DeviceCommandId_t WRITE_LOW_THRESHOLD = 0x85;
|
2021-03-05 12:57:42 +01:00
|
|
|
static constexpr DeviceCommandId_t REQUEST_CONFIG = 0x00;
|
|
|
|
static constexpr DeviceCommandId_t REQUEST_RTD = 0x01;
|
2021-06-02 10:25:35 +02:00
|
|
|
static constexpr DeviceCommandId_t REQUEST_HIGH_THRESHOLD = 0x03;
|
|
|
|
static constexpr DeviceCommandId_t REQUEST_LOW_THRESHOLD = 0x05;
|
2021-03-05 12:57:42 +01:00
|
|
|
static constexpr DeviceCommandId_t REQUEST_FAULT_BYTE = 0x07;
|
|
|
|
|
2021-03-13 14:42:30 +01:00
|
|
|
static constexpr uint32_t MAX31865_SET_ID = REQUEST_RTD;
|
|
|
|
|
|
|
|
static constexpr size_t MAX_REPLY_SIZE = 5;
|
2021-03-05 12:57:42 +01:00
|
|
|
|
2021-03-13 14:42:30 +01:00
|
|
|
class Max31865Set:
|
2021-03-05 12:57:42 +01:00
|
|
|
public StaticLocalDataSet<sizeof(float) + sizeof(uint8_t)> {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Constructor used by owner and data creators like device handlers.
|
|
|
|
* @param owner
|
|
|
|
* @param setId
|
|
|
|
*/
|
2021-03-13 14:42:30 +01:00
|
|
|
Max31865Set(HasLocalDataPoolIF* owner):
|
|
|
|
StaticLocalDataSet(owner, MAX31865_SET_ID) {
|
2021-03-05 12:57:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor used by data users like controllers.
|
|
|
|
* @param sid
|
|
|
|
*/
|
2021-03-13 14:42:30 +01:00
|
|
|
Max31865Set(object_id_t objectId):
|
|
|
|
StaticLocalDataSet(sid_t(objectId, MAX31865_SET_ID)) {
|
2021-03-05 12:57:42 +01:00
|
|
|
}
|
|
|
|
|
2021-07-26 13:55:58 +02:00
|
|
|
lp_var_t<float> rtdValue = lp_var_t<float>(sid.objectId,
|
|
|
|
PoolIds::RTD_VALUE, this);
|
2021-03-05 12:57:42 +01:00
|
|
|
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);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-06-21 09:50:26 +02:00
|
|
|
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_MAX13865DEFINITIONS_H_ */
|
2021-03-05 12:57:42 +01:00
|
|
|
|