Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiancetai
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈家乐
jiancetai
Commits
6a8eeb1b
Commit
6a8eeb1b
authored
Apr 05, 2026
by
黄国庆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat:解决编译报错
parent
54075b63
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
147 additions
and
167 deletions
+147
-167
Application.gpj
YueJin_test_bench/ghs/group/Application.gpj
+6
-0
RTE_GPIO.c
YueJin_test_bench/source/Appliciation/RTE_GPIO.c
+2
-0
RTE_GPIO.h
YueJin_test_bench/source/Appliciation/RTE_GPIO.h
+3
-0
Task.c
YueJin_test_bench/source/Appliciation/Task.c
+3
-0
WMHComm.c
YueJin_test_bench/source/Appliciation/WMHComm.c
+44
-38
WMHComm.h
YueJin_test_bench/source/Appliciation/WMHComm.h
+55
-6
WMHCommData.c
YueJin_test_bench/source/Appliciation/WMHCommData.c
+15
-8
WMHCommData.h
YueJin_test_bench/source/Appliciation/WMHCommData.h
+7
-106
mwWMHComm.c
YueJin_test_bench/source/Appliciation/mwWMHComm.c
+10
-8
mwWMHComm.h
YueJin_test_bench/source/Appliciation/mwWMHComm.h
+2
-1
No files found.
YueJin_test_bench/ghs/group/Application.gpj
View file @
6a8eeb1b
...
...
@@ -2,6 +2,12 @@
[Subproject]
:sourceDir=..\..\source\Appliciation
mwWMHComm.c
mwWMHComm.h
WMHComm.c
WMHComm.h
WMHCommData.c
WMHCommData.h
api_RS485.c
api_RS485.h
R485_Communication_Matrix.c
...
...
YueJin_test_bench/source/Appliciation/RTE_GPIO.c
View file @
6a8eeb1b
...
...
@@ -177,6 +177,8 @@ void RTE_GPIO_Init(void)
LINE_OUT_NEG_02
=
1
;
LINE_OUT_NEG_03
=
1
;
LINE_OUT_NEG_04
=
1
;
#if(0)
gpio_temp
.
enGPIOPort
=
GPIO_PORT_GROUP_0
;
...
...
YueJin_test_bench/source/Appliciation/RTE_GPIO.h
View file @
6a8eeb1b
...
...
@@ -124,6 +124,9 @@
#define zuozhuanget GPIO_IN_PORT10_PIN07 //左转指示灯输出检测
#define youzhuanget GPIO_IN_APORT00_PIN15 //右转指示灯输出检测
#define WMH_COMM90 GPIO_OUT_PORT00_PIN02
#define WMH_COIN GPIO_IN_PORT10_PIN15
//zh:
/******************************************************************************
...
...
YueJin_test_bench/source/Appliciation/Task.c
View file @
6a8eeb1b
...
...
@@ -21,6 +21,8 @@
#include "api_RS485.h"
#include "RTE_WDT.h"
#include "R485_Communication_Matrix.h"
#include "wmhcommdata.h"
#include "wmhcomm.h"
/*******************************************************************************
------------------------------------------------------------------------------*/
...
...
@@ -223,6 +225,7 @@ void Sys_Run_Mode_100ms_Tasks_Group(void)
firstpowerflag
=
2
;
Display_TFT_Clear
();
}
WMHCommFramePackedTransmit
(
EM_WMH_COMM_SEND_MSG_ICM_0x01
);
}
/*=================================================================*/
...
...
YueJin_test_bench/source/Appliciation/WMHComm.c
View file @
6a8eeb1b
#include "wmhcomm.h"
#include "wmhcommdata.h"
#include "mwwmhcomm.h"
#include "TYW_stdint.h"
#include "string.h"
#include "Task.h"
#include "CAN_Communication_Matrix.h"
extern
COMM_DATA_UNION_WI_BOX_0x01
WMHCommDataWiBox_0x01
;
const
WMH_COMM_INIT_FRAME_T
WMHCommRecvInitList
[
EM_WMH_COMM_RECV_MSG_TOTAL
]
=
{
{
0x80u
,
1000u
,
COMM_DATA_UNION_WI_BOX_LENGTH_0X80
,
5000u
,
1u
,
WMHCommDataWiBox_0x80
.
Bytes
,
WMHCommFrameCallBack_WiBox_0x80
,
WMHCommFrameTimeoutFunc_WiBox80
,
WMHCommFrameCheckSumFunc
},
};
const
WMH_COMM_INIT_FRAME_T
WMHCommSendInitList
[
EM_WMH_COMM_SEND_MSG_TOTAL
]
=
{
{
0x
90u
,
1000u
,
COMM_DATA_UNION_WI_BOX_LENGTH_0X90
,
10000u
,
1u
,
WMHCommDataWiBox_0x90
.
Bytes
,
WMHCommFrameCallBack_Icm
,
WMHCommFrameTimeoutFunc_WiBox_90
,
WMHCommFrameCheckSumFunc
},
{
0x91u
,
1000u
,
COMM_DATA_UNION_WI_BOX_LENGTH_0X91
,
10000u
,
1u
,
WMHCommDataWiBox_0x91
.
Bytes
,
WMHCommFrameCallBack_Icm
,
WMHCommFrameTimeoutFunc_WiBox_91
,
WMHCommFrameCheckSumFunc
},
{
0x92u
,
1000u
,
COMM_DATA_UNION_WI_BOX_LENGTH_0X92
,
10000u
,
1u
,
WMHCommDataWiBox_0x92
.
Bytes
,
WMHCommFrameCallBack_Icm
,
WMHCommFrameTimeoutFunc_WiBox_92
,
WMHCommFrameCheckSumFunc
},
const
SifProtocolPacket_t
WMHCommSendInitList
[
EM_WMH_COMM_SEND_MSG_TOTAL
]
=
{
{
0x
0Du
,
0X01u
,
3000u
,
COMM_DATA_UNION_WI_TLV_LENGTH_0X01
,
WMHCommDataWiBox_0x01
.
Bytes
,
1u
,
WMHCommFrameCallBack_WiBox_0x01
,
WMHCommFrameTimeoutFunc_WiBox_01
,
WMHCommFrameCheckSumFunc
},
/*车速*/
};
uint32_t
WMHCommRecvMessageTimeout
[
EM_WMH_COMM_RECV_MSG_TOTAL
]
=
{
0
};
...
...
@@ -22,52 +24,56 @@ uint32_t WMHCommAnalysisPos = 0;
void
WMHCommInit
(
void
)
{
uint8_t
i
=
0
;
for
(
i
=
0
;
i
<
EM_WMH_COMM_RECV_MSG_TOTAL
;
i
++
)
{
(
void
)
memset
(
WMHCommRecvInitList
[
i
].
SignalList
,
0
,
WMHCommRecvInitList
[
i
].
DLC
);
WMHCommRecvMessageTimeout
[
i
]
=
WMHCommRecvInitList
[
i
].
TimeoutMax
;
}
//
for (i = 0; i < EM_WMH_COMM_RECV_MSG_TOTAL; i++) {
// (void)memset(WMHCommRecvInitList[i].dataLength, 0, WMHCommRecvInitList[i].dataLength
);
//
WMHCommRecvMessageTimeout[i] = WMHCommRecvInitList[i].TimeoutMax;
//
}
for
(
i
=
0
;
i
<
EM_WMH_COMM_SEND_MSG_TOTAL
;
i
++
)
{
(
void
)
memset
(
WMHCommSendInitList
[
i
].
SignalList
,
0
,
WMHCommSendInitList
[
i
].
DLC
);
(
void
)
memset
(
WMHCommSendInitList
[
i
].
tlvArray
,
0
,
WMHCommSendInitList
[
i
].
dataLength
);
WMHCommSendMessageTimeout
[
i
]
=
WMHCommSendInitList
[
i
].
TimeoutMax
;
}
WMHCommAnalysisPos
=
0
;
}
/*
协议号 设备号 数据总长度 TLVs 前面数据累加和
0x0D 0x01 TLV数据总长度 qq sumcrc
*/
void
WMHCommFramePackedTransmit
(
EM_WMH_COMM_SEND_MSG_T
MsgIdx
)
{
uint8_t
data
[
64
]
=
{
0
};
uint8_t
length
=
0
;
if
((
MsgIdx
<
EM_WMH_COMM_SEND_MSG_TOTAL
)
&&
(
MsgIdx
>
0
)){
if
((
WMHCommSendInitList
[
MsgIdx
].
DLC
+
4
)
<=
64
)
{
if
(
WMHCommSendInitList
[
MsgIdx
].
FrameCallBackFunc
!=
NULL_P
)
{
WMHCommSendInitList
[
MsgIdx
].
FrameCallBackFunc
();
}
data
[
0
]
=
WMHCommSendInitList
[
MsgIdx
].
ID
;
//id
data
[
1
]
=
WMH
_COMM_PROTOCOL_VERSION
;
//主协议版本
号
data
[
2
]
=
WMHCommSendInitList
[
MsgIdx
].
DLC
+
1u
;
//数据长度
(
void
)
memcpy
(
&
data
[
3
],
WMHCommSendInitList
[
MsgIdx
].
SignalList
,
WMHCommSendInitList
[
MsgIdx
].
DLC
);
data
[
3
+
WMHCommSendInitList
[
MsgIdx
].
DLC
]
=
WMHCommSendInitList
[
MsgIdx
].
FrameGetCheckSum
(
WMHCommSendInitList
[
MsgIdx
].
ID
,
WMHCommSendInitList
[
MsgIdx
].
DLC
,
data
[
1
],
WMHCommSendInitList
[
MsgIdx
].
SignalList
);
length
=
WMHCommSendInitList
[
MsgIdx
].
DLC
+
4u
;
if
((
WMHCommSendInitList
[
MsgIdx
].
dataLength
+
4
)
<=
64
)
{
//
if (WMHCommSendInitList[MsgIdx].FrameCallBackFunc != NULL_P) {
//
WMHCommSendInitList[MsgIdx].FrameCallBackFunc();
//
}
data
[
0
]
=
WMHCommSendInitList
[
MsgIdx
].
protocolNumber
;
//协议号
data
[
1
]
=
WMH
CommSendInitList
[
MsgIdx
].
deviceNumber
;
//设备
号
data
[
2
]
=
WMHCommSendInitList
[
MsgIdx
].
dataLength
+
1u
;
//数据长度
(
void
)
memcpy
(
&
data
[
3
],
WMHCommSendInitList
[
MsgIdx
].
tlvArray
,
WMHCommSendInitList
[
MsgIdx
].
dataLength
);
data
[
3
+
WMHCommSendInitList
[
MsgIdx
].
dataLength
]
=
WMHCommSendInitList
[
MsgIdx
].
FrameGetCheckSum
(
WMHCommSendInitList
[
MsgIdx
].
dataLength
,
WMHCommSendInitList
[
MsgIdx
].
dataLength
,
data
[
1
],
WMHCommSendInitList
[
MsgIdx
].
tlvArray
);
length
=
WMHCommSendInitList
[
MsgIdx
].
dataLength
+
4u
;
mwWMHCommTransmitBytes
(
data
,
length
);
WMHCommSendMessageTimeout
[
MsgIdx
]
=
WMHCommSendInitList
[
MsgIdx
].
TimeoutMax
;
}
}
else
if
(
MsgIdx
==
0
)
{
if
((
WMHCommSendInitList
[
MsgIdx
].
DLC
+
4
)
<=
64
)
{
if
(
WMHCommSendInitList
[
MsgIdx
].
FrameCallBackFunc
!=
NULL_P
)
{
WMHCommSendInitList
[
MsgIdx
].
FrameCallBackFunc
();
}
data
[
0
]
=
WMHCommSendInitList
[
MsgIdx
].
ID
;
//id
data
[
1
]
=
WMH_COMM_PROTOCOL_VERSION
;
//主协议版本号
data
[
2
]
=
WMHCommSendInitList
[
MsgIdx
].
DLC
+
1u
;
//数据长度
(
void
)
memcpy
(
&
data
[
3
],
WMHCommSendInitList
[
MsgIdx
].
SignalList
,
WMHCommSendInitList
[
MsgIdx
].
DLC
);
data
[
3
+
WMHCommSendInitList
[
MsgIdx
].
DLC
]
=
WMHCommSendInitList
[
MsgIdx
].
FrameGetCheckSum
(
WMHCommSendInitList
[
MsgIdx
].
ID
,
WMHCommSendInitList
[
MsgIdx
].
DLC
,
data
[
1
],
WMHCommSendInitList
[
MsgIdx
].
SignalList
);
length
=
WMHCommSendInitList
[
MsgIdx
].
DLC
+
4u
;
mwWMHCommTransmitBytes_90
(
data
,
length
);
WMHCommSendMessageTimeout
[
MsgIdx
]
=
WMHCommSendInitList
[
MsgIdx
].
TimeoutMax
;
}
}
//
else if(MsgIdx == 0)
//
{
//
if ((WMHCommSendInitList[MsgIdx].DLC + 4) <= 64) {
// //
if (WMHCommSendInitList[MsgIdx].FrameCallBackFunc != NULL_P) {
// //
WMHCommSendInitList[MsgIdx].FrameCallBackFunc();
// //
}
//
data[0] = WMHCommSendInitList[MsgIdx].ID;//id
//
data[1] = WMH_COMM_PROTOCOL_VERSION;//主协议版本号
//
data[2] = WMHCommSendInitList[MsgIdx].DLC + 1u;//数据长度
//
(void)memcpy(&data[3], WMHCommSendInitList[MsgIdx].SignalList, WMHCommSendInitList[MsgIdx].DLC);
//
data[3 + WMHCommSendInitList[MsgIdx].DLC] = WMHCommSendInitList[MsgIdx].FrameGetCheckSum(WMHCommSendInitList[MsgIdx].ID, WMHCommSendInitList[MsgIdx].DLC, data[1], WMHCommSendInitList[MsgIdx].SignalList);
//
length = WMHCommSendInitList[MsgIdx].DLC + 4u;
//
mwWMHCommTransmitBytes_90(data, length);
//
WMHCommSendMessageTimeout[MsgIdx] = WMHCommSendInitList[MsgIdx].TimeoutMax;
//
}
//
}
}
void
WMHCommFrameUnpacked
(
uint8_t
*
data
,
uint32_t
length
)
...
...
@@ -82,7 +88,7 @@ void WMHCommFrameUnpacked(uint8_t *data, uint32_t length)
WMHCommRecvInitList
[
i
].
FrameCallBackFunc
();
}
WMHCommRecvMessageTimeout
[
i
]
=
WMHCommRecvInitList
[
i
].
TimeoutMax
;
Can_Msg_Tx_Overwrite
(
&
CAN_CH4_CanMsgTxOp
,
0u
,
1u
,
1000u
);
//
Can_Msg_Tx_Overwrite(&CAN_CH4_CanMsgTxOp,0u,1u,1000u);
}
}
...
...
YueJin_test_bench/source/Appliciation/WMHComm.h
View file @
6a8eeb1b
#ifndef __WMH_COMM_H_
#define __WMH_COMM_H_
#include "TYW_stdint.h"
#include "mwwmhcomm.h"
#include "wmhcomm.h"
#include "wmhcommdata.h"
#define NULL_P (void *)0
typedef
struct
{
...
...
@@ -16,6 +18,7 @@ typedef struct {
uint8_t
(
*
FrameGetCheckSum
)(
uint32_t
ID
,
uint8_t
DLC
,
uint8_t
ProtocolVersion
,
uint8_t
*
data
);
//接收报文时调用该函数,返回1表示checksum正确,0表示错误,如果错误,则不会调用FrameAnalysisFunc函数
}
WMH_COMM_INIT_FRAME_T
;
typedef
enum
{
EM_WMH_COMM_RECV_MSG_WI_BOX_0x80
=
0
,
// EM_WMH_COMM_RECV_MSG_WI_BOX_0x91,
...
...
@@ -24,18 +27,64 @@ typedef enum {
}
EM_WMH_COMM_RECV_MSG_T
;
typedef
enum
{
// EM_WMH_COMM_SEND_MSG_ICM_0x80 = 0,
EM_WMH_COMM_SEND_MSG_ICM_0x90
=
0
,
EM_WMH_COMM_SEND_MSG_ICM_0x91
,
EM_WMH_COMM_SEND_MSG_ICM_0x92
,
EM_WMH_COMM_SEND_MSG_ICM_0x01
=
0
,
EM_WMH_COMM_SEND_MSG_TOTAL
,
}
EM_WMH_COMM_SEND_MSG_T
;
#define SIF_MAX_TLV_COUNT (20U)
/*===========================================================================*/
/* Type Definitions */
/*===========================================================================*/
/**
* @brief TLV结构体
*/
typedef
struct
{
uint8_t
tag
;
/**< Tag标识 */
uint8_t
length
;
/**< 数据长度 */
const
uint8_t
*
pValue
;
/**< 数据指针 */
}
SifTlv_t
;
/**
* @brief 协议包结构体
*/
#define COMM_DATA_UNION_WI_TLV_LENGTH_0X01 10
typedef
union
{
struct
{
uint8_t
Data01_Byte1
:
8
;
uint8_t
Data01_Byte2
:
8
;
/*车速高*/
uint8_t
Data01_Byte3
:
8
;
/*车速低*/
uint8_t
Data01_Byte4
:
8
;
/*运行电流*/
uint8_t
Data01_Byte5
:
8
;
//控制器标称电压
uint8_t
Data01_Byte6
:
8
;
uint8_t
Data01_Byte7
:
8
;
uint8_t
Data01_Byte8
:
8
;
uint8_t
Data01_Byte9
:
8
;
uint8_t
Data01_Byte10
:
8
;
}
bits
;
uint8_t
Bytes
[
COMM_DATA_UNION_WI_TLV_LENGTH_0X01
];
}
COMM_DATA_UNION_WI_BOX_0x01
;
typedef
struct
{
uint8_t
protocolNumber
;
/**< 协议号 */
uint8_t
deviceNumber
;
/**< 设备号 */
uint16_t
TimeoutMax
;
//最大超时时间,单位ms;
uint8_t
dataLength
;
/**< TLV数据总长度(不含头、长度本身、校验和) */
COMM_DATA_UNION_WI_BOX_0x01
*
tlvArray
;
/**< TLV数组 */
uint8_t
tlvCount
;
/**< TLV数量 */
void
(
*
FrameCallBackFunc
)(
void
);
//收到报文时会调用该回调函数;
void
(
*
FrameTimeoutFunc
)(
void
);
//TimeoutMax超时时会调用FrameTimeoutFunc(0),TimeoutLv[0]超时时调用FrameTimeoutFunc(1),TimeoutLv[1]超时时调用FrameTimeoutFunc(2),TimeoutLv[2]超时时调用FrameTimeoutFunc(3);
uint8_t
(
*
FrameGetCheckSum
)(
uint32_t
ID
,
uint8_t
DLC
,
uint8_t
ProtocolVersion
,
uint8_t
*
data
);
//接收报文时调用该函数,返回1表示checksum正确,0表示错误,如果错误,则不会调用FrameAnalysisFunc函数
}
SifProtocolPacket_t
;
extern
void
WMHCommInit
(
void
);
extern
void
WMHCommService
(
uint32_t
TimerDelta
);
extern
void
WMHCommFramePackedTransmit
(
EM_WMH_COMM_SEND_MSG_T
MsgIdx
);
extern
uint8_t
WMHCommFrameGetRecvTimeoutSt
(
uint8_t
n
);
extern
uint8_t
WMHCommFrameGetRecvTimeoutSt
(
uint8_t
n
);
#endif
YueJin_test_bench/source/Appliciation/WMHCommData.c
View file @
6a8eeb1b
...
...
@@ -20,9 +20,11 @@ uint8_t WMHCommFrameCheckSumFunc(uint32_t ID, uint8_t DLC, uint8_t ProtocolVersi
*******************************************************************************************/
extern
const
WMH_COMM_INIT_FRAME_T
WMHCommRecvInitList
[
EM_WMH_COMM_RECV_MSG_TOTAL
];
COMM_DATA_UNION_WI_BOX_0x80
WMHCommDataWiBox_0x80
;
COMM_DATA_UNION_WI_BOX_0x90
WMHCommDataWiBox_0x90
;
COMM_DATA_UNION_WI_BOX_0x91
WMHCommDataWiBox_0x91
;
COMM_DATA_UNION_WI_BOX_0x92
WMHCommDataWiBox_0x92
;
/*黄国庆添加台铃*/
COMM_DATA_UNION_WI_BOX_0x01
WMHCommDataWiBox_0x01
;
void
WMHCommFrameCallBack_WiBox_0x80
(
void
)
{
...
...
@@ -38,12 +40,17 @@ void WMHCommFrameCallBack_WiBox_0x91(void)
uint8_t
tmpCond
=
0
;
}
void
WMHCommFrameCallBack_WiBox_0x01
(
void
)
{
uint8_t
tmpCond
=
0
;
}
void
WMHCommFrameTimeoutFunc_WiBox
(
void
)
{
// 替代第一个 memset
for
(
int
i
=
0
;
i
<
COMM_DATA_UNION_WI_BOX_LENGTH_0X90
;
i
++
)
{
WMHCommDataWiBox_0x90
.
Bytes
[
i
]
=
0
;
}
//
//
替代第一个 memset
//
for (int i = 0; i < COMM_DATA_UNION_WI_BOX_LENGTH_0X90; i++) {
//
WMHCommDataWiBox_0x90.Bytes[i] = 0;
//
}
// 替代第二个 memset
for
(
int
i
=
0
;
i
<
COMM_DATA_UNION_WI_BOX_LENGTH_0X91
;
i
++
)
{
...
...
@@ -56,11 +63,11 @@ void WMHCommFrameTimeoutFunc_WiBox(void)
}
}
void
WMHCommFrameTimeoutFunc_WiBox_
90
(
void
)
void
WMHCommFrameTimeoutFunc_WiBox_
01
(
void
)
{
// 替代第一个 memset
for
(
int
i
=
0
;
i
<
COMM_DATA_UNION_WI_
BOX_LENGTH_0X90
;
i
++
)
{
WMHCommDataWiBox_0x
90
.
Bytes
[
i
]
=
0
;
for
(
int
i
=
0
;
i
<
COMM_DATA_UNION_WI_
TLV_LENGTH_0X01
;
i
++
)
{
WMHCommDataWiBox_0x
01
.
Bytes
[
i
]
=
0
;
}
}
...
...
YueJin_test_bench/source/Appliciation/WMHCommData.h
View file @
6a8eeb1b
#ifndef __WMH_COMM_DATA_H_
#define __WMH_COMM_DATA_H_
#include "TYW_stdint.h"
#include "wmhcomm.h"
#include "wmhcommdata.h"
#include "wmhcommdata.h"
#define WMH_COMM_PROTOCOL_VERSION 0x2F;
#define COMM_DATA_UNION_WI_BOX_LENGTH_0X80 13
...
...
@@ -52,111 +54,8 @@ typedef union {
}
COMM_DATA_UNION_WI_BOX_0x80
;
extern
COMM_DATA_UNION_WI_BOX_0x80
WMHCommDataWiBox_0x80
;
#define COMM_DATA_UNION_WI_BOX_LENGTH_0X90 16
typedef
union
{
struct
{
// // ===================== Byte0 =====================
// uint8_t ProductModel :6; // 产品型号
// uint8_t ManufacturerCodingRules :2; // 厂家编码规则
// // ===================== Byte1 =====================
// uint8_t DeviceEncoding :8; // 设备编码
// // ===================== Byte2 =====================
// uint8_t SerialNumberL :8; // 流水号
// // ===================== Byte3 =====================
// uint8_t FaultStatus :1; // 故障状态
// uint8_t ConstantSpeedStatus :1; // 定速巡航状态
// uint8_t GearPStatus :1; // P档状态
// uint8_t ReadyStatus :1; // READY状态
// uint8_t SerialNumberH :4; // 流水号高字节4位
// // ===================== Byte4 =====================
// uint8_t EstimateMileage_H :8; // 预估里程高字节
// // ===================== Byte5 =====================
// uint8_t EstimateMileage_L :8; // 预估里程低字节
// // ===================== Byte6 =====================
// uint8_t EnergyConsumption :8; // 能耗系数
// // ===================== Byte7 =====================
// uint8_t Fault8 :1; // 电机缺相故障
// uint8_t Fault7 :1; // 堵转保护故障
// uint8_t Fault6 :1; // 欠压保护故障
// uint8_t Fault5 :1; // 转把故障
// uint8_t Fault4 :1; // 控制器MOS管故障
// uint8_t Fault3 :1; // 刹车故障
// uint8_t Fault2 :1; // 电机霍尔故障
// uint8_t Fault1 :1; // 过压保护故障
// // ===================== Byte8 =====================
// uint8_t Fault16 :1; // 电池充电过流保护故障
// uint8_t Fault15 :1; // 电池SOC过低故障
// uint8_t Fault14 :1; // 电池总压欠压保护故障
// uint8_t Fault13 :1; // 电池总压过压保护故障
// uint8_t Fault12 :1; // 电池放电MOS故障
// uint8_t Fault11 :1; // 电池充电MOS故障
// uint8_t Fault10 :1; // 控制器过热故障
// uint8_t Fault9 :1; // 电机过热故障
// // ===================== Byte9 =====================
// uint8_t Reserved3 :2; // 预留位3
// uint8_t Fault22 :1; // 电池放电握手失败故障
// uint8_t Fault21 :1; // 电池充电过温保护故障
// uint8_t Fault20 :1; // 电池充电低温保护故障
// uint8_t Fault19 :1; // 电池放电过温保护故障
// uint8_t Fault18 :1; // 电池放电低温保护故障
// uint8_t Fault17 :1; // 电池放电过流保护故障
// // ===================== Byte10 =====================
// uint8_t Espeed_H :8; // 电机脉冲数高字节
// // ===================== Byte11 =====================
// uint8_t Espeed_L :8; // 电机脉冲数低字节
// // ===================== Byte12 =====================
// uint8_t Electricity :8; // 电量
// // ===================== Byte13 =====================
// uint8_t Reserved5 :3; // 预留位5
// uint8_t TCSopen :1; // TCS功能开启
// uint8_t TCSa :1; // TCS动作中
// uint8_t Fault23 :1; // 控制器过流故障
// uint8_t GEAR :1; // 1:S档 0:D档
// uint8_t FaultLED :1; // 故障指示灯
// // ===================== Byte14 =====================
// uint8_t BurglarStatus :1; // 防盗状态
// uint8_t Reserved4 :4; // 预留位4
// uint8_t CartStatus :1; // 推车状态
// uint8_t SideBraceStatus :1; // 边撑状态
// uint8_t EBSStatus :1; // EBS状态
// // ===================== Byte15 =====================
// uint8_t VSpeed :8; // 车速
uint8_t
Data90_Byte1
:
8
;
uint8_t
Data90_Byte2
:
8
;
uint8_t
Data90_Byte3
:
8
;
uint8_t
Data90_Byte4
:
8
;
uint8_t
Data90_Byte5
:
8
;
uint8_t
Data90_Byte6
:
8
;
uint8_t
Data90_Byte7
:
8
;
uint8_t
Data90_Byte8
:
8
;
uint8_t
Data90_Byte9
:
8
;
uint8_t
Data90_Byte10
:
8
;
uint8_t
Data90_Byte11
:
8
;
uint8_t
Data90_Byte12
:
8
;
uint8_t
Data90_Byte13
:
8
;
uint8_t
Data90_Byte14
:
8
;
uint8_t
Data90_Byte15
:
8
;
uint8_t
Data90_Byte16
:
8
;
}
bits
;
uint8_t
Bytes
[
COMM_DATA_UNION_WI_BOX_LENGTH_0X90
];
}
COMM_DATA_UNION_WI_BOX_0x90
;
extern
COMM_DATA_UNION_WI_BOX_0x90
WMHCommDataWiBox_0x90
;
// extern COMM_DATA_UNION_WI_BOX_0x01 WMHCommDataWiBox_0x01;
#define COMM_DATA_UNION_WI_BOX_LENGTH_0X91 12
typedef
union
{
...
...
@@ -283,7 +182,6 @@ typedef union {
}
COMM_DATA_UNION_ICM
;
extern
COMM_DATA_UNION_ICM
WMHCommDataIcm
;
extern
COMM_DATA_UNION_WI_BOX_0x90
WMHCommDataWiBox_0x90
;
extern
COMM_DATA_UNION_WI_BOX_0x91
WMHCommDataWiBox_0x91
;
extern
COMM_DATA_UNION_WI_BOX_0x92
WMHCommDataWiBox_0x92
;
...
...
@@ -301,6 +199,9 @@ extern void WMHCommFrameTimeoutFunc_WiBox80(void);
extern
void
WMHCommFrameCallBack_Icm
(
void
);
extern
void
WMHCommFrameTimeoutFunc_Icm
(
void
);
/*台铃-黄国庆*/
extern
void
WMHCommFrameTimeoutFunc_WiBox_01
(
void
);
extern
void
WMHCommFrameCallBack_WiBox_0x01
(
void
);
#endif
YueJin_test_bench/source/Appliciation/mwWMHComm.c
View file @
6a8eeb1b
#include "mwwmhcomm.h"
#include "wmhcomm.h"
#include "wmhcommdata.h"
#include "TYW_stdint.h"
#include "string.h"
#include "gpio.h"
...
...
@@ -275,7 +277,7 @@ void mwWMHCommSendIsr(uint32_t tmpCnts)
mwWMHCommSerialBuffer
[
n
].
OptCnts
=
mwWMHCommSerialBuffer
[
n
].
OptCnts
%
MAX_SERIAL_BUFF_SIZE
;
//RTE_GPIO_Config(RTE_GPIO_PORTB_PIN11, GpioOut_Low);
// GPIOB->PBSC = (1 << (11 + 16));
WMH_COMM
=
0
;
//
WMH_COMM = 0;
//PORT_ClrBit(GpioMapData[mwWMHCommPin[n]].IoPara.McuIo.pinGroup, GpioMapData[mwWMHCommPin[n]].IoPara.McuIo.pinNum);
}
}
break
;
...
...
@@ -287,19 +289,19 @@ void mwWMHCommSendIsr(uint32_t tmpCnts)
if
(
mwWMHCommFrameTimerCnts
[
n
].
LowLevelTime
<
mwWMHCommSequentialParams
[
tmpFrame
].
Standard
.
LowLevelTime
)
{
//RTE_GPIO_Config(RTE_GPIO_PORTB_PIN11, GpioOut_Low);
// GPIOB->PBSC = (1 << (11 + 16));
WMH_COMM
=
0
;
//
WMH_COMM = 0;
//PORT_ClrBit(GpioMapData[mwWMHCommPin[n]].IoPara.McuIo.pinGroup, GpioMapData[mwWMHCommPin[n]].IoPara.McuIo.pinNum);
mwWMHCommFrameTimerCnts
[
n
].
LowLevelTime
+=
tmpCnts
;
if
(
mwWMHCommFrameTimerCnts
[
n
].
LowLevelTime
>=
mwWMHCommSequentialParams
[
tmpFrame
].
Standard
.
LowLevelTime
)
{
// GPIOB->PBSC = (1 << 11);
WMH_COMM
=
1
;
//
WMH_COMM = 1;
//RTE_GPIO_Config(RTE_GPIO_PORTB_PIN11, GpioOut_High);
//PORT_SetBit(GpioMapData[mwWMHCommPin[n]].IoPara.McuIo.pinGroup, GpioMapData[mwWMHCommPin[n]].IoPara.McuIo.pinNum);
}
}
else
if
(
mwWMHCommFrameTimerCnts
[
n
].
HighLevelTime
<
mwWMHCommSequentialParams
[
tmpFrame
].
Standard
.
HighLevelTime
)
{
//RTE_GPIO_Config(RTE_GPIO_PORTB_PIN11, GpioOut_High);
// GPIOB->PBSC = (1 << 11);
WMH_COMM
=
1
;
//
WMH_COMM = 1;
//PORT_SetBit(GpioMapData[mwWMHCommPin[n]].IoPara.McuIo.pinGroup, GpioMapData[mwWMHCommPin[n]].IoPara.McuIo.pinNum);
mwWMHCommFrameTimerCnts
[
n
].
HighLevelTime
+=
tmpCnts
;
if
(
mwWMHCommFrameTimerCnts
[
n
].
HighLevelTime
>=
mwWMHCommSequentialParams
[
tmpFrame
].
Standard
.
HighLevelTime
)
{
...
...
@@ -308,7 +310,7 @@ void mwWMHCommSendIsr(uint32_t tmpCnts)
if
(
tmpFrame
!=
EM_WMH_COMM_FRAME_STOP
)
{
//RTE_GPIO_Config(RTE_GPIO_PORTB_PIN11, GpioOut_Low);
// GPIOB->PBSC = (1 << (11 + 16));
WMH_COMM
=
0
;
//
WMH_COMM = 0;
//PORT_ClrBit(GpioMapData[mwWMHCommPin[n]].IoPara.McuIo.pinGroup, GpioMapData[mwWMHCommPin[n]].IoPara.McuIo.pinNum);
if
(
mwWMHCommSerialBuffer
[
n
].
Bit
>=
8
)
{
mwWMHCommSerialBuffer
[
n
].
Bit
=
0
;
...
...
@@ -320,7 +322,7 @@ void mwWMHCommSendIsr(uint32_t tmpCnts)
mwWMHCommSerialBuffer
[
n
].
Valid
=
0
;
//RTE_GPIO_Config(RTE_GPIO_PORTB_PIN11, GpioOut_Low);
// GPIOB->PBSC = (1 << (11 + 16));
WMH_COMM
=
0
;
//
WMH_COMM = 0;
//PORT_ClrBit(GpioMapData[mwWMHCommPin[n]].IoPara.McuIo.pinGroup, GpioMapData[mwWMHCommPin[n]].IoPara.McuIo.pinNum);
}
}
...
...
@@ -336,7 +338,7 @@ void mwWMHCommSendIsr(uint32_t tmpCnts)
}
else
{
//RTE_GPIO_Config(RTE_GPIO_PORTB_PIN11, GpioOut_High);
// GPIOB->PBSC = (1 << 11);
WMH_COMM
=
1
;
//
WMH_COMM = 1;
//PORT_SetBit(GpioMapData[mwWMHCommPin[n]].IoPara.McuIo.pinGroup, GpioMapData[mwWMHCommPin[n]].IoPara.McuIo.pinNum);
mwWMHCommFrame
[
n
]
=
EM_WMH_COMM_FRAME_STANDBAY
;
}
...
...
@@ -346,7 +348,7 @@ void mwWMHCommSendIsr(uint32_t tmpCnts)
default:
{
// GPIOB->PBSC = (1 << 11);
WMH_COMM
=
1
;
//
WMH_COMM = 1;
//PORT_SetBit(GpioMapData[n].IoPara.McuIo.pinGroup, GpioMapData[n].IoPara.McuIo.pinNum);
mwWMHCommFrame
[
n
]
=
EM_WMH_COMM_FRAME_STANDBAY
;
}
break
;
...
...
YueJin_test_bench/source/Appliciation/mwWMHComm.h
View file @
6a8eeb1b
#ifndef __MW_WMH_COMM_H_
#define __MW_WMH_COMM_H_
#include "TYW_stdint.h"
#include "wmhcomm.h"
#include "wmhcommdata.h"
#define NULL_P (void *)0
typedef
enum
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment