-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjoystick_read.tlc
77 lines (67 loc) · 2.47 KB
/
joystick_read.tlc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
%% file : joystick_read.tlc
%%
%% Description:
%% Simulink Coder TLC Code Generation file for joystick_read
%%
%% Simulink version : 9.0 (R2017b) 24-Jul-2017
%% TLC file generated on : 02-Aug-2018 11:27:52
/%
%%%-MATLAB_Construction_Commands_Start
def = legacy_code('initialize');
def.SFunctionName = 'joystick_read';
def.OutputFcnSpec = 'double y1 = read_joystick()';
def.StartFcnSpec = 'void init()';
def.HeaderFiles = {'joystick.h', 'stdio.h', 'ncurses.h', 'gamepad.h'};
def.SourceFiles = {'joystick.c'};
def.HostLibFiles = {'libgamepad.so.1'};
def.SampleTime = 0.001;
legacy_code('sfcn_tlc_generate', def);
%%%-MATLAB_Construction_Commands_End
%/
%implements joystick_read "C"
%% Function: BlockTypeSetup ===============================================
%function BlockTypeSetup (block, system) void
%% The Target Language must be C
%if ::GenCPP==1 && !IsModelReferenceSimTarget()
%<LibReportFatalError("This S-Function generated by the Legacy Code Tool must be only used with the C Target Language")>
%endif
%<LibAddToCommonIncludes("joystick.h")>
%<LibAddToCommonIncludes("stdio.h")>
%<LibAddToCommonIncludes("ncurses.h")>
%<LibAddToCommonIncludes("gamepad.h")>
%<SLibAddToStaticSources("joystick.c")>
%endfunction
%% Function: BlockInstanceSetup ===========================================
%function BlockInstanceSetup (block, system) void
%<LibBlockSetIsExpressionCompliant(block)>
%endfunction
%% Function: Start ========================================================
%function Start (block, system) Output
%%
init();
%endfunction
%% Function: Outputs ======================================================
%function Outputs (block, system) Output
%if !LibBlockOutputSignalIsExpr(0)
%assign y1_val = LibBlockOutputSignal(0, "", "", 0)
%%
%<y1_val> = read_joystick();
%endif
%endfunction
%% Function: BlockOutputSignal ============================================
%function BlockOutputSignal (block,system,portIdx,ucv,lcv,idx,retType) void
%%
%switch retType
%case "Signal"
%if portIdx == 0
%return "read_joystick()"
%else
%assign errTxt = "Block output port index not supported: %<portIdx>"
%<LibBlockReportError(block,errTxt)>
%endif
%default
%assign errTxt = "Unsupported return type: %<retType>"
%<LibBlockReportError(block,errTxt)>
%endswitch
%endfunction
%% [EOF]