* Authors:
* - Carlos Jenkins <carlos@jenkins.co.cr>
*
- * 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.
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*
* File : sfunction_din.c
* Abstract:
- { name: "ErrFlag", type: "bool" }
Parameters:
- - { name: "Pin number [0-15]", type: "uint8" }
+ - { name: "Pin number", type: "uint8", range: "[0-15]" }
- { name: "Use variable threshold", type: "bool" }
- { name: "Pull", type: "Choice from Pull-down or Pull-up" }
- { name: "Active", type: "Choice from Active or Tri-stated" }
# Description and Help is in Markdown mark-up
-Description: &desc |
+Description: |
+
+ Gets the digital value of the specified digital input pin on the RPP board.
+
+ If pin is high the output is 1, 0 if the pin is low.
+
+ If an error is detected while getting the pin, the ErrFlag is set high.
+
+Help: |
This block allows to read the digital inputs on the RPP board. For pins number 0-7 is not
relevant and not visible parameter 'Use variable threshold' and only one block for each pin
can be in model. And oppositely for other pins (8-15) are not relevant and visible parameters
- of names 'Pull' and 'Active'. The variable threshold check change the read mode of the pin. For
- setting it see Digital Input Configure block.
- The ErrFlag should raise if `rpp_din_update()` or `rpp_din_get()` returns error. `rpp_din_update()`
- is called just by the first DIN block in the model and thus only the first block could raise the
- flag because of this. In case an errors occurs the return value will always be LOW (0). Because the
- ErrFlag should never set, once set the following steps will never clear it back.
+ of names 'Pull' and 'Active'. The variable threshold check change the read mode of the pin. For
+ setting it see Digital Input Configure block.
-Help: *desc
+ The ErrFlag should raise if `rpp_din_update()` or `rpp_din_get()` returns error. `rpp_din_update()`
+ is called just by the first DIN block in the model and thus only the first block could raise the
+ flag because of this. In case an errors occurs the return value will always be LOW (0). Because the
+ ErrFlag should never set, once set the following steps will never clear it back.
-Status:
- Tested:
- - Changing the pin.
- - Compilation and general use.
- - Using variable threshold.
- Untested:
- - Faulty situation for the ErrFlag to set.
- Not working:
+Status: Stable
RPP API functions used:
- rpp_din_setup()
if (!rppValidParamBoolean(S, 1)) {
return;
}
-
+
/* Check the parameter 3 */
if (!rppValidParamRange(S, 2, 0, 2)) {
return;
}
-
+
/* Check the parameter 4 */
if (!rppValidParamRange(S, 3, 0, 2)) {
return;
/* Register the run-time parameter 2 */
ssRegDlgParamAsRunTimeParam(S, 1, 1, "p2", SS_BOOLEAN);
-
+
/* Register the run-time parameter 3 */
ssRegDlgParamAsRunTimeParam(S, 2, 2, "p3", SS_UINT8);
-
+
/* Register the run-time parameter 4 */
ssRegDlgParamAsRunTimeParam(S, 3, 3, "p4", SS_UINT8);
}