aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/dboard_iface_python.hpp
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2019-02-04 16:00:16 +0100
committerMartin Braun <martin.braun@ettus.com>2019-02-22 16:56:52 -0800
commit692ddc71b17196487dcad982836e074cab9a0f25 (patch)
treecf76abf577dde6128e03561c52d9c31dca302026 /host/lib/usrp/dboard_iface_python.hpp
parent51bbf548c9b442d0b53b6c8de5f89403de274424 (diff)
downloaduhd-692ddc71b17196487dcad982836e074cab9a0f25.tar.gz
uhd-692ddc71b17196487dcad982836e074cab9a0f25.tar.bz2
uhd-692ddc71b17196487dcad982836e074cab9a0f25.zip
python: Replace Boost.Python with PyBind11
This does not change the Python API itself, but it is still a significant change. Most importantly, it removes the dependency on Boost.Python.
Diffstat (limited to 'host/lib/usrp/dboard_iface_python.hpp')
-rw-r--r--host/lib/usrp/dboard_iface_python.hpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/host/lib/usrp/dboard_iface_python.hpp b/host/lib/usrp/dboard_iface_python.hpp
index f43490e7d..96fcc1702 100644
--- a/host/lib/usrp/dboard_iface_python.hpp
+++ b/host/lib/usrp/dboard_iface_python.hpp
@@ -1,5 +1,6 @@
//
// Copyright 2017-2018 Ettus Research, a National Instruments Company
+// Copyright 2019 Ettus Research, a National Instruments Brand
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
@@ -11,7 +12,7 @@
#include <uhd/usrp/gpio_defs.hpp>
#include "../include/uhdlib/usrp/gpio_defs.hpp"
-void export_dboard_iface()
+void export_dboard_iface(py::module& m)
{
using dboard_iface = uhd::usrp::dboard_iface;
using special_props_t = uhd::usrp::dboard_iface_special_props_t;
@@ -23,48 +24,43 @@ void export_dboard_iface()
using gpio_atr_reg_t = uhd::usrp::gpio_atr::gpio_atr_reg_t;
using gpio_atr_mode_t = uhd::usrp::gpio_atr::gpio_atr_mode_t;
- bp::enum_<gpio_atr_reg_t>("gpio_atr_reg")
+ py::enum_<gpio_atr_reg_t>(m, "gpio_atr_reg")
.value("ATR_REG_IDLE" , gpio_atr_reg_t::ATR_REG_IDLE )
.value("ATR_REG_TX_ONLY" , gpio_atr_reg_t::ATR_REG_TX_ONLY )
.value("ATR_REG_RX_ONLY" , gpio_atr_reg_t::ATR_REG_RX_ONLY )
.value("ATR_REG_FULL_DUPLEX", gpio_atr_reg_t::ATR_REG_FULL_DUPLEX)
;
- bp::enum_<gpio_atr_mode_t>("gpio_atr_mode")
+ py::enum_<gpio_atr_mode_t>(m, "gpio_atr_mode")
.value("MODE_ATR" , gpio_atr_mode_t::MODE_ATR )
.value("MODE_GPIO", gpio_atr_mode_t::MODE_GPIO)
;
- bp::enum_<unit_t>("unit")
+ py::enum_<unit_t>(m, "unit")
.value("UNIT_RX" , unit_t::UNIT_RX )
.value("UNIT_TX" , unit_t::UNIT_TX )
.value("UNIT_BOTH", unit_t::UNIT_BOTH)
;
- bp::enum_<aux_dac_t>("aux_dac")
+ py::enum_<aux_dac_t>(m, "aux_dac")
.value("AUX_DAC_A", aux_dac_t::AUX_DAC_A)
.value("AUX_DAC_B", aux_dac_t::AUX_DAC_B)
.value("AUX_DAC_C", aux_dac_t::AUX_DAC_C)
.value("AUX_DAC_D", aux_dac_t::AUX_DAC_D)
;
- bp::enum_<aux_adc_t>("aux_adc")
+ py::enum_<aux_adc_t>(m, "aux_adc")
.value("AUX_ADC_A", aux_adc_t::AUX_ADC_A)
.value("AUX_ADC_B", aux_adc_t::AUX_ADC_B)
;
- bp::class_<special_props_t>("special_props")
-
+ py::class_<special_props_t>(m, "special_props")
// Properties
- .add_property("soft_clock_divider", &special_props_t::soft_clock_divider)
- .add_property("mangle_i2c_addrs" , &special_props_t::mangle_i2c_addrs )
+ .def_readwrite("soft_clock_divider", &special_props_t::soft_clock_divider)
+ .def_readwrite("mangle_i2c_addrs" , &special_props_t::mangle_i2c_addrs )
;
- bp::class_<
- dboard_iface,
- boost::shared_ptr<dboard_iface>,
- uhd::noncopyable>("dboard_iface", bp::no_init)
-
+ py::class_<dboard_iface, dboard_iface::sptr>(m, "dboard_iface")
// Methods
.def("get_special_props", &dboard_iface::get_special_props)
.def("write_aux_dac" , &dboard_iface::write_aux_dac )