1e73bd0a1SAndrew Jeffery #pragma once 2e73bd0a1SAndrew Jeffery #include <boost/asio/steady_timer.hpp> 3e73bd0a1SAndrew Jeffery #include <boost/container/flat_map.hpp> 4e73bd0a1SAndrew Jeffery #include <sensor.hpp> 5e73bd0a1SAndrew Jeffery 6e73bd0a1SAndrew Jeffery #include <chrono> 7e73bd0a1SAndrew Jeffery #include <limits> 8e73bd0a1SAndrew Jeffery #include <memory> 9e73bd0a1SAndrew Jeffery #include <string> 10e73bd0a1SAndrew Jeffery #include <vector> 11e73bd0a1SAndrew Jeffery 12e73bd0a1SAndrew Jeffery struct MCUTempSensor : public Sensor 13e73bd0a1SAndrew Jeffery { 14e73bd0a1SAndrew Jeffery MCUTempSensor(std::shared_ptr<sdbusplus::asio::connection>& conn, 15*1f978631SEd Tanous boost::asio::io_context& io, const std::string& name, 16e73bd0a1SAndrew Jeffery const std::string& sensorConfiguration, 17e73bd0a1SAndrew Jeffery sdbusplus::asio::object_server& objectServer, 18e73bd0a1SAndrew Jeffery std::vector<thresholds::Threshold>&& thresholdData, 19e73bd0a1SAndrew Jeffery uint8_t busId, uint8_t mcuAddress, uint8_t tempReg); 20e73bd0a1SAndrew Jeffery ~MCUTempSensor() override; 21e73bd0a1SAndrew Jeffery 22e73bd0a1SAndrew Jeffery void checkThresholds(void) override; 23e73bd0a1SAndrew Jeffery void read(void); 24e73bd0a1SAndrew Jeffery void init(void); 25e73bd0a1SAndrew Jeffery 26e73bd0a1SAndrew Jeffery uint8_t busId; 27e73bd0a1SAndrew Jeffery uint8_t mcuAddress; 28e73bd0a1SAndrew Jeffery uint8_t tempReg; 29e73bd0a1SAndrew Jeffery 30e73bd0a1SAndrew Jeffery private: 31e73bd0a1SAndrew Jeffery int getMCURegsInfoWord(uint8_t regs, int16_t* pu16data) const; 32e73bd0a1SAndrew Jeffery sdbusplus::asio::object_server& objectServer; 33e73bd0a1SAndrew Jeffery boost::asio::steady_timer waitTimer; 34e73bd0a1SAndrew Jeffery }; 35