2024-12-12 08:05:43 -04:00
|
|
|
#include "SIM_config.h"
|
|
|
|
|
|
|
|
#if AP_SIM_TEMPERATURE_MCP9600_ENABLED
|
|
|
|
|
2021-10-16 19:33:49 -03:00
|
|
|
#include "SIM_I2CDevice.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
Simulator for the MCP9600 temperature sensor
|
|
|
|
|
|
|
|
DataSheet; https://www.microchip.com/content/dam/mchp/documents/OTH/ProductDocuments/DataSheets/MCP960X-Data-Sheet-20005426.pdf
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace SITL {
|
|
|
|
|
|
|
|
class MCP9600DevReg : public I2CRegEnum {
|
|
|
|
public:
|
|
|
|
static constexpr uint8_t HOT_JUNC { 0x00 };
|
2024-10-05 22:42:35 -03:00
|
|
|
static constexpr uint8_t SENSOR_STATUS { 0x04 };
|
2021-10-16 19:33:49 -03:00
|
|
|
static constexpr uint8_t SENSOR_CONFIG { 0x05 };
|
|
|
|
static constexpr uint8_t WHOAMI { 0x20 };
|
|
|
|
};
|
|
|
|
|
|
|
|
class MCP9600 : public I2CDevice, private I2CRegisters_ConfigurableLength
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
void init() override;
|
|
|
|
|
|
|
|
void update(const class Aircraft &aircraft) override;
|
|
|
|
|
|
|
|
int rdwr(I2C::i2c_rdwr_ioctl_data *&data) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
// should be a call on aircraft:
|
|
|
|
float some_temperature = 26.5;
|
|
|
|
|
|
|
|
uint32_t last_temperature_update_ms;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace SITL
|
2024-12-12 08:05:43 -04:00
|
|
|
|
|
|
|
#endif // AP_SIM_TEMPERATURE_MCP9600_ENABLED
|