diff options
-rw-r--r-- | host/include/uhd/types/serial.hpp | 7 | ||||
-rw-r--r-- | host/lib/types/serial.cpp | 9 |
2 files changed, 16 insertions, 0 deletions
diff --git a/host/include/uhd/types/serial.hpp b/host/include/uhd/types/serial.hpp index 13832e318..7475708f6 100644 --- a/host/include/uhd/types/serial.hpp +++ b/host/include/uhd/types/serial.hpp @@ -104,6 +104,13 @@ struct UHD_API spi_config_t * \param edge the default edge for mosi and miso */ spi_config_t(edge_t edge = EDGE_RISE); + + /*! + * Create a new spi config with custom divider. + * \param edge the default edge for mosi and miso + * \param divider the divider setting to use + */ + spi_config_t(edge_t edge, size_t divider); }; /*! diff --git a/host/lib/types/serial.cpp b/host/lib/types/serial.cpp index 67272e62e..1c9c7bebe 100644 --- a/host/lib/types/serial.cpp +++ b/host/lib/types/serial.cpp @@ -33,6 +33,15 @@ spi_config_t::spi_config_t(edge_t edge) : mosi_edge(edge), miso_edge(edge) use_custom_divider = false; } +spi_config_t::spi_config_t(edge_t edge, size_t divider) : + mosi_edge(edge), + miso_edge(edge), + use_custom_divider(true), + divider(divider) +{ + // empty +} + void i2c_iface::write_eeprom(uint16_t addr, uint16_t offset, const byte_vector_t& bytes) { for (size_t i = 0; i < bytes.size(); i++) { |