Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
haoJin750TFT
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
时昊
haoJin750TFT
Commits
53336ec9
Commit
53336ec9
authored
Jul 17, 2024
by
郑萍
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat:CAN接收调通
parent
549c3fbc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
Can_User.c
Firmware/Source/Application/Can_User.c
+2
-2
rte_can.c
Firmware/Source/Device/Cmsemicon/BAT32A279/RTE/CAN/rte_can.c
+15
-2
No files found.
Firmware/Source/Application/Can_User.c
View file @
53336ec9
...
...
@@ -15,8 +15,8 @@ void Can_Init(void)
can_config_st_t
Can_Config
;
Can_Config
.
ch
=
CAN_CH_0
;
Can_Config
.
freq
=
CAN_500Kbps
;
Can_Config
.
MASK
[
0
]
=
0x
001
fffffU
;
Can_Config
.
MASK
[
1
]
=
0x
000
fffffU
;
Can_Config
.
MASK
[
0
]
=
0x
1ff
fffffU
;
Can_Config
.
MASK
[
1
]
=
0x
1ff
fffffU
;
Can_Config
.
MASK
[
2
]
=
0x1fffffffU
;
Can_Config
.
MASK
[
3
]
=
0x1fffffffU
;
Can_Config
.
rx_callback
=
Can_Rx_Cak
;
...
...
Firmware/Source/Device/Cmsemicon/BAT32A279/RTE/CAN/rte_can.c
View file @
53336ec9
...
...
@@ -6,8 +6,21 @@
CANMSG_Type
*
CANMSG
;
CanTxRxMsg
CAN_RecvMsg
;
CANBuffList_t
CanBufList
=
{
0
};
can_rx_callback
can_rx_handler
=
NULL
;
uint8_t
Read_RingBuff
(
CanTxRxMsg
*
data
)
{
if
(
CanBufList
.
length
==
0
)
{
return
0
;
}
*
data
=
CanBufList
.
data
[
CanBufList
.
Head
];
CanBufList
.
Head
=
(
CanBufList
.
Head
+
1
)
%
LIST_BUF_MAX_NUM
;
CanBufList
.
length
--
;
return
1
;
}
/**
* @brief CAN就收完成回调
*
...
...
@@ -20,8 +33,8 @@ static void can_recv_handler(void *msg)
if
(
CAN_GetFlagStatus
(
CAN0
,
CAN_FLAG_REC
)
!=
RESET
)
{
CAN_ClearFlag
(
CAN0
,
CAN_FLAG_REC
);
// CANMSG = CAN_Get_CANxMSGy(CAN0
);
// CAN_Receive_IT(CAN0,
&CAN_RecvMsg);
CAN_Receive_IT
(
CAN0
,
&
CanBufList
);
Read_RingBuff
(
&
CAN_RecvMsg
);
if
(
can_rx_handler
!=
NULL
)
{
...
...
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