/*
 * Academic License - for use in teaching, academic research, and meeting
 * course requirements at degree granting institutions only.  Not for
 * government, commercial, or other organizational use.
 *
 * File: Labyrinth.h
 *
 * Code generated for Simulink model 'Labyrinth'.
 *
 * Model version                  : 1.1
 * Simulink Coder version         : 23.2 (R2023b) 01-Aug-2023
 * C/C++ source code generated on : Mon Jan  6 16:40:09 2025
 *
 * Target selection: ert.tlc
 * Embedded hardware selection: Atmel->AVR
 * Code generation objectives: Unspecified
 * Validation result: Not run
 */

#ifndef RTW_HEADER_Labyrinth_h_
#define RTW_HEADER_Labyrinth_h_
#ifndef Labyrinth_COMMON_INCLUDES_
#define Labyrinth_COMMON_INCLUDES_
#include "rtwtypes.h"
#include "rtw_extmode.h"
#include "sysran_types.h"
#include "rtw_continuous.h"
#include "rtw_solver.h"
#include "ext_mode.h"
#include "MW_arduino_digitalio.h"
#include "MW_PWM.h"
#include "MW_AnalogIn.h"
#endif                                 /* Labyrinth_COMMON_INCLUDES_ */

#include "Labyrinth_types.h"
#include "zero_crossing_types.h"
#include "MW_target_hardware_resources.h"

/* Macros for accessing real-time model data structure */
#ifndef rtmGetFinalTime
#define rtmGetFinalTime(rtm)           ((rtm)->Timing.tFinal)
#endif

#ifndef rtmGetRTWExtModeInfo
#define rtmGetRTWExtModeInfo(rtm)      ((rtm)->extModeInfo)
#endif

#ifndef rtmGetErrorStatus
#define rtmGetErrorStatus(rtm)         ((rtm)->errorStatus)
#endif

#ifndef rtmSetErrorStatus
#define rtmSetErrorStatus(rtm, val)    ((rtm)->errorStatus = (val))
#endif

#ifndef rtmGetStopRequested
#define rtmGetStopRequested(rtm)       ((rtm)->Timing.stopRequestedFlag)
#endif

#ifndef rtmSetStopRequested
#define rtmSetStopRequested(rtm, val)  ((rtm)->Timing.stopRequestedFlag = (val))
#endif

#ifndef rtmGetStopRequestedPtr
#define rtmGetStopRequestedPtr(rtm)    (&((rtm)->Timing.stopRequestedFlag))
#endif

#ifndef rtmGetT
#define rtmGetT(rtm)                   (rtmGetTPtr((rtm))[0])
#endif

#ifndef rtmGetTFinal
#define rtmGetTFinal(rtm)              ((rtm)->Timing.tFinal)
#endif

#ifndef rtmGetTPtr
#define rtmGetTPtr(rtm)                ((rtm)->Timing.t)
#endif

/* Block signals (default storage) */
typedef struct {
  real_T LED1rot;                      /* '<Root>/Labyrinth' */
  real_T LED1blau;                     /* '<Root>/Labyrinth' */
  real_T LED2rot;                      /* '<Root>/Labyrinth' */
  real_T LED2gruen;                    /* '<Root>/Labyrinth' */
  real_T LED3rot;                      /* '<Root>/Labyrinth' */
  real_T LED3gruen;                    /* '<Root>/Labyrinth' */
  real_T LED4rot;                      /* '<Root>/Labyrinth' */
  real_T LED4blau;                     /* '<Root>/Labyrinth' */
  uint16_T UnitDelay1;                 /* '<Root>/Unit Delay1' */
  uint16_T StartTimer;                 /* '<Root>/Labyrinth' */
  int8_T CLOCK;                        /* '<Root>/TimerBaustein' */
  int8_T inputevents[9];               /* '<Root>/Labyrinth' */
  boolean_T Compare;                   /* '<S4>/Compare' */
  boolean_T Compare_m;                 /* '<S5>/Compare' */
  boolean_T Timer;                     /* '<Root>/TimerBaustein' */
  boolean_T Timer_g;                   /* '<Root>/Timer' */
} B_Labyrinth_T;

