Commit d0c1a409 authored by 李俭双's avatar 李俭双

feat:CAN配置,增加矩阵

parent 5b6f47f2
#include "CAN_CH0_CAN_Communication_Matrix.h" #include "CAN_CH0_CAN_Communication_Matrix.h"
#include "Components.h" /* 2024/04/26 10:01:26 */
#include "Application.h"
/* 2024/02/18 14:28:49 */
st_CanMsgOp CAN_CH0_CanMsgOp; st_CanMsgOp CAN_CH0_CanMsgOp;
st_CanMsgTxOp CAN_CH0_CanMsgTxOp; st_CanMsgTxOp CAN_CH0_CanMsgTxOp;
extern void Can_ID_401(uint8_t CopyData []); #define CAN_CH0 &CAN_CH0_CanMsgOp
const st_CAN_SendAttribute CAN_CH0_CANSendAttr[CAN_CH0_ID_SEND_TOTAL] = const st_CAN_SendAttribute CAN_CH0_CANSendAttr[CAN_CH0_ID_SEND_TOTAL] =
{ {
{0x500ul, 8ul * 1000ul, 7ul * 1000ul, 0u, MSG_STD, 1u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_500, (void *)0},
}; };
const st_CANMsgAttribute CAN_CH0_CAN_MSG_CONST_ARRAY[CAN_CH0_ID_TOTAL_MAX] = const st_CANMsgAttribute CAN_CH0_CAN_MSG_CONST_ARRAY[CAN_CH0_ID_TOTAL_MAX] =
{ {
{ {
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u}, {0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u}, {0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u}, {0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
500ul, 5000ul,
0x402ul, 0x402ul,
(( void * )0), (( void * )0),
(( void * )0), (( void * )0),
...@@ -27,17 +24,47 @@ const st_CANMsgAttribute CAN_CH0_CAN_MSG_CONST_ARRAY[CAN_CH0_ID_TOTAL_MAX] = ...@@ -27,17 +24,47 @@ const st_CANMsgAttribute CAN_CH0_CAN_MSG_CONST_ARRAY[CAN_CH0_ID_TOTAL_MAX] =
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u}, {0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u}, {0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u}, {0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
500ul, 5000ul,
0x341ul,
(( void * )0),
(( void * )0),
(( void * )0),
},
{
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
5000ul,
0x111ul,
(( void * )0),
(( void * )0),
(( void * )0),
},
{
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
5000ul,
0x401ul, 0x401ul,
(( void * )0), (( void * )0),
(Can_ID_401), (( void * )0),
(( void * )0),
},
{
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
5000ul,
0x120ul,
(( void * )0),
(( void * )0),
(( void * )0), (( void * )0),
}, },
{ {
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u}, {0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u}, {0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u}, {0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
500ul, 5000ul,
0x101ul, 0x101ul,
(( void * )0), (( void * )0),
(( void * )0), (( void * )0),
...@@ -45,14 +72,151 @@ const st_CANMsgAttribute CAN_CH0_CAN_MSG_CONST_ARRAY[CAN_CH0_ID_TOTAL_MAX] = ...@@ -45,14 +72,151 @@ const st_CANMsgAttribute CAN_CH0_CAN_MSG_CONST_ARRAY[CAN_CH0_ID_TOTAL_MAX] =
}, },
}; };
//uint8_t Get_CAN_CH0_ID_500_Sig_Key_ISTOP(void)
//{
// return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x500_Msg_Count, 0u) >> 0u) & 0x01u));
//}
uint8_t Get_CAN_CH0_ID_402_Sig_ECU_Warning_Lamp(void) uint8_t Get_CAN_CH0_ID_402_Sig_ECU_Warning_Lamp(void)
{ {
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x402_Msg_Count, 7u) >> 7u) & 0x01u)); return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x402_Msg_Count, 7u) >> 0u) & 0x01u));
}
uint8_t Get_CAN_CH0_ID_402_Sig_ECU_DTCL2(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x402_Msg_Count, 6u) >> 0u) & 0xFFu));
}
uint8_t Get_CAN_CH0_ID_402_Sig_ECU_DTCM2(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x402_Msg_Count, 5u) >> 0u) & 0xFFu));
}
uint8_t Get_CAN_CH0_ID_402_Sig_ECU_DTCH2(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x402_Msg_Count, 4u) >> 0u) & 0xFFu));
}
uint8_t Get_CAN_CH0_ID_402_Sig_ECU_DTCAmnt(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x402_Msg_Count, 3u) >> 0u) & 0xFFu));
}
uint8_t Get_CAN_CH0_ID_402_Sig_ECU_DTCL1(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x402_Msg_Count, 2u) >> 0u) & 0xFFu));
}
uint8_t Get_CAN_CH0_ID_402_Sig_ECU_DTCM1(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x402_Msg_Count, 1u) >> 0u) & 0xFFu));
}
uint8_t Get_CAN_CH0_ID_402_Sig_ECU_DTCH1(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x402_Msg_Count, 0u) >> 0u) & 0xFFu));
}
uint8_t Get_CAN_CH0_ID_341_Sig_software_version(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x341_Msg_Count, 7u) >> 0u) & 0xFFu));
}
uint8_t Get_CAN_CH0_ID_341_Sig_Rear_LearningStatus(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x341_Msg_Count, 5u) >> 0u) & 0x03u));
}
uint8_t Get_CAN_CH0_ID_341_Sig_Front_LearningStatus(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x341_Msg_Count, 4u) >> 6u) & 0x03u));
}
uint8_t Get_CAN_CH0_ID_341_Sig_Rear_Pressure_Warning(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x341_Msg_Count, 4u) >> 3u) & 0x07u));
}
uint8_t Get_CAN_CH0_ID_341_Sig_Front_Pressure_Warning(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x341_Msg_Count, 4u) >> 0u) & 0x07u));
}
uint8_t Get_CAN_CH0_ID_341_Sig_Rear_TireTemperature(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x341_Msg_Count, 3u) >> 0u) & 0xFFu));
}
uint8_t Get_CAN_CH0_ID_341_Sig_Front_TireTemperature(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x341_Msg_Count, 2u) >> 0u) & 0xFFu));
}
uint8_t Get_CAN_CH0_ID_341_Sig_Rear_Pressure(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x341_Msg_Count, 1u) >> 0u) & 0xFFu));
}
uint8_t Get_CAN_CH0_ID_341_Sig_Front_Pressure(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x341_Msg_Count, 0u) >> 0u) & 0xFFu));
}
uint8_t Get_CAN_CH0_ID_111_Sig_ISG_SideStand_State(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x111_Msg_Count, 5u) >> 0u) & 0x01u));
}
uint8_t Get_CAN_CH0_ID_111_Sig_ISG_SideStand(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x111_Msg_Count, 4u) >> 0u) & 0x01u));
}
uint8_t Get_CAN_CH0_ID_111_Sig_ISG_Engine_InjIgn_Cutoff_State(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x111_Msg_Count, 2u) >> 0u) & 0x01u));
}
uint8_t Get_CAN_CH0_ID_111_Sig_ISG_Engine_InjIgn_Cutoff(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x111_Msg_Count, 0u) >> 0u) & 0x01u));
}
uint8_t Get_CAN_CH0_ID_111_Sig_ISG_Engine_Autostop_State(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x111_Msg_Count, 3u) >> 0u) & 0x01u));
}
uint8_t Get_CAN_CH0_ID_111_Sig_ISG_Engine_Autostop(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x111_Msg_Count, 1u) >> 0u) & 0x01u));
}
uint8_t Get_CAN_CH0_ID_111_Sig_ISG_111_Livecounter(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x111_Msg_Count, 6u) >> 0u) & 0x0Fu));
}
uint8_t Get_CAN_CH0_ID_111_Sig_ISG_111_Checksum(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x111_Msg_Count, 7u) >> 0u) & 0xFFu));
}
uint8_t Get_CAN_CH0_ID_401_Sig_ECU_401_Checksum(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x401_Msg_Count, 7u) >> 0u) & 0xFFu));
}
uint8_t Get_CAN_CH0_ID_401_Sig_ECU_401_Livecounter(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x401_Msg_Count, 6u) >> 0u) & 0x0Fu));
}
uint8_t Get_CAN_CH0_ID_401_Sig_ECU_Gear_State(void)
{
return (((uint8_t)((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x401_Msg_Count, 5u) >> 0u) & 0x0Fu) << 4u) + \
((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x401_Msg_Count, 6u) >> 4u) & 0x0Fu));
}
uint16_t Get_CAN_CH0_ID_401_Sig_ECU_Fuel_Consumption(void)
{
return (((uint16_t)((uint16_t)((uint16_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x401_Msg_Count, 3u) >> 0u) & 0xFFu) << 8u) + \
((uint16_t)((uint16_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x401_Msg_Count, 4u) >> 0u) & 0xFFu));
} }
uint8_t Get_CAN_CH0_ID_401_Sig_ECU_Battery_Voltage(void) uint8_t Get_CAN_CH0_ID_401_Sig_ECU_Battery_Voltage(void)
...@@ -60,17 +224,131 @@ uint8_t Get_CAN_CH0_ID_401_Sig_ECU_Battery_Voltage(void) ...@@ -60,17 +224,131 @@ uint8_t Get_CAN_CH0_ID_401_Sig_ECU_Battery_Voltage(void)
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x401_Msg_Count, 2u) >> 0u) & 0xFFu)); return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x401_Msg_Count, 2u) >> 0u) & 0xFFu));
} }
uint16_t Get_CAN_CH0_ID_401_Sig_ECU_Environment_Presure(void)
{
return (((uint16_t)((uint16_t)((uint16_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x401_Msg_Count, 0u) >> 0u) & 0xFFu) << 8u) + \
((uint16_t)((uint16_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x401_Msg_Count, 1u) >> 0u) & 0xFFu));
}
// uint8_t Get_CAN_CH0_ID_220_Sig_CheckSum(void)
// {
// return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x220_Msg_Count, 7u) >> 0u) & 0x1Fu));
// }
// uint8_t Get_CAN_CH0_ID_220_Sig_AliveCounter(void)
// {
// return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x220_Msg_Count, 7u) >> 5u) & 0x07u));
// }
// uint8_t Get_CAN_CH0_ID_220_Sig_TCS_Switch(void)
// {
// return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x220_Msg_Count, 0u) >> 3u) & 0x01u));
// }
uint8_t Get_CAN_CH0_ID_120_Sig_TCSStatus(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x120_Msg_Count, 0u) >> 4u) & 0x07u));
}
uint8_t Get_CAN_CH0_ID_120_Sig_RearWheelSpeedValidity(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x120_Msg_Count, 6u) >> 1u) & 0x01u));
}
uint16_t Get_CAN_CH0_ID_120_Sig_RearWheelSpeed(void)
{
return (((uint16_t)((uint16_t)((uint16_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x120_Msg_Count, 4u) >> 0u) & 0xFFu) << 8u) + \
((uint16_t)((uint16_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x120_Msg_Count, 5u) >> 0u) & 0xFFu));
}
uint8_t Get_CAN_CH0_ID_120_Sig_Rear_ABS_control_status(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x120_Msg_Count, 6u) >> 5u) & 0x01u));
}
uint8_t Get_CAN_CH0_ID_120_Sig_FrontWheelSpeedValidity(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x120_Msg_Count, 6u) >> 0u) & 0x01u));
}
uint16_t Get_CAN_CH0_ID_120_Sig_FrontWheelSpeed(void)
{
return (((uint16_t)((uint16_t)((uint16_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x120_Msg_Count, 2u) >> 0u) & 0xFFu) << 8u) + \
((uint16_t)((uint16_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x120_Msg_Count, 3u) >> 0u) & 0xFFu));
}
uint8_t Get_CAN_CH0_ID_120_Sig_Front_ABS_control_status(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x120_Msg_Count, 6u) >> 4u) & 0x01u));
}
uint8_t Get_CAN_CH0_ID_120_Sig_CheckSum(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x120_Msg_Count, 7u) >> 0u) & 0x1Fu));
}
uint8_t Get_CAN_CH0_ID_120_Sig_AliveCounter(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x120_Msg_Count, 7u) >> 5u) & 0x07u));
}
uint8_t Get_CAN_CH0_ID_120_Sig_ABS_Warning_lamp(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x120_Msg_Count, 6u) >> 2u) & 0x03u));
}
uint8_t Get_CAN_CH0_ID_101_Sig_ECU_Vehicle_Speed_State(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x101_Msg_Count, 6u) >> 5u) & 0x01u));
}
uint8_t Get_CAN_CH0_ID_101_Sig_ECU_Vehicle_Speed(void) uint8_t Get_CAN_CH0_ID_101_Sig_ECU_Vehicle_Speed(void)
{ {
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x101_Msg_Count, 2u) >> 0u) & 0xFFu)); return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x101_Msg_Count, 2u) >> 0u) & 0xFFu));
} }
uint8_t Get_CAN_CH0_ID_101_Sig_ECU_Throttle_Position_State(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x101_Msg_Count, 6u) >> 6u) & 0x01u));
}
uint8_t Get_CAN_CH0_ID_101_Sig_ECU_Throttle_Position(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x101_Msg_Count, 3u) >> 0u) & 0xFFu));
}
uint8_t Get_CAN_CH0_ID_101_Sig_ECU_Engine_Temperature_State(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x101_Msg_Count, 6u) >> 7u) & 0x01u));
}
uint16_t Get_CAN_CH0_ID_101_Sig_ECU_Engine_Temperature(void)
{
return (((uint16_t)((uint16_t)((uint16_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x101_Msg_Count, 4u) >> 0u) & 0xFFu) << 8u) + \
((uint16_t)((uint16_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x101_Msg_Count, 5u) >> 0u) & 0xFFu));
}
uint8_t Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed_State(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x101_Msg_Count, 6u) >> 4u) & 0x01u));
}
uint16_t Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed(void) uint16_t Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed(void)
{ {
return (((uint16_t)((uint16_t)((uint16_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x101_Msg_Count, 0u) >> 0u) & 0xFFu) << 8u) + \ return (((uint16_t)((uint16_t)((uint16_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x101_Msg_Count, 0u) >> 0u) & 0xFFu) << 8u) + \
((uint16_t)((uint16_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x101_Msg_Count, 1u) >> 0u) & 0xFFu)); ((uint16_t)((uint16_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x101_Msg_Count, 1u) >> 0u) & 0xFFu));
} }
uint8_t Get_CAN_CH0_ID_101_Sig_ECU_101_Livecounter(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x101_Msg_Count, 6u) >> 0u) & 0x0Fu));
}
uint8_t Get_CAN_CH0_ID_101_Sig_ECU_101_Checksum(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x101_Msg_Count, 7u) >> 0u) & 0xFFu));
}
uint8_t Co_Can_ConvertSubID_CAN_CH0(uint32_t MsgID) uint8_t Co_Can_ConvertSubID_CAN_CH0(uint32_t MsgID)
{ {
uint8_t u8Result = CAN_CH0_ID_TOTAL_MAX; uint8_t u8Result = CAN_CH0_ID_TOTAL_MAX;
...@@ -79,8 +357,17 @@ uint8_t Co_Can_ConvertSubID_CAN_CH0(uint32_t MsgID) ...@@ -79,8 +357,17 @@ uint8_t Co_Can_ConvertSubID_CAN_CH0(uint32_t MsgID)
case CAN_CH0_ID_CAN_0x402_Msg: case CAN_CH0_ID_CAN_0x402_Msg:
u8Result = CAN_CH0_ID_CAN_0x402_Msg_Count; u8Result = CAN_CH0_ID_CAN_0x402_Msg_Count;
break; break;
case CAN_CH0_ID_CAN_0x341_Msg:
u8Result = CAN_CH0_ID_CAN_0x341_Msg_Count;
break;
case CAN_CH0_ID_CAN_0x111_Msg:
u8Result = CAN_CH0_ID_CAN_0x111_Msg_Count;
break;
case CAN_CH0_ID_CAN_0x401_Msg: case CAN_CH0_ID_CAN_0x401_Msg:
u8Result = CAN_CH0_ID_CAN_0x401_Msg_Count; u8Result = CAN_CH0_ID_CAN_0x401_Msg_Count;
break;
case CAN_CH0_ID_CAN_0x120_Msg:
u8Result = CAN_CH0_ID_CAN_0x120_Msg_Count;
break; break;
case CAN_CH0_ID_CAN_0x101_Msg: case CAN_CH0_ID_CAN_0x101_Msg:
u8Result = CAN_CH0_ID_CAN_0x101_Msg_Count; u8Result = CAN_CH0_ID_CAN_0x101_Msg_Count;
...@@ -92,5 +379,3 @@ uint8_t Co_Can_ConvertSubID_CAN_CH0(uint32_t MsgID) ...@@ -92,5 +379,3 @@ uint8_t Co_Can_ConvertSubID_CAN_CH0(uint32_t MsgID)
return u8Result; return u8Result;
} }
...@@ -3,14 +3,16 @@ ...@@ -3,14 +3,16 @@
#include "Components.h" #include "Components.h"
#define CAN_CH0 &CAN_CH0_CanMsgOp
extern st_CanMsgOp CAN_CH0_CanMsgOp; extern st_CanMsgOp CAN_CH0_CanMsgOp;
extern st_CanMsgTxOp CAN_CH0_CanMsgTxOp; extern st_CanMsgTxOp CAN_CH0_CanMsgTxOp;
typedef enum typedef enum
{ {
CAN_CH0_ID_CAN_0x402_Msg_Count, CAN_CH0_ID_CAN_0x402_Msg_Count,
CAN_CH0_ID_CAN_0x401_Msg_Count, CAN_CH0_ID_CAN_0x341_Msg_Count,
CAN_CH0_ID_CAN_0x111_Msg_Count,
CAN_CH0_ID_CAN_0x401_Msg_Count,
CAN_CH0_ID_CAN_0x120_Msg_Count,
CAN_CH0_ID_CAN_0x101_Msg_Count, CAN_CH0_ID_CAN_0x101_Msg_Count,
CAN_CH0_ID_TOTAL_MAX, CAN_CH0_ID_TOTAL_MAX,
...@@ -18,28 +20,76 @@ typedef enum ...@@ -18,28 +20,76 @@ typedef enum
typedef enum typedef enum
{ {
CAN_CH0_ID_CAN_0x500_Msg_Count,
CAN_CH0_ID_SEND_TOTAL, CAN_CH0_ID_SEND_TOTAL,
} CAN_CH0_CAN_MSG_SEND_ID_t; } CAN_CH0_CAN_MSG_SEND_ID_t;
extern const st_CANMsgAttribute CAN_CH0_CAN_MSG_CONST_ARRAY[CAN_CH0_ID_TOTAL_MAX] ; extern const st_CANMsgAttribute CAN_CH0_CAN_MSG_CONST_ARRAY[CAN_CH0_ID_TOTAL_MAX] ;
extern const st_CAN_SendAttribute CAN_CH0_CANSendAttr[CAN_CH0_ID_SEND_TOTAL] ; extern const st_CAN_SendAttribute CAN_CH0_CANSendAttr[CAN_CH0_ID_SEND_TOTAL] ;
#define CAN_CH0_ID_CAN_0x500_Msg 0x500ul
#define CAN_CH0_ID_CAN_0x402_Msg 0x402ul #define CAN_CH0_ID_CAN_0x402_Msg 0x402ul
#define CAN_CH0_ID_CAN_0x341_Msg 0x341ul
#define CAN_CH0_ID_CAN_0x111_Msg 0x111ul
#define CAN_CH0_ID_CAN_0x401_Msg 0x401ul #define CAN_CH0_ID_CAN_0x401_Msg 0x401ul
#define CAN_CH0_ID_CAN_0x220_Msg 0x220ul
#define CAN_CH0_ID_CAN_0x120_Msg 0x120ul
#define CAN_CH0_ID_CAN_0x101_Msg 0x101ul #define CAN_CH0_ID_CAN_0x101_Msg 0x101ul
//extern uint8_t Get_CAN_CH0_ID_500_Sig_Key_ISTOP(void);
extern uint8_t Get_CAN_CH0_ID_402_Sig_ECU_Warning_Lamp(void); extern uint8_t Get_CAN_CH0_ID_402_Sig_ECU_Warning_Lamp(void);
extern uint8_t Get_CAN_CH0_ID_402_Sig_ECU_DTCL2(void);
extern uint8_t Get_CAN_CH0_ID_402_Sig_ECU_DTCM2(void);
extern uint8_t Get_CAN_CH0_ID_402_Sig_ECU_DTCH2(void);
extern uint8_t Get_CAN_CH0_ID_402_Sig_ECU_DTCAmnt(void);
extern uint8_t Get_CAN_CH0_ID_402_Sig_ECU_DTCL1(void);
extern uint8_t Get_CAN_CH0_ID_402_Sig_ECU_DTCM1(void);
extern uint8_t Get_CAN_CH0_ID_402_Sig_ECU_DTCH1(void);
extern uint8_t Get_CAN_CH0_ID_341_Sig_software_version(void);
extern uint8_t Get_CAN_CH0_ID_341_Sig_Rear_LearningStatus(void);
extern uint8_t Get_CAN_CH0_ID_341_Sig_Front_LearningStatus(void);
extern uint8_t Get_CAN_CH0_ID_341_Sig_Rear_Pressure_Warning(void);
extern uint8_t Get_CAN_CH0_ID_341_Sig_Front_Pressure_Warning(void);
extern uint8_t Get_CAN_CH0_ID_341_Sig_Rear_TireTemperature(void);
extern uint8_t Get_CAN_CH0_ID_341_Sig_Front_TireTemperature(void);
extern uint8_t Get_CAN_CH0_ID_341_Sig_Rear_Pressure(void);
extern uint8_t Get_CAN_CH0_ID_341_Sig_Front_Pressure(void);
extern uint8_t Get_CAN_CH0_ID_111_Sig_ISG_SideStand_State(void);
extern uint8_t Get_CAN_CH0_ID_111_Sig_ISG_SideStand(void);
extern uint8_t Get_CAN_CH0_ID_111_Sig_ISG_Engine_InjIgn_Cutoff_State(void);
extern uint8_t Get_CAN_CH0_ID_111_Sig_ISG_Engine_InjIgn_Cutoff(void);
extern uint8_t Get_CAN_CH0_ID_111_Sig_ISG_Engine_Autostop_State(void);
extern uint8_t Get_CAN_CH0_ID_111_Sig_ISG_Engine_Autostop(void);
extern uint8_t Get_CAN_CH0_ID_111_Sig_ISG_111_Livecounter(void);
extern uint8_t Get_CAN_CH0_ID_111_Sig_ISG_111_Checksum(void);
extern uint8_t Get_CAN_CH0_ID_401_Sig_ECU_401_Checksum(void);
extern uint8_t Get_CAN_CH0_ID_401_Sig_ECU_401_Livecounter(void);
extern uint8_t Get_CAN_CH0_ID_401_Sig_ECU_Gear_State(void);
extern uint16_t Get_CAN_CH0_ID_401_Sig_ECU_Fuel_Consumption(void);
extern uint8_t Get_CAN_CH0_ID_401_Sig_ECU_Battery_Voltage(void); extern uint8_t Get_CAN_CH0_ID_401_Sig_ECU_Battery_Voltage(void);
extern uint16_t Get_CAN_CH0_ID_401_Sig_ECU_Environment_Presure(void);
extern uint8_t Get_CAN_CH0_ID_220_Sig_CheckSum(void);
extern uint8_t Get_CAN_CH0_ID_220_Sig_AliveCounter(void);
extern uint8_t Get_CAN_CH0_ID_220_Sig_TCS_Switch(void);
extern uint8_t Get_CAN_CH0_ID_120_Sig_TCSStatus(void);
extern uint8_t Get_CAN_CH0_ID_120_Sig_RearWheelSpeedValidity(void);
extern uint16_t Get_CAN_CH0_ID_120_Sig_RearWheelSpeed(void);
extern uint8_t Get_CAN_CH0_ID_120_Sig_Rear_ABS_control_status(void);
extern uint8_t Get_CAN_CH0_ID_120_Sig_FrontWheelSpeedValidity(void);
extern uint16_t Get_CAN_CH0_ID_120_Sig_FrontWheelSpeed(void);
extern uint8_t Get_CAN_CH0_ID_120_Sig_Front_ABS_control_status(void);
extern uint8_t Get_CAN_CH0_ID_120_Sig_CheckSum(void);
extern uint8_t Get_CAN_CH0_ID_120_Sig_AliveCounter(void);
extern uint8_t Get_CAN_CH0_ID_120_Sig_ABS_Warning_lamp(void);
extern uint8_t Get_CAN_CH0_ID_101_Sig_ECU_Vehicle_Speed_State(void);
extern uint8_t Get_CAN_CH0_ID_101_Sig_ECU_Vehicle_Speed(void); extern uint8_t Get_CAN_CH0_ID_101_Sig_ECU_Vehicle_Speed(void);
extern uint8_t Get_CAN_CH0_ID_101_Sig_ECU_Throttle_Position_State(void);
extern uint8_t Get_CAN_CH0_ID_101_Sig_ECU_Throttle_Position(void);
extern uint8_t Get_CAN_CH0_ID_101_Sig_ECU_Engine_Temperature_State(void);
extern uint16_t Get_CAN_CH0_ID_101_Sig_ECU_Engine_Temperature(void);
extern uint8_t Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed_State(void);
extern uint16_t Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed(void); extern uint16_t Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed(void);
extern uint8_t Get_CAN_CH0_ID_101_Sig_ECU_101_Livecounter(void);
extern uint8_t Get_CAN_CH0_ID_101_Sig_ECU_101_Checksum(void);
extern uint8_t Co_Can_ConvertSubID_CAN_CH0(uint32_t MsgID); extern uint8_t Co_Can_ConvertSubID_CAN_CH0(uint32_t MsgID);
void Can_Set_Buff_500(canlib_uint8_t CopyData[]);
#endif #endif
...@@ -63,6 +63,33 @@ void Can_RX_Apply_Buff(void) ...@@ -63,6 +63,33 @@ void Can_RX_Apply_Buff(void)
CAN_MessageCache_Init(CAN0MSG06, &CAN_RecvMsg); CAN_MessageCache_Init(CAN0MSG06, &CAN_RecvMsg);
CAN_MessageCache_OverWriteConfig(CAN0MSG06, ENABLE); CAN_MessageCache_OverWriteConfig(CAN0MSG06, ENABLE);
CAN_RecvMsg.Id = 0x341;
CAN_RecvMsg.IDE = CAN_Id_Standard;
CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask;
CAN_RecvMsg.RTR = CAN_RTR_Data;
CAN_RecvMsg.Interrupt = ENABLE;
CAN_MessageCache_DeInit(CAN0MSG05);
CAN_MessageCache_Init(CAN0MSG05, &CAN_RecvMsg);
CAN_MessageCache_OverWriteConfig(CAN0MSG05, ENABLE);
CAN_RecvMsg.Id = 0x111;
CAN_RecvMsg.IDE = CAN_Id_Standard;
CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask;
CAN_RecvMsg.RTR = CAN_RTR_Data;
CAN_RecvMsg.Interrupt = ENABLE;
CAN_MessageCache_DeInit(CAN0MSG07);
CAN_MessageCache_Init(CAN0MSG07, &CAN_RecvMsg);
CAN_MessageCache_OverWriteConfig(CAN0MSG07, ENABLE);
CAN_RecvMsg.Id = 0x120;
CAN_RecvMsg.IDE = CAN_Id_Standard;
CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask;
CAN_RecvMsg.RTR = CAN_RTR_Data;
CAN_RecvMsg.Interrupt = ENABLE;
CAN_MessageCache_DeInit(CAN0MSG11);
CAN_MessageCache_Init(CAN0MSG11, &CAN_RecvMsg);
CAN_MessageCache_OverWriteConfig(CAN0MSG11, ENABLE);
CAN_RecvMsg.Id = DIAG_ID_Rx_PHY; CAN_RecvMsg.Id = DIAG_ID_Rx_PHY;
CAN_RecvMsg.IDE = CAN_Id_Standard; CAN_RecvMsg.IDE = CAN_Id_Standard;
CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask; CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask;
...@@ -90,7 +117,7 @@ void Can_Tx_Apply_Buff(void) ...@@ -90,7 +117,7 @@ void Can_Tx_Apply_Buff(void)
{ {
CanTxRxMsg CAN_SendMsg; CanTxRxMsg CAN_SendMsg;
CanTxRxMsg CAN_SendMsg_Diag_Tx; CanTxRxMsg CAN_SendMsg_Diag_Tx;
CAN_SendMsg.Id = 0x500; CAN_SendMsg.Id = 0x6EE;
CAN_SendMsg.IDE = CAN_Id_Standard; CAN_SendMsg.IDE = CAN_Id_Standard;
CAN_SendMsg.CacheType = CAN_CacheType_Tx; CAN_SendMsg.CacheType = CAN_CacheType_Tx;
CAN_SendMsg.RTR = CAN_RTR_Data; CAN_SendMsg.RTR = CAN_RTR_Data;
...@@ -104,6 +131,49 @@ void Can_Tx_Apply_Buff(void) ...@@ -104,6 +131,49 @@ void Can_Tx_Apply_Buff(void)
CAN_MessageCache_DeInit(CAN0MSG08); CAN_MessageCache_DeInit(CAN0MSG08);
CAN_MessageCache_Init(CAN0MSG08, &CAN_SendMsg); CAN_MessageCache_Init(CAN0MSG08, &CAN_SendMsg);
CAN_SendMsg.Id = 0x6EF;
CAN_SendMsg.IDE = CAN_Id_Standard;
CAN_SendMsg.CacheType = CAN_CacheType_Tx;
CAN_SendMsg.RTR = CAN_RTR_Data;
CAN_RecvMsg.Interrupt = DISABLE;
CAN_SendMsg.DLC = 8;
for (uint8_t i = 0; i < CAN_SendMsg.DLC; i++)
{
CAN_SendMsg.Data[i] = 0;
}
CAN_MessageCache_DeInit(CAN0MSG12);
CAN_MessageCache_Init(CAN0MSG12, &CAN_SendMsg);
CAN_SendMsg.Id = 0x450;
CAN_SendMsg.IDE = CAN_Id_Standard;
CAN_SendMsg.CacheType = CAN_CacheType_Tx;
CAN_SendMsg.RTR = CAN_RTR_Data;
CAN_RecvMsg.Interrupt = DISABLE;
CAN_SendMsg.DLC = 8;
for (uint8_t i = 0; i < CAN_SendMsg.DLC; i++)
{
CAN_SendMsg.Data[i] = 0;
}
CAN_MessageCache_DeInit(CAN0MSG13);
CAN_MessageCache_Init(CAN0MSG13, &CAN_SendMsg);
CAN_SendMsg.Id = 0x220;
CAN_SendMsg.IDE = CAN_Id_Standard;
CAN_SendMsg.CacheType = CAN_CacheType_Tx;
CAN_SendMsg.RTR = CAN_RTR_Data;
CAN_RecvMsg.Interrupt = DISABLE;
CAN_SendMsg.DLC = 8;
for (uint8_t i = 0; i < CAN_SendMsg.DLC; i++)
{
CAN_SendMsg.Data[i] = 0;
}
CAN_MessageCache_DeInit(CAN0MSG10);
CAN_MessageCache_Init(CAN0MSG10, &CAN_SendMsg);
CAN_SendMsg_Diag_Tx.Id = DIAG_ID_Tx; CAN_SendMsg_Diag_Tx.Id = DIAG_ID_Tx;
CAN_SendMsg_Diag_Tx.IDE = CAN_Id_Standard; CAN_SendMsg_Diag_Tx.IDE = CAN_Id_Standard;
...@@ -239,9 +309,18 @@ void Can_Write(st_CAN_Msg *Msg) ...@@ -239,9 +309,18 @@ void Can_Write(st_CAN_Msg *Msg)
switch (CAN_SendMsg.Id) switch (CAN_SendMsg.Id)
{ {
case 0x500: case 0x6EE:
CAN_Transmit(CAN0MSG08, &CAN_SendMsg); CAN_Transmit(CAN0MSG08, &CAN_SendMsg);
break; break;
case 0x6EF:
CAN_Transmit(CAN0MSG12, &CAN_SendMsg);
break;
case 0x450:
CAN_Transmit(CAN0MSG13, &CAN_SendMsg);
break;
case 0x220:
CAN_Transmit(CAN0MSG10, &CAN_SendMsg);
break;
default: default:
break; break;
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
#ifndef _DIAG_ID_DEF_H_ #ifndef _DIAG_ID_DEF_H_
#define _DIAG_ID_DEF_H_ #define _DIAG_ID_DEF_H_
#define DIAG_ID_Tx 0x0789u /*发送ID*/ #define DIAG_ID_Tx 0x07E8u /*发送ID*/
#define DIAG_ID_Rx_PHY 0x0781u /*接收ID,物理寻址*/ #define DIAG_ID_Rx_PHY 0x07E0u /*接收ID,物理寻址*/
#define DIAG_ID_Rx_FUN 0x07DFu /*接收ID,功能寻址*/ #define DIAG_ID_Rx_FUN 0x07DFu /*接收ID,功能寻址*/
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment