added eive specific max31865 handler
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
2022-05-12 09:48:41 +02:00
parent 56f491befb
commit 23f209fb07
9 changed files with 279 additions and 65 deletions

View File

@ -28,6 +28,8 @@ enum CfgBitPos {
BIAS_SEL = 7
};
static constexpr uint32_t WARMUP_MS = 100;
static constexpr DeviceCommandId_t CONFIG_CMD = 0x80;
static constexpr DeviceCommandId_t WRITE_HIGH_THRESHOLD = 0x83;
static constexpr DeviceCommandId_t WRITE_LOW_THRESHOLD = 0x85;
@ -50,20 +52,20 @@ static constexpr uint8_t REG_RTD = 0x01;
static constexpr size_t MAX_REPLY_SIZE = 5;
class Max31865Set : public StaticLocalDataSet<sizeof(float) + sizeof(uint8_t)> {
class Max31865Set : public StaticLocalDataSet<3> {
public:
/**
* Constructor used by owner and data creators like device handlers.
* @param owner
* @param setId
*/
Max31865Set(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, MAX31865_SET_ID) {}
Max31865Set(HasLocalDataPoolIF* owner, uint32_t setId) : StaticLocalDataSet(owner, setId) {}
/**
* Constructor used by data users like controllers.
* @param sid
*/
Max31865Set(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, MAX31865_SET_ID)) {}
Max31865Set(object_id_t objectId, uint32_t setId) : StaticLocalDataSet(sid_t(objectId, setId)) {}
lp_var_t<float> rtdValue = lp_var_t<float>(sid.objectId, PoolIds::RTD_VALUE, this);
lp_var_t<float> temperatureCelcius = lp_var_t<float>(sid.objectId, PoolIds::TEMPERATURE_C, this);
@ -72,4 +74,50 @@ class Max31865Set : public StaticLocalDataSet<sizeof(float) + sizeof(uint8_t)> {
} // namespace MAX31865
namespace EiveMax31855 {
static constexpr uint8_t NUM_RTDS = 16;
enum RtdCommands : DeviceCommandId_t {
ON = 0,
EXCHANGE_SET_ID = MAX31865::REQUEST_RTD,
ACTIVE = 2,
LOW_THRESHOLD = 3,
HIGH_TRESHOLD = 4,
OFF = 5,
CFG = 6,
};
class ReadOutStruct : public SerialLinkedListAdapter<SerializeIF> {
public:
ReadOutStruct() { setLinks(); }
ReadOutStruct(bool active, uint32_t spiErrCnt, bool faultBitSet, uint8_t faultVal,
uint16_t rtdVal)
: active(active),
rtdVal(rtdVal),
faultBitSet(faultBitSet),
faultValue(faultVal),
spiErrorCount(spiErrCnt) {
setLinks();
}
SerializeElement<bool> active = false;
SerializeElement<uint16_t> rtdVal = 0;
SerializeElement<bool> faultBitSet = false;
SerializeElement<uint8_t> faultValue = 0;
SerializeElement<uint32_t> spiErrorCount = 0;
private:
void setLinks() {
setStart(&active);
active.setNext(&rtdVal);
rtdVal.setNext(&faultBitSet);
faultBitSet.setNext(&faultValue);
faultValue.setNext(&spiErrorCount);
};
};
}; // namespace EiveMax31855
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_MAX13865DEFINITIONS_H_ */