1 /* Copyright (C) 2013-2014 Czech Technical University in Prague
6 * This document contains proprietary information belonging to Czech
7 * Technical University in Prague. Passing on and copying of this
8 * document, and communication of its contents is not permitted
9 * without prior written authorization.
11 * File : sfunction_dinc.c
13 * C-MEX S-function block for RPP digital input configuration.
20 * <matlabroot>/bin/mex sfunction_dinc.c
26 Name: Digital Input Configure
36 - { name: "Reference voltage for pins 8-11 [0-4095]", type: "uint16" }
37 - { name: "Reference voltage for pins 12-15 [0-4095]", type: "uint16" }
39 # Description and Help is in Markdown mark-up
42 This block allows one to set reference voltage (threshold) for DIN pins. The block have two parameters,
43 one for pins 8 - 11 and the other for pins 12 - 15.
49 - Changing reference voltage.
50 - Compilation and general use.
52 - Using more than one block in a model.
55 RPP API functions used:
62 #define S_FUNCTION_NAME sfunction_dinc
66 static void mdlInitializeSizes(SimStruct *S)
69 * Configure parameters: 2
70 * - Reference voltage for pins 8-11: [0-4095]
71 * - Reference voltage for pins 12-15: [0-4095]
73 if (!rppSetNumParams(S, 2)) {
78 * Configure input ports: 0
80 if (!ssSetNumInputPorts(S, 0)) {
85 * Configure output ports: 0
87 if (!ssSetNumOutputPorts(S, 0)) {
91 /* Set standard options for this block */
92 rppSetStandardOptions(S);
96 #ifdef MATLAB_MEX_FILE
97 #define MDL_CHECK_PARAMETERS
98 static void mdlCheckParameters(SimStruct *S)
100 /* Check the parameter 1 */
101 if (!rppValidParamRange(S, 0, 0, 4095)) {
105 /* Check the parameter 2 */
106 if (!rppValidParamRange(S, 1, 0, 4095)) {
113 #ifdef MATLAB_MEX_FILE
114 #define MDL_SET_WORK_WIDTHS
115 static void mdlSetWorkWidths(SimStruct *S)
117 /* Set number of run-time parameters */
118 if (!ssSetNumRunTimeParams(S, 2)) {
122 /* Register the run-time parameter 1 */
123 ssRegDlgParamAsRunTimeParam(S, 0, 0, "p1", SS_UINT16);
124 ssRegDlgParamAsRunTimeParam(S, 1, 1, "p2", SS_UINT16);
129 #define COMMON_MDLINITIALIZESAMPLETIMES_INHERIT
130 #define UNUSED_MDLOUTPUTS
131 #define UNUSED_MDLTERMINATE