diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-09-26 18:22:25 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-09-29 10:50:56 -0700 |
commit | 83dde40090e0bbd91c304602cc0e3c365f7878bb (patch) | |
tree | c404968e3d6d35795f331ade6ad3c176f3c1bc8b /host/lib/utils/eeprom_utils.cpp | |
parent | 59736a5bf512db83a6bd7250e14b13c7464770fc (diff) | |
download | uhd-83dde40090e0bbd91c304602cc0e3c365f7878bb.tar.gz uhd-83dde40090e0bbd91c304602cc0e3c365f7878bb.tar.bz2 uhd-83dde40090e0bbd91c304602cc0e3c365f7878bb.zip |
uhd: Changed mboard_eeprom_t interface, refactored MB EEPROM code
- uhd::usrp::mboard_eeprom_t is now simply a map. Its commit() method
has no utility being a public API call, because the user never gets
access to the appropriate I2C object (Minor API breakage)
- The central mboard_eeprom.cpp file was broken up and put into many
smaller compilation units in every device's implementation folder.
- Renamed some of the constants (e.g. B000_* -> USRP1_*, N100_* ->
N200_*)
- Removed the N000_* EEPROM code, because, well, you know, there's no
such device
Diffstat (limited to 'host/lib/utils/eeprom_utils.cpp')
-rw-r--r-- | host/lib/utils/eeprom_utils.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/host/lib/utils/eeprom_utils.cpp b/host/lib/utils/eeprom_utils.cpp new file mode 100644 index 000000000..acf81a1ce --- /dev/null +++ b/host/lib/utils/eeprom_utils.cpp @@ -0,0 +1,22 @@ +// +// Copyright 2017 Ettus Research (National Instruments Corp.) +// +// SPDX-License-Identifier: GPL-3.0 +// + +#include "eeprom_utils.hpp" +#include <boost/lexical_cast.hpp> + +uhd::byte_vector_t string_to_uint16_bytes(const std::string &num_str){ + const uint16_t num = boost::lexical_cast<uint16_t>(num_str); + const std::vector<uint8_t> lsb_msb = { + uint8_t(num >> 0), + uint8_t(num >> 8) + }; + return lsb_msb; +} + +std::string uint16_bytes_to_string(const uhd::byte_vector_t &bytes){ + const uint16_t num = (uint16_t(bytes.at(0)) << 0) | (uint16_t(bytes.at(1)) << 8); + return (num == 0 or num == 0xffff)? "" : std::to_string(num); +} |