2017-05-02 18:10:05 +00:00
|
|
|
//
|
|
|
|
|
// Copyright 2017-2018 Ettus Research, a National Instruments Company
|
2019-02-04 15:00:16 +00:00
|
|
|
// Copyright 2019 Ettus Research, a National Instruments Brand
|
2017-05-02 18:10:05 +00:00
|
|
|
//
|
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#ifndef INCLUDED_UHD_USRP_DBOARD_IFACE_PYTHON_HPP
|
|
|
|
|
#define INCLUDED_UHD_USRP_DBOARD_IFACE_PYTHON_HPP
|
|
|
|
|
|
2020-03-02 23:25:13 +00:00
|
|
|
#include "../include/uhdlib/usrp/gpio_defs.hpp"
|
2017-05-02 18:10:05 +00:00
|
|
|
#include <uhd/usrp/dboard_iface.hpp>
|
|
|
|
|
#include <uhd/usrp/gpio_defs.hpp>
|
|
|
|
|
|
2019-02-04 15:00:16 +00:00
|
|
|
void export_dboard_iface(py::module& m)
|
2017-05-02 18:10:05 +00:00
|
|
|
{
|
|
|
|
|
using dboard_iface = uhd::usrp::dboard_iface;
|
|
|
|
|
using special_props_t = uhd::usrp::dboard_iface_special_props_t;
|
|
|
|
|
using unit_t = dboard_iface::unit_t;
|
|
|
|
|
|
2020-03-02 23:25:13 +00:00
|
|
|
using aux_dac_t = dboard_iface::aux_dac_t;
|
|
|
|
|
using aux_adc_t = dboard_iface::aux_adc_t;
|
2017-05-02 18:10:05 +00:00
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
2019-02-04 15:00:16 +00:00
|
|
|
py::enum_<gpio_atr_reg_t>(m, "gpio_atr_reg")
|
2020-03-02 23:25:13 +00:00
|
|
|
.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);
|
2017-05-02 18:10:05 +00:00
|
|
|
|
2019-02-04 15:00:16 +00:00
|
|
|
py::enum_<gpio_atr_mode_t>(m, "gpio_atr_mode")
|
2020-03-02 23:25:13 +00:00
|
|
|
.value("MODE_ATR", gpio_atr_mode_t::MODE_ATR)
|
|
|
|
|
.value("MODE_GPIO", gpio_atr_mode_t::MODE_GPIO);
|
2017-05-02 18:10:05 +00:00
|
|
|
|
2019-02-04 15:00:16 +00:00
|
|
|
py::enum_<unit_t>(m, "unit")
|
2020-03-02 23:25:13 +00:00
|
|
|
.value("UNIT_RX", unit_t::UNIT_RX)
|
|
|
|
|
.value("UNIT_TX", unit_t::UNIT_TX)
|
|
|
|
|
.value("UNIT_BOTH", unit_t::UNIT_BOTH);
|
2017-05-02 18:10:05 +00:00
|
|
|
|
2019-02-04 15:00:16 +00:00
|
|
|
py::enum_<aux_dac_t>(m, "aux_dac")
|
2017-05-02 18:10:05 +00:00
|
|
|
.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)
|
2020-03-02 23:25:13 +00:00
|
|
|
.value("AUX_DAC_D", aux_dac_t::AUX_DAC_D);
|
2017-05-02 18:10:05 +00:00
|
|
|
|
2019-02-04 15:00:16 +00:00
|
|
|
py::enum_<aux_adc_t>(m, "aux_adc")
|
2017-05-02 18:10:05 +00:00
|
|
|
.value("AUX_ADC_A", aux_adc_t::AUX_ADC_A)
|
2020-03-02 23:25:13 +00:00
|
|
|
.value("AUX_ADC_B", aux_adc_t::AUX_ADC_B);
|
2017-05-02 18:10:05 +00:00
|
|
|
|
2019-02-04 15:00:16 +00:00
|
|
|
py::class_<special_props_t>(m, "special_props")
|
2017-05-02 18:10:05 +00:00
|
|
|
// Properties
|
2019-02-04 15:00:16 +00:00
|
|
|
.def_readwrite("soft_clock_divider", &special_props_t::soft_clock_divider)
|
2020-03-02 23:25:13 +00:00
|
|
|
.def_readwrite("mangle_i2c_addrs", &special_props_t::mangle_i2c_addrs);
|
2017-05-02 18:10:05 +00:00
|
|
|
|
2019-02-04 15:00:16 +00:00
|
|
|
py::class_<dboard_iface, dboard_iface::sptr>(m, "dboard_iface")
|
2017-05-02 18:10:05 +00:00
|
|
|
// Methods
|
|
|
|
|
.def("get_special_props", &dboard_iface::get_special_props)
|
2020-03-02 23:25:13 +00:00
|
|
|
.def("write_aux_dac", &dboard_iface::write_aux_dac)
|
|
|
|
|
.def("read_aux_adc", &dboard_iface::read_aux_adc)
|
|
|
|
|
.def("set_pin_ctrl", &dboard_iface::set_pin_ctrl)
|
|
|
|
|
.def("get_pin_ctrl", &dboard_iface::get_pin_ctrl)
|
|
|
|
|
.def("set_atr_reg", &dboard_iface::set_atr_reg)
|
|
|
|
|
.def("get_atr_reg", &dboard_iface::get_atr_reg)
|
|
|
|
|
.def("set_gpio_ddr", &dboard_iface::set_gpio_ddr)
|
|
|
|
|
.def("get_gpio_ddr", &dboard_iface::get_gpio_ddr)
|
|
|
|
|
.def("get_gpio_out", &dboard_iface::get_gpio_out)
|
|
|
|
|
.def("set_gpio_out", &dboard_iface::set_gpio_out)
|
|
|
|
|
.def("read_gpio", &dboard_iface::read_gpio)
|
|
|
|
|
.def("write_spi", &dboard_iface::write_spi)
|
|
|
|
|
.def("read_write_spi", &dboard_iface::read_write_spi)
|
|
|
|
|
.def("set_clock_rate", &dboard_iface::set_clock_rate)
|
|
|
|
|
.def("get_clock_rate", &dboard_iface::get_clock_rate)
|
|
|
|
|
.def("get_clock_rates", &dboard_iface::get_clock_rates)
|
2017-05-02 18:10:05 +00:00
|
|
|
.def("set_clock_enabled", &dboard_iface::set_clock_enabled)
|
2020-03-02 23:25:13 +00:00
|
|
|
.def("get_codec_rate", &dboard_iface::get_codec_rate)
|
2017-05-02 18:10:05 +00:00
|
|
|
.def("set_fe_connection", &dboard_iface::set_fe_connection)
|
2020-03-02 23:25:13 +00:00
|
|
|
.def("get_command_time", &dboard_iface::get_command_time)
|
|
|
|
|
.def("set_command_time", &dboard_iface::set_command_time)
|
|
|
|
|
.def("sleep", &dboard_iface::sleep);
|
2017-05-02 18:10:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif /* INCLUDED_UHD_USRP_DBOARD_IFACE_PYTHON_HPP */
|