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
1a4adee7
Commit
1a4adee7
authored
Sep 23, 2024
by
张金硕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐞
fix:替换can的厂家库
parent
f4fc76dc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
10 deletions
+16
-10
can.h
...e/Device/Cmsemicon/BAT32A279/Library/Driver/include/can.h
+1
-1
can.c
...ource/Device/Cmsemicon/BAT32A279/Library/Driver/src/can.c
+1
-1
rte_can.c
Firmware/Source/Device/Cmsemicon/BAT32A279/RTE/CAN/rte_can.c
+13
-7
rte_can.h
Firmware/Source/Device/Cmsemicon/BAT32A279/RTE/CAN/rte_can.h
+1
-1
No files found.
Firmware/Source/Device/Cmsemicon/BAT32A279/Library/Driver/include/can.h
View file @
1a4adee7
...
...
@@ -384,7 +384,7 @@ typedef struct
#define CAN_CCTRL_OPMODE_IDLE ((uint16_t)0x0007U)
#define CAN_CCTRL_OPMODE_NORMAL ((uint16_t)0x0106U)//0x0100U
#define CAN_CCTRL_OPMODE_NORMAL_ABT
((uint16_t)0x0205U)//0x0200U
#define CAN_CCTRL_OPMODE_NORMAL_ABT ((uint16_t)0x0205U)//0x0200U
#define CAN_CCTRL_OPMODE_ONLY_RX ((uint16_t)0x0304U)//0x0300U
#define CAN_CCTRL_OPMODE_SHOT ((uint16_t)0x0403U)//0x0400U
#define CAN_CCTRL_OPMODE_TEST ((uint16_t)0x0502U)//0x0500U
...
...
Firmware/Source/Device/Cmsemicon/BAT32A279/Library/Driver/src/can.c
View file @
1a4adee7
...
...
@@ -2,7 +2,7 @@
******************************************************************************
* @file can.c
* @author MCD Application Team
* @version V1.0.
2
* @version V1.0.
1
* @date 2-April-2024
* @brief This file provides firmware functions to manage the following
* functionalities of the Controller area network (CAN) peripheral:
...
...
Firmware/Source/Device/Cmsemicon/BAT32A279/RTE/CAN/rte_can.c
View file @
1a4adee7
...
...
@@ -3,10 +3,9 @@
#include "isr.h"
#include "rte_can.h"
CANBuffList_t
CanBufList
=
{
0
};
CANMSG_Type
*
CANMSG
;
CanTxRxMsg
CAN_RecvMsg
;
CANBuffList_t
CanBufList
=
{
0
};
can_rx_callback
can_rx_handler
=
NULL
;
uint8_t
Read_RingBuff
(
CanTxRxMsg
*
data
)
...
...
@@ -20,29 +19,34 @@ uint8_t Read_RingBuff(CanTxRxMsg *data)
CanBufList
.
length
--
;
return
1
;
}
/**
* @brief CAN就收完成回调
*
* @param msg
*/
static
void
can_recv_handler
(
void
*
msg
)
static
void
can_recv_handler
(
void
)
{
INTC_ClearPendingIRQ
(
CAN0REC_IRQn
);
if
(
CAN_GetFlagStatus
(
CAN0
,
CAN_FLAG_REC
)
!=
RESET
)
{
CAN_ClearFlag
(
CAN0
,
CAN_FLAG_REC
);
CAN_Receive_IT
(
CAN0
,
&
CanBufList
);
Read_RingBuff
(
&
CAN_RecvMsg
);
CAN_Receive
(
CAN0
,
&
CAN_RecvMsg
,
100
);
if
(
can_rx_handler
!=
NULL
)
{
can_rx_handler
(
&
CAN_RecvMsg
);
}
}
}
static
void
can_error_handler
(
void
)
{
INTC_ClearPendingIRQ
(
CAN0ERR_IRQn
);
CANErr_Recover
(
CAN0
);
}
/**
* @brief CAN初始�?
*
...
...
@@ -97,11 +101,13 @@ uint8_t rte_can_init(can_config_st_t *config)
CAN_OperatingModeRequest
(
CAN0
,
CAN_OpMode_Normal
);
CAN_ITConfig
(
CAN0
,
CAN_IT_REC
,
ENABLE
);
CAN_ITConfig
(
CAN0
,
CAN_IT_REC
|
CAN_IT_ERR_STATE
|
CAN_IT_ERR_PROTO
,
ENABLE
);
// |CAN_IT_TRX
ISR_Register
(
CAN0REC_IRQn
,
can_recv_handler
);
INTC_EnableIRQ
(
CAN0REC_IRQn
);
// ISR_Register(CAN0TRX_IRQn, can_tx_handler);
ISR_Register
(
CAN0ERR_IRQn
,
can_error_handler
);
// ISR_DisRegister(CAN0REC_IRQn, can_recv_handler);
...
...
Firmware/Source/Device/Cmsemicon/BAT32A279/RTE/CAN/rte_can.h
View file @
1a4adee7
...
...
@@ -31,7 +31,7 @@ typedef enum
}
CAN_CH
;
#pragma pack(4)
typedef
struct
typedef
struct
__attribute__
((
aligned
(
4
)))
{
CAN_CH
ch
;
CAN_freq
freq
;
...
...
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