eive-obsw/mission/tcs/Tmp1075Definitions.h

43 lines
1.4 KiB
C
Raw Normal View History

2023-03-26 16:42:00 +02:00
#ifndef MISSION_TCS_TMP1075DEFINITIONS_H_
#define MISSION_TCS_TMP1075DEFINITIONS_H_
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
#include <cstdint>
#include "fsfw/devicehandlers/DeviceHandlerIF.h"
2021-01-08 09:34:43 +01:00
namespace TMP1075 {
2022-01-17 15:58:27 +01:00
static const uint8_t TEMP_REG_ADDR = 0x0;
static const uint8_t CFGR_ADDR = 0x1;
2021-01-08 09:34:43 +01:00
2022-01-17 15:58:27 +01:00
/* Writing this information to the configuration register sets the tmp1075
* to shutdown mode and starts a single temperature conversion */
static const uint16_t ONE_SHOT_MODE = 0x8100;
2021-01-08 09:34:43 +01:00
2022-01-17 15:58:27 +01:00
static const DeviceCommandId_t NONE = 0x0; // Set when no command is pending
static const DeviceCommandId_t GET_TEMP = 0x1;
static const DeviceCommandId_t START_ADC_CONVERSION = 0x2;
2021-01-08 09:34:43 +01:00
2022-01-17 15:58:27 +01:00
static const uint8_t GET_TEMP_REPLY_SIZE = 2;
static const uint8_t CFGR_CMD_SIZE = 3;
static const uint8_t POINTER_REG_SIZE = 1;
2021-01-08 09:34:43 +01:00
2022-01-17 15:58:27 +01:00
static const uint32_t TMP1075_DATA_SET_ID = GET_TEMP;
2021-01-08 09:34:43 +01:00
2022-01-17 15:58:27 +01:00
static const uint8_t MAX_REPLY_LENGTH = GET_TEMP_REPLY_SIZE;
2021-01-08 09:34:43 +01:00
enum Tmp1075PoolIds : lp_id_t { TEMPERATURE_C_TMP1075 };
2023-05-02 15:04:14 +02:00
class Tmp1075Dataset : public StaticLocalDataSet<2> {
2022-01-17 15:58:27 +01:00
public:
Tmp1075Dataset(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, TMP1075_DATA_SET_ID) {}
2022-01-17 15:58:27 +01:00
Tmp1075Dataset(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, TMP1075_DATA_SET_ID)) {}
2021-01-08 09:34:43 +01:00
lp_var_t<float> temperatureCelcius = lp_var_t<float>(sid.objectId, TEMPERATURE_C_TMP1075, this);
2021-01-08 09:34:43 +01:00
};
2022-01-17 15:58:27 +01:00
} // namespace TMP1075
2021-01-08 09:34:43 +01:00
2023-03-26 16:42:00 +02:00
#endif /* MISSION_TCS_TMP1075DEFINITIONS_H_ */