pseq: Add base and UCD90320 device monitor classes
Add a power sequencer device monitoring base class and a UCD90320
subclass. Update power controller class to construct and pass device
information to device class. Update build file to support.
Signed-off-by: Jim Wright <jlwright@us.ibm.com>
Change-Id: Idf3ef53011b23f15841d93795f9f0995892b10b9
diff --git a/phosphor-power-sequencer/src/ucd90320_monitor.cpp b/phosphor-power-sequencer/src/ucd90320_monitor.cpp
index 698b0d0..36301b4 100644
--- a/phosphor-power-sequencer/src/ucd90320_monitor.cpp
+++ b/phosphor-power-sequencer/src/ucd90320_monitor.cpp
@@ -14,7 +14,22 @@
* limitations under the License.
*/
-int main()
+#include "ucd90320_monitor.hpp"
+
+#include <fmt/format.h>
+
+#include <string>
+
+namespace phosphor::power::sequencer
{
- return 0;
+
+UCD90320Monitor::UCD90320Monitor(sdbusplus::bus::bus& bus, std::uint8_t i2cBus,
+ std::uint16_t i2cAddress) :
+ PowerSequencerMonitor(),
+ bus{bus}, interface {
+ fmt::format("/sys/bus/i2c/devices/{}-{:04x}", i2cBus, i2cAddress).c_str(),
+ "ucd9000", 0
}
+{}
+
+} // namespace phosphor::power::sequencer