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: ert_main.c |
7 | * |
8 | * Code generated for Simulink model 'TEMP_SPI'. |
9 | * |
10 | * Model version : 1.3 |
11 | * Simulink Coder version : 8.12 (R2017a) 16-Feb-2017 |
12 | * C/C++ source code generated on : Mon Jan 08 21:01:45 2018 |
13 | * |
14 | * Target selection: ert.tlc |
15 | * Embedded hardware selection: Atmel->AVR |
16 | * Code generation objectives: Unspecified |
17 | * Validation result: Not run |
18 | */ |
19 | |
20 | #include "TEMP_SPI.h" |
21 | #include "rtwtypes.h" |
22 | |
23 | volatile int IsrOverrun = 0; |
24 | static boolean_T OverrunFlag = 0; |
25 | void rt_OneStep(void) |
26 | { |
27 | /* Check for overrun. Protect OverrunFlag against preemption */ |
28 | if (OverrunFlag++) { |
29 | IsrOverrun = 1; |
30 | OverrunFlag--; |
31 | return; |
32 | } |
33 | |
34 | #ifndef _MW_ARDUINO_LOOP_ |
35 | |
36 | sei(); |
37 | |
38 | #endif; |
39 | |
40 | TEMP_SPI_step(); |
41 | |
42 | /* Get model outputs here */ |
43 | #ifndef _MW_ARDUINO_LOOP_ |
44 | |
45 | cli(); |
46 | |
47 | #endif; |
48 | |
49 | OverrunFlag--; |
50 | } |
51 | |
52 | int main(void) |
53 | { |
54 | volatile boolean_T runModel = 1; |
55 | float modelBaseRate = 0.2; |
56 | float systemClock = 0; |
57 | init(); |
58 | MW_Arduino_Init(); |
59 | rtmSetErrorStatus(TEMP_SPI_M, 0); |
60 | TEMP_SPI_initialize(); |
61 | configureArduinoAVRTimer(); |
62 | runModel = |
63 | rtmGetErrorStatus(TEMP_SPI_M) == (NULL); |
64 | |
65 | #ifndef _MW_ARDUINO_LOOP_ |
66 | |
67 | sei(); |
68 | |
69 | #endif; |
70 | |
71 | sei(); |
72 | while (runModel) { |
73 | runModel = |
74 | rtmGetErrorStatus(TEMP_SPI_M) == (NULL); |
75 | runModel = runModel && MW_Arduino_Loop(); |
76 | } |
77 | |
78 | /* Disable rt_OneStep() here */ |
79 | |
80 | /* Terminate model */ |
81 | TEMP_SPI_terminate(); |
82 | cli(); |
83 | return 0; |
84 | } |
85 | |
86 | /* |
87 | * File trailer for generated code. |
88 | * |
89 | * [EOF] |
90 | */ |
91 |