1 %% Copyright (C) 2013, 2014 Czech Technical University in Prague
6 %% This document contains proprietary information belonging to Czech
7 %% Technical University in Prague. Passing on and copying of this
8 %% document, and communication of its contents is not permitted
9 %% without prior written authorization.
11 %% File : sfunction_irc.tlc
13 %% TLC file for inlining RPP IRC input block.
16 %% BlockTypeSetup() : rtw_tlc.pdf p. 277
17 %% Start() : rtw_tlc.pdf p. 279
18 %% Outputs() : rtw_tlc.pdf p. 281
21 %implements sfunction_irc "C"
26 %% Function: BlockInstanceSetup ================================================
27 %function BlockInstanceSetup(block, system) void
28 %assign irc_num = LibBlockParameterValue(p1, 0)
32 %if EXISTS("rpp_din_10_11_used") == 1
33 %<LibBlockReportError(block, "Either IRC1 or Digital Input pin 10 and 11 blocks are allowed in one model, not both.")>
35 %assign ::rpp_irc_1_used = 1
39 %if EXISTS("rpp_din_14_15_used") == 1
40 %<LibBlockReportError(block, "Either IRC2 or Digital Input pin 14 and 15 blocks are allowed in one model, not both.")>
42 %assign ::rpp_irc_2_used = 1
48 %% Function: BlockTypeSetup ====================================================
49 %function BlockTypeSetup(block, system) void
51 %% Ensure required header files are included
52 %<RppCommonBlockTypeSetup(block, system)>
53 %<LibAddToCommonIncludes("rpp/rpp.h")>
54 %assign ::rpp_irc_present=1
59 %% Function: Start =============================================================
60 %function Start(block, system) Output
62 %if !SLibCodeGenForSim()
63 %assign irc_num = LibBlockParameterValue(p1, 0)
64 rpp_irc_enable(%<irc_num>);
70 %% Function: Outputs ===========================================================
71 %function Outputs(block, system) Output
73 %if !SLibCodeGenForSim()
76 %assign err_flag = LibBlockOutputSignal(1, "", "", 0)
79 %assign irc_num = LibBlockParameterValue(p1, 0)
81 %% Control if irc running
82 if (rpp_irc_status(%<irc_num>) != 1) {
86 %assign irc_val = LibBlockOutputSignal(0, "", "", 0)
87 %<irc_val> = rpp_irc_get(%<irc_num>);