35 py::class_<timing::I2CMasterNode, uhal::Node>(m,
"I2CMasterNode")
36 .def(py::init<const uhal::Node&>())
40 py::arg(
"i2c_device_address"),
41 py::arg(
"i2c_reg_address"),
42 py::arg(
"atomic") =
false
46 py::arg(
"i2c_device_address"),
47 py::arg(
"i2c_reg_address"),
49 py::arg(
"send_stop") =
true)
52 py::arg(
"i2c_device_address"),
53 py::arg(
"i2c_reg_address"),
54 py::arg(
"number_of_words"),
55 py::arg(
"atomic") =
false
57 .def(
"write_i2cArray",
59 py::arg(
"i2c_device_address"),
60 py::arg(
"i2c_reg_address"),
62 py::arg(
"send_stop") =
true)
64 .def(
"write_i2cPrimitive",
66 py::arg(
"i2c_device_address"),
68 py::arg(
"send_stop") =
true)
77 py::class_<timing::I2CSlave>(m,
"I2CSlave")
85 .def<uint8_t (
timing::I2CSlave::*)(uint32_t, uint32_t)
const>(
"read_i2c_atomic",
89 py::arg(
"i2c_reg_address"),
91 py::arg(
"send_stop") =
true)
94 py::arg(
"i2c_device_address"),
95 py::arg(
"i2c_reg_address"),
97 py::arg(
"send_stop") =
true)
101 .def<std::vector<uint8_t> (
timing::I2CSlave::*)(uint32_t, uint32_t, uint32_t)
const>(
105 "read_i2cArray_atomic",
107 .def<std::vector<uint8_t> (
timing::I2CSlave::*)(uint32_t, uint32_t, uint32_t)
const>(
108 "read_i2cArray_atomic",
113 py::arg(
"i2c_reg_address"),
115 py::arg(
"send_stop") =
true)
119 py::arg(
"i2c_device_address"),
120 py::arg(
"i2c_reg_address"),
122 py::arg(
"send_stop") =
true)
128 py::class_<timing::SIChipSlave, timing::I2CSlave>(m,
"SIChipSlave")
129 .def(py::init<const timing::I2CMasterNode*, uint8_t>())
137 py::class_<timing::SI534xSlave, timing::SIChipSlave>(m,
"SI534xSlave")
138 .def(py::init<const timing::I2CMasterNode*, uint8_t>())
139 .def(
"configure", &timing::SI534xSlave::configure)
140 .def(
"read_config_id", &timing::SI534xSlave::read_config_id)
145 py::class_<timing::SI534xNode, timing::SI534xSlave, timing::I2CMasterNode>(m,
"SI534xNode")
146 .def(py::init<const uhal::Node&>());
149 py::class_<timing::I2CExpanderSlave, timing::I2CSlave>(m,
"I2CExpanderSlave")
150 .def(py::init<const timing::I2CMasterNode*, uint8_t>())
151 .def(
"set_io", &timing::I2CExpanderSlave::set_io)
152 .def(
"set_inversion", &timing::I2CExpanderSlave::set_inversion)
153 .def(
"set_outputs", &timing::I2CExpanderSlave::set_outputs)
154 .def(
"read_inputs", &timing::I2CExpanderSlave::read_inputs)
155 .def(
"debug", &timing::I2CExpanderSlave::debug);
162 py::class_<timing::DACSlave, timing::I2CSlave>(m,
"DACSlave")
163 .def(py::init<const timing::I2CMasterNode*, uint8_t>())
168 py::class_<timing::DACNode, timing::DACSlave, timing::I2CMasterNode>(m,
"DACNode").def(py::init<const uhal::Node&>());
171 py::class_<timing::LTC2945Node, timing::I2CSlave>(m,
"LTC2945Node")
172 .def(py::init<const timing::I2CMasterNode*, uint8_t, double>())
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