1/*
2 * File: sensorsharp.h
3 *
4 * Code generated for Simulink model 'sensorsharp'.
5 *
6 * Model version : 1.47
7 * Simulink Coder version : 8.12 (R2017a) 16-Feb-2017
8 * C/C++ source code generated on : Tue Jun 18 18:54:30 2019
9 *
10 * Target selection: ert.tlc
11 * Embedded hardware selection: Atmel->AVR
12 * Code generation objectives: Unspecified
13 * Validation result: Not run
14 */
15
16#ifndef RTW_HEADER_sensorsharp_h_
17#define RTW_HEADER_sensorsharp_h_
18#include <math.h>
19#include <string.h>
20#include <float.h>
21#include <stddef.h>
22#ifndef sensorsharp_COMMON_INCLUDES_
23# define sensorsharp_COMMON_INCLUDES_
24#include "rtwtypes.h"
25#include "rtw_extmode.h"
26#include "sysran_types.h"
27#include "rtw_continuous.h"
28#include "rtw_solver.h"
29#include "dt_info.h"
30#include "ext_work.h"
31#include "arduino_servowrite_lct.h"
32#include "arduino_analoginput_lct.h"
33#include "arduino_analogoutput_lct.h"
34#endif /* sensorsharp_COMMON_INCLUDES_ */
35
36#include "sensorsharp_types.h"
37
38/* Shared type includes */
39#include "multiword_types.h"
40#include "MW_target_hardware_resources.h"
41#include "rt_nonfinite.h"
42#include "rtGetInf.h"
43
44/* Macros for accessing real-time model data structure */
45#ifndef rtmGetFinalTime
46# define rtmGetFinalTime(rtm) ((rtm)->Timing.tFinal)
47#endif
48
49#ifndef rtmGetRTWExtModeInfo
50# define rtmGetRTWExtModeInfo(rtm) ((rtm)->extModeInfo)
51#endif
52
53#ifndef rtmGetErrorStatus
54# define rtmGetErrorStatus(rtm) ((rtm)->errorStatus)
55#endif
56
57#ifndef rtmSetErrorStatus
58# define rtmSetErrorStatus(rtm, val) ((rtm)->errorStatus = (val))
59#endif
60
61#ifndef rtmStepTask
62# define rtmStepTask(rtm, idx) ((rtm)->Timing.TaskCounters.TID[(idx)] == 0)
63#endif
64
65#ifndef rtmGetStopRequested
66# define rtmGetStopRequested(rtm) ((rtm)->Timing.stopRequestedFlag)
67#endif
68
69#ifndef rtmSetStopRequested
70# define rtmSetStopRequested(rtm, val) ((rtm)->Timing.stopRequestedFlag = (val))
71#endif
72
73#ifndef rtmGetStopRequestedPtr
74# define rtmGetStopRequestedPtr(rtm) (&((rtm)->Timing.stopRequestedFlag))
75#endif
76
77#ifndef rtmGetT
78# define rtmGetT(rtm) ((rtm)->Timing.taskTime0)
79#endif
80
81#ifndef rtmGetTFinal
82# define rtmGetTFinal(rtm) ((rtm)->Timing.tFinal)
83#endif
84
85#ifndef rtmTaskCounter
86# define rtmTaskCounter(rtm, idx) ((rtm)->Timing.TaskCounters.TID[(idx)])
87#endif
88
89/* Block signals (auto storage) */
90typedef struct {
91 real_T sortedValues[20];
92 real_T Constant2; /* '<Root>/Constant2' */
93 real_T Sum; /* '<S4>/Sum' */
94 real_T Saturation; /* '<Root>/Saturation' */
95 real_T poscm; /* '<Root>/MATLAB Function 2' */
96 uint16_T DataTypeConversion1; /* '<Root>/Data Type Conversion1' */
97} B_sensorsharp_T;
98
99/* Block states (auto storage) for system '<Root>' */
100typedef struct {
101 real_T Delay_X[20]; /* '<Root>/Delay' */
102 real_T SFunctionBuilder_DSTATE; /* '<Root>/S-Function Builder' */
103 real_T Integrator_DSTATE; /* '<S4>/Integrator' */
104 real_T UD_DSTATE; /* '<S7>/UD' */
105 struct {
106 void *LoggedData;
107 } Sistemabolabalancn_PWORK; /* '<Root>/Sistema bola balancín' */
108
109 struct {
110 void *LoggedData;
111 } Sistemabolabalancn1_PWORK; /* '<Root>/Sistema bola balancín1' */
112
113 struct {
114 void *LoggedData;
115 } Sistemabolabalancn2_PWORK; /* '<Root>/Sistema bola balancín2' */
116} DW_sensorsharp_T;
117
118/* Parameters (auto storage) */
119struct P_sensorsharp_T_ {
120 real_T PIDController_D; /* Mask Parameter: PIDController_D
121 * Referenced by: '<S4>/Derivative Gain'
122 */
123 real_T PIDController_I; /* Mask Parameter: PIDController_I
124 * Referenced by: '<S4>/Integral Gain'
125 */
126 real_T PIDController_P; /* Mask Parameter: PIDController_P
127 * Referenced by: '<S4>/Proportional Gain'
128 */
129 real_T Delay_vinit; /* Mask Parameter: Delay_vinit
130 * Referenced by: '<Root>/Delay'
131 */
132 uint32_T ServoWrite_pinNumber; /* Mask Parameter: ServoWrite_pinNumber
133 * Referenced by: '<S6>/Servo Write'
134 */
135 uint32_T PWM_pinNumber; /* Mask Parameter: PWM_pinNumber
136 * Referenced by: '<S5>/PWM'
137 */
138 real_T Constant2_Value; /* Expression: 36
139 * Referenced by: '<Root>/Constant2'
140 */
141 real_T Integrator_gainval; /* Computed Parameter: Integrator_gainval
142 * Referenced by: '<S4>/Integrator'
143 */
144 real_T Integrator_IC; /* Expression: InitialConditionForIntegrator
145 * Referenced by: '<S4>/Integrator'
146 */
147 real_T TSamp_WtEt; /* Computed Parameter: TSamp_WtEt
148 * Referenced by: '<S7>/TSamp'
149 */
150 real_T UD_InitialCondition; /* Expression: DifferentiatorICPrevScaledInput
151 * Referenced by: '<S7>/UD'
152 */
153 real_T Saturation_UpperSat; /* Expression: 180
154 * Referenced by: '<Root>/Saturation'
155 */
156 real_T Saturation_LowerSat; /* Expression: 0
157 * Referenced by: '<Root>/Saturation'
158 */
159 real_T Constant1_Value; /* Expression: 65
160 * Referenced by: '<Root>/Constant1'
161 */
162 uint32_T AnalogImputSensor_p1; /* Computed Parameter: AnalogImputSensor_p1
163 * Referenced by: '<Root>/Analog Imput Sensor'
164 */
165 uint16_T UD_DelayLength; /* Computed Parameter: UD_DelayLength
166 * Referenced by: '<S7>/UD'
167 */
168 uint8_T ServoWrite_p1; /* Computed Parameter: ServoWrite_p1
169 * Referenced by: '<S6>/Servo Write'
170 */
171};
172
173/* Real-time Model Data Structure */
174struct tag_RTM_sensorsharp_T {
175 const char_T *errorStatus;
176 RTWExtModeInfo *extModeInfo;
177
178 /*
179 * Sizes:
180 * The following substructure contains sizes information
181 * for many of the model attributes such as inputs, outputs,
182 * dwork, sample times, etc.
183 */
184 struct {
185 uint32_T checksums[4];
186 } Sizes;
187
188 /*
189 * SpecialInfo:
190 * The following substructure contains special information
191 * related to other components that are dependent on RTW.
192 */
193 struct {
194 const void *mappingInfo;
195 } SpecialInfo;
196
197 /*
198 * Timing:
199 * The following substructure contains information regarding
200 * the timing information for the model.
201 */
202 struct {
203 time_T taskTime0;
204 uint32_T clockTick0;
205 time_T stepSize0;
206 uint32_T clockTick1;
207 struct {
208 uint8_T TID[2];
209 } TaskCounters;
210
211 time_T tFinal;
212 boolean_T stopRequestedFlag;
213 } Timing;
214};
215
216/* Block parameters (auto storage) */
217extern P_sensorsharp_T sensorsharp_P;
218
219/* Block signals (auto storage) */
220extern B_sensorsharp_T sensorsharp_B;
221
222/* Block states (auto storage) */
223extern DW_sensorsharp_T sensorsharp_DW;
224
225/* External function called from main */
226extern void sensorsharp_SetEventsForThisBaseStep(boolean_T *eventFlags);
227
228/* Model entry point functions */
229extern void sensorsharp_SetEventsForThisBaseStep(boolean_T *eventFlags);
230extern void sensorsharp_initialize(void);
231extern void sensorsharp_step0(void);
232extern void sensorsharp_step1(void);
233extern void sensorsharp_terminate(void);
234
235/* Real-time Model object */
236extern RT_MODEL_sensorsharp_T *const sensorsharp_M;
237
238/*-
239 * These blocks were eliminated from the model due to optimizations:
240 *
241 * Block '<Root>/Entrada escalon' : Unused code path elimination
242 * Block '<S7>/DTDup' : Unused code path elimination
243 */
244
245/*-
246 * The generated code includes comments that allow you to trace directly
247 * back to the appropriate location in the model. The basic format
248 * is <system>/block_name, where system is the system number (uniquely
249 * assigned by Simulink) and block_name is the name of the block.
250 *
251 * Use the MATLAB hilite_system command to trace the generated code back
252 * to the model. For example,
253 *
254 * hilite_system('<S3>') - opens system 3
255 * hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
256 *
257 * Here is the system hierarchy for this model
258 *
259 * '<Root>' : 'sensorsharp'
260 * '<S1>' : 'sensorsharp/MATLAB Function 1'
261 * '<S2>' : 'sensorsharp/MATLAB Function 2'
262 * '<S3>' : 'sensorsharp/MATLAB Function 3'
263 * '<S4>' : 'sensorsharp/PID Controller'
264 * '<S5>' : 'sensorsharp/PWM'
265 * '<S6>' : 'sensorsharp/Standard Servo Write'
266 * '<S7>' : 'sensorsharp/PID Controller/Differentiator'
267 */
268#endif /* RTW_HEADER_sensorsharp_h_ */
269
270/*
271 * File trailer for generated code.
272 *
273 * [EOF]
274 */
275