function visible = serialConfigurationVisibility(hObj, module)
%SERIALCONFIGURATIONVISIBILITY Returns 1 if 'serial' is selected as external mode or PIL, 0 else

%   Copyright 2020-2022 The MathWorks, Inc.

visible = 0;

if codertarget.target.isCoderTarget(hObj.getConfigSet())
    if strcmp(module,'ExternalMode')
        visible = find(strcmp(codertarget.data.getParameterValue(hObj, 'ExtMode.Configuration'), ...
            {'serial', 'XCP on Serial'}), 1);
        if isempty(visible)
            visible = 0;
        end
    elseif strcmp(module,'PIL') 
        if codertarget.data.isValidParameter(hObj, 'PIL.CommunicationInterface')
            visible = strcmp(codertarget.data.getParameterValue(hObj, 'PIL.CommunicationInterface'), ...
                'serial');
        end
    elseif strcmp(module,'SimulinkIO') 
        if codertarget.data.isValidParameter(hObj, 'SimulinkIO.CommunicationInterface')
            visible = strcmp(codertarget.data.getParameterValue(hObj, 'SimulinkIO.CommunicationInterface'), ...
                'serial');
        end
    end
end
end