]> rtime.felk.cvut.cz Git - pes-rpp/rpp-simulink.git/blob - rpp/blocks/sfunction_scis.c
doc: Update documentation of external mode and related stuff
[pes-rpp/rpp-simulink.git] / rpp / blocks / sfunction_scis.c
1 /* Copyright (C) 2013, 2014 Czech Technical University in Prague
2  *
3  * Authors:
4  *     - Carlos Jenkins <carlos@jenkins.co.cr>
5  *
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.
10  *
11  * File : sfunction_scis.c
12  * Abstract:
13  *     C-MEX S-function block for RPP Serial Communication send.
14  *
15  * References:
16  *     header.c
17  *     trailer.c
18  *
19  * Compile with:
20  *     <matlabroot>/bin/mex sfunction_scis.c
21  */
22
23 /*
24 %YAML 1.2
25 ---
26 Name: Serial Send
27 Category: Communication
28 Header: rpp/sci.h
29 Mnemonic: SCIS
30
31 Inputs:
32   - { name: "Send", type: "uint8" }
33
34 Outputs:
35   - { name: "ErrFlag", type: "bool" }
36
37 Parameters:
38
39 # Description and Help is in Markdown mark-up
40 Description: &desc |
41
42   This block sends a byte to the SCI.
43
44   The ErrFlag is set to true `rpp_sci_write_nb()` returns an error, to
45   false otherwise.
46
47 Help: *desc
48
49 Status: Stable
50
51 RPP API functions used:
52     - rpp_sci_write_nb()
53
54 Relevant demos:
55     - echo_char
56     - hello_world
57 ...
58 */
59
60 #define S_FUNCTION_NAME sfunction_scis
61 #include "header.c"
62
63
64 static void mdlInitializeSizes(SimStruct *S)
65 {
66     /*
67      * Configure parameters: 0
68      */
69     if (!rppSetNumParams(S, 0)) {
70         return;
71     }
72
73     /*
74      * Configure input ports: 1
75      *  - Data send.
76      */
77     if (!ssSetNumInputPorts(S, 1)) {
78         return;
79     }
80     rppAddInputPort(S, 0, SS_UINT8);
81
82     /*
83      * Configure output ports: 1
84      *  - Error flag.
85      */
86     if (!ssSetNumOutputPorts(S, 1)) {
87         return;
88     }
89     rppAddOutputPort(S, 0, SS_BOOLEAN);
90
91     /* Set standard options for this block */
92     rppSetStandardOptions(S);
93 }
94
95
96 #define COMMON_MDLINITIALIZESAMPLETIMES_INHERIT
97 #define UNUSED_MDLCHECKPARAMETERS
98 #define UNUSED_MDLOUTPUTS
99 #define UNUSED_MDLTERMINATE
100 #include "trailer.c"