]> rtime.felk.cvut.cz Git - pes-rpp/rpp-simulink.git/commitdiff
Finished to implement Simulink masks for all S-Functions. Also added printf format...
authorCarlos Jenkins <carlos@jenkins.co.cr>
Thu, 13 Jun 2013 23:00:08 +0000 (01:00 +0200)
committerCarlos Jenkins <carlos@jenkins.co.cr>
Thu, 13 Jun 2013 23:00:08 +0000 (01:00 +0200)
rpp/blocks/README.txt
rpp/blocks/rpp_lib.slx
rpp/blocks/sfunction_scis.c
rpp/blocks/sfunction_sdrw.c

index 5f00e7ce33bfdc3ad84e8018bb245415ea9ede2e..694021789e105dfe790a1120c576a669655375bf 100644 (file)
@@ -15,13 +15,13 @@ The blocks ideally included in this library are:
 
     Logic IO blocks
                 Digital Input block         I           [DIN ]      rpp_din.h
-                Digital Output block        I           [LOUT]      rpp_lout.h
+                Digital Output block        T           [LOUT]      rpp_lout.h
                 Analog Input block          I           [AIN ]      rpp_ain.h
                 Analog Output block         I           [AOUT]      rpp_aout.h
 
     Power output blocks
-                H-Bridge output block       W           [HBR ]      rpp_hbr.h
-                Power output block          W           [MOUT]      rpp_mout.h
+                H-Bridge Control block      I           [HBR ]      rpp_hbr.h
+                Power output block          I           [MOUT]      rpp_mout.h
                 High-Power output block     X           [HOUT]      rpp_hout.h
 
     Communication blocks
@@ -38,7 +38,7 @@ The blocks ideally included in this library are:
                 Ethernet send msg block     X           [ETHS]      - Idem -
 
     Logging/Storage blocks
-                SD Card write block         X           [SDCW]      rpp_sdc.h
+                SD Card write block         I           [SDCW]      rpp_sdc.h
                 SDRAM write block           X           [SDRW]      rpp_sdr.h
 
     Trigger blocks
@@ -198,9 +198,9 @@ The following are the currently specified Simulink blocks.
         uint8   Pin number [1-4]
 
 
-[HBR] H-Bridge Output block ====================================================
+[HBR] H-Bridge Control block ===================================================
     Inputs      : 1
-        double  Sense
+        double  Control
 
     Outputs     : 1
         bool    ErrFlag
@@ -209,7 +209,7 @@ The following are the currently specified Simulink blocks.
         None
 
 
-[MOUT] Power Output ============================================================
+[MOUT] Power Output block ======================================================
     Inputs      : 1
         bool    Power Output
 
@@ -262,7 +262,7 @@ The following are the currently specified Simulink blocks.
     Outputs     : 1
         bool    ErrFlag
 
-    Parameters  : 1
+    Parameters  : 2
         bool    UsePrintf
         string  PrintFormat [SETTING]
 
@@ -285,6 +285,6 @@ The following are the currently specified Simulink blocks.
     Outputs     : 1
         bool    ErrFlag
 
-    Parameters  : 1
+    Parameters  : 2
         uint8   Block ID
-
+        string  PrintFormat [SETTING]
index de27a3deb088b2d85ce5dd58de24b586903db308..f862faddf2f497ddbd16b99de0dfa18c844691c9 100644 (file)
Binary files a/rpp/blocks/rpp_lib.slx and b/rpp/blocks/rpp_lib.slx differ
index 8ab2fdebe6a1eac7ada93e8d794a342c3fb1e076..a35e05105050d36cb6481d3d02ad5c8da7b5659a 100644 (file)
@@ -38,7 +38,7 @@ static void mdlInitializeSizes(SimStruct *S)
     /*
      * Configure parameters: 1
      *  - Use printf.
-     *  - Printf format [not runtime].
+     *  - Printf format [setting].
      */
     if(!rppSetNumParams(S, 2)) {
         return;
index 72b849dce46a8a62c5bc812df499f4f7c15f7a56..a99cce8085b40376cd79f535f73474fa008b3fd1 100644 (file)
 static void mdlInitializeSizes(SimStruct *S)
 {
     /*
-     * Configure parameters: 1
+     * Configure parameters: 2
      *  - Block ID.
+     *  - Printf format [setting].
      */
-    if(!rppSetNumParams(S, 1)) {
+    if(!rppSetNumParams(S, 2)) {
         return;
     }
 
@@ -93,6 +94,22 @@ static void mdlSetWorkWidths(SimStruct *S)
 #endif
 
 
+#ifdef MATLAB_MEX_FILE
+#define MDL_RTW
+static void mdlRTW(SimStruct* S)
+{
+    /* Register parameter 2 as a parameter setting */
+    static char_T str[128];
+    mxGetString(ssGetSFcnParam(S, 1), (char*)&str, sizeof(str)); // Get string
+    if(!ssWriteRTWParamSettings(S, 1,
+            SSWRITE_VALUE_QSTR, "PrintfFormat", (const char_T*)&str)) {
+        // An error ocurred
+        return;
+    }
+}
+#endif
+
+
 #define COMMON_MDLINITIALIZESAMPLETIMES_INHERIT
 #define UNUSED_MDLOUTPUTS
 #define UNUSED_MDLTERMINATE