#include "CAN_CH0_APP.h"
#include "CAN_CH0_Tx_Matirx.h"
#include "CAN_CH0_CAN_Communication_Matrix.h"
#include "CAN_CH1_CAN_Communication_Matrix.h"

void Can_Set_Buff_18FEF117(uint8_t CopyData[])
{
  CopyData[0] = 0;
  CopyData[1] = 0;
  CopyData[2] = 0;
  CopyData[3] = 0;
  if (Get_ID_18FFA017_Sig_Instrument_Igon_Wake_Up_Power() == 1)
  {
    /*3.7.2.1.1、手刹*/
    CopyData[0] |= (uint8_t)(Get_ID_18FFA017_Sig_Hand_Brake() << 2);
    /*3.7.2.1.2、车速*/
    CopyData[1] = (uint8_t)(Get_ID_18FE17EF_Sig_Speed() & 0xFFu);
    CopyData[2] = (uint8_t)((uint8_t)(Get_ID_18FE17EF_Sig_Speed() >> 8) & 0xFFu);
    /*3.7.2.1.3、脚刹*/
    /*规范错误*/
    CopyData[3] = 0;
  }

  CopyData[4] = 0;
  CopyData[5] = 0;
  CopyData[6] = 0;
  CopyData[7] = 0;
}

void Can_Set_Buff_18FEF100(uint8_t CopyData [])
{
  CopyData[0] = 0;
  CopyData[1] = 0;
  CopyData[2] = 0;
  CopyData[3] = 0;
  if (Get_ID_18FFA017_Sig_Instrument_Igon_Wake_Up_Power() == 1)
  {
    /*3.7.2.2.1、手刹*/
    CopyData[0] |= (uint8_t)(Get_ID_18FFA017_Sig_Hand_Brake() << 2);
    /*3.7.2.2.2、车速*/
    CopyData[1] = (uint8_t)(Get_ID_18FE17EF_Sig_Speed() & 0xFFu);
    CopyData[2] = (uint8_t)((uint8_t)(Get_ID_18FE17EF_Sig_Speed() >> 8) & 0xFFu);
    /*3.7.2.1.3、脚刹*/
    /*规范错误*/
    CopyData[3] = 0;
  }

  CopyData[4] = 0;
  CopyData[5] = 0;
  CopyData[6] = 0;
  CopyData[7] = 0;
}

void Can_Set_Buff_18F10117(uint8_t CopyData [])
{
  CopyData[0] = 0;
  CopyData[1] = 0;
  CopyData[2] = 0;
  CopyData[3] = 0;
  if (Get_ID_18FFA017_Sig_Instrument_Igon_Wake_Up_Power() == 1)
  {
    /*3.7.2.3.1、干燥器排气信号  */
    CopyData[0] |= (uint8_t)(Get_ID_18FFA017_Sig_Hand_Brake() << 2);
    /*3.7.2.2.2、车速*/
    CopyData[1] = (uint8_t)(Get_ID_18FE17EF_Sig_Speed() & 0xFFu);
    CopyData[2] = (uint8_t)((uint8_t)(Get_ID_18FE17EF_Sig_Speed() >> 8) & 0xFFu);
    /*3.7.2.1.3、脚刹*/
    /*规范错误*/
    CopyData[3] = 0;
  }

  CopyData[4] = 0;
  CopyData[5] = 0;
  CopyData[6] = 0;
  CopyData[7] = 0;
}

void Can_Set_Buff_18FEAE17(uint8_t CopyData [])
{
    uint8_t         i = 0u;
    CANMsg257Union *pCANMsg257;
  

    pCANMsg257 = ( CANMsg257Union * )CopyData;
    if ( pCANMsg257 != ( void * )0 )
    {
        for ( i = 0u; i < 8u; i++ )
        {
            pCANMsg257->Msg [ i ] = 0u;
        }
        pCANMsg257->Sig.KM_SAUV_H = ( uint16_t ) ( ( 1 >> 16 ) & 0x000000FF );  
        pCANMsg257->Sig.KM_SAUV_M = ( uint16_t ) ( ( 3 >> 8 ) & 0x000000FF );  
        pCANMsg257->Sig.KM_SAUV_L = ( uint16_t ) ( ( 2 ) & 0x000000FF );
        
        pCANMsg257->Sig.SECURE_H = ( uint16_t ) (( ( ~4) >> 16 ) & 0x000000FF );  
        pCANMsg257->Sig.SECURE_M = ( uint16_t ) (( ( ~5) >> 8 ) & 0x000000FF );  
        pCANMsg257->Sig.SECURE_L = ( uint16_t ) (( ( ~7) ) & 0x000000FF );
       
        
    }
}
/*8.21*/
void Can_Set_Buff_18FEAE30(uint8_t CopyData [])
{
    uint8_t         i = 0u;
    CANMsg43CUnion *pCANMsg43C;
 

    pCANMsg43C = ( CANMsg43CUnion * )CopyData;
    if ( pCANMsg43C != ( void * )0 )
    {
        for ( i = 0u; i < 8u; i++ )
        {
            pCANMsg43C->Msg [ i ] = 0u;
        }
        pCANMsg43C->Sig.CAUSE_1 = 2;
        
    }
}
/*8.21*/
void Can_Set_Buff_18F10217(uint8_t CopyData [])
{
    uint8_t         i = 0u;
    CANMsg254Union *pCANMsg254;
 

    pCANMsg254 = ( CANMsg254Union * )CopyData;
    if ( pCANMsg254 != ( void * )0 )
    {
        for ( i = 0u; i < 8u; i++ )
        {
            pCANMsg254->Msg [ i ] = 0u;
        }
        pCANMsg254->Sig.REMOTE_LOCK_UNLOCK_REQ = 4;
        pCANMsg254->Sig.REMOTE_HORN_REQUEST = 7;
        pCANMsg254->Sig.REMOTE_TURN_LIGHTS_REQ = 9;
    }
}

