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_irc.c
13 * C-MEX S-function block for RPP IRC input.
20 * <matlabroot>/bin/mex sfunction_irc.c
34 - { name: "IRC value", type: "int32" }
35 - { name: "ErrFlag", type: "bool" }
38 - { name: "IRC number [1-2]", type: "uint8" }
40 # Description and Help is in Markdown mark-up
43 This block allows to read a value of an IRC sensors. Two
44 configurations are supported: IRC is connected to pins DIN10 and DIN11
45 and/or pins DIN14 and DIN15. The ErrFlag output raises if an error is
46 detected, which should normally not happen.
52 RPP API functions used:
62 #define S_FUNCTION_NAME sfunction_irc
66 static void mdlInitializeSizes(SimStruct *S)
69 * Configure parameters: 1
72 if (!rppSetNumParams(S, 1)) {
77 * Configure input ports: 0
79 if (!ssSetNumInputPorts(S, 0)) {
84 * Configure output ports: 2
88 if (!ssSetNumOutputPorts(S, 2)) {
91 rppAddOutputPort(S, 0, SS_INT32);
92 rppAddOutputPort(S, 1, SS_BOOLEAN);
94 /* Set standard options for this block */
95 rppSetStandardOptions(S);
99 #ifdef MATLAB_MEX_FILE
100 #define MDL_CHECK_PARAMETERS
101 static void mdlCheckParameters(SimStruct *S)
103 /* Check the parameter 1 */
104 if (!rppValidParamRange(S, 0, 1, 2)) {
111 #ifdef MATLAB_MEX_FILE
112 #define MDL_SET_WORK_WIDTHS
113 static void mdlSetWorkWidths(SimStruct *S)
115 /* Set number of run-time parameters */
116 if (!ssSetNumRunTimeParams(S, 1)) {
120 /* Register the run-time parameter 1 */
121 ssRegDlgParamAsRunTimeParam(S, 0, 0, "p1", SS_UINT8);
126 #define COMMON_MDLINITIALIZESAMPLETIMES_INHERIT
127 #define UNUSED_MDLOUTPUTS
128 #define UNUSED_MDLTERMINATE