From c96649d5c0e1b2dc17738b6904238eed66a3b9f0 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 25 Jun 2011 21:15:50 -0700 Subject: uhd: created uart iface to inherit from --- host/include/uhd/types/serial.hpp | 22 ++++++++++++++++++++++ host/include/uhd/usrp/mboard_iface.hpp | 16 +--------------- 2 files changed, 23 insertions(+), 15 deletions(-) (limited to 'host/include') diff --git a/host/include/uhd/types/serial.hpp b/host/include/uhd/types/serial.hpp index cf7e494f9..8a5ed1c32 100644 --- a/host/include/uhd/types/serial.hpp +++ b/host/include/uhd/types/serial.hpp @@ -175,6 +175,28 @@ namespace uhd{ ); }; + /*! + * UART interface to write and read bytes. + */ + class UHD_API uart_iface{ + public: + typedef boost::shared_ptr sptr; + + /*! + * Write to a serial port. + * \param dev which UART to write to + * \param buf the data to write + */ + virtual void write_uart(boost::uint8_t dev, const std::string &buf) = 0; + + /*! + * Read from a serial port. + * \param dev which UART to read from + * \return the data read from the serial port + */ + virtual std::string read_uart(boost::uint8_t dev) = 0; + }; + } //namespace uhd #endif /* INCLUDED_UHD_TYPES_SERIAL_HPP */ diff --git a/host/include/uhd/usrp/mboard_iface.hpp b/host/include/uhd/usrp/mboard_iface.hpp index 784fbc7c5..bbee8f2de 100644 --- a/host/include/uhd/usrp/mboard_iface.hpp +++ b/host/include/uhd/usrp/mboard_iface.hpp @@ -33,7 +33,7 @@ namespace uhd{ namespace usrp{ * Provides a set of functions to implementation layer. * Including spi, peek, poke, control... */ -class mboard_iface : public uhd::i2c_iface, public uhd::spi_iface { +class mboard_iface : public uhd::i2c_iface, public uhd::spi_iface, public uhd::uart_iface { public: typedef boost::shared_ptr sptr; /*! @@ -64,20 +64,6 @@ public: */ virtual boost::uint16_t peek16(boost::uint32_t addr) = 0; - /*! - * Write to a serial port. - * \param dev which UART to write to - * \param buf the data to write - */ - virtual void write_uart(boost::uint8_t dev, const std::string &buf) = 0; - - /*! - * Read from a serial port. - * \param dev which UART to read from - * \return the data read from the serial port - */ - virtual std::string read_uart(boost::uint8_t dev) = 0; - }; }} -- cgit v1.2.3