continued low level MAX31865 handler
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
2022-05-12 11:27:30 +02:00
parent 23f209fb07
commit 6b9e49e632
7 changed files with 221 additions and 64 deletions

View File

@ -9,7 +9,7 @@
namespace MAX31865 {
enum PoolIds : lp_id_t { RTD_VALUE, TEMPERATURE_C, FAULT_BYTE };
enum class PoolIds : lp_id_t { RTD_VALUE, TEMPERATURE_C, FAULT_BYTE };
enum Wires : unsigned int { TWO_WIRE = 0, THREE_WIRE = 1, FOUR_WIRE = 0 };
enum ConvMode : unsigned int { NORM_OFF = 0, AUTO = 1 };
@ -30,26 +30,30 @@ enum CfgBitPos {
static constexpr uint32_t WARMUP_MS = 100;
static constexpr uint8_t WRITE_BIT = 0b10000000;
enum Regs : uint8_t {
CONFIG = 0x00,
RTD = 0x01,
HIGH_THRESHOLD = 0x03,
LOW_THRESHOLD = 0x05,
FAULT_BYTE = 0x07
};
static constexpr DeviceCommandId_t CONFIG_CMD = 0x80;
static constexpr DeviceCommandId_t WRITE_HIGH_THRESHOLD = 0x83;
static constexpr DeviceCommandId_t WRITE_LOW_THRESHOLD = 0x85;
static constexpr DeviceCommandId_t REQUEST_CONFIG = 0x00;
static constexpr DeviceCommandId_t REQUEST_RTD = 0x01;
static constexpr DeviceCommandId_t REQUEST_HIGH_THRESHOLD = 0x03;
static constexpr DeviceCommandId_t REQUEST_LOW_THRESHOLD = 0x05;
static constexpr DeviceCommandId_t REQUEST_FAULT_BYTE = 0x07;
static constexpr DeviceCommandId_t REQUEST_CONFIG = CONFIG;
static constexpr DeviceCommandId_t REQUEST_RTD = RTD;
static constexpr DeviceCommandId_t REQUEST_HIGH_THRESHOLD = HIGH_THRESHOLD;
static constexpr DeviceCommandId_t REQUEST_LOW_THRESHOLD = LOW_THRESHOLD;
static constexpr DeviceCommandId_t REQUEST_FAULT_BYTE = FAULT_BYTE;
static constexpr DeviceCommandId_t CLEAR_FAULT_BYTE = 0x08;
static constexpr uint32_t MAX31865_SET_ID = REQUEST_RTD;
static constexpr uint8_t CLEAR_FAULT_BIT_VAL = 0b0000'0010;
static constexpr uint8_t WRITE_BIT = 0b10000000;
static constexpr uint8_t REG_CONFIG = 0x00;
static constexpr uint8_t REG_RTD = 0x01;
static constexpr size_t MAX_REPLY_SIZE = 5;
class Max31865Set : public StaticLocalDataSet<3> {
@ -67,9 +71,12 @@ class Max31865Set : public StaticLocalDataSet<3> {
*/
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);
lp_var_t<uint8_t> errorByte = lp_var_t<uint8_t>(sid.objectId, PoolIds::FAULT_BYTE, this);
lp_var_t<float> rtdValue =
lp_var_t<float>(sid.objectId, static_cast<lp_id_t>(PoolIds::RTD_VALUE), this);
lp_var_t<float> temperatureCelcius =
lp_var_t<float>(sid.objectId, static_cast<lp_id_t>(PoolIds::TEMPERATURE_C), this);
lp_var_t<uint8_t> errorByte =
lp_var_t<uint8_t>(sid.objectId, static_cast<lp_id_t>(PoolIds::FAULT_BYTE), this);
};
} // namespace MAX31865
@ -86,7 +93,7 @@ enum RtdCommands : DeviceCommandId_t {
HIGH_TRESHOLD = 4,
OFF = 5,
CFG = 6,
NUM_CMDS
};
class ReadOutStruct : public SerialLinkedListAdapter<SerializeIF> {