From c309da44616bf910cf526723217c021856576f4d Mon Sep 17 00:00:00 2001 From: Mark Meserve Date: Wed, 27 Sep 2017 17:43:18 -0500 Subject: ad937x: add comments to ad937x_gain_ctrl_config --- mpm/lib/mykonos/config/ad937x_gain_ctrl_config.cpp | 1 + mpm/lib/mykonos/config/ad937x_gain_ctrl_config.hpp | 35 +++++++++++----------- 2 files changed, 19 insertions(+), 17 deletions(-) (limited to 'mpm/lib/mykonos') diff --git a/mpm/lib/mykonos/config/ad937x_gain_ctrl_config.cpp b/mpm/lib/mykonos/config/ad937x_gain_ctrl_config.cpp index f52982a96..7785a3adb 100644 --- a/mpm/lib/mykonos/config/ad937x_gain_ctrl_config.cpp +++ b/mpm/lib/mykonos/config/ad937x_gain_ctrl_config.cpp @@ -120,6 +120,7 @@ ad937x_gain_ctrl_config_t::ad937x_gain_ctrl_config_t(gain_pins_t gain_pins) { config.emplace(std::piecewise_construct, std::forward_as_tuple(RX_DIRECTION), std::forward_as_tuple()); config.emplace(std::piecewise_construct, std::forward_as_tuple(TX_DIRECTION), std::forward_as_tuple()); + config.at(RX_DIRECTION).emplace(std::piecewise_construct, std::forward_as_tuple(chain_t::ONE), std::forward_as_tuple( _get_gain_pin(RX_DIRECTION, chain_t::ONE, pin_direction_t::INCREASE, gain_pins), diff --git a/mpm/lib/mykonos/config/ad937x_gain_ctrl_config.hpp b/mpm/lib/mykonos/config/ad937x_gain_ctrl_config.hpp index 37c84e36c..065cdec3f 100644 --- a/mpm/lib/mykonos/config/ad937x_gain_ctrl_config.hpp +++ b/mpm/lib/mykonos/config/ad937x_gain_ctrl_config.hpp @@ -20,27 +20,11 @@ #include "../ad937x_device_types.hpp" #include "../adi/t_mykonos.h" -// TODO: fix paths for the config subfolder -#include "../../../include/mpm/ad937x/ad937x_ctrl_types.hpp" +#include "mpm/ad937x/ad937x_ctrl_types.hpp" #include #include -struct ad937x_gain_ctrl_channel_t -{ - uint8_t enable; - uint8_t inc_step; - uint8_t dec_step; - mykonosGpioSelect_t inc_pin; - mykonosGpioSelect_t dec_pin; - - ad937x_gain_ctrl_channel_t(mykonosGpioSelect_t inc_pin, mykonosGpioSelect_t dec_pin); - -private: - const static uint8_t DEFAULT_GAIN_STEP; - const static bool DEFAULT_ENABLE; -}; - // C++14 requires std::hash includes a specialization for enums, but gcc doesn't do that yet // Remove this when that happens namespace std { @@ -61,6 +45,23 @@ namespace std { }; } +// collection of the 5 attributes that define the gain pins for a channel in Mykonos +struct ad937x_gain_ctrl_channel_t +{ + uint8_t enable; + uint8_t inc_step; + uint8_t dec_step; + mykonosGpioSelect_t inc_pin; + mykonosGpioSelect_t dec_pin; + + ad937x_gain_ctrl_channel_t(mykonosGpioSelect_t inc_pin, mykonosGpioSelect_t dec_pin); + +private: + const static uint8_t DEFAULT_GAIN_STEP; + const static bool DEFAULT_ENABLE; +}; + +// logically maps ad937x_gain_ctrl_channels by direction and channel number struct ad937x_gain_ctrl_config_t { std::unordered_map