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
579303ff
Commit
579303ff
authored
Oct 10, 2025
by
何锐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat:实现电动功能
parent
ca5ce2fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
0 deletions
+97
-0
g_Var.h
app_Headers/g_Var.h
+4
-0
app_CAN.c
app_Sources/app_CAN.c
+93
-0
No files found.
app_Headers/g_Var.h
View file @
579303ff
...
@@ -43,6 +43,10 @@
...
@@ -43,6 +43,10 @@
EXTERN_VAR
volatile
_CanMsg
g_Msg084
;
EXTERN_VAR
volatile
_CanMsg
g_Msg084
;
EXTERN_VAR
volatile
_CanMsg
g_Msg18DA17F9
;
EXTERN_VAR
volatile
_CanMsg
g_Msg18DA17F9
;
EXTERN_VAR
volatile
_CanMsg
g_Msg101
;
//ˮ�� ����
EXTERN_VAR
volatile
_CanMsg
g_Msg101
;
//ˮ�� ����
EXTERN_VAR
volatile
_CanMsg
g_Msg1B1
;
EXTERN_VAR
volatile
_CanMsg
g_Msg755
;
EXTERN_VAR
volatile
_CanMsg
g_Msg2B1
;
EXTERN_VAR
volatile
_CanMsg
g_Msg3B0
;
EXTERN_VAR
volatile
_CanMsg
g_Msg402
;
//������ָʾ��
EXTERN_VAR
volatile
_CanMsg
g_Msg402
;
//������ָʾ��
EXTERN_VAR
volatile
__RevCanMsg
g_Msg18DAF917
;
EXTERN_VAR
volatile
__RevCanMsg
g_Msg18DAF917
;
...
...
app_Sources/app_CAN.c
View file @
579303ff
...
@@ -155,6 +155,13 @@ void app_Can_handle(void)
...
@@ -155,6 +155,13 @@ void app_Can_handle(void)
g_bReturn
=
bsp_CANSendFrame
(
g_Msg084
.
id
,
g_Msg084
.
prio
,
g_Msg084
.
dlc
,
g_Msg084
.
data
);
g_bReturn
=
bsp_CANSendFrame
(
g_Msg084
.
id
,
g_Msg084
.
prio
,
g_Msg084
.
dlc
,
g_Msg084
.
data
);
g_bReturn
=
bsp_CANSendFrame
(
g_Msg230
.
id
,
g_Msg230
.
prio
,
g_Msg230
.
dlc
,
g_Msg230
.
data
);
g_bReturn
=
bsp_CANSendFrame
(
g_Msg230
.
id
,
g_Msg230
.
prio
,
g_Msg230
.
dlc
,
g_Msg230
.
data
);
g_bReturn
=
bsp_CANSendFrame
(
g_Msg101
.
id
,
g_Msg101
.
prio
,
g_Msg101
.
dlc
,
g_Msg101
.
data
);
g_bReturn
=
bsp_CANSendFrame
(
g_Msg101
.
id
,
g_Msg101
.
prio
,
g_Msg101
.
dlc
,
g_Msg101
.
data
);
g_bReturn
=
bsp_CANSendFrame
(
g_Msg1B1
.
id
,
g_Msg1B1
.
prio
,
g_Msg1B1
.
dlc
,
g_Msg1B1
.
data
);
g_bReturn
=
bsp_CANSendFrame
(
g_Msg755
.
id
,
g_Msg755
.
prio
,
g_Msg755
.
dlc
,
g_Msg755
.
data
);
g_bReturn
=
bsp_CANSendFrame
(
g_Msg2B1
.
id
,
g_Msg2B1
.
prio
,
g_Msg2B1
.
dlc
,
g_Msg2B1
.
data
);
if
((
G_Button
.
LED_STEP
!=
0
)
&&
(
G_Button
.
LED_STEP
!=
1
))
{
g_bReturn
=
bsp_CANSendFrame
(
g_Msg3B0
.
id
,
g_Msg3B0
.
prio
,
g_Msg3B0
.
dlc
,
g_Msg3B0
.
data
);
}
g_bReturn
=
bsp_CANSendExtFrame
(
g_Msg0C01FF55
.
id
,
g_Msg0C01FF55
.
prio
,
g_Msg0C01FF55
.
dlc
,
g_Msg0C01FF55
.
data
);
g_bReturn
=
bsp_CANSendExtFrame
(
g_Msg0C01FF55
.
id
,
g_Msg0C01FF55
.
prio
,
g_Msg0C01FF55
.
dlc
,
g_Msg0C01FF55
.
data
);
g_bReturn
=
bsp_CANSendExtFrame
(
g_Msg0C01FFAB
.
id
,
g_Msg0C01FFAB
.
prio
,
g_Msg0C01FFAB
.
dlc
,
g_Msg0C01FFAB
.
data
);
g_bReturn
=
bsp_CANSendExtFrame
(
g_Msg0C01FFAB
.
id
,
g_Msg0C01FFAB
.
prio
,
g_Msg0C01FFAB
.
dlc
,
g_Msg0C01FFAB
.
data
);
g_bReturn
=
bsp_CANSendExtFrame
(
g_Msg0C01FFA5
.
id
,
g_Msg0C01FFA5
.
prio
,
g_Msg0C01FFA5
.
dlc
,
g_Msg0C01FFA5
.
data
);
g_bReturn
=
bsp_CANSendExtFrame
(
g_Msg0C01FFA5
.
id
,
g_Msg0C01FFA5
.
prio
,
g_Msg0C01FFA5
.
dlc
,
g_Msg0C01FFA5
.
data
);
...
@@ -340,6 +347,22 @@ void app_Can_IdInit(void)
...
@@ -340,6 +347,22 @@ void app_Can_IdInit(void)
g_Msg18FF5000
.
id
=
0X18FF5000
;
g_Msg18FF5000
.
id
=
0X18FF5000
;
g_Msg18FF5000
.
prio
=
0
;
g_Msg18FF5000
.
prio
=
0
;
g_Msg18FF5000
.
dlc
=
8
;
g_Msg18FF5000
.
dlc
=
8
;
g_Msg1B1
.
id
=
0X1B1
;
g_Msg1B1
.
prio
=
0
;
g_Msg1B1
.
dlc
=
8
;
g_Msg755
.
id
=
0X755
;
g_Msg755
.
prio
=
0
;
g_Msg755
.
dlc
=
8
;
g_Msg2B1
.
id
=
0X2B1
;
g_Msg2B1
.
prio
=
0
;
g_Msg2B1
.
dlc
=
8
;
g_Msg3B0
.
id
=
0X3B0
;
g_Msg3B0
.
prio
=
0
;
g_Msg3B0
.
dlc
=
8
;
}
}
...
@@ -685,6 +708,16 @@ void app_Can_handle_PA5(void) {
...
@@ -685,6 +708,16 @@ void app_Can_handle_PA5(void) {
g_Msg18FF5100
.
data
[
1
].
bbyte
=
0x00
;
g_Msg18FF5100
.
data
[
1
].
bbyte
=
0x00
;
g_Msg18FF5100
.
data
[
2
].
bbyte
=
0x00
;
g_Msg18FF5100
.
data
[
2
].
bbyte
=
0x00
;
g_Msg1B1
.
data
[
1
].
bbyte
=
0x00
;
//电量
g_Msg755
.
data
[
0
].
bbyte
=
0x00
;
//车速
g_Msg2B1
.
data
[
2
].
bbyte
=
0x00
;
//充电
g_Msg3B0
.
data
[
0
].
bbyte
=
0x00
;
//温度
g_Msg3B0
.
data
[
1
].
bbyte
=
0x00
;
g_Msg3B0
.
data
[
2
].
bbyte
=
0x00
;
g_Msg3B0
.
data
[
3
].
bbyte
=
0x00
;
}
}
if
(
G_Button
.
LED_STEP
==
1
)
if
(
G_Button
.
LED_STEP
==
1
)
{
{
...
@@ -716,6 +749,18 @@ void app_Can_handle_PA5(void) {
...
@@ -716,6 +749,18 @@ void app_Can_handle_PA5(void) {
g_Msg18FF5100
.
data
[
1
].
bbyte
=
0x79
;
g_Msg18FF5100
.
data
[
1
].
bbyte
=
0x79
;
g_Msg18FF5100
.
data
[
2
].
bbyte
=
0x00
;
g_Msg18FF5100
.
data
[
2
].
bbyte
=
0x00
;
g_Msg1B1
.
data
[
0
].
bbyte
=
0x03
;
//电量10
g_Msg1B1
.
data
[
1
].
bbyte
=
0xE8
;
g_Msg755
.
data
[
0
].
bbyte
=
0x16
;
//车速10
g_Msg2B1
.
data
[
2
].
bbyte
=
0x00
;
//充电
g_Msg3B0
.
data
[
0
].
bbyte
=
0x00
;
//温度
g_Msg3B0
.
data
[
1
].
bbyte
=
0x00
;
g_Msg3B0
.
data
[
2
].
bbyte
=
0x00
;
g_Msg3B0
.
data
[
3
].
bbyte
=
0x00
;
}
}
if
(
G_Button
.
LED_STEP
==
2
)
if
(
G_Button
.
LED_STEP
==
2
)
{
{
...
@@ -745,6 +790,18 @@ void app_Can_handle_PA5(void) {
...
@@ -745,6 +790,18 @@ void app_Can_handle_PA5(void) {
g_Msg18FF5100
.
data
[
1
].
bbyte
=
0x00
;
g_Msg18FF5100
.
data
[
1
].
bbyte
=
0x00
;
g_Msg18FF5100
.
data
[
2
].
bbyte
=
0x00
;
g_Msg18FF5100
.
data
[
2
].
bbyte
=
0x00
;
g_Msg1B1
.
data
[
0
].
bbyte
=
0x0F
;
//电量40
g_Msg1B1
.
data
[
1
].
bbyte
=
0xA0
;
g_Msg755
.
data
[
0
].
bbyte
=
0x2E
;
//车速20
g_Msg2B1
.
data
[
2
].
bbyte
=
0x40
;
//充电
g_Msg3B0
.
data
[
0
].
bbyte
=
0x00
;
//温度
g_Msg3B0
.
data
[
1
].
bbyte
=
0x00
;
g_Msg3B0
.
data
[
2
].
bbyte
=
0x02
;
g_Msg3B0
.
data
[
3
].
bbyte
=
0x58
;
}
}
if
(
G_Button
.
LED_STEP
==
3
)
if
(
G_Button
.
LED_STEP
==
3
)
{
{
...
@@ -776,6 +833,18 @@ g_Msg12B.data[2].bbyte=0x05;
...
@@ -776,6 +833,18 @@ g_Msg12B.data[2].bbyte=0x05;
g_Msg18FF5100
.
data
[
1
].
bbyte
=
0x00
;
g_Msg18FF5100
.
data
[
1
].
bbyte
=
0x00
;
g_Msg18FF5100
.
data
[
2
].
bbyte
=
0x00
;
g_Msg18FF5100
.
data
[
2
].
bbyte
=
0x00
;
g_Msg1B1
.
data
[
0
].
bbyte
=
0x17
;
//电量60
g_Msg1B1
.
data
[
1
].
bbyte
=
0x70
;
g_Msg755
.
data
[
0
].
bbyte
=
0x41
;
//车速30
g_Msg2B1
.
data
[
2
].
bbyte
=
0x40
;
//充电
g_Msg3B0
.
data
[
0
].
bbyte
=
0x00
;
//温度
g_Msg3B0
.
data
[
1
].
bbyte
=
0x00
;
g_Msg3B0
.
data
[
2
].
bbyte
=
0x02
;
g_Msg3B0
.
data
[
3
].
bbyte
=
0x58
;
}
}
if
(
G_Button
.
LED_STEP
==
4
)
if
(
G_Button
.
LED_STEP
==
4
)
{
{
...
@@ -807,6 +876,18 @@ g_Msg12B.data[2].bbyte=0x05;
...
@@ -807,6 +876,18 @@ g_Msg12B.data[2].bbyte=0x05;
g_Msg18FF5100
.
data
[
1
].
bbyte
=
0x00
;
g_Msg18FF5100
.
data
[
1
].
bbyte
=
0x00
;
g_Msg18FF5100
.
data
[
2
].
bbyte
=
0x40
;
g_Msg18FF5100
.
data
[
2
].
bbyte
=
0x40
;
g_Msg1B1
.
data
[
0
].
bbyte
=
0x27
;
//电量100
g_Msg1B1
.
data
[
1
].
bbyte
=
0x10
;
g_Msg755
.
data
[
0
].
bbyte
=
0x68
;
//车速45
g_Msg2B1
.
data
[
2
].
bbyte
=
0x00
;
//充电
g_Msg3B0
.
data
[
0
].
bbyte
=
0xFF
;
//温度
g_Msg3B0
.
data
[
1
].
bbyte
=
0xF6
;
g_Msg3B0
.
data
[
2
].
bbyte
=
0x00
;
g_Msg3B0
.
data
[
3
].
bbyte
=
0x00
;
}
}
if
(
G_Button
.
LED_STEP
==
5
)
if
(
G_Button
.
LED_STEP
==
5
)
...
@@ -839,6 +920,18 @@ g_Msg12B.data[2].bbyte=0x05;
...
@@ -839,6 +920,18 @@ g_Msg12B.data[2].bbyte=0x05;
g_Msg18FF5100
.
data
[
1
].
bbyte
=
0x79
;
g_Msg18FF5100
.
data
[
1
].
bbyte
=
0x79
;
g_Msg18FF5100
.
data
[
2
].
bbyte
=
0x40
;
g_Msg18FF5100
.
data
[
2
].
bbyte
=
0x40
;
g_Msg1B1
.
data
[
0
].
bbyte
=
0x03
;
//电量10
g_Msg1B1
.
data
[
1
].
bbyte
=
0xE8
;
g_Msg755
.
data
[
0
].
bbyte
=
0x68
;
//车速45
g_Msg2B1
.
data
[
2
].
bbyte
=
0x40
;
//充电
g_Msg3B0
.
data
[
0
].
bbyte
=
0xFF
;
//温度
g_Msg3B0
.
data
[
1
].
bbyte
=
0xF6
;
g_Msg3B0
.
data
[
2
].
bbyte
=
0x02
;
g_Msg3B0
.
data
[
3
].
bbyte
=
0x58
;
}
}
if
(
G_Button
.
LED_STEP
==
6
)
if
(
G_Button
.
LED_STEP
==
6
)
{
{
...
...
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