diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-03-08 09:28:55 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:03:44 -0800 |
commit | 1a4348038d0eb57d53475074dca49e8192aeb2d7 (patch) | |
tree | 04c8e87fa9c95d2702aac410f6fb271461acb9bb /mpm/lib/spi/spi_config.cpp | |
parent | fc8cd827f6b16b9c8c354a216889e6a9d7f37456 (diff) | |
download | uhd-1a4348038d0eb57d53475074dca49e8192aeb2d7.tar.gz uhd-1a4348038d0eb57d53475074dca49e8192aeb2d7.tar.bz2 uhd-1a4348038d0eb57d53475074dca49e8192aeb2d7.zip |
Initial commit for N3xx development.
- Creates mpm/ subdirectory
- First pass at hardware daemon/MPM
- New code for LMK04828, AD9371
- spidev integration
Contributions by:
Martin Braun <martin.braun@ettus.com>
Derek Kozel <derek.kozel@ettus.com>
Mark Meserve <mark.meserve@ni.com>
Andrej Rode <andrej.rode@ettus.com>
Diffstat (limited to 'mpm/lib/spi/spi_config.cpp')
-rw-r--r-- | mpm/lib/spi/spi_config.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/mpm/lib/spi/spi_config.cpp b/mpm/lib/spi/spi_config.cpp new file mode 100644 index 000000000..69d6d9c2a --- /dev/null +++ b/mpm/lib/spi/spi_config.cpp @@ -0,0 +1,37 @@ +#include "spi_config.h" + + +spi_config_t::spi_config_t(const spi_hwd_settings_t hwd_settings, const spi_device_settings_t device_settings) : + full_settings({ + _convert_to_adi_settings(hwd_settings.chip_select_index, device_settings), + hwd_settings }) +{ + +} + +spiSettings_t spi_config_t::_convert_to_adi_settings(const uint8_t chip_select_index, const spi_device_settings_t device_settings) +{ + return { + chip_select_index, + device_settings.writeBitPolarity, + device_settings.longInstructionWord, + device_settings.MSBFirst, + device_settings.CPHA, + device_settings.CPOL, + device_settings.enSpiStreaming, + device_settings.autoIncAddrUp, + device_settings.fourWireMode, + device_settings.spiClkFreq_Hz, + }; +} + +const spiSettings_t* spi_config_t::get_spi_settings() const +{ + return &(full_settings.adi_settings); +} + +const spi_full_settings_t* spi_config_t::recover_full_spi_settings(const spiSettings_t* settings) +{ + // TODO: make this better + return reinterpret_cast<const spi_full_settings_t*>(settings); +} |