]> rtime.felk.cvut.cz Git - jenkicar/rpp-simulink.git/commitdiff
gio blocks: Allow users to select the pin from a list
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sat, 3 Oct 2015 06:06:41 +0000 (08:06 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 4 Oct 2015 08:17:04 +0000 (10:17 +0200)
This (target-specific) list is updated by rpp_setup.

Makefile
rpp/blocks/.gitattributes
rpp/blocks/rpp_gio_in.slx
rpp/blocks/rpp_gio_out.slx
rpp/blocks/rpp_update_blocks_for_target.m [new file with mode: 0644]
rpp/blocks/sfunction_gio_in.c
rpp/blocks/sfunction_gio_out.c
rpp/blocks/tlc_c/sfunction_gio_in.tlc
rpp/blocks/tlc_c/sfunction_gio_out.tlc
rpp/lib
rpp/rpp/rpp_setup.m

index f0b90f428985a69d804f10aab99a0d3b1e1351d2..e9e3f4feb6a0c6a07f5302c9afdcbfcca9845f82 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -47,7 +47,7 @@ RELEASE_LIB_GIT_FILES = \
        os/$(rpp_lib_OS)/include/ \
        rpp/include/
 
-RELEASE_LIB_GEN_FILES = Makefile.config rpp-lib.lib
+RELEASE_LIB_GEN_FILES = Makefile.config rpp-lib.lib build/gio_names.txt
 
 $(RELEASE_BASENAME):: LIB_RELEASE_BASENAME:=$(shell make -C rpp/lib --silent print-release-basename)
 $(RELEASE_BASENAME):: release-lib
index 9acd345bc60aa2a72941ec0462aca2b6f9e1cafc..a545b45510c0bd1c3e4920a8546279e2d5a7de79 100644 (file)
@@ -16,6 +16,7 @@
 /rpp_sci_printf.slx    eaton
 /rpp_sci_rx.slx        eaton
 /rpp_sci_tx.slx        eaton
+/rpp_update_blocks_for_target.m eaton
 /rpp_update_doc.m      eaton
 /sfunction_ain.c       eaton
 /sfunction_canreceive.c        eaton
index 23d9287d7c7984cdf6668b85560c9b6c1bf080d4..a9075ed249a8c7df2ff0b39ad8069664b957e049 100644 (file)
Binary files a/rpp/blocks/rpp_gio_in.slx and b/rpp/blocks/rpp_gio_in.slx differ
index 747c35020d9f3621564e5f9fde0b8eeb55f26f88..21f17a8a91d33357b46937fc4f6e2957b9bedb8f 100644 (file)
Binary files a/rpp/blocks/rpp_gio_out.slx and b/rpp/blocks/rpp_gio_out.slx differ
diff --git a/rpp/blocks/rpp_update_blocks_for_target.m b/rpp/blocks/rpp_update_blocks_for_target.m
new file mode 100644 (file)
index 0000000..44897e7
--- /dev/null
@@ -0,0 +1,21 @@
+function rpp_update_blocks_for_target
+%RPP_UPDATE_BLOCKS_FOR_TARGET Update blocks for use with the particular target hardware
+
+% Update GIO pin names
+    update_gio_names('rpp_gio_in')
+    update_gio_names('rpp_gio_out')
+end
+
+function update_gio_names(lib)
+    block_lib = load_system(lib);
+    set_param(block_lib, 'Lock', 'off');
+    block = find_system(block_lib, 'Type', 'block');
+    params = get_param(block, 'ObjectParameters');
+    p = Simulink.Mask.get(block);
+    param = p.getParameter('pin');
+    gio_names_txt = fullfile(getpref('rpp', 'RppLibRoot'), 'build', 'gio_names.txt');
+    param.TypeOptions = [{'---'}; textread(gio_names_txt, '%s')];
+    set_param(block_lib, 'Lock', 'on');
+    save_system(block_lib);
+    close_system(block_lib);
+end
index 168fbb9c9a839d9289fa34e3b1b4c38d02037e30..00238c68af677728cb22bd07426b049e1c2a250c 100644 (file)
@@ -33,26 +33,26 @@ Inputs:
 Outputs:
   - { name: "Digital Input value", type: "bool" }
 Parameters:
-  - { name: "Port type", type: "Choice", range: "GIOA, GIOB, NHET1" }
-  - { name: "Pin number", type: "int8",   range: "[0–7]", note: "(depends on selected port)" }
+  - { name: "Pin", type: "Choice", range: "Target dependent pin names or '---'" }
+  - { name: "Pin name", type: "String", note: "Pin name as defined in gio_def.h. This parameter is only visible if *Pin* is '---'." }
   - { name: "Input Type", type: "Choice", range: "Tri-state, Pull Up, Pull Down" }
 
 # Description is in Markdown mark-up
 Description: &desc |
-  Reads a value from a GPIO pin. The block supports GIOA, GIOB and NHET1 ports.
-  Any pin can be configured as tri-state, pull up or pull down.
+  Reads value from a GIO pin. Which pins are supported depends on the
+  target board. The selected pin can be configured as tri-state, pull
+  up or pull down.
 
-  It is not allowed to read from one pin by using more then one GIOIN blocks.
-  It is not allowed to use GIOIN and DOUT blocks together configured for one GPIO pin.
+  When the pin is used in multiple GIOIN or GIOOUT blocks, an error is
+  signaled.
 
 Help: *desc
 
 Status: Stable
 
 RPP API functions used:
-  - hal_gpio_pin_get_dsc
-  - hal_gpio_pin_get_value
-  - hal_gpio_pin_conf_set
+  - rpp_gio_setup
+  - rpp_gio_get
 
 Relevant demos:
   - gio_demo
@@ -63,25 +63,13 @@ Relevant demos:
 #define S_FUNCTION_NAME sfunction_gio_in
 #include "header.c"
 
-#define PARAM_NAME_PORT_TYPE           "port_type"
-#define PARAM_NAME_PIN_NUMBER          "pin_number"
-#define PARAM_NAME_INPUT_TYPE          "input_type"
-
 /** Identifiers of the block parameters */
 enum params{
-       PARAM_PORT_TYPE,
-       PARAM_PIN_NUMBER,
+       PARAM_PIN_NAME,
        PARAM_INPUT_TYPE,
        PARAMS_COUNT
 };
 
-enum port_types{
-       PORT_UNKNOWN,
-       PORT_GIOA,
-       PORT_GIOB,
-       PORT_NHET1
-};
-
 enum outputs{
        OUT_PIN_VALUE,
        OUTPUTS_COUNT
@@ -89,12 +77,6 @@ enum outputs{
 
 static void mdlInitializeSizes(SimStruct *S)
 {
-       /*
-       * Configure parameters: 3
-       *  - Port type
-       *  - Pin number
-       *  - Input type
-       */
        if (!rppSetNumParams(S, PARAMS_COUNT)) {
                return;
        }
@@ -123,42 +105,33 @@ static void mdlInitializeSizes(SimStruct *S)
 #define MDL_CHECK_PARAMETERS
 static void mdlCheckParameters(SimStruct *S)
 {
-       if ((int_T)mxGetPr(ssGetSFcnParam(S, PARAM_PORT_TYPE))[0] == PORT_GIOA) {
-               if (!rppValidParamRange(S, PARAM_PIN_NUMBER, 0, 7)) {
-                       return;
-               }
-       }
-       else if ((int_T)mxGetPr(ssGetSFcnParam(S, PARAM_PORT_TYPE))[0] == PORT_GIOB) {
-               if (!rppValidParamRange(S, PARAM_PIN_NUMBER, 0, 7)) {
-                       return;
-               }
-       }
-       else if ((int_T)mxGetPr(ssGetSFcnParam(S, PARAM_PORT_TYPE))[0] == PORT_NHET1) {
-               if (!rppValidParamRange(S, PARAM_PIN_NUMBER, 0, 31)) {
-                       return;
-               }
-       }
-       else {
-               return;
-       }
+    if (!mxIsChar(ssGetSFcnParam(S, PARAM_PIN_NAME))) {
+        ssSetErrorStatus(S, "Parameter to S-function must be a string.");
+    }
 }
 #endif
 
 
-#ifdef MATLAB_MEX_FILE
-#define MDL_SET_WORK_WIDTHS
-static void mdlSetWorkWidths(SimStruct *S)
+#if defined(MATLAB_MEX_FILE)
+#define MDL_RTW
+static void mdlRTW(SimStruct *S)
 {
-       /* Set number of run-time parameters */
-       if (!ssSetNumRunTimeParams(S, PARAMS_COUNT)) {
-               return;
-       }
-       /* Register the run-time parameter 1 */
-       ssRegDlgParamAsRunTimeParam(S, PARAM_PORT_TYPE,      PARAM_PORT_TYPE,      PARAM_NAME_PORT_TYPE,      SS_INT8);
-       ssRegDlgParamAsRunTimeParam(S, PARAM_PIN_NUMBER,     PARAM_PIN_NUMBER,     PARAM_NAME_PIN_NUMBER,     SS_INT8);
-       ssRegDlgParamAsRunTimeParam(S, PARAM_INPUT_TYPE,     PARAM_INPUT_TYPE,     PARAM_NAME_INPUT_TYPE,     SS_INT8);
+    char_T pin_name[80];
+    int8_T pull_type = mxGetPr(ssGetSFcnParam(S, PARAM_INPUT_TYPE))[0];
+
+    if (mxGetString(ssGetSFcnParam(S, PARAM_PIN_NAME), pin_name, sizeof(pin_name)) != 0) {
+        ssSetErrorStatus(S,"mxGetString error in mdlRTW");
+        return;
+    }
+
+    if (!ssWriteRTWParamSettings(S, 2,
+                                 SSWRITE_VALUE_STR, "PinName", pin_name,
+                                 SSWRITE_VALUE_DTYPE_NUM, "PullType", &pull_type, DTINFO(SS_INT8, COMPLEX_NO))) {
+        ssSetErrorStatus(S, "ssWriteRTWParamSettings failed");
+    }
 }
-#endif
+#endif /* MDL_RTW */
+
 
 
 #define COMMON_MDLINITIALIZESAMPLETIMES_INHERIT
index b5ee09e73b7e8c3ae3748ab58ca7bc73a2354e17..3b62b3feb40cdfd6ed0bc1183d66d4980256bb08 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013, 2014 Czech Technical University in Prague
+/* Copyright (C) 2013, 2014, 2015 Czech Technical University in Prague
  *
  * Authors:
  *     - Carlos Jenkins <carlos@jenkins.co.cr>
@@ -33,31 +33,30 @@ Inputs:
 Outputs:
 
 Parameters:
-  - { name: "Port type", type: "Choice", range: "GIOA, GIOB, NHET1" }
-  - { name: "Pin number", type: "int8", range: "[0–7]", note: "(depends on selected port)" }
+  - { name: "Pin", type: "Choice", range: "Target dependent pin names or '---'" }
+  - { name: "Pin name", type: "String", note: "Pin name as defined in gio_def.h. This parameter is only visible if *Pin* is '---'." }
   - { name: "Initial output value", type: "uint8", range: "[0,1]" }
   - { name: "Output Type", type: "Choice", range: "Open Drain, Push/Pull" }
 
 # Description is in Markdown mark-up
 Description: &desc |
 
-  Writes a value to a GPIO pin. The block supports GIOA, GIOB and NHET1 ports.
-  Any pin can be configured as open drain or push/pull and initial output value
-  can be specified. The initial value is a value, which will appear on the pin
-  when the GPIO module is initialized and stays there until the first
-  block execution.
+  Sets a GIO pin to a given value. Which pins are supported depends on
+  the target board. Any pin can be configured as open drain or
+  push/pull and initial output value can be specified. The initial
+  value is a value, which will appear on the pin when the GPIO module
+  is initialized and stays there until the first block execution.
 
-  It is not allowed to write to one pin by using more then one GIOOUT blocks.
-  It is not allowed to use GIOOUT and DIN blocks on one GPIO pin.
+  When the pin is used in multiple GIOIN or GIOOUT blocks, an error is
+  signaled.
 
 Help: *desc
 
 Status: Stable
 
 RPP API functions used:
-  - hal_gpio_pin_get_dsc
-  - hal_gpio_pin_set_value
-  - hal_gpio_pin_conf_set
+  - rpp_gio_setup
+  - rpp_gio_set
 
 Relevant demos:
   - gio_demo
@@ -75,20 +74,12 @@ Relevant demos:
 
 /** Identifiers of the block parameters */
 enum params{
-       PARAM_PORT_TYPE,
-       PARAM_PIN_NUMBER,
+       PARAM_PIN_NAME,
        PARAM_DEFAULT_OUTPUT,
        PARAM_OUTPUT_TYPE,
        PARAMS_COUNT
 };
 
-enum port_types{
-       PORT_UNKNOWN,
-       PORT_GIOA,
-       PORT_GIOB,
-       PORT_NHET1
-};
-
 enum inputs{
        IN_PIN_VALUE,
        INPUTS_COUNT
@@ -96,13 +87,6 @@ enum inputs{
 
 static void mdlInitializeSizes(SimStruct *S)
 {
-       /*
-       * Configure parameters: 4
-       *  - Port type
-       *  - Pin number
-       *  - Default output value
-       *  - Output type
-       */
        if (!rppSetNumParams(S, PARAMS_COUNT)) {
                return;
        }
@@ -132,47 +116,37 @@ static void mdlInitializeSizes(SimStruct *S)
 #define MDL_CHECK_PARAMETERS
 static void mdlCheckParameters(SimStruct *S)
 {
-       if ((int_T)mxGetPr(ssGetSFcnParam(S, PARAM_PORT_TYPE))[0] == PORT_GIOA) {
-               if (!rppValidParamRange(S, PARAM_PIN_NUMBER, 0, 7)) {
-                       return;
-               }
-       }
-       else if ((int_T)mxGetPr(ssGetSFcnParam(S, PARAM_PORT_TYPE))[0] == PORT_GIOB) {
-               if (!rppValidParamRange(S, PARAM_PIN_NUMBER, 0, 7)) {
-                       return;
-               }
-       }
-       else if ((int_T)mxGetPr(ssGetSFcnParam(S, PARAM_PORT_TYPE))[0] == PORT_NHET1) {
-               if (!rppValidParamRange(S, PARAM_PIN_NUMBER, 0, 31)) {
-                       return;
-               }
-       }
-       else {
-               return;
-       }
-
+    if (!mxIsChar(ssGetSFcnParam(S, PARAM_PIN_NAME))) {
+        ssSetErrorStatus(S, "Parameter to S-function must be a string.");
+    }
        if (!rppValidParamRange(S, PARAM_DEFAULT_OUTPUT, 0, 1)) {
                return;
        }
 }
 #endif
 
-
-#ifdef MATLAB_MEX_FILE
-#define MDL_SET_WORK_WIDTHS
-static void mdlSetWorkWidths(SimStruct *S)
+#if defined(MATLAB_MEX_FILE)
+#define MDL_RTW
+static void mdlRTW(SimStruct *S)
 {
-       /* Set number of run-time parameters */
-       if (!ssSetNumRunTimeParams(S, PARAMS_COUNT)) {
-               return;
-       }
-       /* Register the run-time parameter 1 */
-       ssRegDlgParamAsRunTimeParam(S, PARAM_PORT_TYPE,      PARAM_PORT_TYPE,      PARAM_NAME_PORT_TYPE,      SS_INT8);
-       ssRegDlgParamAsRunTimeParam(S, PARAM_PIN_NUMBER,     PARAM_PIN_NUMBER,     PARAM_NAME_PIN_NUMBER,     SS_INT8);
-       ssRegDlgParamAsRunTimeParam(S, PARAM_DEFAULT_OUTPUT, PARAM_DEFAULT_OUTPUT, PARAM_NAME_DEFAULT_OUTPUT, SS_BOOLEAN);
-       ssRegDlgParamAsRunTimeParam(S, PARAM_OUTPUT_TYPE,    PARAM_OUTPUT_TYPE,    PARAM_NAME_OUTPUT_TYPE,    SS_INT8);
+    char_T pin_name[80];
+    int8_T def_out = mxGetPr(ssGetSFcnParam(S, PARAM_DEFAULT_OUTPUT))[0];
+    int8_T out_type = mxGetPr(ssGetSFcnParam(S, PARAM_OUTPUT_TYPE))[0];
+
+    if (mxGetString(ssGetSFcnParam(S, PARAM_PIN_NAME), pin_name, sizeof(pin_name)) != 0) {
+        ssSetErrorStatus(S,"mxGetString error in mdlRTW");
+        return;
+    }
+
+    if (!ssWriteRTWParamSettings(S, 3,
+                                 SSWRITE_VALUE_STR, "PinName", pin_name,
+                                 SSWRITE_VALUE_DTYPE_NUM, "DefOut", &def_out, DTINFO(SS_INT8, COMPLEX_NO),
+                                 SSWRITE_VALUE_DTYPE_NUM, "OutType", &out_type, DTINFO(SS_INT8, COMPLEX_NO))) {
+        ssSetErrorStatus(S, "ssWriteRTWParamSettings failed");
+    }
 }
-#endif
+#endif /* MDL_RTW */
+
 
 
 #define COMMON_MDLINITIALIZESAMPLETIMES_INHERIT
index 2229578c4d24f3bf0a972077a46032dcf4cd1a63..7190fd8bc3083a48839a49b988b95fae200571b2 100644 (file)
 %endfunction
 
 %function BlockInstanceSetup(block, system) void
-       %assign port_par = LibBlockParameterValue(port_type, 0)
-       %assign pin_number_par = LibBlockParameterValue(pin_number, 0)
+    %assign pin_name = SFcnParamSettings.PinName
 
        %% Ensure that every pin is configured only once
-       %if EXISTS("::rpp_gio_%<port_par>_%<pin_number_par>_present") == 0
-               %assign ::rpp_gio_%<port_par>_%<pin_number_par>_present = 1
+       %if EXISTS("::rpp_gio_%<pin_name>_present") == 0
+               %assign ::rpp_gio_%<pin_name>_present = 1
        %else
-               %<LibBlockReportError(block, "GIO pin %<pin_number_par> on port %<port_par> has already been configured.")>
+               %<LibBlockReportError(block, "GIO pin %<pin_name> has already been configured.")>
        %endif
 %endfunction
 
 %% Function: Start =============================================================
 %function Start(block, system) Output
-       %assign port_par = LibBlockParameterValue(port_type, 0)
-       %assign pin_number_par = LibBlockParameterValue(pin_number, 0)
-       %assign config = LibBlockParameterValue(input_type, 0)
+    %assign pin_name = SFcnParamSettings.PinName
+    %assign pull_type   = SFcnParamSettings.PullType
 
        %if !SLibCodeGenForSim()
-               %if port_par == 1       %% GIOA
-            %assign pin = "PIN_GIOA%<pin_number_par>"
-               %elseif port_par == 2   %% GIOB
-                       %assign pin = "PIN_GIOB%<pin_number_par>"
-               %elseif port_par == 3   %% NHET1
-                       %assign pin = "PIN_NHET1%<pin_number_par>"
-               %else
-                       %<LibBlockReportError(block, "Bad port identifier: %<port_par>")>
-               %endif
-
-               %if config == 1         %% Tri-state
-            rpp_gio_setup(%<pin>, RPP_GIO_IN, RPP_GIO_MODE_PULLDIS, FALSE);
-               %elseif config == 2     %% Pull up
-            rpp_gio_setup(%<pin>, RPP_GIO_IN, RPP_GIO_MODE_PULLUP, FALSE);
-               %elseif config == 3     %% Pull down
-            rpp_gio_setup(%<pin>, RPP_GIO_IN, RPP_GIO_MODE_PULLDOWN, FALSE);
+               %if pull_type == 1              %% Tri-state
+            rpp_gio_setup(PIN_%<pin_name>, RPP_GIO_IN, RPP_GIO_MODE_PULLDIS, FALSE);
+               %elseif pull_type == 2  %% Pull up
+            rpp_gio_setup(PIN_%<pin_name>, RPP_GIO_IN, RPP_GIO_MODE_PULLUP, FALSE);
+               %elseif pull_type == 3  %% Pull down
+            rpp_gio_setup(PIN_%<pin_name>, RPP_GIO_IN, RPP_GIO_MODE_PULLDOWN, FALSE);
                %else   %% error
-                       %<LibBlockReportError(block, "Bad configuration value: %<config>")>
+                       %<LibBlockReportError(block, "Bad pull_type value: %<pull_type>")>
                %endif
        %endif
 
 
        %if !SLibCodeGenForSim()
                %assign digital_in = LibBlockOutputSignal(0, "", "", 0)
-               %assign port_par = LibBlockParameterValue(port_type, 0)
-               %assign pin_number_par = LibBlockParameterValue(pin_number, 0)
-               %if port_par == 1       %% GIOA
-                       %assign pin = "PIN_GIOA%<pin_number_par>"
-               %elseif port_par == 2   %% GIOB
-                       %assign pin = "PIN_GIOB%<pin_number_par>"
-               %elseif port_par == 3   %% NHET1
-                       %assign pin = "PIN_NHET1%<pin_number_par>"
-               %else
-                       %<LibBlockReportError(block, "Bad port identifier: %<port_par>")>
-               %endif
+        %assign pin_name = SFcnParamSettings.PinName
         /% TODO: Handle FAILURE (add error output?) %/
-               %<digital_in> = rpp_gio_get(%<pin>) ? TRUE : FALSE;
+               %<digital_in> = rpp_gio_get(PIN_%<pin_name>) ? TRUE : FALSE;
        %endif
 
 %endfunction
index 14f2caaa563f6bf3b48d12ac71a88dfe27cd1ddf..dcee298db47cbf573befaa3cdb1d4d652f45e11a 100644 (file)
 %endfunction
 
 %function BlockInstanceSetup(block, system) void
-       %assign port_par = LibBlockParameterValue(port_type, 0)
-       %assign pin_number_par = LibBlockParameterValue(pin_number, 0)
+    %assign pin_name = SFcnParamSettings.PinName
 
        %% Ensure that every pin is configured only once
-       %if EXISTS("::rpp_gio_%<port_par>_%<pin_number_par>_present") == 0
-               %assign ::rpp_gio_%<port_par>_%<pin_number_par>_present = 1
+       %if EXISTS("::rpp_gio_%<pin_name>_present") == 0
+               %assign ::rpp_gio_%<pin_name>_present = 1
        %else
-               %<LibBlockReportError(block, "GIO pin %<pin_number_par> on port %<port_par> has already been configred.")>
+               %<LibBlockReportError(block, "GIO pin %<pin_name> has already been configured.")>
        %endif
 %endfunction
 
 %% Function: Start =============================================================
 %function Start(block, system) Output
-       %assign port_par = LibBlockParameterValue(port_type, 0)
-       %assign pin_number_par = LibBlockParameterValue(pin_number, 0)
-       %assign config = LibBlockParameterValue(output_type, 0)
-       %assign init_val = LibBlockParameterValue(default_output, 0)
+    %assign pin_name = SFcnParamSettings.PinName
+       %assign config = SFcnParamSettings.OutType
+       %assign init_val = SFcnParamSettings.DefOut
 
        %if !SLibCodeGenForSim()
-               %if port_par == 1       %% GIOA
-                       %assign pin = "PIN_GIOA%<pin_number_par>"
-               %elseif port_par == 2   %% GIOB
-                       %assign pin = "PIN_GIOB%<pin_number_par>"
-               %elseif port_par == 3   %% NHET1
-                       %assign pin = "PIN_NHET1%<pin_number_par>"
-               %else
-                       %<LibBlockReportError(block, "Bad port identifier: %<port_par>")>
-               %endif
-
                %if config == 1         %% Open drain
-            rpp_gio_setup(%<pin>, RPP_GIO_OUT, RPP_GIO_MODE_PULLDIS, TRUE);
+            rpp_gio_setup(PIN_%<pin_name>, RPP_GIO_OUT, RPP_GIO_MODE_PULLDIS, TRUE);
                %elseif config == 2     %% push/pull
-            rpp_gio_setup(%<pin>, RPP_GIO_OUT, RPP_GIO_MODE_PULLDIS, FALSE);
+            rpp_gio_setup(PIN_%<pin_name>, RPP_GIO_OUT, RPP_GIO_MODE_PULLDIS, FALSE);
                %else   %% error
                        %<LibBlockReportError(block, "Bad configuration value: %<config>")>
                %endif
                %if init_val == 0
-                       rpp_gio_set(%<pin>, FALSE);
+                       rpp_gio_set(PIN_%<pin_name>, FALSE);
                %elseif init_val == 1
-                       rpp_gio_set(%<pin>, TRUE);
+                       rpp_gio_set(PIN_%<pin_name>, TRUE);
                %else
                        %<LibBlockReportError(block, "Bad init output value: %<init_val>")>
                %endif
 
 %% Function: Outputs ===========================================================
 %function Outputs(block, system) Output
-
-       %if !SLibCodeGenForSim()
-               %assign digital_out = LibBlockInputSignal(0, "", "", 0)
-               %assign port_par = LibBlockParameterValue(port_type, 0)
-               %assign pin_number_par = LibBlockParameterValue(pin_number, 0)
-
-               %if port_par == 1       %% GIOA
-                       %assign pin = "PIN_GIOA%<pin_number_par>"
-               %elseif port_par == 2   %% GIOB
-                       %assign pin = "PIN_GIOB%<pin_number_par>"
-               %elseif port_par == 3   %% NHET1
-                       %assign pin = "PIN_NHET1%<pin_number_par>"
-               %else
-                       %<LibBlockReportError(block, "Bad port identifier: %<port_par>")>
-               %endif
-
-               rpp_gio_set(%<pin>, %<digital_out>);
-       %endif
-
+  %if !SLibCodeGenForSim()
+    %assign pin_name = SFcnParamSettings.PinName
+    %assign digital_out = LibBlockInputSignal(0, "", "", 0)
+    rpp_gio_set(PIN_%<pin_name>, %<digital_out>);
+  %endif
 %endfunction
 
 %% [EOF]
diff --git a/rpp/lib b/rpp/lib
index b9c14221d9d95c415ea02c0ba34dbf87d90ddbaf..87cafbf47799a5aefe54edf0a7ec5d9fa9fba22f 160000 (submodule)
--- a/rpp/lib
+++ b/rpp/lib
@@ -1 +1 @@
-Subproject commit b9c14221d9d95c415ea02c0ba34dbf87d90ddbaf
+Subproject commit 87cafbf47799a5aefe54edf0a7ec5d9fa9fba22f
index 2271c53046d507df3562f9fb2e1851143c0b1f75..e402b48300e24aa615d420e81179729f07f0d84f 100644 (file)
@@ -94,6 +94,7 @@ function rpp_setup(varargin)
     % Generate blocks and library
     cd('../blocks');
     compile_blocks();
+    rpp_update_blocks_for_target()
     rpp_generate_lib();
     cd(currentPath);