/* Block states (default storage) for system '<Root>' */
typedef struct {
  codertarget_arduinobase_int_o_T obj; /* '<Root>/Taster4' */
  codertarget_arduinobase_int_o_T obj_l;/* '<Root>/Taster2' */
  codertarget_arduinobase_int_o_T obj_b;/* '<Root>/Taster1' */
  codertarget_arduinobase_int_o_T obj_p;/* '<Root>/Taster 3' */
  codertarget_arduinobase_blo_o_T obj_c;/* '<Root>/Timer' */
  codertarget_arduinobase_block_T obj_d;/* '<Root>/LED4rot' */
  codertarget_arduinobase_block_T obj_f;/* '<Root>/LED3rot' */
  codertarget_arduinobase_block_T obj_o;/* '<Root>/LED2rot' */
  codertarget_arduinobase_block_T obj_m;/* '<Root>/LED2gruen' */
  codertarget_arduinobase_block_T obj_fk;/* '<Root>/LED1rot' */
  codertarget_arduinobase_block_T obj_n;/* '<Root>/LED1blau' */
  codertarget_arduinobase_inter_T obj_e;/* '<Root>/PWM' */
  codertarget_arduinobase_inter_T obj_bs;/* '<Root>/LEED3gruen' */
  codertarget_arduinobase_inter_T obj_j;/* '<Root>/LED4blau' */
  real_T Frage;                        /* '<Root>/Labyrinth' */
  uint32_T is_c1_Labyrinth;            /* '<Root>/TimerBaustein' */
  uint32_T temporalCounter_i1;         /* '<Root>/TimerBaustein' */
  uint32_T is_c3_Labyrinth;            /* '<Root>/Labyrinth' */
  uint32_T is_FalscheAntwort;          /* '<Root>/Labyrinth' */
  uint16_T UnitDelay1_DSTATE;          /* '<Root>/Unit Delay1' */
  uint16_T timerValue;                 /* '<Root>/TimerBaustein' */
  int8_T TimerBaustein_SubsysRanBC;    /* '<Root>/TimerBaustein' */
  int8_T Labyrinth_SubsysRanBC;        /* '<Root>/Labyrinth' */
  uint8_T is_active_c1_Labyrinth;      /* '<Root>/TimerBaustein' */
  uint8_T is_active_c3_Labyrinth;      /* '<Root>/Labyrinth' */
} DW_Labyrinth_T;

/* Zero-crossing (trigger) state */
typedef struct {
  ZCSigState TimerBaustein_Trig_ZCE;   /* '<Root>/TimerBaustein' */
  ZCSigState Labyrinth_Trig_ZCE[9];    /* '<Root>/Labyrinth' */
} PrevZCX_Labyrinth_T;

/* Parameters (default storage) */
struct P_Labyrinth_T_ {
  real_T Taster3_SampleTime;           /* Expression: 0.001
                                        * Referenced by: '<Root>/Taster 3'
                                        */
  real_T Taster1_SampleTime;           /* Expression: 0.001
                                        * Referenced by: '<Root>/Taster1'
                                        */
  real_T Taster2_SampleTime;           /* Expression: 0.001
                                        * Referenced by: '<Root>/Taster2'
                                        */
  real_T Taster4_SampleTime;           /* Expression: 0.001
                                        * Referenced by: '<Root>/Taster4'
                                        */
  real_T Timer_SampleTime;             /* Expression: 0.001
                                        * Referenced by: '<Root>/Timer'
                                        */
  real_T Constant_Value;               /* Expression: 128
                                        * Referenced by: '<Root>/Constant'
                                        */
  uint16_T Constant_Value_m;           /* Computed Parameter: Constant_Value_m
                                        * Referenced by: '<S2>/Constant'
                                        */
  uint16_T Constant_Value_o;           /* Computed Parameter: Constant_Value_o
                                        * Referenced by: '<S3>/Constant'
                                        */
  uint16_T Constant_Value_l;           /* Computed Parameter: Constant_Value_l
                                        * Referenced by: '<S4>/Constant'
                                        */
  uint16_T Constant_Value_b;           /* Computed Parameter: Constant_Value_b
                                        * Referenced by: '<S5>/Constant'
                                        */
  uint16_T Constant_Value_g;           /* Computed Parameter: Constant_Value_g
                                        * Referenced by: '<S6>/Constant'
                                        */
  uint16_T Constant_Value_gl;          /* Computed Parameter: Constant_Value_gl
                                        * Referenced by: '<S7>/Constant'
                                        */
  uint16_T Constant_Value_i;           /* Computed Parameter: Constant_Value_i
                                        * Referenced by: '<S8>/Constant'
                                        */
  uint16_T Constant_Value_p;           /* Computed Parameter: Constant_Value_p
                                        * Referenced by: '<S9>/Constant'
                                        */
  uint16_T LookUp1_tableData[2];       /* Computed Parameter: LookUp1_tableData
                                        * Referenced by: '<Root>/LookUp1'
                                        */
  uint16_T LookUp1_bp01Data[2];        /* Computed Parameter: LookUp1_bp01Data
                                        * Referenced by: '<Root>/LookUp1'
                                        */
  uint16_T LookUp2_tableData[2];       /* Computed Parameter: LookUp2_tableData
                                        * Referenced by: '<Root>/LookUp2'
                                        */
  uint16_T LookUp2_bp01Data[2];        /* Computed Parameter: LookUp2_bp01Data
                                        * Referenced by: '<Root>/LookUp2'
                                        */
  uint16_T UnitDelay1_InitialCondition;
                              /* Computed Parameter: UnitDelay1_InitialCondition
                               * Referenced by: '<Root>/Unit Delay1'
                               */
  uint16_T LookUp3_tableData[2];       /* Computed Parameter: LookUp3_tableData
                                        * Referenced by: '<Root>/LookUp3'
                                        */
  uint16_T LookUp3_bp01Data[2];        /* Computed Parameter: LookUp3_bp01Data
                                        * Referenced by: '<Root>/LookUp3'
                                        */
  uint16_T LookUp4_tableData[2];       /* Computed Parameter: LookUp4_tableData
                                        * Referenced by: '<Root>/LookUp4'
                                        */
  uint16_T LookUp4_bp01Data[2];        /* Computed Parameter: LookUp4_bp01Data
                                        * Referenced by: '<Root>/LookUp4'
                                        */
};

