Обновление 23.06.2026
This commit is contained in:
parent
d52b67b759
commit
df766224fb
23
CanPorts.c
23
CanPorts.c
|
|
@ -14,6 +14,13 @@
|
|||
tCanPorts CAN_PORTS;
|
||||
|
||||
static void CAN0_ErrorInterrupt_CallBack(uint8_t u8CanIndex, FLEXCAN_ErrorInfoType *pErrorInfo) {
|
||||
|
||||
if (pErrorInfo->u32ErrorValue & FLEXCAN_ESR1_BOFFINT_MASK) {
|
||||
FLEXCAN_Stop(u8CanIndex);
|
||||
FLEXCAN_DeInit(u8CanIndex);
|
||||
vCanPort_InitCan0();
|
||||
}
|
||||
|
||||
FLEXCAN_ClrErrorInfo(u8CanIndex, pErrorInfo);
|
||||
PROCESS_UNUSED_VAR(u8CanIndex);
|
||||
PROCESS_UNUSED_VAR(pErrorInfo);
|
||||
|
|
@ -24,6 +31,13 @@ static void CAN0_TxInterruptCallBackType(uint8_t u8CanIndex, uint8_t u8TxHandler
|
|||
}
|
||||
|
||||
static void CAN1_ErrorInterrupt_CallBack(uint8_t u8CanIndex, FLEXCAN_ErrorInfoType *pErrorInfo) {
|
||||
|
||||
if (pErrorInfo->u32ErrorValue & FLEXCAN_ESR1_BOFFINT_MASK) {
|
||||
FLEXCAN_Stop(u8CanIndex);
|
||||
FLEXCAN_DeInit(u8CanIndex);
|
||||
vCanPort_InitCan1();
|
||||
}
|
||||
|
||||
FLEXCAN_ClrErrorInfo(u8CanIndex, pErrorInfo);
|
||||
PROCESS_UNUSED_VAR(u8CanIndex);
|
||||
PROCESS_UNUSED_VAR(pErrorInfo);
|
||||
|
|
@ -182,7 +196,8 @@ const FLEXCAN_RxMbFilterType IdCanFilterFifoCan1[countIdCanFilterFifoCan1] = {
|
|||
};
|
||||
#endif
|
||||
|
||||
static bool vCanPort_InitCan0() {
|
||||
|
||||
bool vCanPort_InitCan0() {
|
||||
|
||||
vCanPort_InitCAN0RxTxPin();
|
||||
|
||||
|
|
@ -287,7 +302,7 @@ static void vCanPort_InitCAN1RxTxPin() {
|
|||
GPIO_InitPins(GPIO_A, &tGpioInitStruct);
|
||||
}
|
||||
|
||||
static bool vCanPort_InitCan1() {
|
||||
bool vCanPort_InitCan1() {
|
||||
|
||||
vCanPort_InitCAN1RxTxPin();
|
||||
|
||||
|
|
@ -356,7 +371,7 @@ static bool vCanPort_InitCan1() {
|
|||
|
||||
|
||||
void CanPorts_Init(tLoggerInterface *logger) {
|
||||
CAN_PORTS.Can0.reInit = false;
|
||||
CAN_PORTS.Can0.reInitOne = false;
|
||||
bool result = vCanPort_InitCan0();
|
||||
if (result) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Initialization CAN0 - OK")
|
||||
|
|
@ -365,7 +380,7 @@ void CanPorts_Init(tLoggerInterface *logger) {
|
|||
}
|
||||
CAN_PORTS.Can0_IO = CanPortFrame_GetIo(&CAN_PORTS.Can0);
|
||||
|
||||
CAN_PORTS.Can1.reInit = false;
|
||||
CAN_PORTS.Can1.reInitOne = false;
|
||||
|
||||
result = vCanPort_InitCan1();
|
||||
if (result) {
|
||||
|
|
|
|||
|
|
@ -31,5 +31,7 @@ typedef struct {
|
|||
extern tCanPorts CAN_PORTS;
|
||||
|
||||
void CanPorts_Init(tLoggerInterface *logger);
|
||||
bool vCanPort_InitCan0();
|
||||
bool vCanPort_InitCan1();
|
||||
|
||||
#endif //SMART_COMPONENTS_CANPORTS_H
|
||||
|
|
|
|||
Loading…
Reference in New Issue