diff --git a/src/libDevCom/python.cpp b/src/libDevCom/python.cpp index 500504b656cf1c16dabd22ed47b08f1181d2de5c..41de8aeacb7b9ec774e802e87b7be581f00b2fb4 100644 --- a/src/libDevCom/python.cpp +++ b/src/libDevCom/python.cpp @@ -16,9 +16,6 @@ #include "I2CDevCom.h" #include "I2CDevComuino.h" -#include "DeviceCalibration.h" -#include "ADCDevice.h" -#include "ADCDevComuino.h" #include "PCA9548ACom.h" #ifdef ENABLE_FTDI @@ -32,6 +29,7 @@ #include "LinearCalibration.h" #include "FileCalibration.h" +#include "ADCDevComuino.h" #include "ADCDevice.h" #include "AD799X.h" #include "LTC2451.h" @@ -1152,7 +1150,8 @@ void register_devcom(py::module& m) { .def("pressure", &ClimateSensor::pressure) .def("dewPoint", &ClimateSensor::dewPoint); - py::class_<NTCSensor, PySensor<NTCSensor>, ClimateSensor, std::shared_ptr<NTCSensor>>(m, "NTCSensor"); + py::class_<NTCSensor, PySensor<NTCSensor>, ClimateSensor, std::shared_ptr<NTCSensor>>(m, "NTCSensor") + .def(py::init<uint8_t, std::shared_ptr<ADCDevice>, bool, float, float, float, bool, float, float>()); py::class_<HTS221, PySensor_w_status<HTS221>, ClimateSensor, std::shared_ptr<HTS221>>(m, "HTS221") .def(py::init<std::shared_ptr<I2CCom>>()) @@ -1278,7 +1277,7 @@ void register_devcom(py::module& m) { .def("uncalibrate", &FileCalibration::uncalibrate); // ADCDevice - py::class_<ADCDevice, PyADCDeviceBase<>>(m, "ADCDevice") + py::class_<ADCDevice, std::shared_ptr<ADCDevice>, PyADCDeviceBase<>>(m, "ADCDevice") .def(py::init<std::shared_ptr<DeviceCalibration>>()) .def("setCalibration", static_cast<void (ADCDevice::*)(std::shared_ptr<DeviceCalibration>)>(&ADCDevice::setCalibration)) .def("setCalibration", static_cast<void (ADCDevice::*)(uint8_t, std::shared_ptr<DeviceCalibration>)>(&ADCDevice::setCalibration)) @@ -1290,7 +1289,7 @@ void register_devcom(py::module& m) { .def("readCount", static_cast<void (ADCDevice::*)(const std::vector<uint8_t>&, std::vector<int32_t>&)>(&ADCDevice::readCount)); - py::class_<AD799X, ADCDevice, PyADCDev<AD799X>> ad799x_class(m, "AD799X"); + py::class_<AD799X, ADCDevice, std::shared_ptr<AD799X>> ad799x_class(m, "AD799X"); py::enum_<AD799X::Model>(ad799x_class, "Model") .value("AD7993", AD799X::Model::AD7993) .value("AD7994", AD799X::Model::AD7994) @@ -1298,20 +1297,20 @@ void register_devcom(py::module& m) { .value("AD7998", AD799X::Model::AD7998); ad799x_class.def(py::init<double, AD799X::Model, std::shared_ptr<I2CCom>>()); - py::class_<ADCDevComuino, ADCDevice, PyADCDev<ADCDevComuino>>(m, "ADCDevComuino") + py::class_<ADCDevComuino, ADCDevice, std::shared_ptr<ADCDevComuino>>(m, "ADCDevComuino") .def(py::init<double, std::shared_ptr<TextSerialCom>>()); - py::class_<LTC2451, ADCDevice, PyADCDev<LTC2451>> ltc2451_class(m, "LTC2451"); + py::class_<LTC2451, ADCDevice, std::shared_ptr<LTC2451>> ltc2451_class(m, "LTC2451"); py::enum_<LTC2451::Speed>(ltc2451_class, "Speed") .value("Speed60Hz", LTC2451::Speed::Speed60Hz) .value("Speed30Hz", LTC2451::Speed::Speed30Hz); ltc2451_class.def(py::init<double, std::shared_ptr<I2CCom>>()) .def("setSpeed", <C2451::setSpeed); - py::class_<MAX11619, ADCDevice, PyADCDev<MAX11619>>(m, "MAX11619") + py::class_<MAX11619, ADCDevice, std::shared_ptr<MAX11619>>(m, "MAX11619") .def(py::init<double, std::shared_ptr<SPICom>>()); - py::class_<MCP3425, ADCDevice, PyADCDev<MCP3425>> mcp3425_class(m, "MCP3425"); + py::class_<MCP3425, ADCDevice, std::shared_ptr<MCP3425>> mcp3425_class(m, "MCP3425"); py::enum_<MCP3425::Resolution>(mcp3425_class, "Resolution") .value("bit12", MCP3425::Resolution::bit12) .value("bit14", MCP3425::Resolution::bit14) @@ -1327,7 +1326,7 @@ void register_devcom(py::module& m) { mcp3425_class.def(py::init<MCP3425::Resolution, MCP3425::ConversionMode, MCP3425::Gain, std::shared_ptr<I2CCom>>()) .def(py::init<std::shared_ptr<I2CCom>>()); - py::class_<MCP3428, ADCDevice, PyADCDev<MCP3428>> mcp3428_class(m, "MCP3428"); + py::class_<MCP3428, ADCDevice, std::shared_ptr<MCP3428>> mcp3428_class(m, "MCP3428"); py::enum_<MCP3428::Resolution>(mcp3428_class, "Resolution") .value("bit12", MCP3428::Resolution::bit12) .value("bit14", MCP3428::Resolution::bit14) @@ -1345,7 +1344,7 @@ void register_devcom(py::module& m) { .def("setGain", &MCP3428::setGain); // DACDevice - py::class_<DACDevice, PyDACDeviceBase<>>(m, "DACDevice") + py::class_<DACDevice, std::shared_ptr<DACDevice>, PyDACDeviceBase<>>(m, "DACDevice") .def(py::init<std::shared_ptr<DeviceCalibration>>()) .def("setCalibration", static_cast<void (DACDevice::*)(std::shared_ptr<DeviceCalibration>)>(&DACDevice::setCalibration)) .def("setCalibration", static_cast<void (DACDevice::*)(uint8_t, std::shared_ptr<DeviceCalibration>)>(&DACDevice::setCalibration)) @@ -1362,19 +1361,19 @@ void register_devcom(py::module& m) { .def("readCount", static_cast<int32_t (DACDevice::*)(uint8_t)>(&DACDevice::readCount)) .def("readCount", static_cast<void (DACDevice::*)(const std::vector<uint8_t>&, std::vector<int32_t>&)>(&DACDevice::readCount)); - py::class_<AD56X9, DACDevice, PyDACDev<AD56X9>> ad56x9_class(m, "AD56X9"); + py::class_<AD56X9, DACDevice, std::shared_ptr<AD56X9>> ad56x9_class(m, "AD56X9"); py::enum_<AD56X9::Model>(ad56x9_class, "Model") .value("AD5629", AD56X9::AD5629) .value("AD5669", AD56X9::AD5669); ad56x9_class.def(py::init<double, AD56X9::Model, std::shared_ptr<I2CCom>>()); - py::class_<DAC5571, DACDevice, PyDACDev<DAC5571>>(m, "DAC5571") + py::class_<DAC5571, DACDevice, std::shared_ptr<DAC5571>>(m, "DAC5571") .def(py::init<float, std::shared_ptr<I2CCom>>()); - py::class_<DAC5574, DACDevice, PyDACDev<DAC5574>>(m, "DAC5574") + py::class_<DAC5574, DACDevice, std::shared_ptr<DAC5574>>(m, "DAC5574") .def(py::init<float, std::shared_ptr<I2CCom>>()); - py::class_<MCP4801, DACDevice, PyDACDev<MCP4801>>(m, "MCP4801") + py::class_<MCP4801, DACDevice, std::shared_ptr<MCP4801>>(m, "MCP4801") .def(py::init<std::shared_ptr<SPICom>>()); m.def("listDevCom", &DeviceComRegistry::listDevCom);