1 | |
2 | |
3 | /* |
4 | * Include Files |
5 | * |
6 | */ |
7 | #if defined(MATLAB_MEX_FILE) |
8 | #include "tmwtypes.h" |
9 | #include "simstruc_types.h" |
10 | #else |
11 | #include "rtwtypes.h" |
12 | #endif |
13 | |
14 | |
15 | |
16 | /* %%%-SFUNWIZ_wrapper_includes_Changes_BEGIN --- EDIT HERE TO _END */ |
17 | #include <math.h> |
18 | #ifndef MATLAB_MEX_FILE |
19 | #include "LiquidCrystal.h" |
20 | #include "LiquidCrystal.cpp" |
21 | |
22 | // initialize the library by associating any needed LCD interface pin |
23 | const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2; |
24 | LiquidCrystal lcd(rs, en, d4, d5, d6, d7); |
25 | #endif |
26 | /* %%%-SFUNWIZ_wrapper_includes_Changes_END --- EDIT HERE TO _BEGIN */ |
27 | #define u_width 1 |
28 | /* |
29 | * Create external references here. |
30 | * |
31 | */ |
32 | /* %%%-SFUNWIZ_wrapper_externs_Changes_BEGIN --- EDIT HERE TO _END */ |
33 | /* extern double func(double a); */ |
34 | /* %%%-SFUNWIZ_wrapper_externs_Changes_END --- EDIT HERE TO _BEGIN */ |
35 | |
36 | /* |
37 | * Output functions |
38 | * |
39 | */ |
40 | extern "C" void Lcd_Outputs_wrapper(const uint16_T *char_val, |
41 | const real_T *xD) |
42 | { |
43 | /* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --- EDIT HERE TO _END */ |
44 | /* This sample sets the output equal to the input |
45 | y0[0] = u0[0]; |
46 | For complex signals use: y0[0].re = u0[0].re; |
47 | y0[0].im = u0[0].im; |
48 | y1[0].re = u1[0].re; |
49 | y1[0].im = u1[0].im; |
50 | */ |
51 | |
52 | if(xD[0] == 1) |
53 | { |
54 | #ifndef MATLAB_MEX_FILE |
55 | lcd.setCursor(0, 1); |
56 | lcd.print(char_val[0]); |
57 | lcd.setCursor(3, 1); |
58 | lcd.print("cm"); |
59 | #endif |
60 | } |
61 | /* %%%-SFUNWIZ_wrapper_Outputs_Changes_END --- EDIT HERE TO _BEGIN */ |
62 | } |
63 | |
64 | /* |
65 | * Updates function |
66 | * |
67 | */ |
68 | extern "C" void Lcd_Update_wrapper(const uint16_T *char_val, |
69 | real_T *xD) |
70 | { |
71 | /* %%%-SFUNWIZ_wrapper_Update_Changes_BEGIN --- EDIT HERE TO _END */ |
72 | /* |
73 | * Code example |
74 | * xD[0] = u0[0]; |
75 | */ |
76 | |
77 | if(xD[0] != 1){ |
78 | # ifndef MATLAB_MEX_FILE |
79 | lcd.begin(16, 2); |
80 | // Print a message to the LCD. |
81 | lcd.setCursor(1, 0); |
82 | lcd.print("-TFG BALANCIN-"); |
83 | #endif |
84 | //done with initialization |
85 | xD[0] = 1; |
86 | } |
87 | /* %%%-SFUNWIZ_wrapper_Update_Changes_END --- EDIT HERE TO _BEGIN */ |
88 | } |
89 | |