function ret = ADCClockDisplayCallback(hObj, varargin)
%ADCCLOCKDISPLAYCALLBACK 

% Copyright 2013-2020 The MathWorks, Inc.


ret = 0;
if ~isempty(varargin)
    Module = varargin{1};
    if nargin > 1
        ADCType = varargin{2};
    else
        ADCType = 3;
    end
else
    Module = 'ADC';
    ADCType = 3;
end
hCS = hObj.getConfigSet();
if codertarget.target.isCoderTarget(hCS)
    hCT = hCS.getComponent('Coder Target');
    if ADCType >= 3
        CpuClock = str2double(hCT.CoderTargetData.Clocking.ClosestCpuClock);
        ADCClock = hCT.CoderTargetData.(Module).ClockDiv;
        ret = CpuClock/codertarget.tic2000.internal.getDividerValueFromString(ADCClock);
    else
        if ischar(hCT.CoderTargetData.Clocking.HSPCLK)
            HSPCLK = str2double(hCT.CoderTargetData.Clocking.HSPCLK);
        else
            HSPCLK = hCT.CoderTargetData.Clocking.HSPCLK;
        end
        ADCLKPS = str2double(hCT.CoderTargetData.(Module).ADCLKPS);
        CPS = str2double(hCT.CoderTargetData.(Module).CPS);
        if ADCLKPS
            ret = HSPCLK/(ADCLKPS*2)/(CPS+1);
        else
            ret = HSPCLK/(CPS+1);
        end
    end
end

end