Test program for master controller

Dependencies:   Controller_Master mbed

Files at this revision

API Documentation at this revision

Comitter:
AndreaAndreoli
Date:
Sat Jun 04 18:28:02 2016 +0000
Parent:
0:ae1df001727e
Commit message:
put files into library

Changed in this revision

Controller_Master.c Show diff for this revision Revisions of this file
Controller_Master.h Show diff for this revision Revisions of this file
Controller_Master.lib Show annotated file Show diff for this revision Revisions of this file
rtwtypes.h Show diff for this revision Revisions of this file
--- a/Controller_Master.c	Sat Jun 04 16:58:50 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,581 +0,0 @@
-/*
- * 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: Controller_Master.c
- *
- * Code generated for Simulink model 'Controller_Master'.
- *
- * Model version                  : 1.0
- * Simulink Coder version         : 8.10 (R2016a) 10-Feb-2016
- * C/C++ source code generated on : Sat Jun 04 17:59:52 2016
- *
- * Target selection: ert.tlc
- * Embedded hardware selection: NXP->Cortex-M4
- * Code generation objectives: Unspecified
- * Validation result: Not run
- */
-
-#include "Controller_Master.h"
-
-/* Named constants for Chart: '<S1>/AEB' */
-#define Controller_M_IN_NO_ACTIVE_CHILD ((uint8_T)0U)
-#define Controller_Master_IN_ACTIVE    ((uint8_T)1U)
-#define Controller_Master_IN_BRAKE     ((uint8_T)1U)
-#define Controller_Master_IN_ERR       ((uint8_T)1U)
-#define Controller_Master_IN_IDLE      ((uint8_T)2U)
-#define Controller_Master_IN_OK        ((uint8_T)2U)
-#define Controller_Master_IN_READY     ((uint8_T)2U)
-#define Controller_Master_IN_WARNING   ((uint8_T)3U)
-
-/* Named constants for Chart: '<S1>/select_command' */
-#define Controller_Master_IN_BLINK     ((uint8_T)1U)
-#define Controller_Master_IN_BLINK_OFF ((uint8_T)1U)
-#define Controller_Master_IN_BLINK_ON  ((uint8_T)2U)
-#define Controller_Master_IN_OFF1      ((uint8_T)2U)
-#define Controller_Master_IN_ON        ((uint8_T)3U)
-
-/*===========*
- * Constants *
- *===========*/
-#define RT_PI                          3.14159265358979323846
-#define RT_PIF                         3.1415927F
-#define RT_LN_10                       2.30258509299404568402
-#define RT_LN_10F                      2.3025851F
-#define RT_LOG10E                      0.43429448190325182765
-#define RT_LOG10EF                     0.43429449F
-#define RT_E                           2.7182818284590452354
-#define RT_EF                          2.7182817F
-
-/*
- * UNUSED_PARAMETER(x)
- *   Used to specify that a function parameter (argument) is required but not
- *   accessed by the function body.
- */
-#ifndef UNUSED_PARAMETER
-# if defined(__LCC__)
-#   define UNUSED_PARAMETER(x)                                   /* do nothing */
-# else
-
-/*
- * This is the semi-ANSI standard way of indicating that an
- * unused function parameter is required.
- */
-#   define UNUSED_PARAMETER(x)         (void) (x)
-# endif
-#endif
-
-/* Model step function */
-void Controller_Master_step(RT_MODEL_Controller_Master_T *const
-  Controller_Master_M, real_T Controller_Master_U_V, real_T
-  Controller_Master_U_D_M, uint8_T Controller_Master_U_Slave, uint8_T
-  *Controller_Master_Y_BRAKE, uint8_T *Controller_Master_Y_LED_BLUE, uint8_T
-  *Controller_Master_Y_LED_RED, uint8_T *Controller_Master_Y_MASTER)
-{
-  B_Controller_Master_T *Controller_Master_B = ((B_Controller_Master_T *)
-    Controller_Master_M->ModelData.blockIO);
-  DW_Controller_Master_T *Controller_Master_DW = ((DW_Controller_Master_T *)
-    Controller_Master_M->ModelData.dwork);
-  real_T K;
-
-  /* Outputs for Atomic SubSystem: '<Root>/Controller_Master' */
-  /* Chart: '<S1>/AEB' incorporates:
-   *  Inport: '<Root>/D_M'
-   *  Inport: '<Root>/V'
-   *  Memory: '<S1>/Memory'
-   */
-  /* Gateway: Controller_Master/AEB */
-  /* During: Controller_Master/AEB */
-  if (Controller_Master_DW->is_active_c3_Controller_Master == 0U) {
-    /* Entry: Controller_Master/AEB */
-    Controller_Master_DW->is_active_c3_Controller_Master = 1U;
-
-    /* Entry Internal: Controller_Master/AEB */
-    /* Entry Internal 'AEB': '<S2>:35' */
-    /* Entry Internal 'ERRORS_CHECK_THREAD': '<S2>:33' */
-    /* Transition: '<S2>:38' */
-    Controller_Master_DW->is_ERRORS_CHECK_THREAD = Controller_Master_IN_OK;
-
-    /* Outport: '<Root>/LED_RED' */
-    /* Entry 'OK': '<S2>:37' */
-    /* '<S2>:37:1' Led_Red =uint8(0); */
-    *Controller_Master_Y_LED_RED = 0U;
-
-    /* Outport: '<Root>/MASTER' */
-    /* '<S2>:37:1' Master = uint8(1); */
-    *Controller_Master_Y_MASTER = 1U;
-
-    /* Entry Internal 'APPLICATION_THREAD': '<S2>:32' */
-    /* Transition: '<S2>:27' */
-    Controller_Master_DW->is_APPLICATION_THREAD = Controller_Master_IN_READY;
-
-    /* Outport: '<Root>/BRAKE' */
-    /* Entry 'READY': '<S2>:21' */
-    /* '<S2>:21:1' Brake = uint8(0); */
-    *Controller_Master_Y_BRAKE = 0U;
-
-    /* '<S2>:21:1' Led_Blue = 0; */
-    Controller_Master_B->Led_Blue = 0.0;
-  } else {
-    /* During 'AEB': '<S2>:35' */
-    /* During 'ERRORS_CHECK_THREAD': '<S2>:33' */
-    if (Controller_Master_DW->is_ERRORS_CHECK_THREAD != Controller_Master_IN_ERR)
-    {
-      /* During 'OK': '<S2>:37' */
-      /* '<S2>:46:1' sf_internal_predicateOutput = ... */
-      /* '<S2>:46:1' V > 180 || D > 200 || D < 0; */
-      if ((Controller_Master_U_V > 180.0) || (Controller_Master_U_D_M > 200.0) ||
-          (Controller_Master_U_D_M < 0.0)) {
-        /* Transition: '<S2>:46' */
-        Controller_Master_DW->is_ERRORS_CHECK_THREAD = Controller_Master_IN_ERR;
-
-        /* Outport: '<Root>/LED_RED' */
-        /* Entry 'ERR': '<S2>:42' */
-        /* '<S2>:42:1' Led_Red = uint8(1); */
-        *Controller_Master_Y_LED_RED = 1U;
-
-        /* Outport: '<Root>/MASTER' */
-        /* Entry 'SENSOR_ERR': '<S2>:39' */
-        /* '<S2>:39:1' Master = uint8(0) ; */
-        /* '<S2>:39:1' En = false; */
-        /* '<S2>:39:1' Brake = uint8(0); */
-        /* '<S2>:39:3' Led_Blue = 0; */
-        /* Entry 'MCU_ERR': '<S2>:40' */
-        /* '<S2>:40:1' Master = uint8(0) ; */
-        *Controller_Master_Y_MASTER = 0U;
-
-        /* '<S2>:40:1' En = false; */
-        Controller_Master_DW->En = false;
-
-        /* Outport: '<Root>/BRAKE' */
-        /* '<S2>:40:1' Brake = uint8(0); */
-        *Controller_Master_Y_BRAKE = 0U;
-
-        /* '<S2>:40:3' Led_Blue = 0; */
-        Controller_Master_B->Led_Blue = 0.0;
-      } else {
-        /* '<S2>:43:1' sf_internal_predicateOutput = ... */
-        /* '<S2>:43:1' D == 0; */
-        if (Controller_Master_U_D_M == 0.0) {
-          /* Transition: '<S2>:43' */
-          Controller_Master_DW->is_ERRORS_CHECK_THREAD =
-            Controller_Master_IN_ERR;
-
-          /* Outport: '<Root>/LED_RED' */
-          /* Entry 'ERR': '<S2>:42' */
-          /* '<S2>:42:1' Led_Red = uint8(1); */
-          *Controller_Master_Y_LED_RED = 1U;
-
-          /* Outport: '<Root>/MASTER' */
-          /* Entry 'SENSOR_ERR': '<S2>:39' */
-          /* '<S2>:39:1' Master = uint8(0) ; */
-          /* '<S2>:39:1' En = false; */
-          /* '<S2>:39:1' Brake = uint8(0); */
-          /* '<S2>:39:3' Led_Blue = 0; */
-          /* Entry 'MCU_ERR': '<S2>:40' */
-          /* '<S2>:40:1' Master = uint8(0) ; */
-          *Controller_Master_Y_MASTER = 0U;
-
-          /* '<S2>:40:1' En = false; */
-          Controller_Master_DW->En = false;
-
-          /* Outport: '<Root>/BRAKE' */
-          /* '<S2>:40:1' Brake = uint8(0); */
-          *Controller_Master_Y_BRAKE = 0U;
-
-          /* '<S2>:40:3' Led_Blue = 0; */
-          Controller_Master_B->Led_Blue = 0.0;
-        } else {
-          /* '<S2>:45:1' sf_internal_predicateOutput = ... */
-          /* '<S2>:45:1' Slave ~= 1; */
-          if (Controller_Master_DW->Memory_PreviousInput != 1) {
-            /* Transition: '<S2>:45' */
-            Controller_Master_DW->is_ERRORS_CHECK_THREAD =
-              Controller_Master_IN_ERR;
-
-            /* Outport: '<Root>/LED_RED' */
-            /* Entry 'ERR': '<S2>:42' */
-            /* '<S2>:42:1' Led_Red = uint8(1); */
-            *Controller_Master_Y_LED_RED = 1U;
-
-            /* Outport: '<Root>/MASTER' */
-            /* Entry 'SENSOR_ERR': '<S2>:39' */
-            /* '<S2>:39:1' Master = uint8(0) ; */
-            /* '<S2>:39:1' En = false; */
-            /* '<S2>:39:1' Brake = uint8(0); */
-            /* '<S2>:39:3' Led_Blue = 0; */
-            /* Entry 'MCU_ERR': '<S2>:40' */
-            /* '<S2>:40:1' Master = uint8(0) ; */
-            *Controller_Master_Y_MASTER = 0U;
-
-            /* '<S2>:40:1' En = false; */
-            Controller_Master_DW->En = false;
-
-            /* Outport: '<Root>/BRAKE' */
-            /* '<S2>:40:1' Brake = uint8(0); */
-            *Controller_Master_Y_BRAKE = 0U;
-
-            /* '<S2>:40:3' Led_Blue = 0; */
-            Controller_Master_B->Led_Blue = 0.0;
-          }
-        }
-      }
-    } else {
-      /* During 'ERR': '<S2>:42' */
-      /* During 'SENSOR_ERR': '<S2>:39' */
-      /* During 'MCU_ERR': '<S2>:40' */
-      /* During 'SLAVE_ERR': '<S2>:41' */
-    }
-
-    /* During 'APPLICATION_THREAD': '<S2>:32' */
-    if (Controller_Master_DW->is_APPLICATION_THREAD ==
-        Controller_Master_IN_ACTIVE) {
-      /* During 'ACTIVE': '<S2>:1' */
-      /* '<S2>:26:1' sf_internal_predicateOutput = ... */
-      /* '<S2>:26:1' En == false; */
-      if (!Controller_Master_DW->En) {
-        /* Transition: '<S2>:26' */
-        /* Exit Internal 'ACTIVE': '<S2>:1' */
-        Controller_Master_DW->is_ACTIVE = Controller_M_IN_NO_ACTIVE_CHILD;
-        Controller_Master_DW->is_APPLICATION_THREAD = Controller_Master_IN_READY;
-
-        /* Outport: '<Root>/BRAKE' */
-        /* Entry 'READY': '<S2>:21' */
-        /* '<S2>:21:1' Brake = uint8(0); */
-        *Controller_Master_Y_BRAKE = 0U;
-
-        /* '<S2>:21:1' Led_Blue = 0; */
-        Controller_Master_B->Led_Blue = 0.0;
-      } else {
-        /* '<S2>:1:1' K = (V^2)/D; */
-        K = Controller_Master_U_V * Controller_Master_U_V /
-          Controller_Master_U_D_M;
-        switch (Controller_Master_DW->is_ACTIVE) {
-         case Controller_Master_IN_BRAKE:
-          /* During 'BRAKE': '<S2>:3' */
-          /* '<S2>:10:1' sf_internal_predicateOutput = ... */
-          /* '<S2>:10:1' K < 100; */
-          if (K < 100.0) {
-            /* Transition: '<S2>:10' */
-            Controller_Master_DW->is_ACTIVE = Controller_Master_IN_WARNING;
-
-            /* Outport: '<Root>/BRAKE' */
-            /* Entry 'WARNING': '<S2>:5' */
-            /* '<S2>:5:1' Brake = uint8(0); */
-            *Controller_Master_Y_BRAKE = 0U;
-          }
-          break;
-
-         case Controller_Master_IN_IDLE:
-          /* During 'IDLE': '<S2>:6' */
-          /* '<S2>:12:1' sf_internal_predicateOutput = ... */
-          /* '<S2>:12:1' K >= 70; */
-          if (K >= 70.0) {
-            /* Transition: '<S2>:12' */
-            Controller_Master_DW->is_ACTIVE = Controller_Master_IN_WARNING;
-
-            /* Outport: '<Root>/BRAKE' */
-            /* Entry 'WARNING': '<S2>:5' */
-            /* '<S2>:5:1' Brake = uint8(0); */
-            *Controller_Master_Y_BRAKE = 0U;
-          }
-          break;
-
-         default:
-          /* During 'WARNING': '<S2>:5' */
-          /* '<S2>:9:1' sf_internal_predicateOutput = ... */
-          /* '<S2>:9:1' K  >= 100; */
-          if (K >= 100.0) {
-            /* Transition: '<S2>:9' */
-            Controller_Master_DW->is_ACTIVE = Controller_Master_IN_BRAKE;
-
-            /* Outport: '<Root>/BRAKE' */
-            /* Entry 'BRAKE': '<S2>:3' */
-            /* '<S2>:3:1' Brake = uint8(1); */
-            *Controller_Master_Y_BRAKE = 1U;
-
-            /* '<S2>:3:1' Led_Blue = 1; */
-            Controller_Master_B->Led_Blue = 1.0;
-          } else {
-            /* '<S2>:11:1' sf_internal_predicateOutput = ... */
-            /* '<S2>:11:1' K < 70; */
-            if (K < 70.0) {
-              /* Transition: '<S2>:11' */
-              Controller_Master_DW->is_ACTIVE = Controller_Master_IN_IDLE;
-
-              /* Outport: '<Root>/BRAKE' */
-              /* Entry 'IDLE': '<S2>:6' */
-              /* '<S2>:6:1' Brake = uint8(0); */
-              *Controller_Master_Y_BRAKE = 0U;
-
-              /* '<S2>:6:1' Led_Blue = 0; */
-              Controller_Master_B->Led_Blue = 0.0;
-            } else {
-              /* '<S2>:5:1' Led_Blue = (K-70)/30; */
-              Controller_Master_B->Led_Blue = (K - 70.0) / 30.0;
-            }
-          }
-          break;
-        }
-      }
-    } else {
-      /* During 'READY': '<S2>:21' */
-      /* '<S2>:23:1' sf_internal_predicateOutput = ... */
-      /* '<S2>:23:1' En == true; */
-      if (Controller_Master_DW->En) {
-        /* Transition: '<S2>:23' */
-        Controller_Master_DW->is_APPLICATION_THREAD =
-          Controller_Master_IN_ACTIVE;
-
-        /* Entry 'ACTIVE': '<S2>:1' */
-        /* '<S2>:1:1' K = (V^2)/D; */
-        /* Entry Internal 'ACTIVE': '<S2>:1' */
-        /* Transition: '<S2>:51' */
-        Controller_Master_DW->is_ACTIVE = Controller_Master_IN_IDLE;
-
-        /* Outport: '<Root>/BRAKE' */
-        /* Entry 'IDLE': '<S2>:6' */
-        /* '<S2>:6:1' Brake = uint8(0); */
-        *Controller_Master_Y_BRAKE = 0U;
-
-        /* '<S2>:6:1' Led_Blue = 0; */
-        Controller_Master_B->Led_Blue = 0.0;
-      }
-    }
-  }
-
-  /* End of Chart: '<S1>/AEB' */
-
-  /* Chart: '<S1>/select_command' */
-  if (Controller_Master_DW->temporalCounter_i1 < MAX_uint32_T) {
-    Controller_Master_DW->temporalCounter_i1++;
-  }
-
-  /* Gateway: Controller_Master/select_command */
-  /* During: Controller_Master/select_command */
-  if (Controller_Master_DW->is_active_c2_Controller_Master == 0U) {
-    /* Entry: Controller_Master/select_command */
-    Controller_Master_DW->is_active_c2_Controller_Master = 1U;
-
-    /* Entry Internal: Controller_Master/select_command */
-    /* Transition: '<S3>:2' */
-    Controller_Master_DW->is_c2_Controller_Master = Controller_Master_IN_OFF1;
-
-    /* Outport: '<Root>/LED_BLUE' */
-    /* Entry 'OFF1': '<S3>:3' */
-    /* '<S3>:3:1' led = uint8(0); */
-    *Controller_Master_Y_LED_BLUE = 0U;
-  } else {
-    switch (Controller_Master_DW->is_c2_Controller_Master) {
-     case Controller_Master_IN_BLINK:
-      /* During 'BLINK': '<S3>:20' */
-      /* '<S3>:7:1' sf_internal_predicateOutput = ... */
-      /* '<S3>:7:1' enable == 1; */
-      if (Controller_Master_B->Led_Blue == 1.0) {
-        /* Transition: '<S3>:7' */
-        /* Exit Internal 'BLINK': '<S3>:20' */
-        Controller_Master_DW->is_BLINK = Controller_M_IN_NO_ACTIVE_CHILD;
-        Controller_Master_DW->is_c2_Controller_Master = Controller_Master_IN_ON;
-
-        /* Outport: '<Root>/LED_BLUE' */
-        /* Entry 'ON': '<S3>:6' */
-        /* '<S3>:6:1' led = uint8(1); */
-        *Controller_Master_Y_LED_BLUE = 1U;
-      } else {
-        /* '<S3>:21:1' sf_internal_predicateOutput = ... */
-        /* '<S3>:21:1' enable == 0; */
-        if (Controller_Master_B->Led_Blue == 0.0) {
-          /* Transition: '<S3>:21' */
-          /* Exit Internal 'BLINK': '<S3>:20' */
-          Controller_Master_DW->is_BLINK = Controller_M_IN_NO_ACTIVE_CHILD;
-          Controller_Master_DW->is_c2_Controller_Master =
-            Controller_Master_IN_OFF1;
-
-          /* Outport: '<Root>/LED_BLUE' */
-          /* Entry 'OFF1': '<S3>:3' */
-          /* '<S3>:3:1' led = uint8(0); */
-          *Controller_Master_Y_LED_BLUE = 0U;
-        } else if (Controller_Master_DW->is_BLINK ==
-                   Controller_Master_IN_BLINK_OFF) {
-          /* During 'BLINK_OFF': '<S3>:11' */
-          /* '<S3>:14:1' sf_internal_predicateOutput = ... */
-          /* '<S3>:14:1' after(1-enable,sec); */
-          if (Controller_Master_DW->temporalCounter_i1 >= (uint32_T)ceil((1.0 -
-                Controller_Master_B->Led_Blue) / 0.2 - 2.0E-9)) {
-            /* Transition: '<S3>:14' */
-            Controller_Master_DW->is_BLINK = Controller_Master_IN_BLINK_ON;
-            Controller_Master_DW->temporalCounter_i1 = 0U;
-
-            /* Outport: '<Root>/LED_BLUE' */
-            /* Entry 'BLINK_ON': '<S3>:13' */
-            /* '<S3>:13:1' led = uint8(1); */
-            *Controller_Master_Y_LED_BLUE = 1U;
-          }
-        } else {
-          /* During 'BLINK_ON': '<S3>:13' */
-          /* '<S3>:15:1' sf_internal_predicateOutput = ... */
-          /* '<S3>:15:1' after(0.1,sec); */
-          if (Controller_Master_DW->temporalCounter_i1 >= 1U) {
-            /* Transition: '<S3>:15' */
-            Controller_Master_DW->is_BLINK = Controller_Master_IN_BLINK_OFF;
-            Controller_Master_DW->temporalCounter_i1 = 0U;
-
-            /* Outport: '<Root>/LED_BLUE' */
-            /* Entry 'BLINK_OFF': '<S3>:11' */
-            /* '<S3>:11:1' led = uint8(0); */
-            *Controller_Master_Y_LED_BLUE = 0U;
-          }
-        }
-      }
-      break;
-
-     case Controller_Master_IN_OFF1:
-      /* During 'OFF1': '<S3>:3' */
-      /* '<S3>:22:1' sf_internal_predicateOutput = ... */
-      /* '<S3>:22:1' enable == 1; */
-      if (Controller_Master_B->Led_Blue == 1.0) {
-        /* Transition: '<S3>:22' */
-        Controller_Master_DW->is_c2_Controller_Master = Controller_Master_IN_ON;
-
-        /* Outport: '<Root>/LED_BLUE' */
-        /* Entry 'ON': '<S3>:6' */
-        /* '<S3>:6:1' led = uint8(1); */
-        *Controller_Master_Y_LED_BLUE = 1U;
-      } else {
-        /* '<S3>:12:1' sf_internal_predicateOutput = ... */
-        /* '<S3>:12:1' enable >0 && enable <1; */
-        if ((Controller_Master_B->Led_Blue > 0.0) &&
-            (Controller_Master_B->Led_Blue < 1.0)) {
-          /* Transition: '<S3>:12' */
-          Controller_Master_DW->is_c2_Controller_Master =
-            Controller_Master_IN_BLINK;
-
-          /* Entry Internal 'BLINK': '<S3>:20' */
-          /* Transition: '<S3>:24' */
-          Controller_Master_DW->is_BLINK = Controller_Master_IN_BLINK_OFF;
-          Controller_Master_DW->temporalCounter_i1 = 0U;
-
-          /* Outport: '<Root>/LED_BLUE' */
-          /* Entry 'BLINK_OFF': '<S3>:11' */
-          /* '<S3>:11:1' led = uint8(0); */
-          *Controller_Master_Y_LED_BLUE = 0U;
-        }
-      }
-      break;
-
-     default:
-      /* During 'ON': '<S3>:6' */
-      /* '<S3>:4:1' sf_internal_predicateOutput = ... */
-      /* '<S3>:4:1' enable == 0; */
-      if (Controller_Master_B->Led_Blue == 0.0) {
-        /* Transition: '<S3>:4' */
-        Controller_Master_DW->is_c2_Controller_Master =
-          Controller_Master_IN_OFF1;
-
-        /* Outport: '<Root>/LED_BLUE' */
-        /* Entry 'OFF1': '<S3>:3' */
-        /* '<S3>:3:1' led = uint8(0); */
-        *Controller_Master_Y_LED_BLUE = 0U;
-      } else {
-        /* '<S3>:23:1' sf_internal_predicateOutput = ... */
-        /* '<S3>:23:1' enable >0 && enable <1; */
-        if ((Controller_Master_B->Led_Blue > 0.0) &&
-            (Controller_Master_B->Led_Blue < 1.0)) {
-          /* Transition: '<S3>:23' */
-          Controller_Master_DW->is_c2_Controller_Master =
-            Controller_Master_IN_BLINK;
-
-          /* Entry Internal 'BLINK': '<S3>:20' */
-          /* Transition: '<S3>:24' */
-          Controller_Master_DW->is_BLINK = Controller_Master_IN_BLINK_OFF;
-          Controller_Master_DW->temporalCounter_i1 = 0U;
-
-          /* Outport: '<Root>/LED_BLUE' */
-          /* Entry 'BLINK_OFF': '<S3>:11' */
-          /* '<S3>:11:1' led = uint8(0); */
-          *Controller_Master_Y_LED_BLUE = 0U;
-        }
-      }
-      break;
-    }
-  }
-
-  /* End of Chart: '<S1>/select_command' */
-
-  /* Update for Memory: '<S1>/Memory' incorporates:
-   *  Update for Inport: '<Root>/SLAVE'
-   */
-  Controller_Master_DW->Memory_PreviousInput = Controller_Master_U_Slave;
-
-  /* End of Outputs for SubSystem: '<Root>/Controller_Master' */
-}
-
-/* Model initialize function */
-void Controller_Master_initialize(RT_MODEL_Controller_Master_T *const
-  Controller_Master_M, real_T *Controller_Master_U_V, real_T
-  *Controller_Master_U_D_M, uint8_T *Controller_Master_U_Slave, uint8_T
-  *Controller_Master_Y_BRAKE, uint8_T *Controller_Master_Y_LED_BLUE, uint8_T
-  *Controller_Master_Y_LED_RED, uint8_T *Controller_Master_Y_MASTER)
-{
-  DW_Controller_Master_T *Controller_Master_DW = ((DW_Controller_Master_T *)
-    Controller_Master_M->ModelData.dwork);
-  B_Controller_Master_T *Controller_Master_B = ((B_Controller_Master_T *)
-    Controller_Master_M->ModelData.blockIO);
-
-  /* Registration code */
-
-  /* block I/O */
-  (void) memset(((void *) Controller_Master_B), 0,
-                sizeof(B_Controller_Master_T));
-
-  /* states (dwork) */
-  (void) memset((void *)Controller_Master_DW, 0,
-                sizeof(DW_Controller_Master_T));
-
-  /* external inputs */
-  (*Controller_Master_U_V) = 0.0;
-  (*Controller_Master_U_D_M) = 0.0;
-  (*Controller_Master_U_Slave) = 0U;
-
-  /* external outputs */
-  (*Controller_Master_Y_BRAKE) = 0U;
-  (*Controller_Master_Y_LED_BLUE) = 0U;
-  (*Controller_Master_Y_LED_RED) = 0U;
-  (*Controller_Master_Y_MASTER) = 0U;
-
-  /* SystemInitialize for Atomic SubSystem: '<Root>/Controller_Master' */
-  /* InitializeConditions for Memory: '<S1>/Memory' */
-  Controller_Master_DW->Memory_PreviousInput = 1U;
-
-  /* SystemInitialize for Chart: '<S1>/AEB' */
-  Controller_Master_DW->is_APPLICATION_THREAD = Controller_M_IN_NO_ACTIVE_CHILD;
-  Controller_Master_DW->is_ACTIVE = Controller_M_IN_NO_ACTIVE_CHILD;
-  Controller_Master_DW->is_ERRORS_CHECK_THREAD = Controller_M_IN_NO_ACTIVE_CHILD;
-  Controller_Master_DW->is_active_c3_Controller_Master = 0U;
-  Controller_Master_DW->En = true;
-
-  /* SystemInitialize for Chart: '<S1>/select_command' */
-  Controller_Master_DW->is_BLINK = Controller_M_IN_NO_ACTIVE_CHILD;
-  Controller_Master_DW->temporalCounter_i1 = 0U;
-  Controller_Master_DW->is_active_c2_Controller_Master = 0U;
-  Controller_Master_DW->is_c2_Controller_Master =
-    Controller_M_IN_NO_ACTIVE_CHILD;
-
-  /* End of SystemInitialize for SubSystem: '<Root>/Controller_Master' */
-}
-
-/* Model terminate function */
-void Controller_Master_terminate(RT_MODEL_Controller_Master_T *const
-  Controller_Master_M)
-{
-  /* (no terminate code required) */
-  UNUSED_PARAMETER(Controller_Master_M);
-}
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */
-
--- a/Controller_Master.h	Sat Jun 04 16:58:50 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-/*
- * 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: Controller_Master.h
- *
- * Code generated for Simulink model 'Controller_Master'.
- *
- * Model version                  : 1.0
- * Simulink Coder version         : 8.10 (R2016a) 10-Feb-2016
- * C/C++ source code generated on : Sat Jun 04 17:59:52 2016
- *
- * Target selection: ert.tlc
- * Embedded hardware selection: NXP->Cortex-M4
- * Code generation objectives: Unspecified
- * Validation result: Not run
- */
-
-#ifndef RTW_HEADER_Controller_Master_h_
-#define RTW_HEADER_Controller_Master_h_
-#include <math.h>
-#include <string.h>
-#ifndef Controller_Master_COMMON_INCLUDES_
-# define Controller_Master_COMMON_INCLUDES_
-#include "rtwtypes.h"
-#endif                                 /* Controller_Master_COMMON_INCLUDES_ */
-
-/* Macros for accessing real-time model data structure */
-#ifndef rtmGetErrorStatus
-# define rtmGetErrorStatus(rtm)        ((rtm)->errorStatus)
-#endif
-
-#ifndef rtmSetErrorStatus
-# define rtmSetErrorStatus(rtm, val)   ((rtm)->errorStatus = (val))
-#endif
-
-/* Forward declaration for rtModel */
-typedef struct tag_RTM_Controller_Master_T RT_MODEL_Controller_Master_T;
-
-/* Block signals (auto storage) */
-typedef struct {
-  real_T Led_Blue;                     /* '<S1>/AEB' */
-} B_Controller_Master_T;
-
-/* Block states (auto storage) for system '<Root>' */
-typedef struct {
-  uint32_T temporalCounter_i1;         /* '<S1>/select_command' */
-  uint8_T Memory_PreviousInput;        /* '<S1>/Memory' */
-  uint8_T is_active_c2_Controller_Master;/* '<S1>/select_command' */
-  uint8_T is_c2_Controller_Master;     /* '<S1>/select_command' */
-  uint8_T is_BLINK;                    /* '<S1>/select_command' */
-  uint8_T is_active_c3_Controller_Master;/* '<S1>/AEB' */
-  uint8_T is_ERRORS_CHECK_THREAD;      /* '<S1>/AEB' */
-  uint8_T is_APPLICATION_THREAD;       /* '<S1>/AEB' */
-  uint8_T is_ACTIVE;                   /* '<S1>/AEB' */
-  boolean_T En;                        /* '<S1>/AEB' */
-} DW_Controller_Master_T;
-
-/* Real-time Model Data Structure */
-struct tag_RTM_Controller_Master_T {
-  const char_T * volatile errorStatus;
-
-  /*
-   * ModelData:
-   * The following substructure contains information regarding
-   * the data used in the model.
-   */
-  struct {
-    B_Controller_Master_T *blockIO;
-    DW_Controller_Master_T *dwork;
-  } ModelData;
-};
-
-/* Model entry point functions */
-extern void Controller_Master_initialize(RT_MODEL_Controller_Master_T *const
-  Controller_Master_M, real_T *Controller_Master_U_V, real_T
-  *Controller_Master_U_D_M, uint8_T *Controller_Master_U_Slave, uint8_T
-  *Controller_Master_Y_BRAKE, uint8_T *Controller_Master_Y_LED_BLUE, uint8_T
-  *Controller_Master_Y_LED_RED, uint8_T *Controller_Master_Y_MASTER);
-extern void Controller_Master_step(RT_MODEL_Controller_Master_T *const
-  Controller_Master_M, real_T Controller_Master_U_V, real_T
-  Controller_Master_U_D_M, uint8_T Controller_Master_U_Slave, uint8_T
-  *Controller_Master_Y_BRAKE, uint8_T *Controller_Master_Y_LED_BLUE, uint8_T
-  *Controller_Master_Y_LED_RED, uint8_T *Controller_Master_Y_MASTER);
-extern void Controller_Master_terminate(RT_MODEL_Controller_Master_T *const
-  Controller_Master_M);
-
-/*-
- * 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.
- *
- * Note that this particular code originates from a subsystem build,
- * and has its own system numbers different from the parent model.
- * Refer to the system hierarchy for this subsystem below, and use the
- * MATLAB hilite_system command to trace the generated code back
- * to the parent model.  For example,
- *
- * hilite_system('untitled/Controller/Controller_Master')    - opens subsystem untitled/Controller/Controller_Master
- * hilite_system('untitled/Controller/Controller_Master/Kp') - opens and selects block Kp
- *
- * Here is the system hierarchy for this model
- *
- * '<Root>' : 'untitled/Controller'
- * '<S1>'   : 'untitled/Controller/Controller_Master'
- * '<S2>'   : 'untitled/Controller/Controller_Master/AEB'
- * '<S3>'   : 'untitled/Controller/Controller_Master/select_command'
- */
-#endif                                 /* RTW_HEADER_Controller_Master_h_ */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Controller_Master.lib	Sat Jun 04 18:28:02 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/MBSD_assignment/code/Controller_Master/#8e9e8bee3cf4
--- a/rtwtypes.h	Sat Jun 04 16:58:50 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/*
- * 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: rtwtypes.h
- *
- * Code generated for Simulink model 'Controller_Master'.
- *
- * Model version                  : 1.0
- * Simulink Coder version         : 8.10 (R2016a) 10-Feb-2016
- * C/C++ source code generated on : Sat Jun 04 17:59:52 2016
- *
- * Target selection: ert.tlc
- * Embedded hardware selection: NXP->Cortex-M4
- * Code generation objectives: Unspecified
- * Validation result: Not run
- */
-
-#ifndef RTWTYPES_H
-#define RTWTYPES_H
-
-/* Logical type definitions */
-#if (!defined(__cplusplus))
-#  ifndef false
-#   define false                       (0U)
-#  endif
-
-#  ifndef true
-#   define true                        (1U)
-#  endif
-#endif
-
-/*=======================================================================*
- * Target hardware information
- *   Device type: NXP->Cortex-M4
- *   Number of bits:     char:   8    short:   16    int:  32
- *                       long:  32
- *                       native word size:  32
- *   Byte ordering: LittleEndian
- *   Signed integer division rounds to: Zero
- *   Shift right on a signed integer as arithmetic shift: on
- *=======================================================================*/
-
-/*=======================================================================*
- * Fixed width word size data types:                                     *
- *   int8_T, int16_T, int32_T     - signed 8, 16, or 32 bit integers     *
- *   uint8_T, uint16_T, uint32_T  - unsigned 8, 16, or 32 bit integers   *
- *   real32_T, real64_T           - 32 and 64 bit floating point numbers *
- *=======================================================================*/
-typedef signed char int8_T;
-typedef unsigned char uint8_T;
-typedef short int16_T;
-typedef unsigned short uint16_T;
-typedef int int32_T;
-typedef unsigned int uint32_T;
-typedef float real32_T;
-typedef double real64_T;
-
-/*===========================================================================*
- * Generic type definitions: boolean_T, char_T, byte_T, int_T, uint_T,       *
- *                           real_T, time_T, ulong_T.                        *
- *===========================================================================*/
-typedef double real_T;
-typedef double time_T;
-typedef unsigned char boolean_T;
-typedef int int_T;
-typedef unsigned int uint_T;
-typedef unsigned long ulong_T;
-typedef char char_T;
-typedef unsigned char uchar_T;
-typedef char_T byte_T;
-
-/*===========================================================================*
- * Complex number type definitions                                           *
- *===========================================================================*/
-#define CREAL_T
-
-typedef struct {
-  real32_T re;
-  real32_T im;
-} creal32_T;
-
-typedef struct {
-  real64_T re;
-  real64_T im;
-} creal64_T;
-
-typedef struct {
-  real_T re;
-  real_T im;
-} creal_T;
-
-#define CINT8_T
-
-typedef struct {
-  int8_T re;
-  int8_T im;
-} cint8_T;
-
-#define CUINT8_T
-
-typedef struct {
-  uint8_T re;
-  uint8_T im;
-} cuint8_T;
-
-#define CINT16_T
-
-typedef struct {
-  int16_T re;
-  int16_T im;
-} cint16_T;
-
-#define CUINT16_T
-
-typedef struct {
-  uint16_T re;
-  uint16_T im;
-} cuint16_T;
-
-#define CINT32_T
-
-typedef struct {
-  int32_T re;
-  int32_T im;
-} cint32_T;
-
-#define CUINT32_T
-
-typedef struct {
-  uint32_T re;
-  uint32_T im;
-} cuint32_T;
-
-/*=======================================================================*
- * Min and Max:                                                          *
- *   int8_T, int16_T, int32_T     - signed 8, 16, or 32 bit integers     *
- *   uint8_T, uint16_T, uint32_T  - unsigned 8, 16, or 32 bit integers   *
- *=======================================================================*/
-#define MAX_int8_T                     ((int8_T)(127))
-#define MIN_int8_T                     ((int8_T)(-128))
-#define MAX_uint8_T                    ((uint8_T)(255U))
-#define MAX_int16_T                    ((int16_T)(32767))
-#define MIN_int16_T                    ((int16_T)(-32768))
-#define MAX_uint16_T                   ((uint16_T)(65535U))
-#define MAX_int32_T                    ((int32_T)(2147483647))
-#define MIN_int32_T                    ((int32_T)(-2147483647-1))
-#define MAX_uint32_T                   ((uint32_T)(0xFFFFFFFFU))
-
-/* Block D-Work pointer type */
-typedef void * pointer_T;
-
-#endif                                 /* RTWTYPES_H */
-
-/*
- * File trailer for generated code.
- *
- * [EOF]
- */
-