]> rtime.felk.cvut.cz Git - jenkicar/rpp-simulink.git/commitdiff
Fixed one small bug on library, added documentation for a known bug on rpp_aout_updat...
authorCarlos Jenkins <carlos@jenkins.co.cr>
Fri, 14 Jun 2013 16:15:22 +0000 (18:15 +0200)
committerCarlos Jenkins <carlos@jenkins.co.cr>
Fri, 14 Jun 2013 16:15:22 +0000 (18:15 +0200)
rpp/blocks/rpp_lib.slx
rpp/blocks/sfunction_aout.c
rpp/blocks/tlc_c/sfunction_aout.tlc
rpp/demos/analog_passthrough.slx [new file with mode: 0644]
rpp/lib/rpp-lib.lib
rpp/lib/rpp/include/rpp/aout.h
rpp/lib/rpp/src/rpp/aout.c

index c681503503446e2c6bbd672db28d5984bbbfe35e..6ebba9760c5b80214f58e08553e952fd8d62eb20 100644 (file)
Binary files a/rpp/blocks/rpp_lib.slx and b/rpp/blocks/rpp_lib.slx differ
index a7bbc0ef2c1cd4a504fb27016c12b27e697afa9c..53886c7be758a2e903f8a6145ee7b51399f1dba8 100644 (file)
@@ -89,7 +89,7 @@ static void mdlCheckParameters(SimStruct *S)
 static void mdlSetWorkWidths(SimStruct *S)
 {
     /* Set number of run-time parameters */
-    if(!ssSetNumRunTimeParams(S, 1)) {
+    if(!ssSetNumRunTimeParams(S, 2)) {
         return;
     }
 
index 86876b4e3a22be8a514d5ed1532175ec41e80aff..7f454596050454887a47a3893e1d66b5b2ce71e8 100644 (file)
         %assign pin_num = LibBlockParameterValue(p1, 0)
         rpp_aout_setup(%<pin_num>, TRUE);
         rpp_aout_set(%<pin_num>, 0);
-        rpp_aout_update();
+        /*
+         * Warning! This should be the correct way to initialize AOUT.
+         * Nevertheless rpp_aout_update() has a known bug that if it is called
+         * before starting the FreeRTOS Scheduler the application will freeze.
+         * Check the RPP API documentation for more information.
+         * Not updating now is harmless though.
+         */
+        /* rpp_aout_update(); */
     %endif
 
 %endfunction
diff --git a/rpp/demos/analog_passthrough.slx b/rpp/demos/analog_passthrough.slx
new file mode 100644 (file)
index 0000000..5bc97d2
Binary files /dev/null and b/rpp/demos/analog_passthrough.slx differ
index 7203fda27b8aed26534ba5e57691612252967875..ab0437ba195db53a4a461e754090bb9bddfe2876 100644 (file)
Binary files a/rpp/lib/rpp-lib.lib and b/rpp/lib/rpp-lib.lib differ
index c5cfbb4ea2d7a3eca1e9fe963a560c01aec85617..4f86d05c5624fc2583bf1b37a329f24ccd9193a6 100644 (file)
@@ -69,7 +69,7 @@ int8_t rpp_aout_set(uint8_t pin, uint16_t val);
 /**
  * Set output to given voltage.
  *
- * Helper functions that calculates DAC value given a voltage in millivolts.
+ * Helper function that calculates DAC value given a voltage in millivolts.
  *
  * @param[in] pin       The pin number to set [1-4].
  * @param[in] mv        Voltage level in mV to be set on specified pin [0-12000].
@@ -82,7 +82,13 @@ int8_t rpp_aout_set_voltage(uint8_t pin, uint16_t mv);
 
 
 /**
- * Flush cached output values.
+ * Flush cached output values and configuration changes.
+ *
+ * @bug This function should be called only after the FreeRTOS Scheduler has
+ * started (which implies from a FreeRTOS Task). If called before starting the
+ * scheduler, like for library initialization, or application DAC
+ * initialization, the application will freeze. The cause of this is unknown at
+ * the moment.
  *
  * @return SUCCESS when transaction was successful.\n
  *         FAILURE if transaction could not be confirmed.
index 24ab4be5f5d0bfe9e0a9b445b90237911e30353d..b480cec3e7d3ceddc30946472ef95ec45e9056ee 100644 (file)
@@ -105,9 +105,8 @@ int8_t rpp_aout_set(uint8_t pin, uint16_t val)
     // Map value
     val = map(val, 0, 4095, 0, dac_top);
 
-
     // Check value range
-    if(pin > 4095) {
+    if(val > 4095) {
         return -2;
     }