1/*
2 * Academic License - for use in teaching, academic research, and meeting
3 * course requirements at degree granting institutions only. Not for
4 * government, commercial, or other organizational use.
5 *
6 * File: integ_Accel_and_Gyro.h
7 *
8 * Code generated for Simulink model 'integ_Accel_and_Gyro'.
9 *
10 * Model version : 1.7
11 * Simulink Coder version : 8.12 (R2017a) 16-Feb-2017
12 * C/C++ source code generated on : Tue Dec 05 15:47:02 2017
13 *
14 * Target selection: ert.tlc
15 * Embedded hardware selection: ARM Compatible->ARM Cortex
16 * Code generation objectives: Unspecified
17 * Validation result: Not run
18 */
19
20#ifndef RTW_HEADER_integ_Accel_and_Gyro_h_
21#define RTW_HEADER_integ_Accel_and_Gyro_h_
22#include <string.h>
23#include <float.h>
24#include <stddef.h>
25#ifndef integ_Accel_and_Gyro_COMMON_INCLUDES_
26# define integ_Accel_and_Gyro_COMMON_INCLUDES_
27#include <stddef.h>
28#include "rtwtypes.h"
29#include "rtw_extmode.h"
30#include "sysran_types.h"
31#include "rtw_continuous.h"
32#include "rtw_solver.h"
33#include "dt_info.h"
34#include "ext_work.h"
35#include "MW_I2C.h"
36#endif /* integ_Accel_and_Gyro_COMMON_INCLUDES_ */
37
38#include "integ_Accel_and_Gyro_types.h"
39
40/* Shared type includes */
41#include "multiword_types.h"
42
43/* Macros for accessing real-time model data structure */
44#ifndef rtmGetFinalTime
45# define rtmGetFinalTime(rtm) ((rtm)->Timing.tFinal)
46#endif
47
48#ifndef rtmGetRTWExtModeInfo
49# define rtmGetRTWExtModeInfo(rtm) ((rtm)->extModeInfo)
50#endif
51
52#ifndef rtmGetErrorStatus
53# define rtmGetErrorStatus(rtm) ((rtm)->errorStatus)
54#endif
55
56#ifndef rtmSetErrorStatus
57# define rtmSetErrorStatus(rtm, val) ((rtm)->errorStatus = (val))
58#endif
59
60#ifndef rtmGetStopRequested
61# define rtmGetStopRequested(rtm) ((rtm)->Timing.stopRequestedFlag)
62#endif
63
64#ifndef rtmSetStopRequested
65# define rtmSetStopRequested(rtm, val) ((rtm)->Timing.stopRequestedFlag = (val))
66#endif
67
68#ifndef rtmGetStopRequestedPtr
69# define rtmGetStopRequestedPtr(rtm) (&((rtm)->Timing.stopRequestedFlag))
70#endif
71
72#ifndef rtmGetT
73# define rtmGetT(rtm) (rtmGetTPtr((rtm))[0])
74#endif
75
76#ifndef rtmGetTFinal
77# define rtmGetTFinal(rtm) ((rtm)->Timing.tFinal)
78#endif
79
80/* Block states (auto storage) for system '<S17>/i2cWr' */
81typedef struct {
82 freedomk64f_I2CMasterWrite_in_T obj; /* '<S19>/I2C Master Write' */
83 void *I2CMasterWrite_PWORK; /* '<S19>/I2C Master Write' */
84 int8_T i2cWr_SubsysRanBC; /* '<S17>/i2cWr' */
85} DW_i2cWr_integ_Accel_and_Gyro_T;
86
87/* Block signals (auto storage) */
88typedef struct {
89 real32_T fv0[16];
90 real32_T fv1[16];
91 real32_T y[8]; /* '<S13>/Forward Substitution' */
92 real32_T BackwardSubstitution[8]; /* '<S13>/Backward Substitution' */
93 real32_T fv2[8];
94 real_T FXOS87006AxesSensor[3]; /* '<Root>/FXOS8700 6-Axes Sensor' */
95 real32_T LDLFactorization[4]; /* '<S13>/LDL Factorization' */
96 uint8_T output_raw[14];
97 uint16_T output[7];
98 real32_T Gain[3]; /* '<S2>/Gain' */
99 real32_T Gain2[3]; /* '<S2>/Gain2' */
100 uint32_T i2cname;
101 real_T currentTime;
102 real32_T ZHX_prd[2]; /* '<S8>/Z-H*X_prd' */
103 uint8_T output_raw_m[6];
104 int16_T output_c[3];
105 real32_T Sum; /* '<S2>/Sum' */
106 real32_T DiscreteTimeIntegrator6; /* '<S3>/Discrete-Time Integrator6' */
107 real32_T DiscreteTimeIntegrator7; /* '<S3>/Discrete-Time Integrator7' */
108 real32_T DiscreteTimeIntegrator2; /* '<S3>/Discrete-Time Integrator2' */
109 real32_T DiscreteTimeIntegrator3; /* '<S3>/Discrete-Time Integrator3' */
110 real32_T P_prd_Reshape[16]; /* '<S8>/P_prd_Reshape' */
111 real32_T Assignment[16]; /* '<S9>/Assignment' */
112 real32_T Assignment_o[4]; /* '<S10>/Assignment' */
113 real32_T Assignment_c[4]; /* '<S11>/Assignment' */
114 int16_T acc[3]; /* '<S2>/MPU6050' */
115 int16_T gyro[3]; /* '<S2>/MPU6050' */
116 real32_T accTmp;
117 real32_T DiscreteTimeIntegrator1; /* '<S3>/Discrete-Time Integrator1' */
118 real32_T DiscreteTimeIntegrator; /* '<S3>/Discrete-Time Integrator' */
119 real32_T DiscreteTimeIntegrator5; /* '<S3>/Discrete-Time Integrator5' */
120 int32_T idxV;
121 int32_T s6_iter;
122 int32_T i;
123 int16_T temp; /* '<S2>/MPU6050' */
124 int16_T DataTypeConversion[7]; /* '<S18>/Data Type Conversion' */
125 uint16_T dataw; /* '<S2>/MPU6050' */
126} B_integ_Accel_and_Gyro_T;
127
128/* Block states (auto storage) for system '<Root>' */
129typedef struct {
130 freedomk64f_fxos8700_integ_Ac_T obj; /* '<Root>/FXOS8700 6-Axes Sensor' */
131 freedomk64f_I2CMasterRead_int_T obj_d;/* '<S18>/I2C Master Read' */
132 struct {
133 void *LoggedData[3];
134 } Scope_PWORK; /* '<Root>/Scope' */
135
136 struct {
137 void *LoggedData;
138 } Scope1_PWORK; /* '<Root>/Scope1' */
139
140 struct {
141 void *LoggedData[3];
142 } Scope2_PWORK; /* '<Root>/Scope2' */
143
144 struct {
145 void *LoggedData[3];
146 } accelerometer_PWORK; /* '<Root>/accelerometer' */
147
148 struct {
149 void *LoggedData[2];
150 } filtered_PWORK; /* '<Root>/filtered' */
151
152 struct {
153 void *LoggedData[2];
154 } measured_PWORK; /* '<Root>/measured' */
155
156 struct {
157 void *LoggedData;
158 } temp_PWORK; /* '<Root>/temp' */
159
160 void *I2CMasterRead_PWORK; /* '<S18>/I2C Master Read' */
161 void *FXOS87006AxesSensor_PWORK; /* '<Root>/FXOS8700 6-Axes Sensor' */
162 real32_T UnitDelay2_DSTATE[4]; /* '<S4>/Unit Delay2' */
163 real32_T UnitDelay3_DSTATE[16]; /* '<S4>/Unit Delay3' */
164 real32_T DiscreteTimeIntegrator4_DSTATE;/* '<S3>/Discrete-Time Integrator4' */
165 real32_T DiscreteTimeIntegrator6_DSTATE;/* '<S3>/Discrete-Time Integrator6' */
166 real32_T DiscreteTimeIntegrator5_DSTATE;/* '<S3>/Discrete-Time Integrator5' */
167 real32_T DiscreteTimeIntegrator7_DSTATE;/* '<S3>/Discrete-Time Integrator7' */
168 real32_T DiscreteTimeIntegrator_DSTATE;/* '<S3>/Discrete-Time Integrator' */
169 real32_T DiscreteTimeIntegrator2_DSTATE;/* '<S3>/Discrete-Time Integrator2' */
170 real32_T DiscreteTimeIntegrator1_DSTATE;/* '<S3>/Discrete-Time Integrator1' */
171 real32_T DiscreteTimeIntegrator3_DSTATE;/* '<S3>/Discrete-Time Integrator3' */
172 real32_T LDLFactorization_VMX[2]; /* '<S13>/LDL Factorization' */
173 int8_T Subsystem1_SubsysRanBC; /* '<Root>/Subsystem1' */
174 int8_T i2cRd_SubsysRanBC; /* '<S17>/i2cRd' */
175 uint8_T is_active_c3_integ_Accel_and_Gy;/* '<S2>/MPU6050' */
176 uint8_T is_c3_integ_Accel_and_Gyro; /* '<S2>/MPU6050' */
177 uint8_T n; /* '<S2>/MPU6050' */
178 boolean_T LDLFactorization_STATE; /* '<S13>/LDL Factorization' */
179 boolean_T Subsystem1_MODE; /* '<Root>/Subsystem1' */
180 DW_i2cWr_integ_Accel_and_Gyro_T i2cWr;/* '<S17>/i2cWr' */
181} DW_integ_Accel_and_Gyro_T;
182
183/* Parameters (auto storage) */
184struct P_integ_Accel_and_Gyro_T_ {
185 real_T FXOS87006AxesSensor_SampleTime;/* Expression: -1
186 * Referenced by: '<Root>/FXOS8700 6-Axes Sensor'
187 */
188 real_T I2CMasterRead_SampleTime; /* Expression: -1
189 * Referenced by: '<S18>/I2C Master Read'
190 */
191 real_T Step_Time; /* Expression: 10
192 * Referenced by: '<Root>/Step'
193 */
194 real_T Step_Y0; /* Expression: 0
195 * Referenced by: '<Root>/Step'
196 */
197 real_T Step_YFinal; /* Expression: 1
198 * Referenced by: '<Root>/Step'
199 */
200 real32_T Z_est_Y0; /* Computed Parameter: Z_est_Y0
201 * Referenced by: '<S6>/Z_est'
202 */
203 real32_T X_est_Y0; /* Computed Parameter: X_est_Y0
204 * Referenced by: '<S6>/X_est'
205 */
206 real32_T X_prd_Y0; /* Computed Parameter: X_prd_Y0
207 * Referenced by: '<S6>/X_prd'
208 */
209 real32_T P_prd_Y0; /* Computed Parameter: P_prd_Y0
210 * Referenced by: '<S6>/P_prd'
211 */
212 real32_T Constant3_Value[16]; /* Computed Parameter: Constant3_Value
213 * Referenced by: '<S8>/Constant3'
214 */
215 real32_T Hcst_Value[8]; /* Computed Parameter: Hcst_Value
216 * Referenced by: '<S8>/Hcst'
217 */
218 real32_T Hcst_t_Value[8]; /* Computed Parameter: Hcst_t_Value
219 * Referenced by: '<S8>/Hcst_t'
220 */
221 real32_T Constant2_Value[4]; /* Computed Parameter: Constant2_Value
222 * Referenced by: '<S8>/Constant2'
223 */
224 real32_T Constant4_Value[16]; /* Computed Parameter: Constant4_Value
225 * Referenced by: '<S8>/Constant4'
226 */
227 real32_T Constant5_Value[16]; /* Computed Parameter: Constant5_Value
228 * Referenced by: '<S8>/Constant5'
229 */
230 real32_T x_filter_Y0; /* Computed Parameter: x_filter_Y0
231 * Referenced by: '<S3>/x_filter'
232 */
233 real32_T y_filter_Y0; /* Computed Parameter: y_filter_Y0
234 * Referenced by: '<S3>/y_filter'
235 */
236 real32_T x_meas_Y0; /* Computed Parameter: x_meas_Y0
237 * Referenced by: '<S3>/x_meas'
238 */
239 real32_T y_meas_Y0; /* Computed Parameter: y_meas_Y0
240 * Referenced by: '<S3>/y_meas'
241 */
242 real32_T DiscreteTimeIntegrator4_gainval;/* Computed Parameter: DiscreteTimeIntegrator4_gainval
243 * Referenced by: '<S3>/Discrete-Time Integrator4'
244 */
245 real32_T DiscreteTimeIntegrator4_IC; /* Computed Parameter: DiscreteTimeIntegrator4_IC
246 * Referenced by: '<S3>/Discrete-Time Integrator4'
247 */
248 real32_T DiscreteTimeIntegrator6_gainval;/* Computed Parameter: DiscreteTimeIntegrator6_gainval
249 * Referenced by: '<S3>/Discrete-Time Integrator6'
250 */
251 real32_T DiscreteTimeIntegrator6_IC; /* Computed Parameter: DiscreteTimeIntegrator6_IC
252 * Referenced by: '<S3>/Discrete-Time Integrator6'
253 */
254 real32_T DiscreteTimeIntegrator5_gainval;/* Computed Parameter: DiscreteTimeIntegrator5_gainval
255 * Referenced by: '<S3>/Discrete-Time Integrator5'
256 */
257 real32_T DiscreteTimeIntegrator5_IC; /* Computed Parameter: DiscreteTimeIntegrator5_IC
258 * Referenced by: '<S3>/Discrete-Time Integrator5'
259 */
260 real32_T DiscreteTimeIntegrator7_gainval;/* Computed Parameter: DiscreteTimeIntegrator7_gainval
261 * Referenced by: '<S3>/Discrete-Time Integrator7'
262 */
263 real32_T DiscreteTimeIntegrator7_IC; /* Computed Parameter: DiscreteTimeIntegrator7_IC
264 * Referenced by: '<S3>/Discrete-Time Integrator7'
265 */
266 real32_T DiscreteTimeIntegrator_gainval;/* Computed Parameter: DiscreteTimeIntegrator_gainval
267 * Referenced by: '<S3>/Discrete-Time Integrator'
268 */
269 real32_T DiscreteTimeIntegrator_IC; /* Computed Parameter: DiscreteTimeIntegrator_IC
270 * Referenced by: '<S3>/Discrete-Time Integrator'
271 */
272 real32_T DiscreteTimeIntegrator2_gainval;/* Computed Parameter: DiscreteTimeIntegrator2_gainval
273 * Referenced by: '<S3>/Discrete-Time Integrator2'
274 */
275 real32_T DiscreteTimeIntegrator2_IC; /* Computed Parameter: DiscreteTimeIntegrator2_IC
276 * Referenced by: '<S3>/Discrete-Time Integrator2'
277 */
278 real32_T DiscreteTimeIntegrator1_gainval;/* Computed Parameter: DiscreteTimeIntegrator1_gainval
279 * Referenced by: '<S3>/Discrete-Time Integrator1'
280 */
281 real32_T DiscreteTimeIntegrator1_IC; /* Computed Parameter: DiscreteTimeIntegrator1_IC
282 * Referenced by: '<S3>/Discrete-Time Integrator1'
283 */
284 real32_T DiscreteTimeIntegrator3_gainval;/* Computed Parameter: DiscreteTimeIntegrator3_gainval
285 * Referenced by: '<S3>/Discrete-Time Integrator3'
286 */
287 real32_T DiscreteTimeIntegrator3_IC; /* Computed Parameter: DiscreteTimeIntegrator3_IC
288 * Referenced by: '<S3>/Discrete-Time Integrator3'
289 */
290 real32_T UnitDelay2_InitialCondition[4];/* Computed Parameter: UnitDelay2_InitialCondition
291 * Referenced by: '<S4>/Unit Delay2'
292 */
293 real32_T UnitDelay3_InitialCondition[16];/* Computed Parameter: UnitDelay3_InitialCondition
294 * Referenced by: '<S4>/Unit Delay3'
295 */
296 real32_T Constant_Value; /* Computed Parameter: Constant_Value
297 * Referenced by: '<S2>/Constant'
298 */
299 int32_T Iterator_IterationLimit; /* Computed Parameter: Iterator_IterationLimit
300 * Referenced by: '<S6>/Iterator'
301 */
302 int16_T datar_Y0; /* Computed Parameter: datar_Y0
303 * Referenced by: '<S18>/datar'
304 */
305 int16_T Gain_Gain; /* Computed Parameter: Gain_Gain
306 * Referenced by: '<S2>/Gain'
307 */
308 int16_T Gain2_Gain; /* Computed Parameter: Gain2_Gain
309 * Referenced by: '<S2>/Gain2'
310 */
311 int16_T Gain1_Gain; /* Computed Parameter: Gain1_Gain
312 * Referenced by: '<S2>/Gain1'
313 */
314};
315
316/* Real-time Model Data Structure */
317struct tag_RTM_integ_Accel_and_Gyro_T {
318 const char_T *errorStatus;
319 RTWExtModeInfo *extModeInfo;
320 RTWSolverInfo solverInfo;
321
322 /*
323 * Sizes:
324 * The following substructure contains sizes information
325 * for many of the model attributes such as inputs, outputs,
326 * dwork, sample times, etc.
327 */
328 struct {
329 uint32_T checksums[4];
330 } Sizes;
331
332 /*
333 * SpecialInfo:
334 * The following substructure contains special information
335 * related to other components that are dependent on RTW.
336 */
337 struct {
338 const void *mappingInfo;
339 } SpecialInfo;
340
341 /*
342 * Timing:
343 * The following substructure contains information regarding
344 * the timing information for the model.
345 */
346 struct {
347 uint32_T clockTick0;
348 time_T stepSize0;
349 uint32_T clockTick1;
350 uint32_T clockTick2;
351 struct {
352 uint8_T TID[3];
353 } TaskCounters;
354
355 time_T tFinal;
356 SimTimeStep simTimeStep;
357 boolean_T stopRequestedFlag;
358 time_T *t;
359 time_T tArray[3];
360 } Timing;
361};
362
363/* Block parameters (auto storage) */
364extern P_integ_Accel_and_Gyro_T integ_Accel_and_Gyro_P;
365
366/* Block signals (auto storage) */
367extern B_integ_Accel_and_Gyro_T integ_Accel_and_Gyro_B;
368
369/* Block states (auto storage) */
370extern DW_integ_Accel_and_Gyro_T integ_Accel_and_Gyro_DW;
371
372/* Model entry point functions */
373extern void integ_Accel_and_Gyro_initialize(void);
374extern void integ_Accel_and_Gyro_step(void);
375extern void integ_Accel_and_Gyro_terminate(void);
376
377/* Real-time Model object */
378extern RT_MODEL_integ_Accel_and_Gyro_T *const integ_Accel_and_Gyro_M;
379
380/*-
381 * These blocks were eliminated from the model due to optimizations:
382 *
383 * Block '<S5>/Check Signal Attributes' : Unused code path elimination
384 * Block '<S14>/Check Signal Attributes' : Unused code path elimination
385 * Block '<S15>/Check Signal Attributes' : Unused code path elimination
386 * Block '<S16>/Check Signal Attributes' : Unused code path elimination
387 * Block '<S8>/Z_est_Multiply' : Unused code path elimination
388 * Block '<S12>/Assignment' : Unused code path elimination
389 * Block '<S1>/Sum' : Unused code path elimination
390 * Block '<S8>/P_Reshape' : Reshape block reduction
391 * Block '<S1>/Zero-Order Hold' : Eliminated since input and output rates are identical
392 */
393
394/*-
395 * The generated code includes comments that allow you to trace directly
396 * back to the appropriate location in the model. The basic format
397 * is <system>/block_name, where system is the system number (uniquely
398 * assigned by Simulink) and block_name is the name of the block.
399 *
400 * Use the MATLAB hilite_system command to trace the generated code back
401 * to the model. For example,
402 *
403 * hilite_system('<S3>') - opens system 3
404 * hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
405 *
406 * Here is the system hierarchy for this model
407 *
408 * '<Root>' : 'integ_Accel_and_Gyro'
409 * '<S1>' : 'integ_Accel_and_Gyro/KF1'
410 * '<S2>' : 'integ_Accel_and_Gyro/MPU6050 sensor'
411 * '<S3>' : 'integ_Accel_and_Gyro/Subsystem1'
412 * '<S4>' : 'integ_Accel_and_Gyro/KF1/Kalman Filter1'
413 * '<S5>' : 'integ_Accel_and_Gyro/KF1/Kalman Filter1/Check Signal Attributes'
414 * '<S6>' : 'integ_Accel_and_Gyro/KF1/Kalman Filter1/Control'
415 * '<S7>' : 'integ_Accel_and_Gyro/KF1/Kalman Filter1/Control/Options'
416 * '<S8>' : 'integ_Accel_and_Gyro/KF1/Kalman Filter1/Control/Options/Core'
417 * '<S9>' : 'integ_Accel_and_Gyro/KF1/Kalman Filter1/Control/Options/P_prd_Assign'
418 * '<S10>' : 'integ_Accel_and_Gyro/KF1/Kalman Filter1/Control/Options/X_est_Assign'
419 * '<S11>' : 'integ_Accel_and_Gyro/KF1/Kalman Filter1/Control/Options/X_prd_Assign'
420 * '<S12>' : 'integ_Accel_and_Gyro/KF1/Kalman Filter1/Control/Options/Z_est_Assign'
421 * '<S13>' : 'integ_Accel_and_Gyro/KF1/Kalman Filter1/Control/Options/Core/LDL Solver'
422 * '<S14>' : 'integ_Accel_and_Gyro/KF1/Kalman Filter1/Control/Options/Core/LDL Solver/Check Signal Attributes'
423 * '<S15>' : 'integ_Accel_and_Gyro/KF1/Kalman Filter1/Control/Options/Core/LDL Solver/Check Signal Attributes1'
424 * '<S16>' : 'integ_Accel_and_Gyro/KF1/Kalman Filter1/Control/Options/Core/LDL Solver/Check Signal Attributes2'
425 * '<S17>' : 'integ_Accel_and_Gyro/MPU6050 sensor/MPU6050'
426 * '<S18>' : 'integ_Accel_and_Gyro/MPU6050 sensor/MPU6050/i2cRd'
427 * '<S19>' : 'integ_Accel_and_Gyro/MPU6050 sensor/MPU6050/i2cWr'
428 */
429#endif /* RTW_HEADER_integ_Accel_and_Gyro_h_ */
430
431/*
432 * File trailer for generated code.
433 *
434 * [EOF]
435 */
436