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 Reference Voltage Configuration
36 - { name: "Reference voltage for pins 8-11", type: "uint16", range: "[0-4095]" }
37 - { name: "Reference voltage for pins 12-15", type: "uint16", range: "[0-4095]" }
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 RPP API functions used:
56 #define S_FUNCTION_NAME sfunction_dinc
60 static void mdlInitializeSizes(SimStruct *S)
63 * Configure parameters: 2
64 * - Reference voltage for pins 8-11: [0-4095]
65 * - Reference voltage for pins 12-15: [0-4095]
67 if (!rppSetNumParams(S, 2)) {
72 * Configure input ports: 0
74 if (!ssSetNumInputPorts(S, 0)) {
79 * Configure output ports: 0
81 if (!ssSetNumOutputPorts(S, 0)) {
85 /* Set standard options for this block */
86 rppSetStandardOptions(S);
90 #ifdef MATLAB_MEX_FILE
91 #define MDL_CHECK_PARAMETERS
92 static void mdlCheckParameters(SimStruct *S)
94 /* Check the parameter 1 */
95 if (!rppValidParamRange(S, 0, 0, 4095)) {
99 /* Check the parameter 2 */
100 if (!rppValidParamRange(S, 1, 0, 4095)) {
107 #ifdef MATLAB_MEX_FILE
108 #define MDL_SET_WORK_WIDTHS
109 static void mdlSetWorkWidths(SimStruct *S)
111 /* Set number of run-time parameters */
112 if (!ssSetNumRunTimeParams(S, 2)) {
116 /* Register the run-time parameter 1 */
117 ssRegDlgParamAsRunTimeParam(S, 0, 0, "p1", SS_UINT16);
118 ssRegDlgParamAsRunTimeParam(S, 1, 1, "p2", SS_UINT16);
123 #define COMMON_MDLINITIALIZESAMPLETIMES_INHERIT
124 #define UNUSED_MDLOUTPUTS
125 #define UNUSED_MDLTERMINATE