diff options
author | Martin Anderseck <martin.anderseck@ni.com> | 2022-03-17 13:34:15 +0100 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2022-04-04 12:27:18 -0700 |
commit | bc8713e7af36377abe1c0e969c095c6b627b00c7 (patch) | |
tree | 2376c3fa5430b2329b66e44d485904255f29b3f1 /host/examples/spi.cpp | |
parent | af9e13f4dcf8ebf71a5944edcd0c0a328f558057 (diff) | |
download | uhd-bc8713e7af36377abe1c0e969c095c6b627b00c7.tar.gz uhd-bc8713e7af36377abe1c0e969c095c6b627b00c7.tar.bz2 uhd-bc8713e7af36377abe1c0e969c095c6b627b00c7.zip |
host: SPI: Read number of supported SPI slaves from device
Add support for reading the number of supported SPI slaves from
the device. This has become necessary because we may have bitfiles
with different capabilities and we want to report this back correctly.
Diffstat (limited to 'host/examples/spi.cpp')
-rw-r--r-- | host/examples/spi.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/host/examples/spi.cpp b/host/examples/spi.cpp index e5372cac3..e986eb7d3 100644 --- a/host/examples/spi.cpp +++ b/host/examples/spi.cpp @@ -68,8 +68,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) // create a usrp device std::cout << std::endl; - std::cout << "Creating the usrp device with: " << args << "..." - << std::endl; + std::cout << "Creating the usrp device with: " << args << "..." << std::endl; auto usrp = uhd::usrp::multi_usrp::make(args); if (vm.count("list-banks")) { @@ -80,7 +79,12 @@ int UHD_SAFE_MAIN(int argc, char* argv[]) } } - // Get the SPI getter interface from where we'll get + // Get the SPI getter interface from where we'll get the SPI interface itself + if (!usrp->get_radio_control().has_feature<uhd::features::spi_getter_iface>()) { + std::cout << "Error: Could not find SPI_Getter_Iface. Please check if your FPGA " + "image is up to date.\n"; + return EXIT_FAILURE; + } auto& spi_getter_iface = usrp->get_radio_control().get_feature<uhd::features::spi_getter_iface>(); |