Commit 67f2a9c0 authored by 王雅楠's avatar 王雅楠

Merge branch 'zhengping' of http://tyw-server.synology.me:12345/shihao/haojin750tft into zhengping

parents 4ded9752 ff712839
...@@ -22,3 +22,4 @@ Firmware/Project/Cmsemicon/BAT32A279/MDK_ARM/Listings/HaoJin750TFT.map ...@@ -22,3 +22,4 @@ Firmware/Project/Cmsemicon/BAT32A279/MDK_ARM/Listings/HaoJin750TFT.map
/Firmware/Project/Cmsemicon/BAT32A279/MDK_ARM/Listings/HaoJin750TFT.map /Firmware/Project/Cmsemicon/BAT32A279/MDK_ARM/Listings/HaoJin750TFT.map
/Firmware/Project/Cmsemicon/BAT32A279/MDK_ARM/*.uvoptx /Firmware/Project/Cmsemicon/BAT32A279/MDK_ARM/*.uvoptx
/Firmware/Project/Cmsemicon/BAT32A279/MDK_ARM/JLinkLog.txt /Firmware/Project/Cmsemicon/BAT32A279/MDK_ARM/JLinkLog.txt
/Firmware/Project/Cmsemicon/BAT32A279/MDK_ARM/JLinkLog.txt
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -6,7 +6,7 @@ st_CanMsgTxOp CAN_CH0_CanMsgTxOp; ...@@ -6,7 +6,7 @@ st_CanMsgTxOp CAN_CH0_CanMsgTxOp;
const st_CAN_SendAttribute CAN_CH0_CANSendAttr[CAN_CH0_ID_SEND_TOTAL] = const st_CAN_SendAttribute CAN_CH0_CANSendAttr[CAN_CH0_ID_SEND_TOTAL] =
{ {
{0} {0}
}; };
const st_CANMsgAttribute CAN_CH0_CAN_MSG_CONST_ARRAY[CAN_CH0_ID_TOTAL_MAX] = const st_CANMsgAttribute CAN_CH0_CAN_MSG_CONST_ARRAY[CAN_CH0_ID_TOTAL_MAX] =
......
...@@ -3,9 +3,7 @@ ...@@ -3,9 +3,7 @@
#include "Components.h" #include "Components.h"
#include "CAN_Signal\CAN_Lib.h" #include "CAN_Signal\CAN_Lib.h"
extern st_CanMsgOp CAN_CH0_CanMsgOp; extern st_CanMsgOp CAN_CH0_CanMsgOp;
extern st_CanMsgTxOp CAN_CH0_CanMsgTxOp; extern st_CanMsgTxOp CAN_CH0_CanMsgTxOp;
typedef enum typedef enum
...@@ -23,7 +21,7 @@ typedef enum ...@@ -23,7 +21,7 @@ typedef enum
typedef enum typedef enum
{ {
TEST, TEST,
CAN_CH0_ID_SEND_TOTAL, CAN_CH0_ID_SEND_TOTAL,
} CAN_CH0_CAN_MSG_SEND_ID_t; } CAN_CH0_CAN_MSG_SEND_ID_t;
......
// #include "Can_User.h" #include "Can_User.h"
// #include <string.h> #include <string.h>
// #include "can.h" #include "can.h"
// #include "RTE.h" #include "RTE.h"
// #include "CAN_CH0_CAN_Communication_Matrix.h" #include "CAN_CH0_CAN_Communication_Matrix.h"
// __align(4) __align(4)
// uint32_t pRXBuff[CAN_RX_MSG_Block * CAN_CH0_ID_TOTAL_MAX]; uint32_t pRXBuff[CAN_RX_MSG_Block * CAN_CH0_ID_TOTAL_MAX];
// uint32_t pTXBuff[CAN_TX_MSG_Block * CAN_CH0_ID_SEND_TOTAL]; uint32_t pTXBuff[CAN_TX_MSG_Block * CAN_CH0_ID_SEND_TOTAL];
// static RSCAN0BusoffMonitorStruct RSCAN0Busoff; static RSCAN0BusoffMonitorStruct RSCAN0Busoff;
// void Can_Init(void) void Can_Init(void)
// { {
// can_config_st_t Can_Config; can_config_st_t Can_Config;
// Can_Config.ch = CAN_CH_0; Can_Config.ch = CAN_CH_0;
// Can_Config.freq = CAN_500Kbps; Can_Config.freq = CAN_500Kbps;
// Can_Config.MASK[0] = 0x001fffffU; Can_Config.MASK[0] = 0x1fffffffU;
// Can_Config.MASK[1] = 0x000fffffU; Can_Config.MASK[1] = 0x1fffffffU;
// Can_Config.MASK[2] = 0x1fffffffU; Can_Config.MASK[2] = 0x1fffffffU;
// Can_Config.MASK[3] = 0x1fffffffU; Can_Config.MASK[3] = 0x1fffffffU;
// Can_Config.rx_callback = Can_Rx_Cak; Can_Config.rx_callback = Can_Rx_Cak;
// COM_CAN_Init(); COM_CAN_Init();
// rte_can_init(&Can_Config); rte_can_init(&Can_Config);
// Can_Tx_Apply_Buff(); Can_Tx_Apply_Buff();
// Can_RX_Apply_Buff(); Can_RX_Apply_Buff();
// RTE_GPIO_Set_Level(RTE_GPIO_PORT05_PIN02,RTE_GPIO_LEVEL_LOW); RTE_GPIO_Set_Level(RTE_GPIO_PORT05_PIN02,RTE_GPIO_LEVEL_LOW);
// } }
// /** /**
// * @brief 用于申请RXBUFF CAN0MSG00~CAN0MSG07 * @brief 用于申请RXBUFF CAN0MSG00~CAN0MSG07
// * *
// */ */
// void Can_RX_Apply_Buff(void) void Can_RX_Apply_Buff(void)
// { {
// CAN_RecvMsg.Id = 0x101; CAN_RecvMsg.Id = 0x101;
// CAN_RecvMsg.IDE = CAN_Id_Standard; CAN_RecvMsg.IDE = CAN_Id_Standard;
// CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask; CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask;
// CAN_RecvMsg.RTR = CAN_RTR_Data; CAN_RecvMsg.RTR = CAN_RTR_Data;
// CAN_RecvMsg.Interrupt = ENABLE; CAN_RecvMsg.Interrupt = ENABLE;
// CAN_MessageCache_DeInit(CAN0MSG01); CAN_MessageCache_DeInit(CAN0MSG01);
// CAN_MessageCache_Init(CAN0MSG01, &CAN_RecvMsg); CAN_MessageCache_Init(CAN0MSG01, &CAN_RecvMsg);
// CAN_MessageCache_OverWriteConfig(CAN0MSG01, ENABLE); CAN_MessageCache_OverWriteConfig(CAN0MSG01, ENABLE);
CAN_RecvMsg.Id = 0x111;
// // CAN_RecvMsg.Id = DIAG_ID_Rx_PHY; CAN_RecvMsg.IDE = CAN_Id_Standard;
// // CAN_RecvMsg.IDE = CAN_Id_Standard; CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask;
// // CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask; CAN_RecvMsg.RTR = CAN_RTR_Data;
// // CAN_RecvMsg.RTR = CAN_RTR_Data; CAN_RecvMsg.Interrupt = ENABLE;
// // CAN_RecvMsg.Interrupt = ENABLE; CAN_MessageCache_DeInit(CAN0MSG02);
// // CAN_MessageCache_DeInit(CAN0MSG03); CAN_MessageCache_Init(CAN0MSG02, &CAN_RecvMsg);
// // CAN_MessageCache_Init(CAN0MSG03, &CAN_RecvMsg); CAN_MessageCache_OverWriteConfig(CAN0MSG02, ENABLE);
// // CAN_MessageCache_OverWriteConfig(CAN0MSG03, ENABLE);
CAN_RecvMsg.Id = 0x401;
// // CAN_RecvMsg.Id = DIAG_ID_Rx_FUN; CAN_RecvMsg.IDE = CAN_Id_Standard;
// // CAN_RecvMsg.IDE = CAN_Id_Standard; CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask;
// // CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask; CAN_RecvMsg.RTR = CAN_RTR_Data;
// // CAN_RecvMsg.RTR = CAN_RTR_Data; CAN_RecvMsg.Interrupt = ENABLE;
// // CAN_RecvMsg.Interrupt = ENABLE; CAN_MessageCache_DeInit(CAN0MSG03);
// // CAN_MessageCache_DeInit(CAN0MSG04); CAN_MessageCache_Init(CAN0MSG03, &CAN_RecvMsg);
// // CAN_MessageCache_Init(CAN0MSG04, &CAN_RecvMsg); CAN_MessageCache_OverWriteConfig(CAN0MSG03, ENABLE);
// // CAN_MessageCache_OverWriteConfig(CAN0MSG04, ENABLE);
// } CAN_RecvMsg.Id = 0x402;
CAN_RecvMsg.IDE = CAN_Id_Standard;
// /** CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask;
// * @brief 用于申请TXBUFF CAN_RecvMsg.RTR = CAN_RTR_Data;
// * CAN_RecvMsg.Interrupt = ENABLE;
// */ CAN_MessageCache_DeInit(CAN0MSG04);
// void Can_Tx_Apply_Buff(void) CAN_MessageCache_Init(CAN0MSG04, &CAN_RecvMsg);
// { CAN_MessageCache_OverWriteConfig(CAN0MSG04, ENABLE);
// CanTxRxMsg CAN_SendMsg;
// CanTxRxMsg CAN_SendMsg_Diag_Tx; CAN_RecvMsg.Id = 0x12B;
// CAN_SendMsg.Id = 0x500; CAN_RecvMsg.IDE = CAN_Id_Standard;
// CAN_SendMsg.IDE = CAN_Id_Standard; CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask;
// CAN_SendMsg.CacheType = CAN_CacheType_Tx; CAN_RecvMsg.RTR = CAN_RTR_Data;
// CAN_SendMsg.RTR = CAN_RTR_Data; CAN_RecvMsg.Interrupt = ENABLE;
// CAN_RecvMsg.Interrupt = DISABLE; CAN_MessageCache_DeInit(CAN0MSG05);
// CAN_SendMsg.DLC = 8; CAN_MessageCache_Init(CAN0MSG05, &CAN_RecvMsg);
// for (uint8_t i = 0; i < CAN_SendMsg.DLC; i++) CAN_MessageCache_OverWriteConfig(CAN0MSG05, ENABLE);
// {
// CAN_SendMsg.Data[i] = 0; CAN_RecvMsg.Id = 0x450;
// } CAN_RecvMsg.IDE = CAN_Id_Standard;
CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask;
// CAN_MessageCache_DeInit(CAN0MSG08); CAN_RecvMsg.RTR = CAN_RTR_Data;
// CAN_MessageCache_Init(CAN0MSG08, &CAN_SendMsg); CAN_RecvMsg.Interrupt = ENABLE;
CAN_MessageCache_DeInit(CAN0MSG06);
CAN_MessageCache_Init(CAN0MSG06, &CAN_RecvMsg);
// // CAN_SendMsg_Diag_Tx.Id = DIAG_ID_Tx; CAN_MessageCache_OverWriteConfig(CAN0MSG06, ENABLE);
// // CAN_SendMsg_Diag_Tx.IDE = CAN_Id_Standard;
// // CAN_SendMsg_Diag_Tx.CacheType = CAN_CacheType_Tx; CAN_RecvMsg.Id = 0x37B;
// // CAN_SendMsg_Diag_Tx.RTR = CAN_RTR_Data; CAN_RecvMsg.IDE = CAN_Id_Standard;
// // CAN_SendMsg_Diag_Tx.Interrupt = DISABLE; CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask;
// // CAN_SendMsg_Diag_Tx.DLC = 8; CAN_RecvMsg.RTR = CAN_RTR_Data;
// // for (uint8_t i = 0; i < CAN_SendMsg_Diag_Tx.DLC; i++) CAN_RecvMsg.Interrupt = ENABLE;
// // { CAN_MessageCache_DeInit(CAN0MSG07);
// // CAN_SendMsg_Diag_Tx.Data[i] = 0; CAN_MessageCache_Init(CAN0MSG07, &CAN_RecvMsg);
// // } CAN_MessageCache_OverWriteConfig(CAN0MSG07, ENABLE);
// // CAN_MessageCache_DeInit(CAN0MSG09);
// // CAN_MessageCache_Init(CAN0MSG09, &CAN_SendMsg_Diag_Tx); // CAN_RecvMsg.Id = DIAG_ID_Rx_PHY;
// } // CAN_RecvMsg.IDE = CAN_Id_Standard;
// /** // CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask;
// * @brief 用于接收回调函数 // CAN_RecvMsg.RTR = CAN_RTR_Data;
// * @code // CAN_RecvMsg.Interrupt = ENABLE;
// */ // CAN_MessageCache_DeInit(CAN0MSG03);
// void Can_Rx_Cak(CanTxRxMsg *Msg) // CAN_MessageCache_Init(CAN0MSG03, &CAN_RecvMsg);
// { // CAN_MessageCache_OverWriteConfig(CAN0MSG03, ENABLE);
// Co_Can_Buff_Set(&CAN_CH0_CanMsgOp, Co_Can_ConvertSubID_CAN_CH0(Msg->Id), Msg->DLC, Msg->Data);
// CAN_RecvMsg.Id = DIAG_ID_Rx_FUN;
// if ((Msg->Id == DIAG_ID_Rx_FUN) || (Msg->Id == DIAG_ID_Rx_PHY)) // CAN_RecvMsg.IDE = CAN_Id_Standard;
// { // CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask;
// DoCAN_L_Data_Indication(Msg->Id, Msg->DLC, Msg->Data); // CAN_RecvMsg.RTR = CAN_RTR_Data;
// } // CAN_RecvMsg.Interrupt = ENABLE;
// } // CAN_MessageCache_DeInit(CAN0MSG04);
// /** // CAN_MessageCache_Init(CAN0MSG04, &CAN_RecvMsg);
// * @brief CAN库初始化TX/RX // CAN_MessageCache_OverWriteConfig(CAN0MSG04, ENABLE);
// * }
// */
// void COM_CAN_Init(void) /**
// { * @brief 用于申请TXBUFF
// memset(pRXBuff, 0, sizeof(pRXBuff)); *
// CAN_CH0_CanMsgOp.CAN_MSG_Analysis = (st_CANMsgStruct *)pRXBuff; */
// CAN_CH0_CanMsgOp.pAttrubute = CAN_CH0_CAN_MSG_CONST_ARRAY; void Can_Tx_Apply_Buff(void)
// CAN_CH0_CanMsgOp.Total_Msg = CAN_CH0_ID_TOTAL_MAX; {
// CAN_CH0_CanMsgOp.u8CAN_RX_ENABLE = CAN_N_RX_Enable; // CanTxRxMsg CAN_SendMsg;
// Can_RX_BuffInit(&CAN_CH0_CanMsgOp, CAN_CH0_CAN_MSG_CONST_ARRAY, CAN_CH0_ID_TOTAL_MAX); // CanTxRxMsg CAN_SendMsg_Diag_Tx;
// CAN_RX_SetEnable(&CAN_CH0_CanMsgOp, CAN_N_RX_Enable); // CAN_SendMsg.Id = 0x500;
// CAN_SendMsg.IDE = CAN_Id_Standard;
// memset(pTXBuff, 0, sizeof(pTXBuff)); // CAN_SendMsg.CacheType = CAN_CacheType_Tx;
// CAN_CH0_CanMsgTxOp.CanMsg = (st_CAN_SendOperation *)pTXBuff; // CAN_SendMsg.RTR = CAN_RTR_Data;
// Can_TX_BuffInit(&CAN_CH0_CanMsgTxOp, CAN_CH0_CANSendAttr, CAN_CH0_ID_SEND_TOTAL, COM_APP_Process); // CAN_RecvMsg.Interrupt = DISABLE;
// CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable); // CAN_SendMsg.DLC = 8;
// } // for (uint8_t i = 0; i < CAN_SendMsg.DLC; i++)
// {
// CAN_SendMsg.Data[i] = 0;
// /** // }
// * @brief Buff恢复函数
// * @param deltaTime 调用时间 单位ms 10MS调用 // CAN_MessageCache_DeInit(CAN0MSG08);
// */ // CAN_MessageCache_Init(CAN0MSG08, &CAN_SendMsg);
// void Can_BusOff_Recover(uint8_t deltaTime)
// {
// if (get_can_busoff(CAN_CH_0) == 2) // CAN_SendMsg_Diag_Tx.Id = DIAG_ID_Tx;
// { // CAN_SendMsg_Diag_Tx.IDE = CAN_Id_Standard;
// if (RSCAN0Busoff.Status == RSCAN0_BUS_STABLE) // CAN_SendMsg_Diag_Tx.CacheType = CAN_CacheType_Tx;
// { // CAN_SendMsg_Diag_Tx.RTR = CAN_RTR_Data;
// RSCAN0Busoff.Status = RSCAN0_BUS_OFF_LV1; // CAN_SendMsg_Diag_Tx.Interrupt = DISABLE;
// } // CAN_SendMsg_Diag_Tx.DLC = 8;
// for (uint8_t i = 0; i < CAN_SendMsg_Diag_Tx.DLC; i++)
// if (RSCAN0Busoff.Status == RSCAN0_BUS_OFF_LV1) // {
// { // CAN_SendMsg_Diag_Tx.Data[i] = 0;
// RSCAN0Busoff.Timer++; // }
// if (RSCAN0Busoff.Timer >= RSCAN0_BUS_OFF_LV1_RECOVERY_TIME / deltaTime)
// { // CAN_MessageCache_DeInit(CAN0MSG09);
// RSCAN0Busoff.Timer = 0U; // CAN_MessageCache_Init(CAN0MSG09, &CAN_SendMsg_Diag_Tx);
}
// RSCAN0Busoff.Cnt++; /**
// if (RSCAN0Busoff.Cnt >= 10U) * @brief 用于接收回调函数
// { * @code
*/
// RSCAN0Busoff.Cnt = 0U; void Can_Rx_Cak(CanTxRxMsg *Msg)
{
// RSCAN0Busoff.Status = RSCAN0_BUS_OFF_LV2; Co_Can_Buff_Set(&CAN_CH0_CanMsgOp, Co_Can_ConvertSubID_CAN_CH0(Msg->Id), Msg->DLC, Msg->Data);
// }
// reset_busoff(CAN_CH_0); // if ((Msg->Id == DIAG_ID_Rx_FUN) || (Msg->Id == DIAG_ID_Rx_PHY))
// } // {
// } // DoCAN_L_Data_Indication(Msg->Id, Msg->DLC, Msg->Data);
// else if (RSCAN0Busoff.Status == RSCAN0_BUS_OFF_LV2) // }
// { }
// RSCAN0Busoff.Timer++; /**
* @brief CAN库初始化TX/RX
// if (RSCAN0Busoff.Timer >= RSCAN0_BUS_OFF_LV2_RECOVERY_TIME / deltaTime) *
// { */
// RSCAN0Busoff.Timer = 0U; void COM_CAN_Init(void)
// reset_busoff(CAN_CH_0); {
// } memset(pRXBuff, 0, sizeof(pRXBuff));
// } CAN_CH0_CanMsgOp.CAN_MSG_Analysis = (st_CANMsgStruct *)pRXBuff;
// else CAN_CH0_CanMsgOp.pAttrubute = CAN_CH0_CAN_MSG_CONST_ARRAY;
// { CAN_CH0_CanMsgOp.Total_Msg = CAN_CH0_ID_TOTAL_MAX;
// } CAN_CH0_CanMsgOp.u8CAN_RX_ENABLE = CAN_N_RX_Enable;
// } Can_RX_BuffInit(&CAN_CH0_CanMsgOp, CAN_CH0_CAN_MSG_CONST_ARRAY, CAN_CH0_ID_TOTAL_MAX);
// else /* 总线正常,没有Bus-off发生*/ CAN_RX_SetEnable(&CAN_CH0_CanMsgOp, CAN_N_RX_Enable);
// {
// memset(pTXBuff, 0, sizeof(pTXBuff));
// } // CAN_CH0_CanMsgTxOp.CanMsg = (st_CAN_SendOperation *)pTXBuff;
// } // Can_TX_BuffInit(&CAN_CH0_CanMsgTxOp, CAN_CH0_CANSendAttr, CAN_CH0_ID_SEND_TOTAL, COM_APP_Process);
// CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable);
// /** }
// * @brief 获取busoff状态
// * @return 0 没有busoff
// * 1 错误的操作 /**
// * 2 busoff * @brief Buff恢复函数
// */ * @param deltaTime 调用时间 单位ms 10MS调用
// uint8_t Get_Busoff_Status(void) */
// { void Can_BusOff_Recover(uint8_t deltaTime)
// return get_can_busoff(CAN_CH_0); {
// } if (get_can_busoff(CAN_CH_0) == 2)
{
if (RSCAN0Busoff.Status == RSCAN0_BUS_STABLE)
{
RSCAN0Busoff.Status = RSCAN0_BUS_OFF_LV1;
}
if (RSCAN0Busoff.Status == RSCAN0_BUS_OFF_LV1)
{
RSCAN0Busoff.Timer++;
if (RSCAN0Busoff.Timer >= RSCAN0_BUS_OFF_LV1_RECOVERY_TIME / deltaTime)
{
RSCAN0Busoff.Timer = 0U;
RSCAN0Busoff.Cnt++;
if (RSCAN0Busoff.Cnt >= 10U)
{
RSCAN0Busoff.Cnt = 0U;
RSCAN0Busoff.Status = RSCAN0_BUS_OFF_LV2;
}
reset_busoff(CAN_CH_0);
}
}
else if (RSCAN0Busoff.Status == RSCAN0_BUS_OFF_LV2)
{
RSCAN0Busoff.Timer++;
if (RSCAN0Busoff.Timer >= RSCAN0_BUS_OFF_LV2_RECOVERY_TIME / deltaTime)
{
RSCAN0Busoff.Timer = 0U;
reset_busoff(CAN_CH_0);
}
}
else
{
}
}
else /* 总线正常,没有Bus-off发生*/
{
}
}
/**
* @brief 获取busoff状态
* @return 0 没有busoff
* 1 错误的操作
* 2 busoff
*/
uint8_t Get_Busoff_Status(void)
{
return get_can_busoff(CAN_CH_0);
}
// uint8_t COM_APP_Process(st_CAN_Msg *Msg) // uint8_t COM_APP_Process(st_CAN_Msg *Msg)
// { // {
......
// #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;
......
...@@ -82,8 +82,7 @@ void Data_Vehicle_Speed_Processing_Service(void) ...@@ -82,8 +82,7 @@ void Data_Vehicle_Speed_Processing_Service(void)
if ((CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CH0_101_Msg_Count) == CAN_SIG_LOST) || (Vehicle_Speed > 0XFF)) if ((CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CH0_101_Msg_Count) == CAN_SIG_LOST) || (Vehicle_Speed > 0XFF))
{ {
/* 先判断掉线 */ /* 先判断掉线 */
//if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x101_Msg_Count) == CAN_SIG_LOST) if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CH0_101_Msg_Count) == CAN_SIG_LOST)
if(1)
{ {
DataVSpeedValid = 0; DataVSpeedValid = 0;
DataVSpeedActual = 0; DataVSpeedActual = 0;
......
...@@ -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
...@@ -5,63 +5,156 @@ ...@@ -5,63 +5,156 @@
const Line_In_Attribute_st g_stLineInAttribute[LINE_IN_MAX] = const Line_In_Attribute_st g_stLineInAttribute[LINE_IN_MAX] =
{ {
{LEVEL_LOW, LEVEL_HIGH, LINE_IN_IG_ON, 20U, 20U, Get_LINE_IN_TurnLeft, }, {LEVEL_HIGH, LEVEL_LOW, LINE_IN_IG_ON, 20U, 20U, Get_LINE_IN_Turn_Left, },
{LEVEL_LOW, LEVEL_HIGH, LINE_IN_IG_ON, 20U, 20U, Get_LINE_IN_TurnRight, }, {LEVEL_HIGH, LEVEL_LOW, LINE_IN_IG_ON, 20U, 20U, Get_LINE_IN_Turn_Right, },
{LEVEL_HIGH, LEVEL_LOW, LINE_IN_IG_ON, 60U, 20U, Get_LINE_IN_HighBeam, }, {LEVEL_HIGH, LEVEL_LOW, LINE_IN_IG_ON, 60U, 20U, Get_LINE_IN_High_Beam, },
{LEVEL_HIGH, LEVEL_LOW, LINE_IN_IG_ON, 100U, 20U, Get_LINE_IN_Auto_Start_Stop, }, {LEVEL_LOW, LEVEL_HIGH, LINE_IN_IG_ON, 100U, 20U, Get_LINE_IN_Efi_Fault, },
{LEVEL_HIGH, LEVEL_LOW, LINE_IN_IG_ON, 20U, 20U, Get_LINE_IN_ABS, },
{LEVEL_LOW, LEVEL_HIGH, LINE_IN_IG_ON, 20U, 20U, Get_LINE_IN_Auto_Start_Stop, },
{LEVEL_LOW, LEVEL_HIGH, LINE_IN_IG_ON, 20U, 20U, Get_LINE_IN_Oil_Pressure_Alert, },
{LEVEL_LOW, LEVEL_HIGH, LINE_IN_IG_ON, 20U, 20U, Get_LINE_IN_Voltage, },
{LEVEL_LOW, LEVEL_HIGH, LINE_IN_IG_ON, 20U, 20U, Get_LINE_IN_Fuel_Level_Low, },
{LEVEL_LOW, LEVEL_HIGH, LINE_IN_IG_ON, 20U, 20U, Get_LINE_IN_E, },
{LEVEL_LOW, LEVEL_HIGH, LINE_IN_IG_ON, 20U, 20U, Get_LINE_IN_S, },
}; };
Linelib_uint8_t Get_LINE_IN_Turn_Left(void)
Linelib_uint8_t Get_LINE_IN_TurnLeft(void)
{ {
Linelib_uint8_t ret = 0U; Linelib_uint8_t ret = 0U;
//if (RTE_GPIO_Get_Level(LeftTurn_P_In)) if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
{ {
ret = 1u; ret = 1u;
} }
//else else
{ {
ret = 0UL; ret = 0UL;
} }
return ret; return ret;
} }
Linelib_uint8_t Get_LINE_IN_Turn_Right(void)
Linelib_uint8_t Get_LINE_IN_TurnRight(void)
{ {
Linelib_uint8_t ret = 0U; Linelib_uint8_t ret = 0U;
//if (RTE_GPIO_Get_Level(RightTurn_P_In)) if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
{ {
ret = 1u; ret = 1u;
} }
//else else
{ {
ret = 0UL; ret = 0UL;
} }
return ret; return ret;
} }
Linelib_uint8_t Get_LINE_IN_High_Beam(void)
Linelib_uint8_t Get_LINE_IN_HighBeam(void)
{ {
Linelib_uint8_t ret = 0U; Linelib_uint8_t ret = 0U;
//if (RTE_GPIO_Get_Level(HighBeam_P_In)) if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
{ {
ret = 1u; ret = 1u;
} }
//else else
{
ret = 0UL;
}
return ret;
}
Linelib_uint8_t Get_LINE_IN_Efi_Fault(void)
{
Linelib_uint8_t ret = 0U;
if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
{
ret = 1u;
}
else
{
ret = 0UL;
}
return ret;
}
Linelib_uint8_t Get_LINE_IN_ABS(void)
{
Linelib_uint8_t ret = 0U;
if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
{
ret = 1u;
}
else
{ {
ret = 0UL; ret = 0UL;
} }
return ret; return ret;
} }
Linelib_uint8_t Get_LINE_IN_Auto_Start_Stop(void) Linelib_uint8_t Get_LINE_IN_Auto_Start_Stop(void)
{ {
Linelib_uint8_t ret = 0U; Linelib_uint8_t ret = 0U;
//if (RTE_GPIO_Get_Level(START_STOP_P_IN)) if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
{
ret = 1u;
}
else
{
ret = 0UL;
}
return ret;
}
Linelib_uint8_t Get_LINE_IN_Oil_Pressure_Alert(void)
{
Linelib_uint8_t ret = 0U;
if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
{
ret = 1u;
}
else
{
ret = 0UL;
}
return ret;
}
Linelib_uint8_t Get_LINE_IN_Voltage(void)
{
Linelib_uint8_t ret = 0U;
if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
{
ret = 1u;
}
else
{
ret = 0UL;
}
return ret;
}
Linelib_uint8_t Get_LINE_IN_Fuel_Level_Low(void)
{
Linelib_uint8_t ret = 0U;
if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
{
ret = 1u;
}
else
{
ret = 0UL;
}
return ret;
}
Linelib_uint8_t Get_LINE_IN_E(void)
{
Linelib_uint8_t ret = 0U;
if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
{
ret = 1u;
}
else
{
ret = 0UL;
}
return ret;
}
Linelib_uint8_t Get_LINE_IN_S(void)
{
Linelib_uint8_t ret = 0U;
if (RTE_GPIO_Get_Level(LeftTurn_MUC_OUT))
{ {
ret = 1u; ret = 1u;
} }
//else else
{ {
ret = 0UL; ret = 0UL;
} }
...@@ -74,7 +167,7 @@ Linelib_uint8_t LINE_IN_Men[LINE_IN_MAX * LINE_IN_BLOCK_SIZE]; ...@@ -74,7 +167,7 @@ Linelib_uint8_t LINE_IN_Men[LINE_IN_MAX * LINE_IN_BLOCK_SIZE];
static Linelib_uint16_t LINE_GET_PWR(void) static Linelib_uint16_t LINE_GET_PWR(void)
{ {
Linelib_uint16_t Res; Linelib_uint16_t Res;
//Res = Common_Get_IG_Sts() & 0x00FFu; Res = Common_Get_IG_Sts() & 0x00FFu;
return Res; return Res;
} }
......
...@@ -5,19 +5,31 @@ ...@@ -5,19 +5,31 @@
typedef enum typedef enum
{ {
LINE_IN_TurnLeft = 0, LINE_IN_Turn_Left,
LINE_IN_TurnRight, LINE_IN_Turn_Right,
LINE_IN_HighBeam, LINE_IN_High_Beam,
LINE_IN_Efi_Fault,
LINE_IN_ABS,
LINE_IN_Auto_Start_Stop, LINE_IN_Auto_Start_Stop,
LINE_IN_Oil_Pressure_Alert,
LINE_IN_Voltage,
LINE_IN_Fuel_Level_Low,
LINE_IN_E,
LINE_IN_S,
LINE_IN_MAX, LINE_IN_MAX,
} LINE_IN_Enum_t; } LINE_IN_Enum_t;
extern void LINE_IN_Init(void); extern void LINE_IN_Init(void);
Linelib_uint8_t Get_LINE_IN_TurnLeft(void); Linelib_uint8_t Get_LINE_IN_Turn_Left(void);
Linelib_uint8_t Get_LINE_IN_TurnRight(void); Linelib_uint8_t Get_LINE_IN_Turn_Right(void);
Linelib_uint8_t Get_LINE_IN_HighBeam(void); Linelib_uint8_t Get_LINE_IN_High_Beam(void);
Linelib_uint8_t Get_LINE_IN_Efi_Fault(void);
Linelib_uint8_t Get_LINE_IN_ABS(void);
Linelib_uint8_t Get_LINE_IN_Auto_Start_Stop(void); Linelib_uint8_t Get_LINE_IN_Auto_Start_Stop(void);
Linelib_uint8_t Get_LINE_IN_Oil_Pressure_Alert(void);
Linelib_uint8_t Get_LINE_IN_Voltage(void);
Linelib_uint8_t Get_LINE_IN_Fuel_Level_Low(void);
Linelib_uint8_t Get_LINE_IN_E(void);
Linelib_uint8_t Get_LINE_IN_S(void);
#endif #endif
...@@ -53,7 +53,7 @@ static void Power_KL30_Init(void) ...@@ -53,7 +53,7 @@ static void Power_KL30_Init(void)
Data_User_Mileage_KL30Init(); Data_User_Mileage_KL30Init();
Fuel_KL30_Init(); Fuel_KL30_Init();
Amt630hInit(); Amt630hInit();
//Telltales_Init(); Telltales_Init();
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400, 64000000); TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400, 64000000);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER1, TIMERM_CHB, ActiveLevel_High); TimerM_PWM_CH_Output_init(TIMERM_COUNTER1, TIMERM_CHB, ActiveLevel_High);
g_stRTCInformation.u8RTCSecond = 0; g_stRTCInformation.u8RTCSecond = 0;
...@@ -62,16 +62,15 @@ static void Power_KL30_Init(void) ...@@ -62,16 +62,15 @@ static void Power_KL30_Init(void)
g_stRTCInformation.u8RTCDayOfMonth = 1; g_stRTCInformation.u8RTCDayOfMonth = 1;
g_stRTCInformation.u8RTCMonth = 1; g_stRTCInformation.u8RTCMonth = 1;
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();
...@@ -86,9 +85,10 @@ static void Power_Wakeup_Init(void) ...@@ -86,9 +85,10 @@ static void Power_Wakeup_Init(void)
Amt630hInit(); Amt630hInit();
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400, 64000000); TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400, 64000000);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER1, TIMERM_CHB, ActiveLevel_High); TimerM_PWM_CH_Output_init(TIMERM_COUNTER1, TIMERM_CHB, ActiveLevel_High);
//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;
} }
......
//#include "Telltales_Lib.h" #include "Telltales_Lib.h"
//#include "Telltales_user.h" #include "Telltales_user.h"
//#include "Line_In\Line_In_user.h" #include "Line_In\Line_In_user.h"
//#include "Application.h" #include "Components.h"
//#include "CAN_APP\CAN_CH0_CAN_Communication_Matrix.h"
//#include "Components.h"
//static Tellib_uint16_t LED_High_Beam_Judgement(void); static Tellib_uint16_t LED_Turn_Left_Judgement(void);
//static void LED_High_Beam_Execution(Tellib_uint16_t led_status); static void LED_Turn_Left_Execution(Tellib_uint16_t led_status);
//static Tellib_uint16_t LED_Efi_Fault_Judgement(void); static Tellib_uint16_t LED_Turn_Right_Judgement(void);
//static void LED_Efi_Fault_Execution(Tellib_uint16_t led_status); static void LED_Turn_Right_Execution(Tellib_uint16_t led_status);
//static Tellib_uint16_t LED_Auto_Start_Stop_Judgement(void); static Tellib_uint16_t LED_High_Beam_Judgement(void);
//static void LED_Auto_Start_Stop_Execution(Tellib_uint16_t led_status); static void LED_High_Beam_Execution(Tellib_uint16_t led_status);
//static Tellib_uint16_t LED_Voltage_Judgement(void); static Tellib_uint16_t LED_Efi_Fault_Judgement(void);//电喷故障灯
//static void LED_Voltage_Execution(Tellib_uint16_t led_status); static void LED_Efi_Fault_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_ABS_Judgement(void);
static void LED_ABS_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_Auto_Start_Stop_Judgement(void);
static void LED_Auto_Start_Stop_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_Oil_Pressure_Alert_Judgement(void);
static void LED_Oil_Pressure_Alert_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_TCS_Judgement(void);
static void LED_TCS_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_HEV_Judgement(void);
static void LED_HEV_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_Voltage_Judgement(void);
static void LED_Voltage_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_Fuel_Level_Low_Judgement(void);
static void LED_Fuel_Level_Low_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_Coolant_Temperature_Judgement(void);
static void LED_Coolant_Temperature_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_WIFI_Judgement(void);
static void LED_WIFI_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_Bluetooth_Judgement(void);
static void LED_Bluetooth_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_E_Judgement(void);
static void LED_E_Execution(Tellib_uint16_t led_status);
static Tellib_uint16_t LED_S_Judgement(void);
static void LED_S_Execution(Tellib_uint16_t led_status);
uint8_t u8CanId401Flag = 0;
const LED_Attribute_st LED_Attribute [ LED_Max ] = {
/* 指示灯索引 是否自检 外部信号自检 工作电源状态 自检开始时间 自检持续时间 指示灯点亮条件 指示灯执行函数 */
//static Tellib_uint16_t LED_Fuel_Judgement(void); {em_LED_Turn_Left, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Turn_Left_Judgement, LED_Turn_Left_Execution },
//static void LED_Fuel_Execution(Tellib_uint16_t led_status); {em_LED_Turn_Right, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Turn_Right_Judgement, LED_Turn_Right_Execution },
{em_LED_High_Beam, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_High_Beam_Judgement, LED_High_Beam_Execution },
{em_LED_Efi_Fault, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Efi_Fault_Judgement, LED_Efi_Fault_Execution },
{em_LED_ABS, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_ABS_Judgement, LED_ABS_Execution },
{em_LED_Auto_Start_Stop, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Auto_Start_Stop_Judgement, LED_Auto_Start_Stop_Execution },
{em_LED_Oil_Pressure_Alert, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Oil_Pressure_Alert_Judgement, LED_Oil_Pressure_Alert_Execution },
{em_LED_TCS, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_TCS_Judgement, LED_TCS_Execution },
{em_LED_HEV, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_HEV_Judgement, LED_HEV_Execution },
{em_LED_Voltage, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Voltage_Judgement, LED_Voltage_Execution },
{em_LED_Fuel_Level_Low, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Fuel_Level_Low_Judgement, LED_Fuel_Level_Low_Execution },
{em_LED_Coolant_Temperature, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Coolant_Temperature_Judgement, LED_Coolant_Temperature_Execution },
{em_LED_WIFI, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_WIFI_Judgement, LED_WIFI_Execution },
{em_LED_Bluetooth, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Bluetooth_Judgement, LED_Bluetooth_Execution },
{em_LED_E, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_E_Judgement, LED_E_Execution },
{em_LED_S, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_S_Judgement, LED_S_Execution },
};
Tellib_uint8_t Tel_Mem [ Tel_MEM_Block_Size * LED_Max + Tel_MEM_Block_Addition ];
void Telltales_Init(void)
{
TelExtPara m_ExtPara;
m_ExtPara.TotalLength = LED_Max;
m_ExtPara.LED_PowerOFF_TimerCbk = Common_GetIgnOffTime;
m_ExtPara.LED_PowerON_TimerCbk = Common_GetIgnOnTime;
m_ExtPara.LED_PowerCbk = Common_Get_IG_Sts;
u8CanId401Flag = 0;
Telltales_KL30_Wakeup_Init(Tel_Mem, LED_Attribute, &m_ExtPara);
}
void Can_ID_401(uint8_t CopyData [])
{
u8CanId401Flag = 1;
}
/******************************************************************************************************************************************************************************************************************* */
static Tellib_uint16_t LED_Turn_Left_Judgement(void)//硬线-P10 高电平
{
Tellib_uint16_t LED_STATE = 0u;
if (Line_In_Get_Status(LINE_IN_Turn_Left))
{
LED_STATE = 1;
}
else
{
LED_STATE = 0;
}
return LED_STATE;
}
static void LED_Turn_Left_Execution(Tellib_uint16_t led_status)
{
// if (led_status == 1u)
// {
// RTE_GPIO_Set_Level(TurnLeft_MUC_OUT, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(TurnLeft_MUC_OUT, LED_LINEOUT_Low);
// }
}
/*硬线-P9 高电平*/
static Tellib_uint16_t LED_Turn_Right_Judgement(void)
{
Tellib_uint16_t LED_STATE = 0u;
if (Line_In_Get_Status(LINE_IN_Turn_Right))
{
LED_STATE = 1;
}
else
{
LED_STATE = 0;
}
return LED_STATE;
}
static void LED_Turn_Right_Execution(Tellib_uint16_t led_status)
{
// if (led_status == 1u)
// {
// RTE_GPIO_Set_Level(TurnRight_MUC_OUT, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(TurnRight_MUC_OUT, LED_LINEOUT_Low);
// }
}
/*硬线-P18 高电平*/
static Tellib_uint16_t LED_High_Beam_Judgement(void)
{
Tellib_uint16_t LED_STATE = 0u;
if (Line_In_Get_Status(LINE_IN_High_Beam))
{
LED_STATE = 1;
}
else
{
LED_STATE = 0;
}
return LED_STATE;
}
static void LED_High_Beam_Execution(Tellib_uint16_t led_status)
{
// if (led_status == 1u)
// {
// RTE_GPIO_Set_Level(HighBeam_MUC_OUT, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(HighBeam_MUC_OUT, LED_LINEOUT_Low);
// }
}
/*硬线-P15 低电平*/
static Tellib_uint16_t LED_Efi_Fault_Judgement(void)
{
Tellib_uint16_t LED_STATE = 0u;
if (Line_In_Get_Status(LINE_IN_Efi_Fault))
{
LED_STATE = 1;
}
else
{
LED_STATE = 0;
}
return LED_STATE;
}
static void LED_Efi_Fault_Execution(Tellib_uint16_t led_status)
{
// if (led_status == 1u)
// {
// RTE_GPIO_Set_Level(EfiFault_MUC_OUT, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(EfiFault_MUC_OUT, LED_LINEOUT_Low);
// }
}
/*硬线-P7 悬空/高点亮 接地灭*/
static Tellib_uint16_t LED_ABS_Judgement(void)
{
Tellib_uint16_t LED_STATE = 0u;
if (Line_In_Get_Status(LINE_IN_ABS))
{
LED_STATE = 1;
}
else
{
LED_STATE = 0;
}
return LED_STATE;
}
static void LED_ABS_Execution(Tellib_uint16_t led_status)
{
// if (led_status == 1u)
// {
// RTE_GPIO_Set_Level(ABS_MUC_OUT, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(ABS_MUC_OUT, LED_LINEOUT_Low);
// }
}
/*硬线-P12 低电平*/
static Tellib_uint16_t LED_Auto_Start_Stop_Judgement(void)
{
Tellib_uint16_t LED_STATE = 0u;
if (Line_In_Get_Status(LINE_IN_Auto_Start_Stop))
{
LED_STATE = 1;
}
else
{
LED_STATE = 0;
}
return LED_STATE;
}
static void LED_Auto_Start_Stop_Execution(Tellib_uint16_t led_status)
{
// if (led_status == 1u)
// {
// RTE_GPIO_Set_Level(AutoStartStop_MUC_OUT, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(AutoStartStop_MUC_OUT, LED_LINEOUT_Low);
// }
}
/*硬线-P21 低电平*/
static Tellib_uint16_t LED_Oil_Pressure_Alert_Judgement(void)
{
Tellib_uint16_t LED_STATE = 0u;
if (Line_In_Get_Status(LINE_IN_Oil_Pressure_Alert))
{
LED_STATE = 1;
}
else
{
LED_STATE = 0;
}
return LED_STATE;
}
static void LED_Oil_Pressure_Alert_Execution(Tellib_uint16_t led_status)
{
// if (led_status == 1u)
// {
// RTE_GPIO_Set_Level(OilPressureAlert_MUC_OUT, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(OilPressureAlert_MUC_OUT, LED_LINEOUT_Low);
// }
}
/*CAN信号来源:TCS_37B*/
static Tellib_uint16_t LED_TCS_Judgement(void)
{
//Tellib_uint16_t LED_STATE = 0u;
//if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CH0_37B_Msg_Count) == CAN_SIG_LOST)
//{
// LED_STATE = 0u;
//}
//else
//{
// if(Get_CAN_CH0_ID_37B_Sig_TCS_Work_Mode() == 1)
// {
// LED_STATE = 1u;
// }
// else
// {
// LED_STATE = 0u;
// }
//}
//return LED_STATE;
//static Tellib_uint16_t LED_Atmosphere_Judgement(void); }
//static void LED_Atmosphere_Execution(Tellib_uint16_t led_status); static void LED_TCS_Execution(Tellib_uint16_t led_status)
//uint8_t u8CanId401Flag = 0; {
//const LED_Attribute_st LED_Attribute [ LED_Max ] = { // if (led_status == 1u)
// /* 指示灯索引 是否自检 外部信号自检 工作电源状态 自检开始时间 自检持续时间 指示灯点亮条件 指示灯执行函数 */ // {
// // RTE_GPIO_Set_Level(TCS_MUC_OUT, LED_LINEOUT_High);
// {em_LED_High_Beam, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_High_Beam_Judgement, LED_High_Beam_Execution }, // }
// {em_LED_Efi_Fault, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Efi_Fault_Judgement, LED_Efi_Fault_Execution }, // else
// {em_LED_Auto_Start_Stop, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Auto_Start_Stop_Judgement, LED_Auto_Start_Stop_Execution }, // {
// {em_LED_Voltage, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Voltage_Judgement, LED_Voltage_Execution }, // RTE_GPIO_Set_Level(TCS_MUC_OUT, LED_LINEOUT_Low);
// {em_LED_Fuel, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Fuel_Judgement, LED_Fuel_Execution }, // }
// {em_LED_Atmosphere, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Atmosphere_Judgement, LED_Atmosphere_Execution}, }
//}; /*信号来源:ISG_111*/
static Tellib_uint16_t LED_HEV_Judgement(void)
{
//Tellib_uint16_t LED_STATE = 0u;
//if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x402_Msg_Count) == CAN_SIG_LOST)
//{
// LED_STATE = 0u;
//}
//else
//{
// if( == 1)
// {
// LED_STATE = 1u;
// }
// else
// {
// LED_STATE = 0u;
// }
//}
//return LED_STATE;
}
static void LED_HEV_Execution(Tellib_uint16_t led_status)
{
// if (led_status == 1u)
// {
// RTE_GPIO_Set_Level(HEV_MUC_OUT, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(HEV_MUC_OUT, LED_LINEOUT_Low);
// }
}
/*硬线-P19 电压值*/
static Tellib_uint16_t LED_Voltage_Judgement(void)
{
Tellib_uint16_t LED_STATE = 0u;
if (Line_In_Get_Status(LINE_IN_Voltage))
{
LED_STATE = 1;
}
else
{
LED_STATE = 0;
}
return LED_STATE;
}
static void LED_Voltage_Execution(Tellib_uint16_t led_status)
{
// if (led_status == 1u)
// {
// RTE_GPIO_Set_Level(Voltage_MUC_OUT, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(Voltage_MUC_OUT, LED_LINEOUT_Low);
// }
}
/*硬线P14-阻值*/
static Tellib_uint16_t LED_Fuel_Level_Low_Judgement(void)
{
Tellib_uint16_t LED_STATE = 0u;
if (Line_In_Get_Status(LINE_IN_Fuel_Level_Low))
{
LED_STATE = 1;
}
else
{
LED_STATE = 0;
}
return LED_STATE;
}
static void LED_Fuel_Level_Low_Execution(Tellib_uint16_t led_status)
{
// if (led_status == 1u)
// {
// RTE_GPIO_Set_Level(FuelLevelLow_MUC_OUT, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(FuelLevelLow_MUC_OUT, LED_LINEOUT_Low);
// }
}//
/*信号来源:ECU_101 +硬线-P11 阻值 CAN>硬线*/
static Tellib_uint16_t LED_Coolant_Temperature_Judgement(void)
{
}
static void LED_Coolant_Temperature_Execution(Tellib_uint16_t led_status)
{
// if (led_status == 1u)
// {
// RTE_GPIO_Set_Level(CoolantTemperature_MUC_OUT, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(CoolantTemperature_MUC_OUT, LED_LINEOUT_Low);
// }
}
/*无*/
static Tellib_uint16_t LED_WIFI_Judgement(void)
{
Tellib_uint16_t LED_STATE = 0u;
// if (Line_In_Get_Status(LINE_IN_WIFI))
// {
// LED_STATE = 1;
// }
// else
// {
// LED_STATE = 0;
// }
return LED_STATE;
}
static void LED_WIFI_Execution(Tellib_uint16_t led_status)
{
// if (led_status == 1u)
// {
// RTE_GPIO_Set_Level(WIFI_MUC_OUT, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(WIFI_MUC_OUT, LED_LINEOUT_Low);
// }
}
/*信号来源:蓝牙模块*/
static Tellib_uint16_t LED_Bluetooth_Judgement(void)
{
// Tellib_uint16_t LED_STATE = 0u;
// if (Line_In_Get_Status(LINE_IN_Bluetooth))
// {
// LED_STATE = 1;
// }
// else
// {
// LED_STATE = 0;
// }
// return LED_STATE;
}
static void LED_Bluetooth_Execution(Tellib_uint16_t led_status)
{
// if (led_status == 1u)
// {
// RTE_GPIO_Set_Level(Bluetooth_MUC_OUT, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(Bluetooth_MUC_OUT, LED_LINEOUT_Low);
// }
}
/*信号来源:0x111*/
static Tellib_uint16_t LED_E_Judgement(void)
{
//Tellib_uint8_t Tel_Mem [ Tel_MEM_Block_Size * LED_Max + Tel_MEM_Block_Addition ]; }
static void LED_E_Execution(Tellib_uint16_t led_status)
{
// if (led_status == 1u)
// {
// RTE_GPIO_Set_Level(E_MUC_OUT, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(E_MUC_OUT, LED_LINEOUT_Low);
// }
}
/*信号来源:0x111*/
static Tellib_uint16_t LED_S_Judgement(void)
{
// void Telltales_Init(void) }
// { static void LED_S_Execution(Tellib_uint16_t led_status)
// TelExtPara m_ExtPara; {
// m_ExtPara.TotalLength = LED_Max; // if (led_status == 1u)
// m_ExtPara.LED_PowerOFF_TimerCbk = Common_GetIgnOffTime; // {
// m_ExtPara.LED_PowerON_TimerCbk = Common_GetIgnOnTime; // RTE_GPIO_Set_Level(S_MUC_OUT, LED_LINEOUT_High);
// m_ExtPara.LED_PowerCbk = Common_Get_IG_Sts; // }
// u8CanId401Flag = 0; // else
// Telltales_KL30_Wakeup_Init(Tel_Mem, LED_Attribute, &m_ExtPara); // {
// } // RTE_GPIO_Set_Level(S_MUC_OUT, LED_LINEOUT_Low);
// }
}
//void Can_ID_401(uint8_t CopyData []) \ No newline at end of file
//{
// u8CanId401Flag = 1;
//}
//
//static Tellib_uint16_t LED_High_Beam_Judgement(void)
//{
// Tellib_uint16_t LED_STATE = 0u;
// if (Line_In_Get_Status(LINE_IN_HighBeam))
// {
// LED_STATE = 1;
// }
// else
// {
// LED_STATE = 0;
// }
// return LED_STATE;
//}
//static void LED_High_Beam_Execution(Tellib_uint16_t led_status)
//{
// if ( led_status == 1u )
// {
// RTE_GPIO_Set_Level(HighBeam_MUC_OUT, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(HighBeam_MUC_OUT, LED_LINEOUT_Low);
// }
//}
//static Tellib_uint16_t LED_Efi_Fault_Judgement(void)
//{
// Tellib_uint16_t LED_STATE = 0u;
// if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x402_Msg_Count) == CAN_SIG_LOST)
// {
// LED_STATE = 0u;
// }
// else
// {
// if(Get_CAN_CH0_ID_402_Sig_ECU_Warning_Lamp() == 1)
// {
// LED_STATE = 1u;
// }
// else
// {
// LED_STATE = 0u;
// }
// }
// return LED_STATE;
//}
//static void LED_Efi_Fault_Execution(Tellib_uint16_t led_status)
//{
// if ( led_status == 1u )
// {
// RTE_GPIO_Set_Level(EFI_FAULT_OUT, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(EFI_FAULT_OUT, LED_LINEOUT_Low);
// }
//}
//Tellib_uint8_t Auto_Start_Stop = 0u;
//Tellib_uint8_t Key_ISTOP = 0u;
//void Telltales_Auto_Start_Stop(void)
//{
// Auto_Start_Stop = 0;
//
//}
//void Telltales_Auto_Start_Stop_Setting(void)
//{
// if (Auto_Start_Stop == 0)
// {
// Auto_Start_Stop = 1;
// }
// else if (Auto_Start_Stop == 1)
// {
// Auto_Start_Stop = 0;
// }
// else
// {
// ;
// }
//}
//static Tellib_uint16_t LED_Auto_Start_Stop_Judgement(void)
//{
// Tellib_uint16_t LED_STATE = 0u;
//
// if (Auto_Start_Stop == 1)
// {
// if (Line_In_Get_Status(LINE_IN_Auto_Start_Stop))
// {
// LED_STATE = 1;
// }
// else
// {
// LED_STATE = 0;
// }
// }
// else
// {
// LED_STATE = 0;
// }
//
// return LED_STATE;
//}
//static void LED_Auto_Start_Stop_Execution(Tellib_uint16_t led_status)
//{
// if ( led_status == 1u )
// {
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_07_Key_ISTOP, LED_ON);
// SEG_SET_LED_STS(1,1);
// }
// else
// {
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_07_Key_ISTOP, LED_OFF);
// SEG_SET_LED_STS(1,0);
// }
//}
//Tellib_uint8_t Telltales_Voltage_Date(void)
//{
// Tellib_uint8_t Voltage = 0;
// Voltage = Get_CAN_CH0_ID_401_Sig_ECU_Battery_Voltage();
// return Voltage;
//}
//static Tellib_uint16_t LED_Voltage_Judgement(void)
//{
// Tellib_uint16_t LED_STATE = 0u;
// Tellib_uint16_t Voltage = 0u;
// Voltage = Telltales_Voltage_Date();
// if ((CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x401_Msg_Count) == CAN_SIG_LOST) || (u8CanId401Flag != 1))
// {
// u8CanId401Flag = 0;
// LED_STATE = 0u;
// }
// else
// {
// if ((Voltage < 120) || (Voltage > 150))
// {
// LED_STATE = 1u;
// }
// else
// {
// LED_STATE = 2u;
// }
// }
// return LED_STATE;
//}
//static void LED_Voltage_Execution(Tellib_uint16_t led_status)
//{
// if ( led_status == 1u )
// {
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_03_High_Low_Voltage, LED_ON);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_02_Normal_Voltage, LED_OFF);
// SEG_SET_LED_STS(0,1);
// }
// else if ( led_status == 2u )
// {
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_02_Normal_Voltage, LED_ON);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_03_High_Low_Voltage, LED_OFF);
// SEG_SET_LED_STS(0,1);
// }
// else
// {
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_03_High_Low_Voltage, LED_OFF);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_02_Normal_Voltage, LED_OFF);
// SEG_SET_LED_STS(0,0);
// }
//}
//static Tellib_uint16_t LED_Fuel_Judgement(void)
//{
// Tellib_uint16_t LED_STATE = 0u;
// if (Common_GetIgnOnTime() >= 3000)
// {
// if(Get_Fuel_Sensor_State() == FuelSensorNormal)
// {
// if(Get_CurFuelSetp() > 1)
// {
// LED_STATE = 3;//白灯
// }
// else
// {
// LED_STATE = 2;//格小于等于1
// }
// }
// else
// {
// LED_STATE = 2;//开路
// }
// }
// else
// {
// LED_STATE = 1;//自检只亮黄
// }
// return LED_STATE;
//}
//static void LED_Fuel_Execution(Tellib_uint16_t led_status)
//{
// if ( led_status == 3u )
// {
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_04_Fuel_W, LED_ON);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_05_Fuel_Y, LED_OFF);
// SEG_SET_LED_STS(2,1);
// }
// else if ( led_status == 2u )
// {
// if (FLASH_SYNC_1Hz)
// {
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_05_Fuel_Y, LED_ON);
// SEG_SET_LED_STS(2,1);
// }
// else
// {
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_05_Fuel_Y, LED_OFF);
// SEG_SET_LED_STS(2,0);
// }
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_04_Fuel_W, LED_OFF);
//
// }
// else if ( led_status == 1u )
// {
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_05_Fuel_Y, LED_ON);
// SEG_SET_LED_STS(2,1);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_04_Fuel_W, LED_OFF);
// }
// else
// {
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_04_Fuel_W, LED_OFF);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_05_Fuel_Y, LED_OFF);
// SEG_SET_LED_STS(2,0);
// }
//}
//static Tellib_uint16_t LED_Atmosphere_Judgement(void)
//{
// Tellib_uint16_t LED_STATE = 0u;
// LED_STATE = 1;
// return LED_STATE;
//}
//static void LED_Atmosphere_Execution(Tellib_uint16_t led_status)
//{
// if (led_status == 1)
// {
// RTE_GPIO_Set_Level(AMBIENT_LIGHT_B, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(AMBIENT_LIGHT_B, LED_LINEOUT_Low);
// }
//}
//void Turn_Left_Right_Lamp(void)
//{
// if ( SYS_OPR_STAT_IGN_ON )
// {
// if (Common_GetIgnOnTime() >= 3000)
// {
// if (Line_In_Get_Status(LINE_IN_TurnLeft))
// {
// RTE_GPIO_Set_Level(LeftTurn_MUC_OUT, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(LeftTurn_MUC_OUT, LED_LINEOUT_Low);
// }
// if (Line_In_Get_Status(LINE_IN_TurnRight))
// {
// RTE_GPIO_Set_Level(RightTurn_MUC_OUT, LED_LINEOUT_High);
// }
// else
// {
// RTE_GPIO_Set_Level(RightTurn_MUC_OUT, LED_LINEOUT_Low);
// }
// }
// else
// {
// RTE_GPIO_Set_Level(RightTurn_MUC_OUT, LED_LINEOUT_High);
// RTE_GPIO_Set_Level(LeftTurn_MUC_OUT, LED_LINEOUT_High);
// }
// }
// else
// {
// RTE_GPIO_Set_Level(RightTurn_MUC_OUT, LED_LINEOUT_Low);
// RTE_GPIO_Set_Level(LeftTurn_MUC_OUT, LED_LINEOUT_Low);
// }
//}
//#ifndef TELLTALES_USER_H #ifndef TELLTALES_USER_H
//#define TELLTALES_USER_H #define TELLTALES_USER_H
typedef enum
{
em_LED_Turn_Left,
em_LED_Turn_Right,
em_LED_High_Beam,
em_LED_Efi_Fault,
em_LED_ABS,
em_LED_Auto_Start_Stop,
em_LED_Oil_Pressure_Alert,
em_LED_TCS,
em_LED_HEV,
em_LED_Voltage,
em_LED_Fuel_Level_Low,
em_LED_Coolant_Temperature,
em_LED_WIFI,
em_LED_Bluetooth,
em_LED_E,
em_LED_S,
//typedef enum LED_Max ,
//{ } LED_Idx_t;
// em_LED_High_Beam, extern Tellib_uint8_t Auto_Start_Stop ;
// em_LED_Efi_Fault, void Telltales_Init(void);
// em_LED_Auto_Start_Stop, Tellib_uint8_t Telltales_Voltage_Date(void);
// em_LED_Voltage, #endif
// em_LED_Fuel,
// em_LED_Atmosphere,
//
// LED_Max ,
//} LED_Idx_t;
//extern Tellib_uint8_t Auto_Start_Stop ;
//void Telltales_Init(void);
//Tellib_uint8_t Telltales_Voltage_Date(void);
//#endif
...@@ -6,8 +6,21 @@ ...@@ -6,8 +6,21 @@
CANMSG_Type* CANMSG; CANMSG_Type* CANMSG;
CanTxRxMsg CAN_RecvMsg; CanTxRxMsg CAN_RecvMsg;
CANBuffList_t CanBufList = {0};
can_rx_callback can_rx_handler = NULL; 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就收完成回调 * @brief CAN就收完成回调
* *
...@@ -20,8 +33,8 @@ static void can_recv_handler(void *msg) ...@@ -20,8 +33,8 @@ static void can_recv_handler(void *msg)
if (CAN_GetFlagStatus(CAN0, CAN_FLAG_REC) != RESET) if (CAN_GetFlagStatus(CAN0, CAN_FLAG_REC) != RESET)
{ {
CAN_ClearFlag(CAN0, CAN_FLAG_REC); CAN_ClearFlag(CAN0, CAN_FLAG_REC);
// CANMSG = CAN_Get_CANxMSGy(CAN0); CAN_Receive_IT(CAN0, &CanBufList);
// CAN_Receive_IT(CAN0, &CAN_RecvMsg); Read_RingBuff(&CAN_RecvMsg);
if (can_rx_handler != NULL) if (can_rx_handler != NULL)
{ {
...@@ -31,9 +44,9 @@ static void can_recv_handler(void *msg) ...@@ -31,9 +44,9 @@ static void can_recv_handler(void *msg)
} }
/** /**
* @brief CAN初始? * @brief CAN初始?
* *
* @param config CAN初始结构体指? * @param config CAN初始结构体指?
* @return uint8_t 0成功 1失败 * @return uint8_t 0成功 1失败
*/ */
uint8_t rte_can_init(can_config_st_t *config) uint8_t rte_can_init(can_config_st_t *config)
...@@ -98,7 +111,7 @@ uint8_t rte_can_init(can_config_st_t *config) ...@@ -98,7 +111,7 @@ uint8_t rte_can_init(can_config_st_t *config)
/** /**
* @brief can反初始化 * @brief can反初始化
* @param CANx CAN0 ? CAN1 * @param CANx CAN0 ? CAN1
* *
* @return uint8_t 0成功 1失败 * @return uint8_t 0成功 1失败
*/ */
...@@ -124,10 +137,10 @@ uint8_t rte_can_deinit(CAN_CH ch) ...@@ -124,10 +137,10 @@ uint8_t rte_can_deinit(CAN_CH ch)
/** /**
* @brief 获取CAN是否BusOff * @brief 获取CAN是否BusOff
* @param CANx CAN0 ? CAN1 * @param CANx CAN0 ? CAN1
* *
* @return uint8_t 0 没有busoff * @return uint8_t 0 没有busoff
* 1 错误的操? 2 busoff * 1 错误的操? 2 busoff
*/ */
uint8_t get_can_busoff(CAN_CH ch) uint8_t get_can_busoff(CAN_CH ch)
{ {
...@@ -151,9 +164,9 @@ uint8_t get_can_busoff(CAN_CH ch) ...@@ -151,9 +164,9 @@ uint8_t get_can_busoff(CAN_CH ch)
} }
/** /**
* @brief 从busoff状态恢? * @brief 从busoff状态恢?
* *
* @param CANx CAN0 ? CAN1 * @param CANx CAN0 ? CAN1
* @return uint8_t 0成功 1失败 * @return uint8_t 0成功 1失败
*/ */
uint8_t reset_busoff(CAN_CH ch) uint8_t reset_busoff(CAN_CH ch)
...@@ -189,7 +202,7 @@ uint8_t reset_busoff(CAN_CH ch) ...@@ -189,7 +202,7 @@ uint8_t reset_busoff(CAN_CH ch)
return 0; return 0;
} }
/* 下面是一些例? 自己? /* 下面是一些例�? 自己�?
CAN_SendMsg.Id = 0x00aa0432; CAN_SendMsg.Id = 0x00aa0432;
CAN_SendMsg.IDE = CAN_Id_Extended; CAN_SendMsg.IDE = CAN_Id_Extended;
CAN_SendMsg.CacheType = CAN_CacheType_Tx; CAN_SendMsg.CacheType = CAN_CacheType_Tx;
......
...@@ -11,15 +11,12 @@ uint32_t RTE_SystemCoreClock; ...@@ -11,15 +11,12 @@ uint32_t RTE_SystemCoreClock;
extern uint32_t SystemCoreClock; extern uint32_t SystemCoreClock;
void RTE_CLOCK_Select_Start(void) void RTE_CLOCK_Select_Start(void)
{ {
////uint32_t msCnt;
#ifdef USED_FX_FCLK #ifdef USED_FX_FCLK
/* config clock */ CGC_Osc_Setting(OSC_OSCILLATOR,OSC_UNDER_10M,OSC_OSCILLATOR,OSC_NORMAL_POWER);
CGC_HSEConfig(OSC_OSCILLATOR,OSC_UNDER_10M);
CGC_PLL_Setting(PLL_SR_fMX,PLL_DIV_2,PLL_MUL_16); CGC_PLL_Setting(PLL_SR_fMX,PLL_DIV_2,PLL_MUL_16);
CGC_PLL_CFG_AS_FCLK(); CGC_PLL_CFG_AS_FCLK();
SystemCoreClockUpdate();
RTE_SystemCoreClock = SystemCoreClock;
delay_init(64000000); delay_init(64000000);
SystemCoreClock = 64000000UL; SystemCoreClock = 64000000UL;
#endif #endif
......
...@@ -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)
...@@ -24,6 +26,7 @@ void Sys_5ms_Tasks(void) ...@@ -24,6 +26,7 @@ void Sys_5ms_Tasks(void)
void Sys_10ms_Tasks(void) void Sys_10ms_Tasks(void)
{ {
Line_In_Debounce_Service(10u);
Key_Service(); Key_Service();
Key_Clear_Time(); Key_Clear_Time();
Key_TimeOut_Service(); Key_TimeOut_Service();
...@@ -38,6 +41,7 @@ void Sys_20ms_Tasks(void) ...@@ -38,6 +41,7 @@ void Sys_20ms_Tasks(void)
void Sys_50ms_Tasks(void) void Sys_50ms_Tasks(void)
{ {
Telltales_Management();
g_u8Cursor_Posittion = Menu_Get_Current_Cursor_Information(); g_u8Cursor_Posittion = Menu_Get_Current_Cursor_Information();
} }
......
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