36 py::class_<timing::I2CMasterNode, uhal::Node>(m,
"I2CMasterNode")
37 .def(py::init<const uhal::Node&>())
41 py::arg(
"i2c_device_address"),
42 py::arg(
"i2c_reg_address"),
43 py::arg(
"atomic") =
false
47 py::arg(
"i2c_device_address"),
48 py::arg(
"i2c_reg_address"),
50 py::arg(
"send_stop") =
true)
53 py::arg(
"i2c_device_address"),
54 py::arg(
"i2c_reg_address"),
55 py::arg(
"number_of_words"),
56 py::arg(
"atomic") =
false
58 .def(
"write_i2cArray",
60 py::arg(
"i2c_device_address"),
61 py::arg(
"i2c_reg_address"),
63 py::arg(
"send_stop") =
true)
65 .def(
"write_i2cPrimitive",
67 py::arg(
"i2c_device_address"),
69 py::arg(
"send_stop") =
true)
78 py::class_<timing::I2CSlave>(m,
"I2CSlave")
86 .def<uint8_t (
timing::I2CSlave::*)(uint32_t, uint32_t)
const>(
"read_i2c_atomic",
90 py::arg(
"i2c_reg_address"),
92 py::arg(
"send_stop") =
true)
95 py::arg(
"i2c_device_address"),
96 py::arg(
"i2c_reg_address"),
98 py::arg(
"send_stop") =
true)
102 .def<std::vector<uint8_t> (
timing::I2CSlave::*)(uint32_t, uint32_t, uint32_t)
const>(
106 "read_i2cArray_atomic",
108 .def<std::vector<uint8_t> (
timing::I2CSlave::*)(uint32_t, uint32_t, uint32_t)
const>(
109 "read_i2cArray_atomic",
114 py::arg(
"i2c_reg_address"),
116 py::arg(
"send_stop") =
true)
120 py::arg(
"i2c_device_address"),
121 py::arg(
"i2c_reg_address"),
123 py::arg(
"send_stop") =
true)
129 py::class_<timing::SIChipSlave, timing::I2CSlave>(m,
"SIChipSlave")
130 .def(py::init<const timing::I2CMasterNode*, uint8_t>())
138 py::class_<timing::SI534xSlave, timing::SIChipSlave>(m,
"SI534xSlave")
139 .def(py::init<const timing::I2CMasterNode*, uint8_t>())
140 .def(
"configure", &timing::SI534xSlave::configure)
141 .def(
"read_config_id", &timing::SI534xSlave::read_config_id)
142 .def(
"get_status", &timing::SI534xSlave::get_status, py::arg(
"print_out"))
147 py::class_<timing::SI534xNode, timing::SI534xSlave, timing::I2CMasterNode>(m,
"SI534xNode")
148 .def(py::init<const uhal::Node&>());
151 py::class_<timing::I2CExpanderSlave, timing::I2CSlave>(m,
"I2CExpanderSlave")
152 .def(py::init<const timing::I2CMasterNode*, uint8_t>())
153 .def(
"set_io", &timing::I2CExpanderSlave::set_io)
154 .def(
"set_inversion", &timing::I2CExpanderSlave::set_inversion)
155 .def(
"set_outputs", &timing::I2CExpanderSlave::set_outputs)
156 .def(
"read_inputs", &timing::I2CExpanderSlave::read_inputs)
157 .def(
"read_outputs_config", &timing::I2CExpanderSlave::read_outputs_config)
158 .def(
"debug", &timing::I2CExpanderSlave::debug);
165 py::class_<timing::DACSlave, timing::I2CSlave>(m,
"DACSlave")
166 .def(py::init<const timing::I2CMasterNode*, uint8_t>())
171 py::class_<timing::DACNode, timing::DACSlave, timing::I2CMasterNode>(m,
"DACNode").def(py::init<const uhal::Node&>());
174 py::class_<timing::LTC2945Node, timing::I2CSlave>(m,
"LTC2945Node")
175 .def(py::init<const timing::I2CMasterNode*, uint8_t, double>())
182 py::class_<timing::I2C9546SwitchSlave, timing::I2CSlave>(m,
"I2C9546SwitchSlave")
183 .def(py::init<const timing::I2CMasterNode*, uint8_t>())
184 .def(
"enable_channel", &timing::I2C9546SwitchSlave::enable_channel)
185 .def(
"disable_channel", &timing::I2C9546SwitchSlave::disable_channel)
186 .def(
"read_channels_states", &timing::I2C9546SwitchSlave::read_channels_states)
187 .def(
"set_channels_states", &timing::I2C9546SwitchSlave::set_channels_states);
Unknown serialization type<< t,((char) t)) template< typename T > inline std::string datatype_to_string() { return "Unknown";} namespace serialization { template< typename T > struct is_serializable :std::false_type {};enum SerializationType { kMsgPack };inline SerializationType from_string(const std::string s) { if(s=="msgpack") return kMsgPack;throw UnknownSerializationTypeString(ERS_HERE, s);} constexpr uint8_t serialization_type_byte(SerializationType stype) { switch(stype) { case kMsgPack:return 'M';default:throw UnknownSerializationTypeEnum(ERS_HERE);} } constexpr SerializationType DEFAULT_SERIALIZATION_TYPE=kMsgPack;template< class T > std::vector< uint8_t > serialize(const T &obj, SerializationType stype=DEFAULT_SERIALIZATION_TYPE) { switch(stype) { case kMsgPack:{ msgpack::sbuffer buf;msgpack::pack(buf, obj);std::vector< uint8_t > ret(buf.size()+1);ret[0]=serialization_type_byte(stype);std::copy(buf.data(), buf.data()+buf.size(), ret.begin()+1);return ret;} default:throw UnknownSerializationTypeEnum(ERS_HERE);} } template< class T, typename CharType=unsigned char > T deserialize(const std::vector< CharType > &v) { switch(v[0]) { case serialization_type_byte(kMsgPack):{ try { msgpack::object_handle oh=msgpack::unpack(const_cast< char * >(reinterpret_cast< const char * >(v.data()+1)), v.size() - 1,[](msgpack::type::object_type, std::size_t, void *) -> bool