From d717feaf3d6ce6f8823a6437000e0394b5b68134 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Wed, 31 Jul 2019 14:34:36 -0700 Subject: rfnoc: radio: Introduce coerce_rate() method This is a helper method for property resolution, where set_rate() is not appropriate. --- host/lib/include/uhdlib/rfnoc/radio_control_impl.hpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'host/lib/include/uhdlib/rfnoc/radio_control_impl.hpp') diff --git a/host/lib/include/uhdlib/rfnoc/radio_control_impl.hpp b/host/lib/include/uhdlib/rfnoc/radio_control_impl.hpp index 6b50cc31c..fc90035f7 100644 --- a/host/lib/include/uhdlib/rfnoc/radio_control_impl.hpp +++ b/host/lib/include/uhdlib/rfnoc/radio_control_impl.hpp @@ -256,6 +256,22 @@ public: static const uhd::fs_path FE_PATH; protected: + /*! Helper function for property propagation: Like set_rate(), but called + * during a different context. + * + * This function is called from the samp_rate property resolver. The + * difference to set_rate() is that the latter is a user API, and may + * trigger different kinds of warnings or errors. + * If the radio supports changing its sampling rate at runtime, it is OK to + * call set_rate() within this function. + * + * Default implementation is to simply return the current rate. + */ + virtual double coerce_rate(const double /* rate */) + { + return _rate; + } + //! Properties for samp_rate (one per port) std::vector> _samp_rate_in; //! Properties for samp_rate (one per port) -- cgit v1.2.3