%% Call C Functions Using C Caller Block
%
% This example shows how to use the C Caller block to call your handwritten
% C functions.
% 
% In this example, four custom C functions are defined in my_func.h, and
% implemented in my_func.c.
%
% The header file and the source file are specified in 
% *''Model Configuration Parameters > Simulation Target''*. 
% Then C functions can be called via C Caller blocks. For example,
% the block 'add' adds a signal and a constant together, 
% and the block 'timesK' multiplies the signal by a parameter K. 
% C Caller block supports C structure and enumeration types.
% Use command *''Simulink.importExternalCTypes''* to import these types into Simulink 
% as matching Simulink.Bus object or Simulink.IntEnumType.

% Copyright 2018 The MathWorks, Inc.

model = 'slexCCallerExample';
open_system(model);
evalc('sim(model)');
slcc('clearCustomCodeModules');  % unload custom libs before delete slprj folder

%% 
% *Set up custom C code in model configuration*
%
% Add '#include "my_func.h"' to
% *''Configuration Parameters > Simulation Target > Header File''* field.
%
% Add 'include' to
% *''Configuration Parameters > Simulation Target > Include directories''* field.
%
% Add 'src/my_func.c' to
% *''Configuration Parameters > Simulation Target > Source Files''* field.
%
