mirror of
https://github.com/fairwaves/UHD-Fairwaves.git
synced 2025-11-03 13:33:15 +00:00
umtrx: add spi/i2c/wishbone interfaces into the ptree
This commit is contained in:
@@ -146,6 +146,11 @@ umtrx_impl::umtrx_impl(const device_addr_t &device_addr)
|
||||
_tree->create<std::string>(mb_path / "name").set(_iface->get_cname());
|
||||
_tree->create<std::string>(mb_path / "fw_version").set(_iface->get_fw_version_string());
|
||||
|
||||
//get access to the various interfaces
|
||||
_tree->create<uhd::wb_iface::sptr>(mb_path / "wb_iface").set(_iface);
|
||||
_tree->create<uhd::spi_iface::sptr>(mb_path / "spi_iface").set(_iface);
|
||||
_tree->create<uhd::i2c_iface::sptr>(mb_path / "i2c_iface").set(_iface);
|
||||
|
||||
//check the fpga compatibility number
|
||||
const boost::uint32_t fpga_compat_num = _iface->peek32(U2_REG_COMPAT_NUM_RB);
|
||||
const boost::uint16_t fpga_major = fpga_compat_num >> 16, fpga_minor = fpga_compat_num & 0xffff;
|
||||
|
||||
@@ -172,6 +172,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
|
||||
uhd::usrp::multi_usrp::sptr usrp = uhd::usrp::multi_usrp::make(args);
|
||||
std::cout << boost::format("Using Device: %s") % usrp->get_pp_string() << std::endl;
|
||||
|
||||
//access the i2c interface
|
||||
uhd::i2c_iface::sptr i2c = usrp->get_device()->get_tree()->access<uhd::i2c_iface::sptr>("/mboards/0/i2c_iface").get();
|
||||
|
||||
//set the tx sample rate
|
||||
std::cout << boost::format("Setting TX Rate: %f Msps...") % (tx_rate/1e6) << std::endl;
|
||||
usrp->set_tx_rate(tx_rate);
|
||||
|
||||
Reference in New Issue
Block a user