gusucode.com > target工具箱matlab源码程序 > target/extensions/processor/shared/ti/blks/masks/rtdx_callback.m

    function varargout = rtdx_callback(action)
% RTDX_CALLBACK Mask Helper Function for the RTDX Source block.

% Copyright 2001-2015 The MathWorks, Inc.

if nargin==0, action = 'dynamic'; end
blk = gcbh;

retvalue = 1;

switch action
    case 'dynamic'
        
        mask_enables_orig    = get_param(blk,'MaskEnables');
        mask_enables         = mask_enables_orig;
        isBlocking           = get_param(blk,'isBlocking');
        ICEditBoxIndex       = 3;
        
        if (strcmp(isBlocking,'on'))
            mask_enables{ICEditBoxIndex} = 'off';
        else
            mask_enables{ICEditBoxIndex} = 'on';
        end
        
        if ~isequal(mask_enables, mask_enables_orig),
            set_param(blk,'MaskEnables',mask_enables);
        end
        
    case 'ChName'
        
        allblocks = [ find_system(gcs,'FollowLinks','on','LookUnderMasks','on','MaskType','To RTDX'); ...
            find_system(gcs,'FollowLinks','on','LookUnderMasks','on','MaskType','From RTDX') ];
        
        allChannelNames = sort(get_param (allblocks, 'channelNameStr'));
        
        for i=1:length(allChannelNames)-1
            if ( isequal (allChannelNames{i}, allChannelNames{i+1} ) )
                retvalue = 0;
            end
        end
        
    case {'InitFcn', 'CopyFcn'}
        if (~exist('qeBypassBoardCheck', 'file') || ~qeBypassBoardCheck())
            acs = getActiveConfigSet(bdroot(gcs));
            if ~isempty(acs)
                hwDeviceType = get_param(acs, 'ProdHWDeviceType');
                if ismember(hwDeviceType, {'Texas Instruments->C6000', 'TI C6000'})
                    DAStudio.error('TARGETSHARED:blocks:rtdxdeprecation');
                end
            end
        end
        
end
if nargout >= 1
    varargout{1} = retvalue;
end
end
% [EOF] rtdx_callback.m