diff options
Diffstat (limited to 'host/lib/usrp/usrp2/usrp2_iface.cpp')
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index c639c0dfe..76ee5d6fe 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -136,8 +136,8 @@ public: /*********************************************************************** * EEPROM **********************************************************************/ - void write_eeprom(boost::uint8_t addr, boost::uint8_t offset, const byte_vector_t &buf){ - BOOST_FOREACH(boost::uint8_t byte, buf){ + void write_eeprom(boost::uint8_t addr, boost::uint8_t offset, const byte_vector_t &bytes){ + BOOST_FOREACH(boost::uint8_t byte, bytes){ //write a byte at a time, its easy that way byte_vector_t cmd = boost::assign::list_of(offset)(byte); this->write_i2c(addr, cmd); @@ -145,9 +145,13 @@ public: } byte_vector_t read_eeprom(boost::uint8_t addr, boost::uint8_t offset, size_t num_bytes){ - //do a zero byte write to start read cycle - write_i2c(addr, byte_vector_t(1, offset)); - return read_i2c(addr, num_bytes); + byte_vector_t bytes; + for (size_t i = 0; i < num_bytes; i++){ + //do a zero byte write to start read cycle + write_i2c(addr, byte_vector_t(1, offset)); + bytes.push_back(read_i2c(addr, 1).at(0)); + } + return bytes; } /*********************************************************************** |