%% Copyright (C) 2013, 2015 Czech Technical University in Prague %% %% Authors: %% - Carlos Jenkins %% - Michal Horn %% %% This document contains proprietary information belonging to Czech %% Technical University in Prague. Passing on and copying of this %% document, and communication of its contents is not permitted %% without prior written authorization. %% %% File : sfunction_gio_in.tlc %% Abstract: %% TLC file for inlining RPP digital input block. %% %% References: %% BlockTypeSetup() : rtw_tlc.pdf p. 277 %% Start() : rtw_tlc.pdf p. 279 %% Outputs() : rtw_tlc.pdf p. 281 %implements sfunction_gio_in "C" %include "common.tlc" %% Function: BlockTypeSetup ==================================================== %function BlockTypeSetup(block, system) void %% Ensure required header files are included % % %assign ::rpp_gio_in_present = 1 %endfunction %function BlockInstanceSetup(block, system) void %assign pin_name = SFcnParamSettings.PinName %% Ensure that every pin is configured only once %if EXISTS("::rpp_gio_%_present") == 0 %assign ::rpp_gio_%_present = 1 %else % has already been configured.")> %endif %endfunction %% Function: Start ============================================================= %function Start(block, system) Output %assign pin_name = SFcnParamSettings.PinName %assign pull_type = SFcnParamSettings.PullType %if !SLibCodeGenForSim() %if pull_type == 1 %% Tri-state rpp_gio_setup(PIN_%, RPP_GIO_IN, RPP_GIO_MODE_PULLDIS, FALSE); %elseif pull_type == 2 %% Pull up rpp_gio_setup(PIN_%, RPP_GIO_IN, RPP_GIO_MODE_PULLUP, FALSE); %elseif pull_type == 3 %% Pull down rpp_gio_setup(PIN_%, RPP_GIO_IN, RPP_GIO_MODE_PULLDOWN, FALSE); %else %% error %")> %endif %endif %endfunction %% Function: Outputs =========================================================== %function Outputs(block, system) Output %if !SLibCodeGenForSim() %assign digital_in = LibBlockOutputSignal(0, "", "", 0) %assign pin_name = SFcnParamSettings.PinName /% TODO: Handle FAILURE (add error output?) %/ % = rpp_gio_get(PIN_%) ? TRUE : FALSE; %endif %endfunction %% [EOF]