function [fmod, fmast, dependencyDelay] = calcI2CFrequencies(system_clock_inMHz, IPSC, ICCL, ICCH)
%

% Copyright 2013-2018 The MathWorks, Inc.

IPSC = convertStringsToChars(IPSC);
ICCL = convertStringsToChars(ICCL);
ICCH = convertStringsToChars(ICCH);

if ischar(IPSC)
    IPSC = str2double(IPSC);
end

if ischar(ICCL)
    ICCL = str2double(ICCL);
end

if ischar(ICCH)
    ICCH = str2double(ICCH);
end

fmod = system_clock_inMHz * 1e6 / (IPSC + 1); %MHz to Hz
if IPSC == 0
    dependencyDelay = 7;
elseif IPSC == 1
    dependencyDelay = 6;
else
    dependencyDelay = 5;
end
fmast = fmod / ((ICCL+dependencyDelay) + (ICCH+dependencyDelay));