Orion
high-rate readout
pybind.hpp
Go to the documentation of this file.
1 
5 #pragma once
6 
7 #include <pybind11/pybind11.h>
8 #include <pybind11/stl.h>
9 #include <pybind11/stl_bind.h>
10 #include <pybind11/functional.h>
11 
12 
13 namespace py = pybind11;
14 
15 namespace itk::itkpix::cmd {
16 
22 template<typename T>
23 auto pybindCommandCallback(py::module_& m) {
24 
25  return py::class_<T, std::shared_ptr<T>>(m, "CommandCallback")
26  .def("idle", &T::idle)
27  .def("sync", &T::sync)
28  .def("trig", &T::trig, py::arg("bc"), py::arg("tag"))
29  .def("read_trig", &T::read_trig, py::arg("chip_id"), py::arg("ext_tag"))
30  .def("clear", &T::clear, py::arg("chip_id"))
31  .def("global", &T::global, py::arg("chip_id"))
32  .def("calib", &T::calib, py::arg("chip_id"),
33  py::arg("edg_mode"), py::arg("edg_delay"), py::arg("edg_width"),
34  py::arg("aux_mode"), py::arg("aux_delay"))
35  .def("read_reg", &T::read_reg, py::arg("chip_id"), py::arg("addr"))
36  .def("write_reg", &T::write_reg, py::arg("chip_id"), py::arg("addr"), py::arg("data"))
37  .def("write_pix_start", &T::write_pix_start, py::arg("chip_id"))
38  .def("write_pix_next", &T::write_pix_next, py::arg("data"))
39  .def("on_warning", &T::on_warning, py::arg("frame"))
40  .def("on_error", &T::on_error, py::arg("frame"))
41  ; // CommandCallback
42 }
43 
44 
45 
51 template<typename T>
52 auto pybindCommandDecoder(py::module_& m) {
53 
54  return py::class_<T, std::shared_ptr<T>>(m, "CommandDecoder")
55  .def(py::init<typename T::CommandCallback&>(), py::arg("cb"))
56  .def(py::init<uint8_t, typename T::CommandCallback&>(), py::arg("chip_id"), py::arg("cb"))
57  .def("reset", &T::reset)
58  .def("decode", [](T &self, std::vector<uint16_t>& cmds) { self.decode(cmds); }, py::arg("cmds"))
59  // .def("callback_on_command", &T::callback_on_command, py::arg("cb"))
60  ; // CommandDecoder
61 }
62 
63 
64 } // itk::itkpix::cmd
auto pybindCommandDecoder(py::module_ &m)
Pybinding template for CommandDecoder.
Definition: pybind.hpp:52
auto pybindCommandCallback(py::module_ &m)
Pybinding template for CommandCallback.
Definition: pybind.hpp:23