1 /* Copyright (C) 2013, 2014 Czech Technical University in Prague
4 * - Carlos Jenkins <carlos@jenkins.co.cr>
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_scir.c
13 * C-MEX S-function block for RPP Serial Communication receive.
20 * <matlabroot>/bin/mex sfunction_scir.c
27 Category: Communication
34 - { name: "Data", type: "uint8" }
35 - { name: "ErrFlag", type: "bool" }
39 # Description and Help is in Markdown mark-up
42 This block receives a byte from the SCI by calling
43 `rpp_sci_read_nb()`. The ErrFlag raises if the call returns an
44 error. The behavior of the ErrFlag is different from others blocks
45 in that this block will set or clear the flag in each step depending
46 on the result. Note that this block uses a non-blocking function to
47 read the SCI and thus it will work even if nothing is received.
53 RPP API functions used:
62 #define S_FUNCTION_NAME sfunction_scir
66 static void mdlInitializeSizes(SimStruct *S)
69 * Configure parameters: 0
71 if (!rppSetNumParams(S, 0)) {
76 * Configure input ports: 0
78 if (!ssSetNumInputPorts(S, 0)) {
83 * Configure output ports: 2
87 if (!ssSetNumOutputPorts(S, 2)) {
90 rppAddOutputPort(S, 0, SS_INT16);
91 rppAddOutputPort(S, 1, SS_BOOLEAN);
93 /* Set standard options for this block */
94 rppSetStandardOptions(S);
98 #define COMMON_MDLINITIALIZESAMPLETIMES_INHERIT
99 #define UNUSED_MDLCHECKPARAMETERS
100 #define UNUSED_MDLOUTPUTS
101 #define UNUSED_MDLTERMINATE