/*
 * File: TouchBoardXY_handle_4ms.c
 *
 * Code generated for Simulink model 'P417_SWTL_App'.
 *
 * Model version                  : 1.148
 * Simulink Coder version         : 8.13 (R2017b) 24-Jul-2017
 * C/C++ source code generated on : Tue Dec 20 16:43:44 2022
 *
 * Target selection: ert.tlc
 * Embedded hardware selection: Intel->x86-64 (Windows64)
 * Code generation objectives: Unspecified
 * Validation result: Not run
 */

#include "TouchBoardXY_handle_4ms.h"

/* Include model header file for global data */
#include "P417_SWTL_App.h"
#include "P417_SWTL_App_private.h"

/* System initialize for function-call system: '<S2>/TouchBoardXY_handle_4ms' */
void P4_TouchBoardXY_handle_4ms_Init(uint8_T *rty_TouchBoard_XY_Sts_after_han,
  uint8_T *rty_XY_Touch_And_Below_1N_af_hd, DW_TouchBoardXY_handle_4ms_P4_T
  *localDW)
{
  /* SystemInitialize for Chart: '<S39>/Value_Debounce_Chart' */
  P417__Value_Debounce_Chart_Init(rty_TouchBoard_XY_Sts_after_han,
    &localDW->sf_Value_Debounce_Chart);

  /* SystemInitialize for Chart: '<S40>/Value_Debounce_Chart' */
  P417__Value_Debounce_Chart_Init(rty_XY_Touch_And_Below_1N_af_hd,
    &localDW->sf_Value_Debounce_Chart_i);
}

/* Output and update for function-call system: '<S2>/TouchBoardXY_handle_4ms' */
void P417_SW_TouchBoardXY_handle_4ms(uint8_T rtu_TouchBoard_XY_Sts_input,
  uint8_T rtu_XY_Touch_And_Below_1N, uint8_T *rty_TouchBoard_XY_Sts_after_han,
  uint8_T *rty_XY_Touch_And_Below_1N_af_hd, DW_TouchBoardXY_handle_4ms_P4_T
  *localDW)
{
  /* Chart: '<S39>/Value_Debounce_Chart' incorporates:
   *  RelationalOperator: '<S41>/FixPt Relational Operator'
   *  UnitDelay: '<S41>/Delay Input1'
   *
   * Block description for '<S41>/Delay Input1':
   *
   *  Store in Global RAM
   */
  P417_SWTL__Value_Debounce_Chart(rtu_TouchBoard_XY_Sts_input, (uint8_T)
    (rtu_TouchBoard_XY_Sts_input != localDW->DelayInput1_DSTATE),
    rty_TouchBoard_XY_Sts_after_han, &localDW->sf_Value_Debounce_Chart, 3U);

  /* Chart: '<S40>/Value_Debounce_Chart' incorporates:
   *  RelationalOperator: '<S43>/FixPt Relational Operator'
   *  UnitDelay: '<S43>/Delay Input1'
   *
   * Block description for '<S43>/Delay Input1':
   *
   *  Store in Global RAM
   */
  P417_SWTL__Value_Debounce_Chart(rtu_XY_Touch_And_Below_1N, (uint8_T)
    (rtu_XY_Touch_And_Below_1N != localDW->DelayInput1_DSTATE_m),
    rty_XY_Touch_And_Below_1N_af_hd, &localDW->sf_Value_Debounce_Chart_i, 12U);

  /* Update for UnitDelay: '<S41>/Delay Input1'
   *
   * Block description for '<S41>/Delay Input1':
   *
   *  Store in Global RAM
   */
  localDW->DelayInput1_DSTATE = rtu_TouchBoard_XY_Sts_input;

  /* Update for UnitDelay: '<S43>/Delay Input1'
   *
   * Block description for '<S43>/Delay Input1':
   *
   *  Store in Global RAM
   */
  localDW->DelayInput1_DSTATE_m = rtu_XY_Touch_And_Below_1N;
}

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