/* Real-time Model Data Structure */
struct tag_RTM_Labyrinth_T {
  const char_T *errorStatus;
  RTWExtModeInfo *extModeInfo;
  RTWSolverInfo solverInfo;

  /*
   * Sizes:
   * The following substructure contains sizes information
   * for many of the model attributes such as inputs, outputs,
   * dwork, sample times, etc.
   */
  struct {
    uint32_T checksums[4];
  } Sizes;

  /*
   * SpecialInfo:
   * The following substructure contains special information
   * related to other components that are dependent on RTW.
   */
  struct {
    const void *mappingInfo;
  } SpecialInfo;

  /*
   * Timing:
   * The following substructure contains information regarding
   * the timing information for the model.
   */
  struct {
    uint32_T clockTick0;
    time_T stepSize0;
    uint32_T clockTick1;
    time_T tFinal;
    SimTimeStep simTimeStep;
    boolean_T stopRequestedFlag;
    time_T *t;
    time_T tArray[2];
  } Timing;
};

/* Block parameters (default storage) */
extern P_Labyrinth_T Labyrinth_P;

/* Block signals (default storage) */
extern B_Labyrinth_T Labyrinth_B;

/* Block states (default storage) */
extern DW_Labyrinth_T Labyrinth_DW;

/* Zero-crossing (trigger) state */
extern PrevZCX_Labyrinth_T Labyrinth_PrevZCX;

/* Model entry point functions */
extern void Labyrinth_initialize(void);
extern void Labyrinth_step(void);
extern void Labyrinth_terminate(void);

/* Real-time Model object */
extern RT_MODEL_Labyrinth_T *const Labyrinth_M;
extern volatile boolean_T stopRequested;
extern volatile boolean_T runModel;

/*-
 * These blocks were eliminated from the model due to optimizations:
 *
 * Block '<Root>/ ' : Unused code path elimination
 */

/*-
 * The generated code includes comments that allow you to trace directly
 * back to the appropriate location in the model.  The basic format
 * is <system>/block_name, where system is the system number (uniquely
 * assigned by Simulink) and block_name is the name of the block.
 *
 * Use the MATLAB hilite_system command to trace the generated code back
 * to the model.  For example,
 *
 * hilite_system('<S3>')    - opens system 3
 * hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
 *
 * Here is the system hierarchy for this model
 *
 * '<Root>' : 'Labyrinth'
 * '<S1>'   : 'Labyrinth/Labyrinth'
 * '<S2>'   : 'Labyrinth/Taster1Aus'
 * '<S3>'   : 'Labyrinth/Taster1Ein'
 * '<S4>'   : 'Labyrinth/Taster2Aus'
 * '<S5>'   : 'Labyrinth/Taster2Ein'
 * '<S6>'   : 'Labyrinth/Taster3Aus'
 * '<S7>'   : 'Labyrinth/Taster3Ein'
 * '<S8>'   : 'Labyrinth/Taster4Aus'
 * '<S9>'   : 'Labyrinth/Taster4Ein'
 * '<S10>'  : 'Labyrinth/TimerBaustein'
 */
#endif                                 /* RTW_HEADER_Labyrinth_h_ */

/*
 * File trailer for generated code.
 *
 * [EOF]
 */
