52 lines
1.5 KiB
C
52 lines
1.5 KiB
C
|
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_TMP1075DEFINITIONS_H_
|
||
|
#define MISSION_DEVICES_DEVICEDEFINITIONS_TMP1075DEFINITIONS_H_
|
||
|
|
||
|
namespace TMP1075 {
|
||
|
static const uint8_t TEMP_REG_ADDR = 0x0;
|
||
|
static const uint8_t CFGR_ADDR = 0x1;
|
||
|
|
||
|
/* 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;
|
||
|
|
||
|
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;
|
||
|
|
||
|
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;
|
||
|
|
||
|
static const lp_id_t TEMPERATURE_C = GET_TEMP;
|
||
|
static const uint32_t DATA_SET_ID = 0x0;
|
||
|
|
||
|
static const uint8_t MAX_REPLY_LENGTH = GET_TEMP_REPLY_SIZE;
|
||
|
|
||
|
class Tmp1075Dataset:
|
||
|
public StaticLocalDataSet<sizeof(float)> {
|
||
|
public:
|
||
|
/**
|
||
|
* Constructor used by owner and data creators like device handlers.
|
||
|
* @param owner
|
||
|
* @param setId
|
||
|
*/
|
||
|
Tmp1075Dataset(HasLocalDataPoolIF* owner):
|
||
|
StaticLocalDataSet(owner, DATA_SET_ID) {
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Constructor used by data users like controllers.
|
||
|
* @param sid
|
||
|
*/
|
||
|
Tmp1075Dataset(object_id_t objectId):
|
||
|
StaticLocalDataSet(sid_t(objectId, DATA_SET_ID)) {
|
||
|
}
|
||
|
|
||
|
lp_var_t<float> temperatureCelcius = lp_var_t<float>(hkManager->getOwner(),
|
||
|
TEMPERATURE_C, this);
|
||
|
};
|
||
|
}
|
||
|
|
||
|
|
||
|
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_TMP1075DEFINITIONS_H_ */
|