Merge branch 'develop' into mohr/thermal_controller
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
This commit is contained in:
@ -14,7 +14,7 @@ static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::GPS_HANDLER;
|
||||
static constexpr Event GPS_FIX_CHANGE = event::makeEvent(SUBSYSTEM_ID, 0, severity::INFO);
|
||||
|
||||
static constexpr DeviceCommandId_t GPS_REPLY = 0;
|
||||
static constexpr DeviceCommandId_t TRIGGER_RESET_PIN = 5;
|
||||
static constexpr DeviceCommandId_t TRIGGER_RESET_PIN_GNSS = 5;
|
||||
|
||||
static constexpr uint32_t DATASET_ID = 0;
|
||||
|
||||
|
@ -38,7 +38,8 @@ static const DeviceCommandId_t PARAM_GET = 0; //!< [EXPORT] : [COMMAND]
|
||||
static const DeviceCommandId_t PARAM_SET = 255; //!< [EXPORT] : [COMMAND]
|
||||
static const DeviceCommandId_t REQUEST_HK_TABLE = 16; //!< [EXPORT] : [COMMAND]
|
||||
|
||||
//!< [EXPORT] : [COMMAND] Print switch states, voltages and currents to the console
|
||||
//! [EXPORT] : [COMMAND] Print switch states, voltages and currents to the console
|
||||
//! For the ACU device, only print voltages and currents of the 6 ACU channels
|
||||
static const DeviceCommandId_t PRINT_SWITCH_V_I = 32;
|
||||
static const DeviceCommandId_t PRINT_LATCHUPS = 33;
|
||||
|
||||
@ -55,7 +56,8 @@ enum class SetIds : uint32_t {
|
||||
PDU_2_AUX = 4,
|
||||
P60_CORE = 5,
|
||||
P60_AUX = 6,
|
||||
ACU = 7
|
||||
ACU_CORE = 7,
|
||||
ACU_AUX = 8
|
||||
};
|
||||
|
||||
namespace pool {
|
||||
@ -129,67 +131,24 @@ enum Ids : lp_id_t {
|
||||
PDU_WDT_CSP_LEFT2,
|
||||
|
||||
/** ACU Ids */
|
||||
ACU_CURRENT_IN_CHANNEL0,
|
||||
ACU_CURRENT_IN_CHANNEL1,
|
||||
ACU_CURRENT_IN_CHANNEL2,
|
||||
ACU_CURRENT_IN_CHANNEL3,
|
||||
ACU_CURRENT_IN_CHANNEL4,
|
||||
ACU_CURRENT_IN_CHANNEL5,
|
||||
ACU_VOLTAGE_IN_CHANNEL0,
|
||||
ACU_VOLTAGE_IN_CHANNEL1,
|
||||
ACU_VOLTAGE_IN_CHANNEL2,
|
||||
ACU_VOLTAGE_IN_CHANNEL3,
|
||||
ACU_VOLTAGE_IN_CHANNEL4,
|
||||
ACU_VOLTAGE_IN_CHANNEL5,
|
||||
ACU_CURRENT_IN_CHANNELS,
|
||||
ACU_VOLTAGE_IN_CHANNELS,
|
||||
ACU_VCC,
|
||||
ACU_VBAT,
|
||||
ACU_TEMPERATURE_1,
|
||||
ACU_TEMPERATURE_2,
|
||||
ACU_TEMPERATURE_3,
|
||||
ACU_TEMPERATURES,
|
||||
ACU_MPPT_MODE,
|
||||
ACU_VBOOST_CHANNEL0,
|
||||
ACU_VBOOST_CHANNEL1,
|
||||
ACU_VBOOST_CHANNEL2,
|
||||
ACU_VBOOST_CHANNEL3,
|
||||
ACU_VBOOST_CHANNEL4,
|
||||
ACU_VBOOST_CHANNEL5,
|
||||
ACU_POWER_CHANNEL0,
|
||||
ACU_POWER_CHANNEL1,
|
||||
ACU_POWER_CHANNEL2,
|
||||
ACU_POWER_CHANNEL3,
|
||||
ACU_POWER_CHANNEL4,
|
||||
ACU_POWER_CHANNEL5,
|
||||
ACU_DAC_EN_0,
|
||||
ACU_DAC_EN_1,
|
||||
ACU_DAC_EN_2,
|
||||
ACU_DAC_RAW_0,
|
||||
ACU_DAC_RAW_1,
|
||||
ACU_DAC_RAW_2,
|
||||
ACU_DAC_RAW_3,
|
||||
ACU_DAC_RAW_4,
|
||||
ACU_DAC_RAW_5,
|
||||
ACU_VBOOST_IN_CHANNELS,
|
||||
ACU_POWER_IN_CHANNELS,
|
||||
ACU_DAC_ENABLES,
|
||||
ACU_DAC_RAW_CHANNELS,
|
||||
ACU_BOOTCAUSE,
|
||||
ACU_BOOTCNT,
|
||||
ACU_UPTIME,
|
||||
ACU_RESET_CAUSE,
|
||||
ACU_MPPT_TIME,
|
||||
ACU_MPPT_PERIOD,
|
||||
ACU_DEVICE_0,
|
||||
ACU_DEVICE_1,
|
||||
ACU_DEVICE_2,
|
||||
ACU_DEVICE_3,
|
||||
ACU_DEVICE_4,
|
||||
ACU_DEVICE_5,
|
||||
ACU_DEVICE_6,
|
||||
ACU_DEVICE_7,
|
||||
ACU_DEVICE_0_STATUS,
|
||||
ACU_DEVICE_1_STATUS,
|
||||
ACU_DEVICE_2_STATUS,
|
||||
ACU_DEVICE_3_STATUS,
|
||||
ACU_DEVICE_4_STATUS,
|
||||
ACU_DEVICE_5_STATUS,
|
||||
ACU_DEVICE_6_STATUS,
|
||||
ACU_DEVICE_7_STATUS,
|
||||
ACU_DEVICES,
|
||||
ACU_DEVICES_STATUS,
|
||||
ACU_WDT_CNT_GND,
|
||||
ACU_WDT_GND_LEFT,
|
||||
};
|
||||
@ -592,143 +551,76 @@ static const uint16_t MAX_HKTABLE_ADDRESS = 120;
|
||||
static const uint8_t HK_TABLE_ENTRIES = 64;
|
||||
static const uint16_t HK_TABLE_REPLY_SIZE = 262;
|
||||
|
||||
/**
|
||||
* @brief This class defines a dataset for the hk table of the ACU.
|
||||
*/
|
||||
class HkTableDataset : public StaticLocalDataSet<HK_TABLE_ENTRIES> {
|
||||
class CoreHk : public StaticLocalDataSet<14> {
|
||||
public:
|
||||
HkTableDataset(HasLocalDataPoolIF* owner)
|
||||
: StaticLocalDataSet(owner, static_cast<uint32_t>(::P60System::SetIds::ACU)) {}
|
||||
CoreHk(HasLocalDataPoolIF* owner)
|
||||
: StaticLocalDataSet(owner, static_cast<uint32_t>(::P60System::SetIds::ACU_CORE)) {}
|
||||
|
||||
HkTableDataset(object_id_t objectId)
|
||||
: StaticLocalDataSet(sid_t(objectId, static_cast<uint32_t>(::P60System::SetIds::ACU))) {}
|
||||
|
||||
lp_var_t<int16_t> currentInChannel0 =
|
||||
lp_var_t<int16_t>(sid.objectId, P60System::pool::ACU_CURRENT_IN_CHANNEL0, this);
|
||||
lp_var_t<int16_t> currentInChannel1 =
|
||||
lp_var_t<int16_t>(sid.objectId, P60System::pool::ACU_CURRENT_IN_CHANNEL1, this);
|
||||
lp_var_t<int16_t> currentInChannel2 =
|
||||
lp_var_t<int16_t>(sid.objectId, P60System::pool::ACU_CURRENT_IN_CHANNEL2, this);
|
||||
lp_var_t<int16_t> currentInChannel3 =
|
||||
lp_var_t<int16_t>(sid.objectId, P60System::pool::ACU_CURRENT_IN_CHANNEL3, this);
|
||||
lp_var_t<int16_t> currentInChannel4 =
|
||||
lp_var_t<int16_t>(sid.objectId, P60System::pool::ACU_CURRENT_IN_CHANNEL4, this);
|
||||
lp_var_t<int16_t> currentInChannel5 =
|
||||
lp_var_t<int16_t>(sid.objectId, P60System::pool::ACU_CURRENT_IN_CHANNEL5, this);
|
||||
|
||||
lp_var_t<uint16_t> voltageInChannel0 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VOLTAGE_IN_CHANNEL0, this);
|
||||
lp_var_t<uint16_t> voltageInChannel1 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VOLTAGE_IN_CHANNEL1, this);
|
||||
lp_var_t<uint16_t> voltageInChannel2 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VOLTAGE_IN_CHANNEL2, this);
|
||||
lp_var_t<uint16_t> voltageInChannel3 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VOLTAGE_IN_CHANNEL3, this);
|
||||
lp_var_t<uint16_t> voltageInChannel4 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VOLTAGE_IN_CHANNEL4, this);
|
||||
lp_var_t<uint16_t> voltageInChannel5 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VOLTAGE_IN_CHANNEL5, this);
|
||||
|
||||
lp_var_t<uint16_t> vcc = lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VCC, this);
|
||||
lp_var_t<uint16_t> vbat = lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VBAT, this);
|
||||
|
||||
lp_var_t<int16_t> temperature1 =
|
||||
lp_var_t<int16_t>(sid.objectId, P60System::pool::ACU_TEMPERATURE_1, this);
|
||||
lp_var_t<int16_t> temperature2 =
|
||||
lp_var_t<int16_t>(sid.objectId, P60System::pool::ACU_TEMPERATURE_2, this);
|
||||
lp_var_t<int16_t> temperature3 =
|
||||
lp_var_t<int16_t>(sid.objectId, P60System::pool::ACU_TEMPERATURE_3, this);
|
||||
CoreHk(object_id_t objectId)
|
||||
: StaticLocalDataSet(sid_t(objectId, static_cast<uint32_t>(::P60System::SetIds::ACU_CORE))) {}
|
||||
|
||||
lp_var_t<uint8_t> mpptMode =
|
||||
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_MPPT_MODE, this);
|
||||
|
||||
lp_var_t<uint16_t> vboostInChannel0 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VBOOST_CHANNEL0, this);
|
||||
lp_var_t<uint16_t> vboostInChannel1 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VBOOST_CHANNEL1, this);
|
||||
lp_var_t<uint16_t> vboostInChannel2 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VBOOST_CHANNEL2, this);
|
||||
lp_var_t<uint16_t> vboostInChannel3 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VBOOST_CHANNEL3, this);
|
||||
lp_var_t<uint16_t> vboostInChannel4 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VBOOST_CHANNEL4, this);
|
||||
lp_var_t<uint16_t> vboostInChannel5 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VBOOST_CHANNEL5, this);
|
||||
lp_vec_t<int16_t, 6> currentInChannels =
|
||||
lp_vec_t<int16_t, 6>(sid.objectId, P60System::pool::ACU_CURRENT_IN_CHANNELS, this);
|
||||
lp_vec_t<uint16_t, 6> voltageInChannels =
|
||||
lp_vec_t<uint16_t, 6>(sid.objectId, P60System::pool::ACU_VOLTAGE_IN_CHANNELS, this);
|
||||
|
||||
lp_var_t<uint16_t> powerInChannel0 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_POWER_CHANNEL0, this);
|
||||
lp_var_t<uint16_t> powerInChannel1 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_POWER_CHANNEL1, this);
|
||||
lp_var_t<uint16_t> powerInChannel2 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_POWER_CHANNEL2, this);
|
||||
lp_var_t<uint16_t> powerInChannel3 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_POWER_CHANNEL3, this);
|
||||
lp_var_t<uint16_t> powerInChannel4 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_POWER_CHANNEL4, this);
|
||||
lp_var_t<uint16_t> powerInChannel5 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_POWER_CHANNEL5, this);
|
||||
lp_var_t<uint16_t> vcc = lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VCC, this);
|
||||
lp_var_t<uint16_t> vbat = lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_VBAT, this);
|
||||
|
||||
lp_var_t<uint8_t> dac0Enable =
|
||||
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DAC_EN_0, this);
|
||||
lp_var_t<uint8_t> dac1Enable =
|
||||
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DAC_EN_1, this);
|
||||
lp_var_t<uint8_t> dac2Enable =
|
||||
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DAC_EN_2, this);
|
||||
lp_vec_t<uint16_t, 6> vboostInChannels =
|
||||
lp_vec_t<uint16_t, 6>(sid.objectId, P60System::pool::ACU_VBOOST_IN_CHANNELS, this);
|
||||
lp_vec_t<uint16_t, 6> powerInChannels =
|
||||
lp_vec_t<uint16_t, 6>(sid.objectId, P60System::pool::ACU_POWER_IN_CHANNELS, this);
|
||||
|
||||
lp_var_t<uint16_t> dacRawChannelVal0 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_DAC_RAW_0, this);
|
||||
lp_var_t<uint16_t> dacRawChannelVal1 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_DAC_RAW_1, this);
|
||||
lp_var_t<uint16_t> dacRawChannelVal2 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_DAC_RAW_2, this);
|
||||
lp_var_t<uint16_t> dacRawChannelVal3 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_DAC_RAW_3, this);
|
||||
lp_var_t<uint16_t> dacRawChannelVal4 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_DAC_RAW_4, this);
|
||||
lp_var_t<uint16_t> dacRawChannelVal5 =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_DAC_RAW_5, this);
|
||||
lp_vec_t<int16_t, 3> temperatures =
|
||||
lp_vec_t<int16_t, 3>(sid.objectId, P60System::pool::ACU_TEMPERATURES, this);
|
||||
|
||||
lp_var_t<uint32_t> bootCause =
|
||||
lp_var_t<uint32_t>(sid.objectId, P60System::pool::ACU_BOOTCAUSE, this);
|
||||
lp_var_t<uint32_t> bootcnt = lp_var_t<uint32_t>(sid.objectId, P60System::pool::ACU_BOOTCNT, this);
|
||||
lp_var_t<uint32_t> uptime = lp_var_t<uint32_t>(sid.objectId, P60System::pool::ACU_UPTIME, this);
|
||||
lp_var_t<uint16_t> resetCause =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_RESET_CAUSE, this);
|
||||
lp_var_t<uint16_t> mpptTime =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_MPPT_TIME, this);
|
||||
lp_var_t<uint16_t> mpptPeriod =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_MPPT_PERIOD, this);
|
||||
};
|
||||
/**
|
||||
* @brief This class defines a dataset for the hk table of the ACU.
|
||||
*/
|
||||
class AuxHk : public StaticLocalDataSet<12> {
|
||||
public:
|
||||
AuxHk(HasLocalDataPoolIF* owner)
|
||||
: StaticLocalDataSet(owner, static_cast<uint32_t>(::P60System::SetIds::ACU_AUX)) {}
|
||||
|
||||
lp_var_t<uint8_t> device0 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_0, this);
|
||||
lp_var_t<uint8_t> device1 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_1, this);
|
||||
lp_var_t<uint8_t> device2 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_2, this);
|
||||
lp_var_t<uint8_t> device3 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_3, this);
|
||||
lp_var_t<uint8_t> device4 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_4, this);
|
||||
lp_var_t<uint8_t> device5 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_5, this);
|
||||
lp_var_t<uint8_t> device6 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_6, this);
|
||||
lp_var_t<uint8_t> device7 = lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_7, this);
|
||||
AuxHk(object_id_t objectId)
|
||||
: StaticLocalDataSet(sid_t(objectId, static_cast<uint32_t>(::P60System::SetIds::ACU_AUX))) {}
|
||||
|
||||
lp_var_t<uint8_t> device0Status =
|
||||
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_0_STATUS, this);
|
||||
lp_var_t<uint8_t> device1Status =
|
||||
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_1_STATUS, this);
|
||||
lp_var_t<uint8_t> device2Status =
|
||||
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_2_STATUS, this);
|
||||
lp_var_t<uint8_t> device3Status =
|
||||
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_3_STATUS, this);
|
||||
lp_var_t<uint8_t> device4Status =
|
||||
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_4_STATUS, this);
|
||||
lp_var_t<uint8_t> device5Status =
|
||||
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_5_STATUS, this);
|
||||
lp_var_t<uint8_t> device6Status =
|
||||
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_6_STATUS, this);
|
||||
lp_var_t<uint8_t> device7Status =
|
||||
lp_var_t<uint8_t>(sid.objectId, P60System::pool::ACU_DEVICE_7_STATUS, this);
|
||||
lp_vec_t<uint8_t, 3> dacEnables =
|
||||
lp_vec_t<uint8_t, 3>(sid.objectId, P60System::pool::ACU_DAC_ENABLES, this);
|
||||
|
||||
lp_vec_t<uint16_t, 6> dacRawChannelVals =
|
||||
lp_vec_t<uint16_t, 6>(sid.objectId, P60System::pool::ACU_DAC_RAW_CHANNELS, this);
|
||||
|
||||
lp_var_t<uint32_t> bootCause =
|
||||
lp_var_t<uint32_t>(sid.objectId, P60System::pool::ACU_BOOTCAUSE, this);
|
||||
lp_var_t<uint16_t> resetCause =
|
||||
lp_var_t<uint16_t>(sid.objectId, P60System::pool::ACU_RESET_CAUSE, this);
|
||||
|
||||
lp_var_t<uint32_t> wdtCntGnd =
|
||||
lp_var_t<uint32_t>(sid.objectId, P60System::pool::ACU_WDT_CNT_GND, this);
|
||||
lp_var_t<uint32_t> wdtGndLeft =
|
||||
lp_var_t<uint32_t>(sid.objectId, P60System::pool::ACU_WDT_GND_LEFT, this);
|
||||
|
||||
/**
|
||||
* There are 8 devices on the PDU. FRAM, ADCs, temperature sensor etc. Each device is
|
||||
* identified by an ID. Refer also to gs-man-nanopower-p60-pdu-200-1.pdf on pages 17 and 18.
|
||||
*/
|
||||
lp_vec_t<uint8_t, 8> deviceTypes =
|
||||
lp_vec_t<uint8_t, 8>(sid.objectId, P60System::pool::ACU_DEVICES, this);
|
||||
/** The status of each device. 0 = None, 1 = Ok, 2 = Error, 3 = Not found */
|
||||
lp_vec_t<uint8_t, 8> devicesStatus =
|
||||
lp_vec_t<uint8_t, 8>(sid.objectId, P60System::pool::ACU_DEVICES_STATUS, this);
|
||||
};
|
||||
} // namespace ACU
|
||||
|
||||
|
@ -7,20 +7,48 @@
|
||||
|
||||
#include "objects/systemObjectList.h"
|
||||
|
||||
namespace Max31865Definitions {
|
||||
namespace MAX31865 {
|
||||
|
||||
enum PoolIds : lp_id_t { RTD_VALUE, TEMPERATURE_C, FAULT_BYTE };
|
||||
enum class PoolIds : lp_id_t { RTD_VALUE, TEMPERATURE_C, LAST_FAULT_BYTE, FAULT_BYTE };
|
||||
enum Wires : unsigned int { TWO_WIRE = 0, THREE_WIRE = 1, FOUR_WIRE = 0 };
|
||||
|
||||
enum ConvMode : unsigned int { NORM_OFF = 0, AUTO = 1 };
|
||||
|
||||
enum Bias : unsigned int { OFF = 0, ON = 1 };
|
||||
|
||||
enum FilterSel : unsigned int { FIFTY_HERTZ = 1, SIXTY_HERTZ = 0 };
|
||||
|
||||
enum CfgBitPos {
|
||||
FILTER_SEL = 0,
|
||||
FAULT_STATUS_CLEAR = 1,
|
||||
FDCC = 2,
|
||||
WIRE_SEL = 4,
|
||||
ONE_SHOT = 5,
|
||||
CONV_MODE = 6,
|
||||
BIAS_SEL = 7
|
||||
};
|
||||
|
||||
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;
|
||||
@ -28,26 +56,82 @@ static constexpr uint8_t CLEAR_FAULT_BIT_VAL = 0b0000'0010;
|
||||
|
||||
static constexpr size_t MAX_REPLY_SIZE = 5;
|
||||
|
||||
class Max31865Set : public StaticLocalDataSet<sizeof(float) + sizeof(uint8_t)> {
|
||||
class Max31865Set : public StaticLocalDataSet<4> {
|
||||
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);
|
||||
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> lastErrorByte =
|
||||
lp_var_t<uint8_t>(sid.objectId, static_cast<lp_id_t>(PoolIds::LAST_FAULT_BYTE), this);
|
||||
lp_var_t<uint8_t> errorByte =
|
||||
lp_var_t<uint8_t>(sid.objectId, static_cast<lp_id_t>(PoolIds::FAULT_BYTE), this);
|
||||
};
|
||||
|
||||
} // namespace Max31865Definitions
|
||||
} // namespace MAX31865
|
||||
|
||||
namespace EiveMax31855 {
|
||||
|
||||
static constexpr float RTD_RREF_PT1000 = 4020.0; //!< Ohm
|
||||
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,
|
||||
NUM_CMDS
|
||||
};
|
||||
|
||||
class ReadOutStruct : public SerialLinkedListAdapter<SerializeIF> {
|
||||
public:
|
||||
ReadOutStruct() { setLinks(); }
|
||||
ReadOutStruct(bool active, uint32_t spiErrCnt, bool faultBitSet, uint8_t faultVal,
|
||||
uint16_t rtdVal)
|
||||
: active(active),
|
||||
adcCode(rtdVal),
|
||||
faultBitSet(faultBitSet),
|
||||
faultValue(faultVal),
|
||||
spiErrorCount(spiErrCnt) {
|
||||
setLinks();
|
||||
}
|
||||
|
||||
//! RTD was set on and is configured, but is not periodically polled
|
||||
SerializeElement<bool> configured = false;
|
||||
//! RTD is active and polled periodically
|
||||
SerializeElement<bool> active = false;
|
||||
SerializeElement<uint16_t> adcCode = 0;
|
||||
SerializeElement<bool> faultBitSet = false;
|
||||
SerializeElement<uint8_t> faultValue = 0;
|
||||
SerializeElement<uint32_t> spiErrorCount = 0;
|
||||
|
||||
private:
|
||||
void setLinks() {
|
||||
setStart(&configured);
|
||||
configured.setNext(&active);
|
||||
active.setNext(&adcCode);
|
||||
adcCode.setNext(&faultBitSet);
|
||||
faultBitSet.setNext(&faultValue);
|
||||
faultValue.setNext(&spiErrorCount);
|
||||
};
|
||||
};
|
||||
|
||||
}; // namespace EiveMax31855
|
||||
|
||||
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_MAX13865DEFINITIONS_H_ */
|
||||
|
Reference in New Issue
Block a user