#include "PC_Control.h"
#include "TPS2HB35AQPWPRQ1.h"
#include "MC33984EHFK.h"
#include "SGM4591Q.h"
#include "Dio.h"
#include "CAN_CH0_CAN_Communication_Matrix.h"
/*此文件用于上位机控制U16和U48*/

uint8_t state_23 = 1;
/*U16*/
void PC_Control_U16(void)
{
  uint8_t state_24 = 1;
  state_23 = Get_ID_18000000_Sig_PC_Control_U16_Power();
  /*DIA_EN 引脚置为高电平*/
  SGM4591Q_Chip3_2_Segment1.BIT.PIN_3 = 1;
  SGM4591Q_Global_Control(SGM4591Q_Chip3_2, SGM4591Q_Segment1);
  /*OUT23*/
  if (state_23 == 1)
  {
    TPS2HB35_SetOutput3A_OUT23(1);
  }
  else if (state_23 == 0)
  {
    TPS2HB35_SetOutput3A_OUT23(0);
  }
  else
  {
    ;
  }

  /*OUT24*/
  // if (state_24 == 1)
  // {
  //   TPS2HB35_SetOutput3A_OUT24(1);
  // }
  // else if (state_24 == 0)
  // {
  //   TPS2HB35_SetOutput3A_OUT24(0);
  // }
  // else
  // {
  //   ;
  // }
}

/*U48*/
uint8_t state_U48_1 = 1;
void PC_Control_U48(void)
{
  state_U48_1 = Get_ID_18000000_Sig_PC_Control_U48_Power();
  /*20A_OUT2*/
  if (state_U48_1 == 1)
  {
    Dio_WriteChannel(DioConf_DioChannel_P20_09, STD_HIGH);
  }
  else if (state_U48_1 == 0)
  {
    Dio_WriteChannel(DioConf_DioChannel_P20_09, STD_LOW);
  }
  else
  {
    ;
  }
  Get_ID_18000000_Sig_PC_Control_U48_CurrentControlSet();
}
