Commit 0e4e8eb5 authored by 时昊's avatar 时昊

feat:增加can功能,外发,接收,初始化

parent 0fb7e3f4
This diff is collapsed.
// #ifndef _CAN_USER_H_ #ifndef _CAN_USER_H_
// #define _CAN_USER_H_ #define _CAN_USER_H_
// #include "RTE.h" #include "RTE.h"
// #include "Components.h" #include "Components.h"
// /****************************************************************************** /******************************************************************************
// Bus-off Bus-off
// ******************************************************************************/ ******************************************************************************/
// #define RSCAN0_BUS_STABLE 0x00U #define RSCAN0_BUS_STABLE 0x00U
// #define RSCAN0_BUS_OFF_LV1 0x01U #define RSCAN0_BUS_OFF_LV1 0x01U
// #define RSCAN0_BUS_OFF_LV2 0x02U #define RSCAN0_BUS_OFF_LV2 0x02U
// #define RSCAN00_BUS_LIMP 0x03U #define RSCAN00_BUS_LIMP 0x03U
// /****************************************************************************** /******************************************************************************
// Bus-off Bus-off
// ******************************************************************************/ ******************************************************************************/
// #define RSCAN0_BUS_OFF_LV1_RECOVERY_TIME 90U #define RSCAN0_BUS_OFF_LV1_RECOVERY_TIME 90U
// #define RSCAN0_BUS_OFF_LV2_RECOVERY_TIME 1000U #define RSCAN0_BUS_OFF_LV2_RECOVERY_TIME 1000U
// typedef struct typedef struct
// { {
// uint8_t Status; uint8_t Status;
// uint8_t Timer; uint8_t Timer;
// uint8_t Cnt; uint8_t Cnt;
// uint8_t ReportDTCCnt; uint8_t ReportDTCCnt;
// } RSCAN0BusoffMonitorStruct; } RSCAN0BusoffMonitorStruct;
// extern void Can_Tx_Apply_Buff(void); extern void Can_Tx_Apply_Buff(void);
// extern void Can_RX_Apply_Buff(void); extern void Can_RX_Apply_Buff(void);
// extern void Can_BusOff_Recover(uint8_t deltaTime); extern void Can_BusOff_Recover(uint8_t deltaTime);
// extern void COM_CAN_Init(void); extern void COM_CAN_Init(void);
// extern void Can_Init(void); extern void Can_Init(void);
// extern void Can_Rx_Cak(CanTxRxMsg *Msg); extern void Can_Rx_Cak(CanTxRxMsg *Msg);
// extern void Busoff(void); extern void Busoff(void);
// extern uint8_t COM_APP_Process(st_CAN_Msg *Msg); extern uint8_t COM_APP_Process(st_CAN_Msg *Msg);
// extern void Can_Write(st_CAN_Msg *Msg); extern void Can_Write(st_CAN_Msg *Msg);
// #endif #endif
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
uint32_t PowerIgnOnTimeLine; uint32_t PowerIgnOnTimeLine;
uint32_t PowerIgnOffTimeLine; uint32_t PowerIgnOffTimeLine;
static uint32_t PowerSocTimeLine; static uint32_t PowerSocTimeLine;
......
...@@ -28,5 +28,7 @@ ...@@ -28,5 +28,7 @@
#include "Data_VSpeed.h" #include "Data_VSpeed.h"
#include "BackLight.h" #include "BackLight.h"
#include "RTC\RTE_RTC.h" #include "RTC\RTE_RTC.h"
#include "CAN_Signal\CAN_Lib.h"
#include "CAN_CH0_CAN_Communication_Matrix.h"
#endif #endif
...@@ -64,14 +64,13 @@ static void Power_KL30_Init(void) ...@@ -64,14 +64,13 @@ static void Power_KL30_Init(void)
g_stRTCInformation.u8RTCYear = 20; g_stRTCInformation.u8RTCYear = 20;
//RTE_RTC_Init(g_stRTCInformation); //RTE_RTC_Init(g_stRTCInformation);
Menu_User_Init(); Menu_User_Init();
Can_Init();
Protocol_KL30_Wakeup_Init(); Protocol_KL30_Wakeup_Init();
RTE_DEEPSLEEP_GPIO_Interrupt_Enable(KL15_AD_IN, Trigger_Rising); RTE_DEEPSLEEP_GPIO_Interrupt_Enable(KL15_AD_IN, Trigger_Rising);
} }
//extern uint32_t PowerIgnOffTimeLine;
static void Power_Wakeup_Init(void) static void Power_Wakeup_Init(void)
{ {
// PowerIgnOffTimeLine = 0;
Gpio_Init(Gpio_WakeUp_Init); Gpio_Init(Gpio_WakeUp_Init);
eeprom_StoreInfo_Init(); eeprom_StoreInfo_Init();
Analog_Signal_Conv_Init(); Analog_Signal_Conv_Init();
...@@ -89,6 +88,7 @@ static void Power_Wakeup_Init(void) ...@@ -89,6 +88,7 @@ static void Power_Wakeup_Init(void)
//Telltales_Init(); //Telltales_Init();
Key_KL30_Init_EXample(); Key_KL30_Init_EXample();
Menu_User_WAKEUP(); Menu_User_WAKEUP();
Can_Init();
Protocol_KL30_Wakeup_Init(); Protocol_KL30_Wakeup_Init();
RTE_DEEPSLEEP_GPIO_Interrupt_Enable(KL15_AD_IN, Trigger_Rising); RTE_DEEPSLEEP_GPIO_Interrupt_Enable(KL15_AD_IN, Trigger_Rising);
} }
...@@ -184,6 +184,7 @@ static Power_Status_em Power_Stay_Protect(void) ...@@ -184,6 +184,7 @@ static Power_Status_em Power_Stay_Protect(void)
/* 关闭所有外设,坪保留AD采集,电溝状思切�? */ /* 关闭所有外设,坪保留AD采集,电溝状思切�? */
{ {
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, 0); TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, 0);
CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Disable);
} }
u8PowerSts = EM_IGN_OFF_Init; u8PowerSts = EM_IGN_OFF_Init;
/* 电溝模弝正常 */ /* 电溝模弝正常 */
...@@ -196,6 +197,7 @@ static Power_Status_em Power_Stay_Protect(void) ...@@ -196,6 +197,7 @@ static Power_Status_em Power_Stay_Protect(void)
if ( SYS_OPR_STAT_RUN ) if ( SYS_OPR_STAT_RUN )
{ {
CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable);
return u8PowerSts; return u8PowerSts;
} }
......
...@@ -15,6 +15,8 @@ void Sys_2ms_Tasks(void) ...@@ -15,6 +15,8 @@ void Sys_2ms_Tasks(void)
Sys_Status_Update_Service(); Sys_Status_Update_Service();
Analog_Signal_Conv_Service(); Analog_Signal_Conv_Service();
AMT630H_Main(); AMT630H_Main();
Can_Write_Fun(&CAN_CH0_CanMsgTxOp, 2000u);
CanMSg_XMS_Analysis(&CAN_CH0_CanMsgOp, 2u);
} }
void Sys_5ms_Tasks(void) void Sys_5ms_Tasks(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment