/*
 * File: untitledf28388.c
 *
 * Code generated for Simulink model 'untitledf28388'.
 *
 * Model version                  : 1.4
 * Simulink Coder version         : 9.5 (R2021a) 14-Nov-2020
 * C/C++ source code generated on : Sun Jan  2 15:48:33 2022
 *
 * Target selection: ert.tlc
 * Embedded hardware selection: Texas Instruments->C2000
 * Code generation objectives: Unspecified
 * Validation result: Not run
 */

#include "untitledf28388.h"
#include "untitledf28388_private.h"

/* Real-time model */
static RT_MODEL_untitledf28388_T untitledf28388_M_;
RT_MODEL_untitledf28388_T *const untitledf28388_M = &untitledf28388_M_;

/* Model step function */
void untitledf28388_step(void)
{
  /* S-Function (c280xgpio_do): '<Root>/Digital Output' incorporates:
   *  Constant: '<Root>/Constant'
   */
  {
    GpioDataRegs.GPBTOGGLE.bit.GPIO49 = (untitledf28388_P.Constant_Value != 0);
  }

  /* S-Function (c280xcanxmt): '<Root>/eCAN Transmit' incorporates:
   *  Constant: '<Root>/Constant1'
   */
  {
    unsigned char ucTXMsgData[1];
    ucTXMsgData[0] = (untitledf28388_P.Constant1_Value);
    CAN_sendMessage(CANA_BASE, 2, 1, (uint16_T*)ucTXMsgData);
  }
}

/* Model initialize function */
void untitledf28388_initialize(void)
{
  /* Registration code */

  /* initialize error status */
  rtmSetErrorStatus(untitledf28388_M, (NULL));

  /* Start for S-Function (c280xgpio_do): '<Root>/Digital Output' incorporates:
   *  Constant: '<Root>/Constant'
   */
  EALLOW;
  GpioCtrlRegs.GPBMUX2.all &= 0xFFFFFFF3;
  GpioCtrlRegs.GPBDIR.all |= 0x20000;
  EDIS;

  /* Start for S-Function (c280xcanxmt): '<Root>/eCAN Transmit' incorporates:
   *  Constant: '<Root>/Constant1'
   */
  {
    CAN_setupMessageObject(CANA_BASE, 2, 1, CAN_MSG_FRAME_STD,
      CAN_MSG_OBJ_TYPE_TX, 0, CAN_MSG_OBJ_NO_FLAGS, 1);
  }
}

/* Model terminate function */
void untitledf28388_terminate(void)
{
  /* (no terminate code required) */
}

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