ESP8266 Treppenlichtsteuerung mit OTA zum Firmware Upload
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ert_main.cpp 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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.cpp
  7. //
  8. // Code generated for Simulink model 'FSMTreppe'.
  9. //
  10. // Model version : 1.65
  11. // Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
  12. // C/C++ source code generated on : Tue Sep 7 08:47:00 2021
  13. //
  14. // Target selection: ert.tlc
  15. // Embedded hardware selection: ARM Compatible->ARM Cortex-M
  16. // Code generation objectives: Unspecified
  17. // Validation result: Not run
  18. //
  19. #include <stddef.h>
  20. #include <stdio.h> // This ert_main.c example uses printf/fflush
  21. #include "FSMTreppe.h" // Model's header file
  22. #include "rtwtypes.h"
  23. static FSMTreppeModelClass FSMTreppe_Obj;// Instance of model class
  24. //
  25. // Associating rt_OneStep with a real-time clock or interrupt service routine
  26. // is what makes the generated code "real-time". The function rt_OneStep is
  27. // always associated with the base rate of the model. Subrates are managed
  28. // by the base rate from inside the generated code. Enabling/disabling
  29. // interrupts and floating point context switches are target specific. This
  30. // example code indicates where these should take place relative to executing
  31. // the generated code step function. Overrun behavior should be tailored to
  32. // your application needs. This example simply sets an error status in the
  33. // real-time model and returns from rt_OneStep.
  34. //
  35. void rt_OneStep(void);
  36. void rt_OneStep(void)
  37. {
  38. static boolean_T OverrunFlag = false;
  39. // Disable interrupts here
  40. // Check for overrun
  41. if (OverrunFlag) {
  42. rtmSetErrorStatus(FSMTreppe_Obj.getRTM(), "Overrun");
  43. return;
  44. }
  45. OverrunFlag = true;
  46. // Save FPU context here (if necessary)
  47. // Re-enable timer or interrupt here
  48. // Set model inputs here
  49. // Step the model
  50. FSMTreppe_Obj.step();
  51. // Get model outputs here
  52. // Indicate task complete
  53. OverrunFlag = false;
  54. // Disable interrupts here
  55. // Restore FPU context here (if necessary)
  56. // Enable interrupts here
  57. }
  58. //
  59. // The example "main" function illustrates what is required by your
  60. // application code to initialize, execute, and terminate the generated code.
  61. // Attaching rt_OneStep to a real-time clock is target specific. This example
  62. // illustrates how you do this relative to initializing the model.
  63. //
  64. int_T main(int_T argc, const char *argv[])
  65. {
  66. // Unused arguments
  67. (void)(argc);
  68. (void)(argv);
  69. // Initialize model
  70. FSMTreppe_Obj.initialize();
  71. // Attach rt_OneStep to a timer or interrupt service routine with
  72. // period 0.01 seconds (the model's base sample time) here. The
  73. // call syntax for rt_OneStep is
  74. //
  75. // rt_OneStep();
  76. printf("Warning: The simulation will run forever. "
  77. "Generated ERT main won't simulate model step behavior. "
  78. "To change this behavior select the 'MAT-file logging' option.\n");
  79. fflush((NULL));
  80. while (rtmGetErrorStatus(FSMTreppe_Obj.getRTM()) == (NULL)) {
  81. // Perform other application tasks here
  82. }
  83. // Disable rt_OneStep() here
  84. // Terminate model
  85. FSMTreppe_Obj.terminate();
  86. return 0;
  87. }
  88. //
  89. // File trailer for generated code.
  90. //
  91. // [EOF]
  92. //