]> rtime.felk.cvut.cz Git - jenkicar/rpp-simulink.git/commitdiff
Implemented common TLC function based on new RPP API.
authorCarlos Miguel Jenkins Pérez <carlos@jenkins.co.cr>
Sun, 19 May 2013 15:22:19 +0000 (17:22 +0200)
committerCarlos Miguel Jenkins Pérez <carlos@jenkins.co.cr>
Sun, 19 May 2013 15:22:19 +0000 (17:22 +0200)
rpp/blocks/tlc_c/common.tlc
rpp/blocks/tlc_c/sfunction_gpio_write.tlc

index 3b48ba9391f25983aeaf1cf56983ccf40a7f4c9a..b0d945270b48bc2d60f5ed068a5573cfdbf812ab 100644 (file)
 %endfunction
 
 
-%function ArduinoCommonBlockTypeSetup(block, system) void
+%function RppCommonBlockTypeSetup(block, system) void
 
     %if EXISTS("_DONE_COMMON_BLOCK_TYPE_SETUP_") == 0
         %assign _DONE_COMMON_BLOCK_TYPE_SETUP_ = 1
 
         %if !SLibCodeGenForSim()
 
-            %%<LibAddToCommonIncludes("common.h")>
-            %%<LibAddToCommonIncludes("anothercommon.h")>
+            %<LibAddToCommonIncludes("rpp.h")>
 
         %endif
     %endif
 
 %endfunction
+
+
+%function RppCommonStart(block, system) void
+
+    %if EXISTS("_DONE_COMMON_START_") == 0
+        %assign _DONE_COMMON_START_ = 1
+
+        %if !SLibCodeGenForSim()
+
+            /* Initialize RPP board */
+            rpp_init();
+
+        %endif
+    %endif
+
+%endfunction
+
index e2e82738ea9ebada37b388422c72f82f46719951..7a26dbd6e677eadf8e0269377cade68bf2d842a9 100644 (file)
@@ -39,7 +39,7 @@
 %function BlockTypeSetup(block, system) void
 
     %% Ensure required header files are included
-    %%<LibAddToCommonIncludes("somegpioheader.h")>
+    %<RppCommonBlockTypeSetup(block, system)>
 
 %endfunction
 
 %function Start(block, system) Output
 
     %if !SLibCodeGenForSim()
-        /* %<Type> (%<ParamSettings.FunctionName>): %<Name> */
-        dmmInit();
-        gioInit();
-        %assign p1_val = LibBlockParameter(p1, "", "", 0)
-        //pinMode(%<p1_val>, OUTPUT);
+        %%/* %<Type> (%<ParamSettings.FunctionName>): %<Name> */
+        %<RppCommonStart(block, system)>
+        %%assign p1_val = LibBlockParameter(p1, "", "", 0)
+        %%//pinMode(%<p1_val>, OUTPUT);
     %endif
 
 %endfunction