diff options
author | Lane Kolbly <lane.kolbly@ni.com> | 2021-10-25 15:54:25 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-11-05 12:02:19 -0700 |
commit | 568ee85778bcf0ef304b5f330ee71c113f403ed8 (patch) | |
tree | 4369aef243fd4dc50de3151fc70e73937ed9fe1b /host/lib/usrp/mpmd | |
parent | 0bb02043a3d197b3fc3282bb1b0826dcbbaffe8a (diff) | |
download | uhd-568ee85778bcf0ef304b5f330ee71c113f403ed8.tar.gz uhd-568ee85778bcf0ef304b5f330ee71c113f403ed8.tar.bz2 uhd-568ee85778bcf0ef304b5f330ee71c113f403ed8.zip |
host: Add gpio_voltage discoverable feature
Diffstat (limited to 'host/lib/usrp/mpmd')
-rw-r--r-- | host/lib/usrp/mpmd/mpmd_mb_controller.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/host/lib/usrp/mpmd/mpmd_mb_controller.cpp b/host/lib/usrp/mpmd/mpmd_mb_controller.cpp index b79abcee0..cdc86b086 100644 --- a/host/lib/usrp/mpmd/mpmd_mb_controller.cpp +++ b/host/lib/usrp/mpmd/mpmd_mb_controller.cpp @@ -74,6 +74,41 @@ void mpmd_mb_controller::trig_io_mode::set_trig_io_mode(const uhd::trig_io_mode_ } } +mpmd_mb_controller::gpio_power::gpio_power( + uhd::usrp::dio_rpc_iface::sptr rpcc, const std::vector<std::string>& ports) + : _rpcc(rpcc), _ports(ports) +{} + +std::vector<std::string> mpmd_mb_controller::gpio_power::get_supported_voltages( + const std::string& port) const +{ + return _rpcc->dio_get_supported_voltage_levels(port); +} + +void mpmd_mb_controller::gpio_power::set_port_voltage( + const std::string& port, const std::string& voltage) +{ + _rpcc->dio_set_voltage_level(port, voltage); +} + +std::string mpmd_mb_controller::gpio_power::get_port_voltage( + const std::string& port) const +{ + return _rpcc->dio_get_voltage_level(port); +} + +void mpmd_mb_controller::gpio_power::set_external_power( + const std::string& port, bool enable) +{ + _rpcc->dio_set_external_power(port, enable); +} + +std::string mpmd_mb_controller::gpio_power::get_external_power_status( + const std::string& port) const +{ + return _rpcc->dio_get_external_power_state(port); +} + mpmd_mb_controller::mpmd_mb_controller( uhd::usrp::mpmd_rpc_iface::sptr rpcc, uhd::device_addr_t device_info) : _rpc(rpcc), _device_info(device_info) @@ -106,6 +141,12 @@ mpmd_mb_controller::mpmd_mb_controller( _trig_io_mode = std::make_shared<trig_io_mode>(_rpc); register_feature(_trig_io_mode); } + + if (_rpc->supports_feature("gpio_power")) { + _gpio_power = std::make_shared<gpio_power>( + std::make_shared<uhd::usrp::dio_rpc>(get_rpc_client()), _gpio_banks); + register_feature(_gpio_power); + } } /****************************************************************************** |